[AArch64] Add support for Neoverse E1
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
207
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
213 -fno-elide-constructors @gol
214 -fno-enforce-eh-specs @gol
215 -fno-gnu-keywords @gol
216 -fno-implicit-templates @gol
217 -fno-implicit-inline-templates @gol
218 -fno-implement-inlines -fms-extensions @gol
219 -fnew-inheriting-ctors @gol
220 -fnew-ttp-matching @gol
221 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
222 -fno-optional-diags -fpermissive @gol
223 -fno-pretty-templates @gol
224 -frepo -fno-rtti -fsized-deallocation @gol
225 -ftemplate-backtrace-limit=@var{n} @gol
226 -ftemplate-depth=@var{n} @gol
227 -fno-threadsafe-statics -fuse-cxa-atexit @gol
228 -fno-weak -nostdinc++ @gol
229 -fvisibility-inlines-hidden @gol
230 -fvisibility-ms-compat @gol
231 -fext-numeric-literals @gol
232 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
233 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
234 -Wliteral-suffix @gol
235 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
236 -Wnamespaces -Wnarrowing @gol
237 -Wpessimizing-move -Wredundant-move @gol
238 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
239 -Wnon-virtual-dtor -Wreorder -Wregister @gol
240 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
241 -Wno-non-template-friend -Wold-style-cast @gol
242 -Woverloaded-virtual -Wno-pmf-conversions @gol
243 -Wno-class-conversion -Wno-terminate @gol
244 -Wsign-promo -Wvirtual-inheritance}
245
246 @item Objective-C and Objective-C++ Language Options
247 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
248 Objective-C and Objective-C++ Dialects}.
249 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
250 -fgnu-runtime -fnext-runtime @gol
251 -fno-nil-receivers @gol
252 -fobjc-abi-version=@var{n} @gol
253 -fobjc-call-cxx-cdtors @gol
254 -fobjc-direct-dispatch @gol
255 -fobjc-exceptions @gol
256 -fobjc-gc @gol
257 -fobjc-nilcheck @gol
258 -fobjc-std=objc1 @gol
259 -fno-local-ivars @gol
260 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
261 -freplace-objc-classes @gol
262 -fzero-link @gol
263 -gen-decls @gol
264 -Wassign-intercept @gol
265 -Wno-protocol -Wselector @gol
266 -Wstrict-selector-match @gol
267 -Wundeclared-selector}
268
269 @item Diagnostic Message Formatting Options
270 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
271 @gccoptlist{-fmessage-length=@var{n} @gol
272 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
273 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
274 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
275 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
276 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
277 -fdiagnostics-minimum-margin-width=@var{width} @gol
278 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
279 -fdiagnostics-show-template-tree -fno-elide-type @gol
280 -fno-show-column}
281
282 @item Warning Options
283 @xref{Warning Options,,Options to Request or Suppress Warnings}.
284 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
285 -pedantic-errors @gol
286 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
287 -Waggregate-return -Waligned-new @gol
288 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
289 -Walloca -Walloca-larger-than=@var{byte-size} @gol
290 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
291 -Wno-attributes -Wno-attribute-alias @gol
292 -Wbool-compare -Wbool-operation @gol
293 -Wno-builtin-declaration-mismatch @gol
294 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
295 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
296 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
297 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
298 -Wclobbered -Wcomment -Wconditionally-supported @gol
299 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
300 -Wdelete-incomplete @gol
301 -Wno-attribute-warning @gol
302 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
303 -Wdisabled-optimization @gol
304 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
305 -Wno-div-by-zero -Wdouble-promotion @gol
306 -Wduplicated-branches -Wduplicated-cond @gol
307 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
308 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
309 -Wfloat-equal -Wformat -Wformat=2 @gol
310 -Wno-format-contains-nul -Wno-format-extra-args @gol
311 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
312 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
313 -Wformat-y2k -Wframe-address @gol
314 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
315 -Wjump-misses-init @gol
316 -Whsa -Wif-not-aligned @gol
317 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
318 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
319 -Wimplicit-function-declaration -Wimplicit-int @gol
320 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
321 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
322 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
323 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
324 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
325 -Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol
326 -Wmissing-field-initializers -Wmissing-format-attribute @gol
327 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
328 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
329 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
330 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
331 -Woverride-init-side-effects -Woverlength-strings @gol
332 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
333 -Wparentheses -Wno-pedantic-ms-format @gol
334 -Wplacement-new -Wplacement-new=@var{n} @gol
335 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
336 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
337 -Wrestrict -Wno-return-local-addr @gol
338 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
339 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
340 -Wshift-overflow -Wshift-overflow=@var{n} @gol
341 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
342 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
343 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
344 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
345 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
346 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
347 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
348 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
349 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
350 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
351 -Wswitch-unreachable -Wsync-nand @gol
352 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
353 -Wtype-limits -Wundef @gol
354 -Wuninitialized -Wunknown-pragmas @gol
355 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
356 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
357 -Wunused-parameter -Wno-unused-result @gol
358 -Wunused-value -Wunused-variable @gol
359 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
360 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
361 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
362 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
363 -Wwrite-strings @gol
364 -Wzero-as-null-pointer-constant}
365
366 @item C and Objective-C-only Warning Options
367 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
368 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
369 -Wold-style-declaration -Wold-style-definition @gol
370 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
371 -Wdeclaration-after-statement -Wpointer-sign}
372
373 @item Debugging Options
374 @xref{Debugging Options,,Options for Debugging Your Program}.
375 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
376 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
377 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
378 -gas-loc-support -gno-as-loc-support @gol
379 -gas-locview-support -gno-as-locview-support @gol
380 -gcolumn-info -gno-column-info @gol
381 -gstatement-frontiers -gno-statement-frontiers @gol
382 -gvariable-location-views -gno-variable-location-views @gol
383 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
384 -ginline-points -gno-inline-points @gol
385 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
386 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
387 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
388 -fno-eliminate-unused-debug-types @gol
389 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
390 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
391 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
392 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
393 -fvar-tracking -fvar-tracking-assignments}
394
395 @item Optimization Options
396 @xref{Optimize Options,,Options that Control Optimization}.
397 @gccoptlist{-faggressive-loop-optimizations @gol
398 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
399 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
400 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
403 -fauto-inc-dec -fbranch-probabilities @gol
404 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
405 -fbtr-bb-exclusive -fcaller-saves @gol
406 -fcombine-stack-adjustments -fconserve-stack @gol
407 -fcompare-elim -fcprop-registers -fcrossjumping @gol
408 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
409 -fcx-limited-range @gol
410 -fdata-sections -fdce -fdelayed-branch @gol
411 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
412 -fdevirtualize-at-ltrans -fdse @gol
413 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
414 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
415 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
416 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
417 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
418 -fif-conversion2 -findirect-inlining @gol
419 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
420 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
421 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
422 -fipa-reference -fipa-reference-addressable @gol
423 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
424 -flive-patching=@var{level} @gol
425 -fira-region=@var{region} -fira-hoist-pressure @gol
426 -fira-loop-pressure -fno-ira-share-save-slots @gol
427 -fno-ira-share-spill-slots @gol
428 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
429 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
430 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
431 -floop-block -floop-interchange -floop-strip-mine @gol
432 -floop-unroll-and-jam -floop-nest-optimize @gol
433 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
434 -flto-partition=@var{alg} -fmerge-all-constants @gol
435 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
436 -fmove-loop-invariants -fno-branch-count-reg @gol
437 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
438 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
439 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
440 -fno-sched-spec -fno-signed-zeros @gol
441 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
442 -fomit-frame-pointer -foptimize-sibling-calls @gol
443 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
444 -fprefetch-loop-arrays @gol
445 -fprofile-correction @gol
446 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
447 -fprofile-reorder-functions @gol
448 -freciprocal-math -free -frename-registers -freorder-blocks @gol
449 -freorder-blocks-algorithm=@var{algorithm} @gol
450 -freorder-blocks-and-partition -freorder-functions @gol
451 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
452 -frounding-math -fsave-optimization-record @gol
453 -fsched2-use-superblocks -fsched-pressure @gol
454 -fsched-spec-load -fsched-spec-load-dangerous @gol
455 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
456 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
457 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
458 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
459 -fschedule-fusion @gol
460 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
461 -fselective-scheduling -fselective-scheduling2 @gol
462 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
463 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
464 -fsignaling-nans @gol
465 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
466 -fsplit-paths @gol
467 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
468 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
469 -fthread-jumps -ftracer -ftree-bit-ccp @gol
470 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
471 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
472 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
473 -ftree-loop-if-convert -ftree-loop-im @gol
474 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
475 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
476 -ftree-loop-vectorize @gol
477 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
478 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
479 -ftree-switch-conversion -ftree-tail-merge @gol
480 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
481 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
482 -funsafe-math-optimizations -funswitch-loops @gol
483 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
484 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
485 --param @var{name}=@var{value}
486 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
487
488 @item Program Instrumentation Options
489 @xref{Instrumentation Options,,Program Instrumentation Options}.
490 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
491 -fprofile-abs-path @gol
492 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
493 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
494 -fprofile-exclude-files=@var{regex} @gol
495 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
496 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
497 -fsanitize-undefined-trap-on-error -fbounds-check @gol
498 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
499 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
500 -fstack-protector-explicit -fstack-check @gol
501 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
502 -fno-stack-limit -fsplit-stack @gol
503 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
504 -fvtv-counts -fvtv-debug @gol
505 -finstrument-functions @gol
506 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
507 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
508
509 @item Preprocessor Options
510 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
511 @gccoptlist{-A@var{question}=@var{answer} @gol
512 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
513 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
514 -dD -dI -dM -dN -dU @gol
515 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
516 -fexec-charset=@var{charset} -fextended-identifiers @gol
517 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
518 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
519 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
520 -fwide-exec-charset=@var{charset} -fworking-directory @gol
521 -H -imacros @var{file} -include @var{file} @gol
522 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
523 -no-integrated-cpp -P -pthread -remap @gol
524 -traditional -traditional-cpp -trigraphs @gol
525 -U@var{macro} -undef @gol
526 -Wp,@var{option} -Xpreprocessor @var{option}}
527
528 @item Assembler Options
529 @xref{Assembler Options,,Passing Options to the Assembler}.
530 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
531
532 @item Linker Options
533 @xref{Link Options,,Options for Linking}.
534 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
535 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
536 -e @var{entry} --entry=@var{entry} @gol
537 -pie -pthread -r -rdynamic @gol
538 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
539 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
540 -shared -shared-libgcc -symbolic @gol
541 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
542 -u @var{symbol} -z @var{keyword}}
543
544 @item Directory Options
545 @xref{Directory Options,,Options for Directory Search}.
546 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
547 -idirafter @var{dir} @gol
548 -imacros @var{file} -imultilib @var{dir} @gol
549 -iplugindir=@var{dir} -iprefix @var{file} @gol
550 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
551 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
552 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
553 -nostdinc -nostdinc++ --sysroot=@var{dir}}
554
555 @item Code Generation Options
556 @xref{Code Gen Options,,Options for Code Generation Conventions}.
557 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
558 -ffixed-@var{reg} -fexceptions @gol
559 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
560 -fasynchronous-unwind-tables @gol
561 -fno-gnu-unique @gol
562 -finhibit-size-directive -fno-common -fno-ident @gol
563 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
564 -fno-jump-tables @gol
565 -frecord-gcc-switches @gol
566 -freg-struct-return -fshort-enums -fshort-wchar @gol
567 -fverbose-asm -fpack-struct[=@var{n}] @gol
568 -fleading-underscore -ftls-model=@var{model} @gol
569 -fstack-reuse=@var{reuse_level} @gol
570 -ftrampolines -ftrapv -fwrapv @gol
571 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
572 -fstrict-volatile-bitfields -fsync-libcalls}
573
574 @item Developer Options
575 @xref{Developer Options,,GCC Developer Options}.
576 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
577 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
578 -fdbg-cnt=@var{counter-value-list} @gol
579 -fdisable-ipa-@var{pass_name} @gol
580 -fdisable-rtl-@var{pass_name} @gol
581 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
582 -fdisable-tree-@var{pass_name} @gol
583 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
584 -fdump-debug -fdump-earlydebug @gol
585 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
586 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
587 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
588 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
589 -fdump-lang-all @gol
590 -fdump-lang-@var{switch} @gol
591 -fdump-lang-@var{switch}-@var{options} @gol
592 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
593 -fdump-passes @gol
594 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
595 -fdump-statistics @gol
596 -fdump-tree-all @gol
597 -fdump-tree-@var{switch} @gol
598 -fdump-tree-@var{switch}-@var{options} @gol
599 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
600 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
601 -fenable-@var{kind}-@var{pass} @gol
602 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
603 -fira-verbose=@var{n} @gol
604 -flto-report -flto-report-wpa -fmem-report-wpa @gol
605 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
606 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
607 -fprofile-report @gol
608 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
609 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
610 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
611 -fvar-tracking-assignments-toggle -gtoggle @gol
612 -print-file-name=@var{library} -print-libgcc-file-name @gol
613 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
614 -print-prog-name=@var{program} -print-search-dirs -Q @gol
615 -print-sysroot -print-sysroot-headers-suffix @gol
616 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
617
618 @item Machine-Dependent Options
619 @xref{Submodel Options,,Machine-Dependent Options}.
620 @c This list is ordered alphanumerically by subsection name.
621 @c Try and put the significant identifier (CPU or system) first,
622 @c so users have a clue at guessing where the ones they want will be.
623
624 @emph{AArch64 Options}
625 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
626 -mgeneral-regs-only @gol
627 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
628 -mstrict-align -mno-strict-align @gol
629 -momit-leaf-frame-pointer @gol
630 -mtls-dialect=desc -mtls-dialect=traditional @gol
631 -mtls-size=@var{size} @gol
632 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
633 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
634 -mpc-relative-literal-loads @gol
635 -msign-return-address=@var{scope} @gol
636 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}] @gol
637 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
638 -moverride=@var{string} -mverbose-cost-dump @gol
639 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
640 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
641
642 @emph{Adapteva Epiphany Options}
643 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
644 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
645 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
646 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
647 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
648 -msplit-vecmove-early -m1reg-@var{reg}}
649
650 @emph{AMD GCN Options}
651 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
652
653 @emph{ARC Options}
654 @gccoptlist{-mbarrel-shifter -mjli-always @gol
655 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
656 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
657 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
658 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
659 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
660 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
661 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
662 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
663 -mvolatile-cache -mtp-regno=@var{regno} @gol
664 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
665 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
666 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
667 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
668 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
669 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
670 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
671 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
672
673 @emph{ARM Options}
674 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
675 -mabi=@var{name} @gol
676 -mapcs-stack-check -mno-apcs-stack-check @gol
677 -mapcs-reentrant -mno-apcs-reentrant @gol
678 -msched-prolog -mno-sched-prolog @gol
679 -mlittle-endian -mbig-endian @gol
680 -mbe8 -mbe32 @gol
681 -mfloat-abi=@var{name} @gol
682 -mfp16-format=@var{name}
683 -mthumb-interwork -mno-thumb-interwork @gol
684 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
685 -mtune=@var{name} -mprint-tune-info @gol
686 -mstructure-size-boundary=@var{n} @gol
687 -mabort-on-noreturn @gol
688 -mlong-calls -mno-long-calls @gol
689 -msingle-pic-base -mno-single-pic-base @gol
690 -mpic-register=@var{reg} @gol
691 -mnop-fun-dllimport @gol
692 -mpoke-function-name @gol
693 -mthumb -marm -mflip-thumb @gol
694 -mtpcs-frame -mtpcs-leaf-frame @gol
695 -mcaller-super-interworking -mcallee-super-interworking @gol
696 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
697 -mword-relocations @gol
698 -mfix-cortex-m3-ldrd @gol
699 -munaligned-access @gol
700 -mneon-for-64bits @gol
701 -mslow-flash-data @gol
702 -masm-syntax-unified @gol
703 -mrestrict-it @gol
704 -mverbose-cost-dump @gol
705 -mpure-code @gol
706 -mcmse}
707
708 @emph{AVR Options}
709 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
710 -mbranch-cost=@var{cost} @gol
711 -mcall-prologues -mgas-isr-prologues -mint8 @gol
712 -mn_flash=@var{size} -mno-interrupts @gol
713 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
714 -mfract-convert-truncate @gol
715 -mshort-calls -nodevicelib @gol
716 -Waddr-space-convert -Wmisspelled-isr}
717
718 @emph{Blackfin Options}
719 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
720 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
721 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
722 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
723 -mno-id-shared-library -mshared-library-id=@var{n} @gol
724 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
725 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
726 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
727 -micplb}
728
729 @emph{C6X Options}
730 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
731 -msim -msdata=@var{sdata-type}}
732
733 @emph{CRIS Options}
734 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
735 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
736 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
737 -mstack-align -mdata-align -mconst-align @gol
738 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
739 -melf -maout -melinux -mlinux -sim -sim2 @gol
740 -mmul-bug-workaround -mno-mul-bug-workaround}
741
742 @emph{CR16 Options}
743 @gccoptlist{-mmac @gol
744 -mcr16cplus -mcr16c @gol
745 -msim -mint32 -mbit-ops
746 -mdata-model=@var{model}}
747
748 @emph{C-SKY Options}
749 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
750 -mbig-endian -EB -mlittle-endian -EL @gol
751 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
752 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
753 -mdsp -medsp -mvdsp @gol
754 -mdiv -msmart -mhigh-registers -manchor @gol
755 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
756 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
757
758 @emph{Darwin Options}
759 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
760 -arch_only -bind_at_load -bundle -bundle_loader @gol
761 -client_name -compatibility_version -current_version @gol
762 -dead_strip @gol
763 -dependency-file -dylib_file -dylinker_install_name @gol
764 -dynamic -dynamiclib -exported_symbols_list @gol
765 -filelist -flat_namespace -force_cpusubtype_ALL @gol
766 -force_flat_namespace -headerpad_max_install_names @gol
767 -iframework @gol
768 -image_base -init -install_name -keep_private_externs @gol
769 -multi_module -multiply_defined -multiply_defined_unused @gol
770 -noall_load -no_dead_strip_inits_and_terms @gol
771 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
772 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
773 -private_bundle -read_only_relocs -sectalign @gol
774 -sectobjectsymbols -whyload -seg1addr @gol
775 -sectcreate -sectobjectsymbols -sectorder @gol
776 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
777 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
778 -segprot -segs_read_only_addr -segs_read_write_addr @gol
779 -single_module -static -sub_library -sub_umbrella @gol
780 -twolevel_namespace -umbrella -undefined @gol
781 -unexported_symbols_list -weak_reference_mismatches @gol
782 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
783 -mkernel -mone-byte-bool}
784
785 @emph{DEC Alpha Options}
786 @gccoptlist{-mno-fp-regs -msoft-float @gol
787 -mieee -mieee-with-inexact -mieee-conformant @gol
788 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
789 -mtrap-precision=@var{mode} -mbuild-constants @gol
790 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
791 -mbwx -mmax -mfix -mcix @gol
792 -mfloat-vax -mfloat-ieee @gol
793 -mexplicit-relocs -msmall-data -mlarge-data @gol
794 -msmall-text -mlarge-text @gol
795 -mmemory-latency=@var{time}}
796
797 @emph{FR30 Options}
798 @gccoptlist{-msmall-model -mno-lsim}
799
800 @emph{FT32 Options}
801 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
802
803 @emph{FRV Options}
804 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
805 -mhard-float -msoft-float @gol
806 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
807 -mdouble -mno-double @gol
808 -mmedia -mno-media -mmuladd -mno-muladd @gol
809 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
810 -mlinked-fp -mlong-calls -malign-labels @gol
811 -mlibrary-pic -macc-4 -macc-8 @gol
812 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
813 -moptimize-membar -mno-optimize-membar @gol
814 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
815 -mvliw-branch -mno-vliw-branch @gol
816 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
817 -mno-nested-cond-exec -mtomcat-stats @gol
818 -mTLS -mtls @gol
819 -mcpu=@var{cpu}}
820
821 @emph{GNU/Linux Options}
822 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
823 -tno-android-cc -tno-android-ld}
824
825 @emph{H8/300 Options}
826 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
827
828 @emph{HPPA Options}
829 @gccoptlist{-march=@var{architecture-type} @gol
830 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
831 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
832 -mfixed-range=@var{register-range} @gol
833 -mjump-in-delay -mlinker-opt -mlong-calls @gol
834 -mlong-load-store -mno-disable-fpregs @gol
835 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
836 -mno-jump-in-delay -mno-long-load-store @gol
837 -mno-portable-runtime -mno-soft-float @gol
838 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
839 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
840 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
841 -munix=@var{unix-std} -nolibdld -static -threads}
842
843 @emph{IA-64 Options}
844 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
845 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
846 -mconstant-gp -mauto-pic -mfused-madd @gol
847 -minline-float-divide-min-latency @gol
848 -minline-float-divide-max-throughput @gol
849 -mno-inline-float-divide @gol
850 -minline-int-divide-min-latency @gol
851 -minline-int-divide-max-throughput @gol
852 -mno-inline-int-divide @gol
853 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
854 -mno-inline-sqrt @gol
855 -mdwarf2-asm -mearly-stop-bits @gol
856 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
857 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
858 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
859 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
860 -msched-spec-ldc -msched-spec-control-ldc @gol
861 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
862 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
863 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
864 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
865
866 @emph{LM32 Options}
867 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
868 -msign-extend-enabled -muser-enabled}
869
870 @emph{M32R/D Options}
871 @gccoptlist{-m32r2 -m32rx -m32r @gol
872 -mdebug @gol
873 -malign-loops -mno-align-loops @gol
874 -missue-rate=@var{number} @gol
875 -mbranch-cost=@var{number} @gol
876 -mmodel=@var{code-size-model-type} @gol
877 -msdata=@var{sdata-type} @gol
878 -mno-flush-func -mflush-func=@var{name} @gol
879 -mno-flush-trap -mflush-trap=@var{number} @gol
880 -G @var{num}}
881
882 @emph{M32C Options}
883 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
884
885 @emph{M680x0 Options}
886 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
887 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
888 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
889 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
890 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
891 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
892 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
893 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
894 -mxgot -mno-xgot -mlong-jump-table-offsets}
895
896 @emph{MCore Options}
897 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
898 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
899 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
900 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
901 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
902
903 @emph{MeP Options}
904 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
905 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
906 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
907 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
908 -mtiny=@var{n}}
909
910 @emph{MicroBlaze Options}
911 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
912 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
913 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
914 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
915 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
916 -mpic-data-is-text-relative}
917
918 @emph{MIPS Options}
919 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
920 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
921 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
922 -mips16 -mno-mips16 -mflip-mips16 @gol
923 -minterlink-compressed -mno-interlink-compressed @gol
924 -minterlink-mips16 -mno-interlink-mips16 @gol
925 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
926 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
927 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
928 -mno-float -msingle-float -mdouble-float @gol
929 -modd-spreg -mno-odd-spreg @gol
930 -mabs=@var{mode} -mnan=@var{encoding} @gol
931 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
932 -mmcu -mmno-mcu @gol
933 -meva -mno-eva @gol
934 -mvirt -mno-virt @gol
935 -mxpa -mno-xpa @gol
936 -mcrc -mno-crc @gol
937 -mginv -mno-ginv @gol
938 -mmicromips -mno-micromips @gol
939 -mmsa -mno-msa @gol
940 -mloongson-mmi -mno-loongson-mmi @gol
941 -mloongson-ext -mno-loongson-ext @gol
942 -mloongson-ext2 -mno-loongson-ext2 @gol
943 -mfpu=@var{fpu-type} @gol
944 -msmartmips -mno-smartmips @gol
945 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
946 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
947 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
948 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
949 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
950 -membedded-data -mno-embedded-data @gol
951 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
952 -mcode-readable=@var{setting} @gol
953 -msplit-addresses -mno-split-addresses @gol
954 -mexplicit-relocs -mno-explicit-relocs @gol
955 -mcheck-zero-division -mno-check-zero-division @gol
956 -mdivide-traps -mdivide-breaks @gol
957 -mload-store-pairs -mno-load-store-pairs @gol
958 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
959 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
960 -mfix-24k -mno-fix-24k @gol
961 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
962 -mfix-r5900 -mno-fix-r5900 @gol
963 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
964 -mfix-vr4120 -mno-fix-vr4120 @gol
965 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
966 -mflush-func=@var{func} -mno-flush-func @gol
967 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
968 -mcompact-branches=@var{policy} @gol
969 -mfp-exceptions -mno-fp-exceptions @gol
970 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
971 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
972 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
973 -mframe-header-opt -mno-frame-header-opt}
974
975 @emph{MMIX Options}
976 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
977 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
978 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
979 -mno-base-addresses -msingle-exit -mno-single-exit}
980
981 @emph{MN10300 Options}
982 @gccoptlist{-mmult-bug -mno-mult-bug @gol
983 -mno-am33 -mam33 -mam33-2 -mam34 @gol
984 -mtune=@var{cpu-type} @gol
985 -mreturn-pointer-on-d0 @gol
986 -mno-crt0 -mrelax -mliw -msetlb}
987
988 @emph{Moxie Options}
989 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
990
991 @emph{MSP430 Options}
992 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
993 -mwarn-mcu @gol
994 -mcode-region= -mdata-region= @gol
995 -msilicon-errata= -msilicon-errata-warn= @gol
996 -mhwmult= -minrt}
997
998 @emph{NDS32 Options}
999 @gccoptlist{-mbig-endian -mlittle-endian @gol
1000 -mreduced-regs -mfull-regs @gol
1001 -mcmov -mno-cmov @gol
1002 -mext-perf -mno-ext-perf @gol
1003 -mext-perf2 -mno-ext-perf2 @gol
1004 -mext-string -mno-ext-string @gol
1005 -mv3push -mno-v3push @gol
1006 -m16bit -mno-16bit @gol
1007 -misr-vector-size=@var{num} @gol
1008 -mcache-block-size=@var{num} @gol
1009 -march=@var{arch} @gol
1010 -mcmodel=@var{code-model} @gol
1011 -mctor-dtor -mrelax}
1012
1013 @emph{Nios II Options}
1014 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1015 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1016 -mel -meb @gol
1017 -mno-bypass-cache -mbypass-cache @gol
1018 -mno-cache-volatile -mcache-volatile @gol
1019 -mno-fast-sw-div -mfast-sw-div @gol
1020 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1021 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1022 -mcustom-fpu-cfg=@var{name} @gol
1023 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1024 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1025
1026 @emph{Nvidia PTX Options}
1027 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1028
1029 @emph{OpenRISC Options}
1030 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1031 -msoft-mul -msoft-div @gol
1032 -mcmov -mror -msext -msfimm -mshftimm}
1033
1034 @emph{PDP-11 Options}
1035 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1036 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1037 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1038
1039 @emph{picoChip Options}
1040 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1041 -msymbol-as-address -mno-inefficient-warnings}
1042
1043 @emph{PowerPC Options}
1044 See RS/6000 and PowerPC Options.
1045
1046 @emph{RISC-V Options}
1047 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1048 -mplt -mno-plt @gol
1049 -mabi=@var{ABI-string} @gol
1050 -mfdiv -mno-fdiv @gol
1051 -mdiv -mno-div @gol
1052 -march=@var{ISA-string} @gol
1053 -mtune=@var{processor-string} @gol
1054 -mpreferred-stack-boundary=@var{num} @gol
1055 -msmall-data-limit=@var{N-bytes} @gol
1056 -msave-restore -mno-save-restore @gol
1057 -mstrict-align -mno-strict-align @gol
1058 -mcmodel=medlow -mcmodel=medany @gol
1059 -mexplicit-relocs -mno-explicit-relocs @gol
1060 -mrelax -mno-relax}
1061
1062 @emph{RL78 Options}
1063 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1064 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1065 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1066
1067 @emph{RS/6000 and PowerPC Options}
1068 @gccoptlist{-mcpu=@var{cpu-type} @gol
1069 -mtune=@var{cpu-type} @gol
1070 -mcmodel=@var{code-model} @gol
1071 -mpowerpc64 @gol
1072 -maltivec -mno-altivec @gol
1073 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1074 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1075 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1076 -mfprnd -mno-fprnd @gol
1077 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1078 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1079 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1080 -malign-power -malign-natural @gol
1081 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1082 -mupdate -mno-update @gol
1083 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1084 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1085 -mstrict-align -mno-strict-align -mrelocatable @gol
1086 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1087 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1088 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1089 -mprioritize-restricted-insns=@var{priority} @gol
1090 -msched-costly-dep=@var{dependence_type} @gol
1091 -minsert-sched-nops=@var{scheme} @gol
1092 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1093 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1094 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1095 -mtraceback=@var{traceback_type} @gol
1096 -maix-struct-return -msvr4-struct-return @gol
1097 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1098 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1099 -mblock-move-inline-limit=@var{num} @gol
1100 -mblock-compare-inline-limit=@var{num} @gol
1101 -mblock-compare-inline-loop-limit=@var{num} @gol
1102 -mstring-compare-inline-limit=@var{num} @gol
1103 -misel -mno-isel @gol
1104 -mvrsave -mno-vrsave @gol
1105 -mmulhw -mno-mulhw @gol
1106 -mdlmzb -mno-dlmzb @gol
1107 -mprototype -mno-prototype @gol
1108 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1109 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1110 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1111 -mno-recip-precision @gol
1112 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1113 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1114 -msave-toc-indirect -mno-save-toc-indirect @gol
1115 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1116 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1117 -mquad-memory -mno-quad-memory @gol
1118 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1119 -mcompat-align-parm -mno-compat-align-parm @gol
1120 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1121 -mgnu-attribute -mno-gnu-attribute @gol
1122 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1123 -mstack-protector-guard-offset=@var{offset}}
1124
1125 @emph{RX Options}
1126 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1127 -mcpu=@gol
1128 -mbig-endian-data -mlittle-endian-data @gol
1129 -msmall-data @gol
1130 -msim -mno-sim@gol
1131 -mas100-syntax -mno-as100-syntax@gol
1132 -mrelax@gol
1133 -mmax-constant-size=@gol
1134 -mint-register=@gol
1135 -mpid@gol
1136 -mallow-string-insns -mno-allow-string-insns@gol
1137 -mjsr@gol
1138 -mno-warn-multiple-fast-interrupts@gol
1139 -msave-acc-in-interrupts}
1140
1141 @emph{S/390 and zSeries Options}
1142 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1143 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1144 -mlong-double-64 -mlong-double-128 @gol
1145 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1146 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1147 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1148 -mhtm -mvx -mzvector @gol
1149 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1150 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1151 -mhotpatch=@var{halfwords},@var{halfwords}}
1152
1153 @emph{Score Options}
1154 @gccoptlist{-meb -mel @gol
1155 -mnhwloop @gol
1156 -muls @gol
1157 -mmac @gol
1158 -mscore5 -mscore5u -mscore7 -mscore7d}
1159
1160 @emph{SH Options}
1161 @gccoptlist{-m1 -m2 -m2e @gol
1162 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1163 -m3 -m3e @gol
1164 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1165 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1166 -mb -ml -mdalign -mrelax @gol
1167 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1168 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1169 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1170 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1171 -maccumulate-outgoing-args @gol
1172 -matomic-model=@var{atomic-model} @gol
1173 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1174 -mcbranch-force-delay-slot @gol
1175 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1176 -mpretend-cmove -mtas}
1177
1178 @emph{Solaris 2 Options}
1179 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1180 -pthreads}
1181
1182 @emph{SPARC Options}
1183 @gccoptlist{-mcpu=@var{cpu-type} @gol
1184 -mtune=@var{cpu-type} @gol
1185 -mcmodel=@var{code-model} @gol
1186 -mmemory-model=@var{mem-model} @gol
1187 -m32 -m64 -mapp-regs -mno-app-regs @gol
1188 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1189 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1190 -mhard-quad-float -msoft-quad-float @gol
1191 -mstack-bias -mno-stack-bias @gol
1192 -mstd-struct-return -mno-std-struct-return @gol
1193 -munaligned-doubles -mno-unaligned-doubles @gol
1194 -muser-mode -mno-user-mode @gol
1195 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1196 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1197 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1198 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1199 -mpopc -mno-popc -msubxc -mno-subxc @gol
1200 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1201 -mlra -mno-lra}
1202
1203 @emph{SPU Options}
1204 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1205 -msafe-dma -munsafe-dma @gol
1206 -mbranch-hints @gol
1207 -msmall-mem -mlarge-mem -mstdmain @gol
1208 -mfixed-range=@var{register-range} @gol
1209 -mea32 -mea64 @gol
1210 -maddress-space-conversion -mno-address-space-conversion @gol
1211 -mcache-size=@var{cache-size} @gol
1212 -matomic-updates -mno-atomic-updates}
1213
1214 @emph{System V Options}
1215 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1216
1217 @emph{TILE-Gx Options}
1218 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1219 -mcmodel=@var{code-model}}
1220
1221 @emph{TILEPro Options}
1222 @gccoptlist{-mcpu=@var{cpu} -m32}
1223
1224 @emph{V850 Options}
1225 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1226 -mprolog-function -mno-prolog-function -mspace @gol
1227 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1228 -mapp-regs -mno-app-regs @gol
1229 -mdisable-callt -mno-disable-callt @gol
1230 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1231 -mv850e -mv850 -mv850e3v5 @gol
1232 -mloop @gol
1233 -mrelax @gol
1234 -mlong-jumps @gol
1235 -msoft-float @gol
1236 -mhard-float @gol
1237 -mgcc-abi @gol
1238 -mrh850-abi @gol
1239 -mbig-switch}
1240
1241 @emph{VAX Options}
1242 @gccoptlist{-mg -mgnu -munix}
1243
1244 @emph{Visium Options}
1245 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1246 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1247
1248 @emph{VMS Options}
1249 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1250 -mpointer-size=@var{size}}
1251
1252 @emph{VxWorks Options}
1253 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1254 -Xbind-lazy -Xbind-now}
1255
1256 @emph{x86 Options}
1257 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1258 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1259 -mfpmath=@var{unit} @gol
1260 -masm=@var{dialect} -mno-fancy-math-387 @gol
1261 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1262 -mno-wide-multiply -mrtd -malign-double @gol
1263 -mpreferred-stack-boundary=@var{num} @gol
1264 -mincoming-stack-boundary=@var{num} @gol
1265 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1266 -mrecip -mrecip=@var{opt} @gol
1267 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1268 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1269 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1270 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1271 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1272 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1273 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1274 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1275 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1276 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 @gol
1277 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1278 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1279 -mrdseed -msgx @gol
1280 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1281 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1282 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1283 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1284 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1285 -mregparm=@var{num} -msseregparm @gol
1286 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1287 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1288 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1289 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1290 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1291 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1292 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1293 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1294 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1295 -mstack-protector-guard-reg=@var{reg} @gol
1296 -mstack-protector-guard-offset=@var{offset} @gol
1297 -mstack-protector-guard-symbol=@var{symbol} @gol
1298 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1299 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1300 -mindirect-branch-register}
1301
1302 @emph{x86 Windows Options}
1303 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1304 -mnop-fun-dllimport -mthread @gol
1305 -municode -mwin32 -mwindows -fno-set-stack-executable}
1306
1307 @emph{Xstormy16 Options}
1308 @gccoptlist{-msim}
1309
1310 @emph{Xtensa Options}
1311 @gccoptlist{-mconst16 -mno-const16 @gol
1312 -mfused-madd -mno-fused-madd @gol
1313 -mforce-no-pic @gol
1314 -mserialize-volatile -mno-serialize-volatile @gol
1315 -mtext-section-literals -mno-text-section-literals @gol
1316 -mauto-litpools -mno-auto-litpools @gol
1317 -mtarget-align -mno-target-align @gol
1318 -mlongcalls -mno-longcalls}
1319
1320 @emph{zSeries Options}
1321 See S/390 and zSeries Options.
1322 @end table
1323
1324
1325 @node Overall Options
1326 @section Options Controlling the Kind of Output
1327
1328 Compilation can involve up to four stages: preprocessing, compilation
1329 proper, assembly and linking, always in that order. GCC is capable of
1330 preprocessing and compiling several files either into several
1331 assembler input files, or into one assembler input file; then each
1332 assembler input file produces an object file, and linking combines all
1333 the object files (those newly compiled, and those specified as input)
1334 into an executable file.
1335
1336 @cindex file name suffix
1337 For any given input file, the file name suffix determines what kind of
1338 compilation is done:
1339
1340 @table @gcctabopt
1341 @item @var{file}.c
1342 C source code that must be preprocessed.
1343
1344 @item @var{file}.i
1345 C source code that should not be preprocessed.
1346
1347 @item @var{file}.ii
1348 C++ source code that should not be preprocessed.
1349
1350 @item @var{file}.m
1351 Objective-C source code. Note that you must link with the @file{libobjc}
1352 library to make an Objective-C program work.
1353
1354 @item @var{file}.mi
1355 Objective-C source code that should not be preprocessed.
1356
1357 @item @var{file}.mm
1358 @itemx @var{file}.M
1359 Objective-C++ source code. Note that you must link with the @file{libobjc}
1360 library to make an Objective-C++ program work. Note that @samp{.M} refers
1361 to a literal capital M@.
1362
1363 @item @var{file}.mii
1364 Objective-C++ source code that should not be preprocessed.
1365
1366 @item @var{file}.h
1367 C, C++, Objective-C or Objective-C++ header file to be turned into a
1368 precompiled header (default), or C, C++ header file to be turned into an
1369 Ada spec (via the @option{-fdump-ada-spec} switch).
1370
1371 @item @var{file}.cc
1372 @itemx @var{file}.cp
1373 @itemx @var{file}.cxx
1374 @itemx @var{file}.cpp
1375 @itemx @var{file}.CPP
1376 @itemx @var{file}.c++
1377 @itemx @var{file}.C
1378 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1379 the last two letters must both be literally @samp{x}. Likewise,
1380 @samp{.C} refers to a literal capital C@.
1381
1382 @item @var{file}.mm
1383 @itemx @var{file}.M
1384 Objective-C++ source code that must be preprocessed.
1385
1386 @item @var{file}.mii
1387 Objective-C++ source code that should not be preprocessed.
1388
1389 @item @var{file}.hh
1390 @itemx @var{file}.H
1391 @itemx @var{file}.hp
1392 @itemx @var{file}.hxx
1393 @itemx @var{file}.hpp
1394 @itemx @var{file}.HPP
1395 @itemx @var{file}.h++
1396 @itemx @var{file}.tcc
1397 C++ header file to be turned into a precompiled header or Ada spec.
1398
1399 @item @var{file}.f
1400 @itemx @var{file}.for
1401 @itemx @var{file}.ftn
1402 Fixed form Fortran source code that should not be preprocessed.
1403
1404 @item @var{file}.F
1405 @itemx @var{file}.FOR
1406 @itemx @var{file}.fpp
1407 @itemx @var{file}.FPP
1408 @itemx @var{file}.FTN
1409 Fixed form Fortran source code that must be preprocessed (with the traditional
1410 preprocessor).
1411
1412 @item @var{file}.f90
1413 @itemx @var{file}.f95
1414 @itemx @var{file}.f03
1415 @itemx @var{file}.f08
1416 Free form Fortran source code that should not be preprocessed.
1417
1418 @item @var{file}.F90
1419 @itemx @var{file}.F95
1420 @itemx @var{file}.F03
1421 @itemx @var{file}.F08
1422 Free form Fortran source code that must be preprocessed (with the
1423 traditional preprocessor).
1424
1425 @item @var{file}.go
1426 Go source code.
1427
1428 @item @var{file}.brig
1429 BRIG files (binary representation of HSAIL).
1430
1431 @item @var{file}.d
1432 D source code.
1433
1434 @item @var{file}.di
1435 D interface file.
1436
1437 @item @var{file}.dd
1438 D documentation code (Ddoc).
1439
1440 @item @var{file}.ads
1441 Ada source code file that contains a library unit declaration (a
1442 declaration of a package, subprogram, or generic, or a generic
1443 instantiation), or a library unit renaming declaration (a package,
1444 generic, or subprogram renaming declaration). Such files are also
1445 called @dfn{specs}.
1446
1447 @item @var{file}.adb
1448 Ada source code file containing a library unit body (a subprogram or
1449 package body). Such files are also called @dfn{bodies}.
1450
1451 @c GCC also knows about some suffixes for languages not yet included:
1452 @c Ratfor:
1453 @c @var{file}.r
1454
1455 @item @var{file}.s
1456 Assembler code.
1457
1458 @item @var{file}.S
1459 @itemx @var{file}.sx
1460 Assembler code that must be preprocessed.
1461
1462 @item @var{other}
1463 An object file to be fed straight into linking.
1464 Any file name with no recognized suffix is treated this way.
1465 @end table
1466
1467 @opindex x
1468 You can specify the input language explicitly with the @option{-x} option:
1469
1470 @table @gcctabopt
1471 @item -x @var{language}
1472 Specify explicitly the @var{language} for the following input files
1473 (rather than letting the compiler choose a default based on the file
1474 name suffix). This option applies to all following input files until
1475 the next @option{-x} option. Possible values for @var{language} are:
1476 @smallexample
1477 c c-header cpp-output
1478 c++ c++-header c++-cpp-output
1479 objective-c objective-c-header objective-c-cpp-output
1480 objective-c++ objective-c++-header objective-c++-cpp-output
1481 assembler assembler-with-cpp
1482 ada
1483 d
1484 f77 f77-cpp-input f95 f95-cpp-input
1485 go
1486 brig
1487 @end smallexample
1488
1489 @item -x none
1490 Turn off any specification of a language, so that subsequent files are
1491 handled according to their file name suffixes (as they are if @option{-x}
1492 has not been used at all).
1493 @end table
1494
1495 If you only want some of the stages of compilation, you can use
1496 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1497 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1498 @command{gcc} is to stop. Note that some combinations (for example,
1499 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1500
1501 @table @gcctabopt
1502 @item -c
1503 @opindex c
1504 Compile or assemble the source files, but do not link. The linking
1505 stage simply is not done. The ultimate output is in the form of an
1506 object file for each source file.
1507
1508 By default, the object file name for a source file is made by replacing
1509 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1510
1511 Unrecognized input files, not requiring compilation or assembly, are
1512 ignored.
1513
1514 @item -S
1515 @opindex S
1516 Stop after the stage of compilation proper; do not assemble. The output
1517 is in the form of an assembler code file for each non-assembler input
1518 file specified.
1519
1520 By default, the assembler file name for a source file is made by
1521 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1522
1523 Input files that don't require compilation are ignored.
1524
1525 @item -E
1526 @opindex E
1527 Stop after the preprocessing stage; do not run the compiler proper. The
1528 output is in the form of preprocessed source code, which is sent to the
1529 standard output.
1530
1531 Input files that don't require preprocessing are ignored.
1532
1533 @cindex output file option
1534 @item -o @var{file}
1535 @opindex o
1536 Place output in file @var{file}. This applies to whatever
1537 sort of output is being produced, whether it be an executable file,
1538 an object file, an assembler file or preprocessed C code.
1539
1540 If @option{-o} is not specified, the default is to put an executable
1541 file in @file{a.out}, the object file for
1542 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1543 assembler file in @file{@var{source}.s}, a precompiled header file in
1544 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1545 standard output.
1546
1547 @item -v
1548 @opindex v
1549 Print (on standard error output) the commands executed to run the stages
1550 of compilation. Also print the version number of the compiler driver
1551 program and of the preprocessor and the compiler proper.
1552
1553 @item -###
1554 @opindex ###
1555 Like @option{-v} except the commands are not executed and arguments
1556 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1557 This is useful for shell scripts to capture the driver-generated command lines.
1558
1559 @item --help
1560 @opindex help
1561 Print (on the standard output) a description of the command-line options
1562 understood by @command{gcc}. If the @option{-v} option is also specified
1563 then @option{--help} is also passed on to the various processes
1564 invoked by @command{gcc}, so that they can display the command-line options
1565 they accept. If the @option{-Wextra} option has also been specified
1566 (prior to the @option{--help} option), then command-line options that
1567 have no documentation associated with them are also displayed.
1568
1569 @item --target-help
1570 @opindex target-help
1571 Print (on the standard output) a description of target-specific command-line
1572 options for each tool. For some targets extra target-specific
1573 information may also be printed.
1574
1575 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1576 Print (on the standard output) a description of the command-line
1577 options understood by the compiler that fit into all specified classes
1578 and qualifiers. These are the supported classes:
1579
1580 @table @asis
1581 @item @samp{optimizers}
1582 Display all of the optimization options supported by the
1583 compiler.
1584
1585 @item @samp{warnings}
1586 Display all of the options controlling warning messages
1587 produced by the compiler.
1588
1589 @item @samp{target}
1590 Display target-specific options. Unlike the
1591 @option{--target-help} option however, target-specific options of the
1592 linker and assembler are not displayed. This is because those
1593 tools do not currently support the extended @option{--help=} syntax.
1594
1595 @item @samp{params}
1596 Display the values recognized by the @option{--param}
1597 option.
1598
1599 @item @var{language}
1600 Display the options supported for @var{language}, where
1601 @var{language} is the name of one of the languages supported in this
1602 version of GCC@.
1603
1604 @item @samp{common}
1605 Display the options that are common to all languages.
1606 @end table
1607
1608 These are the supported qualifiers:
1609
1610 @table @asis
1611 @item @samp{undocumented}
1612 Display only those options that are undocumented.
1613
1614 @item @samp{joined}
1615 Display options taking an argument that appears after an equal
1616 sign in the same continuous piece of text, such as:
1617 @samp{--help=target}.
1618
1619 @item @samp{separate}
1620 Display options taking an argument that appears as a separate word
1621 following the original option, such as: @samp{-o output-file}.
1622 @end table
1623
1624 Thus for example to display all the undocumented target-specific
1625 switches supported by the compiler, use:
1626
1627 @smallexample
1628 --help=target,undocumented
1629 @end smallexample
1630
1631 The sense of a qualifier can be inverted by prefixing it with the
1632 @samp{^} character, so for example to display all binary warning
1633 options (i.e., ones that are either on or off and that do not take an
1634 argument) that have a description, use:
1635
1636 @smallexample
1637 --help=warnings,^joined,^undocumented
1638 @end smallexample
1639
1640 The argument to @option{--help=} should not consist solely of inverted
1641 qualifiers.
1642
1643 Combining several classes is possible, although this usually
1644 restricts the output so much that there is nothing to display. One
1645 case where it does work, however, is when one of the classes is
1646 @var{target}. For example, to display all the target-specific
1647 optimization options, use:
1648
1649 @smallexample
1650 --help=target,optimizers
1651 @end smallexample
1652
1653 The @option{--help=} option can be repeated on the command line. Each
1654 successive use displays its requested class of options, skipping
1655 those that have already been displayed. If @option{--help} is also
1656 specified anywhere on the command line then this takes precedence
1657 over any @option{--help=} option.
1658
1659 If the @option{-Q} option appears on the command line before the
1660 @option{--help=} option, then the descriptive text displayed by
1661 @option{--help=} is changed. Instead of describing the displayed
1662 options, an indication is given as to whether the option is enabled,
1663 disabled or set to a specific value (assuming that the compiler
1664 knows this at the point where the @option{--help=} option is used).
1665
1666 Here is a truncated example from the ARM port of @command{gcc}:
1667
1668 @smallexample
1669 % gcc -Q -mabi=2 --help=target -c
1670 The following options are target specific:
1671 -mabi= 2
1672 -mabort-on-noreturn [disabled]
1673 -mapcs [disabled]
1674 @end smallexample
1675
1676 The output is sensitive to the effects of previous command-line
1677 options, so for example it is possible to find out which optimizations
1678 are enabled at @option{-O2} by using:
1679
1680 @smallexample
1681 -Q -O2 --help=optimizers
1682 @end smallexample
1683
1684 Alternatively you can discover which binary optimizations are enabled
1685 by @option{-O3} by using:
1686
1687 @smallexample
1688 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1689 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1690 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1691 @end smallexample
1692
1693 @item --version
1694 @opindex version
1695 Display the version number and copyrights of the invoked GCC@.
1696
1697 @item -pass-exit-codes
1698 @opindex pass-exit-codes
1699 Normally the @command{gcc} program exits with the code of 1 if any
1700 phase of the compiler returns a non-success return code. If you specify
1701 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1702 the numerically highest error produced by any phase returning an error
1703 indication. The C, C++, and Fortran front ends return 4 if an internal
1704 compiler error is encountered.
1705
1706 @item -pipe
1707 @opindex pipe
1708 Use pipes rather than temporary files for communication between the
1709 various stages of compilation. This fails to work on some systems where
1710 the assembler is unable to read from a pipe; but the GNU assembler has
1711 no trouble.
1712
1713 @item -specs=@var{file}
1714 @opindex specs
1715 Process @var{file} after the compiler reads in the standard @file{specs}
1716 file, in order to override the defaults which the @command{gcc} driver
1717 program uses when determining what switches to pass to @command{cc1},
1718 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1719 @option{-specs=@var{file}} can be specified on the command line, and they
1720 are processed in order, from left to right. @xref{Spec Files}, for
1721 information about the format of the @var{file}.
1722
1723 @item -wrapper
1724 @opindex wrapper
1725 Invoke all subcommands under a wrapper program. The name of the
1726 wrapper program and its parameters are passed as a comma separated
1727 list.
1728
1729 @smallexample
1730 gcc -c t.c -wrapper gdb,--args
1731 @end smallexample
1732
1733 @noindent
1734 This invokes all subprograms of @command{gcc} under
1735 @samp{gdb --args}, thus the invocation of @command{cc1} is
1736 @samp{gdb --args cc1 @dots{}}.
1737
1738 @item -ffile-prefix-map=@var{old}=@var{new}
1739 @opindex ffile-prefix-map
1740 When compiling files residing in directory @file{@var{old}}, record
1741 any references to them in the result of the compilation as if the
1742 files resided in directory @file{@var{new}} instead. Specifying this
1743 option is equivalent to specifying all the individual
1744 @option{-f*-prefix-map} options. This can be used to make reproducible
1745 builds that are location independent. See also
1746 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1747
1748 @item -fplugin=@var{name}.so
1749 @opindex fplugin
1750 Load the plugin code in file @var{name}.so, assumed to be a
1751 shared object to be dlopen'd by the compiler. The base name of
1752 the shared object file is used to identify the plugin for the
1753 purposes of argument parsing (See
1754 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1755 Each plugin should define the callback functions specified in the
1756 Plugins API.
1757
1758 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1759 @opindex fplugin-arg
1760 Define an argument called @var{key} with a value of @var{value}
1761 for the plugin called @var{name}.
1762
1763 @item -fdump-ada-spec@r{[}-slim@r{]}
1764 @opindex fdump-ada-spec
1765 For C and C++ source and include files, generate corresponding Ada specs.
1766 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1767 GNAT User's Guide}, which provides detailed documentation on this feature.
1768
1769 @item -fada-spec-parent=@var{unit}
1770 @opindex fada-spec-parent
1771 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1772 Ada specs as child units of parent @var{unit}.
1773
1774 @item -fdump-go-spec=@var{file}
1775 @opindex fdump-go-spec
1776 For input files in any language, generate corresponding Go
1777 declarations in @var{file}. This generates Go @code{const},
1778 @code{type}, @code{var}, and @code{func} declarations which may be a
1779 useful way to start writing a Go interface to code written in some
1780 other language.
1781
1782 @include @value{srcdir}/../libiberty/at-file.texi
1783 @end table
1784
1785 @node Invoking G++
1786 @section Compiling C++ Programs
1787
1788 @cindex suffixes for C++ source
1789 @cindex C++ source file suffixes
1790 C++ source files conventionally use one of the suffixes @samp{.C},
1791 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1792 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1793 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1794 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1795 files with these names and compiles them as C++ programs even if you
1796 call the compiler the same way as for compiling C programs (usually
1797 with the name @command{gcc}).
1798
1799 @findex g++
1800 @findex c++
1801 However, the use of @command{gcc} does not add the C++ library.
1802 @command{g++} is a program that calls GCC and automatically specifies linking
1803 against the C++ library. It treats @samp{.c},
1804 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1805 files unless @option{-x} is used. This program is also useful when
1806 precompiling a C header file with a @samp{.h} extension for use in C++
1807 compilations. On many systems, @command{g++} is also installed with
1808 the name @command{c++}.
1809
1810 @cindex invoking @command{g++}
1811 When you compile C++ programs, you may specify many of the same
1812 command-line options that you use for compiling programs in any
1813 language; or command-line options meaningful for C and related
1814 languages; or options that are meaningful only for C++ programs.
1815 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1816 explanations of options for languages related to C@.
1817 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1818 explanations of options that are meaningful only for C++ programs.
1819
1820 @node C Dialect Options
1821 @section Options Controlling C Dialect
1822 @cindex dialect options
1823 @cindex language dialect options
1824 @cindex options, dialect
1825
1826 The following options control the dialect of C (or languages derived
1827 from C, such as C++, Objective-C and Objective-C++) that the compiler
1828 accepts:
1829
1830 @table @gcctabopt
1831 @cindex ANSI support
1832 @cindex ISO support
1833 @item -ansi
1834 @opindex ansi
1835 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1836 equivalent to @option{-std=c++98}.
1837
1838 This turns off certain features of GCC that are incompatible with ISO
1839 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1840 such as the @code{asm} and @code{typeof} keywords, and
1841 predefined macros such as @code{unix} and @code{vax} that identify the
1842 type of system you are using. It also enables the undesirable and
1843 rarely used ISO trigraph feature. For the C compiler,
1844 it disables recognition of C++ style @samp{//} comments as well as
1845 the @code{inline} keyword.
1846
1847 The alternate keywords @code{__asm__}, @code{__extension__},
1848 @code{__inline__} and @code{__typeof__} continue to work despite
1849 @option{-ansi}. You would not want to use them in an ISO C program, of
1850 course, but it is useful to put them in header files that might be included
1851 in compilations done with @option{-ansi}. Alternate predefined macros
1852 such as @code{__unix__} and @code{__vax__} are also available, with or
1853 without @option{-ansi}.
1854
1855 The @option{-ansi} option does not cause non-ISO programs to be
1856 rejected gratuitously. For that, @option{-Wpedantic} is required in
1857 addition to @option{-ansi}. @xref{Warning Options}.
1858
1859 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1860 option is used. Some header files may notice this macro and refrain
1861 from declaring certain functions or defining certain macros that the
1862 ISO standard doesn't call for; this is to avoid interfering with any
1863 programs that might use these names for other things.
1864
1865 Functions that are normally built in but do not have semantics
1866 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1867 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1868 built-in functions provided by GCC}, for details of the functions
1869 affected.
1870
1871 @item -std=
1872 @opindex std
1873 Determine the language standard. @xref{Standards,,Language Standards
1874 Supported by GCC}, for details of these standard versions. This option
1875 is currently only supported when compiling C or C++.
1876
1877 The compiler can accept several base standards, such as @samp{c90} or
1878 @samp{c++98}, and GNU dialects of those standards, such as
1879 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1880 compiler accepts all programs following that standard plus those
1881 using GNU extensions that do not contradict it. For example,
1882 @option{-std=c90} turns off certain features of GCC that are
1883 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1884 keywords, but not other GNU extensions that do not have a meaning in
1885 ISO C90, such as omitting the middle term of a @code{?:}
1886 expression. On the other hand, when a GNU dialect of a standard is
1887 specified, all features supported by the compiler are enabled, even when
1888 those features change the meaning of the base standard. As a result, some
1889 strict-conforming programs may be rejected. The particular standard
1890 is used by @option{-Wpedantic} to identify which features are GNU
1891 extensions given that version of the standard. For example
1892 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1893 comments, while @option{-std=gnu99 -Wpedantic} does not.
1894
1895 A value for this option must be provided; possible values are
1896
1897 @table @samp
1898 @item c90
1899 @itemx c89
1900 @itemx iso9899:1990
1901 Support all ISO C90 programs (certain GNU extensions that conflict
1902 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1903
1904 @item iso9899:199409
1905 ISO C90 as modified in amendment 1.
1906
1907 @item c99
1908 @itemx c9x
1909 @itemx iso9899:1999
1910 @itemx iso9899:199x
1911 ISO C99. This standard is substantially completely supported, modulo
1912 bugs and floating-point issues
1913 (mainly but not entirely relating to optional C99 features from
1914 Annexes F and G). See
1915 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1916 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1917
1918 @item c11
1919 @itemx c1x
1920 @itemx iso9899:2011
1921 ISO C11, the 2011 revision of the ISO C standard. This standard is
1922 substantially completely supported, modulo bugs, floating-point issues
1923 (mainly but not entirely relating to optional C11 features from
1924 Annexes F and G) and the optional Annexes K (Bounds-checking
1925 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1926
1927 @item c17
1928 @itemx c18
1929 @itemx iso9899:2017
1930 @itemx iso9899:2018
1931 ISO C17, the 2017 revision of the ISO C standard
1932 (published in 2018). This standard is
1933 same as C11 except for corrections of defects (all of which are also
1934 applied with @option{-std=c11}) and a new value of
1935 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1936
1937 @item c2x
1938 The next version of the ISO C standard, still under development. The
1939 support for this version is experimental and incomplete.
1940
1941 @item gnu90
1942 @itemx gnu89
1943 GNU dialect of ISO C90 (including some C99 features).
1944
1945 @item gnu99
1946 @itemx gnu9x
1947 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1948
1949 @item gnu11
1950 @itemx gnu1x
1951 GNU dialect of ISO C11.
1952 The name @samp{gnu1x} is deprecated.
1953
1954 @item gnu17
1955 @itemx gnu18
1956 GNU dialect of ISO C17. This is the default for C code.
1957
1958 @item gnu2x
1959 The next version of the ISO C standard, still under development, plus
1960 GNU extensions. The support for this version is experimental and
1961 incomplete.
1962
1963 @item c++98
1964 @itemx c++03
1965 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1966 additional defect reports. Same as @option{-ansi} for C++ code.
1967
1968 @item gnu++98
1969 @itemx gnu++03
1970 GNU dialect of @option{-std=c++98}.
1971
1972 @item c++11
1973 @itemx c++0x
1974 The 2011 ISO C++ standard plus amendments.
1975 The name @samp{c++0x} is deprecated.
1976
1977 @item gnu++11
1978 @itemx gnu++0x
1979 GNU dialect of @option{-std=c++11}.
1980 The name @samp{gnu++0x} is deprecated.
1981
1982 @item c++14
1983 @itemx c++1y
1984 The 2014 ISO C++ standard plus amendments.
1985 The name @samp{c++1y} is deprecated.
1986
1987 @item gnu++14
1988 @itemx gnu++1y
1989 GNU dialect of @option{-std=c++14}.
1990 This is the default for C++ code.
1991 The name @samp{gnu++1y} is deprecated.
1992
1993 @item c++17
1994 @itemx c++1z
1995 The 2017 ISO C++ standard plus amendments.
1996 The name @samp{c++1z} is deprecated.
1997
1998 @item gnu++17
1999 @itemx gnu++1z
2000 GNU dialect of @option{-std=c++17}.
2001 The name @samp{gnu++1z} is deprecated.
2002
2003 @item c++2a
2004 The next revision of the ISO C++ standard, tentatively planned for
2005 2020. Support is highly experimental, and will almost certainly
2006 change in incompatible ways in future releases.
2007
2008 @item gnu++2a
2009 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2010 and will almost certainly change in incompatible ways in future
2011 releases.
2012 @end table
2013
2014 @item -fgnu89-inline
2015 @opindex fgnu89-inline
2016 The option @option{-fgnu89-inline} tells GCC to use the traditional
2017 GNU semantics for @code{inline} functions when in C99 mode.
2018 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2019 Using this option is roughly equivalent to adding the
2020 @code{gnu_inline} function attribute to all inline functions
2021 (@pxref{Function Attributes}).
2022
2023 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2024 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2025 specifies the default behavior).
2026 This option is not supported in @option{-std=c90} or
2027 @option{-std=gnu90} mode.
2028
2029 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2030 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2031 in effect for @code{inline} functions. @xref{Common Predefined
2032 Macros,,,cpp,The C Preprocessor}.
2033
2034 @item -fpermitted-flt-eval-methods=@var{style}
2035 @opindex fpermitted-flt-eval-methods
2036 @opindex fpermitted-flt-eval-methods=c11
2037 @opindex fpermitted-flt-eval-methods=ts-18661-3
2038 ISO/IEC TS 18661-3 defines new permissible values for
2039 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2040 a semantic type that is an interchange or extended format should be
2041 evaluated to the precision and range of that type. These new values are
2042 a superset of those permitted under C99/C11, which does not specify the
2043 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2044 conforming to C11 may not have been written expecting the possibility of
2045 the new values.
2046
2047 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2048 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2049 or the extended set of values specified in ISO/IEC TS 18661-3.
2050
2051 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2052
2053 The default when in a standards compliant mode (@option{-std=c11} or similar)
2054 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2055 dialect (@option{-std=gnu11} or similar) is
2056 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2057
2058 @item -aux-info @var{filename}
2059 @opindex aux-info
2060 Output to the given filename prototyped declarations for all functions
2061 declared and/or defined in a translation unit, including those in header
2062 files. This option is silently ignored in any language other than C@.
2063
2064 Besides declarations, the file indicates, in comments, the origin of
2065 each declaration (source file and line), whether the declaration was
2066 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2067 @samp{O} for old, respectively, in the first character after the line
2068 number and the colon), and whether it came from a declaration or a
2069 definition (@samp{C} or @samp{F}, respectively, in the following
2070 character). In the case of function definitions, a K&R-style list of
2071 arguments followed by their declarations is also provided, inside
2072 comments, after the declaration.
2073
2074 @item -fallow-parameterless-variadic-functions
2075 @opindex fallow-parameterless-variadic-functions
2076 Accept variadic functions without named parameters.
2077
2078 Although it is possible to define such a function, this is not very
2079 useful as it is not possible to read the arguments. This is only
2080 supported for C as this construct is allowed by C++.
2081
2082 @item -fno-asm
2083 @opindex fno-asm
2084 @opindex fasm
2085 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2086 keyword, so that code can use these words as identifiers. You can use
2087 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2088 instead. @option{-ansi} implies @option{-fno-asm}.
2089
2090 In C++, this switch only affects the @code{typeof} keyword, since
2091 @code{asm} and @code{inline} are standard keywords. You may want to
2092 use the @option{-fno-gnu-keywords} flag instead, which has the same
2093 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2094 switch only affects the @code{asm} and @code{typeof} keywords, since
2095 @code{inline} is a standard keyword in ISO C99.
2096
2097 @item -fno-builtin
2098 @itemx -fno-builtin-@var{function}
2099 @opindex fno-builtin
2100 @opindex fbuiltin
2101 @cindex built-in functions
2102 Don't recognize built-in functions that do not begin with
2103 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2104 functions provided by GCC}, for details of the functions affected,
2105 including those which are not built-in functions when @option{-ansi} or
2106 @option{-std} options for strict ISO C conformance are used because they
2107 do not have an ISO standard meaning.
2108
2109 GCC normally generates special code to handle certain built-in functions
2110 more efficiently; for instance, calls to @code{alloca} may become single
2111 instructions which adjust the stack directly, and calls to @code{memcpy}
2112 may become inline copy loops. The resulting code is often both smaller
2113 and faster, but since the function calls no longer appear as such, you
2114 cannot set a breakpoint on those calls, nor can you change the behavior
2115 of the functions by linking with a different library. In addition,
2116 when a function is recognized as a built-in function, GCC may use
2117 information about that function to warn about problems with calls to
2118 that function, or to generate more efficient code, even if the
2119 resulting code still contains calls to that function. For example,
2120 warnings are given with @option{-Wformat} for bad calls to
2121 @code{printf} when @code{printf} is built in and @code{strlen} is
2122 known not to modify global memory.
2123
2124 With the @option{-fno-builtin-@var{function}} option
2125 only the built-in function @var{function} is
2126 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2127 function is named that is not built-in in this version of GCC, this
2128 option is ignored. There is no corresponding
2129 @option{-fbuiltin-@var{function}} option; if you wish to enable
2130 built-in functions selectively when using @option{-fno-builtin} or
2131 @option{-ffreestanding}, you may define macros such as:
2132
2133 @smallexample
2134 #define abs(n) __builtin_abs ((n))
2135 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2136 @end smallexample
2137
2138 @item -fgimple
2139 @opindex fgimple
2140
2141 Enable parsing of function definitions marked with @code{__GIMPLE}.
2142 This is an experimental feature that allows unit testing of GIMPLE
2143 passes.
2144
2145 @item -fhosted
2146 @opindex fhosted
2147 @cindex hosted environment
2148
2149 Assert that compilation targets a hosted environment. This implies
2150 @option{-fbuiltin}. A hosted environment is one in which the
2151 entire standard library is available, and in which @code{main} has a return
2152 type of @code{int}. Examples are nearly everything except a kernel.
2153 This is equivalent to @option{-fno-freestanding}.
2154
2155 @item -ffreestanding
2156 @opindex ffreestanding
2157 @cindex hosted environment
2158
2159 Assert that compilation targets a freestanding environment. This
2160 implies @option{-fno-builtin}. A freestanding environment
2161 is one in which the standard library may not exist, and program startup may
2162 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2163 This is equivalent to @option{-fno-hosted}.
2164
2165 @xref{Standards,,Language Standards Supported by GCC}, for details of
2166 freestanding and hosted environments.
2167
2168 @item -fopenacc
2169 @opindex fopenacc
2170 @cindex OpenACC accelerator programming
2171 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2172 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2173 compiler generates accelerated code according to the OpenACC Application
2174 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2175 implies @option{-pthread}, and thus is only supported on targets that
2176 have support for @option{-pthread}.
2177
2178 @item -fopenacc-dim=@var{geom}
2179 @opindex fopenacc-dim
2180 @cindex OpenACC accelerator programming
2181 Specify default compute dimensions for parallel offload regions that do
2182 not explicitly specify. The @var{geom} value is a triple of
2183 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2184 can be omitted, to use a target-specific default value.
2185
2186 @item -fopenmp
2187 @opindex fopenmp
2188 @cindex OpenMP parallel
2189 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2190 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2191 compiler generates parallel code according to the OpenMP Application
2192 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2193 implies @option{-pthread}, and thus is only supported on targets that
2194 have support for @option{-pthread}. @option{-fopenmp} implies
2195 @option{-fopenmp-simd}.
2196
2197 @item -fopenmp-simd
2198 @opindex fopenmp-simd
2199 @cindex OpenMP SIMD
2200 @cindex SIMD
2201 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2202 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2203 are ignored.
2204
2205 @item -fgnu-tm
2206 @opindex fgnu-tm
2207 When the option @option{-fgnu-tm} is specified, the compiler
2208 generates code for the Linux variant of Intel's current Transactional
2209 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2210 an experimental feature whose interface may change in future versions
2211 of GCC, as the official specification changes. Please note that not
2212 all architectures are supported for this feature.
2213
2214 For more information on GCC's support for transactional memory,
2215 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2216 Transactional Memory Library}.
2217
2218 Note that the transactional memory feature is not supported with
2219 non-call exceptions (@option{-fnon-call-exceptions}).
2220
2221 @item -fms-extensions
2222 @opindex fms-extensions
2223 Accept some non-standard constructs used in Microsoft header files.
2224
2225 In C++ code, this allows member names in structures to be similar
2226 to previous types declarations.
2227
2228 @smallexample
2229 typedef int UOW;
2230 struct ABC @{
2231 UOW UOW;
2232 @};
2233 @end smallexample
2234
2235 Some cases of unnamed fields in structures and unions are only
2236 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2237 fields within structs/unions}, for details.
2238
2239 Note that this option is off for all targets but x86
2240 targets using ms-abi.
2241
2242 @item -fplan9-extensions
2243 @opindex fplan9-extensions
2244 Accept some non-standard constructs used in Plan 9 code.
2245
2246 This enables @option{-fms-extensions}, permits passing pointers to
2247 structures with anonymous fields to functions that expect pointers to
2248 elements of the type of the field, and permits referring to anonymous
2249 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2250 struct/union fields within structs/unions}, for details. This is only
2251 supported for C, not C++.
2252
2253 @item -fcond-mismatch
2254 @opindex fcond-mismatch
2255 Allow conditional expressions with mismatched types in the second and
2256 third arguments. The value of such an expression is void. This option
2257 is not supported for C++.
2258
2259 @item -flax-vector-conversions
2260 @opindex flax-vector-conversions
2261 Allow implicit conversions between vectors with differing numbers of
2262 elements and/or incompatible element types. This option should not be
2263 used for new code.
2264
2265 @item -funsigned-char
2266 @opindex funsigned-char
2267 Let the type @code{char} be unsigned, like @code{unsigned char}.
2268
2269 Each kind of machine has a default for what @code{char} should
2270 be. It is either like @code{unsigned char} by default or like
2271 @code{signed char} by default.
2272
2273 Ideally, a portable program should always use @code{signed char} or
2274 @code{unsigned char} when it depends on the signedness of an object.
2275 But many programs have been written to use plain @code{char} and
2276 expect it to be signed, or expect it to be unsigned, depending on the
2277 machines they were written for. This option, and its inverse, let you
2278 make such a program work with the opposite default.
2279
2280 The type @code{char} is always a distinct type from each of
2281 @code{signed char} or @code{unsigned char}, even though its behavior
2282 is always just like one of those two.
2283
2284 @item -fsigned-char
2285 @opindex fsigned-char
2286 Let the type @code{char} be signed, like @code{signed char}.
2287
2288 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2289 the negative form of @option{-funsigned-char}. Likewise, the option
2290 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2291
2292 @item -fsigned-bitfields
2293 @itemx -funsigned-bitfields
2294 @itemx -fno-signed-bitfields
2295 @itemx -fno-unsigned-bitfields
2296 @opindex fsigned-bitfields
2297 @opindex funsigned-bitfields
2298 @opindex fno-signed-bitfields
2299 @opindex fno-unsigned-bitfields
2300 These options control whether a bit-field is signed or unsigned, when the
2301 declaration does not use either @code{signed} or @code{unsigned}. By
2302 default, such a bit-field is signed, because this is consistent: the
2303 basic integer types such as @code{int} are signed types.
2304
2305 @item -fsso-struct=@var{endianness}
2306 @opindex fsso-struct
2307 Set the default scalar storage order of structures and unions to the
2308 specified endianness. The accepted values are @samp{big-endian},
2309 @samp{little-endian} and @samp{native} for the native endianness of
2310 the target (the default). This option is not supported for C++.
2311
2312 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2313 code that is not binary compatible with code generated without it if the
2314 specified endianness is not the native endianness of the target.
2315 @end table
2316
2317 @node C++ Dialect Options
2318 @section Options Controlling C++ Dialect
2319
2320 @cindex compiler options, C++
2321 @cindex C++ options, command-line
2322 @cindex options, C++
2323 This section describes the command-line options that are only meaningful
2324 for C++ programs. You can also use most of the GNU compiler options
2325 regardless of what language your program is in. For example, you
2326 might compile a file @file{firstClass.C} like this:
2327
2328 @smallexample
2329 g++ -g -fstrict-enums -O -c firstClass.C
2330 @end smallexample
2331
2332 @noindent
2333 In this example, only @option{-fstrict-enums} is an option meant
2334 only for C++ programs; you can use the other options with any
2335 language supported by GCC@.
2336
2337 Some options for compiling C programs, such as @option{-std}, are also
2338 relevant for C++ programs.
2339 @xref{C Dialect Options,,Options Controlling C Dialect}.
2340
2341 Here is a list of options that are @emph{only} for compiling C++ programs:
2342
2343 @table @gcctabopt
2344
2345 @item -fabi-version=@var{n}
2346 @opindex fabi-version
2347 Use version @var{n} of the C++ ABI@. The default is version 0.
2348
2349 Version 0 refers to the version conforming most closely to
2350 the C++ ABI specification. Therefore, the ABI obtained using version 0
2351 will change in different versions of G++ as ABI bugs are fixed.
2352
2353 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2354
2355 Version 2 is the version of the C++ ABI that first appeared in G++
2356 3.4, and was the default through G++ 4.9.
2357
2358 Version 3 corrects an error in mangling a constant address as a
2359 template argument.
2360
2361 Version 4, which first appeared in G++ 4.5, implements a standard
2362 mangling for vector types.
2363
2364 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2365 attribute const/volatile on function pointer types, decltype of a
2366 plain decl, and use of a function parameter in the declaration of
2367 another parameter.
2368
2369 Version 6, which first appeared in G++ 4.7, corrects the promotion
2370 behavior of C++11 scoped enums and the mangling of template argument
2371 packs, const/static_cast, prefix ++ and --, and a class scope function
2372 used as a template argument.
2373
2374 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2375 builtin type and corrects the mangling of lambdas in default argument
2376 scope.
2377
2378 Version 8, which first appeared in G++ 4.9, corrects the substitution
2379 behavior of function types with function-cv-qualifiers.
2380
2381 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2382 @code{nullptr_t}.
2383
2384 Version 10, which first appeared in G++ 6.1, adds mangling of
2385 attributes that affect type identity, such as ia32 calling convention
2386 attributes (e.g.@: @samp{stdcall}).
2387
2388 Version 11, which first appeared in G++ 7, corrects the mangling of
2389 sizeof... expressions and operator names. For multiple entities with
2390 the same name within a function, that are declared in different scopes,
2391 the mangling now changes starting with the twelfth occurrence. It also
2392 implies @option{-fnew-inheriting-ctors}.
2393
2394 Version 12, which first appeared in G++ 8, corrects the calling
2395 conventions for empty classes on the x86_64 target and for classes
2396 with only deleted copy/move constructors. It accidentally changes the
2397 calling convention for classes with a deleted copy constructor and a
2398 trivial move constructor.
2399
2400 Version 13, which first appeared in G++ 8.2, fixes the accidental
2401 change in version 12.
2402
2403 See also @option{-Wabi}.
2404
2405 @item -fabi-compat-version=@var{n}
2406 @opindex fabi-compat-version
2407 On targets that support strong aliases, G++
2408 works around mangling changes by creating an alias with the correct
2409 mangled name when defining a symbol with an incorrect mangled name.
2410 This switch specifies which ABI version to use for the alias.
2411
2412 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2413 compatibility). If another ABI version is explicitly selected, this
2414 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2415 use @option{-fabi-compat-version=2}.
2416
2417 If this option is not provided but @option{-Wabi=@var{n}} is, that
2418 version is used for compatibility aliases. If this option is provided
2419 along with @option{-Wabi} (without the version), the version from this
2420 option is used for the warning.
2421
2422 @item -fno-access-control
2423 @opindex fno-access-control
2424 @opindex faccess-control
2425 Turn off all access checking. This switch is mainly useful for working
2426 around bugs in the access control code.
2427
2428 @item -faligned-new
2429 @opindex faligned-new
2430 Enable support for C++17 @code{new} of types that require more
2431 alignment than @code{void* ::operator new(std::size_t)} provides. A
2432 numeric argument such as @code{-faligned-new=32} can be used to
2433 specify how much alignment (in bytes) is provided by that function,
2434 but few users will need to override the default of
2435 @code{alignof(std::max_align_t)}.
2436
2437 This flag is enabled by default for @option{-std=c++17}.
2438
2439 @item -fchar8_t
2440 @itemx -fno-char8_t
2441 @opindex fchar8_t
2442 @opindex fno-char8_t
2443 Enable support for @code{char8_t} as adopted for C++2a. This includes
2444 the addition of a new @code{char8_t} fundamental type, changes to the
2445 types of UTF-8 string and character literals, new signatures for
2446 user-defined literals, associated standard library updates, and new
2447 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2448
2449 This option enables functions to be overloaded for ordinary and UTF-8
2450 strings:
2451
2452 @smallexample
2453 int f(const char *); // #1
2454 int f(const char8_t *); // #2
2455 int v1 = f("text"); // Calls #1
2456 int v2 = f(u8"text"); // Calls #2
2457 @end smallexample
2458
2459 @noindent
2460 and introduces new signatures for user-defined literals:
2461
2462 @smallexample
2463 int operator""_udl1(char8_t);
2464 int v3 = u8'x'_udl1;
2465 int operator""_udl2(const char8_t*, std::size_t);
2466 int v4 = u8"text"_udl2;
2467 template<typename T, T...> int operator""_udl3();
2468 int v5 = u8"text"_udl3;
2469 @end smallexample
2470
2471 @noindent
2472 The change to the types of UTF-8 string and character literals introduces
2473 incompatibilities with ISO C++11 and later standards. For example, the
2474 following code is well-formed under ISO C++11, but is ill-formed when
2475 @option{-fchar8_t} is specified.
2476
2477 @smallexample
2478 char ca[] = u8"xx"; // error: char-array initialized from wide
2479 // string
2480 const char *cp = u8"xx";// error: invalid conversion from
2481 // `const char8_t*' to `const char*'
2482 int f(const char*);
2483 auto v = f(u8"xx"); // error: invalid conversion from
2484 // `const char8_t*' to `const char*'
2485 std::string s@{u8"xx"@}; // error: no matching function for call to
2486 // `std::basic_string<char>::basic_string()'
2487 using namespace std::literals;
2488 s = u8"xx"s; // error: conversion from
2489 // `basic_string<char8_t>' to non-scalar
2490 // type `basic_string<char>' requested
2491 @end smallexample
2492
2493 @item -fcheck-new
2494 @opindex fcheck-new
2495 Check that the pointer returned by @code{operator new} is non-null
2496 before attempting to modify the storage allocated. This check is
2497 normally unnecessary because the C++ standard specifies that
2498 @code{operator new} only returns @code{0} if it is declared
2499 @code{throw()}, in which case the compiler always checks the
2500 return value even without this option. In all other cases, when
2501 @code{operator new} has a non-empty exception specification, memory
2502 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2503 @samp{new (nothrow)}.
2504
2505 @item -fconcepts
2506 @opindex fconcepts
2507 Enable support for the C++ Extensions for Concepts Technical
2508 Specification, ISO 19217 (2015), which allows code like
2509
2510 @smallexample
2511 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2512 template <Addable T> T add (T a, T b) @{ return a + b; @}
2513 @end smallexample
2514
2515 @item -fconstexpr-depth=@var{n}
2516 @opindex fconstexpr-depth
2517 Set the maximum nested evaluation depth for C++11 constexpr functions
2518 to @var{n}. A limit is needed to detect endless recursion during
2519 constant expression evaluation. The minimum specified by the standard
2520 is 512.
2521
2522 @item -fconstexpr-loop-limit=@var{n}
2523 @opindex fconstexpr-loop-limit
2524 Set the maximum number of iterations for a loop in C++14 constexpr functions
2525 to @var{n}. A limit is needed to detect infinite loops during
2526 constant expression evaluation. The default is 262144 (1<<18).
2527
2528 @item -fdeduce-init-list
2529 @opindex fdeduce-init-list
2530 Enable deduction of a template type parameter as
2531 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2532
2533 @smallexample
2534 template <class T> auto forward(T t) -> decltype (realfn (t))
2535 @{
2536 return realfn (t);
2537 @}
2538
2539 void f()
2540 @{
2541 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2542 @}
2543 @end smallexample
2544
2545 This deduction was implemented as a possible extension to the
2546 originally proposed semantics for the C++11 standard, but was not part
2547 of the final standard, so it is disabled by default. This option is
2548 deprecated, and may be removed in a future version of G++.
2549
2550 @item -fno-elide-constructors
2551 @opindex fno-elide-constructors
2552 @opindex felide-constructors
2553 The C++ standard allows an implementation to omit creating a temporary
2554 that is only used to initialize another object of the same type.
2555 Specifying this option disables that optimization, and forces G++ to
2556 call the copy constructor in all cases. This option also causes G++
2557 to call trivial member functions which otherwise would be expanded inline.
2558
2559 In C++17, the compiler is required to omit these temporaries, but this
2560 option still affects trivial member functions.
2561
2562 @item -fno-enforce-eh-specs
2563 @opindex fno-enforce-eh-specs
2564 @opindex fenforce-eh-specs
2565 Don't generate code to check for violation of exception specifications
2566 at run time. This option violates the C++ standard, but may be useful
2567 for reducing code size in production builds, much like defining
2568 @code{NDEBUG}. This does not give user code permission to throw
2569 exceptions in violation of the exception specifications; the compiler
2570 still optimizes based on the specifications, so throwing an
2571 unexpected exception results in undefined behavior at run time.
2572
2573 @item -fextern-tls-init
2574 @itemx -fno-extern-tls-init
2575 @opindex fextern-tls-init
2576 @opindex fno-extern-tls-init
2577 The C++11 and OpenMP standards allow @code{thread_local} and
2578 @code{threadprivate} variables to have dynamic (runtime)
2579 initialization. To support this, any use of such a variable goes
2580 through a wrapper function that performs any necessary initialization.
2581 When the use and definition of the variable are in the same
2582 translation unit, this overhead can be optimized away, but when the
2583 use is in a different translation unit there is significant overhead
2584 even if the variable doesn't actually need dynamic initialization. If
2585 the programmer can be sure that no use of the variable in a
2586 non-defining TU needs to trigger dynamic initialization (either
2587 because the variable is statically initialized, or a use of the
2588 variable in the defining TU will be executed before any uses in
2589 another TU), they can avoid this overhead with the
2590 @option{-fno-extern-tls-init} option.
2591
2592 On targets that support symbol aliases, the default is
2593 @option{-fextern-tls-init}. On targets that do not support symbol
2594 aliases, the default is @option{-fno-extern-tls-init}.
2595
2596 @item -fno-gnu-keywords
2597 @opindex fno-gnu-keywords
2598 @opindex fgnu-keywords
2599 Do not recognize @code{typeof} as a keyword, so that code can use this
2600 word as an identifier. You can use the keyword @code{__typeof__} instead.
2601 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2602 @option{-std=c++98}, @option{-std=c++11}, etc.
2603
2604 @item -fno-implicit-templates
2605 @opindex fno-implicit-templates
2606 @opindex fimplicit-templates
2607 Never emit code for non-inline templates that are instantiated
2608 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2609 If you use this option, you must take care to structure your code to
2610 include all the necessary explicit instantiations to avoid getting
2611 undefined symbols at link time.
2612 @xref{Template Instantiation}, for more information.
2613
2614 @item -fno-implicit-inline-templates
2615 @opindex fno-implicit-inline-templates
2616 @opindex fimplicit-inline-templates
2617 Don't emit code for implicit instantiations of inline templates, either.
2618 The default is to handle inlines differently so that compiles with and
2619 without optimization need the same set of explicit instantiations.
2620
2621 @item -fno-implement-inlines
2622 @opindex fno-implement-inlines
2623 @opindex fimplement-inlines
2624 To save space, do not emit out-of-line copies of inline functions
2625 controlled by @code{#pragma implementation}. This causes linker
2626 errors if these functions are not inlined everywhere they are called.
2627
2628 @item -fms-extensions
2629 @opindex fms-extensions
2630 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2631 int and getting a pointer to member function via non-standard syntax.
2632
2633 @item -fnew-inheriting-ctors
2634 @opindex fnew-inheriting-ctors
2635 Enable the P0136 adjustment to the semantics of C++11 constructor
2636 inheritance. This is part of C++17 but also considered to be a Defect
2637 Report against C++11 and C++14. This flag is enabled by default
2638 unless @option{-fabi-version=10} or lower is specified.
2639
2640 @item -fnew-ttp-matching
2641 @opindex fnew-ttp-matching
2642 Enable the P0522 resolution to Core issue 150, template template
2643 parameters and default arguments: this allows a template with default
2644 template arguments as an argument for a template template parameter
2645 with fewer template parameters. This flag is enabled by default for
2646 @option{-std=c++17}.
2647
2648 @item -fno-nonansi-builtins
2649 @opindex fno-nonansi-builtins
2650 @opindex fnonansi-builtins
2651 Disable built-in declarations of functions that are not mandated by
2652 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2653 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2654
2655 @item -fnothrow-opt
2656 @opindex fnothrow-opt
2657 Treat a @code{throw()} exception specification as if it were a
2658 @code{noexcept} specification to reduce or eliminate the text size
2659 overhead relative to a function with no exception specification. If
2660 the function has local variables of types with non-trivial
2661 destructors, the exception specification actually makes the
2662 function smaller because the EH cleanups for those variables can be
2663 optimized away. The semantic effect is that an exception thrown out of
2664 a function with such an exception specification results in a call
2665 to @code{terminate} rather than @code{unexpected}.
2666
2667 @item -fno-operator-names
2668 @opindex fno-operator-names
2669 @opindex foperator-names
2670 Do not treat the operator name keywords @code{and}, @code{bitand},
2671 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2672 synonyms as keywords.
2673
2674 @item -fno-optional-diags
2675 @opindex fno-optional-diags
2676 @opindex foptional-diags
2677 Disable diagnostics that the standard says a compiler does not need to
2678 issue. Currently, the only such diagnostic issued by G++ is the one for
2679 a name having multiple meanings within a class.
2680
2681 @item -fpermissive
2682 @opindex fpermissive
2683 Downgrade some diagnostics about nonconformant code from errors to
2684 warnings. Thus, using @option{-fpermissive} allows some
2685 nonconforming code to compile.
2686
2687 @item -fno-pretty-templates
2688 @opindex fno-pretty-templates
2689 @opindex fpretty-templates
2690 When an error message refers to a specialization of a function
2691 template, the compiler normally prints the signature of the
2692 template followed by the template arguments and any typedefs or
2693 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2694 rather than @code{void f(int)}) so that it's clear which template is
2695 involved. When an error message refers to a specialization of a class
2696 template, the compiler omits any template arguments that match
2697 the default template arguments for that template. If either of these
2698 behaviors make it harder to understand the error message rather than
2699 easier, you can use @option{-fno-pretty-templates} to disable them.
2700
2701 @item -frepo
2702 @opindex frepo
2703 Enable automatic template instantiation at link time. This option also
2704 implies @option{-fno-implicit-templates}. @xref{Template
2705 Instantiation}, for more information.
2706
2707 @item -fno-rtti
2708 @opindex fno-rtti
2709 @opindex frtti
2710 Disable generation of information about every class with virtual
2711 functions for use by the C++ run-time type identification features
2712 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2713 of the language, you can save some space by using this flag. Note that
2714 exception handling uses the same information, but G++ generates it as
2715 needed. The @code{dynamic_cast} operator can still be used for casts that
2716 do not require run-time type information, i.e.@: casts to @code{void *} or to
2717 unambiguous base classes.
2718
2719 Mixing code compiled with @option{-frtti} with that compiled with
2720 @option{-fno-rtti} may not work. For example, programs may
2721 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2722 for a class compiled with @option{-frtti}.
2723
2724 @item -fsized-deallocation
2725 @opindex fsized-deallocation
2726 Enable the built-in global declarations
2727 @smallexample
2728 void operator delete (void *, std::size_t) noexcept;
2729 void operator delete[] (void *, std::size_t) noexcept;
2730 @end smallexample
2731 as introduced in C++14. This is useful for user-defined replacement
2732 deallocation functions that, for example, use the size of the object
2733 to make deallocation faster. Enabled by default under
2734 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2735 warns about places that might want to add a definition.
2736
2737 @item -fstrict-enums
2738 @opindex fstrict-enums
2739 Allow the compiler to optimize using the assumption that a value of
2740 enumerated type can only be one of the values of the enumeration (as
2741 defined in the C++ standard; basically, a value that can be
2742 represented in the minimum number of bits needed to represent all the
2743 enumerators). This assumption may not be valid if the program uses a
2744 cast to convert an arbitrary integer value to the enumerated type.
2745
2746 @item -fstrong-eval-order
2747 @opindex fstrong-eval-order
2748 Evaluate member access, array subscripting, and shift expressions in
2749 left-to-right order, and evaluate assignment in right-to-left order,
2750 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2751 @option{-fstrong-eval-order=some} enables just the ordering of member
2752 access and shift expressions, and is the default without
2753 @option{-std=c++17}.
2754
2755 @item -ftemplate-backtrace-limit=@var{n}
2756 @opindex ftemplate-backtrace-limit
2757 Set the maximum number of template instantiation notes for a single
2758 warning or error to @var{n}. The default value is 10.
2759
2760 @item -ftemplate-depth=@var{n}
2761 @opindex ftemplate-depth
2762 Set the maximum instantiation depth for template classes to @var{n}.
2763 A limit on the template instantiation depth is needed to detect
2764 endless recursions during template class instantiation. ANSI/ISO C++
2765 conforming programs must not rely on a maximum depth greater than 17
2766 (changed to 1024 in C++11). The default value is 900, as the compiler
2767 can run out of stack space before hitting 1024 in some situations.
2768
2769 @item -fno-threadsafe-statics
2770 @opindex fno-threadsafe-statics
2771 @opindex fthreadsafe-statics
2772 Do not emit the extra code to use the routines specified in the C++
2773 ABI for thread-safe initialization of local statics. You can use this
2774 option to reduce code size slightly in code that doesn't need to be
2775 thread-safe.
2776
2777 @item -fuse-cxa-atexit
2778 @opindex fuse-cxa-atexit
2779 Register destructors for objects with static storage duration with the
2780 @code{__cxa_atexit} function rather than the @code{atexit} function.
2781 This option is required for fully standards-compliant handling of static
2782 destructors, but only works if your C library supports
2783 @code{__cxa_atexit}.
2784
2785 @item -fno-use-cxa-get-exception-ptr
2786 @opindex fno-use-cxa-get-exception-ptr
2787 @opindex fuse-cxa-get-exception-ptr
2788 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2789 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2790 if the runtime routine is not available.
2791
2792 @item -fvisibility-inlines-hidden
2793 @opindex fvisibility-inlines-hidden
2794 This switch declares that the user does not attempt to compare
2795 pointers to inline functions or methods where the addresses of the two functions
2796 are taken in different shared objects.
2797
2798 The effect of this is that GCC may, effectively, mark inline methods with
2799 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2800 appear in the export table of a DSO and do not require a PLT indirection
2801 when used within the DSO@. Enabling this option can have a dramatic effect
2802 on load and link times of a DSO as it massively reduces the size of the
2803 dynamic export table when the library makes heavy use of templates.
2804
2805 The behavior of this switch is not quite the same as marking the
2806 methods as hidden directly, because it does not affect static variables
2807 local to the function or cause the compiler to deduce that
2808 the function is defined in only one shared object.
2809
2810 You may mark a method as having a visibility explicitly to negate the
2811 effect of the switch for that method. For example, if you do want to
2812 compare pointers to a particular inline method, you might mark it as
2813 having default visibility. Marking the enclosing class with explicit
2814 visibility has no effect.
2815
2816 Explicitly instantiated inline methods are unaffected by this option
2817 as their linkage might otherwise cross a shared library boundary.
2818 @xref{Template Instantiation}.
2819
2820 @item -fvisibility-ms-compat
2821 @opindex fvisibility-ms-compat
2822 This flag attempts to use visibility settings to make GCC's C++
2823 linkage model compatible with that of Microsoft Visual Studio.
2824
2825 The flag makes these changes to GCC's linkage model:
2826
2827 @enumerate
2828 @item
2829 It sets the default visibility to @code{hidden}, like
2830 @option{-fvisibility=hidden}.
2831
2832 @item
2833 Types, but not their members, are not hidden by default.
2834
2835 @item
2836 The One Definition Rule is relaxed for types without explicit
2837 visibility specifications that are defined in more than one
2838 shared object: those declarations are permitted if they are
2839 permitted when this option is not used.
2840 @end enumerate
2841
2842 In new code it is better to use @option{-fvisibility=hidden} and
2843 export those classes that are intended to be externally visible.
2844 Unfortunately it is possible for code to rely, perhaps accidentally,
2845 on the Visual Studio behavior.
2846
2847 Among the consequences of these changes are that static data members
2848 of the same type with the same name but defined in different shared
2849 objects are different, so changing one does not change the other;
2850 and that pointers to function members defined in different shared
2851 objects may not compare equal. When this flag is given, it is a
2852 violation of the ODR to define types with the same name differently.
2853
2854 @item -fno-weak
2855 @opindex fno-weak
2856 @opindex fweak
2857 Do not use weak symbol support, even if it is provided by the linker.
2858 By default, G++ uses weak symbols if they are available. This
2859 option exists only for testing, and should not be used by end-users;
2860 it results in inferior code and has no benefits. This option may
2861 be removed in a future release of G++.
2862
2863 @item -nostdinc++
2864 @opindex nostdinc++
2865 Do not search for header files in the standard directories specific to
2866 C++, but do still search the other standard directories. (This option
2867 is used when building the C++ library.)
2868 @end table
2869
2870 In addition, these optimization, warning, and code generation options
2871 have meanings only for C++ programs:
2872
2873 @table @gcctabopt
2874 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2875 @opindex Wabi
2876 @opindex Wno-abi
2877 Warn when G++ it generates code that is probably not compatible with
2878 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2879 ABI with each major release, normally @option{-Wabi} will warn only if
2880 there is a check added later in a release series for an ABI issue
2881 discovered since the initial release. @option{-Wabi} will warn about
2882 more things if an older ABI version is selected (with
2883 @option{-fabi-version=@var{n}}).
2884
2885 @option{-Wabi} can also be used with an explicit version number to
2886 warn about compatibility with a particular @option{-fabi-version}
2887 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2888 @option{-fabi-version=2}.
2889
2890 If an explicit version number is provided and
2891 @option{-fabi-compat-version} is not specified, the version number
2892 from this option is used for compatibility aliases. If no explicit
2893 version number is provided with this option, but
2894 @option{-fabi-compat-version} is specified, that version number is
2895 used for ABI warnings.
2896
2897 Although an effort has been made to warn about
2898 all such cases, there are probably some cases that are not warned about,
2899 even though G++ is generating incompatible code. There may also be
2900 cases where warnings are emitted even though the code that is generated
2901 is compatible.
2902
2903 You should rewrite your code to avoid these warnings if you are
2904 concerned about the fact that code generated by G++ may not be binary
2905 compatible with code generated by other compilers.
2906
2907 Known incompatibilities in @option{-fabi-version=2} (which was the
2908 default from GCC 3.4 to 4.9) include:
2909
2910 @itemize @bullet
2911
2912 @item
2913 A template with a non-type template parameter of reference type was
2914 mangled incorrectly:
2915 @smallexample
2916 extern int N;
2917 template <int &> struct S @{@};
2918 void n (S<N>) @{2@}
2919 @end smallexample
2920
2921 This was fixed in @option{-fabi-version=3}.
2922
2923 @item
2924 SIMD vector types declared using @code{__attribute ((vector_size))} were
2925 mangled in a non-standard way that does not allow for overloading of
2926 functions taking vectors of different sizes.
2927
2928 The mangling was changed in @option{-fabi-version=4}.
2929
2930 @item
2931 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2932 qualifiers, and @code{decltype} of a plain declaration was folded away.
2933
2934 These mangling issues were fixed in @option{-fabi-version=5}.
2935
2936 @item
2937 Scoped enumerators passed as arguments to a variadic function are
2938 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2939 On most targets this does not actually affect the parameter passing
2940 ABI, as there is no way to pass an argument smaller than @code{int}.
2941
2942 Also, the ABI changed the mangling of template argument packs,
2943 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2944 a class scope function used as a template argument.
2945
2946 These issues were corrected in @option{-fabi-version=6}.
2947
2948 @item
2949 Lambdas in default argument scope were mangled incorrectly, and the
2950 ABI changed the mangling of @code{nullptr_t}.
2951
2952 These issues were corrected in @option{-fabi-version=7}.
2953
2954 @item
2955 When mangling a function type with function-cv-qualifiers, the
2956 un-qualified function type was incorrectly treated as a substitution
2957 candidate.
2958
2959 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2960
2961 @item
2962 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2963 unaligned accesses. Note that this did not affect the ABI of a
2964 function with a @code{nullptr_t} parameter, as parameters have a
2965 minimum alignment.
2966
2967 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2968
2969 @item
2970 Target-specific attributes that affect the identity of a type, such as
2971 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2972 did not affect the mangled name, leading to name collisions when
2973 function pointers were used as template arguments.
2974
2975 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2976
2977 @end itemize
2978
2979 It also warns about psABI-related changes. The known psABI changes at this
2980 point include:
2981
2982 @itemize @bullet
2983
2984 @item
2985 For SysV/x86-64, unions with @code{long double} members are
2986 passed in memory as specified in psABI. For example:
2987
2988 @smallexample
2989 union U @{
2990 long double ld;
2991 int i;
2992 @};
2993 @end smallexample
2994
2995 @noindent
2996 @code{union U} is always passed in memory.
2997
2998 @end itemize
2999
3000 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3001 @opindex Wabi-tag
3002 @opindex Wabi-tag
3003 Warn when a type with an ABI tag is used in a context that does not
3004 have that ABI tag. See @ref{C++ Attributes} for more information
3005 about ABI tags.
3006
3007 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3008 @opindex Wctor-dtor-privacy
3009 @opindex Wno-ctor-dtor-privacy
3010 Warn when a class seems unusable because all the constructors or
3011 destructors in that class are private, and it has neither friends nor
3012 public static member functions. Also warn if there are no non-private
3013 methods, and there's at least one private member function that isn't
3014 a constructor or destructor.
3015
3016 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3017 @opindex Wdelete-non-virtual-dtor
3018 @opindex Wno-delete-non-virtual-dtor
3019 Warn when @code{delete} is used to destroy an instance of a class that
3020 has virtual functions and non-virtual destructor. It is unsafe to delete
3021 an instance of a derived class through a pointer to a base class if the
3022 base class does not have a virtual destructor. This warning is enabled
3023 by @option{-Wall}.
3024
3025 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3026 @opindex Wdeprecated-copy
3027 @opindex Wno-deprecated-copy
3028 Warn that the implicit declaration of a copy constructor or copy
3029 assignment operator is deprecated if the class has a user-provided
3030 copy constructor or copy assignment operator, in C++11 and up. This
3031 warning is enabled by @option{-Wextra}. With
3032 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3033 user-provided destructor.
3034
3035 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3036 @opindex Winit-list-lifetime
3037 @opindex Wno-init-list-lifetime
3038 Do not warn about uses of @code{std::initializer_list} that are likely
3039 to result in dangling pointers. Since the underlying array for an
3040 @code{initializer_list} is handled like a normal C++ temporary object,
3041 it is easy to inadvertently keep a pointer to the array past the end
3042 of the array's lifetime. For example:
3043
3044 @itemize @bullet
3045 @item
3046 If a function returns a temporary @code{initializer_list}, or a local
3047 @code{initializer_list} variable, the array's lifetime ends at the end
3048 of the return statement, so the value returned has a dangling pointer.
3049
3050 @item
3051 If a new-expression creates an @code{initializer_list}, the array only
3052 lives until the end of the enclosing full-expression, so the
3053 @code{initializer_list} in the heap has a dangling pointer.
3054
3055 @item
3056 When an @code{initializer_list} variable is assigned from a
3057 brace-enclosed initializer list, the temporary array created for the
3058 right side of the assignment only lives until the end of the
3059 full-expression, so at the next statement the @code{initializer_list}
3060 variable has a dangling pointer.
3061
3062 @smallexample
3063 // li's initial underlying array lives as long as li
3064 std::initializer_list<int> li = @{ 1,2,3 @};
3065 // assignment changes li to point to a temporary array
3066 li = @{ 4, 5 @};
3067 // now the temporary is gone and li has a dangling pointer
3068 int i = li.begin()[0] // undefined behavior
3069 @end smallexample
3070
3071 @item
3072 When a list constructor stores the @code{begin} pointer from the
3073 @code{initializer_list} argument, this doesn't extend the lifetime of
3074 the array, so if a class variable is constructed from a temporary
3075 @code{initializer_list}, the pointer is left dangling by the end of
3076 the variable declaration statement.
3077
3078 @end itemize
3079
3080 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3081 @opindex Wliteral-suffix
3082 @opindex Wno-literal-suffix
3083 Warn when a string or character literal is followed by a ud-suffix which does
3084 not begin with an underscore. As a conforming extension, GCC treats such
3085 suffixes as separate preprocessing tokens in order to maintain backwards
3086 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3087 For example:
3088
3089 @smallexample
3090 #define __STDC_FORMAT_MACROS
3091 #include <inttypes.h>
3092 #include <stdio.h>
3093
3094 int main() @{
3095 int64_t i64 = 123;
3096 printf("My int64: %" PRId64"\n", i64);
3097 @}
3098 @end smallexample
3099
3100 In this case, @code{PRId64} is treated as a separate preprocessing token.
3101
3102 Additionally, warn when a user-defined literal operator is declared with
3103 a literal suffix identifier that doesn't begin with an underscore. Literal
3104 suffix identifiers that don't begin with an underscore are reserved for
3105 future standardization.
3106
3107 This warning is enabled by default.
3108
3109 @item -Wlto-type-mismatch
3110 @opindex Wlto-type-mismatch
3111 @opindex Wno-lto-type-mismatch
3112
3113 During the link-time optimization warn about type mismatches in
3114 global declarations from different compilation units.
3115 Requires @option{-flto} to be enabled. Enabled by default.
3116
3117 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3118 @opindex Wnarrowing
3119 @opindex Wno-narrowing
3120 For C++11 and later standards, narrowing conversions are diagnosed by default,
3121 as required by the standard. A narrowing conversion from a constant produces
3122 an error, and a narrowing conversion from a non-constant produces a warning,
3123 but @option{-Wno-narrowing} suppresses the diagnostic.
3124 Note that this does not affect the meaning of well-formed code;
3125 narrowing conversions are still considered ill-formed in SFINAE contexts.
3126
3127 With @option{-Wnarrowing} in C++98, warn when a narrowing
3128 conversion prohibited by C++11 occurs within
3129 @samp{@{ @}}, e.g.
3130
3131 @smallexample
3132 int i = @{ 2.2 @}; // error: narrowing from double to int
3133 @end smallexample
3134
3135 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3136
3137 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3138 @opindex Wnoexcept
3139 @opindex Wno-noexcept
3140 Warn when a noexcept-expression evaluates to false because of a call
3141 to a function that does not have a non-throwing exception
3142 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3143 the compiler to never throw an exception.
3144
3145 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3146 @opindex Wnoexcept-type
3147 @opindex Wno-noexcept-type
3148 Warn if the C++17 feature making @code{noexcept} part of a function
3149 type changes the mangled name of a symbol relative to C++14. Enabled
3150 by @option{-Wabi} and @option{-Wc++17-compat}.
3151
3152 As an example:
3153
3154 @smallexample
3155 template <class T> void f(T t) @{ t(); @};
3156 void g() noexcept;
3157 void h() @{ f(g); @}
3158 @end smallexample
3159
3160 @noindent
3161 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3162 C++17 it calls @code{f<void(*)()noexcept>}.
3163
3164 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3165 @opindex Wclass-memaccess
3166 @opindex Wno-class-memaccess
3167 Warn when the destination of a call to a raw memory function such as
3168 @code{memset} or @code{memcpy} is an object of class type, and when writing
3169 into such an object might bypass the class non-trivial or deleted constructor
3170 or copy assignment, violate const-correctness or encapsulation, or corrupt
3171 virtual table pointers. Modifying the representation of such objects may
3172 violate invariants maintained by member functions of the class. For example,
3173 the call to @code{memset} below is undefined because it modifies a non-trivial
3174 class object and is, therefore, diagnosed. The safe way to either initialize
3175 or clear the storage of objects of such types is by using the appropriate
3176 constructor or assignment operator, if one is available.
3177 @smallexample
3178 std::string str = "abc";
3179 memset (&str, 0, sizeof str);
3180 @end smallexample
3181 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3182 Explicitly casting the pointer to the class object to @code{void *} or
3183 to a type that can be safely accessed by the raw memory function suppresses
3184 the warning.
3185
3186 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3187 @opindex Wnon-virtual-dtor
3188 @opindex Wno-non-virtual-dtor
3189 Warn when a class has virtual functions and an accessible non-virtual
3190 destructor itself or in an accessible polymorphic base class, in which
3191 case it is possible but unsafe to delete an instance of a derived
3192 class through a pointer to the class itself or base class. This
3193 warning is automatically enabled if @option{-Weffc++} is specified.
3194
3195 @item -Wregister @r{(C++ and Objective-C++ only)}
3196 @opindex Wregister
3197 @opindex Wno-register
3198 Warn on uses of the @code{register} storage class specifier, except
3199 when it is part of the GNU @ref{Explicit Register Variables} extension.
3200 The use of the @code{register} keyword as storage class specifier has
3201 been deprecated in C++11 and removed in C++17.
3202 Enabled by default with @option{-std=c++17}.
3203
3204 @item -Wreorder @r{(C++ and Objective-C++ only)}
3205 @opindex Wreorder
3206 @opindex Wno-reorder
3207 @cindex reordering, warning
3208 @cindex warning for reordering of member initializers
3209 Warn when the order of member initializers given in the code does not
3210 match the order in which they must be executed. For instance:
3211
3212 @smallexample
3213 struct A @{
3214 int i;
3215 int j;
3216 A(): j (0), i (1) @{ @}
3217 @};
3218 @end smallexample
3219
3220 @noindent
3221 The compiler rearranges the member initializers for @code{i}
3222 and @code{j} to match the declaration order of the members, emitting
3223 a warning to that effect. This warning is enabled by @option{-Wall}.
3224
3225 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3226 @opindex Wpessimizing-move
3227 @opindex Wno-pessimizing-move
3228 This warning warns when a call to @code{std::move} prevents copy
3229 elision. A typical scenario when copy elision can occur is when returning in
3230 a function with a class return type, when the expression being returned is the
3231 name of a non-volatile automatic object, and is not a function parameter, and
3232 has the same type as the function return type.
3233
3234 @smallexample
3235 struct T @{
3236 @dots{}
3237 @};
3238 T fn()
3239 @{
3240 T t;
3241 @dots{}
3242 return std::move (t);
3243 @}
3244 @end smallexample
3245
3246 But in this example, the @code{std::move} call prevents copy elision.
3247
3248 This warning is enabled by @option{-Wall}.
3249
3250 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3251 @opindex Wredundant-move
3252 @opindex Wno-redundant-move
3253 This warning warns about redundant calls to @code{std::move}; that is, when
3254 a move operation would have been performed even without the @code{std::move}
3255 call. This happens because the compiler is forced to treat the object as if
3256 it were an rvalue in certain situations such as returning a local variable,
3257 where copy elision isn't applicable. Consider:
3258
3259 @smallexample
3260 struct T @{
3261 @dots{}
3262 @};
3263 T fn(T t)
3264 @{
3265 @dots{}
3266 return std::move (t);
3267 @}
3268 @end smallexample
3269
3270 Here, the @code{std::move} call is redundant. Because G++ implements Core
3271 Issue 1579, another example is:
3272
3273 @smallexample
3274 struct T @{ // convertible to U
3275 @dots{}
3276 @};
3277 struct U @{
3278 @dots{}
3279 @};
3280 U fn()
3281 @{
3282 T t;
3283 @dots{}
3284 return std::move (t);
3285 @}
3286 @end smallexample
3287 In this example, copy elision isn't applicable because the type of the
3288 expression being returned and the function return type differ, yet G++
3289 treats the return value as if it were designated by an rvalue.
3290
3291 This warning is enabled by @option{-Wextra}.
3292
3293 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3294 @opindex fext-numeric-literals
3295 @opindex fno-ext-numeric-literals
3296 Accept imaginary, fixed-point, or machine-defined
3297 literal number suffixes as GNU extensions.
3298 When this option is turned off these suffixes are treated
3299 as C++11 user-defined literal numeric suffixes.
3300 This is on by default for all pre-C++11 dialects and all GNU dialects:
3301 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3302 @option{-std=gnu++14}.
3303 This option is off by default
3304 for ISO C++11 onwards (@option{-std=c++11}, ...).
3305 @end table
3306
3307 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3308
3309 @table @gcctabopt
3310 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3311 @opindex Weffc++
3312 @opindex Wno-effc++
3313 Warn about violations of the following style guidelines from Scott Meyers'
3314 @cite{Effective C++} series of books:
3315
3316 @itemize @bullet
3317 @item
3318 Define a copy constructor and an assignment operator for classes
3319 with dynamically-allocated memory.
3320
3321 @item
3322 Prefer initialization to assignment in constructors.
3323
3324 @item
3325 Have @code{operator=} return a reference to @code{*this}.
3326
3327 @item
3328 Don't try to return a reference when you must return an object.
3329
3330 @item
3331 Distinguish between prefix and postfix forms of increment and
3332 decrement operators.
3333
3334 @item
3335 Never overload @code{&&}, @code{||}, or @code{,}.
3336
3337 @end itemize
3338
3339 This option also enables @option{-Wnon-virtual-dtor}, which is also
3340 one of the effective C++ recommendations. However, the check is
3341 extended to warn about the lack of virtual destructor in accessible
3342 non-polymorphic bases classes too.
3343
3344 When selecting this option, be aware that the standard library
3345 headers do not obey all of these guidelines; use @samp{grep -v}
3346 to filter out those warnings.
3347
3348 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3349 @opindex Wstrict-null-sentinel
3350 @opindex Wno-strict-null-sentinel
3351 Warn about the use of an uncasted @code{NULL} as sentinel. When
3352 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3353 to @code{__null}. Although it is a null pointer constant rather than a
3354 null pointer, it is guaranteed to be of the same size as a pointer.
3355 But this use is not portable across different compilers.
3356
3357 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3358 @opindex Wno-non-template-friend
3359 @opindex Wnon-template-friend
3360 Disable warnings when non-template friend functions are declared
3361 within a template. In very old versions of GCC that predate implementation
3362 of the ISO standard, declarations such as
3363 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3364 could be interpreted as a particular specialization of a template
3365 function; the warning exists to diagnose compatibility problems,
3366 and is enabled by default.
3367
3368 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3369 @opindex Wold-style-cast
3370 @opindex Wno-old-style-cast
3371 Warn if an old-style (C-style) cast to a non-void type is used within
3372 a C++ program. The new-style casts (@code{dynamic_cast},
3373 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3374 less vulnerable to unintended effects and much easier to search for.
3375
3376 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3377 @opindex Woverloaded-virtual
3378 @opindex Wno-overloaded-virtual
3379 @cindex overloaded virtual function, warning
3380 @cindex warning for overloaded virtual function
3381 Warn when a function declaration hides virtual functions from a
3382 base class. For example, in:
3383
3384 @smallexample
3385 struct A @{
3386 virtual void f();
3387 @};
3388
3389 struct B: public A @{
3390 void f(int);
3391 @};
3392 @end smallexample
3393
3394 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3395 like:
3396
3397 @smallexample
3398 B* b;
3399 b->f();
3400 @end smallexample
3401
3402 @noindent
3403 fails to compile.
3404
3405 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3406 @opindex Wno-pmf-conversions
3407 @opindex Wpmf-conversions
3408 Disable the diagnostic for converting a bound pointer to member function
3409 to a plain pointer.
3410
3411 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3412 @opindex Wsign-promo
3413 @opindex Wno-sign-promo
3414 Warn when overload resolution chooses a promotion from unsigned or
3415 enumerated type to a signed type, over a conversion to an unsigned type of
3416 the same size. Previous versions of G++ tried to preserve
3417 unsignedness, but the standard mandates the current behavior.
3418
3419 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3420 @opindex Wtemplates
3421 @opindex Wno-templates
3422 Warn when a primary template declaration is encountered. Some coding
3423 rules disallow templates, and this may be used to enforce that rule.
3424 The warning is inactive inside a system header file, such as the STL, so
3425 one can still use the STL. One may also instantiate or specialize
3426 templates.
3427
3428 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3429 @opindex Wmultiple-inheritance
3430 @opindex Wno-multiple-inheritance
3431 Warn when a class is defined with multiple direct base classes. Some
3432 coding rules disallow multiple inheritance, and this may be used to
3433 enforce that rule. The warning is inactive inside a system header file,
3434 such as the STL, so one can still use the STL. One may also define
3435 classes that indirectly use multiple inheritance.
3436
3437 @item -Wvirtual-inheritance
3438 @opindex Wvirtual-inheritance
3439 @opindex Wno-virtual-inheritance
3440 Warn when a class is defined with a virtual direct base class. Some
3441 coding rules disallow multiple inheritance, and this may be used to
3442 enforce that rule. The warning is inactive inside a system header file,
3443 such as the STL, so one can still use the STL. One may also define
3444 classes that indirectly use virtual inheritance.
3445
3446 @item -Wnamespaces
3447 @opindex Wnamespaces
3448 @opindex Wno-namespaces
3449 Warn when a namespace definition is opened. Some coding rules disallow
3450 namespaces, and this may be used to enforce that rule. The warning is
3451 inactive inside a system header file, such as the STL, so one can still
3452 use the STL. One may also use using directives and qualified names.
3453
3454 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3455 @opindex Wterminate
3456 @opindex Wno-terminate
3457 Disable the warning about a throw-expression that will immediately
3458 result in a call to @code{terminate}.
3459
3460 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3461 @opindex Wno-class-conversion
3462 @opindex Wclass-conversion
3463 Disable the warning about the case when a conversion function converts an
3464 object to the same type, to a base class of that type, or to void; such
3465 a conversion function will never be called.
3466 @end table
3467
3468 @node Objective-C and Objective-C++ Dialect Options
3469 @section Options Controlling Objective-C and Objective-C++ Dialects
3470
3471 @cindex compiler options, Objective-C and Objective-C++
3472 @cindex Objective-C and Objective-C++ options, command-line
3473 @cindex options, Objective-C and Objective-C++
3474 (NOTE: This manual does not describe the Objective-C and Objective-C++
3475 languages themselves. @xref{Standards,,Language Standards
3476 Supported by GCC}, for references.)
3477
3478 This section describes the command-line options that are only meaningful
3479 for Objective-C and Objective-C++ programs. You can also use most of
3480 the language-independent GNU compiler options.
3481 For example, you might compile a file @file{some_class.m} like this:
3482
3483 @smallexample
3484 gcc -g -fgnu-runtime -O -c some_class.m
3485 @end smallexample
3486
3487 @noindent
3488 In this example, @option{-fgnu-runtime} is an option meant only for
3489 Objective-C and Objective-C++ programs; you can use the other options with
3490 any language supported by GCC@.
3491
3492 Note that since Objective-C is an extension of the C language, Objective-C
3493 compilations may also use options specific to the C front-end (e.g.,
3494 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3495 C++-specific options (e.g., @option{-Wabi}).
3496
3497 Here is a list of options that are @emph{only} for compiling Objective-C
3498 and Objective-C++ programs:
3499
3500 @table @gcctabopt
3501 @item -fconstant-string-class=@var{class-name}
3502 @opindex fconstant-string-class
3503 Use @var{class-name} as the name of the class to instantiate for each
3504 literal string specified with the syntax @code{@@"@dots{}"}. The default
3505 class name is @code{NXConstantString} if the GNU runtime is being used, and
3506 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3507 @option{-fconstant-cfstrings} option, if also present, overrides the
3508 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3509 to be laid out as constant CoreFoundation strings.
3510
3511 @item -fgnu-runtime
3512 @opindex fgnu-runtime
3513 Generate object code compatible with the standard GNU Objective-C
3514 runtime. This is the default for most types of systems.
3515
3516 @item -fnext-runtime
3517 @opindex fnext-runtime
3518 Generate output compatible with the NeXT runtime. This is the default
3519 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3520 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3521 used.
3522
3523 @item -fno-nil-receivers
3524 @opindex fno-nil-receivers
3525 @opindex fnil-receivers
3526 Assume that all Objective-C message dispatches (@code{[receiver
3527 message:arg]}) in this translation unit ensure that the receiver is
3528 not @code{nil}. This allows for more efficient entry points in the
3529 runtime to be used. This option is only available in conjunction with
3530 the NeXT runtime and ABI version 0 or 1.
3531
3532 @item -fobjc-abi-version=@var{n}
3533 @opindex fobjc-abi-version
3534 Use version @var{n} of the Objective-C ABI for the selected runtime.
3535 This option is currently supported only for the NeXT runtime. In that
3536 case, Version 0 is the traditional (32-bit) ABI without support for
3537 properties and other Objective-C 2.0 additions. Version 1 is the
3538 traditional (32-bit) ABI with support for properties and other
3539 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3540 nothing is specified, the default is Version 0 on 32-bit target
3541 machines, and Version 2 on 64-bit target machines.
3542
3543 @item -fobjc-call-cxx-cdtors
3544 @opindex fobjc-call-cxx-cdtors
3545 For each Objective-C class, check if any of its instance variables is a
3546 C++ object with a non-trivial default constructor. If so, synthesize a
3547 special @code{- (id) .cxx_construct} instance method which runs
3548 non-trivial default constructors on any such instance variables, in order,
3549 and then return @code{self}. Similarly, check if any instance variable
3550 is a C++ object with a non-trivial destructor, and if so, synthesize a
3551 special @code{- (void) .cxx_destruct} method which runs
3552 all such default destructors, in reverse order.
3553
3554 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3555 methods thusly generated only operate on instance variables
3556 declared in the current Objective-C class, and not those inherited
3557 from superclasses. It is the responsibility of the Objective-C
3558 runtime to invoke all such methods in an object's inheritance
3559 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3560 by the runtime immediately after a new object instance is allocated;
3561 the @code{- (void) .cxx_destruct} methods are invoked immediately
3562 before the runtime deallocates an object instance.
3563
3564 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3565 support for invoking the @code{- (id) .cxx_construct} and
3566 @code{- (void) .cxx_destruct} methods.
3567
3568 @item -fobjc-direct-dispatch
3569 @opindex fobjc-direct-dispatch
3570 Allow fast jumps to the message dispatcher. On Darwin this is
3571 accomplished via the comm page.
3572
3573 @item -fobjc-exceptions
3574 @opindex fobjc-exceptions
3575 Enable syntactic support for structured exception handling in
3576 Objective-C, similar to what is offered by C++. This option
3577 is required to use the Objective-C keywords @code{@@try},
3578 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3579 @code{@@synchronized}. This option is available with both the GNU
3580 runtime and the NeXT runtime (but not available in conjunction with
3581 the NeXT runtime on Mac OS X 10.2 and earlier).
3582
3583 @item -fobjc-gc
3584 @opindex fobjc-gc
3585 Enable garbage collection (GC) in Objective-C and Objective-C++
3586 programs. This option is only available with the NeXT runtime; the
3587 GNU runtime has a different garbage collection implementation that
3588 does not require special compiler flags.
3589
3590 @item -fobjc-nilcheck
3591 @opindex fobjc-nilcheck
3592 For the NeXT runtime with version 2 of the ABI, check for a nil
3593 receiver in method invocations before doing the actual method call.
3594 This is the default and can be disabled using
3595 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3596 checked for nil in this way no matter what this flag is set to.
3597 Currently this flag does nothing when the GNU runtime, or an older
3598 version of the NeXT runtime ABI, is used.
3599
3600 @item -fobjc-std=objc1
3601 @opindex fobjc-std
3602 Conform to the language syntax of Objective-C 1.0, the language
3603 recognized by GCC 4.0. This only affects the Objective-C additions to
3604 the C/C++ language; it does not affect conformance to C/C++ standards,
3605 which is controlled by the separate C/C++ dialect option flags. When
3606 this option is used with the Objective-C or Objective-C++ compiler,
3607 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3608 This is useful if you need to make sure that your Objective-C code can
3609 be compiled with older versions of GCC@.
3610
3611 @item -freplace-objc-classes
3612 @opindex freplace-objc-classes
3613 Emit a special marker instructing @command{ld(1)} not to statically link in
3614 the resulting object file, and allow @command{dyld(1)} to load it in at
3615 run time instead. This is used in conjunction with the Fix-and-Continue
3616 debugging mode, where the object file in question may be recompiled and
3617 dynamically reloaded in the course of program execution, without the need
3618 to restart the program itself. Currently, Fix-and-Continue functionality
3619 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3620 and later.
3621
3622 @item -fzero-link
3623 @opindex fzero-link
3624 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3625 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3626 compile time) with static class references that get initialized at load time,
3627 which improves run-time performance. Specifying the @option{-fzero-link} flag
3628 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3629 to be retained. This is useful in Zero-Link debugging mode, since it allows
3630 for individual class implementations to be modified during program execution.
3631 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3632 regardless of command-line options.
3633
3634 @item -fno-local-ivars
3635 @opindex fno-local-ivars
3636 @opindex flocal-ivars
3637 By default instance variables in Objective-C can be accessed as if
3638 they were local variables from within the methods of the class they're
3639 declared in. This can lead to shadowing between instance variables
3640 and other variables declared either locally inside a class method or
3641 globally with the same name. Specifying the @option{-fno-local-ivars}
3642 flag disables this behavior thus avoiding variable shadowing issues.
3643
3644 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3645 @opindex fivar-visibility
3646 Set the default instance variable visibility to the specified option
3647 so that instance variables declared outside the scope of any access
3648 modifier directives default to the specified visibility.
3649
3650 @item -gen-decls
3651 @opindex gen-decls
3652 Dump interface declarations for all classes seen in the source file to a
3653 file named @file{@var{sourcename}.decl}.
3654
3655 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3656 @opindex Wassign-intercept
3657 @opindex Wno-assign-intercept
3658 Warn whenever an Objective-C assignment is being intercepted by the
3659 garbage collector.
3660
3661 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3662 @opindex Wno-protocol
3663 @opindex Wprotocol
3664 If a class is declared to implement a protocol, a warning is issued for
3665 every method in the protocol that is not implemented by the class. The
3666 default behavior is to issue a warning for every method not explicitly
3667 implemented in the class, even if a method implementation is inherited
3668 from the superclass. If you use the @option{-Wno-protocol} option, then
3669 methods inherited from the superclass are considered to be implemented,
3670 and no warning is issued for them.
3671
3672 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3673 @opindex Wselector
3674 @opindex Wno-selector
3675 Warn if multiple methods of different types for the same selector are
3676 found during compilation. The check is performed on the list of methods
3677 in the final stage of compilation. Additionally, a check is performed
3678 for each selector appearing in a @code{@@selector(@dots{})}
3679 expression, and a corresponding method for that selector has been found
3680 during compilation. Because these checks scan the method table only at
3681 the end of compilation, these warnings are not produced if the final
3682 stage of compilation is not reached, for example because an error is
3683 found during compilation, or because the @option{-fsyntax-only} option is
3684 being used.
3685
3686 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3687 @opindex Wstrict-selector-match
3688 @opindex Wno-strict-selector-match
3689 Warn if multiple methods with differing argument and/or return types are
3690 found for a given selector when attempting to send a message using this
3691 selector to a receiver of type @code{id} or @code{Class}. When this flag
3692 is off (which is the default behavior), the compiler omits such warnings
3693 if any differences found are confined to types that share the same size
3694 and alignment.
3695
3696 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3697 @opindex Wundeclared-selector
3698 @opindex Wno-undeclared-selector
3699 Warn if a @code{@@selector(@dots{})} expression referring to an
3700 undeclared selector is found. A selector is considered undeclared if no
3701 method with that name has been declared before the
3702 @code{@@selector(@dots{})} expression, either explicitly in an
3703 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3704 an @code{@@implementation} section. This option always performs its
3705 checks as soon as a @code{@@selector(@dots{})} expression is found,
3706 while @option{-Wselector} only performs its checks in the final stage of
3707 compilation. This also enforces the coding style convention
3708 that methods and selectors must be declared before being used.
3709
3710 @item -print-objc-runtime-info
3711 @opindex print-objc-runtime-info
3712 Generate C header describing the largest structure that is passed by
3713 value, if any.
3714
3715 @end table
3716
3717 @node Diagnostic Message Formatting Options
3718 @section Options to Control Diagnostic Messages Formatting
3719 @cindex options to control diagnostics formatting
3720 @cindex diagnostic messages
3721 @cindex message formatting
3722
3723 Traditionally, diagnostic messages have been formatted irrespective of
3724 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3725 options described below
3726 to control the formatting algorithm for diagnostic messages,
3727 e.g.@: how many characters per line, how often source location
3728 information should be reported. Note that some language front ends may not
3729 honor these options.
3730
3731 @table @gcctabopt
3732 @item -fmessage-length=@var{n}
3733 @opindex fmessage-length
3734 Try to format error messages so that they fit on lines of about
3735 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3736 done; each error message appears on a single line. This is the
3737 default for all front ends.
3738
3739 Note - this option also affects the display of the @samp{#error} and
3740 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3741 function/type/variable attribute. It does not however affect the
3742 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3743
3744 @item -fdiagnostics-show-location=once
3745 @opindex fdiagnostics-show-location
3746 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3747 reporter to emit source location information @emph{once}; that is, in
3748 case the message is too long to fit on a single physical line and has to
3749 be wrapped, the source location won't be emitted (as prefix) again,
3750 over and over, in subsequent continuation lines. This is the default
3751 behavior.
3752
3753 @item -fdiagnostics-show-location=every-line
3754 Only meaningful in line-wrapping mode. Instructs the diagnostic
3755 messages reporter to emit the same source location information (as
3756 prefix) for physical lines that result from the process of breaking
3757 a message which is too long to fit on a single line.
3758
3759 @item -fdiagnostics-color[=@var{WHEN}]
3760 @itemx -fno-diagnostics-color
3761 @opindex fdiagnostics-color
3762 @cindex highlight, color
3763 @vindex GCC_COLORS @r{environment variable}
3764 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3765 or @samp{auto}. The default depends on how the compiler has been configured,
3766 it can be any of the above @var{WHEN} options or also @samp{never}
3767 if @env{GCC_COLORS} environment variable isn't present in the environment,
3768 and @samp{auto} otherwise.
3769 @samp{auto} means to use color only when the standard error is a terminal.
3770 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3771 aliases for @option{-fdiagnostics-color=always} and
3772 @option{-fdiagnostics-color=never}, respectively.
3773
3774 The colors are defined by the environment variable @env{GCC_COLORS}.
3775 Its value is a colon-separated list of capabilities and Select Graphic
3776 Rendition (SGR) substrings. SGR commands are interpreted by the
3777 terminal or terminal emulator. (See the section in the documentation
3778 of your text terminal for permitted values and their meanings as
3779 character attributes.) These substring values are integers in decimal
3780 representation and can be concatenated with semicolons.
3781 Common values to concatenate include
3782 @samp{1} for bold,
3783 @samp{4} for underline,
3784 @samp{5} for blink,
3785 @samp{7} for inverse,
3786 @samp{39} for default foreground color,
3787 @samp{30} to @samp{37} for foreground colors,
3788 @samp{90} to @samp{97} for 16-color mode foreground colors,
3789 @samp{38;5;0} to @samp{38;5;255}
3790 for 88-color and 256-color modes foreground colors,
3791 @samp{49} for default background color,
3792 @samp{40} to @samp{47} for background colors,
3793 @samp{100} to @samp{107} for 16-color mode background colors,
3794 and @samp{48;5;0} to @samp{48;5;255}
3795 for 88-color and 256-color modes background colors.
3796
3797 The default @env{GCC_COLORS} is
3798 @smallexample
3799 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3800 quote=01:fixit-insert=32:fixit-delete=31:\
3801 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3802 type-diff=01;32
3803 @end smallexample
3804 @noindent
3805 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3806 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3807 @samp{01} is bold, and @samp{31} is red.
3808 Setting @env{GCC_COLORS} to the empty string disables colors.
3809 Supported capabilities are as follows.
3810
3811 @table @code
3812 @item error=
3813 @vindex error GCC_COLORS @r{capability}
3814 SGR substring for error: markers.
3815
3816 @item warning=
3817 @vindex warning GCC_COLORS @r{capability}
3818 SGR substring for warning: markers.
3819
3820 @item note=
3821 @vindex note GCC_COLORS @r{capability}
3822 SGR substring for note: markers.
3823
3824 @item range1=
3825 @vindex range1 GCC_COLORS @r{capability}
3826 SGR substring for first additional range.
3827
3828 @item range2=
3829 @vindex range2 GCC_COLORS @r{capability}
3830 SGR substring for second additional range.
3831
3832 @item locus=
3833 @vindex locus GCC_COLORS @r{capability}
3834 SGR substring for location information, @samp{file:line} or
3835 @samp{file:line:column} etc.
3836
3837 @item quote=
3838 @vindex quote GCC_COLORS @r{capability}
3839 SGR substring for information printed within quotes.
3840
3841 @item fixit-insert=
3842 @vindex fixit-insert GCC_COLORS @r{capability}
3843 SGR substring for fix-it hints suggesting text to
3844 be inserted or replaced.
3845
3846 @item fixit-delete=
3847 @vindex fixit-delete GCC_COLORS @r{capability}
3848 SGR substring for fix-it hints suggesting text to
3849 be deleted.
3850
3851 @item diff-filename=
3852 @vindex diff-filename GCC_COLORS @r{capability}
3853 SGR substring for filename headers within generated patches.
3854
3855 @item diff-hunk=
3856 @vindex diff-hunk GCC_COLORS @r{capability}
3857 SGR substring for the starts of hunks within generated patches.
3858
3859 @item diff-delete=
3860 @vindex diff-delete GCC_COLORS @r{capability}
3861 SGR substring for deleted lines within generated patches.
3862
3863 @item diff-insert=
3864 @vindex diff-insert GCC_COLORS @r{capability}
3865 SGR substring for inserted lines within generated patches.
3866
3867 @item type-diff=
3868 @vindex type-diff GCC_COLORS @r{capability}
3869 SGR substring for highlighting mismatching types within template
3870 arguments in the C++ frontend.
3871 @end table
3872
3873 @item -fno-diagnostics-show-option
3874 @opindex fno-diagnostics-show-option
3875 @opindex fdiagnostics-show-option
3876 By default, each diagnostic emitted includes text indicating the
3877 command-line option that directly controls the diagnostic (if such an
3878 option is known to the diagnostic machinery). Specifying the
3879 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3880
3881 @item -fno-diagnostics-show-caret
3882 @opindex fno-diagnostics-show-caret
3883 @opindex fdiagnostics-show-caret
3884 By default, each diagnostic emitted includes the original source line
3885 and a caret @samp{^} indicating the column. This option suppresses this
3886 information. The source line is truncated to @var{n} characters, if
3887 the @option{-fmessage-length=n} option is given. When the output is done
3888 to the terminal, the width is limited to the width given by the
3889 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3890
3891 @item -fno-diagnostics-show-labels
3892 @opindex fno-diagnostics-show-labels
3893 @opindex fdiagnostics-show-labels
3894 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3895 diagnostics can label ranges of source code with pertinent information, such
3896 as the types of expressions:
3897
3898 @smallexample
3899 printf ("foo %s bar", long_i + long_j);
3900 ~^ ~~~~~~~~~~~~~~~
3901 | |
3902 char * long int
3903 @end smallexample
3904
3905 This option suppresses the printing of these labels (in the example above,
3906 the vertical bars and the ``char *'' and ``long int'' text).
3907
3908 @item -fno-diagnostics-show-line-numbers
3909 @opindex fno-diagnostics-show-line-numbers
3910 @opindex fdiagnostics-show-line-numbers
3911 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3912 a left margin is printed, showing line numbers. This option suppresses this
3913 left margin.
3914
3915 @item -fdiagnostics-minimum-margin-width=@var{width}
3916 @opindex fdiagnostics-minimum-margin-width
3917 This option controls the minimum width of the left margin printed by
3918 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3919
3920 @item -fdiagnostics-parseable-fixits
3921 @opindex fdiagnostics-parseable-fixits
3922 Emit fix-it hints in a machine-parseable format, suitable for consumption
3923 by IDEs. For each fix-it, a line will be printed after the relevant
3924 diagnostic, starting with the string ``fix-it:''. For example:
3925
3926 @smallexample
3927 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3928 @end smallexample
3929
3930 The location is expressed as a half-open range, expressed as a count of
3931 bytes, starting at byte 1 for the initial column. In the above example,
3932 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3933 given string:
3934
3935 @smallexample
3936 00000000011111111112222222222
3937 12345678901234567890123456789
3938 gtk_widget_showall (dlg);
3939 ^^^^^^^^^^^^^^^^^^
3940 gtk_widget_show_all
3941 @end smallexample
3942
3943 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3944 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3945 (e.g. vertical tab as ``\013'').
3946
3947 An empty replacement string indicates that the given range is to be removed.
3948 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3949 be inserted at the given position.
3950
3951 @item -fdiagnostics-generate-patch
3952 @opindex fdiagnostics-generate-patch
3953 Print fix-it hints to stderr in unified diff format, after any diagnostics
3954 are printed. For example:
3955
3956 @smallexample
3957 --- test.c
3958 +++ test.c
3959 @@ -42,5 +42,5 @@
3960
3961 void show_cb(GtkDialog *dlg)
3962 @{
3963 - gtk_widget_showall(dlg);
3964 + gtk_widget_show_all(dlg);
3965 @}
3966
3967 @end smallexample
3968
3969 The diff may or may not be colorized, following the same rules
3970 as for diagnostics (see @option{-fdiagnostics-color}).
3971
3972 @item -fdiagnostics-show-template-tree
3973 @opindex fdiagnostics-show-template-tree
3974
3975 In the C++ frontend, when printing diagnostics showing mismatching
3976 template types, such as:
3977
3978 @smallexample
3979 could not convert 'std::map<int, std::vector<double> >()'
3980 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3981 @end smallexample
3982
3983 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3984 tree-like structure showing the common and differing parts of the types,
3985 such as:
3986
3987 @smallexample
3988 map<
3989 [...],
3990 vector<
3991 [double != float]>>
3992 @end smallexample
3993
3994 The parts that differ are highlighted with color (``double'' and
3995 ``float'' in this case).
3996
3997 @item -fno-elide-type
3998 @opindex fno-elide-type
3999 @opindex felide-type
4000 By default when the C++ frontend prints diagnostics showing mismatching
4001 template types, common parts of the types are printed as ``[...]'' to
4002 simplify the error message. For example:
4003
4004 @smallexample
4005 could not convert 'std::map<int, std::vector<double> >()'
4006 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4007 @end smallexample
4008
4009 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4010 This flag also affects the output of the
4011 @option{-fdiagnostics-show-template-tree} flag.
4012
4013 @item -fno-show-column
4014 @opindex fno-show-column
4015 @opindex fshow-column
4016 Do not print column numbers in diagnostics. This may be necessary if
4017 diagnostics are being scanned by a program that does not understand the
4018 column numbers, such as @command{dejagnu}.
4019
4020 @item -fdiagnostics-format=@var{FORMAT}
4021 @opindex fdiagnostics-format
4022 Select a different format for printing diagnostics.
4023 @var{FORMAT} is @samp{text} or @samp{json}.
4024 The default is @samp{text}.
4025
4026 The @samp{json} format consists of a top-level JSON array containing JSON
4027 objects representing the diagnostics.
4028
4029 The JSON is emitted as one line, without formatting; the examples below
4030 have been formatted for clarity.
4031
4032 Diagnostics can have child diagnostics. For example, this error and note:
4033
4034 @smallexample
4035 misleading-indentation.c:15:3: warning: this 'if' clause does not
4036 guard... [-Wmisleading-indentation]
4037 15 | if (flag)
4038 | ^~
4039 misleading-indentation.c:17:5: note: ...this statement, but the latter
4040 is misleadingly indented as if it were guarded by the 'if'
4041 17 | y = 2;
4042 | ^
4043 @end smallexample
4044
4045 @noindent
4046 might be printed in JSON form (after formatting) like this:
4047
4048 @smallexample
4049 [
4050 @{
4051 "kind": "warning",
4052 "locations": [
4053 @{
4054 "caret": @{
4055 "column": 3,
4056 "file": "misleading-indentation.c",
4057 "line": 15
4058 @},
4059 "finish": @{
4060 "column": 4,
4061 "file": "misleading-indentation.c",
4062 "line": 15
4063 @}
4064 @}
4065 ],
4066 "message": "this \u2018if\u2019 clause does not guard...",
4067 "option": "-Wmisleading-indentation",
4068 "children": [
4069 @{
4070 "kind": "note",
4071 "locations": [
4072 @{
4073 "caret": @{
4074 "column": 5,
4075 "file": "misleading-indentation.c",
4076 "line": 17
4077 @}
4078 @}
4079 ],
4080 "message": "...this statement, but the latter is @dots{}"
4081 @}
4082 ]
4083 @},
4084 @dots{}
4085 ]
4086 @end smallexample
4087
4088 @noindent
4089 where the @code{note} is a child of the @code{warning}.
4090
4091 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4092 an @code{option} key describing the command-line option controlling the
4093 warning.
4094
4095 A diagnostic can contain zero or more locations. Each location has up
4096 to three positions within it: a @code{caret} position and optional
4097 @code{start} and @code{finish} positions. A location can also have
4098 an optional @code{label} string. For example, this error:
4099
4100 @smallexample
4101 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4102 'struct s'@} and 'T' @{aka 'struct t'@})
4103 64 | return callee_4a () + callee_4b ();
4104 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4105 | | |
4106 | | T @{aka struct t@}
4107 | S @{aka struct s@}
4108 @end smallexample
4109
4110 @noindent
4111 has three locations. Its primary location is at the ``+'' token at column
4112 23. It has two secondary locations, describing the left and right-hand sides
4113 of the expression, which have labels. It might be printed in JSON form as:
4114
4115 @smallexample
4116 @{
4117 "children": [],
4118 "kind": "error",
4119 "locations": [
4120 @{
4121 "caret": @{
4122 "column": 23, "file": "bad-binary-ops.c", "line": 64
4123 @}
4124 @},
4125 @{
4126 "caret": @{
4127 "column": 10, "file": "bad-binary-ops.c", "line": 64
4128 @},
4129 "finish": @{
4130 "column": 21, "file": "bad-binary-ops.c", "line": 64
4131 @},
4132 "label": "S @{aka struct s@}"
4133 @},
4134 @{
4135 "caret": @{
4136 "column": 25, "file": "bad-binary-ops.c", "line": 64
4137 @},
4138 "finish": @{
4139 "column": 36, "file": "bad-binary-ops.c", "line": 64
4140 @},
4141 "label": "T @{aka struct t@}"
4142 @}
4143 ],
4144 "message": "invalid operands to binary + @dots{}"
4145 @}
4146 @end smallexample
4147
4148 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4149 consisting of half-open intervals, similar to the output of
4150 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4151 with a replacement fix-it hint:
4152
4153 @smallexample
4154 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4155 mean 'color'?
4156 8 | return ptr->colour;
4157 | ^~~~~~
4158 | color
4159 @end smallexample
4160
4161 @noindent
4162 might be printed in JSON form as:
4163
4164 @smallexample
4165 @{
4166 "children": [],
4167 "fixits": [
4168 @{
4169 "next": @{
4170 "column": 21,
4171 "file": "demo.c",
4172 "line": 8
4173 @},
4174 "start": @{
4175 "column": 15,
4176 "file": "demo.c",
4177 "line": 8
4178 @},
4179 "string": "color"
4180 @}
4181 ],
4182 "kind": "error",
4183 "locations": [
4184 @{
4185 "caret": @{
4186 "column": 15,
4187 "file": "demo.c",
4188 "line": 8
4189 @},
4190 "finish": @{
4191 "column": 20,
4192 "file": "demo.c",
4193 "line": 8
4194 @}
4195 @}
4196 ],
4197 "message": "\u2018struct s\u2019 has no member named @dots{}"
4198 @}
4199 @end smallexample
4200
4201 @noindent
4202 where the fix-it hint suggests replacing the text from @code{start} up
4203 to but not including @code{next} with @code{string}'s value. Deletions
4204 are expressed via an empty value for @code{string}, insertions by
4205 having @code{start} equal @code{next}.
4206
4207 @end table
4208
4209 @node Warning Options
4210 @section Options to Request or Suppress Warnings
4211 @cindex options to control warnings
4212 @cindex warning messages
4213 @cindex messages, warning
4214 @cindex suppressing warnings
4215
4216 Warnings are diagnostic messages that report constructions that
4217 are not inherently erroneous but that are risky or suggest there
4218 may have been an error.
4219
4220 The following language-independent options do not enable specific
4221 warnings but control the kinds of diagnostics produced by GCC@.
4222
4223 @table @gcctabopt
4224 @cindex syntax checking
4225 @item -fsyntax-only
4226 @opindex fsyntax-only
4227 Check the code for syntax errors, but don't do anything beyond that.
4228
4229 @item -fmax-errors=@var{n}
4230 @opindex fmax-errors
4231 Limits the maximum number of error messages to @var{n}, at which point
4232 GCC bails out rather than attempting to continue processing the source
4233 code. If @var{n} is 0 (the default), there is no limit on the number
4234 of error messages produced. If @option{-Wfatal-errors} is also
4235 specified, then @option{-Wfatal-errors} takes precedence over this
4236 option.
4237
4238 @item -w
4239 @opindex w
4240 Inhibit all warning messages.
4241
4242 @item -Werror
4243 @opindex Werror
4244 @opindex Wno-error
4245 Make all warnings into errors.
4246
4247 @item -Werror=
4248 @opindex Werror=
4249 @opindex Wno-error=
4250 Make the specified warning into an error. The specifier for a warning
4251 is appended; for example @option{-Werror=switch} turns the warnings
4252 controlled by @option{-Wswitch} into errors. This switch takes a
4253 negative form, to be used to negate @option{-Werror} for specific
4254 warnings; for example @option{-Wno-error=switch} makes
4255 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4256 is in effect.
4257
4258 The warning message for each controllable warning includes the
4259 option that controls the warning. That option can then be used with
4260 @option{-Werror=} and @option{-Wno-error=} as described above.
4261 (Printing of the option in the warning message can be disabled using the
4262 @option{-fno-diagnostics-show-option} flag.)
4263
4264 Note that specifying @option{-Werror=}@var{foo} automatically implies
4265 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4266 imply anything.
4267
4268 @item -Wfatal-errors
4269 @opindex Wfatal-errors
4270 @opindex Wno-fatal-errors
4271 This option causes the compiler to abort compilation on the first error
4272 occurred rather than trying to keep going and printing further error
4273 messages.
4274
4275 @end table
4276
4277 You can request many specific warnings with options beginning with
4278 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4279 implicit declarations. Each of these specific warning options also
4280 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4281 example, @option{-Wno-implicit}. This manual lists only one of the
4282 two forms, whichever is not the default. For further
4283 language-specific options also refer to @ref{C++ Dialect Options} and
4284 @ref{Objective-C and Objective-C++ Dialect Options}.
4285
4286 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4287 options, such as @option{-Wunused}, which may turn on further options,
4288 such as @option{-Wunused-value}. The combined effect of positive and
4289 negative forms is that more specific options have priority over less
4290 specific ones, independently of their position in the command-line. For
4291 options of the same specificity, the last one takes effect. Options
4292 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4293 as if they appeared at the end of the command-line.
4294
4295 When an unrecognized warning option is requested (e.g.,
4296 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4297 that the option is not recognized. However, if the @option{-Wno-} form
4298 is used, the behavior is slightly different: no diagnostic is
4299 produced for @option{-Wno-unknown-warning} unless other diagnostics
4300 are being produced. This allows the use of new @option{-Wno-} options
4301 with old compilers, but if something goes wrong, the compiler
4302 warns that an unrecognized option is present.
4303
4304 @table @gcctabopt
4305 @item -Wpedantic
4306 @itemx -pedantic
4307 @opindex pedantic
4308 @opindex Wpedantic
4309 @opindex Wno-pedantic
4310 Issue all the warnings demanded by strict ISO C and ISO C++;
4311 reject all programs that use forbidden extensions, and some other
4312 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4313 version of the ISO C standard specified by any @option{-std} option used.
4314
4315 Valid ISO C and ISO C++ programs should compile properly with or without
4316 this option (though a rare few require @option{-ansi} or a
4317 @option{-std} option specifying the required version of ISO C)@. However,
4318 without this option, certain GNU extensions and traditional C and C++
4319 features are supported as well. With this option, they are rejected.
4320
4321 @option{-Wpedantic} does not cause warning messages for use of the
4322 alternate keywords whose names begin and end with @samp{__}. Pedantic
4323 warnings are also disabled in the expression that follows
4324 @code{__extension__}. However, only system header files should use
4325 these escape routes; application programs should avoid them.
4326 @xref{Alternate Keywords}.
4327
4328 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4329 C conformance. They soon find that it does not do quite what they want:
4330 it finds some non-ISO practices, but not all---only those for which
4331 ISO C @emph{requires} a diagnostic, and some others for which
4332 diagnostics have been added.
4333
4334 A feature to report any failure to conform to ISO C might be useful in
4335 some instances, but would require considerable additional work and would
4336 be quite different from @option{-Wpedantic}. We don't have plans to
4337 support such a feature in the near future.
4338
4339 Where the standard specified with @option{-std} represents a GNU
4340 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4341 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4342 extended dialect is based. Warnings from @option{-Wpedantic} are given
4343 where they are required by the base standard. (It does not make sense
4344 for such warnings to be given only for features not in the specified GNU
4345 C dialect, since by definition the GNU dialects of C include all
4346 features the compiler supports with the given option, and there would be
4347 nothing to warn about.)
4348
4349 @item -pedantic-errors
4350 @opindex pedantic-errors
4351 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4352 requires a diagnostic, in some cases where there is undefined behavior
4353 at compile-time and in some other cases that do not prevent compilation
4354 of programs that are valid according to the standard. This is not
4355 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4356 by this option and not enabled by the latter and vice versa.
4357
4358 @item -Wall
4359 @opindex Wall
4360 @opindex Wno-all
4361 This enables all the warnings about constructions that some users
4362 consider questionable, and that are easy to avoid (or modify to
4363 prevent the warning), even in conjunction with macros. This also
4364 enables some language-specific warnings described in @ref{C++ Dialect
4365 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4366
4367 @option{-Wall} turns on the following warning flags:
4368
4369 @gccoptlist{-Waddress @gol
4370 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4371 -Wbool-compare @gol
4372 -Wbool-operation @gol
4373 -Wc++11-compat -Wc++14-compat @gol
4374 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4375 -Wchar-subscripts @gol
4376 -Wcomment @gol
4377 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4378 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4379 -Wformat @gol
4380 -Wint-in-bool-context @gol
4381 -Wimplicit @r{(C and Objective-C only)} @gol
4382 -Wimplicit-int @r{(C and Objective-C only)} @gol
4383 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4384 -Winit-self @r{(only for C++)} @gol
4385 -Wlogical-not-parentheses @gol
4386 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4387 -Wmaybe-uninitialized @gol
4388 -Wmemset-elt-size @gol
4389 -Wmemset-transposed-args @gol
4390 -Wmisleading-indentation @r{(only for C/C++)} @gol
4391 -Wmissing-attributes @gol
4392 -Wmissing-braces @r{(only for C/ObjC)} @gol
4393 -Wmultistatement-macros @gol
4394 -Wnarrowing @r{(only for C++)} @gol
4395 -Wnonnull @gol
4396 -Wnonnull-compare @gol
4397 -Wopenmp-simd @gol
4398 -Wparentheses @gol
4399 -Wpessimizing-move @r{(only for C++)} @gol
4400 -Wpointer-sign @gol
4401 -Wreorder @gol
4402 -Wrestrict @gol
4403 -Wreturn-type @gol
4404 -Wsequence-point @gol
4405 -Wsign-compare @r{(only in C++)} @gol
4406 -Wsizeof-pointer-div @gol
4407 -Wsizeof-pointer-memaccess @gol
4408 -Wstrict-aliasing @gol
4409 -Wstrict-overflow=1 @gol
4410 -Wswitch @gol
4411 -Wtautological-compare @gol
4412 -Wtrigraphs @gol
4413 -Wuninitialized @gol
4414 -Wunknown-pragmas @gol
4415 -Wunused-function @gol
4416 -Wunused-label @gol
4417 -Wunused-value @gol
4418 -Wunused-variable @gol
4419 -Wvolatile-register-var}
4420
4421 Note that some warning flags are not implied by @option{-Wall}. Some of
4422 them warn about constructions that users generally do not consider
4423 questionable, but which occasionally you might wish to check for;
4424 others warn about constructions that are necessary or hard to avoid in
4425 some cases, and there is no simple way to modify the code to suppress
4426 the warning. Some of them are enabled by @option{-Wextra} but many of
4427 them must be enabled individually.
4428
4429 @item -Wextra
4430 @opindex W
4431 @opindex Wextra
4432 @opindex Wno-extra
4433 This enables some extra warning flags that are not enabled by
4434 @option{-Wall}. (This option used to be called @option{-W}. The older
4435 name is still supported, but the newer name is more descriptive.)
4436
4437 @gccoptlist{-Wclobbered @gol
4438 -Wcast-function-type @gol
4439 -Wdeprecated-copy @r{(C++ only)} @gol
4440 -Wempty-body @gol
4441 -Wignored-qualifiers @gol
4442 -Wimplicit-fallthrough=3 @gol
4443 -Wmissing-field-initializers @gol
4444 -Wmissing-parameter-type @r{(C only)} @gol
4445 -Wold-style-declaration @r{(C only)} @gol
4446 -Woverride-init @gol
4447 -Wsign-compare @r{(C only)} @gol
4448 -Wredundant-move @r{(only for C++)} @gol
4449 -Wtype-limits @gol
4450 -Wuninitialized @gol
4451 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4452 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4453 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4454
4455
4456 The option @option{-Wextra} also prints warning messages for the
4457 following cases:
4458
4459 @itemize @bullet
4460
4461 @item
4462 A pointer is compared against integer zero with @code{<}, @code{<=},
4463 @code{>}, or @code{>=}.
4464
4465 @item
4466 (C++ only) An enumerator and a non-enumerator both appear in a
4467 conditional expression.
4468
4469 @item
4470 (C++ only) Ambiguous virtual bases.
4471
4472 @item
4473 (C++ only) Subscripting an array that has been declared @code{register}.
4474
4475 @item
4476 (C++ only) Taking the address of a variable that has been declared
4477 @code{register}.
4478
4479 @item
4480 (C++ only) A base class is not initialized in the copy constructor
4481 of a derived class.
4482
4483 @end itemize
4484
4485 @item -Wchar-subscripts
4486 @opindex Wchar-subscripts
4487 @opindex Wno-char-subscripts
4488 Warn if an array subscript has type @code{char}. This is a common cause
4489 of error, as programmers often forget that this type is signed on some
4490 machines.
4491 This warning is enabled by @option{-Wall}.
4492
4493 @item -Wchkp
4494 @opindex Wchkp
4495 @opindex Wno-chkp
4496 Warn about an invalid memory access that is found by Pointer Bounds Checker
4497 (@option{-fcheck-pointer-bounds}).
4498
4499 @item -Wno-coverage-mismatch
4500 @opindex Wno-coverage-mismatch
4501 @opindex Wcoverage-mismatch
4502 Warn if feedback profiles do not match when using the
4503 @option{-fprofile-use} option.
4504 If a source file is changed between compiling with @option{-fprofile-generate}
4505 and with @option{-fprofile-use}, the files with the profile feedback can fail
4506 to match the source file and GCC cannot use the profile feedback
4507 information. By default, this warning is enabled and is treated as an
4508 error. @option{-Wno-coverage-mismatch} can be used to disable the
4509 warning or @option{-Wno-error=coverage-mismatch} can be used to
4510 disable the error. Disabling the error for this warning can result in
4511 poorly optimized code and is useful only in the
4512 case of very minor changes such as bug fixes to an existing code-base.
4513 Completely disabling the warning is not recommended.
4514
4515 @item -Wno-cpp
4516 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4517
4518 Suppress warning messages emitted by @code{#warning} directives.
4519
4520 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4521 @opindex Wdouble-promotion
4522 @opindex Wno-double-promotion
4523 Give a warning when a value of type @code{float} is implicitly
4524 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4525 floating-point unit implement @code{float} in hardware, but emulate
4526 @code{double} in software. On such a machine, doing computations
4527 using @code{double} values is much more expensive because of the
4528 overhead required for software emulation.
4529
4530 It is easy to accidentally do computations with @code{double} because
4531 floating-point literals are implicitly of type @code{double}. For
4532 example, in:
4533 @smallexample
4534 @group
4535 float area(float radius)
4536 @{
4537 return 3.14159 * radius * radius;
4538 @}
4539 @end group
4540 @end smallexample
4541 the compiler performs the entire computation with @code{double}
4542 because the floating-point literal is a @code{double}.
4543
4544 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4545 @opindex Wduplicate-decl-specifier
4546 @opindex Wno-duplicate-decl-specifier
4547 Warn if a declaration has duplicate @code{const}, @code{volatile},
4548 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4549 @option{-Wall}.
4550
4551 @item -Wformat
4552 @itemx -Wformat=@var{n}
4553 @opindex Wformat
4554 @opindex Wno-format
4555 @opindex ffreestanding
4556 @opindex fno-builtin
4557 @opindex Wformat=
4558 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4559 the arguments supplied have types appropriate to the format string
4560 specified, and that the conversions specified in the format string make
4561 sense. This includes standard functions, and others specified by format
4562 attributes (@pxref{Function Attributes}), in the @code{printf},
4563 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4564 not in the C standard) families (or other target-specific families).
4565 Which functions are checked without format attributes having been
4566 specified depends on the standard version selected, and such checks of
4567 functions without the attribute specified are disabled by
4568 @option{-ffreestanding} or @option{-fno-builtin}.
4569
4570 The formats are checked against the format features supported by GNU
4571 libc version 2.2. These include all ISO C90 and C99 features, as well
4572 as features from the Single Unix Specification and some BSD and GNU
4573 extensions. Other library implementations may not support all these
4574 features; GCC does not support warning about features that go beyond a
4575 particular library's limitations. However, if @option{-Wpedantic} is used
4576 with @option{-Wformat}, warnings are given about format features not
4577 in the selected standard version (but not for @code{strfmon} formats,
4578 since those are not in any version of the C standard). @xref{C Dialect
4579 Options,,Options Controlling C Dialect}.
4580
4581 @table @gcctabopt
4582 @item -Wformat=1
4583 @itemx -Wformat
4584 @opindex Wformat
4585 @opindex Wformat=1
4586 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4587 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4588 @option{-Wformat} also checks for null format arguments for several
4589 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4590 aspects of this level of format checking can be disabled by the
4591 options: @option{-Wno-format-contains-nul},
4592 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4593 @option{-Wformat} is enabled by @option{-Wall}.
4594
4595 @item -Wno-format-contains-nul
4596 @opindex Wno-format-contains-nul
4597 @opindex Wformat-contains-nul
4598 If @option{-Wformat} is specified, do not warn about format strings that
4599 contain NUL bytes.
4600
4601 @item -Wno-format-extra-args
4602 @opindex Wno-format-extra-args
4603 @opindex Wformat-extra-args
4604 If @option{-Wformat} is specified, do not warn about excess arguments to a
4605 @code{printf} or @code{scanf} format function. The C standard specifies
4606 that such arguments are ignored.
4607
4608 Where the unused arguments lie between used arguments that are
4609 specified with @samp{$} operand number specifications, normally
4610 warnings are still given, since the implementation could not know what
4611 type to pass to @code{va_arg} to skip the unused arguments. However,
4612 in the case of @code{scanf} formats, this option suppresses the
4613 warning if the unused arguments are all pointers, since the Single
4614 Unix Specification says that such unused arguments are allowed.
4615
4616 @item -Wformat-overflow
4617 @itemx -Wformat-overflow=@var{level}
4618 @opindex Wformat-overflow
4619 @opindex Wno-format-overflow
4620 Warn about calls to formatted input/output functions such as @code{sprintf}
4621 and @code{vsprintf} that might overflow the destination buffer. When the
4622 exact number of bytes written by a format directive cannot be determined
4623 at compile-time it is estimated based on heuristics that depend on the
4624 @var{level} argument and on optimization. While enabling optimization
4625 will in most cases improve the accuracy of the warning, it may also
4626 result in false positives.
4627
4628 @table @gcctabopt
4629 @item -Wformat-overflow
4630 @itemx -Wformat-overflow=1
4631 @opindex Wformat-overflow
4632 @opindex Wno-format-overflow
4633 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4634 employs a conservative approach that warns only about calls that most
4635 likely overflow the buffer. At this level, numeric arguments to format
4636 directives with unknown values are assumed to have the value of one, and
4637 strings of unknown length to be empty. Numeric arguments that are known
4638 to be bounded to a subrange of their type, or string arguments whose output
4639 is bounded either by their directive's precision or by a finite set of
4640 string literals, are assumed to take on the value within the range that
4641 results in the most bytes on output. For example, the call to @code{sprintf}
4642 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4643 the terminating NUL character (@code{'\0'}) appended by the function
4644 to the destination buffer will be written past its end. Increasing
4645 the size of the buffer by a single byte is sufficient to avoid the
4646 warning, though it may not be sufficient to avoid the overflow.
4647
4648 @smallexample
4649 void f (int a, int b)
4650 @{
4651 char buf [13];
4652 sprintf (buf, "a = %i, b = %i\n", a, b);
4653 @}
4654 @end smallexample
4655
4656 @item -Wformat-overflow=2
4657 Level @var{2} warns also about calls that might overflow the destination
4658 buffer given an argument of sufficient length or magnitude. At level
4659 @var{2}, unknown numeric arguments are assumed to have the minimum
4660 representable value for signed types with a precision greater than 1, and
4661 the maximum representable value otherwise. Unknown string arguments whose
4662 length cannot be assumed to be bounded either by the directive's precision,
4663 or by a finite set of string literals they may evaluate to, or the character
4664 array they may point to, are assumed to be 1 character long.
4665
4666 At level @var{2}, the call in the example above is again diagnosed, but
4667 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4668 @code{%i} directive will write some of its digits beyond the end of
4669 the destination buffer. To make the call safe regardless of the values
4670 of the two variables, the size of the destination buffer must be increased
4671 to at least 34 bytes. GCC includes the minimum size of the buffer in
4672 an informational note following the warning.
4673
4674 An alternative to increasing the size of the destination buffer is to
4675 constrain the range of formatted values. The maximum length of string
4676 arguments can be bounded by specifying the precision in the format
4677 directive. When numeric arguments of format directives can be assumed
4678 to be bounded by less than the precision of their type, choosing
4679 an appropriate length modifier to the format specifier will reduce
4680 the required buffer size. For example, if @var{a} and @var{b} in the
4681 example above can be assumed to be within the precision of
4682 the @code{short int} type then using either the @code{%hi} format
4683 directive or casting the argument to @code{short} reduces the maximum
4684 required size of the buffer to 24 bytes.
4685
4686 @smallexample
4687 void f (int a, int b)
4688 @{
4689 char buf [23];
4690 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4691 @}
4692 @end smallexample
4693 @end table
4694
4695 @item -Wno-format-zero-length
4696 @opindex Wno-format-zero-length
4697 @opindex Wformat-zero-length
4698 If @option{-Wformat} is specified, do not warn about zero-length formats.
4699 The C standard specifies that zero-length formats are allowed.
4700
4701
4702 @item -Wformat=2
4703 @opindex Wformat=2
4704 Enable @option{-Wformat} plus additional format checks. Currently
4705 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4706 -Wformat-y2k}.
4707
4708 @item -Wformat-nonliteral
4709 @opindex Wformat-nonliteral
4710 @opindex Wno-format-nonliteral
4711 If @option{-Wformat} is specified, also warn if the format string is not a
4712 string literal and so cannot be checked, unless the format function
4713 takes its format arguments as a @code{va_list}.
4714
4715 @item -Wformat-security
4716 @opindex Wformat-security
4717 @opindex Wno-format-security
4718 If @option{-Wformat} is specified, also warn about uses of format
4719 functions that represent possible security problems. At present, this
4720 warns about calls to @code{printf} and @code{scanf} functions where the
4721 format string is not a string literal and there are no format arguments,
4722 as in @code{printf (foo);}. This may be a security hole if the format
4723 string came from untrusted input and contains @samp{%n}. (This is
4724 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4725 in future warnings may be added to @option{-Wformat-security} that are not
4726 included in @option{-Wformat-nonliteral}.)
4727
4728 @item -Wformat-signedness
4729 @opindex Wformat-signedness
4730 @opindex Wno-format-signedness
4731 If @option{-Wformat} is specified, also warn if the format string
4732 requires an unsigned argument and the argument is signed and vice versa.
4733
4734 @item -Wformat-truncation
4735 @itemx -Wformat-truncation=@var{level}
4736 @opindex Wformat-truncation
4737 @opindex Wno-format-truncation
4738 Warn about calls to formatted input/output functions such as @code{snprintf}
4739 and @code{vsnprintf} that might result in output truncation. When the exact
4740 number of bytes written by a format directive cannot be determined at
4741 compile-time it is estimated based on heuristics that depend on
4742 the @var{level} argument and on optimization. While enabling optimization
4743 will in most cases improve the accuracy of the warning, it may also result
4744 in false positives. Except as noted otherwise, the option uses the same
4745 logic @option{-Wformat-overflow}.
4746
4747 @table @gcctabopt
4748 @item -Wformat-truncation
4749 @itemx -Wformat-truncation=1
4750 @opindex Wformat-truncation
4751 @opindex Wno-format-truncation
4752 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4753 employs a conservative approach that warns only about calls to bounded
4754 functions whose return value is unused and that will most likely result
4755 in output truncation.
4756
4757 @item -Wformat-truncation=2
4758 Level @var{2} warns also about calls to bounded functions whose return
4759 value is used and that might result in truncation given an argument of
4760 sufficient length or magnitude.
4761 @end table
4762
4763 @item -Wformat-y2k
4764 @opindex Wformat-y2k
4765 @opindex Wno-format-y2k
4766 If @option{-Wformat} is specified, also warn about @code{strftime}
4767 formats that may yield only a two-digit year.
4768 @end table
4769
4770 @item -Wnonnull
4771 @opindex Wnonnull
4772 @opindex Wno-nonnull
4773 Warn about passing a null pointer for arguments marked as
4774 requiring a non-null value by the @code{nonnull} function attribute.
4775
4776 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4777 can be disabled with the @option{-Wno-nonnull} option.
4778
4779 @item -Wnonnull-compare
4780 @opindex Wnonnull-compare
4781 @opindex Wno-nonnull-compare
4782 Warn when comparing an argument marked with the @code{nonnull}
4783 function attribute against null inside the function.
4784
4785 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4786 can be disabled with the @option{-Wno-nonnull-compare} option.
4787
4788 @item -Wnull-dereference
4789 @opindex Wnull-dereference
4790 @opindex Wno-null-dereference
4791 Warn if the compiler detects paths that trigger erroneous or
4792 undefined behavior due to dereferencing a null pointer. This option
4793 is only active when @option{-fdelete-null-pointer-checks} is active,
4794 which is enabled by optimizations in most targets. The precision of
4795 the warnings depends on the optimization options used.
4796
4797 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4798 @opindex Winit-self
4799 @opindex Wno-init-self
4800 Warn about uninitialized variables that are initialized with themselves.
4801 Note this option can only be used with the @option{-Wuninitialized} option.
4802
4803 For example, GCC warns about @code{i} being uninitialized in the
4804 following snippet only when @option{-Winit-self} has been specified:
4805 @smallexample
4806 @group
4807 int f()
4808 @{
4809 int i = i;
4810 return i;
4811 @}
4812 @end group
4813 @end smallexample
4814
4815 This warning is enabled by @option{-Wall} in C++.
4816
4817 @item -Wimplicit-int @r{(C and Objective-C only)}
4818 @opindex Wimplicit-int
4819 @opindex Wno-implicit-int
4820 Warn when a declaration does not specify a type.
4821 This warning is enabled by @option{-Wall}.
4822
4823 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4824 @opindex Wimplicit-function-declaration
4825 @opindex Wno-implicit-function-declaration
4826 Give a warning whenever a function is used before being declared. In
4827 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4828 enabled by default and it is made into an error by
4829 @option{-pedantic-errors}. This warning is also enabled by
4830 @option{-Wall}.
4831
4832 @item -Wimplicit @r{(C and Objective-C only)}
4833 @opindex Wimplicit
4834 @opindex Wno-implicit
4835 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4836 This warning is enabled by @option{-Wall}.
4837
4838 @item -Wimplicit-fallthrough
4839 @opindex Wimplicit-fallthrough
4840 @opindex Wno-implicit-fallthrough
4841 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4842 and @option{-Wno-implicit-fallthrough} is the same as
4843 @option{-Wimplicit-fallthrough=0}.
4844
4845 @item -Wimplicit-fallthrough=@var{n}
4846 @opindex Wimplicit-fallthrough=
4847 Warn when a switch case falls through. For example:
4848
4849 @smallexample
4850 @group
4851 switch (cond)
4852 @{
4853 case 1:
4854 a = 1;
4855 break;
4856 case 2:
4857 a = 2;
4858 case 3:
4859 a = 3;
4860 break;
4861 @}
4862 @end group
4863 @end smallexample
4864
4865 This warning does not warn when the last statement of a case cannot
4866 fall through, e.g. when there is a return statement or a call to function
4867 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4868 also takes into account control flow statements, such as ifs, and only
4869 warns when appropriate. E.g.@:
4870
4871 @smallexample
4872 @group
4873 switch (cond)
4874 @{
4875 case 1:
4876 if (i > 3) @{
4877 bar (5);
4878 break;
4879 @} else if (i < 1) @{
4880 bar (0);
4881 @} else
4882 return;
4883 default:
4884 @dots{}
4885 @}
4886 @end group
4887 @end smallexample
4888
4889 Since there are occasions where a switch case fall through is desirable,
4890 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4891 to be used along with a null statement to suppress this warning that
4892 would normally occur:
4893
4894 @smallexample
4895 @group
4896 switch (cond)
4897 @{
4898 case 1:
4899 bar (0);
4900 __attribute__ ((fallthrough));
4901 default:
4902 @dots{}
4903 @}
4904 @end group
4905 @end smallexample
4906
4907 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4908 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4909 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4910 Instead of these attributes, it is also possible to add a fallthrough comment
4911 to silence the warning. The whole body of the C or C++ style comment should
4912 match the given regular expressions listed below. The option argument @var{n}
4913 specifies what kind of comments are accepted:
4914
4915 @itemize @bullet
4916
4917 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4918
4919 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4920 expression, any comment is used as fallthrough comment.
4921
4922 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4923 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4924
4925 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4926 following regular expressions:
4927
4928 @itemize @bullet
4929
4930 @item @code{-fallthrough}
4931
4932 @item @code{@@fallthrough@@}
4933
4934 @item @code{lint -fallthrough[ \t]*}
4935
4936 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4937
4938 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4939
4940 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4941
4942 @end itemize
4943
4944 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4945 following regular expressions:
4946
4947 @itemize @bullet
4948
4949 @item @code{-fallthrough}
4950
4951 @item @code{@@fallthrough@@}
4952
4953 @item @code{lint -fallthrough[ \t]*}
4954
4955 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4956
4957 @end itemize
4958
4959 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4960 fallthrough comments, only attributes disable the warning.
4961
4962 @end itemize
4963
4964 The comment needs to be followed after optional whitespace and other comments
4965 by @code{case} or @code{default} keywords or by a user label that precedes some
4966 @code{case} or @code{default} label.
4967
4968 @smallexample
4969 @group
4970 switch (cond)
4971 @{
4972 case 1:
4973 bar (0);
4974 /* FALLTHRU */
4975 default:
4976 @dots{}
4977 @}
4978 @end group
4979 @end smallexample
4980
4981 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4982
4983 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4984 @opindex Wif-not-aligned
4985 @opindex Wno-if-not-aligned
4986 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4987 should be issued. This is enabled by default.
4988 Use @option{-Wno-if-not-aligned} to disable it.
4989
4990 @item -Wignored-qualifiers @r{(C and C++ only)}
4991 @opindex Wignored-qualifiers
4992 @opindex Wno-ignored-qualifiers
4993 Warn if the return type of a function has a type qualifier
4994 such as @code{const}. For ISO C such a type qualifier has no effect,
4995 since the value returned by a function is not an lvalue.
4996 For C++, the warning is only emitted for scalar types or @code{void}.
4997 ISO C prohibits qualified @code{void} return types on function
4998 definitions, so such return types always receive a warning
4999 even without this option.
5000
5001 This warning is also enabled by @option{-Wextra}.
5002
5003 @item -Wignored-attributes @r{(C and C++ only)}
5004 @opindex Wignored-attributes
5005 @opindex Wno-ignored-attributes
5006 Warn when an attribute is ignored. This is different from the
5007 @option{-Wattributes} option in that it warns whenever the compiler decides
5008 to drop an attribute, not that the attribute is either unknown, used in a
5009 wrong place, etc. This warning is enabled by default.
5010
5011 @item -Wmain
5012 @opindex Wmain
5013 @opindex Wno-main
5014 Warn if the type of @code{main} is suspicious. @code{main} should be
5015 a function with external linkage, returning int, taking either zero
5016 arguments, two, or three arguments of appropriate types. This warning
5017 is enabled by default in C++ and is enabled by either @option{-Wall}
5018 or @option{-Wpedantic}.
5019
5020 @item -Wmisleading-indentation @r{(C and C++ only)}
5021 @opindex Wmisleading-indentation
5022 @opindex Wno-misleading-indentation
5023 Warn when the indentation of the code does not reflect the block structure.
5024 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5025 @code{for} clauses with a guarded statement that does not use braces,
5026 followed by an unguarded statement with the same indentation.
5027
5028 In the following example, the call to ``bar'' is misleadingly indented as
5029 if it were guarded by the ``if'' conditional.
5030
5031 @smallexample
5032 if (some_condition ())
5033 foo ();
5034 bar (); /* Gotcha: this is not guarded by the "if". */
5035 @end smallexample
5036
5037 In the case of mixed tabs and spaces, the warning uses the
5038 @option{-ftabstop=} option to determine if the statements line up
5039 (defaulting to 8).
5040
5041 The warning is not issued for code involving multiline preprocessor logic
5042 such as the following example.
5043
5044 @smallexample
5045 if (flagA)
5046 foo (0);
5047 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5048 if (flagB)
5049 #endif
5050 foo (1);
5051 @end smallexample
5052
5053 The warning is not issued after a @code{#line} directive, since this
5054 typically indicates autogenerated code, and no assumptions can be made
5055 about the layout of the file that the directive references.
5056
5057 This warning is enabled by @option{-Wall} in C and C++.
5058
5059 @item -Wno-missing-attributes
5060 @opindex Wmissing-attributes
5061 @opindex Wno-missing-attributes
5062 Warn when a declaration of a function is missing one or more attributes
5063 that a related function is declared with and whose absence may adversely
5064 affect the correctness or efficiency of generated code. For example,
5065 the warning is issued for declarations of aliases that use attributes
5066 to specify less restrictive requirements than those of their targets.
5067 This typically represents a potential optimization oportunity rather
5068 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
5069 issued for mismatches between declarations of aliases and their targets
5070 that might be indicative of code generation bugs.
5071 Attributes considered include @code{alloc_align}, @code{alloc_size},
5072 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5073 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5074 @code{returns_nonnull}, and @code{returns_twice}.
5075
5076 In C++, the warning is issued when an explicit specialization of a primary
5077 template declared with attribute @code{alloc_align}, @code{alloc_size},
5078 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5079 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5080 @code{error}, and @code{warning} suppress the warning.
5081 (@pxref{Function Attributes}).
5082
5083 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5084
5085 For example, since the declaration of the primary function template
5086 below makes use of both attribute @code{malloc} and @code{alloc_size}
5087 the declaration of the explicit specialization of the template is
5088 diagnosed because it is missing one of the attributes.
5089
5090 @smallexample
5091 template <class T>
5092 T* __attribute__ ((malloc, alloc_size (1)))
5093 allocate (size_t);
5094
5095 template <>
5096 void* __attribute__ ((malloc)) // missing alloc_size
5097 allocate<void> (size_t);
5098 @end smallexample
5099
5100 @item -Wmissing-braces
5101 @opindex Wmissing-braces
5102 @opindex Wno-missing-braces
5103 Warn if an aggregate or union initializer is not fully bracketed. In
5104 the following example, the initializer for @code{a} is not fully
5105 bracketed, but that for @code{b} is fully bracketed. This warning is
5106 enabled by @option{-Wall} in C.
5107
5108 @smallexample
5109 int a[2][2] = @{ 0, 1, 2, 3 @};
5110 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5111 @end smallexample
5112
5113 This warning is enabled by @option{-Wall}.
5114
5115 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5116 @opindex Wmissing-include-dirs
5117 @opindex Wno-missing-include-dirs
5118 Warn if a user-supplied include directory does not exist.
5119
5120 @item -Wmissing-profile
5121 @opindex Wmissing-profile
5122 @opindex Wno-missing-profile
5123 Warn if feedback profiles are missing when using the
5124 @option{-fprofile-use} option.
5125 This option diagnoses those cases where a new function or a new file is added
5126 to the user code between compiling with @option{-fprofile-generate} and with
5127 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5128 profile feedback data files do not contain any profile feedback information for
5129 the newly added function or file respectively. Also, in the case when profile
5130 count data (.gcda) files are removed, GCC cannot use any profile feedback
5131 information. In all these cases, warnings are issued to inform the user that a
5132 profile generation step is due. @option{-Wno-missing-profile} can be used to
5133 disable the warning. Ignoring the warning can result in poorly optimized code.
5134 Completely disabling the warning is not recommended and should be done only
5135 when non-existent profile data is justified.
5136
5137 @item -Wmultistatement-macros
5138 @opindex Wmultistatement-macros
5139 @opindex Wno-multistatement-macros
5140 Warn about unsafe multiple statement macros that appear to be guarded
5141 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5142 @code{while}, in which only the first statement is actually guarded after
5143 the macro is expanded.
5144
5145 For example:
5146
5147 @smallexample
5148 #define DOIT x++; y++
5149 if (c)
5150 DOIT;
5151 @end smallexample
5152
5153 will increment @code{y} unconditionally, not just when @code{c} holds.
5154 The can usually be fixed by wrapping the macro in a do-while loop:
5155 @smallexample
5156 #define DOIT do @{ x++; y++; @} while (0)
5157 if (c)
5158 DOIT;
5159 @end smallexample
5160
5161 This warning is enabled by @option{-Wall} in C and C++.
5162
5163 @item -Wparentheses
5164 @opindex Wparentheses
5165 @opindex Wno-parentheses
5166 Warn if parentheses are omitted in certain contexts, such
5167 as when there is an assignment in a context where a truth value
5168 is expected, or when operators are nested whose precedence people
5169 often get confused about.
5170
5171 Also warn if a comparison like @code{x<=y<=z} appears; this is
5172 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5173 interpretation from that of ordinary mathematical notation.
5174
5175 Also warn for dangerous uses of the GNU extension to
5176 @code{?:} with omitted middle operand. When the condition
5177 in the @code{?}: operator is a boolean expression, the omitted value is
5178 always 1. Often programmers expect it to be a value computed
5179 inside the conditional expression instead.
5180
5181 For C++ this also warns for some cases of unnecessary parentheses in
5182 declarations, which can indicate an attempt at a function call instead
5183 of a declaration:
5184 @smallexample
5185 @{
5186 // Declares a local variable called mymutex.
5187 std::unique_lock<std::mutex> (mymutex);
5188 // User meant std::unique_lock<std::mutex> lock (mymutex);
5189 @}
5190 @end smallexample
5191
5192 This warning is enabled by @option{-Wall}.
5193
5194 @item -Wsequence-point
5195 @opindex Wsequence-point
5196 @opindex Wno-sequence-point
5197 Warn about code that may have undefined semantics because of violations
5198 of sequence point rules in the C and C++ standards.
5199
5200 The C and C++ standards define the order in which expressions in a C/C++
5201 program are evaluated in terms of @dfn{sequence points}, which represent
5202 a partial ordering between the execution of parts of the program: those
5203 executed before the sequence point, and those executed after it. These
5204 occur after the evaluation of a full expression (one which is not part
5205 of a larger expression), after the evaluation of the first operand of a
5206 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5207 function is called (but after the evaluation of its arguments and the
5208 expression denoting the called function), and in certain other places.
5209 Other than as expressed by the sequence point rules, the order of
5210 evaluation of subexpressions of an expression is not specified. All
5211 these rules describe only a partial order rather than a total order,
5212 since, for example, if two functions are called within one expression
5213 with no sequence point between them, the order in which the functions
5214 are called is not specified. However, the standards committee have
5215 ruled that function calls do not overlap.
5216
5217 It is not specified when between sequence points modifications to the
5218 values of objects take effect. Programs whose behavior depends on this
5219 have undefined behavior; the C and C++ standards specify that ``Between
5220 the previous and next sequence point an object shall have its stored
5221 value modified at most once by the evaluation of an expression.
5222 Furthermore, the prior value shall be read only to determine the value
5223 to be stored.''. If a program breaks these rules, the results on any
5224 particular implementation are entirely unpredictable.
5225
5226 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5227 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5228 diagnosed by this option, and it may give an occasional false positive
5229 result, but in general it has been found fairly effective at detecting
5230 this sort of problem in programs.
5231
5232 The C++17 standard will define the order of evaluation of operands in
5233 more cases: in particular it requires that the right-hand side of an
5234 assignment be evaluated before the left-hand side, so the above
5235 examples are no longer undefined. But this warning will still warn
5236 about them, to help people avoid writing code that is undefined in C
5237 and earlier revisions of C++.
5238
5239 The standard is worded confusingly, therefore there is some debate
5240 over the precise meaning of the sequence point rules in subtle cases.
5241 Links to discussions of the problem, including proposed formal
5242 definitions, may be found on the GCC readings page, at
5243 @uref{http://gcc.gnu.org/@/readings.html}.
5244
5245 This warning is enabled by @option{-Wall} for C and C++.
5246
5247 @item -Wno-return-local-addr
5248 @opindex Wno-return-local-addr
5249 @opindex Wreturn-local-addr
5250 Do not warn about returning a pointer (or in C++, a reference) to a
5251 variable that goes out of scope after the function returns.
5252
5253 @item -Wreturn-type
5254 @opindex Wreturn-type
5255 @opindex Wno-return-type
5256 Warn whenever a function is defined with a return type that defaults
5257 to @code{int}. Also warn about any @code{return} statement with no
5258 return value in a function whose return type is not @code{void}
5259 (falling off the end of the function body is considered returning
5260 without a value).
5261
5262 For C only, warn about a @code{return} statement with an expression in a
5263 function whose return type is @code{void}, unless the expression type is
5264 also @code{void}. As a GNU extension, the latter case is accepted
5265 without a warning unless @option{-Wpedantic} is used. Attempting
5266 to use the return value of a non-@code{void} function other than @code{main}
5267 that flows off the end by reaching the closing curly brace that terminates
5268 the function is undefined.
5269
5270 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5271 than @code{main} results in undefined behavior even when the value of
5272 the function is not used.
5273
5274 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5275
5276 @item -Wshift-count-negative
5277 @opindex Wshift-count-negative
5278 @opindex Wno-shift-count-negative
5279 Warn if shift count is negative. This warning is enabled by default.
5280
5281 @item -Wshift-count-overflow
5282 @opindex Wshift-count-overflow
5283 @opindex Wno-shift-count-overflow
5284 Warn if shift count >= width of type. This warning is enabled by default.
5285
5286 @item -Wshift-negative-value
5287 @opindex Wshift-negative-value
5288 @opindex Wno-shift-negative-value
5289 Warn if left shifting a negative value. This warning is enabled by
5290 @option{-Wextra} in C99 and C++11 modes (and newer).
5291
5292 @item -Wshift-overflow
5293 @itemx -Wshift-overflow=@var{n}
5294 @opindex Wshift-overflow
5295 @opindex Wno-shift-overflow
5296 Warn about left shift overflows. This warning is enabled by
5297 default in C99 and C++11 modes (and newer).
5298
5299 @table @gcctabopt
5300 @item -Wshift-overflow=1
5301 This is the warning level of @option{-Wshift-overflow} and is enabled
5302 by default in C99 and C++11 modes (and newer). This warning level does
5303 not warn about left-shifting 1 into the sign bit. (However, in C, such
5304 an overflow is still rejected in contexts where an integer constant expression
5305 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5306 shifts always wrap.
5307
5308 @item -Wshift-overflow=2
5309 This warning level also warns about left-shifting 1 into the sign bit,
5310 unless C++14 mode (or newer) is active.
5311 @end table
5312
5313 @item -Wswitch
5314 @opindex Wswitch
5315 @opindex Wno-switch
5316 Warn whenever a @code{switch} statement has an index of enumerated type
5317 and lacks a @code{case} for one or more of the named codes of that
5318 enumeration. (The presence of a @code{default} label prevents this
5319 warning.) @code{case} labels outside the enumeration range also
5320 provoke warnings when this option is used (even if there is a
5321 @code{default} label).
5322 This warning is enabled by @option{-Wall}.
5323
5324 @item -Wswitch-default
5325 @opindex Wswitch-default
5326 @opindex Wno-switch-default
5327 Warn whenever a @code{switch} statement does not have a @code{default}
5328 case.
5329
5330 @item -Wswitch-enum
5331 @opindex Wswitch-enum
5332 @opindex Wno-switch-enum
5333 Warn whenever a @code{switch} statement has an index of enumerated type
5334 and lacks a @code{case} for one or more of the named codes of that
5335 enumeration. @code{case} labels outside the enumeration range also
5336 provoke warnings when this option is used. The only difference
5337 between @option{-Wswitch} and this option is that this option gives a
5338 warning about an omitted enumeration code even if there is a
5339 @code{default} label.
5340
5341 @item -Wswitch-bool
5342 @opindex Wswitch-bool
5343 @opindex Wno-switch-bool
5344 Warn whenever a @code{switch} statement has an index of boolean type
5345 and the case values are outside the range of a boolean type.
5346 It is possible to suppress this warning by casting the controlling
5347 expression to a type other than @code{bool}. For example:
5348 @smallexample
5349 @group
5350 switch ((int) (a == 4))
5351 @{
5352 @dots{}
5353 @}
5354 @end group
5355 @end smallexample
5356 This warning is enabled by default for C and C++ programs.
5357
5358 @item -Wswitch-unreachable
5359 @opindex Wswitch-unreachable
5360 @opindex Wno-switch-unreachable
5361 Warn whenever a @code{switch} statement contains statements between the
5362 controlling expression and the first case label, which will never be
5363 executed. For example:
5364 @smallexample
5365 @group
5366 switch (cond)
5367 @{
5368 i = 15;
5369 @dots{}
5370 case 5:
5371 @dots{}
5372 @}
5373 @end group
5374 @end smallexample
5375 @option{-Wswitch-unreachable} does not warn if the statement between the
5376 controlling expression and the first case label is just a declaration:
5377 @smallexample
5378 @group
5379 switch (cond)
5380 @{
5381 int i;
5382 @dots{}
5383 case 5:
5384 i = 5;
5385 @dots{}
5386 @}
5387 @end group
5388 @end smallexample
5389 This warning is enabled by default for C and C++ programs.
5390
5391 @item -Wsync-nand @r{(C and C++ only)}
5392 @opindex Wsync-nand
5393 @opindex Wno-sync-nand
5394 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5395 built-in functions are used. These functions changed semantics in GCC 4.4.
5396
5397 @item -Wunused-but-set-parameter
5398 @opindex Wunused-but-set-parameter
5399 @opindex Wno-unused-but-set-parameter
5400 Warn whenever a function parameter is assigned to, but otherwise unused
5401 (aside from its declaration).
5402
5403 To suppress this warning use the @code{unused} attribute
5404 (@pxref{Variable Attributes}).
5405
5406 This warning is also enabled by @option{-Wunused} together with
5407 @option{-Wextra}.
5408
5409 @item -Wunused-but-set-variable
5410 @opindex Wunused-but-set-variable
5411 @opindex Wno-unused-but-set-variable
5412 Warn whenever a local variable is assigned to, but otherwise unused
5413 (aside from its declaration).
5414 This warning is enabled by @option{-Wall}.
5415
5416 To suppress this warning use the @code{unused} attribute
5417 (@pxref{Variable Attributes}).
5418
5419 This warning is also enabled by @option{-Wunused}, which is enabled
5420 by @option{-Wall}.
5421
5422 @item -Wunused-function
5423 @opindex Wunused-function
5424 @opindex Wno-unused-function
5425 Warn whenever a static function is declared but not defined or a
5426 non-inline static function is unused.
5427 This warning is enabled by @option{-Wall}.
5428
5429 @item -Wunused-label
5430 @opindex Wunused-label
5431 @opindex Wno-unused-label
5432 Warn whenever a label is declared but not used.
5433 This warning is enabled by @option{-Wall}.
5434
5435 To suppress this warning use the @code{unused} attribute
5436 (@pxref{Variable Attributes}).
5437
5438 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5439 @opindex Wunused-local-typedefs
5440 @opindex Wno-unused-local-typedefs
5441 Warn when a typedef locally defined in a function is not used.
5442 This warning is enabled by @option{-Wall}.
5443
5444 @item -Wunused-parameter
5445 @opindex Wunused-parameter
5446 @opindex Wno-unused-parameter
5447 Warn whenever a function parameter is unused aside from its declaration.
5448
5449 To suppress this warning use the @code{unused} attribute
5450 (@pxref{Variable Attributes}).
5451
5452 @item -Wno-unused-result
5453 @opindex Wunused-result
5454 @opindex Wno-unused-result
5455 Do not warn if a caller of a function marked with attribute
5456 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5457 its return value. The default is @option{-Wunused-result}.
5458
5459 @item -Wunused-variable
5460 @opindex Wunused-variable
5461 @opindex Wno-unused-variable
5462 Warn whenever a local or static variable is unused aside from its
5463 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5464 but not for C++. This warning is enabled by @option{-Wall}.
5465
5466 To suppress this warning use the @code{unused} attribute
5467 (@pxref{Variable Attributes}).
5468
5469 @item -Wunused-const-variable
5470 @itemx -Wunused-const-variable=@var{n}
5471 @opindex Wunused-const-variable
5472 @opindex Wno-unused-const-variable
5473 Warn whenever a constant static variable is unused aside from its declaration.
5474 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5475 for C, but not for C++. In C this declares variable storage, but in C++ this
5476 is not an error since const variables take the place of @code{#define}s.
5477
5478 To suppress this warning use the @code{unused} attribute
5479 (@pxref{Variable Attributes}).
5480
5481 @table @gcctabopt
5482 @item -Wunused-const-variable=1
5483 This is the warning level that is enabled by @option{-Wunused-variable} for
5484 C. It warns only about unused static const variables defined in the main
5485 compilation unit, but not about static const variables declared in any
5486 header included.
5487
5488 @item -Wunused-const-variable=2
5489 This warning level also warns for unused constant static variables in
5490 headers (excluding system headers). This is the warning level of
5491 @option{-Wunused-const-variable} and must be explicitly requested since
5492 in C++ this isn't an error and in C it might be harder to clean up all
5493 headers included.
5494 @end table
5495
5496 @item -Wunused-value
5497 @opindex Wunused-value
5498 @opindex Wno-unused-value
5499 Warn whenever a statement computes a result that is explicitly not
5500 used. To suppress this warning cast the unused expression to
5501 @code{void}. This includes an expression-statement or the left-hand
5502 side of a comma expression that contains no side effects. For example,
5503 an expression such as @code{x[i,j]} causes a warning, while
5504 @code{x[(void)i,j]} does not.
5505
5506 This warning is enabled by @option{-Wall}.
5507
5508 @item -Wunused
5509 @opindex Wunused
5510 @opindex Wno-unused
5511 All the above @option{-Wunused} options combined.
5512
5513 In order to get a warning about an unused function parameter, you must
5514 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5515 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5516
5517 @item -Wuninitialized
5518 @opindex Wuninitialized
5519 @opindex Wno-uninitialized
5520 Warn if an automatic variable is used without first being initialized
5521 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5522 warn if a non-static reference or non-static @code{const} member
5523 appears in a class without constructors.
5524
5525 If you want to warn about code that uses the uninitialized value of the
5526 variable in its own initializer, use the @option{-Winit-self} option.
5527
5528 These warnings occur for individual uninitialized or clobbered
5529 elements of structure, union or array variables as well as for
5530 variables that are uninitialized or clobbered as a whole. They do
5531 not occur for variables or elements declared @code{volatile}. Because
5532 these warnings depend on optimization, the exact variables or elements
5533 for which there are warnings depends on the precise optimization
5534 options and version of GCC used.
5535
5536 Note that there may be no warning about a variable that is used only
5537 to compute a value that itself is never used, because such
5538 computations may be deleted by data flow analysis before the warnings
5539 are printed.
5540
5541 @item -Winvalid-memory-model
5542 @opindex Winvalid-memory-model
5543 @opindex Wno-invalid-memory-model
5544 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5545 and the C11 atomic generic functions with a memory consistency argument
5546 that is either invalid for the operation or outside the range of values
5547 of the @code{memory_order} enumeration. For example, since the
5548 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5549 defined for the relaxed, release, and sequentially consistent memory
5550 orders the following code is diagnosed:
5551
5552 @smallexample
5553 void store (int *i)
5554 @{
5555 __atomic_store_n (i, 0, memory_order_consume);
5556 @}
5557 @end smallexample
5558
5559 @option{-Winvalid-memory-model} is enabled by default.
5560
5561 @item -Wmaybe-uninitialized
5562 @opindex Wmaybe-uninitialized
5563 @opindex Wno-maybe-uninitialized
5564 For an automatic (i.e.@: local) variable, if there exists a path from the
5565 function entry to a use of the variable that is initialized, but there exist
5566 some other paths for which the variable is not initialized, the compiler
5567 emits a warning if it cannot prove the uninitialized paths are not
5568 executed at run time.
5569
5570 These warnings are only possible in optimizing compilation, because otherwise
5571 GCC does not keep track of the state of variables.
5572
5573 These warnings are made optional because GCC may not be able to determine when
5574 the code is correct in spite of appearing to have an error. Here is one
5575 example of how this can happen:
5576
5577 @smallexample
5578 @group
5579 @{
5580 int x;
5581 switch (y)
5582 @{
5583 case 1: x = 1;
5584 break;
5585 case 2: x = 4;
5586 break;
5587 case 3: x = 5;
5588 @}
5589 foo (x);
5590 @}
5591 @end group
5592 @end smallexample
5593
5594 @noindent
5595 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5596 always initialized, but GCC doesn't know this. To suppress the
5597 warning, you need to provide a default case with assert(0) or
5598 similar code.
5599
5600 @cindex @code{longjmp} warnings
5601 This option also warns when a non-volatile automatic variable might be
5602 changed by a call to @code{longjmp}.
5603 The compiler sees only the calls to @code{setjmp}. It cannot know
5604 where @code{longjmp} will be called; in fact, a signal handler could
5605 call it at any point in the code. As a result, you may get a warning
5606 even when there is in fact no problem because @code{longjmp} cannot
5607 in fact be called at the place that would cause a problem.
5608
5609 Some spurious warnings can be avoided if you declare all the functions
5610 you use that never return as @code{noreturn}. @xref{Function
5611 Attributes}.
5612
5613 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5614
5615 @item -Wunknown-pragmas
5616 @opindex Wunknown-pragmas
5617 @opindex Wno-unknown-pragmas
5618 @cindex warning for unknown pragmas
5619 @cindex unknown pragmas, warning
5620 @cindex pragmas, warning of unknown
5621 Warn when a @code{#pragma} directive is encountered that is not understood by
5622 GCC@. If this command-line option is used, warnings are even issued
5623 for unknown pragmas in system header files. This is not the case if
5624 the warnings are only enabled by the @option{-Wall} command-line option.
5625
5626 @item -Wno-pragmas
5627 @opindex Wno-pragmas
5628 @opindex Wpragmas
5629 Do not warn about misuses of pragmas, such as incorrect parameters,
5630 invalid syntax, or conflicts between pragmas. See also
5631 @option{-Wunknown-pragmas}.
5632
5633 @item -Wno-prio-ctor-dtor
5634 @opindex Wno-prio-ctor-dtor
5635 @opindex Wprio-ctor-dtor
5636 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5637 The use of constructor and destructor attributes allow you to assign a
5638 priority to the constructor/destructor to control its order of execution
5639 before @code{main} is called or after it returns. The priority values must be
5640 greater than 100 as the compiler reserves priority values between 0--100 for
5641 the implementation.
5642
5643 @item -Wstrict-aliasing
5644 @opindex Wstrict-aliasing
5645 @opindex Wno-strict-aliasing
5646 This option is only active when @option{-fstrict-aliasing} is active.
5647 It warns about code that might break the strict aliasing rules that the
5648 compiler is using for optimization. The warning does not catch all
5649 cases, but does attempt to catch the more common pitfalls. It is
5650 included in @option{-Wall}.
5651 It is equivalent to @option{-Wstrict-aliasing=3}
5652
5653 @item -Wstrict-aliasing=n
5654 @opindex Wstrict-aliasing=n
5655 This option is only active when @option{-fstrict-aliasing} is active.
5656 It warns about code that might break the strict aliasing rules that the
5657 compiler is using for optimization.
5658 Higher levels correspond to higher accuracy (fewer false positives).
5659 Higher levels also correspond to more effort, similar to the way @option{-O}
5660 works.
5661 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5662
5663 Level 1: Most aggressive, quick, least accurate.
5664 Possibly useful when higher levels
5665 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5666 false negatives. However, it has many false positives.
5667 Warns for all pointer conversions between possibly incompatible types,
5668 even if never dereferenced. Runs in the front end only.
5669
5670 Level 2: Aggressive, quick, not too precise.
5671 May still have many false positives (not as many as level 1 though),
5672 and few false negatives (but possibly more than level 1).
5673 Unlike level 1, it only warns when an address is taken. Warns about
5674 incomplete types. Runs in the front end only.
5675
5676 Level 3 (default for @option{-Wstrict-aliasing}):
5677 Should have very few false positives and few false
5678 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5679 Takes care of the common pun+dereference pattern in the front end:
5680 @code{*(int*)&some_float}.
5681 If optimization is enabled, it also runs in the back end, where it deals
5682 with multiple statement cases using flow-sensitive points-to information.
5683 Only warns when the converted pointer is dereferenced.
5684 Does not warn about incomplete types.
5685
5686 @item -Wstrict-overflow
5687 @itemx -Wstrict-overflow=@var{n}
5688 @opindex Wstrict-overflow
5689 @opindex Wno-strict-overflow
5690 This option is only active when signed overflow is undefined.
5691 It warns about cases where the compiler optimizes based on the
5692 assumption that signed overflow does not occur. Note that it does not
5693 warn about all cases where the code might overflow: it only warns
5694 about cases where the compiler implements some optimization. Thus
5695 this warning depends on the optimization level.
5696
5697 An optimization that assumes that signed overflow does not occur is
5698 perfectly safe if the values of the variables involved are such that
5699 overflow never does, in fact, occur. Therefore this warning can
5700 easily give a false positive: a warning about code that is not
5701 actually a problem. To help focus on important issues, several
5702 warning levels are defined. No warnings are issued for the use of
5703 undefined signed overflow when estimating how many iterations a loop
5704 requires, in particular when determining whether a loop will be
5705 executed at all.
5706
5707 @table @gcctabopt
5708 @item -Wstrict-overflow=1
5709 Warn about cases that are both questionable and easy to avoid. For
5710 example the compiler simplifies
5711 @code{x + 1 > x} to @code{1}. This level of
5712 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5713 are not, and must be explicitly requested.
5714
5715 @item -Wstrict-overflow=2
5716 Also warn about other cases where a comparison is simplified to a
5717 constant. For example: @code{abs (x) >= 0}. This can only be
5718 simplified when signed integer overflow is undefined, because
5719 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5720 zero. @option{-Wstrict-overflow} (with no level) is the same as
5721 @option{-Wstrict-overflow=2}.
5722
5723 @item -Wstrict-overflow=3
5724 Also warn about other cases where a comparison is simplified. For
5725 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5726
5727 @item -Wstrict-overflow=4
5728 Also warn about other simplifications not covered by the above cases.
5729 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5730
5731 @item -Wstrict-overflow=5
5732 Also warn about cases where the compiler reduces the magnitude of a
5733 constant involved in a comparison. For example: @code{x + 2 > y} is
5734 simplified to @code{x + 1 >= y}. This is reported only at the
5735 highest warning level because this simplification applies to many
5736 comparisons, so this warning level gives a very large number of
5737 false positives.
5738 @end table
5739
5740 @item -Wstringop-overflow
5741 @itemx -Wstringop-overflow=@var{type}
5742 @opindex Wstringop-overflow
5743 @opindex Wno-stringop-overflow
5744 Warn for calls to string manipulation functions such as @code{memcpy} and
5745 @code{strcpy} that are determined to overflow the destination buffer. The
5746 optional argument is one greater than the type of Object Size Checking to
5747 perform to determine the size of the destination. @xref{Object Size Checking}.
5748 The argument is meaningful only for functions that operate on character arrays
5749 but not for raw memory functions like @code{memcpy} which always make use
5750 of Object Size type-0. The option also warns for calls that specify a size
5751 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5752 The option produces the best results with optimization enabled but can detect
5753 a small subset of simple buffer overflows even without optimization in
5754 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5755 correspond to the standard functions. In any case, the option warns about
5756 just a subset of buffer overflows detected by the corresponding overflow
5757 checking built-ins. For example, the option will issue a warning for
5758 the @code{strcpy} call below because it copies at least 5 characters
5759 (the string @code{"blue"} including the terminating NUL) into the buffer
5760 of size 4.
5761
5762 @smallexample
5763 enum Color @{ blue, purple, yellow @};
5764 const char* f (enum Color clr)
5765 @{
5766 static char buf [4];
5767 const char *str;
5768 switch (clr)
5769 @{
5770 case blue: str = "blue"; break;
5771 case purple: str = "purple"; break;
5772 case yellow: str = "yellow"; break;
5773 @}
5774
5775 return strcpy (buf, str); // warning here
5776 @}
5777 @end smallexample
5778
5779 Option @option{-Wstringop-overflow=2} is enabled by default.
5780
5781 @table @gcctabopt
5782 @item -Wstringop-overflow
5783 @itemx -Wstringop-overflow=1
5784 @opindex Wstringop-overflow
5785 @opindex Wno-stringop-overflow
5786 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5787 to determine the sizes of destination objects. This is the default setting
5788 of the option. At this setting the option will not warn for writes past
5789 the end of subobjects of larger objects accessed by pointers unless the
5790 size of the largest surrounding object is known. When the destination may
5791 be one of several objects it is assumed to be the largest one of them. On
5792 Linux systems, when optimization is enabled at this setting the option warns
5793 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5794 a non-zero value.
5795
5796 @item -Wstringop-overflow=2
5797 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5798 to determine the sizes of destination objects. At this setting the option
5799 will warn about overflows when writing to members of the largest complete
5800 objects whose exact size is known. It will, however, not warn for excessive
5801 writes to the same members of unknown objects referenced by pointers since
5802 they may point to arrays containing unknown numbers of elements.
5803
5804 @item -Wstringop-overflow=3
5805 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5806 to determine the sizes of destination objects. At this setting the option
5807 warns about overflowing the smallest object or data member. This is the
5808 most restrictive setting of the option that may result in warnings for safe
5809 code.
5810
5811 @item -Wstringop-overflow=4
5812 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5813 to determine the sizes of destination objects. At this setting the option
5814 will warn about overflowing any data members, and when the destination is
5815 one of several objects it uses the size of the largest of them to decide
5816 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5817 setting of the option may result in warnings for benign code.
5818 @end table
5819
5820 @item -Wstringop-truncation
5821 @opindex Wstringop-truncation
5822 @opindex Wno-stringop-truncation
5823 Warn for calls to bounded string manipulation functions such as @code{strncat},
5824 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5825 or leave the destination unchanged.
5826
5827 In the following example, the call to @code{strncat} specifies a bound that
5828 is less than the length of the source string. As a result, the copy of
5829 the source will be truncated and so the call is diagnosed. To avoid the
5830 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5831
5832 @smallexample
5833 void append (char *buf, size_t bufsize)
5834 @{
5835 strncat (buf, ".txt", 3);
5836 @}
5837 @end smallexample
5838
5839 As another example, the following call to @code{strncpy} results in copying
5840 to @code{d} just the characters preceding the terminating NUL, without
5841 appending the NUL to the end. Assuming the result of @code{strncpy} is
5842 necessarily a NUL-terminated string is a common mistake, and so the call
5843 is diagnosed. To avoid the warning when the result is not expected to be
5844 NUL-terminated, call @code{memcpy} instead.
5845
5846 @smallexample
5847 void copy (char *d, const char *s)
5848 @{
5849 strncpy (d, s, strlen (s));
5850 @}
5851 @end smallexample
5852
5853 In the following example, the call to @code{strncpy} specifies the size
5854 of the destination buffer as the bound. If the length of the source
5855 string is equal to or greater than this size the result of the copy will
5856 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5857 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5858 element of the buffer to @code{NUL}.
5859
5860 @smallexample
5861 void copy (const char *s)
5862 @{
5863 char buf[80];
5864 strncpy (buf, s, sizeof buf);
5865 @dots{}
5866 @}
5867 @end smallexample
5868
5869 In situations where a character array is intended to store a sequence
5870 of bytes with no terminating @code{NUL} such an array may be annotated
5871 with attribute @code{nonstring} to avoid this warning. Such arrays,
5872 however, are not suitable arguments to functions that expect
5873 @code{NUL}-terminated strings. To help detect accidental misuses of
5874 such arrays GCC issues warnings unless it can prove that the use is
5875 safe. @xref{Common Variable Attributes}.
5876
5877 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5878 @opindex Wsuggest-attribute=
5879 @opindex Wno-suggest-attribute=
5880 Warn for cases where adding an attribute may be beneficial. The
5881 attributes currently supported are listed below.
5882
5883 @table @gcctabopt
5884 @item -Wsuggest-attribute=pure
5885 @itemx -Wsuggest-attribute=const
5886 @itemx -Wsuggest-attribute=noreturn
5887 @itemx -Wmissing-noreturn
5888 @itemx -Wsuggest-attribute=malloc
5889 @opindex Wsuggest-attribute=pure
5890 @opindex Wno-suggest-attribute=pure
5891 @opindex Wsuggest-attribute=const
5892 @opindex Wno-suggest-attribute=const
5893 @opindex Wsuggest-attribute=noreturn
5894 @opindex Wno-suggest-attribute=noreturn
5895 @opindex Wmissing-noreturn
5896 @opindex Wno-missing-noreturn
5897 @opindex Wsuggest-attribute=malloc
5898 @opindex Wno-suggest-attribute=malloc
5899
5900 Warn about functions that might be candidates for attributes
5901 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5902 only warns for functions visible in other compilation units or (in the case of
5903 @code{pure} and @code{const}) if it cannot prove that the function returns
5904 normally. A function returns normally if it doesn't contain an infinite loop or
5905 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5906 requires option @option{-fipa-pure-const}, which is enabled by default at
5907 @option{-O} and higher. Higher optimization levels improve the accuracy
5908 of the analysis.
5909
5910 @item -Wsuggest-attribute=format
5911 @itemx -Wmissing-format-attribute
5912 @opindex Wsuggest-attribute=format
5913 @opindex Wmissing-format-attribute
5914 @opindex Wno-suggest-attribute=format
5915 @opindex Wno-missing-format-attribute
5916 @opindex Wformat
5917 @opindex Wno-format
5918
5919 Warn about function pointers that might be candidates for @code{format}
5920 attributes. Note these are only possible candidates, not absolute ones.
5921 GCC guesses that function pointers with @code{format} attributes that
5922 are used in assignment, initialization, parameter passing or return
5923 statements should have a corresponding @code{format} attribute in the
5924 resulting type. I.e.@: the left-hand side of the assignment or
5925 initialization, the type of the parameter variable, or the return type
5926 of the containing function respectively should also have a @code{format}
5927 attribute to avoid the warning.
5928
5929 GCC also warns about function definitions that might be
5930 candidates for @code{format} attributes. Again, these are only
5931 possible candidates. GCC guesses that @code{format} attributes
5932 might be appropriate for any function that calls a function like
5933 @code{vprintf} or @code{vscanf}, but this might not always be the
5934 case, and some functions for which @code{format} attributes are
5935 appropriate may not be detected.
5936
5937 @item -Wsuggest-attribute=cold
5938 @opindex Wsuggest-attribute=cold
5939 @opindex Wno-suggest-attribute=cold
5940
5941 Warn about functions that might be candidates for @code{cold} attribute. This
5942 is based on static detection and generally will only warn about functions which
5943 always leads to a call to another @code{cold} function such as wrappers of
5944 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5945 @end table
5946
5947 @item -Wsuggest-final-types
5948 @opindex Wno-suggest-final-types
5949 @opindex Wsuggest-final-types
5950 Warn about types with virtual methods where code quality would be improved
5951 if the type were declared with the C++11 @code{final} specifier,
5952 or, if possible,
5953 declared in an anonymous namespace. This allows GCC to more aggressively
5954 devirtualize the polymorphic calls. This warning is more effective with link
5955 time optimization, where the information about the class hierarchy graph is
5956 more complete.
5957
5958 @item -Wsuggest-final-methods
5959 @opindex Wno-suggest-final-methods
5960 @opindex Wsuggest-final-methods
5961 Warn about virtual methods where code quality would be improved if the method
5962 were declared with the C++11 @code{final} specifier,
5963 or, if possible, its type were
5964 declared in an anonymous namespace or with the @code{final} specifier.
5965 This warning is
5966 more effective with link-time optimization, where the information about the
5967 class hierarchy graph is more complete. It is recommended to first consider
5968 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5969 annotations.
5970
5971 @item -Wsuggest-override
5972 Warn about overriding virtual functions that are not marked with the override
5973 keyword.
5974
5975 @item -Walloc-zero
5976 @opindex Wno-alloc-zero
5977 @opindex Walloc-zero
5978 Warn about calls to allocation functions decorated with attribute
5979 @code{alloc_size} that specify zero bytes, including those to the built-in
5980 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5981 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5982 when called with a zero size differs among implementations (and in the case
5983 of @code{realloc} has been deprecated) relying on it may result in subtle
5984 portability bugs and should be avoided.
5985
5986 @item -Walloc-size-larger-than=@var{byte-size}
5987 @opindex Walloc-size-larger-than=
5988 @opindex Wno-alloc-size-larger-than
5989 Warn about calls to functions decorated with attribute @code{alloc_size}
5990 that attempt to allocate objects larger than the specified number of bytes,
5991 or where the result of the size computation in an integer type with infinite
5992 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5993 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5994 Warnings controlled by the option can be disabled either by specifying
5995 @var{byte-size} of @samp{SIZE_MAX} or more or by
5996 @option{-Wno-alloc-size-larger-than}.
5997 @xref{Function Attributes}.
5998
5999 @item -Wno-alloc-size-larger-than
6000 @opindex Wno-alloc-size-larger-than
6001 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6002 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6003 larger.
6004
6005 @item -Walloca
6006 @opindex Wno-alloca
6007 @opindex Walloca
6008 This option warns on all uses of @code{alloca} in the source.
6009
6010 @item -Walloca-larger-than=@var{byte-size}
6011 @opindex Walloca-larger-than=
6012 @opindex Wno-alloca-larger-than
6013 This option warns on calls to @code{alloca} with an integer argument whose
6014 value is either zero, or that is not bounded by a controlling predicate
6015 that limits its value to at most @var{byte-size}. It also warns for calls
6016 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6017 types are considered unbounded even if they appear to be constrained to
6018 the expected range.
6019
6020 For example, a bounded case of @code{alloca} could be:
6021
6022 @smallexample
6023 void func (size_t n)
6024 @{
6025 void *p;
6026 if (n <= 1000)
6027 p = alloca (n);
6028 else
6029 p = malloc (n);
6030 f (p);
6031 @}
6032 @end smallexample
6033
6034 In the above example, passing @code{-Walloca-larger-than=1000} would not
6035 issue a warning because the call to @code{alloca} is known to be at most
6036 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6037 the compiler would emit a warning.
6038
6039 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6040 controlling predicate constraining its integer argument. For example:
6041
6042 @smallexample
6043 void func ()
6044 @{
6045 void *p = alloca (n);
6046 f (p);
6047 @}
6048 @end smallexample
6049
6050 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6051 a warning, but this time because of the lack of bounds checking.
6052
6053 Note, that even seemingly correct code involving signed integers could
6054 cause a warning:
6055
6056 @smallexample
6057 void func (signed int n)
6058 @{
6059 if (n < 500)
6060 @{
6061 p = alloca (n);
6062 f (p);
6063 @}
6064 @}
6065 @end smallexample
6066
6067 In the above example, @var{n} could be negative, causing a larger than
6068 expected argument to be implicitly cast into the @code{alloca} call.
6069
6070 This option also warns when @code{alloca} is used in a loop.
6071
6072 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6073 but is usually only effective when @option{-ftree-vrp} is active (default
6074 for @option{-O2} and above).
6075
6076 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6077
6078 @item -Wno-alloca-larger-than
6079 @opindex Wno-alloca-larger-than
6080 Disable @option{-Walloca-larger-than=} warnings. The option is
6081 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6082
6083 @item -Warray-bounds
6084 @itemx -Warray-bounds=@var{n}
6085 @opindex Wno-array-bounds
6086 @opindex Warray-bounds
6087 This option is only active when @option{-ftree-vrp} is active
6088 (default for @option{-O2} and above). It warns about subscripts to arrays
6089 that are always out of bounds. This warning is enabled by @option{-Wall}.
6090
6091 @table @gcctabopt
6092 @item -Warray-bounds=1
6093 This is the warning level of @option{-Warray-bounds} and is enabled
6094 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6095
6096 @item -Warray-bounds=2
6097 This warning level also warns about out of bounds access for
6098 arrays at the end of a struct and for arrays accessed through
6099 pointers. This warning level may give a larger number of
6100 false positives and is deactivated by default.
6101 @end table
6102
6103 @item -Wattribute-alias=@var{n}
6104 @itemx -Wno-attribute-alias
6105 @opindex -Wattribute-alias
6106 @opindex -Wno-attribute-alias
6107 Warn about declarations using the @code{alias} and similar attributes whose
6108 target is incompatible with the type of the alias.
6109 @xref{Function Attributes,,Declaring Attributes of Functions}.
6110 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
6111
6112 @table @gcctabopt
6113 @item -Wattribute-alias=1
6114 The default warning level of the @option{-Wattribute-alias} option diagnoses
6115 incompatibilities between the type of the alias declaration and that of its
6116 target. Such incompatibilities are typically indicative of bugs.
6117
6118 @item -Wattribute-alias=2
6119 At this level @option{-Wattribute-alias} also diagnoses mismatches between
6120 the set of attributes of the alias declaration and the attributes applied
6121 to its target. Although in some cases such mismatches may indicate bugs,
6122 in other cases they may be benign and could be resolved simply by adding
6123 the missing attribute to the target.
6124 @end table
6125
6126 @item -Wbool-compare
6127 @opindex Wno-bool-compare
6128 @opindex Wbool-compare
6129 Warn about boolean expression compared with an integer value different from
6130 @code{true}/@code{false}. For instance, the following comparison is
6131 always false:
6132 @smallexample
6133 int n = 5;
6134 @dots{}
6135 if ((n > 1) == 2) @{ @dots{} @}
6136 @end smallexample
6137 This warning is enabled by @option{-Wall}.
6138
6139 @item -Wbool-operation
6140 @opindex Wno-bool-operation
6141 @opindex Wbool-operation
6142 Warn about suspicious operations on expressions of a boolean type. For
6143 instance, bitwise negation of a boolean is very likely a bug in the program.
6144 For C, this warning also warns about incrementing or decrementing a boolean,
6145 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6146 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6147
6148 This warning is enabled by @option{-Wall}.
6149
6150 @item -Wduplicated-branches
6151 @opindex Wno-duplicated-branches
6152 @opindex Wduplicated-branches
6153 Warn when an if-else has identical branches. This warning detects cases like
6154 @smallexample
6155 if (p != NULL)
6156 return 0;
6157 else
6158 return 0;
6159 @end smallexample
6160 It doesn't warn when both branches contain just a null statement. This warning
6161 also warn for conditional operators:
6162 @smallexample
6163 int i = x ? *p : *p;
6164 @end smallexample
6165
6166 @item -Wduplicated-cond
6167 @opindex Wno-duplicated-cond
6168 @opindex Wduplicated-cond
6169 Warn about duplicated conditions in an if-else-if chain. For instance,
6170 warn for the following code:
6171 @smallexample
6172 if (p->q != NULL) @{ @dots{} @}
6173 else if (p->q != NULL) @{ @dots{} @}
6174 @end smallexample
6175
6176 @item -Wframe-address
6177 @opindex Wno-frame-address
6178 @opindex Wframe-address
6179 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6180 is called with an argument greater than 0. Such calls may return indeterminate
6181 values or crash the program. The warning is included in @option{-Wall}.
6182
6183 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6184 @opindex Wno-discarded-qualifiers
6185 @opindex Wdiscarded-qualifiers
6186 Do not warn if type qualifiers on pointers are being discarded.
6187 Typically, the compiler warns if a @code{const char *} variable is
6188 passed to a function that takes a @code{char *} parameter. This option
6189 can be used to suppress such a warning.
6190
6191 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6192 @opindex Wno-discarded-array-qualifiers
6193 @opindex Wdiscarded-array-qualifiers
6194 Do not warn if type qualifiers on arrays which are pointer targets
6195 are being discarded. Typically, the compiler warns if a
6196 @code{const int (*)[]} variable is passed to a function that
6197 takes a @code{int (*)[]} parameter. This option can be used to
6198 suppress such a warning.
6199
6200 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6201 @opindex Wno-incompatible-pointer-types
6202 @opindex Wincompatible-pointer-types
6203 Do not warn when there is a conversion between pointers that have incompatible
6204 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6205 which warns for pointer argument passing or assignment with different
6206 signedness.
6207
6208 @item -Wno-int-conversion @r{(C and Objective-C only)}
6209 @opindex Wno-int-conversion
6210 @opindex Wint-conversion
6211 Do not warn about incompatible integer to pointer and pointer to integer
6212 conversions. This warning is about implicit conversions; for explicit
6213 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6214 @option{-Wno-pointer-to-int-cast} may be used.
6215
6216 @item -Wno-div-by-zero
6217 @opindex Wno-div-by-zero
6218 @opindex Wdiv-by-zero
6219 Do not warn about compile-time integer division by zero. Floating-point
6220 division by zero is not warned about, as it can be a legitimate way of
6221 obtaining infinities and NaNs.
6222
6223 @item -Wsystem-headers
6224 @opindex Wsystem-headers
6225 @opindex Wno-system-headers
6226 @cindex warnings from system headers
6227 @cindex system headers, warnings from
6228 Print warning messages for constructs found in system header files.
6229 Warnings from system headers are normally suppressed, on the assumption
6230 that they usually do not indicate real problems and would only make the
6231 compiler output harder to read. Using this command-line option tells
6232 GCC to emit warnings from system headers as if they occurred in user
6233 code. However, note that using @option{-Wall} in conjunction with this
6234 option does @emph{not} warn about unknown pragmas in system
6235 headers---for that, @option{-Wunknown-pragmas} must also be used.
6236
6237 @item -Wtautological-compare
6238 @opindex Wtautological-compare
6239 @opindex Wno-tautological-compare
6240 Warn if a self-comparison always evaluates to true or false. This
6241 warning detects various mistakes such as:
6242 @smallexample
6243 int i = 1;
6244 @dots{}
6245 if (i > i) @{ @dots{} @}
6246 @end smallexample
6247
6248 This warning also warns about bitwise comparisons that always evaluate
6249 to true or false, for instance:
6250 @smallexample
6251 if ((a & 16) == 10) @{ @dots{} @}
6252 @end smallexample
6253 will always be false.
6254
6255 This warning is enabled by @option{-Wall}.
6256
6257 @item -Wtrampolines
6258 @opindex Wtrampolines
6259 @opindex Wno-trampolines
6260 Warn about trampolines generated for pointers to nested functions.
6261 A trampoline is a small piece of data or code that is created at run
6262 time on the stack when the address of a nested function is taken, and is
6263 used to call the nested function indirectly. For some targets, it is
6264 made up of data only and thus requires no special treatment. But, for
6265 most targets, it is made up of code and thus requires the stack to be
6266 made executable in order for the program to work properly.
6267
6268 @item -Wfloat-equal
6269 @opindex Wfloat-equal
6270 @opindex Wno-float-equal
6271 Warn if floating-point values are used in equality comparisons.
6272
6273 The idea behind this is that sometimes it is convenient (for the
6274 programmer) to consider floating-point values as approximations to
6275 infinitely precise real numbers. If you are doing this, then you need
6276 to compute (by analyzing the code, or in some other way) the maximum or
6277 likely maximum error that the computation introduces, and allow for it
6278 when performing comparisons (and when producing output, but that's a
6279 different problem). In particular, instead of testing for equality, you
6280 should check to see whether the two values have ranges that overlap; and
6281 this is done with the relational operators, so equality comparisons are
6282 probably mistaken.
6283
6284 @item -Wtraditional @r{(C and Objective-C only)}
6285 @opindex Wtraditional
6286 @opindex Wno-traditional
6287 Warn about certain constructs that behave differently in traditional and
6288 ISO C@. Also warn about ISO C constructs that have no traditional C
6289 equivalent, and/or problematic constructs that should be avoided.
6290
6291 @itemize @bullet
6292 @item
6293 Macro parameters that appear within string literals in the macro body.
6294 In traditional C macro replacement takes place within string literals,
6295 but in ISO C it does not.
6296
6297 @item
6298 In traditional C, some preprocessor directives did not exist.
6299 Traditional preprocessors only considered a line to be a directive
6300 if the @samp{#} appeared in column 1 on the line. Therefore
6301 @option{-Wtraditional} warns about directives that traditional C
6302 understands but ignores because the @samp{#} does not appear as the
6303 first character on the line. It also suggests you hide directives like
6304 @code{#pragma} not understood by traditional C by indenting them. Some
6305 traditional implementations do not recognize @code{#elif}, so this option
6306 suggests avoiding it altogether.
6307
6308 @item
6309 A function-like macro that appears without arguments.
6310
6311 @item
6312 The unary plus operator.
6313
6314 @item
6315 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6316 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6317 constants.) Note, these suffixes appear in macros defined in the system
6318 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6319 Use of these macros in user code might normally lead to spurious
6320 warnings, however GCC's integrated preprocessor has enough context to
6321 avoid warning in these cases.
6322
6323 @item
6324 A function declared external in one block and then used after the end of
6325 the block.
6326
6327 @item
6328 A @code{switch} statement has an operand of type @code{long}.
6329
6330 @item
6331 A non-@code{static} function declaration follows a @code{static} one.
6332 This construct is not accepted by some traditional C compilers.
6333
6334 @item
6335 The ISO type of an integer constant has a different width or
6336 signedness from its traditional type. This warning is only issued if
6337 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6338 typically represent bit patterns, are not warned about.
6339
6340 @item
6341 Usage of ISO string concatenation is detected.
6342
6343 @item
6344 Initialization of automatic aggregates.
6345
6346 @item
6347 Identifier conflicts with labels. Traditional C lacks a separate
6348 namespace for labels.
6349
6350 @item
6351 Initialization of unions. If the initializer is zero, the warning is
6352 omitted. This is done under the assumption that the zero initializer in
6353 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6354 initializer warnings and relies on default initialization to zero in the
6355 traditional C case.
6356
6357 @item
6358 Conversions by prototypes between fixed/floating-point values and vice
6359 versa. The absence of these prototypes when compiling with traditional
6360 C causes serious problems. This is a subset of the possible
6361 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6362
6363 @item
6364 Use of ISO C style function definitions. This warning intentionally is
6365 @emph{not} issued for prototype declarations or variadic functions
6366 because these ISO C features appear in your code when using
6367 libiberty's traditional C compatibility macros, @code{PARAMS} and
6368 @code{VPARAMS}. This warning is also bypassed for nested functions
6369 because that feature is already a GCC extension and thus not relevant to
6370 traditional C compatibility.
6371 @end itemize
6372
6373 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6374 @opindex Wtraditional-conversion
6375 @opindex Wno-traditional-conversion
6376 Warn if a prototype causes a type conversion that is different from what
6377 would happen to the same argument in the absence of a prototype. This
6378 includes conversions of fixed point to floating and vice versa, and
6379 conversions changing the width or signedness of a fixed-point argument
6380 except when the same as the default promotion.
6381
6382 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6383 @opindex Wdeclaration-after-statement
6384 @opindex Wno-declaration-after-statement
6385 Warn when a declaration is found after a statement in a block. This
6386 construct, known from C++, was introduced with ISO C99 and is by default
6387 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6388
6389 @item -Wshadow
6390 @opindex Wshadow
6391 @opindex Wno-shadow
6392 Warn whenever a local variable or type declaration shadows another
6393 variable, parameter, type, class member (in C++), or instance variable
6394 (in Objective-C) or whenever a built-in function is shadowed. Note
6395 that in C++, the compiler warns if a local variable shadows an
6396 explicit typedef, but not if it shadows a struct/class/enum.
6397 Same as @option{-Wshadow=global}.
6398
6399 @item -Wno-shadow-ivar @r{(Objective-C only)}
6400 @opindex Wno-shadow-ivar
6401 @opindex Wshadow-ivar
6402 Do not warn whenever a local variable shadows an instance variable in an
6403 Objective-C method.
6404
6405 @item -Wshadow=global
6406 @opindex Wshadow=local
6407 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6408
6409 @item -Wshadow=local
6410 @opindex Wshadow=local
6411 Warn when a local variable shadows another local variable or parameter.
6412 This warning is enabled by @option{-Wshadow=global}.
6413
6414 @item -Wshadow=compatible-local
6415 @opindex Wshadow=compatible-local
6416 Warn when a local variable shadows another local variable or parameter
6417 whose type is compatible with that of the shadowing variable. In C++,
6418 type compatibility here means the type of the shadowing variable can be
6419 converted to that of the shadowed variable. The creation of this flag
6420 (in addition to @option{-Wshadow=local}) is based on the idea that when
6421 a local variable shadows another one of incompatible type, it is most
6422 likely intentional, not a bug or typo, as shown in the following example:
6423
6424 @smallexample
6425 @group
6426 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6427 @{
6428 for (int i = 0; i < N; ++i)
6429 @{
6430 ...
6431 @}
6432 ...
6433 @}
6434 @end group
6435 @end smallexample
6436
6437 Since the two variable @code{i} in the example above have incompatible types,
6438 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6439 Because their types are incompatible, if a programmer accidentally uses one
6440 in place of the other, type checking will catch that and emit an error or
6441 warning. So not warning (about shadowing) in this case will not lead to
6442 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6443 possibly reduce the number of warnings triggered by intentional shadowing.
6444
6445 This warning is enabled by @option{-Wshadow=local}.
6446
6447 @item -Wlarger-than=@var{byte-size}
6448 @opindex Wlarger-than=
6449 @opindex Wlarger-than-@var{byte-size}
6450 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6451 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6452 Warnings controlled by the option can be disabled either by specifying
6453 @var{byte-size} of @samp{SIZE_MAX} or more or by
6454 @option{-Wno-larger-than}.
6455
6456 @item -Wno-larger-than
6457 @opindex Wno-larger-than
6458 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6459 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6460
6461 @item -Wframe-larger-than=@var{byte-size}
6462 @opindex Wframe-larger-than=
6463 @opindex Wno-frame-larger-than
6464 Warn if the size of a function frame exceeds @var{byte-size}.
6465 The computation done to determine the stack frame size is approximate
6466 and not conservative.
6467 The actual requirements may be somewhat greater than @var{byte-size}
6468 even if you do not get a warning. In addition, any space allocated
6469 via @code{alloca}, variable-length arrays, or related constructs
6470 is not included by the compiler when determining
6471 whether or not to issue a warning.
6472 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6473 Warnings controlled by the option can be disabled either by specifying
6474 @var{byte-size} of @samp{SIZE_MAX} or more or by
6475 @option{-Wno-frame-larger-than}.
6476
6477 @item -Wno-frame-larger-than
6478 @opindex Wno-frame-larger-than
6479 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6480 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6481
6482 @item -Wno-free-nonheap-object
6483 @opindex Wno-free-nonheap-object
6484 @opindex Wfree-nonheap-object
6485 Do not warn when attempting to free an object that was not allocated
6486 on the heap.
6487
6488 @item -Wstack-usage=@var{byte-size}
6489 @opindex Wstack-usage
6490 @opindex Wno-stack-usage
6491 Warn if the stack usage of a function might exceed @var{byte-size}.
6492 The computation done to determine the stack usage is conservative.
6493 Any space allocated via @code{alloca}, variable-length arrays, or related
6494 constructs is included by the compiler when determining whether or not to
6495 issue a warning.
6496
6497 The message is in keeping with the output of @option{-fstack-usage}.
6498
6499 @itemize
6500 @item
6501 If the stack usage is fully static but exceeds the specified amount, it's:
6502
6503 @smallexample
6504 warning: stack usage is 1120 bytes
6505 @end smallexample
6506 @item
6507 If the stack usage is (partly) dynamic but bounded, it's:
6508
6509 @smallexample
6510 warning: stack usage might be 1648 bytes
6511 @end smallexample
6512 @item
6513 If the stack usage is (partly) dynamic and not bounded, it's:
6514
6515 @smallexample
6516 warning: stack usage might be unbounded
6517 @end smallexample
6518 @end itemize
6519
6520 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6521 Warnings controlled by the option can be disabled either by specifying
6522 @var{byte-size} of @samp{SIZE_MAX} or more or by
6523 @option{-Wno-stack-usage}.
6524
6525 @item -Wno-stack-usage
6526 @opindex Wno-stack-usage
6527 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6528 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6529
6530 @item -Wunsafe-loop-optimizations
6531 @opindex Wunsafe-loop-optimizations
6532 @opindex Wno-unsafe-loop-optimizations
6533 Warn if the loop cannot be optimized because the compiler cannot
6534 assume anything on the bounds of the loop indices. With
6535 @option{-funsafe-loop-optimizations} warn if the compiler makes
6536 such assumptions.
6537
6538 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6539 @opindex Wno-pedantic-ms-format
6540 @opindex Wpedantic-ms-format
6541 When used in combination with @option{-Wformat}
6542 and @option{-pedantic} without GNU extensions, this option
6543 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6544 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6545 which depend on the MS runtime.
6546
6547 @item -Waligned-new
6548 @opindex Waligned-new
6549 @opindex Wno-aligned-new
6550 Warn about a new-expression of a type that requires greater alignment
6551 than the @code{alignof(std::max_align_t)} but uses an allocation
6552 function without an explicit alignment parameter. This option is
6553 enabled by @option{-Wall}.
6554
6555 Normally this only warns about global allocation functions, but
6556 @option{-Waligned-new=all} also warns about class member allocation
6557 functions.
6558
6559 @item -Wplacement-new
6560 @itemx -Wplacement-new=@var{n}
6561 @opindex Wplacement-new
6562 @opindex Wno-placement-new
6563 Warn about placement new expressions with undefined behavior, such as
6564 constructing an object in a buffer that is smaller than the type of
6565 the object. For example, the placement new expression below is diagnosed
6566 because it attempts to construct an array of 64 integers in a buffer only
6567 64 bytes large.
6568 @smallexample
6569 char buf [64];
6570 new (buf) int[64];
6571 @end smallexample
6572 This warning is enabled by default.
6573
6574 @table @gcctabopt
6575 @item -Wplacement-new=1
6576 This is the default warning level of @option{-Wplacement-new}. At this
6577 level the warning is not issued for some strictly undefined constructs that
6578 GCC allows as extensions for compatibility with legacy code. For example,
6579 the following @code{new} expression is not diagnosed at this level even
6580 though it has undefined behavior according to the C++ standard because
6581 it writes past the end of the one-element array.
6582 @smallexample
6583 struct S @{ int n, a[1]; @};
6584 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6585 new (s->a)int [32]();
6586 @end smallexample
6587
6588 @item -Wplacement-new=2
6589 At this level, in addition to diagnosing all the same constructs as at level
6590 1, a diagnostic is also issued for placement new expressions that construct
6591 an object in the last member of structure whose type is an array of a single
6592 element and whose size is less than the size of the object being constructed.
6593 While the previous example would be diagnosed, the following construct makes
6594 use of the flexible member array extension to avoid the warning at level 2.
6595 @smallexample
6596 struct S @{ int n, a[]; @};
6597 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6598 new (s->a)int [32]();
6599 @end smallexample
6600
6601 @end table
6602
6603 @item -Wpointer-arith
6604 @opindex Wpointer-arith
6605 @opindex Wno-pointer-arith
6606 Warn about anything that depends on the ``size of'' a function type or
6607 of @code{void}. GNU C assigns these types a size of 1, for
6608 convenience in calculations with @code{void *} pointers and pointers
6609 to functions. In C++, warn also when an arithmetic operation involves
6610 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6611
6612 @item -Wpointer-compare
6613 @opindex Wpointer-compare
6614 @opindex Wno-pointer-compare
6615 Warn if a pointer is compared with a zero character constant. This usually
6616 means that the pointer was meant to be dereferenced. For example:
6617
6618 @smallexample
6619 const char *p = foo ();
6620 if (p == '\0')
6621 return 42;
6622 @end smallexample
6623
6624 Note that the code above is invalid in C++11.
6625
6626 This warning is enabled by default.
6627
6628 @item -Wtype-limits
6629 @opindex Wtype-limits
6630 @opindex Wno-type-limits
6631 Warn if a comparison is always true or always false due to the limited
6632 range of the data type, but do not warn for constant expressions. For
6633 example, warn if an unsigned variable is compared against zero with
6634 @code{<} or @code{>=}. This warning is also enabled by
6635 @option{-Wextra}.
6636
6637 @item -Wabsolute-value @r{(C and Objective-C only)}
6638 @opindex Wabsolute-value
6639 @opindex Wno-absolute-value
6640 Warn when a wrong absolute value function seems to be used or when it
6641 does not have any effect because its argument is an unsigned type.
6642 This warning be suppressed with an explicit type cast and it is also
6643 enabled by @option{-Wextra}.
6644
6645 @include cppwarnopts.texi
6646
6647 @item -Wbad-function-cast @r{(C and Objective-C only)}
6648 @opindex Wbad-function-cast
6649 @opindex Wno-bad-function-cast
6650 Warn when a function call is cast to a non-matching type.
6651 For example, warn if a call to a function returning an integer type
6652 is cast to a pointer type.
6653
6654 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6655 @opindex Wc90-c99-compat
6656 @opindex Wno-c90-c99-compat
6657 Warn about features not present in ISO C90, but present in ISO C99.
6658 For instance, warn about use of variable length arrays, @code{long long}
6659 type, @code{bool} type, compound literals, designated initializers, and so
6660 on. This option is independent of the standards mode. Warnings are disabled
6661 in the expression that follows @code{__extension__}.
6662
6663 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6664 @opindex Wc99-c11-compat
6665 @opindex Wno-c99-c11-compat
6666 Warn about features not present in ISO C99, but present in ISO C11.
6667 For instance, warn about use of anonymous structures and unions,
6668 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6669 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6670 and so on. This option is independent of the standards mode. Warnings are
6671 disabled in the expression that follows @code{__extension__}.
6672
6673 @item -Wc++-compat @r{(C and Objective-C only)}
6674 @opindex Wc++-compat
6675 @opindex Wno-c++-compat
6676 Warn about ISO C constructs that are outside of the common subset of
6677 ISO C and ISO C++, e.g.@: request for implicit conversion from
6678 @code{void *} to a pointer to non-@code{void} type.
6679
6680 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6681 @opindex Wc++11-compat
6682 @opindex Wno-c++11-compat
6683 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6684 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6685 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6686 enabled by @option{-Wall}.
6687
6688 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6689 @opindex Wc++14-compat
6690 @opindex Wno-c++14-compat
6691 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6692 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6693
6694 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6695 @opindex Wc++17-compat
6696 @opindex Wno-c++17-compat
6697 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6698 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6699
6700 @item -Wcast-qual
6701 @opindex Wcast-qual
6702 @opindex Wno-cast-qual
6703 Warn whenever a pointer is cast so as to remove a type qualifier from
6704 the target type. For example, warn if a @code{const char *} is cast
6705 to an ordinary @code{char *}.
6706
6707 Also warn when making a cast that introduces a type qualifier in an
6708 unsafe way. For example, casting @code{char **} to @code{const char **}
6709 is unsafe, as in this example:
6710
6711 @smallexample
6712 /* p is char ** value. */
6713 const char **q = (const char **) p;
6714 /* Assignment of readonly string to const char * is OK. */
6715 *q = "string";
6716 /* Now char** pointer points to read-only memory. */
6717 **p = 'b';
6718 @end smallexample
6719
6720 @item -Wcast-align
6721 @opindex Wcast-align
6722 @opindex Wno-cast-align
6723 Warn whenever a pointer is cast such that the required alignment of the
6724 target is increased. For example, warn if a @code{char *} is cast to
6725 an @code{int *} on machines where integers can only be accessed at
6726 two- or four-byte boundaries.
6727
6728 @item -Wcast-align=strict
6729 @opindex Wcast-align=strict
6730 Warn whenever a pointer is cast such that the required alignment of the
6731 target is increased. For example, warn if a @code{char *} is cast to
6732 an @code{int *} regardless of the target machine.
6733
6734 @item -Wcast-function-type
6735 @opindex Wcast-function-type
6736 @opindex Wno-cast-function-type
6737 Warn when a function pointer is cast to an incompatible function pointer.
6738 In a cast involving function types with a variable argument list only
6739 the types of initial arguments that are provided are considered.
6740 Any parameter of pointer-type matches any other pointer-type. Any benign
6741 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6742 on ILP32 targets. Likewise type qualifiers are ignored. The function
6743 type @code{void (*) (void)} is special and matches everything, which can
6744 be used to suppress this warning.
6745 In a cast involving pointer to member types this warning warns whenever
6746 the type cast is changing the pointer to member type.
6747 This warning is enabled by @option{-Wextra}.
6748
6749 @item -Wwrite-strings
6750 @opindex Wwrite-strings
6751 @opindex Wno-write-strings
6752 When compiling C, give string constants the type @code{const
6753 char[@var{length}]} so that copying the address of one into a
6754 non-@code{const} @code{char *} pointer produces a warning. These
6755 warnings help you find at compile time code that can try to write
6756 into a string constant, but only if you have been very careful about
6757 using @code{const} in declarations and prototypes. Otherwise, it is
6758 just a nuisance. This is why we did not make @option{-Wall} request
6759 these warnings.
6760
6761 When compiling C++, warn about the deprecated conversion from string
6762 literals to @code{char *}. This warning is enabled by default for C++
6763 programs.
6764
6765 @item -Wcatch-value
6766 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6767 @opindex Wcatch-value
6768 @opindex Wno-catch-value
6769 Warn about catch handlers that do not catch via reference.
6770 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6771 warn about polymorphic class types that are caught by value.
6772 With @option{-Wcatch-value=2} warn about all class types that are caught
6773 by value. With @option{-Wcatch-value=3} warn about all types that are
6774 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6775
6776 @item -Wclobbered
6777 @opindex Wclobbered
6778 @opindex Wno-clobbered
6779 Warn for variables that might be changed by @code{longjmp} or
6780 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6781
6782 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6783 @opindex Wconditionally-supported
6784 @opindex Wno-conditionally-supported
6785 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6786
6787 @item -Wconversion
6788 @opindex Wconversion
6789 @opindex Wno-conversion
6790 Warn for implicit conversions that may alter a value. This includes
6791 conversions between real and integer, like @code{abs (x)} when
6792 @code{x} is @code{double}; conversions between signed and unsigned,
6793 like @code{unsigned ui = -1}; and conversions to smaller types, like
6794 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6795 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6796 changed by the conversion like in @code{abs (2.0)}. Warnings about
6797 conversions between signed and unsigned integers can be disabled by
6798 using @option{-Wno-sign-conversion}.
6799
6800 For C++, also warn for confusing overload resolution for user-defined
6801 conversions; and conversions that never use a type conversion
6802 operator: conversions to @code{void}, the same type, a base class or a
6803 reference to them. Warnings about conversions between signed and
6804 unsigned integers are disabled by default in C++ unless
6805 @option{-Wsign-conversion} is explicitly enabled.
6806
6807 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6808 @opindex Wconversion-null
6809 @opindex Wno-conversion-null
6810 Do not warn for conversions between @code{NULL} and non-pointer
6811 types. @option{-Wconversion-null} is enabled by default.
6812
6813 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6814 @opindex Wzero-as-null-pointer-constant
6815 @opindex Wno-zero-as-null-pointer-constant
6816 Warn when a literal @samp{0} is used as null pointer constant. This can
6817 be useful to facilitate the conversion to @code{nullptr} in C++11.
6818
6819 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6820 @opindex Wsubobject-linkage
6821 @opindex Wno-subobject-linkage
6822 Warn if a class type has a base or a field whose type uses the anonymous
6823 namespace or depends on a type with no linkage. If a type A depends on
6824 a type B with no or internal linkage, defining it in multiple
6825 translation units would be an ODR violation because the meaning of B
6826 is different in each translation unit. If A only appears in a single
6827 translation unit, the best way to silence the warning is to give it
6828 internal linkage by putting it in an anonymous namespace as well. The
6829 compiler doesn't give this warning for types defined in the main .C
6830 file, as those are unlikely to have multiple definitions.
6831 @option{-Wsubobject-linkage} is enabled by default.
6832
6833 @item -Wdangling-else
6834 @opindex Wdangling-else
6835 @opindex Wno-dangling-else
6836 Warn about constructions where there may be confusion to which
6837 @code{if} statement an @code{else} branch belongs. Here is an example of
6838 such a case:
6839
6840 @smallexample
6841 @group
6842 @{
6843 if (a)
6844 if (b)
6845 foo ();
6846 else
6847 bar ();
6848 @}
6849 @end group
6850 @end smallexample
6851
6852 In C/C++, every @code{else} branch belongs to the innermost possible
6853 @code{if} statement, which in this example is @code{if (b)}. This is
6854 often not what the programmer expected, as illustrated in the above
6855 example by indentation the programmer chose. When there is the
6856 potential for this confusion, GCC issues a warning when this flag
6857 is specified. To eliminate the warning, add explicit braces around
6858 the innermost @code{if} statement so there is no way the @code{else}
6859 can belong to the enclosing @code{if}. The resulting code
6860 looks like this:
6861
6862 @smallexample
6863 @group
6864 @{
6865 if (a)
6866 @{
6867 if (b)
6868 foo ();
6869 else
6870 bar ();
6871 @}
6872 @}
6873 @end group
6874 @end smallexample
6875
6876 This warning is enabled by @option{-Wparentheses}.
6877
6878 @item -Wdate-time
6879 @opindex Wdate-time
6880 @opindex Wno-date-time
6881 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6882 are encountered as they might prevent bit-wise-identical reproducible
6883 compilations.
6884
6885 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6886 @opindex Wdelete-incomplete
6887 @opindex Wno-delete-incomplete
6888 Warn when deleting a pointer to incomplete type, which may cause
6889 undefined behavior at runtime. This warning is enabled by default.
6890
6891 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6892 @opindex Wuseless-cast
6893 @opindex Wno-useless-cast
6894 Warn when an expression is casted to its own type.
6895
6896 @item -Wempty-body
6897 @opindex Wempty-body
6898 @opindex Wno-empty-body
6899 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6900 while} statement. This warning is also enabled by @option{-Wextra}.
6901
6902 @item -Wenum-compare
6903 @opindex Wenum-compare
6904 @opindex Wno-enum-compare
6905 Warn about a comparison between values of different enumerated types.
6906 In C++ enumerated type mismatches in conditional expressions are also
6907 diagnosed and the warning is enabled by default. In C this warning is
6908 enabled by @option{-Wall}.
6909
6910 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6911 @opindex Wextra-semi
6912 @opindex Wno-extra-semi
6913 Warn about redundant semicolon after in-class function definition.
6914
6915 @item -Wjump-misses-init @r{(C, Objective-C only)}
6916 @opindex Wjump-misses-init
6917 @opindex Wno-jump-misses-init
6918 Warn if a @code{goto} statement or a @code{switch} statement jumps
6919 forward across the initialization of a variable, or jumps backward to a
6920 label after the variable has been initialized. This only warns about
6921 variables that are initialized when they are declared. This warning is
6922 only supported for C and Objective-C; in C++ this sort of branch is an
6923 error in any case.
6924
6925 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6926 can be disabled with the @option{-Wno-jump-misses-init} option.
6927
6928 @item -Wsign-compare
6929 @opindex Wsign-compare
6930 @opindex Wno-sign-compare
6931 @cindex warning for comparison of signed and unsigned values
6932 @cindex comparison of signed and unsigned values, warning
6933 @cindex signed and unsigned values, comparison warning
6934 Warn when a comparison between signed and unsigned values could produce
6935 an incorrect result when the signed value is converted to unsigned.
6936 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6937 also enabled by @option{-Wextra}.
6938
6939 @item -Wsign-conversion
6940 @opindex Wsign-conversion
6941 @opindex Wno-sign-conversion
6942 Warn for implicit conversions that may change the sign of an integer
6943 value, like assigning a signed integer expression to an unsigned
6944 integer variable. An explicit cast silences the warning. In C, this
6945 option is enabled also by @option{-Wconversion}.
6946
6947 @item -Wfloat-conversion
6948 @opindex Wfloat-conversion
6949 @opindex Wno-float-conversion
6950 Warn for implicit conversions that reduce the precision of a real value.
6951 This includes conversions from real to integer, and from higher precision
6952 real to lower precision real values. This option is also enabled by
6953 @option{-Wconversion}.
6954
6955 @item -Wno-scalar-storage-order
6956 @opindex Wno-scalar-storage-order
6957 @opindex Wscalar-storage-order
6958 Do not warn on suspicious constructs involving reverse scalar storage order.
6959
6960 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6961 @opindex Wsized-deallocation
6962 @opindex Wno-sized-deallocation
6963 Warn about a definition of an unsized deallocation function
6964 @smallexample
6965 void operator delete (void *) noexcept;
6966 void operator delete[] (void *) noexcept;
6967 @end smallexample
6968 without a definition of the corresponding sized deallocation function
6969 @smallexample
6970 void operator delete (void *, std::size_t) noexcept;
6971 void operator delete[] (void *, std::size_t) noexcept;
6972 @end smallexample
6973 or vice versa. Enabled by @option{-Wextra} along with
6974 @option{-fsized-deallocation}.
6975
6976 @item -Wsizeof-pointer-div
6977 @opindex Wsizeof-pointer-div
6978 @opindex Wno-sizeof-pointer-div
6979 Warn for suspicious divisions of two sizeof expressions that divide
6980 the pointer size by the element size, which is the usual way to compute
6981 the array size but won't work out correctly with pointers. This warning
6982 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6983 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6984
6985 @item -Wsizeof-pointer-memaccess
6986 @opindex Wsizeof-pointer-memaccess
6987 @opindex Wno-sizeof-pointer-memaccess
6988 Warn for suspicious length parameters to certain string and memory built-in
6989 functions if the argument uses @code{sizeof}. This warning triggers for
6990 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6991 an array, but a pointer, and suggests a possible fix, or about
6992 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6993 also warns about calls to bounded string copy functions like @code{strncat}
6994 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6995 the source array. For example, in the following function the call to
6996 @code{strncat} specifies the size of the source string as the bound. That
6997 is almost certainly a mistake and so the call is diagnosed.
6998 @smallexample
6999 void make_file (const char *name)
7000 @{
7001 char path[PATH_MAX];
7002 strncpy (path, name, sizeof path - 1);
7003 strncat (path, ".text", sizeof ".text");
7004 @dots{}
7005 @}
7006 @end smallexample
7007
7008 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7009
7010 @item -Wsizeof-array-argument
7011 @opindex Wsizeof-array-argument
7012 @opindex Wno-sizeof-array-argument
7013 Warn when the @code{sizeof} operator is applied to a parameter that is
7014 declared as an array in a function definition. This warning is enabled by
7015 default for C and C++ programs.
7016
7017 @item -Wmemset-elt-size
7018 @opindex Wmemset-elt-size
7019 @opindex Wno-memset-elt-size
7020 Warn for suspicious calls to the @code{memset} built-in function, if the
7021 first argument references an array, and the third argument is a number
7022 equal to the number of elements, but not equal to the size of the array
7023 in memory. This indicates that the user has omitted a multiplication by
7024 the element size. This warning is enabled by @option{-Wall}.
7025
7026 @item -Wmemset-transposed-args
7027 @opindex Wmemset-transposed-args
7028 @opindex Wno-memset-transposed-args
7029 Warn for suspicious calls to the @code{memset} built-in function where
7030 the second argument is not zero and the third argument is zero. For
7031 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7032 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7033 is only emitted if the third argument is a literal zero. Otherwise, if
7034 it is an expression that is folded to zero, or a cast of zero to some
7035 type, it is far less likely that the arguments have been mistakenly
7036 transposed and no warning is emitted. This warning is enabled
7037 by @option{-Wall}.
7038
7039 @item -Waddress
7040 @opindex Waddress
7041 @opindex Wno-address
7042 Warn about suspicious uses of memory addresses. These include using
7043 the address of a function in a conditional expression, such as
7044 @code{void func(void); if (func)}, and comparisons against the memory
7045 address of a string literal, such as @code{if (x == "abc")}. Such
7046 uses typically indicate a programmer error: the address of a function
7047 always evaluates to true, so their use in a conditional usually
7048 indicate that the programmer forgot the parentheses in a function
7049 call; and comparisons against string literals result in unspecified
7050 behavior and are not portable in C, so they usually indicate that the
7051 programmer intended to use @code{strcmp}. This warning is enabled by
7052 @option{-Wall}.
7053
7054 @item -Waddress-of-packed-member
7055 @opindex Waddress-of-packed-member
7056 @opindex Wno-address-of-packed-member
7057 Warn when the address of packed member of struct or union is taken,
7058 which usually results in an unaligned pointer value. This is
7059 enabled by default.
7060
7061 @item -Wlogical-op
7062 @opindex Wlogical-op
7063 @opindex Wno-logical-op
7064 Warn about suspicious uses of logical operators in expressions.
7065 This includes using logical operators in contexts where a
7066 bit-wise operator is likely to be expected. Also warns when
7067 the operands of a logical operator are the same:
7068 @smallexample
7069 extern int a;
7070 if (a < 0 && a < 0) @{ @dots{} @}
7071 @end smallexample
7072
7073 @item -Wlogical-not-parentheses
7074 @opindex Wlogical-not-parentheses
7075 @opindex Wno-logical-not-parentheses
7076 Warn about logical not used on the left hand side operand of a comparison.
7077 This option does not warn if the right operand is considered to be a boolean
7078 expression. Its purpose is to detect suspicious code like the following:
7079 @smallexample
7080 int a;
7081 @dots{}
7082 if (!a > 1) @{ @dots{} @}
7083 @end smallexample
7084
7085 It is possible to suppress the warning by wrapping the LHS into
7086 parentheses:
7087 @smallexample
7088 if ((!a) > 1) @{ @dots{} @}
7089 @end smallexample
7090
7091 This warning is enabled by @option{-Wall}.
7092
7093 @item -Waggregate-return
7094 @opindex Waggregate-return
7095 @opindex Wno-aggregate-return
7096 Warn if any functions that return structures or unions are defined or
7097 called. (In languages where you can return an array, this also elicits
7098 a warning.)
7099
7100 @item -Wno-aggressive-loop-optimizations
7101 @opindex Wno-aggressive-loop-optimizations
7102 @opindex Waggressive-loop-optimizations
7103 Warn if in a loop with constant number of iterations the compiler detects
7104 undefined behavior in some statement during one or more of the iterations.
7105
7106 @item -Wno-attributes
7107 @opindex Wno-attributes
7108 @opindex Wattributes
7109 Do not warn if an unexpected @code{__attribute__} is used, such as
7110 unrecognized attributes, function attributes applied to variables,
7111 etc. This does not stop errors for incorrect use of supported
7112 attributes.
7113
7114 @item -Wno-builtin-declaration-mismatch
7115 @opindex Wno-builtin-declaration-mismatch
7116 @opindex Wbuiltin-declaration-mismatch
7117 Warn if a built-in function is declared with an incompatible signature
7118 or as a non-function, or when a built-in function declared with a type
7119 that does not include a prototype is called with arguments whose promoted
7120 types do not match those expected by the function. When @option{-Wextra}
7121 is specified, also warn when a built-in function that takes arguments is
7122 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7123 warning is enabled by default. To avoid the warning include the appropriate
7124 header to bring the prototypes of built-in functions into scope.
7125
7126 For example, the call to @code{memset} below is diagnosed by the warning
7127 because the function expects a value of type @code{size_t} as its argument
7128 but the type of @code{32} is @code{int}. With @option{-Wextra},
7129 the declaration of the function is diagnosed as well.
7130 @smallexample
7131 extern void* memset ();
7132 void f (void *d)
7133 @{
7134 memset (d, '\0', 32);
7135 @}
7136 @end smallexample
7137
7138 @item -Wno-builtin-macro-redefined
7139 @opindex Wno-builtin-macro-redefined
7140 @opindex Wbuiltin-macro-redefined
7141 Do not warn if certain built-in macros are redefined. This suppresses
7142 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7143 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7144
7145 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7146 @opindex Wstrict-prototypes
7147 @opindex Wno-strict-prototypes
7148 Warn if a function is declared or defined without specifying the
7149 argument types. (An old-style function definition is permitted without
7150 a warning if preceded by a declaration that specifies the argument
7151 types.)
7152
7153 @item -Wold-style-declaration @r{(C and Objective-C only)}
7154 @opindex Wold-style-declaration
7155 @opindex Wno-old-style-declaration
7156 Warn for obsolescent usages, according to the C Standard, in a
7157 declaration. For example, warn if storage-class specifiers like
7158 @code{static} are not the first things in a declaration. This warning
7159 is also enabled by @option{-Wextra}.
7160
7161 @item -Wold-style-definition @r{(C and Objective-C only)}
7162 @opindex Wold-style-definition
7163 @opindex Wno-old-style-definition
7164 Warn if an old-style function definition is used. A warning is given
7165 even if there is a previous prototype.
7166
7167 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7168 @opindex Wmissing-parameter-type
7169 @opindex Wno-missing-parameter-type
7170 A function parameter is declared without a type specifier in K&R-style
7171 functions:
7172
7173 @smallexample
7174 void foo(bar) @{ @}
7175 @end smallexample
7176
7177 This warning is also enabled by @option{-Wextra}.
7178
7179 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7180 @opindex Wmissing-prototypes
7181 @opindex Wno-missing-prototypes
7182 Warn if a global function is defined without a previous prototype
7183 declaration. This warning is issued even if the definition itself
7184 provides a prototype. Use this option to detect global functions
7185 that do not have a matching prototype declaration in a header file.
7186 This option is not valid for C++ because all function declarations
7187 provide prototypes and a non-matching declaration declares an
7188 overload rather than conflict with an earlier declaration.
7189 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7190
7191 @item -Wmissing-declarations
7192 @opindex Wmissing-declarations
7193 @opindex Wno-missing-declarations
7194 Warn if a global function is defined without a previous declaration.
7195 Do so even if the definition itself provides a prototype.
7196 Use this option to detect global functions that are not declared in
7197 header files. In C, no warnings are issued for functions with previous
7198 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7199 missing prototypes. In C++, no warnings are issued for function templates,
7200 or for inline functions, or for functions in anonymous namespaces.
7201
7202 @item -Wmissing-field-initializers
7203 @opindex Wmissing-field-initializers
7204 @opindex Wno-missing-field-initializers
7205 @opindex W
7206 @opindex Wextra
7207 @opindex Wno-extra
7208 Warn if a structure's initializer has some fields missing. For
7209 example, the following code causes such a warning, because
7210 @code{x.h} is implicitly zero:
7211
7212 @smallexample
7213 struct s @{ int f, g, h; @};
7214 struct s x = @{ 3, 4 @};
7215 @end smallexample
7216
7217 This option does not warn about designated initializers, so the following
7218 modification does not trigger a warning:
7219
7220 @smallexample
7221 struct s @{ int f, g, h; @};
7222 struct s x = @{ .f = 3, .g = 4 @};
7223 @end smallexample
7224
7225 In C this option does not warn about the universal zero initializer
7226 @samp{@{ 0 @}}:
7227
7228 @smallexample
7229 struct s @{ int f, g, h; @};
7230 struct s x = @{ 0 @};
7231 @end smallexample
7232
7233 Likewise, in C++ this option does not warn about the empty @{ @}
7234 initializer, for example:
7235
7236 @smallexample
7237 struct s @{ int f, g, h; @};
7238 s x = @{ @};
7239 @end smallexample
7240
7241 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7242 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7243
7244 @item -Wno-multichar
7245 @opindex Wno-multichar
7246 @opindex Wmultichar
7247 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7248 Usually they indicate a typo in the user's code, as they have
7249 implementation-defined values, and should not be used in portable code.
7250
7251 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7252 @opindex Wnormalized=
7253 @opindex Wnormalized
7254 @opindex Wno-normalized
7255 @cindex NFC
7256 @cindex NFKC
7257 @cindex character set, input normalization
7258 In ISO C and ISO C++, two identifiers are different if they are
7259 different sequences of characters. However, sometimes when characters
7260 outside the basic ASCII character set are used, you can have two
7261 different character sequences that look the same. To avoid confusion,
7262 the ISO 10646 standard sets out some @dfn{normalization rules} which
7263 when applied ensure that two sequences that look the same are turned into
7264 the same sequence. GCC can warn you if you are using identifiers that
7265 have not been normalized; this option controls that warning.
7266
7267 There are four levels of warning supported by GCC@. The default is
7268 @option{-Wnormalized=nfc}, which warns about any identifier that is
7269 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7270 recommended form for most uses. It is equivalent to
7271 @option{-Wnormalized}.
7272
7273 Unfortunately, there are some characters allowed in identifiers by
7274 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7275 identifiers. That is, there's no way to use these symbols in portable
7276 ISO C or C++ and have all your identifiers in NFC@.
7277 @option{-Wnormalized=id} suppresses the warning for these characters.
7278 It is hoped that future versions of the standards involved will correct
7279 this, which is why this option is not the default.
7280
7281 You can switch the warning off for all characters by writing
7282 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7283 only do this if you are using some other normalization scheme (like
7284 ``D''), because otherwise you can easily create bugs that are
7285 literally impossible to see.
7286
7287 Some characters in ISO 10646 have distinct meanings but look identical
7288 in some fonts or display methodologies, especially once formatting has
7289 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7290 LETTER N'', displays just like a regular @code{n} that has been
7291 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7292 normalization scheme to convert all these into a standard form as
7293 well, and GCC warns if your code is not in NFKC if you use
7294 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7295 about every identifier that contains the letter O because it might be
7296 confused with the digit 0, and so is not the default, but may be
7297 useful as a local coding convention if the programming environment
7298 cannot be fixed to display these characters distinctly.
7299
7300 @item -Wno-attribute-warning
7301 @opindex Wno-attribute-warning
7302 @opindex Wattribute-warning
7303 Do not warn about usage of functions (@pxref{Function Attributes})
7304 declared with @code{warning} attribute. By default, this warning is
7305 enabled. @option{-Wno-attribute-warning} can be used to disable the
7306 warning or @option{-Wno-error=attribute-warning} can be used to
7307 disable the error when compiled with @option{-Werror} flag.
7308
7309 @item -Wno-deprecated
7310 @opindex Wno-deprecated
7311 @opindex Wdeprecated
7312 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7313
7314 @item -Wno-deprecated-declarations
7315 @opindex Wno-deprecated-declarations
7316 @opindex Wdeprecated-declarations
7317 Do not warn about uses of functions (@pxref{Function Attributes}),
7318 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7319 Attributes}) marked as deprecated by using the @code{deprecated}
7320 attribute.
7321
7322 @item -Wno-overflow
7323 @opindex Wno-overflow
7324 @opindex Woverflow
7325 Do not warn about compile-time overflow in constant expressions.
7326
7327 @item -Wno-odr
7328 @opindex Wno-odr
7329 @opindex Wodr
7330 Warn about One Definition Rule violations during link-time optimization.
7331 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7332
7333 @item -Wopenmp-simd
7334 @opindex Wopenmp-simd
7335 @opindex Wno-openmp-simd
7336 Warn if the vectorizer cost model overrides the OpenMP
7337 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7338 option can be used to relax the cost model.
7339
7340 @item -Woverride-init @r{(C and Objective-C only)}
7341 @opindex Woverride-init
7342 @opindex Wno-override-init
7343 @opindex W
7344 @opindex Wextra
7345 @opindex Wno-extra
7346 Warn if an initialized field without side effects is overridden when
7347 using designated initializers (@pxref{Designated Inits, , Designated
7348 Initializers}).
7349
7350 This warning is included in @option{-Wextra}. To get other
7351 @option{-Wextra} warnings without this one, use @option{-Wextra
7352 -Wno-override-init}.
7353
7354 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7355 @opindex Woverride-init-side-effects
7356 @opindex Wno-override-init-side-effects
7357 Warn if an initialized field with side effects is overridden when
7358 using designated initializers (@pxref{Designated Inits, , Designated
7359 Initializers}). This warning is enabled by default.
7360
7361 @item -Wpacked
7362 @opindex Wpacked
7363 @opindex Wno-packed
7364 Warn if a structure is given the packed attribute, but the packed
7365 attribute has no effect on the layout or size of the structure.
7366 Such structures may be mis-aligned for little benefit. For
7367 instance, in this code, the variable @code{f.x} in @code{struct bar}
7368 is misaligned even though @code{struct bar} does not itself
7369 have the packed attribute:
7370
7371 @smallexample
7372 @group
7373 struct foo @{
7374 int x;
7375 char a, b, c, d;
7376 @} __attribute__((packed));
7377 struct bar @{
7378 char z;
7379 struct foo f;
7380 @};
7381 @end group
7382 @end smallexample
7383
7384 @item -Wpacked-bitfield-compat
7385 @opindex Wpacked-bitfield-compat
7386 @opindex Wno-packed-bitfield-compat
7387 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7388 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7389 the change can lead to differences in the structure layout. GCC
7390 informs you when the offset of such a field has changed in GCC 4.4.
7391 For example there is no longer a 4-bit padding between field @code{a}
7392 and @code{b} in this structure:
7393
7394 @smallexample
7395 struct foo
7396 @{
7397 char a:4;
7398 char b:8;
7399 @} __attribute__ ((packed));
7400 @end smallexample
7401
7402 This warning is enabled by default. Use
7403 @option{-Wno-packed-bitfield-compat} to disable this warning.
7404
7405 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7406 @opindex Wpacked-not-aligned
7407 @opindex Wno-packed-not-aligned
7408 Warn if a structure field with explicitly specified alignment in a
7409 packed struct or union is misaligned. For example, a warning will
7410 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7411 'struct S' is less than 8}, in this code:
7412
7413 @smallexample
7414 @group
7415 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7416 struct __attribute__ ((packed)) S @{
7417 struct S8 s8;
7418 @};
7419 @end group
7420 @end smallexample
7421
7422 This warning is enabled by @option{-Wall}.
7423
7424 @item -Wpadded
7425 @opindex Wpadded
7426 @opindex Wno-padded
7427 Warn if padding is included in a structure, either to align an element
7428 of the structure or to align the whole structure. Sometimes when this
7429 happens it is possible to rearrange the fields of the structure to
7430 reduce the padding and so make the structure smaller.
7431
7432 @item -Wredundant-decls
7433 @opindex Wredundant-decls
7434 @opindex Wno-redundant-decls
7435 Warn if anything is declared more than once in the same scope, even in
7436 cases where multiple declaration is valid and changes nothing.
7437
7438 @item -Wno-restrict
7439 @opindex Wrestrict
7440 @opindex Wno-restrict
7441 Warn when an object referenced by a @code{restrict}-qualified parameter
7442 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7443 argument, or when copies between such objects overlap. For example,
7444 the call to the @code{strcpy} function below attempts to truncate the string
7445 by replacing its initial characters with the last four. However, because
7446 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7447 the call is diagnosed.
7448
7449 @smallexample
7450 void foo (void)
7451 @{
7452 char a[] = "abcd1234";
7453 strcpy (a, a + 4);
7454 @dots{}
7455 @}
7456 @end smallexample
7457 The @option{-Wrestrict} option detects some instances of simple overlap
7458 even without optimization but works best at @option{-O2} and above. It
7459 is included in @option{-Wall}.
7460
7461 @item -Wnested-externs @r{(C and Objective-C only)}
7462 @opindex Wnested-externs
7463 @opindex Wno-nested-externs
7464 Warn if an @code{extern} declaration is encountered within a function.
7465
7466 @item -Wno-inherited-variadic-ctor
7467 @opindex Winherited-variadic-ctor
7468 @opindex Wno-inherited-variadic-ctor
7469 Suppress warnings about use of C++11 inheriting constructors when the
7470 base class inherited from has a C variadic constructor; the warning is
7471 on by default because the ellipsis is not inherited.
7472
7473 @item -Winline
7474 @opindex Winline
7475 @opindex Wno-inline
7476 Warn if a function that is declared as inline cannot be inlined.
7477 Even with this option, the compiler does not warn about failures to
7478 inline functions declared in system headers.
7479
7480 The compiler uses a variety of heuristics to determine whether or not
7481 to inline a function. For example, the compiler takes into account
7482 the size of the function being inlined and the amount of inlining
7483 that has already been done in the current function. Therefore,
7484 seemingly insignificant changes in the source program can cause the
7485 warnings produced by @option{-Winline} to appear or disappear.
7486
7487 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7488 @opindex Wno-invalid-offsetof
7489 @opindex Winvalid-offsetof
7490 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7491 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7492 to a non-standard-layout type is undefined. In existing C++ implementations,
7493 however, @code{offsetof} typically gives meaningful results.
7494 This flag is for users who are aware that they are
7495 writing nonportable code and who have deliberately chosen to ignore the
7496 warning about it.
7497
7498 The restrictions on @code{offsetof} may be relaxed in a future version
7499 of the C++ standard.
7500
7501 @item -Wint-in-bool-context
7502 @opindex Wint-in-bool-context
7503 @opindex Wno-int-in-bool-context
7504 Warn for suspicious use of integer values where boolean values are expected,
7505 such as conditional expressions (?:) using non-boolean integer constants in
7506 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7507 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7508 for all kinds of multiplications regardless of the data type.
7509 This warning is enabled by @option{-Wall}.
7510
7511 @item -Wno-int-to-pointer-cast
7512 @opindex Wno-int-to-pointer-cast
7513 @opindex Wint-to-pointer-cast
7514 Suppress warnings from casts to pointer type of an integer of a
7515 different size. In C++, casting to a pointer type of smaller size is
7516 an error. @option{Wint-to-pointer-cast} is enabled by default.
7517
7518
7519 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7520 @opindex Wno-pointer-to-int-cast
7521 @opindex Wpointer-to-int-cast
7522 Suppress warnings from casts from a pointer to an integer type of a
7523 different size.
7524
7525 @item -Winvalid-pch
7526 @opindex Winvalid-pch
7527 @opindex Wno-invalid-pch
7528 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7529 the search path but cannot be used.
7530
7531 @item -Wlong-long
7532 @opindex Wlong-long
7533 @opindex Wno-long-long
7534 Warn if @code{long long} type is used. This is enabled by either
7535 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7536 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7537
7538 @item -Wvariadic-macros
7539 @opindex Wvariadic-macros
7540 @opindex Wno-variadic-macros
7541 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7542 alternate syntax is used in ISO C99 mode. This is enabled by either
7543 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7544 messages, use @option{-Wno-variadic-macros}.
7545
7546 @item -Wvarargs
7547 @opindex Wvarargs
7548 @opindex Wno-varargs
7549 Warn upon questionable usage of the macros used to handle variable
7550 arguments like @code{va_start}. This is default. To inhibit the
7551 warning messages, use @option{-Wno-varargs}.
7552
7553 @item -Wvector-operation-performance
7554 @opindex Wvector-operation-performance
7555 @opindex Wno-vector-operation-performance
7556 Warn if vector operation is not implemented via SIMD capabilities of the
7557 architecture. Mainly useful for the performance tuning.
7558 Vector operation can be implemented @code{piecewise}, which means that the
7559 scalar operation is performed on every vector element;
7560 @code{in parallel}, which means that the vector operation is implemented
7561 using scalars of wider type, which normally is more performance efficient;
7562 and @code{as a single scalar}, which means that vector fits into a
7563 scalar type.
7564
7565 @item -Wno-virtual-move-assign
7566 @opindex Wvirtual-move-assign
7567 @opindex Wno-virtual-move-assign
7568 Suppress warnings about inheriting from a virtual base with a
7569 non-trivial C++11 move assignment operator. This is dangerous because
7570 if the virtual base is reachable along more than one path, it is
7571 moved multiple times, which can mean both objects end up in the
7572 moved-from state. If the move assignment operator is written to avoid
7573 moving from a moved-from object, this warning can be disabled.
7574
7575 @item -Wvla
7576 @opindex Wvla
7577 @opindex Wno-vla
7578 Warn if a variable-length array is used in the code.
7579 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7580 the variable-length array.
7581
7582 @item -Wvla-larger-than=@var{byte-size}
7583 @opindex Wvla-larger-than=
7584 @opindex Wno-vla-larger-than
7585 If this option is used, the compiler will warn for declarations of
7586 variable-length arrays whose size is either unbounded, or bounded
7587 by an argument that allows the array size to exceed @var{byte-size}
7588 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7589 works, but with variable-length arrays.
7590
7591 Note that GCC may optimize small variable-length arrays of a known
7592 value into plain arrays, so this warning may not get triggered for
7593 such arrays.
7594
7595 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7596 is typically only effective when @option{-ftree-vrp} is active (default
7597 for @option{-O2} and above).
7598
7599 See also @option{-Walloca-larger-than=@var{byte-size}}.
7600
7601 @item -Wno-vla-larger-than
7602 @opindex Wno-vla-larger-than
7603 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7604 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7605
7606 @item -Wvolatile-register-var
7607 @opindex Wvolatile-register-var
7608 @opindex Wno-volatile-register-var
7609 Warn if a register variable is declared volatile. The volatile
7610 modifier does not inhibit all optimizations that may eliminate reads
7611 and/or writes to register variables. This warning is enabled by
7612 @option{-Wall}.
7613
7614 @item -Wdisabled-optimization
7615 @opindex Wdisabled-optimization
7616 @opindex Wno-disabled-optimization
7617 Warn if a requested optimization pass is disabled. This warning does
7618 not generally indicate that there is anything wrong with your code; it
7619 merely indicates that GCC's optimizers are unable to handle the code
7620 effectively. Often, the problem is that your code is too big or too
7621 complex; GCC refuses to optimize programs when the optimization
7622 itself is likely to take inordinate amounts of time.
7623
7624 @item -Wpointer-sign @r{(C and Objective-C only)}
7625 @opindex Wpointer-sign
7626 @opindex Wno-pointer-sign
7627 Warn for pointer argument passing or assignment with different signedness.
7628 This option is only supported for C and Objective-C@. It is implied by
7629 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7630 @option{-Wno-pointer-sign}.
7631
7632 @item -Wstack-protector
7633 @opindex Wstack-protector
7634 @opindex Wno-stack-protector
7635 This option is only active when @option{-fstack-protector} is active. It
7636 warns about functions that are not protected against stack smashing.
7637
7638 @item -Woverlength-strings
7639 @opindex Woverlength-strings
7640 @opindex Wno-overlength-strings
7641 Warn about string constants that are longer than the ``minimum
7642 maximum'' length specified in the C standard. Modern compilers
7643 generally allow string constants that are much longer than the
7644 standard's minimum limit, but very portable programs should avoid
7645 using longer strings.
7646
7647 The limit applies @emph{after} string constant concatenation, and does
7648 not count the trailing NUL@. In C90, the limit was 509 characters; in
7649 C99, it was raised to 4095. C++98 does not specify a normative
7650 minimum maximum, so we do not diagnose overlength strings in C++@.
7651
7652 This option is implied by @option{-Wpedantic}, and can be disabled with
7653 @option{-Wno-overlength-strings}.
7654
7655 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7656 @opindex Wunsuffixed-float-constants
7657 @opindex Wno-unsuffixed-float-constants
7658
7659 Issue a warning for any floating constant that does not have
7660 a suffix. When used together with @option{-Wsystem-headers} it
7661 warns about such constants in system header files. This can be useful
7662 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7663 from the decimal floating-point extension to C99.
7664
7665 @item -Wno-designated-init @r{(C and Objective-C only)}
7666 Suppress warnings when a positional initializer is used to initialize
7667 a structure that has been marked with the @code{designated_init}
7668 attribute.
7669
7670 @item -Whsa
7671 Issue a warning when HSAIL cannot be emitted for the compiled function or
7672 OpenMP construct.
7673
7674 @end table
7675
7676 @node Debugging Options
7677 @section Options for Debugging Your Program
7678 @cindex options, debugging
7679 @cindex debugging information options
7680
7681 To tell GCC to emit extra information for use by a debugger, in almost
7682 all cases you need only to add @option{-g} to your other options.
7683
7684 GCC allows you to use @option{-g} with
7685 @option{-O}. The shortcuts taken by optimized code may occasionally
7686 be surprising: some variables you declared may not exist
7687 at all; flow of control may briefly move where you did not expect it;
7688 some statements may not be executed because they compute constant
7689 results or their values are already at hand; some statements may
7690 execute in different places because they have been moved out of loops.
7691 Nevertheless it is possible to debug optimized output. This makes
7692 it reasonable to use the optimizer for programs that might have bugs.
7693
7694 If you are not using some other optimization option, consider
7695 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7696 With no @option{-O} option at all, some compiler passes that collect
7697 information useful for debugging do not run at all, so that
7698 @option{-Og} may result in a better debugging experience.
7699
7700 @table @gcctabopt
7701 @item -g
7702 @opindex g
7703 Produce debugging information in the operating system's native format
7704 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7705 information.
7706
7707 On most systems that use stabs format, @option{-g} enables use of extra
7708 debugging information that only GDB can use; this extra information
7709 makes debugging work better in GDB but probably makes other debuggers
7710 crash or
7711 refuse to read the program. If you want to control for certain whether
7712 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7713 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7714
7715 @item -ggdb
7716 @opindex ggdb
7717 Produce debugging information for use by GDB@. This means to use the
7718 most expressive format available (DWARF, stabs, or the native format
7719 if neither of those are supported), including GDB extensions if at all
7720 possible.
7721
7722 @item -gdwarf
7723 @itemx -gdwarf-@var{version}
7724 @opindex gdwarf
7725 Produce debugging information in DWARF format (if that is supported).
7726 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7727 for most targets is 4. DWARF Version 5 is only experimental.
7728
7729 Note that with DWARF Version 2, some ports require and always
7730 use some non-conflicting DWARF 3 extensions in the unwind tables.
7731
7732 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7733 for maximum benefit.
7734
7735 GCC no longer supports DWARF Version 1, which is substantially
7736 different than Version 2 and later. For historical reasons, some
7737 other DWARF-related options such as
7738 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7739 in their names, but apply to all currently-supported versions of DWARF.
7740
7741 @item -gstabs
7742 @opindex gstabs
7743 Produce debugging information in stabs format (if that is supported),
7744 without GDB extensions. This is the format used by DBX on most BSD
7745 systems. On MIPS, Alpha and System V Release 4 systems this option
7746 produces stabs debugging output that is not understood by DBX@.
7747 On System V Release 4 systems this option requires the GNU assembler.
7748
7749 @item -gstabs+
7750 @opindex gstabs+
7751 Produce debugging information in stabs format (if that is supported),
7752 using GNU extensions understood only by the GNU debugger (GDB)@. The
7753 use of these extensions is likely to make other debuggers crash or
7754 refuse to read the program.
7755
7756 @item -gxcoff
7757 @opindex gxcoff
7758 Produce debugging information in XCOFF format (if that is supported).
7759 This is the format used by the DBX debugger on IBM RS/6000 systems.
7760
7761 @item -gxcoff+
7762 @opindex gxcoff+
7763 Produce debugging information in XCOFF format (if that is supported),
7764 using GNU extensions understood only by the GNU debugger (GDB)@. The
7765 use of these extensions is likely to make other debuggers crash or
7766 refuse to read the program, and may cause assemblers other than the GNU
7767 assembler (GAS) to fail with an error.
7768
7769 @item -gvms
7770 @opindex gvms
7771 Produce debugging information in Alpha/VMS debug format (if that is
7772 supported). This is the format used by DEBUG on Alpha/VMS systems.
7773
7774 @item -g@var{level}
7775 @itemx -ggdb@var{level}
7776 @itemx -gstabs@var{level}
7777 @itemx -gxcoff@var{level}
7778 @itemx -gvms@var{level}
7779 Request debugging information and also use @var{level} to specify how
7780 much information. The default level is 2.
7781
7782 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7783 @option{-g}.
7784
7785 Level 1 produces minimal information, enough for making backtraces in
7786 parts of the program that you don't plan to debug. This includes
7787 descriptions of functions and external variables, and line number
7788 tables, but no information about local variables.
7789
7790 Level 3 includes extra information, such as all the macro definitions
7791 present in the program. Some debuggers support macro expansion when
7792 you use @option{-g3}.
7793
7794 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7795 confusion with @option{-gdwarf-@var{level}}.
7796 Instead use an additional @option{-g@var{level}} option to change the
7797 debug level for DWARF.
7798
7799 @item -feliminate-unused-debug-symbols
7800 @opindex feliminate-unused-debug-symbols
7801 Produce debugging information in stabs format (if that is supported),
7802 for only symbols that are actually used.
7803
7804 @item -femit-class-debug-always
7805 @opindex femit-class-debug-always
7806 Instead of emitting debugging information for a C++ class in only one
7807 object file, emit it in all object files using the class. This option
7808 should be used only with debuggers that are unable to handle the way GCC
7809 normally emits debugging information for classes because using this
7810 option increases the size of debugging information by as much as a
7811 factor of two.
7812
7813 @item -fno-merge-debug-strings
7814 @opindex fmerge-debug-strings
7815 @opindex fno-merge-debug-strings
7816 Direct the linker to not merge together strings in the debugging
7817 information that are identical in different object files. Merging is
7818 not supported by all assemblers or linkers. Merging decreases the size
7819 of the debug information in the output file at the cost of increasing
7820 link processing time. Merging is enabled by default.
7821
7822 @item -fdebug-prefix-map=@var{old}=@var{new}
7823 @opindex fdebug-prefix-map
7824 When compiling files residing in directory @file{@var{old}}, record
7825 debugging information describing them as if the files resided in
7826 directory @file{@var{new}} instead. This can be used to replace a
7827 build-time path with an install-time path in the debug info. It can
7828 also be used to change an absolute path to a relative path by using
7829 @file{.} for @var{new}. This can give more reproducible builds, which
7830 are location independent, but may require an extra command to tell GDB
7831 where to find the source files. See also @option{-ffile-prefix-map}.
7832
7833 @item -fvar-tracking
7834 @opindex fvar-tracking
7835 Run variable tracking pass. It computes where variables are stored at each
7836 position in code. Better debugging information is then generated
7837 (if the debugging information format supports this information).
7838
7839 It is enabled by default when compiling with optimization (@option{-Os},
7840 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7841 the debug info format supports it.
7842
7843 @item -fvar-tracking-assignments
7844 @opindex fvar-tracking-assignments
7845 @opindex fno-var-tracking-assignments
7846 Annotate assignments to user variables early in the compilation and
7847 attempt to carry the annotations over throughout the compilation all the
7848 way to the end, in an attempt to improve debug information while
7849 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7850
7851 It can be enabled even if var-tracking is disabled, in which case
7852 annotations are created and maintained, but discarded at the end.
7853 By default, this flag is enabled together with @option{-fvar-tracking},
7854 except when selective scheduling is enabled.
7855
7856 @item -gsplit-dwarf
7857 @opindex gsplit-dwarf
7858 Separate as much DWARF debugging information as possible into a
7859 separate output file with the extension @file{.dwo}. This option allows
7860 the build system to avoid linking files with debug information. To
7861 be useful, this option requires a debugger capable of reading @file{.dwo}
7862 files.
7863
7864 @item -gdescribe-dies
7865 @opindex gdescribe-dies
7866 Add description attributes to some DWARF DIEs that have no name attribute,
7867 such as artificial variables, external references and call site
7868 parameter DIEs.
7869
7870 @item -gpubnames
7871 @opindex gpubnames
7872 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7873
7874 @item -ggnu-pubnames
7875 @opindex ggnu-pubnames
7876 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7877 suitable for conversion into a GDB@ index. This option is only useful
7878 with a linker that can produce GDB@ index version 7.
7879
7880 @item -fdebug-types-section
7881 @opindex fdebug-types-section
7882 @opindex fno-debug-types-section
7883 When using DWARF Version 4 or higher, type DIEs can be put into
7884 their own @code{.debug_types} section instead of making them part of the
7885 @code{.debug_info} section. It is more efficient to put them in a separate
7886 comdat section since the linker can then remove duplicates.
7887 But not all DWARF consumers support @code{.debug_types} sections yet
7888 and on some objects @code{.debug_types} produces larger instead of smaller
7889 debugging information.
7890
7891 @item -grecord-gcc-switches
7892 @itemx -gno-record-gcc-switches
7893 @opindex grecord-gcc-switches
7894 @opindex gno-record-gcc-switches
7895 This switch causes the command-line options used to invoke the
7896 compiler that may affect code generation to be appended to the
7897 DW_AT_producer attribute in DWARF debugging information. The options
7898 are concatenated with spaces separating them from each other and from
7899 the compiler version.
7900 It is enabled by default.
7901 See also @option{-frecord-gcc-switches} for another
7902 way of storing compiler options into the object file.
7903
7904 @item -gstrict-dwarf
7905 @opindex gstrict-dwarf
7906 Disallow using extensions of later DWARF standard version than selected
7907 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7908 DWARF extensions from later standard versions is allowed.
7909
7910 @item -gno-strict-dwarf
7911 @opindex gno-strict-dwarf
7912 Allow using extensions of later DWARF standard version than selected with
7913 @option{-gdwarf-@var{version}}.
7914
7915 @item -gas-loc-support
7916 @opindex gas-loc-support
7917 Inform the compiler that the assembler supports @code{.loc} directives.
7918 It may then use them for the assembler to generate DWARF2+ line number
7919 tables.
7920
7921 This is generally desirable, because assembler-generated line-number
7922 tables are a lot more compact than those the compiler can generate
7923 itself.
7924
7925 This option will be enabled by default if, at GCC configure time, the
7926 assembler was found to support such directives.
7927
7928 @item -gno-as-loc-support
7929 @opindex gno-as-loc-support
7930 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7931 line number tables are to be generated.
7932
7933 @item gas-locview-support
7934 @opindex gas-locview-support
7935 Inform the compiler that the assembler supports @code{view} assignment
7936 and reset assertion checking in @code{.loc} directives.
7937
7938 This option will be enabled by default if, at GCC configure time, the
7939 assembler was found to support them.
7940
7941 @item gno-as-locview-support
7942 Force GCC to assign view numbers internally, if
7943 @option{-gvariable-location-views} are explicitly requested.
7944
7945 @item -gcolumn-info
7946 @itemx -gno-column-info
7947 @opindex gcolumn-info
7948 @opindex gno-column-info
7949 Emit location column information into DWARF debugging information, rather
7950 than just file and line.
7951 This option is enabled by default.
7952
7953 @item -gstatement-frontiers
7954 @itemx -gno-statement-frontiers
7955 @opindex gstatement-frontiers
7956 @opindex gno-statement-frontiers
7957 This option causes GCC to create markers in the internal representation
7958 at the beginning of statements, and to keep them roughly in place
7959 throughout compilation, using them to guide the output of @code{is_stmt}
7960 markers in the line number table. This is enabled by default when
7961 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7962 @dots{}), and outputting DWARF 2 debug information at the normal level.
7963
7964 @item -gvariable-location-views
7965 @itemx -gvariable-location-views=incompat5
7966 @itemx -gno-variable-location-views
7967 @opindex gvariable-location-views
7968 @opindex gvariable-location-views=incompat5
7969 @opindex gno-variable-location-views
7970 Augment variable location lists with progressive view numbers implied
7971 from the line number table. This enables debug information consumers to
7972 inspect state at certain points of the program, even if no instructions
7973 associated with the corresponding source locations are present at that
7974 point. If the assembler lacks support for view numbers in line number
7975 tables, this will cause the compiler to emit the line number table,
7976 which generally makes them somewhat less compact. The augmented line
7977 number tables and location lists are fully backward-compatible, so they
7978 can be consumed by debug information consumers that are not aware of
7979 these augmentations, but they won't derive any benefit from them either.
7980
7981 This is enabled by default when outputting DWARF 2 debug information at
7982 the normal level, as long as there is assembler support,
7983 @option{-fvar-tracking-assignments} is enabled and
7984 @option{-gstrict-dwarf} is not. When assembler support is not
7985 available, this may still be enabled, but it will force GCC to output
7986 internal line number tables, and if
7987 @option{-ginternal-reset-location-views} is not enabled, that will most
7988 certainly lead to silently mismatching location views.
7989
7990 There is a proposed representation for view numbers that is not backward
7991 compatible with the location list format introduced in DWARF 5, that can
7992 be enabled with @option{-gvariable-location-views=incompat5}. This
7993 option may be removed in the future, is only provided as a reference
7994 implementation of the proposed representation. Debug information
7995 consumers are not expected to support this extended format, and they
7996 would be rendered unable to decode location lists using it.
7997
7998 @item -ginternal-reset-location-views
7999 @itemx -gnointernal-reset-location-views
8000 @opindex ginternal-reset-location-views
8001 @opindex gno-internal-reset-location-views
8002 Attempt to determine location views that can be omitted from location
8003 view lists. This requires the compiler to have very accurate insn
8004 length estimates, which isn't always the case, and it may cause
8005 incorrect view lists to be generated silently when using an assembler
8006 that does not support location view lists. The GNU assembler will flag
8007 any such error as a @code{view number mismatch}. This is only enabled
8008 on ports that define a reliable estimation function.
8009
8010 @item -ginline-points
8011 @itemx -gno-inline-points
8012 @opindex ginline-points
8013 @opindex gno-inline-points
8014 Generate extended debug information for inlined functions. Location
8015 view tracking markers are inserted at inlined entry points, so that
8016 address and view numbers can be computed and output in debug
8017 information. This can be enabled independently of location views, in
8018 which case the view numbers won't be output, but it can only be enabled
8019 along with statement frontiers, and it is only enabled by default if
8020 location views are enabled.
8021
8022 @item -gz@r{[}=@var{type}@r{]}
8023 @opindex gz
8024 Produce compressed debug sections in DWARF format, if that is supported.
8025 If @var{type} is not given, the default type depends on the capabilities
8026 of the assembler and linker used. @var{type} may be one of
8027 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8028 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8029 compression in traditional GNU format). If the linker doesn't support
8030 writing compressed debug sections, the option is rejected. Otherwise,
8031 if the assembler does not support them, @option{-gz} is silently ignored
8032 when producing object files.
8033
8034 @item -femit-struct-debug-baseonly
8035 @opindex femit-struct-debug-baseonly
8036 Emit debug information for struct-like types
8037 only when the base name of the compilation source file
8038 matches the base name of file in which the struct is defined.
8039
8040 This option substantially reduces the size of debugging information,
8041 but at significant potential loss in type information to the debugger.
8042 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8043 See @option{-femit-struct-debug-detailed} for more detailed control.
8044
8045 This option works only with DWARF debug output.
8046
8047 @item -femit-struct-debug-reduced
8048 @opindex femit-struct-debug-reduced
8049 Emit debug information for struct-like types
8050 only when the base name of the compilation source file
8051 matches the base name of file in which the type is defined,
8052 unless the struct is a template or defined in a system header.
8053
8054 This option significantly reduces the size of debugging information,
8055 with some potential loss in type information to the debugger.
8056 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8057 See @option{-femit-struct-debug-detailed} for more detailed control.
8058
8059 This option works only with DWARF debug output.
8060
8061 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8062 @opindex femit-struct-debug-detailed
8063 Specify the struct-like types
8064 for which the compiler generates debug information.
8065 The intent is to reduce duplicate struct debug information
8066 between different object files within the same program.
8067
8068 This option is a detailed version of
8069 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8070 which serves for most needs.
8071
8072 A specification has the syntax@*
8073 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8074
8075 The optional first word limits the specification to
8076 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8077 A struct type is used directly when it is the type of a variable, member.
8078 Indirect uses arise through pointers to structs.
8079 That is, when use of an incomplete struct is valid, the use is indirect.
8080 An example is
8081 @samp{struct one direct; struct two * indirect;}.
8082
8083 The optional second word limits the specification to
8084 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8085 Generic structs are a bit complicated to explain.
8086 For C++, these are non-explicit specializations of template classes,
8087 or non-template classes within the above.
8088 Other programming languages have generics,
8089 but @option{-femit-struct-debug-detailed} does not yet implement them.
8090
8091 The third word specifies the source files for those
8092 structs for which the compiler should emit debug information.
8093 The values @samp{none} and @samp{any} have the normal meaning.
8094 The value @samp{base} means that
8095 the base of name of the file in which the type declaration appears
8096 must match the base of the name of the main compilation file.
8097 In practice, this means that when compiling @file{foo.c}, debug information
8098 is generated for types declared in that file and @file{foo.h},
8099 but not other header files.
8100 The value @samp{sys} means those types satisfying @samp{base}
8101 or declared in system or compiler headers.
8102
8103 You may need to experiment to determine the best settings for your application.
8104
8105 The default is @option{-femit-struct-debug-detailed=all}.
8106
8107 This option works only with DWARF debug output.
8108
8109 @item -fno-dwarf2-cfi-asm
8110 @opindex fdwarf2-cfi-asm
8111 @opindex fno-dwarf2-cfi-asm
8112 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8113 instead of using GAS @code{.cfi_*} directives.
8114
8115 @item -fno-eliminate-unused-debug-types
8116 @opindex feliminate-unused-debug-types
8117 @opindex fno-eliminate-unused-debug-types
8118 Normally, when producing DWARF output, GCC avoids producing debug symbol
8119 output for types that are nowhere used in the source file being compiled.
8120 Sometimes it is useful to have GCC emit debugging
8121 information for all types declared in a compilation
8122 unit, regardless of whether or not they are actually used
8123 in that compilation unit, for example
8124 if, in the debugger, you want to cast a value to a type that is
8125 not actually used in your program (but is declared). More often,
8126 however, this results in a significant amount of wasted space.
8127 @end table
8128
8129 @node Optimize Options
8130 @section Options That Control Optimization
8131 @cindex optimize options
8132 @cindex options, optimization
8133
8134 These options control various sorts of optimizations.
8135
8136 Without any optimization option, the compiler's goal is to reduce the
8137 cost of compilation and to make debugging produce the expected
8138 results. Statements are independent: if you stop the program with a
8139 breakpoint between statements, you can then assign a new value to any
8140 variable or change the program counter to any other statement in the
8141 function and get exactly the results you expect from the source
8142 code.
8143
8144 Turning on optimization flags makes the compiler attempt to improve
8145 the performance and/or code size at the expense of compilation time
8146 and possibly the ability to debug the program.
8147
8148 The compiler performs optimization based on the knowledge it has of the
8149 program. Compiling multiple files at once to a single output file mode allows
8150 the compiler to use information gained from all of the files when compiling
8151 each of them.
8152
8153 Not all optimizations are controlled directly by a flag. Only
8154 optimizations that have a flag are listed in this section.
8155
8156 Most optimizations are completely disabled at @option{-O0} or if an
8157 @option{-O} level is not set on the command line, even if individual
8158 optimization flags are specified. Similarly, @option{-Og} suppresses
8159 many optimization passes.
8160
8161 Depending on the target and how GCC was configured, a slightly different
8162 set of optimizations may be enabled at each @option{-O} level than
8163 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8164 to find out the exact set of optimizations that are enabled at each level.
8165 @xref{Overall Options}, for examples.
8166
8167 @table @gcctabopt
8168 @item -O
8169 @itemx -O1
8170 @opindex O
8171 @opindex O1
8172 Optimize. Optimizing compilation takes somewhat more time, and a lot
8173 more memory for a large function.
8174
8175 With @option{-O}, the compiler tries to reduce code size and execution
8176 time, without performing any optimizations that take a great deal of
8177 compilation time.
8178
8179 @c Note that in addition to the default_options_table list in opts.c,
8180 @c several optimization flags default to true but control optimization
8181 @c passes that are explicitly disabled at -O0.
8182
8183 @option{-O} turns on the following optimization flags:
8184
8185 @c Please keep the following list alphabetized.
8186 @gccoptlist{-fauto-inc-dec @gol
8187 -fbranch-count-reg @gol
8188 -fcombine-stack-adjustments @gol
8189 -fcompare-elim @gol
8190 -fcprop-registers @gol
8191 -fdce @gol
8192 -fdefer-pop @gol
8193 -fdelayed-branch @gol
8194 -fdse @gol
8195 -fforward-propagate @gol
8196 -fguess-branch-probability @gol
8197 -fif-conversion @gol
8198 -fif-conversion2 @gol
8199 -finline-functions-called-once @gol
8200 -fipa-profile @gol
8201 -fipa-pure-const @gol
8202 -fipa-reference @gol
8203 -fipa-reference-addressable @gol
8204 -fmerge-constants @gol
8205 -fmove-loop-invariants @gol
8206 -fomit-frame-pointer @gol
8207 -freorder-blocks @gol
8208 -fshrink-wrap @gol
8209 -fshrink-wrap-separate @gol
8210 -fsplit-wide-types @gol
8211 -fssa-backprop @gol
8212 -fssa-phiopt @gol
8213 -ftree-bit-ccp @gol
8214 -ftree-ccp @gol
8215 -ftree-ch @gol
8216 -ftree-coalesce-vars @gol
8217 -ftree-copy-prop @gol
8218 -ftree-dce @gol
8219 -ftree-dominator-opts @gol
8220 -ftree-dse @gol
8221 -ftree-forwprop @gol
8222 -ftree-fre @gol
8223 -ftree-phiprop @gol
8224 -ftree-pta @gol
8225 -ftree-scev-cprop @gol
8226 -ftree-sink @gol
8227 -ftree-slsr @gol
8228 -ftree-sra @gol
8229 -ftree-ter @gol
8230 -funit-at-a-time}
8231
8232 @item -O2
8233 @opindex O2
8234 Optimize even more. GCC performs nearly all supported optimizations
8235 that do not involve a space-speed tradeoff.
8236 As compared to @option{-O}, this option increases both compilation time
8237 and the performance of the generated code.
8238
8239 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8240 also turns on the following optimization flags:
8241
8242 @c Please keep the following list alphabetized!
8243 @gccoptlist{-falign-functions -falign-jumps @gol
8244 -falign-labels -falign-loops @gol
8245 -fcaller-saves @gol
8246 -fcode-hoisting @gol
8247 -fcrossjumping @gol
8248 -fcse-follow-jumps -fcse-skip-blocks @gol
8249 -fdelete-null-pointer-checks @gol
8250 -fdevirtualize -fdevirtualize-speculatively @gol
8251 -fexpensive-optimizations @gol
8252 -fgcse -fgcse-lm @gol
8253 -fhoist-adjacent-loads @gol
8254 -finline-small-functions @gol
8255 -findirect-inlining @gol
8256 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8257 -fipa-ra -fipa-sra -fipa-vrp @gol
8258 -fisolate-erroneous-paths-dereference @gol
8259 -flra-remat @gol
8260 -foptimize-sibling-calls @gol
8261 -foptimize-strlen @gol
8262 -fpartial-inlining @gol
8263 -fpeephole2 @gol
8264 -freorder-blocks-algorithm=stc @gol
8265 -freorder-blocks-and-partition -freorder-functions @gol
8266 -frerun-cse-after-loop @gol
8267 -fschedule-insns -fschedule-insns2 @gol
8268 -fsched-interblock -fsched-spec @gol
8269 -fstore-merging @gol
8270 -fstrict-aliasing @gol
8271 -fthread-jumps @gol
8272 -ftree-builtin-call-dce @gol
8273 -ftree-pre @gol
8274 -ftree-switch-conversion -ftree-tail-merge @gol
8275 -ftree-vrp}
8276
8277 Please note the warning under @option{-fgcse} about
8278 invoking @option{-O2} on programs that use computed gotos.
8279
8280 @item -O3
8281 @opindex O3
8282 Optimize yet more. @option{-O3} turns on all optimizations specified
8283 by @option{-O2} and also turns on the following optimization flags:
8284
8285 @c Please keep the following list alphabetized!
8286 @gccoptlist{-fgcse-after-reload @gol
8287 -finline-functions @gol
8288 -fipa-cp-clone
8289 -floop-interchange @gol
8290 -floop-unroll-and-jam @gol
8291 -fpeel-loops @gol
8292 -fpredictive-commoning @gol
8293 -fsplit-paths @gol
8294 -ftree-loop-distribute-patterns @gol
8295 -ftree-loop-distribution @gol
8296 -ftree-loop-vectorize @gol
8297 -ftree-partial-pre @gol
8298 -ftree-slp-vectorize @gol
8299 -funswitch-loops @gol
8300 -fvect-cost-model @gol
8301 -fversion-loops-for-strides}
8302
8303 @item -O0
8304 @opindex O0
8305 Reduce compilation time and make debugging produce the expected
8306 results. This is the default.
8307
8308 @item -Os
8309 @opindex Os
8310 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8311 except those that often increase code size:
8312
8313 @gccoptlist{-falign-functions -falign-jumps @gol
8314 -falign-labels -falign-loops @gol
8315 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8316
8317 It also enables @option{-finline-functions}, causes the compiler to tune for
8318 code size rather than execution speed, and performs further optimizations
8319 designed to reduce code size.
8320
8321 @item -Ofast
8322 @opindex Ofast
8323 Disregard strict standards compliance. @option{-Ofast} enables all
8324 @option{-O3} optimizations. It also enables optimizations that are not
8325 valid for all standard-compliant programs.
8326 It turns on @option{-ffast-math} and the Fortran-specific
8327 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8328 specified, and @option{-fno-protect-parens}.
8329
8330 @item -Og
8331 @opindex Og
8332 Optimize debugging experience. @option{-Og} should be the optimization
8333 level of choice for the standard edit-compile-debug cycle, offering
8334 a reasonable level of optimization while maintaining fast compilation
8335 and a good debugging experience. It is a better choice than @option{-O0}
8336 for producing debuggable code because some compiler passes
8337 that collect debug information are disabled at @option{-O0}.
8338
8339 Like @option{-O0}, @option{-Og} completely disables a number of
8340 optimization passes so that individual options controlling them have
8341 no effect. Otherwise @option{-Og} enables all @option{-O1}
8342 optimization flags except for those that may interfere with debugging:
8343
8344 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8345 -fif-conversion -fif-conversion2 @gol
8346 -finline-functions-called-once @gol
8347 -fmove-loop-invariants -fssa-phiopt @gol
8348 -ftree-bit-ccp -ftree-pta -ftree-sra}
8349
8350 @end table
8351
8352 If you use multiple @option{-O} options, with or without level numbers,
8353 the last such option is the one that is effective.
8354
8355 Options of the form @option{-f@var{flag}} specify machine-independent
8356 flags. Most flags have both positive and negative forms; the negative
8357 form of @option{-ffoo} is @option{-fno-foo}. In the table
8358 below, only one of the forms is listed---the one you typically
8359 use. You can figure out the other form by either removing @samp{no-}
8360 or adding it.
8361
8362 The following options control specific optimizations. They are either
8363 activated by @option{-O} options or are related to ones that are. You
8364 can use the following flags in the rare cases when ``fine-tuning'' of
8365 optimizations to be performed is desired.
8366
8367 @table @gcctabopt
8368 @item -fno-defer-pop
8369 @opindex fno-defer-pop
8370 @opindex fdefer-pop
8371 For machines that must pop arguments after a function call, always pop
8372 the arguments as soon as each function returns.
8373 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8374 this allows the compiler to let arguments accumulate on the stack for several
8375 function calls and pop them all at once.
8376
8377 @item -fforward-propagate
8378 @opindex fforward-propagate
8379 Perform a forward propagation pass on RTL@. The pass tries to combine two
8380 instructions and checks if the result can be simplified. If loop unrolling
8381 is active, two passes are performed and the second is scheduled after
8382 loop unrolling.
8383
8384 This option is enabled by default at optimization levels @option{-O},
8385 @option{-O2}, @option{-O3}, @option{-Os}.
8386
8387 @item -ffp-contract=@var{style}
8388 @opindex ffp-contract
8389 @option{-ffp-contract=off} disables floating-point expression contraction.
8390 @option{-ffp-contract=fast} enables floating-point expression contraction
8391 such as forming of fused multiply-add operations if the target has
8392 native support for them.
8393 @option{-ffp-contract=on} enables floating-point expression contraction
8394 if allowed by the language standard. This is currently not implemented
8395 and treated equal to @option{-ffp-contract=off}.
8396
8397 The default is @option{-ffp-contract=fast}.
8398
8399 @item -fomit-frame-pointer
8400 @opindex fomit-frame-pointer
8401 Omit the frame pointer in functions that don't need one. This avoids the
8402 instructions to save, set up and restore the frame pointer; on many targets
8403 it also makes an extra register available.
8404
8405 On some targets this flag has no effect because the standard calling sequence
8406 always uses a frame pointer, so it cannot be omitted.
8407
8408 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8409 is used in all functions. Several targets always omit the frame pointer in
8410 leaf functions.
8411
8412 Enabled by default at @option{-O} and higher.
8413
8414 @item -foptimize-sibling-calls
8415 @opindex foptimize-sibling-calls
8416 Optimize sibling and tail recursive calls.
8417
8418 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8419
8420 @item -foptimize-strlen
8421 @opindex foptimize-strlen
8422 Optimize various standard C string functions (e.g.@: @code{strlen},
8423 @code{strchr} or @code{strcpy}) and
8424 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8425
8426 Enabled at levels @option{-O2}, @option{-O3}.
8427
8428 @item -fno-inline
8429 @opindex fno-inline
8430 @opindex finline
8431 Do not expand any functions inline apart from those marked with
8432 the @code{always_inline} attribute. This is the default when not
8433 optimizing.
8434
8435 Single functions can be exempted from inlining by marking them
8436 with the @code{noinline} attribute.
8437
8438 @item -finline-small-functions
8439 @opindex finline-small-functions
8440 Integrate functions into their callers when their body is smaller than expected
8441 function call code (so overall size of program gets smaller). The compiler
8442 heuristically decides which functions are simple enough to be worth integrating
8443 in this way. This inlining applies to all functions, even those not declared
8444 inline.
8445
8446 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8447
8448 @item -findirect-inlining
8449 @opindex findirect-inlining
8450 Inline also indirect calls that are discovered to be known at compile
8451 time thanks to previous inlining. This option has any effect only
8452 when inlining itself is turned on by the @option{-finline-functions}
8453 or @option{-finline-small-functions} options.
8454
8455 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8456
8457 @item -finline-functions
8458 @opindex finline-functions
8459 Consider all functions for inlining, even if they are not declared inline.
8460 The compiler heuristically decides which functions are worth integrating
8461 in this way.
8462
8463 If all calls to a given function are integrated, and the function is
8464 declared @code{static}, then the function is normally not output as
8465 assembler code in its own right.
8466
8467 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8468 by @option{-fprofile-use} and @option{-fauto-profile}.
8469
8470 @item -finline-functions-called-once
8471 @opindex finline-functions-called-once
8472 Consider all @code{static} functions called once for inlining into their
8473 caller even if they are not marked @code{inline}. If a call to a given
8474 function is integrated, then the function is not output as assembler code
8475 in its own right.
8476
8477 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8478 but not @option{-Og}.
8479
8480 @item -fearly-inlining
8481 @opindex fearly-inlining
8482 Inline functions marked by @code{always_inline} and functions whose body seems
8483 smaller than the function call overhead early before doing
8484 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8485 makes profiling significantly cheaper and usually inlining faster on programs
8486 having large chains of nested wrapper functions.
8487
8488 Enabled by default.
8489
8490 @item -fipa-sra
8491 @opindex fipa-sra
8492 Perform interprocedural scalar replacement of aggregates, removal of
8493 unused parameters and replacement of parameters passed by reference
8494 by parameters passed by value.
8495
8496 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8497
8498 @item -finline-limit=@var{n}
8499 @opindex finline-limit
8500 By default, GCC limits the size of functions that can be inlined. This flag
8501 allows coarse control of this limit. @var{n} is the size of functions that
8502 can be inlined in number of pseudo instructions.
8503
8504 Inlining is actually controlled by a number of parameters, which may be
8505 specified individually by using @option{--param @var{name}=@var{value}}.
8506 The @option{-finline-limit=@var{n}} option sets some of these parameters
8507 as follows:
8508
8509 @table @gcctabopt
8510 @item max-inline-insns-single
8511 is set to @var{n}/2.
8512 @item max-inline-insns-auto
8513 is set to @var{n}/2.
8514 @end table
8515
8516 See below for a documentation of the individual
8517 parameters controlling inlining and for the defaults of these parameters.
8518
8519 @emph{Note:} there may be no value to @option{-finline-limit} that results
8520 in default behavior.
8521
8522 @emph{Note:} pseudo instruction represents, in this particular context, an
8523 abstract measurement of function's size. In no way does it represent a count
8524 of assembly instructions and as such its exact meaning might change from one
8525 release to an another.
8526
8527 @item -fno-keep-inline-dllexport
8528 @opindex fno-keep-inline-dllexport
8529 @opindex fkeep-inline-dllexport
8530 This is a more fine-grained version of @option{-fkeep-inline-functions},
8531 which applies only to functions that are declared using the @code{dllexport}
8532 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8533 Functions}.
8534
8535 @item -fkeep-inline-functions
8536 @opindex fkeep-inline-functions
8537 In C, emit @code{static} functions that are declared @code{inline}
8538 into the object file, even if the function has been inlined into all
8539 of its callers. This switch does not affect functions using the
8540 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8541 inline functions into the object file.
8542
8543 @item -fkeep-static-functions
8544 @opindex fkeep-static-functions
8545 Emit @code{static} functions into the object file, even if the function
8546 is never used.
8547
8548 @item -fkeep-static-consts
8549 @opindex fkeep-static-consts
8550 Emit variables declared @code{static const} when optimization isn't turned
8551 on, even if the variables aren't referenced.
8552
8553 GCC enables this option by default. If you want to force the compiler to
8554 check if a variable is referenced, regardless of whether or not
8555 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8556
8557 @item -fmerge-constants
8558 @opindex fmerge-constants
8559 Attempt to merge identical constants (string constants and floating-point
8560 constants) across compilation units.
8561
8562 This option is the default for optimized compilation if the assembler and
8563 linker support it. Use @option{-fno-merge-constants} to inhibit this
8564 behavior.
8565
8566 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8567
8568 @item -fmerge-all-constants
8569 @opindex fmerge-all-constants
8570 Attempt to merge identical constants and identical variables.
8571
8572 This option implies @option{-fmerge-constants}. In addition to
8573 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8574 arrays or initialized constant variables with integral or floating-point
8575 types. Languages like C or C++ require each variable, including multiple
8576 instances of the same variable in recursive calls, to have distinct locations,
8577 so using this option results in non-conforming
8578 behavior.
8579
8580 @item -fmodulo-sched
8581 @opindex fmodulo-sched
8582 Perform swing modulo scheduling immediately before the first scheduling
8583 pass. This pass looks at innermost loops and reorders their
8584 instructions by overlapping different iterations.
8585
8586 @item -fmodulo-sched-allow-regmoves
8587 @opindex fmodulo-sched-allow-regmoves
8588 Perform more aggressive SMS-based modulo scheduling with register moves
8589 allowed. By setting this flag certain anti-dependences edges are
8590 deleted, which triggers the generation of reg-moves based on the
8591 life-range analysis. This option is effective only with
8592 @option{-fmodulo-sched} enabled.
8593
8594 @item -fno-branch-count-reg
8595 @opindex fno-branch-count-reg
8596 @opindex fbranch-count-reg
8597 Disable the optimization pass that scans for opportunities to use
8598 ``decrement and branch'' instructions on a count register instead of
8599 instruction sequences that decrement a register, compare it against zero, and
8600 then branch based upon the result. This option is only meaningful on
8601 architectures that support such instructions, which include x86, PowerPC,
8602 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8603 doesn't remove the decrement and branch instructions from the generated
8604 instruction stream introduced by other optimization passes.
8605
8606 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8607 except for @option{-Og}.
8608
8609 @item -fno-function-cse
8610 @opindex fno-function-cse
8611 @opindex ffunction-cse
8612 Do not put function addresses in registers; make each instruction that
8613 calls a constant function contain the function's address explicitly.
8614
8615 This option results in less efficient code, but some strange hacks
8616 that alter the assembler output may be confused by the optimizations
8617 performed when this option is not used.
8618
8619 The default is @option{-ffunction-cse}
8620
8621 @item -fno-zero-initialized-in-bss
8622 @opindex fno-zero-initialized-in-bss
8623 @opindex fzero-initialized-in-bss
8624 If the target supports a BSS section, GCC by default puts variables that
8625 are initialized to zero into BSS@. This can save space in the resulting
8626 code.
8627
8628 This option turns off this behavior because some programs explicitly
8629 rely on variables going to the data section---e.g., so that the
8630 resulting executable can find the beginning of that section and/or make
8631 assumptions based on that.
8632
8633 The default is @option{-fzero-initialized-in-bss}.
8634
8635 @item -fthread-jumps
8636 @opindex fthread-jumps
8637 Perform optimizations that check to see if a jump branches to a
8638 location where another comparison subsumed by the first is found. If
8639 so, the first branch is redirected to either the destination of the
8640 second branch or a point immediately following it, depending on whether
8641 the condition is known to be true or false.
8642
8643 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8644
8645 @item -fsplit-wide-types
8646 @opindex fsplit-wide-types
8647 When using a type that occupies multiple registers, such as @code{long
8648 long} on a 32-bit system, split the registers apart and allocate them
8649 independently. This normally generates better code for those types,
8650 but may make debugging more difficult.
8651
8652 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8653 @option{-Os}.
8654
8655 @item -fcse-follow-jumps
8656 @opindex fcse-follow-jumps
8657 In common subexpression elimination (CSE), scan through jump instructions
8658 when the target of the jump is not reached by any other path. For
8659 example, when CSE encounters an @code{if} statement with an
8660 @code{else} clause, CSE follows the jump when the condition
8661 tested is false.
8662
8663 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8664
8665 @item -fcse-skip-blocks
8666 @opindex fcse-skip-blocks
8667 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8668 follow jumps that conditionally skip over blocks. When CSE
8669 encounters a simple @code{if} statement with no else clause,
8670 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8671 body of the @code{if}.
8672
8673 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8674
8675 @item -frerun-cse-after-loop
8676 @opindex frerun-cse-after-loop
8677 Re-run common subexpression elimination after loop optimizations are
8678 performed.
8679
8680 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8681
8682 @item -fgcse
8683 @opindex fgcse
8684 Perform a global common subexpression elimination pass.
8685 This pass also performs global constant and copy propagation.
8686
8687 @emph{Note:} When compiling a program using computed gotos, a GCC
8688 extension, you may get better run-time performance if you disable
8689 the global common subexpression elimination pass by adding
8690 @option{-fno-gcse} to the command line.
8691
8692 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8693
8694 @item -fgcse-lm
8695 @opindex fgcse-lm
8696 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8697 attempts to move loads that are only killed by stores into themselves. This
8698 allows a loop containing a load/store sequence to be changed to a load outside
8699 the loop, and a copy/store within the loop.
8700
8701 Enabled by default when @option{-fgcse} is enabled.
8702
8703 @item -fgcse-sm
8704 @opindex fgcse-sm
8705 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8706 global common subexpression elimination. This pass attempts to move
8707 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8708 loops containing a load/store sequence can be changed to a load before
8709 the loop and a store after the loop.
8710
8711 Not enabled at any optimization level.
8712
8713 @item -fgcse-las
8714 @opindex fgcse-las
8715 When @option{-fgcse-las} is enabled, the global common subexpression
8716 elimination pass eliminates redundant loads that come after stores to the
8717 same memory location (both partial and full redundancies).
8718
8719 Not enabled at any optimization level.
8720
8721 @item -fgcse-after-reload
8722 @opindex fgcse-after-reload
8723 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8724 pass is performed after reload. The purpose of this pass is to clean up
8725 redundant spilling.
8726
8727 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8728
8729 @item -faggressive-loop-optimizations
8730 @opindex faggressive-loop-optimizations
8731 This option tells the loop optimizer to use language constraints to
8732 derive bounds for the number of iterations of a loop. This assumes that
8733 loop code does not invoke undefined behavior by for example causing signed
8734 integer overflows or out-of-bound array accesses. The bounds for the
8735 number of iterations of a loop are used to guide loop unrolling and peeling
8736 and loop exit test optimizations.
8737 This option is enabled by default.
8738
8739 @item -funconstrained-commons
8740 @opindex funconstrained-commons
8741 This option tells the compiler that variables declared in common blocks
8742 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8743 prevents certain optimizations that depend on knowing the array bounds.
8744
8745 @item -fcrossjumping
8746 @opindex fcrossjumping
8747 Perform cross-jumping transformation.
8748 This transformation unifies equivalent code and saves code size. The
8749 resulting code may or may not perform better than without cross-jumping.
8750
8751 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8752
8753 @item -fauto-inc-dec
8754 @opindex fauto-inc-dec
8755 Combine increments or decrements of addresses with memory accesses.
8756 This pass is always skipped on architectures that do not have
8757 instructions to support this. Enabled by default at @option{-O} and
8758 higher on architectures that support this.
8759
8760 @item -fdce
8761 @opindex fdce
8762 Perform dead code elimination (DCE) on RTL@.
8763 Enabled by default at @option{-O} and higher.
8764
8765 @item -fdse
8766 @opindex fdse
8767 Perform dead store elimination (DSE) on RTL@.
8768 Enabled by default at @option{-O} and higher.
8769
8770 @item -fif-conversion
8771 @opindex fif-conversion
8772 Attempt to transform conditional jumps into branch-less equivalents. This
8773 includes use of conditional moves, min, max, set flags and abs instructions, and
8774 some tricks doable by standard arithmetics. The use of conditional execution
8775 on chips where it is available is controlled by @option{-fif-conversion2}.
8776
8777 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8778 not with @option{-Og}.
8779
8780 @item -fif-conversion2
8781 @opindex fif-conversion2
8782 Use conditional execution (where available) to transform conditional jumps into
8783 branch-less equivalents.
8784
8785 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8786 not with @option{-Og}.
8787
8788 @item -fdeclone-ctor-dtor
8789 @opindex fdeclone-ctor-dtor
8790 The C++ ABI requires multiple entry points for constructors and
8791 destructors: one for a base subobject, one for a complete object, and
8792 one for a virtual destructor that calls operator delete afterwards.
8793 For a hierarchy with virtual bases, the base and complete variants are
8794 clones, which means two copies of the function. With this option, the
8795 base and complete variants are changed to be thunks that call a common
8796 implementation.
8797
8798 Enabled by @option{-Os}.
8799
8800 @item -fdelete-null-pointer-checks
8801 @opindex fdelete-null-pointer-checks
8802 Assume that programs cannot safely dereference null pointers, and that
8803 no code or data element resides at address zero.
8804 This option enables simple constant
8805 folding optimizations at all optimization levels. In addition, other
8806 optimization passes in GCC use this flag to control global dataflow
8807 analyses that eliminate useless checks for null pointers; these assume
8808 that a memory access to address zero always results in a trap, so
8809 that if a pointer is checked after it has already been dereferenced,
8810 it cannot be null.
8811
8812 Note however that in some environments this assumption is not true.
8813 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8814 for programs that depend on that behavior.
8815
8816 This option is enabled by default on most targets. On Nios II ELF, it
8817 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8818
8819 Passes that use the dataflow information
8820 are enabled independently at different optimization levels.
8821
8822 @item -fdevirtualize
8823 @opindex fdevirtualize
8824 Attempt to convert calls to virtual functions to direct calls. This
8825 is done both within a procedure and interprocedurally as part of
8826 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8827 propagation (@option{-fipa-cp}).
8828 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8829
8830 @item -fdevirtualize-speculatively
8831 @opindex fdevirtualize-speculatively
8832 Attempt to convert calls to virtual functions to speculative direct calls.
8833 Based on the analysis of the type inheritance graph, determine for a given call
8834 the set of likely targets. If the set is small, preferably of size 1, change
8835 the call into a conditional deciding between direct and indirect calls. The
8836 speculative calls enable more optimizations, such as inlining. When they seem
8837 useless after further optimization, they are converted back into original form.
8838
8839 @item -fdevirtualize-at-ltrans
8840 @opindex fdevirtualize-at-ltrans
8841 Stream extra information needed for aggressive devirtualization when running
8842 the link-time optimizer in local transformation mode.
8843 This option enables more devirtualization but
8844 significantly increases the size of streamed data. For this reason it is
8845 disabled by default.
8846
8847 @item -fexpensive-optimizations
8848 @opindex fexpensive-optimizations
8849 Perform a number of minor optimizations that are relatively expensive.
8850
8851 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8852
8853 @item -free
8854 @opindex free
8855 Attempt to remove redundant extension instructions. This is especially
8856 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8857 registers after writing to their lower 32-bit half.
8858
8859 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8860 @option{-O3}, @option{-Os}.
8861
8862 @item -fno-lifetime-dse
8863 @opindex fno-lifetime-dse
8864 @opindex flifetime-dse
8865 In C++ the value of an object is only affected by changes within its
8866 lifetime: when the constructor begins, the object has an indeterminate
8867 value, and any changes during the lifetime of the object are dead when
8868 the object is destroyed. Normally dead store elimination will take
8869 advantage of this; if your code relies on the value of the object
8870 storage persisting beyond the lifetime of the object, you can use this
8871 flag to disable this optimization. To preserve stores before the
8872 constructor starts (e.g.@: because your operator new clears the object
8873 storage) but still treat the object as dead after the destructor you,
8874 can use @option{-flifetime-dse=1}. The default behavior can be
8875 explicitly selected with @option{-flifetime-dse=2}.
8876 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8877
8878 @item -flive-range-shrinkage
8879 @opindex flive-range-shrinkage
8880 Attempt to decrease register pressure through register live range
8881 shrinkage. This is helpful for fast processors with small or moderate
8882 size register sets.
8883
8884 @item -fira-algorithm=@var{algorithm}
8885 @opindex fira-algorithm
8886 Use the specified coloring algorithm for the integrated register
8887 allocator. The @var{algorithm} argument can be @samp{priority}, which
8888 specifies Chow's priority coloring, or @samp{CB}, which specifies
8889 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8890 for all architectures, but for those targets that do support it, it is
8891 the default because it generates better code.
8892
8893 @item -fira-region=@var{region}
8894 @opindex fira-region
8895 Use specified regions for the integrated register allocator. The
8896 @var{region} argument should be one of the following:
8897
8898 @table @samp
8899
8900 @item all
8901 Use all loops as register allocation regions.
8902 This can give the best results for machines with a small and/or
8903 irregular register set.
8904
8905 @item mixed
8906 Use all loops except for loops with small register pressure
8907 as the regions. This value usually gives
8908 the best results in most cases and for most architectures,
8909 and is enabled by default when compiling with optimization for speed
8910 (@option{-O}, @option{-O2}, @dots{}).
8911
8912 @item one
8913 Use all functions as a single region.
8914 This typically results in the smallest code size, and is enabled by default for
8915 @option{-Os} or @option{-O0}.
8916
8917 @end table
8918
8919 @item -fira-hoist-pressure
8920 @opindex fira-hoist-pressure
8921 Use IRA to evaluate register pressure in the code hoisting pass for
8922 decisions to hoist expressions. This option usually results in smaller
8923 code, but it can slow the compiler down.
8924
8925 This option is enabled at level @option{-Os} for all targets.
8926
8927 @item -fira-loop-pressure
8928 @opindex fira-loop-pressure
8929 Use IRA to evaluate register pressure in loops for decisions to move
8930 loop invariants. This option usually results in generation
8931 of faster and smaller code on machines with large register files (>= 32
8932 registers), but it can slow the compiler down.
8933
8934 This option is enabled at level @option{-O3} for some targets.
8935
8936 @item -fno-ira-share-save-slots
8937 @opindex fno-ira-share-save-slots
8938 @opindex fira-share-save-slots
8939 Disable sharing of stack slots used for saving call-used hard
8940 registers living through a call. Each hard register gets a
8941 separate stack slot, and as a result function stack frames are
8942 larger.
8943
8944 @item -fno-ira-share-spill-slots
8945 @opindex fno-ira-share-spill-slots
8946 @opindex fira-share-spill-slots
8947 Disable sharing of stack slots allocated for pseudo-registers. Each
8948 pseudo-register that does not get a hard register gets a separate
8949 stack slot, and as a result function stack frames are larger.
8950
8951 @item -flra-remat
8952 @opindex flra-remat
8953 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8954 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8955 values if it is profitable.
8956
8957 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8958
8959 @item -fdelayed-branch
8960 @opindex fdelayed-branch
8961 If supported for the target machine, attempt to reorder instructions
8962 to exploit instruction slots available after delayed branch
8963 instructions.
8964
8965 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8966 but not at @option{-Og}.
8967
8968 @item -fschedule-insns
8969 @opindex fschedule-insns
8970 If supported for the target machine, attempt to reorder instructions to
8971 eliminate execution stalls due to required data being unavailable. This
8972 helps machines that have slow floating point or memory load instructions
8973 by allowing other instructions to be issued until the result of the load
8974 or floating-point instruction is required.
8975
8976 Enabled at levels @option{-O2}, @option{-O3}.
8977
8978 @item -fschedule-insns2
8979 @opindex fschedule-insns2
8980 Similar to @option{-fschedule-insns}, but requests an additional pass of
8981 instruction scheduling after register allocation has been done. This is
8982 especially useful on machines with a relatively small number of
8983 registers and where memory load instructions take more than one cycle.
8984
8985 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8986
8987 @item -fno-sched-interblock
8988 @opindex fno-sched-interblock
8989 @opindex fsched-interblock
8990 Disable instruction scheduling across basic blocks, which
8991 is normally enabled when scheduling before register allocation, i.e.@:
8992 with @option{-fschedule-insns} or at @option{-O2} or higher.
8993
8994 @item -fno-sched-spec
8995 @opindex fno-sched-spec
8996 @opindex fsched-spec
8997 Disable speculative motion of non-load instructions, which
8998 is normally enabled when scheduling before register allocation, i.e.@:
8999 with @option{-fschedule-insns} or at @option{-O2} or higher.
9000
9001 @item -fsched-pressure
9002 @opindex fsched-pressure
9003 Enable register pressure sensitive insn scheduling before register
9004 allocation. This only makes sense when scheduling before register
9005 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9006 @option{-O2} or higher. Usage of this option can improve the
9007 generated code and decrease its size by preventing register pressure
9008 increase above the number of available hard registers and subsequent
9009 spills in register allocation.
9010
9011 @item -fsched-spec-load
9012 @opindex fsched-spec-load
9013 Allow speculative motion of some load instructions. This only makes
9014 sense when scheduling before register allocation, i.e.@: with
9015 @option{-fschedule-insns} or at @option{-O2} or higher.
9016
9017 @item -fsched-spec-load-dangerous
9018 @opindex fsched-spec-load-dangerous
9019 Allow speculative motion of more load instructions. This only makes
9020 sense when scheduling before register allocation, i.e.@: with
9021 @option{-fschedule-insns} or at @option{-O2} or higher.
9022
9023 @item -fsched-stalled-insns
9024 @itemx -fsched-stalled-insns=@var{n}
9025 @opindex fsched-stalled-insns
9026 Define how many insns (if any) can be moved prematurely from the queue
9027 of stalled insns into the ready list during the second scheduling pass.
9028 @option{-fno-sched-stalled-insns} means that no insns are moved
9029 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9030 on how many queued insns can be moved prematurely.
9031 @option{-fsched-stalled-insns} without a value is equivalent to
9032 @option{-fsched-stalled-insns=1}.
9033
9034 @item -fsched-stalled-insns-dep
9035 @itemx -fsched-stalled-insns-dep=@var{n}
9036 @opindex fsched-stalled-insns-dep
9037 Define how many insn groups (cycles) are examined for a dependency
9038 on a stalled insn that is a candidate for premature removal from the queue
9039 of stalled insns. This has an effect only during the second scheduling pass,
9040 and only if @option{-fsched-stalled-insns} is used.
9041 @option{-fno-sched-stalled-insns-dep} is equivalent to
9042 @option{-fsched-stalled-insns-dep=0}.
9043 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9044 @option{-fsched-stalled-insns-dep=1}.
9045
9046 @item -fsched2-use-superblocks
9047 @opindex fsched2-use-superblocks
9048 When scheduling after register allocation, use superblock scheduling.
9049 This allows motion across basic block boundaries,
9050 resulting in faster schedules. This option is experimental, as not all machine
9051 descriptions used by GCC model the CPU closely enough to avoid unreliable
9052 results from the algorithm.
9053
9054 This only makes sense when scheduling after register allocation, i.e.@: with
9055 @option{-fschedule-insns2} or at @option{-O2} or higher.
9056
9057 @item -fsched-group-heuristic
9058 @opindex fsched-group-heuristic
9059 Enable the group heuristic in the scheduler. This heuristic favors
9060 the instruction that belongs to a schedule group. This is enabled
9061 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9062 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9063
9064 @item -fsched-critical-path-heuristic
9065 @opindex fsched-critical-path-heuristic
9066 Enable the critical-path heuristic in the scheduler. This heuristic favors
9067 instructions on the critical path. This is enabled by default when
9068 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9069 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9070
9071 @item -fsched-spec-insn-heuristic
9072 @opindex fsched-spec-insn-heuristic
9073 Enable the speculative instruction heuristic in the scheduler. This
9074 heuristic favors speculative instructions with greater dependency weakness.
9075 This is enabled by default when scheduling is enabled, i.e.@:
9076 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9077 or at @option{-O2} or higher.
9078
9079 @item -fsched-rank-heuristic
9080 @opindex fsched-rank-heuristic
9081 Enable the rank heuristic in the scheduler. This heuristic favors
9082 the instruction belonging to a basic block with greater size or frequency.
9083 This is enabled by default when scheduling is enabled, i.e.@:
9084 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9085 at @option{-O2} or higher.
9086
9087 @item -fsched-last-insn-heuristic
9088 @opindex fsched-last-insn-heuristic
9089 Enable the last-instruction heuristic in the scheduler. This heuristic
9090 favors the instruction that is less dependent on the last instruction
9091 scheduled. This is enabled by default when scheduling is enabled,
9092 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9093 at @option{-O2} or higher.
9094
9095 @item -fsched-dep-count-heuristic
9096 @opindex fsched-dep-count-heuristic
9097 Enable the dependent-count heuristic in the scheduler. This heuristic
9098 favors the instruction that has more instructions depending on it.
9099 This is enabled by default when scheduling is enabled, i.e.@:
9100 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9101 at @option{-O2} or higher.
9102
9103 @item -freschedule-modulo-scheduled-loops
9104 @opindex freschedule-modulo-scheduled-loops
9105 Modulo scheduling is performed before traditional scheduling. If a loop
9106 is modulo scheduled, later scheduling passes may change its schedule.
9107 Use this option to control that behavior.
9108
9109 @item -fselective-scheduling
9110 @opindex fselective-scheduling
9111 Schedule instructions using selective scheduling algorithm. Selective
9112 scheduling runs instead of the first scheduler pass.
9113
9114 @item -fselective-scheduling2
9115 @opindex fselective-scheduling2
9116 Schedule instructions using selective scheduling algorithm. Selective
9117 scheduling runs instead of the second scheduler pass.
9118
9119 @item -fsel-sched-pipelining
9120 @opindex fsel-sched-pipelining
9121 Enable software pipelining of innermost loops during selective scheduling.
9122 This option has no effect unless one of @option{-fselective-scheduling} or
9123 @option{-fselective-scheduling2} is turned on.
9124
9125 @item -fsel-sched-pipelining-outer-loops
9126 @opindex fsel-sched-pipelining-outer-loops
9127 When pipelining loops during selective scheduling, also pipeline outer loops.
9128 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9129
9130 @item -fsemantic-interposition
9131 @opindex fsemantic-interposition
9132 Some object formats, like ELF, allow interposing of symbols by the
9133 dynamic linker.
9134 This means that for symbols exported from the DSO, the compiler cannot perform
9135 interprocedural propagation, inlining and other optimizations in anticipation
9136 that the function or variable in question may change. While this feature is
9137 useful, for example, to rewrite memory allocation functions by a debugging
9138 implementation, it is expensive in the terms of code quality.
9139 With @option{-fno-semantic-interposition} the compiler assumes that
9140 if interposition happens for functions the overwriting function will have
9141 precisely the same semantics (and side effects).
9142 Similarly if interposition happens
9143 for variables, the constructor of the variable will be the same. The flag
9144 has no effect for functions explicitly declared inline
9145 (where it is never allowed for interposition to change semantics)
9146 and for symbols explicitly declared weak.
9147
9148 @item -fshrink-wrap
9149 @opindex fshrink-wrap
9150 Emit function prologues only before parts of the function that need it,
9151 rather than at the top of the function. This flag is enabled by default at
9152 @option{-O} and higher.
9153
9154 @item -fshrink-wrap-separate
9155 @opindex fshrink-wrap-separate
9156 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9157 those parts are only executed when needed.
9158 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9159 is also turned on and the target supports this.
9160
9161 @item -fcaller-saves
9162 @opindex fcaller-saves
9163 Enable allocation of values to registers that are clobbered by
9164 function calls, by emitting extra instructions to save and restore the
9165 registers around such calls. Such allocation is done only when it
9166 seems to result in better code.
9167
9168 This option is always enabled by default on certain machines, usually
9169 those which have no call-preserved registers to use instead.
9170
9171 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9172
9173 @item -fcombine-stack-adjustments
9174 @opindex fcombine-stack-adjustments
9175 Tracks stack adjustments (pushes and pops) and stack memory references
9176 and then tries to find ways to combine them.
9177
9178 Enabled by default at @option{-O1} and higher.
9179
9180 @item -fipa-ra
9181 @opindex fipa-ra
9182 Use caller save registers for allocation if those registers are not used by
9183 any called function. In that case it is not necessary to save and restore
9184 them around calls. This is only possible if called functions are part of
9185 same compilation unit as current function and they are compiled before it.
9186
9187 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9188 is disabled if generated code will be instrumented for profiling
9189 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9190 exactly (this happens on targets that do not expose prologues
9191 and epilogues in RTL).
9192
9193 @item -fconserve-stack
9194 @opindex fconserve-stack
9195 Attempt to minimize stack usage. The compiler attempts to use less
9196 stack space, even if that makes the program slower. This option
9197 implies setting the @option{large-stack-frame} parameter to 100
9198 and the @option{large-stack-frame-growth} parameter to 400.
9199
9200 @item -ftree-reassoc
9201 @opindex ftree-reassoc
9202 Perform reassociation on trees. This flag is enabled by default
9203 at @option{-O} and higher.
9204
9205 @item -fcode-hoisting
9206 @opindex fcode-hoisting
9207 Perform code hoisting. Code hoisting tries to move the
9208 evaluation of expressions executed on all paths to the function exit
9209 as early as possible. This is especially useful as a code size
9210 optimization, but it often helps for code speed as well.
9211 This flag is enabled by default at @option{-O2} and higher.
9212
9213 @item -ftree-pre
9214 @opindex ftree-pre
9215 Perform partial redundancy elimination (PRE) on trees. This flag is
9216 enabled by default at @option{-O2} and @option{-O3}.
9217
9218 @item -ftree-partial-pre
9219 @opindex ftree-partial-pre
9220 Make partial redundancy elimination (PRE) more aggressive. This flag is
9221 enabled by default at @option{-O3}.
9222
9223 @item -ftree-forwprop
9224 @opindex ftree-forwprop
9225 Perform forward propagation on trees. This flag is enabled by default
9226 at @option{-O} and higher.
9227
9228 @item -ftree-fre
9229 @opindex ftree-fre
9230 Perform full redundancy elimination (FRE) on trees. The difference
9231 between FRE and PRE is that FRE only considers expressions
9232 that are computed on all paths leading to the redundant computation.
9233 This analysis is faster than PRE, though it exposes fewer redundancies.
9234 This flag is enabled by default at @option{-O} and higher.
9235
9236 @item -ftree-phiprop
9237 @opindex ftree-phiprop
9238 Perform hoisting of loads from conditional pointers on trees. This
9239 pass is enabled by default at @option{-O} and higher.
9240
9241 @item -fhoist-adjacent-loads
9242 @opindex fhoist-adjacent-loads
9243 Speculatively hoist loads from both branches of an if-then-else if the
9244 loads are from adjacent locations in the same structure and the target
9245 architecture has a conditional move instruction. This flag is enabled
9246 by default at @option{-O2} and higher.
9247
9248 @item -ftree-copy-prop
9249 @opindex ftree-copy-prop
9250 Perform copy propagation on trees. This pass eliminates unnecessary
9251 copy operations. This flag is enabled by default at @option{-O} and
9252 higher.
9253
9254 @item -fipa-pure-const
9255 @opindex fipa-pure-const
9256 Discover which functions are pure or constant.
9257 Enabled by default at @option{-O} and higher.
9258
9259 @item -fipa-reference
9260 @opindex fipa-reference
9261 Discover which static variables do not escape the
9262 compilation unit.
9263 Enabled by default at @option{-O} and higher.
9264
9265 @item -fipa-reference-addressable
9266 @opindex fipa-reference-addressable
9267 Discover read-only, write-only and non-addressable static variables.
9268 Enabled by default at @option{-O} and higher.
9269
9270 @item -fipa-stack-alignment
9271 @opindex fipa-stack-alignment
9272 Reduce stack alignment on call sites if possible.
9273 Enabled by default.
9274
9275 @item -fipa-pta
9276 @opindex fipa-pta
9277 Perform interprocedural pointer analysis and interprocedural modification
9278 and reference analysis. This option can cause excessive memory and
9279 compile-time usage on large compilation units. It is not enabled by
9280 default at any optimization level.
9281
9282 @item -fipa-profile
9283 @opindex fipa-profile
9284 Perform interprocedural profile propagation. The functions called only from
9285 cold functions are marked as cold. Also functions executed once (such as
9286 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9287 functions and loop less parts of functions executed once are then optimized for
9288 size.
9289 Enabled by default at @option{-O} and higher.
9290
9291 @item -fipa-cp
9292 @opindex fipa-cp
9293 Perform interprocedural constant propagation.
9294 This optimization analyzes the program to determine when values passed
9295 to functions are constants and then optimizes accordingly.
9296 This optimization can substantially increase performance
9297 if the application has constants passed to functions.
9298 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9299 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9300
9301 @item -fipa-cp-clone
9302 @opindex fipa-cp-clone
9303 Perform function cloning to make interprocedural constant propagation stronger.
9304 When enabled, interprocedural constant propagation performs function cloning
9305 when externally visible function can be called with constant arguments.
9306 Because this optimization can create multiple copies of functions,
9307 it may significantly increase code size
9308 (see @option{--param ipcp-unit-growth=@var{value}}).
9309 This flag is enabled by default at @option{-O3}.
9310 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9311
9312 @item -fipa-bit-cp
9313 @opindex fipa-bit-cp
9314 When enabled, perform interprocedural bitwise constant
9315 propagation. This flag is enabled by default at @option{-O2} and
9316 by @option{-fprofile-use} and @option{-fauto-profile}.
9317 It requires that @option{-fipa-cp} is enabled.
9318
9319 @item -fipa-vrp
9320 @opindex fipa-vrp
9321 When enabled, perform interprocedural propagation of value
9322 ranges. This flag is enabled by default at @option{-O2}. It requires
9323 that @option{-fipa-cp} is enabled.
9324
9325 @item -fipa-icf
9326 @opindex fipa-icf
9327 Perform Identical Code Folding for functions and read-only variables.
9328 The optimization reduces code size and may disturb unwind stacks by replacing
9329 a function by equivalent one with a different name. The optimization works
9330 more effectively with link-time optimization enabled.
9331
9332 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9333 works on different levels and thus the optimizations are not same - there are
9334 equivalences that are found only by GCC and equivalences found only by Gold.
9335
9336 This flag is enabled by default at @option{-O2} and @option{-Os}.
9337
9338 @item -flive-patching=@var{level}
9339 @opindex flive-patching
9340 Control GCC's optimizations to provide a safe compilation for live-patching.
9341
9342 If the compiler's optimization uses a function's body or information extracted
9343 from its body to optimize/change another function, the latter is called an
9344 impacted function of the former. If a function is patched, its impacted
9345 functions should be patched too.
9346
9347 The impacted functions are decided by the compiler's interprocedural
9348 optimizations. For example, inlining a function into its caller, cloning
9349 a function and changing its caller to call this new clone, or extracting
9350 a function's pureness/constness information to optimize its direct or
9351 indirect callers, etc.
9352
9353 Usually, the more IPA optimizations enabled, the larger the number of
9354 impacted functions for each function. In order to control the number of
9355 impacted functions and computed the list of impacted function easily,
9356 we provide control to partially enable IPA optimizations on two different
9357 levels.
9358
9359 The @var{level} argument should be one of the following:
9360
9361 @table @samp
9362
9363 @item inline-clone
9364
9365 Only enable inlining and cloning optimizations, which includes inlining,
9366 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9367 As a result, when patching a function, all its callers and its clones'
9368 callers need to be patched as well.
9369
9370 @option{-flive-patching=inline-clone} disables the following optimization flags:
9371 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9372 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9373 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9374 -fipa-stack-alignment}
9375
9376 @item inline-only-static
9377
9378 Only enable inlining of static functions.
9379 As a result, when patching a static function, all its callers need to be
9380 patches as well.
9381
9382 In addition to all the flags that -flive-patching=inline-clone disables,
9383 @option{-flive-patching=inline-only-static} disables the following additional
9384 optimization flags:
9385 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9386
9387 @end table
9388
9389 When -flive-patching specified without any value, the default value
9390 is "inline-clone".
9391
9392 This flag is disabled by default.
9393
9394 Note that -flive-patching is not supported with link-time optimizer.
9395 (@option{-flto}).
9396
9397 @item -fisolate-erroneous-paths-dereference
9398 @opindex fisolate-erroneous-paths-dereference
9399 Detect paths that trigger erroneous or undefined behavior due to
9400 dereferencing a null pointer. Isolate those paths from the main control
9401 flow and turn the statement with erroneous or undefined behavior into a trap.
9402 This flag is enabled by default at @option{-O2} and higher and depends on
9403 @option{-fdelete-null-pointer-checks} also being enabled.
9404
9405 @item -fisolate-erroneous-paths-attribute
9406 @opindex fisolate-erroneous-paths-attribute
9407 Detect paths that trigger erroneous or undefined behavior due to a null value
9408 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9409 attribute. Isolate those paths from the main control flow and turn the
9410 statement with erroneous or undefined behavior into a trap. This is not
9411 currently enabled, but may be enabled by @option{-O2} in the future.
9412
9413 @item -ftree-sink
9414 @opindex ftree-sink
9415 Perform forward store motion on trees. This flag is
9416 enabled by default at @option{-O} and higher.
9417
9418 @item -ftree-bit-ccp
9419 @opindex ftree-bit-ccp
9420 Perform sparse conditional bit constant propagation on trees and propagate
9421 pointer alignment information.
9422 This pass only operates on local scalar variables and is enabled by default
9423 at @option{-O1} and higher, except for @option{-Og}.
9424 It requires that @option{-ftree-ccp} is enabled.
9425
9426 @item -ftree-ccp
9427 @opindex ftree-ccp
9428 Perform sparse conditional constant propagation (CCP) on trees. This
9429 pass only operates on local scalar variables and is enabled by default
9430 at @option{-O} and higher.
9431
9432 @item -fssa-backprop
9433 @opindex fssa-backprop
9434 Propagate information about uses of a value up the definition chain
9435 in order to simplify the definitions. For example, this pass strips
9436 sign operations if the sign of a value never matters. The flag is
9437 enabled by default at @option{-O} and higher.
9438
9439 @item -fssa-phiopt
9440 @opindex fssa-phiopt
9441 Perform pattern matching on SSA PHI nodes to optimize conditional
9442 code. This pass is enabled by default at @option{-O1} and higher,
9443 except for @option{-Og}.
9444
9445 @item -ftree-switch-conversion
9446 @opindex ftree-switch-conversion
9447 Perform conversion of simple initializations in a switch to
9448 initializations from a scalar array. This flag is enabled by default
9449 at @option{-O2} and higher.
9450
9451 @item -ftree-tail-merge
9452 @opindex ftree-tail-merge
9453 Look for identical code sequences. When found, replace one with a jump to the
9454 other. This optimization is known as tail merging or cross jumping. This flag
9455 is enabled by default at @option{-O2} and higher. The compilation time
9456 in this pass can
9457 be limited using @option{max-tail-merge-comparisons} parameter and
9458 @option{max-tail-merge-iterations} parameter.
9459
9460 @item -ftree-dce
9461 @opindex ftree-dce
9462 Perform dead code elimination (DCE) on trees. This flag is enabled by
9463 default at @option{-O} and higher.
9464
9465 @item -ftree-builtin-call-dce
9466 @opindex ftree-builtin-call-dce
9467 Perform conditional dead code elimination (DCE) for calls to built-in functions
9468 that may set @code{errno} but are otherwise free of side effects. This flag is
9469 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9470 specified.
9471
9472 @item -ftree-dominator-opts
9473 @opindex ftree-dominator-opts
9474 Perform a variety of simple scalar cleanups (constant/copy
9475 propagation, redundancy elimination, range propagation and expression
9476 simplification) based on a dominator tree traversal. This also
9477 performs jump threading (to reduce jumps to jumps). This flag is
9478 enabled by default at @option{-O} and higher.
9479
9480 @item -ftree-dse
9481 @opindex ftree-dse
9482 Perform dead store elimination (DSE) on trees. A dead store is a store into
9483 a memory location that is later overwritten by another store without
9484 any intervening loads. In this case the earlier store can be deleted. This
9485 flag is enabled by default at @option{-O} and higher.
9486
9487 @item -ftree-ch
9488 @opindex ftree-ch
9489 Perform loop header copying on trees. This is beneficial since it increases
9490 effectiveness of code motion optimizations. It also saves one jump. This flag
9491 is enabled by default at @option{-O} and higher. It is not enabled
9492 for @option{-Os}, since it usually increases code size.
9493
9494 @item -ftree-loop-optimize
9495 @opindex ftree-loop-optimize
9496 Perform loop optimizations on trees. This flag is enabled by default
9497 at @option{-O} and higher.
9498
9499 @item -ftree-loop-linear
9500 @itemx -floop-strip-mine
9501 @itemx -floop-block
9502 @opindex ftree-loop-linear
9503 @opindex floop-strip-mine
9504 @opindex floop-block
9505 Perform loop nest optimizations. Same as
9506 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9507 to be configured with @option{--with-isl} to enable the Graphite loop
9508 transformation infrastructure.
9509
9510 @item -fgraphite-identity
9511 @opindex fgraphite-identity
9512 Enable the identity transformation for graphite. For every SCoP we generate
9513 the polyhedral representation and transform it back to gimple. Using
9514 @option{-fgraphite-identity} we can check the costs or benefits of the
9515 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9516 are also performed by the code generator isl, like index splitting and
9517 dead code elimination in loops.
9518
9519 @item -floop-nest-optimize
9520 @opindex floop-nest-optimize
9521 Enable the isl based loop nest optimizer. This is a generic loop nest
9522 optimizer based on the Pluto optimization algorithms. It calculates a loop
9523 structure optimized for data-locality and parallelism. This option
9524 is experimental.
9525
9526 @item -floop-parallelize-all
9527 @opindex floop-parallelize-all
9528 Use the Graphite data dependence analysis to identify loops that can
9529 be parallelized. Parallelize all the loops that can be analyzed to
9530 not contain loop carried dependences without checking that it is
9531 profitable to parallelize the loops.
9532
9533 @item -ftree-coalesce-vars
9534 @opindex ftree-coalesce-vars
9535 While transforming the program out of the SSA representation, attempt to
9536 reduce copying by coalescing versions of different user-defined
9537 variables, instead of just compiler temporaries. This may severely
9538 limit the ability to debug an optimized program compiled with
9539 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9540 prevents SSA coalescing of user variables. This option is enabled by
9541 default if optimization is enabled, and it does very little otherwise.
9542
9543 @item -ftree-loop-if-convert
9544 @opindex ftree-loop-if-convert
9545 Attempt to transform conditional jumps in the innermost loops to
9546 branch-less equivalents. The intent is to remove control-flow from
9547 the innermost loops in order to improve the ability of the
9548 vectorization pass to handle these loops. This is enabled by default
9549 if vectorization is enabled.
9550
9551 @item -ftree-loop-distribution
9552 @opindex ftree-loop-distribution
9553 Perform loop distribution. This flag can improve cache performance on
9554 big loop bodies and allow further loop optimizations, like
9555 parallelization or vectorization, to take place. For example, the loop
9556 @smallexample
9557 DO I = 1, N
9558 A(I) = B(I) + C
9559 D(I) = E(I) * F
9560 ENDDO
9561 @end smallexample
9562 is transformed to
9563 @smallexample
9564 DO I = 1, N
9565 A(I) = B(I) + C
9566 ENDDO
9567 DO I = 1, N
9568 D(I) = E(I) * F
9569 ENDDO
9570 @end smallexample
9571 This flag is enabled by default at @option{-O3}.
9572 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9573
9574 @item -ftree-loop-distribute-patterns
9575 @opindex ftree-loop-distribute-patterns
9576 Perform loop distribution of patterns that can be code generated with
9577 calls to a library. This flag is enabled by default at @option{-O3}, and
9578 by @option{-fprofile-use} and @option{-fauto-profile}.
9579
9580 This pass distributes the initialization loops and generates a call to
9581 memset zero. For example, the loop
9582 @smallexample
9583 DO I = 1, N
9584 A(I) = 0
9585 B(I) = A(I) + I
9586 ENDDO
9587 @end smallexample
9588 is transformed to
9589 @smallexample
9590 DO I = 1, N
9591 A(I) = 0
9592 ENDDO
9593 DO I = 1, N
9594 B(I) = A(I) + I
9595 ENDDO
9596 @end smallexample
9597 and the initialization loop is transformed into a call to memset zero.
9598 This flag is enabled by default at @option{-O3}.
9599 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9600
9601 @item -floop-interchange
9602 @opindex floop-interchange
9603 Perform loop interchange outside of graphite. This flag can improve cache
9604 performance on loop nest and allow further loop optimizations, like
9605 vectorization, to take place. For example, the loop
9606 @smallexample
9607 for (int i = 0; i < N; i++)
9608 for (int j = 0; j < N; j++)
9609 for (int k = 0; k < N; k++)
9610 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9611 @end smallexample
9612 is transformed to
9613 @smallexample
9614 for (int i = 0; i < N; i++)
9615 for (int k = 0; k < N; k++)
9616 for (int j = 0; j < N; j++)
9617 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9618 @end smallexample
9619 This flag is enabled by default at @option{-O3}.
9620 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9621
9622 @item -floop-unroll-and-jam
9623 @opindex floop-unroll-and-jam
9624 Apply unroll and jam transformations on feasible loops. In a loop
9625 nest this unrolls the outer loop by some factor and fuses the resulting
9626 multiple inner loops. This flag is enabled by default at @option{-O3}.
9627 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9628
9629 @item -ftree-loop-im
9630 @opindex ftree-loop-im
9631 Perform loop invariant motion on trees. This pass moves only invariants that
9632 are hard to handle at RTL level (function calls, operations that expand to
9633 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9634 operands of conditions that are invariant out of the loop, so that we can use
9635 just trivial invariantness analysis in loop unswitching. The pass also includes
9636 store motion.
9637
9638 @item -ftree-loop-ivcanon
9639 @opindex ftree-loop-ivcanon
9640 Create a canonical counter for number of iterations in loops for which
9641 determining number of iterations requires complicated analysis. Later
9642 optimizations then may determine the number easily. Useful especially
9643 in connection with unrolling.
9644
9645 @item -ftree-scev-cprop
9646 @opindex ftree-scev-cprop
9647 Perform final value replacement. If a variable is modified in a loop
9648 in such a way that its value when exiting the loop can be determined using
9649 only its initial value and the number of loop iterations, replace uses of
9650 the final value by such a computation, provided it is sufficiently cheap.
9651 This reduces data dependencies and may allow further simplifications.
9652 Enabled by default at @option{-O} and higher.
9653
9654 @item -fivopts
9655 @opindex fivopts
9656 Perform induction variable optimizations (strength reduction, induction
9657 variable merging and induction variable elimination) on trees.
9658
9659 @item -ftree-parallelize-loops=n
9660 @opindex ftree-parallelize-loops
9661 Parallelize loops, i.e., split their iteration space to run in n threads.
9662 This is only possible for loops whose iterations are independent
9663 and can be arbitrarily reordered. The optimization is only
9664 profitable on multiprocessor machines, for loops that are CPU-intensive,
9665 rather than constrained e.g.@: by memory bandwidth. This option
9666 implies @option{-pthread}, and thus is only supported on targets
9667 that have support for @option{-pthread}.
9668
9669 @item -ftree-pta
9670 @opindex ftree-pta
9671 Perform function-local points-to analysis on trees. This flag is
9672 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9673
9674 @item -ftree-sra
9675 @opindex ftree-sra
9676 Perform scalar replacement of aggregates. This pass replaces structure
9677 references with scalars to prevent committing structures to memory too
9678 early. This flag is enabled by default at @option{-O1} and higher,
9679 except for @option{-Og}.
9680
9681 @item -fstore-merging
9682 @opindex fstore-merging
9683 Perform merging of narrow stores to consecutive memory addresses. This pass
9684 merges contiguous stores of immediate values narrower than a word into fewer
9685 wider stores to reduce the number of instructions. This is enabled by default
9686 at @option{-O2} and higher as well as @option{-Os}.
9687
9688 @item -ftree-ter
9689 @opindex ftree-ter
9690 Perform temporary expression replacement during the SSA->normal phase. Single
9691 use/single def temporaries are replaced at their use location with their
9692 defining expression. This results in non-GIMPLE code, but gives the expanders
9693 much more complex trees to work on resulting in better RTL generation. This is
9694 enabled by default at @option{-O} and higher.
9695
9696 @item -ftree-slsr
9697 @opindex ftree-slsr
9698 Perform straight-line strength reduction on trees. This recognizes related
9699 expressions involving multiplications and replaces them by less expensive
9700 calculations when possible. This is enabled by default at @option{-O} and
9701 higher.
9702
9703 @item -ftree-vectorize
9704 @opindex ftree-vectorize
9705 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9706 and @option{-ftree-slp-vectorize} if not explicitly specified.
9707
9708 @item -ftree-loop-vectorize
9709 @opindex ftree-loop-vectorize
9710 Perform loop vectorization on trees. This flag is enabled by default at
9711 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9712 and @option{-fauto-profile}.
9713
9714 @item -ftree-slp-vectorize
9715 @opindex ftree-slp-vectorize
9716 Perform basic block vectorization on trees. This flag is enabled by default at
9717 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9718 and @option{-fauto-profile}.
9719
9720 @item -fvect-cost-model=@var{model}
9721 @opindex fvect-cost-model
9722 Alter the cost model used for vectorization. The @var{model} argument
9723 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9724 With the @samp{unlimited} model the vectorized code-path is assumed
9725 to be profitable while with the @samp{dynamic} model a runtime check
9726 guards the vectorized code-path to enable it only for iteration
9727 counts that will likely execute faster than when executing the original
9728 scalar loop. The @samp{cheap} model disables vectorization of
9729 loops where doing so would be cost prohibitive for example due to
9730 required runtime checks for data dependence or alignment but otherwise
9731 is equal to the @samp{dynamic} model.
9732 The default cost model depends on other optimization flags and is
9733 either @samp{dynamic} or @samp{cheap}.
9734
9735 @item -fsimd-cost-model=@var{model}
9736 @opindex fsimd-cost-model
9737 Alter the cost model used for vectorization of loops marked with the OpenMP
9738 simd directive. The @var{model} argument should be one of
9739 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9740 have the same meaning as described in @option{-fvect-cost-model} and by
9741 default a cost model defined with @option{-fvect-cost-model} is used.
9742
9743 @item -ftree-vrp
9744 @opindex ftree-vrp
9745 Perform Value Range Propagation on trees. This is similar to the
9746 constant propagation pass, but instead of values, ranges of values are
9747 propagated. This allows the optimizers to remove unnecessary range
9748 checks like array bound checks and null pointer checks. This is
9749 enabled by default at @option{-O2} and higher. Null pointer check
9750 elimination is only done if @option{-fdelete-null-pointer-checks} is
9751 enabled.
9752
9753 @item -fsplit-paths
9754 @opindex fsplit-paths
9755 Split paths leading to loop backedges. This can improve dead code
9756 elimination and common subexpression elimination. This is enabled by
9757 default at @option{-O3} and above.
9758
9759 @item -fsplit-ivs-in-unroller
9760 @opindex fsplit-ivs-in-unroller
9761 Enables expression of values of induction variables in later iterations
9762 of the unrolled loop using the value in the first iteration. This breaks
9763 long dependency chains, thus improving efficiency of the scheduling passes.
9764
9765 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9766 same effect. However, that is not reliable in cases where the loop body
9767 is more complicated than a single basic block. It also does not work at all
9768 on some architectures due to restrictions in the CSE pass.
9769
9770 This optimization is enabled by default.
9771
9772 @item -fvariable-expansion-in-unroller
9773 @opindex fvariable-expansion-in-unroller
9774 With this option, the compiler creates multiple copies of some
9775 local variables when unrolling a loop, which can result in superior code.
9776
9777 @item -fpartial-inlining
9778 @opindex fpartial-inlining
9779 Inline parts of functions. This option has any effect only
9780 when inlining itself is turned on by the @option{-finline-functions}
9781 or @option{-finline-small-functions} options.
9782
9783 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9784
9785 @item -fpredictive-commoning
9786 @opindex fpredictive-commoning
9787 Perform predictive commoning optimization, i.e., reusing computations
9788 (especially memory loads and stores) performed in previous
9789 iterations of loops.
9790
9791 This option is enabled at level @option{-O3}.
9792 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9793
9794 @item -fprefetch-loop-arrays
9795 @opindex fprefetch-loop-arrays
9796 If supported by the target machine, generate instructions to prefetch
9797 memory to improve the performance of loops that access large arrays.
9798
9799 This option may generate better or worse code; results are highly
9800 dependent on the structure of loops within the source code.
9801
9802 Disabled at level @option{-Os}.
9803
9804 @item -fno-printf-return-value
9805 @opindex fno-printf-return-value
9806 @opindex fprintf-return-value
9807 Do not substitute constants for known return value of formatted output
9808 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9809 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9810 transformation allows GCC to optimize or even eliminate branches based
9811 on the known return value of these functions called with arguments that
9812 are either constant, or whose values are known to be in a range that
9813 makes determining the exact return value possible. For example, when
9814 @option{-fprintf-return-value} is in effect, both the branch and the
9815 body of the @code{if} statement (but not the call to @code{snprint})
9816 can be optimized away when @code{i} is a 32-bit or smaller integer
9817 because the return value is guaranteed to be at most 8.
9818
9819 @smallexample
9820 char buf[9];
9821 if (snprintf (buf, "%08x", i) >= sizeof buf)
9822 @dots{}
9823 @end smallexample
9824
9825 The @option{-fprintf-return-value} option relies on other optimizations
9826 and yields best results with @option{-O2} and above. It works in tandem
9827 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9828 options. The @option{-fprintf-return-value} option is enabled by default.
9829
9830 @item -fno-peephole
9831 @itemx -fno-peephole2
9832 @opindex fno-peephole
9833 @opindex fpeephole
9834 @opindex fno-peephole2
9835 @opindex fpeephole2
9836 Disable any machine-specific peephole optimizations. The difference
9837 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9838 are implemented in the compiler; some targets use one, some use the
9839 other, a few use both.
9840
9841 @option{-fpeephole} is enabled by default.
9842 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9843
9844 @item -fno-guess-branch-probability
9845 @opindex fno-guess-branch-probability
9846 @opindex fguess-branch-probability
9847 Do not guess branch probabilities using heuristics.
9848
9849 GCC uses heuristics to guess branch probabilities if they are
9850 not provided by profiling feedback (@option{-fprofile-arcs}). These
9851 heuristics are based on the control flow graph. If some branch probabilities
9852 are specified by @code{__builtin_expect}, then the heuristics are
9853 used to guess branch probabilities for the rest of the control flow graph,
9854 taking the @code{__builtin_expect} info into account. The interactions
9855 between the heuristics and @code{__builtin_expect} can be complex, and in
9856 some cases, it may be useful to disable the heuristics so that the effects
9857 of @code{__builtin_expect} are easier to understand.
9858
9859 It is also possible to specify expected probability of the expression
9860 with @code{__builtin_expect_with_probability} built-in function.
9861
9862 The default is @option{-fguess-branch-probability} at levels
9863 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9864
9865 @item -freorder-blocks
9866 @opindex freorder-blocks
9867 Reorder basic blocks in the compiled function in order to reduce number of
9868 taken branches and improve code locality.
9869
9870 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9871
9872 @item -freorder-blocks-algorithm=@var{algorithm}
9873 @opindex freorder-blocks-algorithm
9874 Use the specified algorithm for basic block reordering. The
9875 @var{algorithm} argument can be @samp{simple}, which does not increase
9876 code size (except sometimes due to secondary effects like alignment),
9877 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9878 put all often executed code together, minimizing the number of branches
9879 executed by making extra copies of code.
9880
9881 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9882 @samp{stc} at levels @option{-O2}, @option{-O3}.
9883
9884 @item -freorder-blocks-and-partition
9885 @opindex freorder-blocks-and-partition
9886 In addition to reordering basic blocks in the compiled function, in order
9887 to reduce number of taken branches, partitions hot and cold basic blocks
9888 into separate sections of the assembly and @file{.o} files, to improve
9889 paging and cache locality performance.
9890
9891 This optimization is automatically turned off in the presence of
9892 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9893 section attribute and on any architecture that does not support named
9894 sections. When @option{-fsplit-stack} is used this option is not
9895 enabled by default (to avoid linker errors), but may be enabled
9896 explicitly (if using a working linker).
9897
9898 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9899
9900 @item -freorder-functions
9901 @opindex freorder-functions
9902 Reorder functions in the object file in order to
9903 improve code locality. This is implemented by using special
9904 subsections @code{.text.hot} for most frequently executed functions and
9905 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9906 the linker so object file format must support named sections and linker must
9907 place them in a reasonable way.
9908
9909 This option isn't effective unless you either provide profile feedback
9910 (see @option{-fprofile-arcs} for details) or manually annotate functions with
9911 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9912
9913 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9914
9915 @item -fstrict-aliasing
9916 @opindex fstrict-aliasing
9917 Allow the compiler to assume the strictest aliasing rules applicable to
9918 the language being compiled. For C (and C++), this activates
9919 optimizations based on the type of expressions. In particular, an
9920 object of one type is assumed never to reside at the same address as an
9921 object of a different type, unless the types are almost the same. For
9922 example, an @code{unsigned int} can alias an @code{int}, but not a
9923 @code{void*} or a @code{double}. A character type may alias any other
9924 type.
9925
9926 @anchor{Type-punning}Pay special attention to code like this:
9927 @smallexample
9928 union a_union @{
9929 int i;
9930 double d;
9931 @};
9932
9933 int f() @{
9934 union a_union t;
9935 t.d = 3.0;
9936 return t.i;
9937 @}
9938 @end smallexample
9939 The practice of reading from a different union member than the one most
9940 recently written to (called ``type-punning'') is common. Even with
9941 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9942 is accessed through the union type. So, the code above works as
9943 expected. @xref{Structures unions enumerations and bit-fields
9944 implementation}. However, this code might not:
9945 @smallexample
9946 int f() @{
9947 union a_union t;
9948 int* ip;
9949 t.d = 3.0;
9950 ip = &t.i;
9951 return *ip;
9952 @}
9953 @end smallexample
9954
9955 Similarly, access by taking the address, casting the resulting pointer
9956 and dereferencing the result has undefined behavior, even if the cast
9957 uses a union type, e.g.:
9958 @smallexample
9959 int f() @{
9960 double d = 3.0;
9961 return ((union a_union *) &d)->i;
9962 @}
9963 @end smallexample
9964
9965 The @option{-fstrict-aliasing} option is enabled at levels
9966 @option{-O2}, @option{-O3}, @option{-Os}.
9967
9968 @item -falign-functions
9969 @itemx -falign-functions=@var{n}
9970 @itemx -falign-functions=@var{n}:@var{m}
9971 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9972 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9973 @opindex falign-functions
9974 Align the start of functions to the next power-of-two greater than
9975 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9976 the first @var{m} bytes of the function can be fetched by the CPU
9977 without crossing an @var{n}-byte alignment boundary.
9978
9979 If @var{m} is not specified, it defaults to @var{n}.
9980
9981 Examples: @option{-falign-functions=32} aligns functions to the next
9982 32-byte boundary, @option{-falign-functions=24} aligns to the next
9983 32-byte boundary only if this can be done by skipping 23 bytes or less,
9984 @option{-falign-functions=32:7} aligns to the next
9985 32-byte boundary only if this can be done by skipping 6 bytes or less.
9986
9987 The second pair of @var{n2}:@var{m2} values allows you to specify
9988 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9989 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9990 otherwise aligns to the next 32-byte boundary if this can be done
9991 by skipping 2 bytes or less.
9992 If @var{m2} is not specified, it defaults to @var{n2}.
9993
9994 Some assemblers only support this flag when @var{n} is a power of two;
9995 in that case, it is rounded up.
9996
9997 @option{-fno-align-functions} and @option{-falign-functions=1} are
9998 equivalent and mean that functions are not aligned.
9999
10000 If @var{n} is not specified or is zero, use a machine-dependent default.
10001 The maximum allowed @var{n} option value is 65536.
10002
10003 Enabled at levels @option{-O2}, @option{-O3}.
10004
10005 @item -flimit-function-alignment
10006 If this option is enabled, the compiler tries to avoid unnecessarily
10007 overaligning functions. It attempts to instruct the assembler to align
10008 by the amount specified by @option{-falign-functions}, but not to
10009 skip more bytes than the size of the function.
10010
10011 @item -falign-labels
10012 @itemx -falign-labels=@var{n}
10013 @itemx -falign-labels=@var{n}:@var{m}
10014 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10015 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10016 @opindex falign-labels
10017 Align all branch targets to a power-of-two boundary.
10018
10019 Parameters of this option are analogous to the @option{-falign-functions} option.
10020 @option{-fno-align-labels} and @option{-falign-labels=1} are
10021 equivalent and mean that labels are not aligned.
10022
10023 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10024 are greater than this value, then their values are used instead.
10025
10026 If @var{n} is not specified or is zero, use a machine-dependent default
10027 which is very likely to be @samp{1}, meaning no alignment.
10028 The maximum allowed @var{n} option value is 65536.
10029
10030 Enabled at levels @option{-O2}, @option{-O3}.
10031
10032 @item -falign-loops
10033 @itemx -falign-loops=@var{n}
10034 @itemx -falign-loops=@var{n}:@var{m}
10035 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10036 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10037 @opindex falign-loops
10038 Align loops to a power-of-two boundary. If the loops are executed
10039 many times, this makes up for any execution of the dummy padding
10040 instructions.
10041
10042 Parameters of this option are analogous to the @option{-falign-functions} option.
10043 @option{-fno-align-loops} and @option{-falign-loops=1} are
10044 equivalent and mean that loops are not aligned.
10045 The maximum allowed @var{n} option value is 65536.
10046
10047 If @var{n} is not specified or is zero, use a machine-dependent default.
10048
10049 Enabled at levels @option{-O2}, @option{-O3}.
10050
10051 @item -falign-jumps
10052 @itemx -falign-jumps=@var{n}
10053 @itemx -falign-jumps=@var{n}:@var{m}
10054 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10055 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10056 @opindex falign-jumps
10057 Align branch targets to a power-of-two boundary, for branch targets
10058 where the targets can only be reached by jumping. In this case,
10059 no dummy operations need be executed.
10060
10061 Parameters of this option are analogous to the @option{-falign-functions} option.
10062 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10063 equivalent and mean that loops are not aligned.
10064
10065 If @var{n} is not specified or is zero, use a machine-dependent default.
10066 The maximum allowed @var{n} option value is 65536.
10067
10068 Enabled at levels @option{-O2}, @option{-O3}.
10069
10070 @item -funit-at-a-time
10071 @opindex funit-at-a-time
10072 This option is left for compatibility reasons. @option{-funit-at-a-time}
10073 has no effect, while @option{-fno-unit-at-a-time} implies
10074 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10075
10076 Enabled by default.
10077
10078 @item -fno-toplevel-reorder
10079 @opindex fno-toplevel-reorder
10080 @opindex ftoplevel-reorder
10081 Do not reorder top-level functions, variables, and @code{asm}
10082 statements. Output them in the same order that they appear in the
10083 input file. When this option is used, unreferenced static variables
10084 are not removed. This option is intended to support existing code
10085 that relies on a particular ordering. For new code, it is better to
10086 use attributes when possible.
10087
10088 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10089 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10090 Additionally @option{-fno-toplevel-reorder} implies
10091 @option{-fno-section-anchors}.
10092
10093 @item -fweb
10094 @opindex fweb
10095 Constructs webs as commonly used for register allocation purposes and assign
10096 each web individual pseudo register. This allows the register allocation pass
10097 to operate on pseudos directly, but also strengthens several other optimization
10098 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10099 however, make debugging impossible, since variables no longer stay in a
10100 ``home register''.
10101
10102 Enabled by default with @option{-funroll-loops}.
10103
10104 @item -fwhole-program
10105 @opindex fwhole-program
10106 Assume that the current compilation unit represents the whole program being
10107 compiled. All public functions and variables with the exception of @code{main}
10108 and those merged by attribute @code{externally_visible} become static functions
10109 and in effect are optimized more aggressively by interprocedural optimizers.
10110
10111 This option should not be used in combination with @option{-flto}.
10112 Instead relying on a linker plugin should provide safer and more precise
10113 information.
10114
10115 @item -flto[=@var{n}]
10116 @opindex flto
10117 This option runs the standard link-time optimizer. When invoked
10118 with source code, it generates GIMPLE (one of GCC's internal
10119 representations) and writes it to special ELF sections in the object
10120 file. When the object files are linked together, all the function
10121 bodies are read from these ELF sections and instantiated as if they
10122 had been part of the same translation unit.
10123
10124 To use the link-time optimizer, @option{-flto} and optimization
10125 options should be specified at compile time and during the final link.
10126 It is recommended that you compile all the files participating in the
10127 same link with the same options and also specify those options at
10128 link time.
10129 For example:
10130
10131 @smallexample
10132 gcc -c -O2 -flto foo.c
10133 gcc -c -O2 -flto bar.c
10134 gcc -o myprog -flto -O2 foo.o bar.o
10135 @end smallexample
10136
10137 The first two invocations to GCC save a bytecode representation
10138 of GIMPLE into special ELF sections inside @file{foo.o} and
10139 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10140 @file{foo.o} and @file{bar.o}, merges the two files into a single
10141 internal image, and compiles the result as usual. Since both
10142 @file{foo.o} and @file{bar.o} are merged into a single image, this
10143 causes all the interprocedural analyses and optimizations in GCC to
10144 work across the two files as if they were a single one. This means,
10145 for example, that the inliner is able to inline functions in
10146 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10147
10148 Another (simpler) way to enable link-time optimization is:
10149
10150 @smallexample
10151 gcc -o myprog -flto -O2 foo.c bar.c
10152 @end smallexample
10153
10154 The above generates bytecode for @file{foo.c} and @file{bar.c},
10155 merges them together into a single GIMPLE representation and optimizes
10156 them as usual to produce @file{myprog}.
10157
10158 The important thing to keep in mind is that to enable link-time
10159 optimizations you need to use the GCC driver to perform the link step.
10160 GCC automatically performs link-time optimization if any of the
10161 objects involved were compiled with the @option{-flto} command-line option.
10162 You can always override
10163 the automatic decision to do link-time optimization
10164 by passing @option{-fno-lto} to the link command.
10165
10166 To make whole program optimization effective, it is necessary to make
10167 certain whole program assumptions. The compiler needs to know
10168 what functions and variables can be accessed by libraries and runtime
10169 outside of the link-time optimized unit. When supported by the linker,
10170 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10171 to the compiler about used and externally visible symbols. When
10172 the linker plugin is not available, @option{-fwhole-program} should be
10173 used to allow the compiler to make these assumptions, which leads
10174 to more aggressive optimization decisions.
10175
10176 When a file is compiled with @option{-flto} without
10177 @option{-fuse-linker-plugin}, the generated object file is larger than
10178 a regular object file because it contains GIMPLE bytecodes and the usual
10179 final code (see @option{-ffat-lto-objects}. This means that
10180 object files with LTO information can be linked as normal object
10181 files; if @option{-fno-lto} is passed to the linker, no
10182 interprocedural optimizations are applied. Note that when
10183 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10184 but you cannot perform a regular, non-LTO link on them.
10185
10186 When producing the final binary, GCC only
10187 applies link-time optimizations to those files that contain bytecode.
10188 Therefore, you can mix and match object files and libraries with
10189 GIMPLE bytecodes and final object code. GCC automatically selects
10190 which files to optimize in LTO mode and which files to link without
10191 further processing.
10192
10193 Generally, options specified at link time override those
10194 specified at compile time, although in some cases GCC attempts to infer
10195 link-time options from the settings used to compile the input files.
10196
10197 If you do not specify an optimization level option @option{-O} at
10198 link time, then GCC uses the highest optimization level
10199 used when compiling the object files. Note that it is generally
10200 ineffective to specify an optimization level option only at link time and
10201 not at compile time, for two reasons. First, compiling without
10202 optimization suppresses compiler passes that gather information
10203 needed for effective optimization at link time. Second, some early
10204 optimization passes can be performed only at compile time and
10205 not at link time.
10206
10207 There are some code generation flags preserved by GCC when
10208 generating bytecodes, as they need to be used during the final link.
10209 Currently, the following options and their settings are taken from
10210 the first object file that explicitly specifies them:
10211 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10212 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10213 and all the @option{-m} target flags.
10214
10215 Certain ABI-changing flags are required to match in all compilation units,
10216 and trying to override this at link time with a conflicting value
10217 is ignored. This includes options such as @option{-freg-struct-return}
10218 and @option{-fpcc-struct-return}.
10219
10220 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10221 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10222 are passed through to the link stage and merged conservatively for
10223 conflicting translation units. Specifically
10224 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10225 precedence; and for example @option{-ffp-contract=off} takes precedence
10226 over @option{-ffp-contract=fast}. You can override them at link time.
10227
10228 If LTO encounters objects with C linkage declared with incompatible
10229 types in separate translation units to be linked together (undefined
10230 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10231 issued. The behavior is still undefined at run time. Similar
10232 diagnostics may be raised for other languages.
10233
10234 Another feature of LTO is that it is possible to apply interprocedural
10235 optimizations on files written in different languages:
10236
10237 @smallexample
10238 gcc -c -flto foo.c
10239 g++ -c -flto bar.cc
10240 gfortran -c -flto baz.f90
10241 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10242 @end smallexample
10243
10244 Notice that the final link is done with @command{g++} to get the C++
10245 runtime libraries and @option{-lgfortran} is added to get the Fortran
10246 runtime libraries. In general, when mixing languages in LTO mode, you
10247 should use the same link command options as when mixing languages in a
10248 regular (non-LTO) compilation.
10249
10250 If object files containing GIMPLE bytecode are stored in a library archive, say
10251 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10252 are using a linker with plugin support. To create static libraries suitable
10253 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10254 and @command{ranlib};
10255 to show the symbols of object files with GIMPLE bytecode, use
10256 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10257 and @command{nm} have been compiled with plugin support. At link time, use the
10258 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10259 the LTO optimization process:
10260
10261 @smallexample
10262 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10263 @end smallexample
10264
10265 With the linker plugin enabled, the linker extracts the needed
10266 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10267 to make them part of the aggregated GIMPLE image to be optimized.
10268
10269 If you are not using a linker with plugin support and/or do not
10270 enable the linker plugin, then the objects inside @file{libfoo.a}
10271 are extracted and linked as usual, but they do not participate
10272 in the LTO optimization process. In order to make a static library suitable
10273 for both LTO optimization and usual linkage, compile its object files with
10274 @option{-flto} @option{-ffat-lto-objects}.
10275
10276 Link-time optimizations do not require the presence of the whole program to
10277 operate. If the program does not require any symbols to be exported, it is
10278 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10279 the interprocedural optimizers to use more aggressive assumptions which may
10280 lead to improved optimization opportunities.
10281 Use of @option{-fwhole-program} is not needed when linker plugin is
10282 active (see @option{-fuse-linker-plugin}).
10283
10284 The current implementation of LTO makes no
10285 attempt to generate bytecode that is portable between different
10286 types of hosts. The bytecode files are versioned and there is a
10287 strict version check, so bytecode files generated in one version of
10288 GCC do not work with an older or newer version of GCC.
10289
10290 Link-time optimization does not work well with generation of debugging
10291 information on systems other than those using a combination of ELF and
10292 DWARF.
10293
10294 If you specify the optional @var{n}, the optimization and code
10295 generation done at link time is executed in parallel using @var{n}
10296 parallel jobs by utilizing an installed @command{make} program. The
10297 environment variable @env{MAKE} may be used to override the program
10298 used. The default value for @var{n} is 1.
10299
10300 You can also specify @option{-flto=jobserver} to use GNU make's
10301 job server mode to determine the number of parallel jobs. This
10302 is useful when the Makefile calling GCC is already executing in parallel.
10303 You must prepend a @samp{+} to the command recipe in the parent Makefile
10304 for this to work. This option likely only works if @env{MAKE} is
10305 GNU make.
10306
10307 @item -flto-partition=@var{alg}
10308 @opindex flto-partition
10309 Specify the partitioning algorithm used by the link-time optimizer.
10310 The value is either @samp{1to1} to specify a partitioning mirroring
10311 the original source files or @samp{balanced} to specify partitioning
10312 into equally sized chunks (whenever possible) or @samp{max} to create
10313 new partition for every symbol where possible. Specifying @samp{none}
10314 as an algorithm disables partitioning and streaming completely.
10315 The default value is @samp{balanced}. While @samp{1to1} can be used
10316 as an workaround for various code ordering issues, the @samp{max}
10317 partitioning is intended for internal testing only.
10318 The value @samp{one} specifies that exactly one partition should be
10319 used while the value @samp{none} bypasses partitioning and executes
10320 the link-time optimization step directly from the WPA phase.
10321
10322 @item -flto-odr-type-merging
10323 @opindex flto-odr-type-merging
10324 Enable streaming of mangled types names of C++ types and their unification
10325 at link time. This increases size of LTO object files, but enables
10326 diagnostics about One Definition Rule violations.
10327
10328 @item -flto-compression-level=@var{n}
10329 @opindex flto-compression-level
10330 This option specifies the level of compression used for intermediate
10331 language written to LTO object files, and is only meaningful in
10332 conjunction with LTO mode (@option{-flto}). Valid
10333 values are 0 (no compression) to 9 (maximum compression). Values
10334 outside this range are clamped to either 0 or 9. If the option is not
10335 given, a default balanced compression setting is used.
10336
10337 @item -fuse-linker-plugin
10338 @opindex fuse-linker-plugin
10339 Enables the use of a linker plugin during link-time optimization. This
10340 option relies on plugin support in the linker, which is available in gold
10341 or in GNU ld 2.21 or newer.
10342
10343 This option enables the extraction of object files with GIMPLE bytecode out
10344 of library archives. This improves the quality of optimization by exposing
10345 more code to the link-time optimizer. This information specifies what
10346 symbols can be accessed externally (by non-LTO object or during dynamic
10347 linking). Resulting code quality improvements on binaries (and shared
10348 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10349 See @option{-flto} for a description of the effect of this flag and how to
10350 use it.
10351
10352 This option is enabled by default when LTO support in GCC is enabled
10353 and GCC was configured for use with
10354 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10355
10356 @item -ffat-lto-objects
10357 @opindex ffat-lto-objects
10358 Fat LTO objects are object files that contain both the intermediate language
10359 and the object code. This makes them usable for both LTO linking and normal
10360 linking. This option is effective only when compiling with @option{-flto}
10361 and is ignored at link time.
10362
10363 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10364 requires the complete toolchain to be aware of LTO. It requires a linker with
10365 linker plugin support for basic functionality. Additionally,
10366 @command{nm}, @command{ar} and @command{ranlib}
10367 need to support linker plugins to allow a full-featured build environment
10368 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10369 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10370 to these tools. With non fat LTO makefiles need to be modified to use them.
10371
10372 Note that modern binutils provide plugin auto-load mechanism.
10373 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10374 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10375 @command{gcc-ranlib}).
10376
10377 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10378 support.
10379
10380 @item -fcompare-elim
10381 @opindex fcompare-elim
10382 After register allocation and post-register allocation instruction splitting,
10383 identify arithmetic instructions that compute processor flags similar to a
10384 comparison operation based on that arithmetic. If possible, eliminate the
10385 explicit comparison operation.
10386
10387 This pass only applies to certain targets that cannot explicitly represent
10388 the comparison operation before register allocation is complete.
10389
10390 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10391
10392 @item -fcprop-registers
10393 @opindex fcprop-registers
10394 After register allocation and post-register allocation instruction splitting,
10395 perform a copy-propagation pass to try to reduce scheduling dependencies
10396 and occasionally eliminate the copy.
10397
10398 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10399
10400 @item -fprofile-correction
10401 @opindex fprofile-correction
10402 Profiles collected using an instrumented binary for multi-threaded programs may
10403 be inconsistent due to missed counter updates. When this option is specified,
10404 GCC uses heuristics to correct or smooth out such inconsistencies. By
10405 default, GCC emits an error message when an inconsistent profile is detected.
10406
10407 This option is enabled by @option{-fauto-profile}.
10408
10409 @item -fprofile-use
10410 @itemx -fprofile-use=@var{path}
10411 @opindex fprofile-use
10412 Enable profile feedback-directed optimizations,
10413 and the following optimizations, many of which
10414 are generally profitable only with profile feedback available:
10415
10416 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10417 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10418 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10419 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10420 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10421 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10422 -fprofile-reorder-functions}
10423
10424 Before you can use this option, you must first generate profiling information.
10425 @xref{Instrumentation Options}, for information about the
10426 @option{-fprofile-generate} option.
10427
10428 By default, GCC emits an error message if the feedback profiles do not
10429 match the source code. This error can be turned into a warning by using
10430 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10431 optimized code. Additionally, by default, GCC also emits a warning message if
10432 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10433
10434 If @var{path} is specified, GCC looks at the @var{path} to find
10435 the profile feedback data files. See @option{-fprofile-dir}.
10436
10437 @item -fauto-profile
10438 @itemx -fauto-profile=@var{path}
10439 @opindex fauto-profile
10440 Enable sampling-based feedback-directed optimizations,
10441 and the following optimizations,
10442 many of which are generally profitable only with profile feedback available:
10443
10444 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10445 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10446 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10447 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10448 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10449 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10450 -fprofile-correction}
10451
10452 @var{path} is the name of a file containing AutoFDO profile information.
10453 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10454
10455 Producing an AutoFDO profile data file requires running your program
10456 with the @command{perf} utility on a supported GNU/Linux target system.
10457 For more information, see @uref{https://perf.wiki.kernel.org/}.
10458
10459 E.g.
10460 @smallexample
10461 perf record -e br_inst_retired:near_taken -b -o perf.data \
10462 -- your_program
10463 @end smallexample
10464
10465 Then use the @command{create_gcov} tool to convert the raw profile data
10466 to a format that can be used by GCC.@ You must also supply the
10467 unstripped binary for your program to this tool.
10468 See @uref{https://github.com/google/autofdo}.
10469
10470 E.g.
10471 @smallexample
10472 create_gcov --binary=your_program.unstripped --profile=perf.data \
10473 --gcov=profile.afdo
10474 @end smallexample
10475 @end table
10476
10477 The following options control compiler behavior regarding floating-point
10478 arithmetic. These options trade off between speed and
10479 correctness. All must be specifically enabled.
10480
10481 @table @gcctabopt
10482 @item -ffloat-store
10483 @opindex ffloat-store
10484 Do not store floating-point variables in registers, and inhibit other
10485 options that might change whether a floating-point value is taken from a
10486 register or memory.
10487
10488 @cindex floating-point precision
10489 This option prevents undesirable excess precision on machines such as
10490 the 68000 where the floating registers (of the 68881) keep more
10491 precision than a @code{double} is supposed to have. Similarly for the
10492 x86 architecture. For most programs, the excess precision does only
10493 good, but a few programs rely on the precise definition of IEEE floating
10494 point. Use @option{-ffloat-store} for such programs, after modifying
10495 them to store all pertinent intermediate computations into variables.
10496
10497 @item -fexcess-precision=@var{style}
10498 @opindex fexcess-precision
10499 This option allows further control over excess precision on machines
10500 where floating-point operations occur in a format with more precision or
10501 range than the IEEE standard and interchange floating-point types. By
10502 default, @option{-fexcess-precision=fast} is in effect; this means that
10503 operations may be carried out in a wider precision than the types specified
10504 in the source if that would result in faster code, and it is unpredictable
10505 when rounding to the types specified in the source code takes place.
10506 When compiling C, if @option{-fexcess-precision=standard} is specified then
10507 excess precision follows the rules specified in ISO C99; in particular,
10508 both casts and assignments cause values to be rounded to their
10509 semantic types (whereas @option{-ffloat-store} only affects
10510 assignments). This option is enabled by default for C if a strict
10511 conformance option such as @option{-std=c99} is used.
10512 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10513 regardless of whether a strict conformance option is used.
10514
10515 @opindex mfpmath
10516 @option{-fexcess-precision=standard} is not implemented for languages
10517 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10518 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10519 semantics apply without excess precision, and in the latter, rounding
10520 is unpredictable.
10521
10522 @item -ffast-math
10523 @opindex ffast-math
10524 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10525 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10526 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10527 @option{-fexcess-precision=fast}.
10528
10529 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10530
10531 This option is not turned on by any @option{-O} option besides
10532 @option{-Ofast} since it can result in incorrect output for programs
10533 that depend on an exact implementation of IEEE or ISO rules/specifications
10534 for math functions. It may, however, yield faster code for programs
10535 that do not require the guarantees of these specifications.
10536
10537 @item -fno-math-errno
10538 @opindex fno-math-errno
10539 @opindex fmath-errno
10540 Do not set @code{errno} after calling math functions that are executed
10541 with a single instruction, e.g., @code{sqrt}. A program that relies on
10542 IEEE exceptions for math error handling may want to use this flag
10543 for speed while maintaining IEEE arithmetic compatibility.
10544
10545 This option is not turned on by any @option{-O} option since
10546 it can result in incorrect output for programs that depend on
10547 an exact implementation of IEEE or ISO rules/specifications for
10548 math functions. It may, however, yield faster code for programs
10549 that do not require the guarantees of these specifications.
10550
10551 The default is @option{-fmath-errno}.
10552
10553 On Darwin systems, the math library never sets @code{errno}. There is
10554 therefore no reason for the compiler to consider the possibility that
10555 it might, and @option{-fno-math-errno} is the default.
10556
10557 @item -funsafe-math-optimizations
10558 @opindex funsafe-math-optimizations
10559
10560 Allow optimizations for floating-point arithmetic that (a) assume
10561 that arguments and results are valid and (b) may violate IEEE or
10562 ANSI standards. When used at link time, it may include libraries
10563 or startup files that change the default FPU control word or other
10564 similar optimizations.
10565
10566 This option is not turned on by any @option{-O} option since
10567 it can result in incorrect output for programs that depend on
10568 an exact implementation of IEEE or ISO rules/specifications for
10569 math functions. It may, however, yield faster code for programs
10570 that do not require the guarantees of these specifications.
10571 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10572 @option{-fassociative-math} and @option{-freciprocal-math}.
10573
10574 The default is @option{-fno-unsafe-math-optimizations}.
10575
10576 @item -fassociative-math
10577 @opindex fassociative-math
10578
10579 Allow re-association of operands in series of floating-point operations.
10580 This violates the ISO C and C++ language standard by possibly changing
10581 computation result. NOTE: re-ordering may change the sign of zero as
10582 well as ignore NaNs and inhibit or create underflow or overflow (and
10583 thus cannot be used on code that relies on rounding behavior like
10584 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10585 and thus may not be used when ordered comparisons are required.
10586 This option requires that both @option{-fno-signed-zeros} and
10587 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10588 much sense with @option{-frounding-math}. For Fortran the option
10589 is automatically enabled when both @option{-fno-signed-zeros} and
10590 @option{-fno-trapping-math} are in effect.
10591
10592 The default is @option{-fno-associative-math}.
10593
10594 @item -freciprocal-math
10595 @opindex freciprocal-math
10596
10597 Allow the reciprocal of a value to be used instead of dividing by
10598 the value if this enables optimizations. For example @code{x / y}
10599 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10600 is subject to common subexpression elimination. Note that this loses
10601 precision and increases the number of flops operating on the value.
10602
10603 The default is @option{-fno-reciprocal-math}.
10604
10605 @item -ffinite-math-only
10606 @opindex ffinite-math-only
10607 Allow optimizations for floating-point arithmetic that assume
10608 that arguments and results are not NaNs or +-Infs.
10609
10610 This option is not turned on by any @option{-O} option since
10611 it can result in incorrect output for programs that depend on
10612 an exact implementation of IEEE or ISO rules/specifications for
10613 math functions. It may, however, yield faster code for programs
10614 that do not require the guarantees of these specifications.
10615
10616 The default is @option{-fno-finite-math-only}.
10617
10618 @item -fno-signed-zeros
10619 @opindex fno-signed-zeros
10620 @opindex fsigned-zeros
10621 Allow optimizations for floating-point arithmetic that ignore the
10622 signedness of zero. IEEE arithmetic specifies the behavior of
10623 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10624 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10625 This option implies that the sign of a zero result isn't significant.
10626
10627 The default is @option{-fsigned-zeros}.
10628
10629 @item -fno-trapping-math
10630 @opindex fno-trapping-math
10631 @opindex ftrapping-math
10632 Compile code assuming that floating-point operations cannot generate
10633 user-visible traps. These traps include division by zero, overflow,
10634 underflow, inexact result and invalid operation. This option requires
10635 that @option{-fno-signaling-nans} be in effect. Setting this option may
10636 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10637
10638 This option should never be turned on by any @option{-O} option since
10639 it can result in incorrect output for programs that depend on
10640 an exact implementation of IEEE or ISO rules/specifications for
10641 math functions.
10642
10643 The default is @option{-ftrapping-math}.
10644
10645 @item -frounding-math
10646 @opindex frounding-math
10647 Disable transformations and optimizations that assume default floating-point
10648 rounding behavior. This is round-to-zero for all floating point
10649 to integer conversions, and round-to-nearest for all other arithmetic
10650 truncations. This option should be specified for programs that change
10651 the FP rounding mode dynamically, or that may be executed with a
10652 non-default rounding mode. This option disables constant folding of
10653 floating-point expressions at compile time (which may be affected by
10654 rounding mode) and arithmetic transformations that are unsafe in the
10655 presence of sign-dependent rounding modes.
10656
10657 The default is @option{-fno-rounding-math}.
10658
10659 This option is experimental and does not currently guarantee to
10660 disable all GCC optimizations that are affected by rounding mode.
10661 Future versions of GCC may provide finer control of this setting
10662 using C99's @code{FENV_ACCESS} pragma. This command-line option
10663 will be used to specify the default state for @code{FENV_ACCESS}.
10664
10665 @item -fsignaling-nans
10666 @opindex fsignaling-nans
10667 Compile code assuming that IEEE signaling NaNs may generate user-visible
10668 traps during floating-point operations. Setting this option disables
10669 optimizations that may change the number of exceptions visible with
10670 signaling NaNs. This option implies @option{-ftrapping-math}.
10671
10672 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10673 be defined.
10674
10675 The default is @option{-fno-signaling-nans}.
10676
10677 This option is experimental and does not currently guarantee to
10678 disable all GCC optimizations that affect signaling NaN behavior.
10679
10680 @item -fno-fp-int-builtin-inexact
10681 @opindex fno-fp-int-builtin-inexact
10682 @opindex ffp-int-builtin-inexact
10683 Do not allow the built-in functions @code{ceil}, @code{floor},
10684 @code{round} and @code{trunc}, and their @code{float} and @code{long
10685 double} variants, to generate code that raises the ``inexact''
10686 floating-point exception for noninteger arguments. ISO C99 and C11
10687 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10688 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10689 functions to do so.
10690
10691 The default is @option{-ffp-int-builtin-inexact}, allowing the
10692 exception to be raised. This option does nothing unless
10693 @option{-ftrapping-math} is in effect.
10694
10695 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10696 generate a call to a library function then the ``inexact'' exception
10697 may be raised if the library implementation does not follow TS 18661.
10698
10699 @item -fsingle-precision-constant
10700 @opindex fsingle-precision-constant
10701 Treat floating-point constants as single precision instead of
10702 implicitly converting them to double-precision constants.
10703
10704 @item -fcx-limited-range
10705 @opindex fcx-limited-range
10706 When enabled, this option states that a range reduction step is not
10707 needed when performing complex division. Also, there is no checking
10708 whether the result of a complex multiplication or division is @code{NaN
10709 + I*NaN}, with an attempt to rescue the situation in that case. The
10710 default is @option{-fno-cx-limited-range}, but is enabled by
10711 @option{-ffast-math}.
10712
10713 This option controls the default setting of the ISO C99
10714 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10715 all languages.
10716
10717 @item -fcx-fortran-rules
10718 @opindex fcx-fortran-rules
10719 Complex multiplication and division follow Fortran rules. Range
10720 reduction is done as part of complex division, but there is no checking
10721 whether the result of a complex multiplication or division is @code{NaN
10722 + I*NaN}, with an attempt to rescue the situation in that case.
10723
10724 The default is @option{-fno-cx-fortran-rules}.
10725
10726 @end table
10727
10728 The following options control optimizations that may improve
10729 performance, but are not enabled by any @option{-O} options. This
10730 section includes experimental options that may produce broken code.
10731
10732 @table @gcctabopt
10733 @item -fbranch-probabilities
10734 @opindex fbranch-probabilities
10735 After running a program compiled with @option{-fprofile-arcs}
10736 (@pxref{Instrumentation Options}),
10737 you can compile it a second time using
10738 @option{-fbranch-probabilities}, to improve optimizations based on
10739 the number of times each branch was taken. When a program
10740 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10741 counts to a file called @file{@var{sourcename}.gcda} for each source
10742 file. The information in this data file is very dependent on the
10743 structure of the generated code, so you must use the same source code
10744 and the same optimization options for both compilations.
10745
10746 With @option{-fbranch-probabilities}, GCC puts a
10747 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10748 These can be used to improve optimization. Currently, they are only
10749 used in one place: in @file{reorg.c}, instead of guessing which path a
10750 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10751 exactly determine which path is taken more often.
10752
10753 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10754
10755 @item -fprofile-values
10756 @opindex fprofile-values
10757 If combined with @option{-fprofile-arcs}, it adds code so that some
10758 data about values of expressions in the program is gathered.
10759
10760 With @option{-fbranch-probabilities}, it reads back the data gathered
10761 from profiling values of expressions for usage in optimizations.
10762
10763 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10764 @option{-fauto-profile}.
10765
10766 @item -fprofile-reorder-functions
10767 @opindex fprofile-reorder-functions
10768 Function reordering based on profile instrumentation collects
10769 first time of execution of a function and orders these functions
10770 in ascending order.
10771
10772 Enabled with @option{-fprofile-use}.
10773
10774 @item -fvpt
10775 @opindex fvpt
10776 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10777 to add code to gather information about values of expressions.
10778
10779 With @option{-fbranch-probabilities}, it reads back the data gathered
10780 and actually performs the optimizations based on them.
10781 Currently the optimizations include specialization of division operations
10782 using the knowledge about the value of the denominator.
10783
10784 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10785
10786 @item -frename-registers
10787 @opindex frename-registers
10788 Attempt to avoid false dependencies in scheduled code by making use
10789 of registers left over after register allocation. This optimization
10790 most benefits processors with lots of registers. Depending on the
10791 debug information format adopted by the target, however, it can
10792 make debugging impossible, since variables no longer stay in
10793 a ``home register''.
10794
10795 Enabled by default with @option{-funroll-loops}.
10796
10797 @item -fschedule-fusion
10798 @opindex fschedule-fusion
10799 Performs a target dependent pass over the instruction stream to schedule
10800 instructions of same type together because target machine can execute them
10801 more efficiently if they are adjacent to each other in the instruction flow.
10802
10803 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10804
10805 @item -ftracer
10806 @opindex ftracer
10807 Perform tail duplication to enlarge superblock size. This transformation
10808 simplifies the control flow of the function allowing other optimizations to do
10809 a better job.
10810
10811 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10812
10813 @item -funroll-loops
10814 @opindex funroll-loops
10815 Unroll loops whose number of iterations can be determined at compile time or
10816 upon entry to the loop. @option{-funroll-loops} implies
10817 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10818 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10819 a small constant number of iterations). This option makes code larger, and may
10820 or may not make it run faster.
10821
10822 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10823
10824 @item -funroll-all-loops
10825 @opindex funroll-all-loops
10826 Unroll all loops, even if their number of iterations is uncertain when
10827 the loop is entered. This usually makes programs run more slowly.
10828 @option{-funroll-all-loops} implies the same options as
10829 @option{-funroll-loops}.
10830
10831 @item -fpeel-loops
10832 @opindex fpeel-loops
10833 Peels loops for which there is enough information that they do not
10834 roll much (from profile feedback or static analysis). It also turns on
10835 complete loop peeling (i.e.@: complete removal of loops with small constant
10836 number of iterations).
10837
10838 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10839
10840 @item -fmove-loop-invariants
10841 @opindex fmove-loop-invariants
10842 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10843 at level @option{-O1} and higher, except for @option{-Og}.
10844
10845 @item -fsplit-loops
10846 @opindex fsplit-loops
10847 Split a loop into two if it contains a condition that's always true
10848 for one side of the iteration space and false for the other.
10849
10850 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10851
10852 @item -funswitch-loops
10853 @opindex funswitch-loops
10854 Move branches with loop invariant conditions out of the loop, with duplicates
10855 of the loop on both branches (modified according to result of the condition).
10856
10857 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10858
10859 @item -fversion-loops-for-strides
10860 @opindex fversion-loops-for-strides
10861 If a loop iterates over an array with a variable stride, create another
10862 version of the loop that assumes the stride is always one. For example:
10863
10864 @smallexample
10865 for (int i = 0; i < n; ++i)
10866 x[i * stride] = @dots{};
10867 @end smallexample
10868
10869 becomes:
10870
10871 @smallexample
10872 if (stride == 1)
10873 for (int i = 0; i < n; ++i)
10874 x[i] = @dots{};
10875 else
10876 for (int i = 0; i < n; ++i)
10877 x[i * stride] = @dots{};
10878 @end smallexample
10879
10880 This is particularly useful for assumed-shape arrays in Fortran where
10881 (for example) it allows better vectorization assuming contiguous accesses.
10882 This flag is enabled by default at @option{-O3}.
10883 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10884
10885 @item -ffunction-sections
10886 @itemx -fdata-sections
10887 @opindex ffunction-sections
10888 @opindex fdata-sections
10889 Place each function or data item into its own section in the output
10890 file if the target supports arbitrary sections. The name of the
10891 function or the name of the data item determines the section's name
10892 in the output file.
10893
10894 Use these options on systems where the linker can perform optimizations to
10895 improve locality of reference in the instruction space. Most systems using the
10896 ELF object format have linkers with such optimizations. On AIX, the linker
10897 rearranges sections (CSECTs) based on the call graph. The performance impact
10898 varies.
10899
10900 Together with a linker garbage collection (linker @option{--gc-sections}
10901 option) these options may lead to smaller statically-linked executables (after
10902 stripping).
10903
10904 On ELF/DWARF systems these options do not degenerate the quality of the debug
10905 information. There could be issues with other object files/debug info formats.
10906
10907 Only use these options when there are significant benefits from doing so. When
10908 you specify these options, the assembler and linker create larger object and
10909 executable files and are also slower. These options affect code generation.
10910 They prevent optimizations by the compiler and assembler using relative
10911 locations inside a translation unit since the locations are unknown until
10912 link time. An example of such an optimization is relaxing calls to short call
10913 instructions.
10914
10915 @item -fbranch-target-load-optimize
10916 @opindex fbranch-target-load-optimize
10917 Perform branch target register load optimization before prologue / epilogue
10918 threading.
10919 The use of target registers can typically be exposed only during reload,
10920 thus hoisting loads out of loops and doing inter-block scheduling needs
10921 a separate optimization pass.
10922
10923 @item -fbranch-target-load-optimize2
10924 @opindex fbranch-target-load-optimize2
10925 Perform branch target register load optimization after prologue / epilogue
10926 threading.
10927
10928 @item -fbtr-bb-exclusive
10929 @opindex fbtr-bb-exclusive
10930 When performing branch target register load optimization, don't reuse
10931 branch target registers within any basic block.
10932
10933 @item -fstdarg-opt
10934 @opindex fstdarg-opt
10935 Optimize the prologue of variadic argument functions with respect to usage of
10936 those arguments.
10937
10938 @item -fsection-anchors
10939 @opindex fsection-anchors
10940 Try to reduce the number of symbolic address calculations by using
10941 shared ``anchor'' symbols to address nearby objects. This transformation
10942 can help to reduce the number of GOT entries and GOT accesses on some
10943 targets.
10944
10945 For example, the implementation of the following function @code{foo}:
10946
10947 @smallexample
10948 static int a, b, c;
10949 int foo (void) @{ return a + b + c; @}
10950 @end smallexample
10951
10952 @noindent
10953 usually calculates the addresses of all three variables, but if you
10954 compile it with @option{-fsection-anchors}, it accesses the variables
10955 from a common anchor point instead. The effect is similar to the
10956 following pseudocode (which isn't valid C):
10957
10958 @smallexample
10959 int foo (void)
10960 @{
10961 register int *xr = &x;
10962 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10963 @}
10964 @end smallexample
10965
10966 Not all targets support this option.
10967
10968 @item --param @var{name}=@var{value}
10969 @opindex param
10970 In some places, GCC uses various constants to control the amount of
10971 optimization that is done. For example, GCC does not inline functions
10972 that contain more than a certain number of instructions. You can
10973 control some of these constants on the command line using the
10974 @option{--param} option.
10975
10976 The names of specific parameters, and the meaning of the values, are
10977 tied to the internals of the compiler, and are subject to change
10978 without notice in future releases.
10979
10980 In order to get minimal, maximal and default value of a parameter,
10981 one can use @option{--help=param -Q} options.
10982
10983 In each case, the @var{value} is an integer. The allowable choices for
10984 @var{name} are:
10985
10986 @table @gcctabopt
10987 @item predictable-branch-outcome
10988 When branch is predicted to be taken with probability lower than this threshold
10989 (in percent), then it is considered well predictable.
10990
10991 @item max-rtl-if-conversion-insns
10992 RTL if-conversion tries to remove conditional branches around a block and
10993 replace them with conditionally executed instructions. This parameter
10994 gives the maximum number of instructions in a block which should be
10995 considered for if-conversion. The compiler will
10996 also use other heuristics to decide whether if-conversion is likely to be
10997 profitable.
10998
10999 @item max-rtl-if-conversion-predictable-cost
11000 @itemx max-rtl-if-conversion-unpredictable-cost
11001 RTL if-conversion will try to remove conditional branches around a block
11002 and replace them with conditionally executed instructions. These parameters
11003 give the maximum permissible cost for the sequence that would be generated
11004 by if-conversion depending on whether the branch is statically determined
11005 to be predictable or not. The units for this parameter are the same as
11006 those for the GCC internal seq_cost metric. The compiler will try to
11007 provide a reasonable default for this parameter using the BRANCH_COST
11008 target macro.
11009
11010 @item max-crossjump-edges
11011 The maximum number of incoming edges to consider for cross-jumping.
11012 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11013 the number of edges incoming to each block. Increasing values mean
11014 more aggressive optimization, making the compilation time increase with
11015 probably small improvement in executable size.
11016
11017 @item min-crossjump-insns
11018 The minimum number of instructions that must be matched at the end
11019 of two blocks before cross-jumping is performed on them. This
11020 value is ignored in the case where all instructions in the block being
11021 cross-jumped from are matched.
11022
11023 @item max-grow-copy-bb-insns
11024 The maximum code size expansion factor when copying basic blocks
11025 instead of jumping. The expansion is relative to a jump instruction.
11026
11027 @item max-goto-duplication-insns
11028 The maximum number of instructions to duplicate to a block that jumps
11029 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11030 passes, GCC factors computed gotos early in the compilation process,
11031 and unfactors them as late as possible. Only computed jumps at the
11032 end of a basic blocks with no more than max-goto-duplication-insns are
11033 unfactored.
11034
11035 @item max-delay-slot-insn-search
11036 The maximum number of instructions to consider when looking for an
11037 instruction to fill a delay slot. If more than this arbitrary number of
11038 instructions are searched, the time savings from filling the delay slot
11039 are minimal, so stop searching. Increasing values mean more
11040 aggressive optimization, making the compilation time increase with probably
11041 small improvement in execution time.
11042
11043 @item max-delay-slot-live-search
11044 When trying to fill delay slots, the maximum number of instructions to
11045 consider when searching for a block with valid live register
11046 information. Increasing this arbitrarily chosen value means more
11047 aggressive optimization, increasing the compilation time. This parameter
11048 should be removed when the delay slot code is rewritten to maintain the
11049 control-flow graph.
11050
11051 @item max-gcse-memory
11052 The approximate maximum amount of memory that can be allocated in
11053 order to perform the global common subexpression elimination
11054 optimization. If more memory than specified is required, the
11055 optimization is not done.
11056
11057 @item max-gcse-insertion-ratio
11058 If the ratio of expression insertions to deletions is larger than this value
11059 for any expression, then RTL PRE inserts or removes the expression and thus
11060 leaves partially redundant computations in the instruction stream.
11061
11062 @item max-pending-list-length
11063 The maximum number of pending dependencies scheduling allows
11064 before flushing the current state and starting over. Large functions
11065 with few branches or calls can create excessively large lists which
11066 needlessly consume memory and resources.
11067
11068 @item max-modulo-backtrack-attempts
11069 The maximum number of backtrack attempts the scheduler should make
11070 when modulo scheduling a loop. Larger values can exponentially increase
11071 compilation time.
11072
11073 @item max-inline-insns-single
11074 Several parameters control the tree inliner used in GCC@.
11075 This number sets the maximum number of instructions (counted in GCC's
11076 internal representation) in a single function that the tree inliner
11077 considers for inlining. This only affects functions declared
11078 inline and methods implemented in a class declaration (C++).
11079
11080 @item max-inline-insns-auto
11081 When you use @option{-finline-functions} (included in @option{-O3}),
11082 a lot of functions that would otherwise not be considered for inlining
11083 by the compiler are investigated. To those functions, a different
11084 (more restrictive) limit compared to functions declared inline can
11085 be applied.
11086
11087 @item max-inline-insns-small
11088 This is bound applied to calls which are considered relevant with
11089 @option{-finline-small-functions}.
11090
11091 @item max-inline-insns-size
11092 This is bound applied to calls which are optimized for size. Small growth
11093 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11094
11095 @item uninlined-function-insns
11096 Number of instructions accounted by inliner for function overhead such as
11097 function prologue and epilogue.
11098
11099 @item uninlined-function-time
11100 Extra time accounted by inliner for function overhead such as time needed to
11101 execute function prologue and epilogue
11102
11103 @item uninlined-thunk-insns
11104 @item uninlined-thunk-time
11105 Same as @option{--param uninlined-function-insns} and
11106 @option{--param uninlined-function-time} but applied to function thunks
11107
11108 @item inline-min-speedup
11109 When estimated performance improvement of caller + callee runtime exceeds this
11110 threshold (in percent), the function can be inlined regardless of the limit on
11111 @option{--param max-inline-insns-single} and @option{--param
11112 max-inline-insns-auto}.
11113
11114 @item large-function-insns
11115 The limit specifying really large functions. For functions larger than this
11116 limit after inlining, inlining is constrained by
11117 @option{--param large-function-growth}. This parameter is useful primarily
11118 to avoid extreme compilation time caused by non-linear algorithms used by the
11119 back end.
11120
11121 @item large-function-growth
11122 Specifies maximal growth of large function caused by inlining in percents.
11123 For example, parameter value 100 limits large function growth to 2.0 times
11124 the original size.
11125
11126 @item large-unit-insns
11127 The limit specifying large translation unit. Growth caused by inlining of
11128 units larger than this limit is limited by @option{--param inline-unit-growth}.
11129 For small units this might be too tight.
11130 For example, consider a unit consisting of function A
11131 that is inline and B that just calls A three times. If B is small relative to
11132 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11133 large units consisting of small inlineable functions, however, the overall unit
11134 growth limit is needed to avoid exponential explosion of code size. Thus for
11135 smaller units, the size is increased to @option{--param large-unit-insns}
11136 before applying @option{--param inline-unit-growth}.
11137
11138 @item inline-unit-growth
11139 Specifies maximal overall growth of the compilation unit caused by inlining.
11140 For example, parameter value 20 limits unit growth to 1.2 times the original
11141 size. Cold functions (either marked cold via an attribute or by profile
11142 feedback) are not accounted into the unit size.
11143
11144 @item ipcp-unit-growth
11145 Specifies maximal overall growth of the compilation unit caused by
11146 interprocedural constant propagation. For example, parameter value 10 limits
11147 unit growth to 1.1 times the original size.
11148
11149 @item large-stack-frame
11150 The limit specifying large stack frames. While inlining the algorithm is trying
11151 to not grow past this limit too much.
11152
11153 @item large-stack-frame-growth
11154 Specifies maximal growth of large stack frames caused by inlining in percents.
11155 For example, parameter value 1000 limits large stack frame growth to 11 times
11156 the original size.
11157
11158 @item max-inline-insns-recursive
11159 @itemx max-inline-insns-recursive-auto
11160 Specifies the maximum number of instructions an out-of-line copy of a
11161 self-recursive inline
11162 function can grow into by performing recursive inlining.
11163
11164 @option{--param max-inline-insns-recursive} applies to functions
11165 declared inline.
11166 For functions not declared inline, recursive inlining
11167 happens only when @option{-finline-functions} (included in @option{-O3}) is
11168 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11169
11170 @item max-inline-recursive-depth
11171 @itemx max-inline-recursive-depth-auto
11172 Specifies the maximum recursion depth used for recursive inlining.
11173
11174 @option{--param max-inline-recursive-depth} applies to functions
11175 declared inline. For functions not declared inline, recursive inlining
11176 happens only when @option{-finline-functions} (included in @option{-O3}) is
11177 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11178
11179 @item min-inline-recursive-probability
11180 Recursive inlining is profitable only for function having deep recursion
11181 in average and can hurt for function having little recursion depth by
11182 increasing the prologue size or complexity of function body to other
11183 optimizers.
11184
11185 When profile feedback is available (see @option{-fprofile-generate}) the actual
11186 recursion depth can be guessed from the probability that function recurses
11187 via a given call expression. This parameter limits inlining only to call
11188 expressions whose probability exceeds the given threshold (in percents).
11189
11190 @item early-inlining-insns
11191 Specify growth that the early inliner can make. In effect it increases
11192 the amount of inlining for code having a large abstraction penalty.
11193
11194 @item max-early-inliner-iterations
11195 Limit of iterations of the early inliner. This basically bounds
11196 the number of nested indirect calls the early inliner can resolve.
11197 Deeper chains are still handled by late inlining.
11198
11199 @item comdat-sharing-probability
11200 Probability (in percent) that C++ inline function with comdat visibility
11201 are shared across multiple compilation units.
11202
11203 @item profile-func-internal-id
11204 A parameter to control whether to use function internal id in profile
11205 database lookup. If the value is 0, the compiler uses an id that
11206 is based on function assembler name and filename, which makes old profile
11207 data more tolerant to source changes such as function reordering etc.
11208
11209 @item min-vect-loop-bound
11210 The minimum number of iterations under which loops are not vectorized
11211 when @option{-ftree-vectorize} is used. The number of iterations after
11212 vectorization needs to be greater than the value specified by this option
11213 to allow vectorization.
11214
11215 @item gcse-cost-distance-ratio
11216 Scaling factor in calculation of maximum distance an expression
11217 can be moved by GCSE optimizations. This is currently supported only in the
11218 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11219 is with simple expressions, i.e., the expressions that have cost
11220 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11221 hoisting of simple expressions.
11222
11223 @item gcse-unrestricted-cost
11224 Cost, roughly measured as the cost of a single typical machine
11225 instruction, at which GCSE optimizations do not constrain
11226 the distance an expression can travel. This is currently
11227 supported only in the code hoisting pass. The lesser the cost,
11228 the more aggressive code hoisting is. Specifying 0
11229 allows all expressions to travel unrestricted distances.
11230
11231 @item max-hoist-depth
11232 The depth of search in the dominator tree for expressions to hoist.
11233 This is used to avoid quadratic behavior in hoisting algorithm.
11234 The value of 0 does not limit on the search, but may slow down compilation
11235 of huge functions.
11236
11237 @item max-tail-merge-comparisons
11238 The maximum amount of similar bbs to compare a bb with. This is used to
11239 avoid quadratic behavior in tree tail merging.
11240
11241 @item max-tail-merge-iterations
11242 The maximum amount of iterations of the pass over the function. This is used to
11243 limit compilation time in tree tail merging.
11244
11245 @item store-merging-allow-unaligned
11246 Allow the store merging pass to introduce unaligned stores if it is legal to
11247 do so.
11248
11249 @item max-stores-to-merge
11250 The maximum number of stores to attempt to merge into wider stores in the store
11251 merging pass.
11252
11253 @item max-unrolled-insns
11254 The maximum number of instructions that a loop may have to be unrolled.
11255 If a loop is unrolled, this parameter also determines how many times
11256 the loop code is unrolled.
11257
11258 @item max-average-unrolled-insns
11259 The maximum number of instructions biased by probabilities of their execution
11260 that a loop may have to be unrolled. If a loop is unrolled,
11261 this parameter also determines how many times the loop code is unrolled.
11262
11263 @item max-unroll-times
11264 The maximum number of unrollings of a single loop.
11265
11266 @item max-peeled-insns
11267 The maximum number of instructions that a loop may have to be peeled.
11268 If a loop is peeled, this parameter also determines how many times
11269 the loop code is peeled.
11270
11271 @item max-peel-times
11272 The maximum number of peelings of a single loop.
11273
11274 @item max-peel-branches
11275 The maximum number of branches on the hot path through the peeled sequence.
11276
11277 @item max-completely-peeled-insns
11278 The maximum number of insns of a completely peeled loop.
11279
11280 @item max-completely-peel-times
11281 The maximum number of iterations of a loop to be suitable for complete peeling.
11282
11283 @item max-completely-peel-loop-nest-depth
11284 The maximum depth of a loop nest suitable for complete peeling.
11285
11286 @item max-unswitch-insns
11287 The maximum number of insns of an unswitched loop.
11288
11289 @item max-unswitch-level
11290 The maximum number of branches unswitched in a single loop.
11291
11292 @item lim-expensive
11293 The minimum cost of an expensive expression in the loop invariant motion.
11294
11295 @item iv-consider-all-candidates-bound
11296 Bound on number of candidates for induction variables, below which
11297 all candidates are considered for each use in induction variable
11298 optimizations. If there are more candidates than this,
11299 only the most relevant ones are considered to avoid quadratic time complexity.
11300
11301 @item iv-max-considered-uses
11302 The induction variable optimizations give up on loops that contain more
11303 induction variable uses.
11304
11305 @item iv-always-prune-cand-set-bound
11306 If the number of candidates in the set is smaller than this value,
11307 always try to remove unnecessary ivs from the set
11308 when adding a new one.
11309
11310 @item avg-loop-niter
11311 Average number of iterations of a loop.
11312
11313 @item dse-max-object-size
11314 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11315 Larger values may result in larger compilation times.
11316
11317 @item dse-max-alias-queries-per-store
11318 Maximum number of queries into the alias oracle per store.
11319 Larger values result in larger compilation times and may result in more
11320 removed dead stores.
11321
11322 @item scev-max-expr-size
11323 Bound on size of expressions used in the scalar evolutions analyzer.
11324 Large expressions slow the analyzer.
11325
11326 @item scev-max-expr-complexity
11327 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11328 Complex expressions slow the analyzer.
11329
11330 @item max-tree-if-conversion-phi-args
11331 Maximum number of arguments in a PHI supported by TREE if conversion
11332 unless the loop is marked with simd pragma.
11333
11334 @item vect-max-version-for-alignment-checks
11335 The maximum number of run-time checks that can be performed when
11336 doing loop versioning for alignment in the vectorizer.
11337
11338 @item vect-max-version-for-alias-checks
11339 The maximum number of run-time checks that can be performed when
11340 doing loop versioning for alias in the vectorizer.
11341
11342 @item vect-max-peeling-for-alignment
11343 The maximum number of loop peels to enhance access alignment
11344 for vectorizer. Value -1 means no limit.
11345
11346 @item max-iterations-to-track
11347 The maximum number of iterations of a loop the brute-force algorithm
11348 for analysis of the number of iterations of the loop tries to evaluate.
11349
11350 @item hot-bb-count-ws-permille
11351 A basic block profile count is considered hot if it contributes to
11352 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11353
11354 @item hot-bb-frequency-fraction
11355 Select fraction of the entry block frequency of executions of basic block in
11356 function given basic block needs to have to be considered hot.
11357
11358 @item max-predicted-iterations
11359 The maximum number of loop iterations we predict statically. This is useful
11360 in cases where a function contains a single loop with known bound and
11361 another loop with unknown bound.
11362 The known number of iterations is predicted correctly, while
11363 the unknown number of iterations average to roughly 10. This means that the
11364 loop without bounds appears artificially cold relative to the other one.
11365
11366 @item builtin-expect-probability
11367 Control the probability of the expression having the specified value. This
11368 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11369
11370 @item builtin-string-cmp-inline-length
11371 The maximum length of a constant string for a builtin string cmp call
11372 eligible for inlining.
11373
11374 @item align-threshold
11375
11376 Select fraction of the maximal frequency of executions of a basic block in
11377 a function to align the basic block.
11378
11379 @item align-loop-iterations
11380
11381 A loop expected to iterate at least the selected number of iterations is
11382 aligned.
11383
11384 @item tracer-dynamic-coverage
11385 @itemx tracer-dynamic-coverage-feedback
11386
11387 This value is used to limit superblock formation once the given percentage of
11388 executed instructions is covered. This limits unnecessary code size
11389 expansion.
11390
11391 The @option{tracer-dynamic-coverage-feedback} parameter
11392 is used only when profile
11393 feedback is available. The real profiles (as opposed to statically estimated
11394 ones) are much less balanced allowing the threshold to be larger value.
11395
11396 @item tracer-max-code-growth
11397 Stop tail duplication once code growth has reached given percentage. This is
11398 a rather artificial limit, as most of the duplicates are eliminated later in
11399 cross jumping, so it may be set to much higher values than is the desired code
11400 growth.
11401
11402 @item tracer-min-branch-ratio
11403
11404 Stop reverse growth when the reverse probability of best edge is less than this
11405 threshold (in percent).
11406
11407 @item tracer-min-branch-probability
11408 @itemx tracer-min-branch-probability-feedback
11409
11410 Stop forward growth if the best edge has probability lower than this
11411 threshold.
11412
11413 Similarly to @option{tracer-dynamic-coverage} two parameters are
11414 provided. @option{tracer-min-branch-probability-feedback} is used for
11415 compilation with profile feedback and @option{tracer-min-branch-probability}
11416 compilation without. The value for compilation with profile feedback
11417 needs to be more conservative (higher) in order to make tracer
11418 effective.
11419
11420 @item stack-clash-protection-guard-size
11421 Specify the size of the operating system provided stack guard as
11422 2 raised to @var{num} bytes. Higher values may reduce the
11423 number of explicit probes, but a value larger than the operating system
11424 provided guard will leave code vulnerable to stack clash style attacks.
11425
11426 @item stack-clash-protection-probe-interval
11427 Stack clash protection involves probing stack space as it is allocated. This
11428 param controls the maximum distance between probes into the stack as 2 raised
11429 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11430 larger than the operating system provided guard will leave code vulnerable to
11431 stack clash style attacks.
11432
11433 @item max-cse-path-length
11434
11435 The maximum number of basic blocks on path that CSE considers.
11436
11437 @item max-cse-insns
11438 The maximum number of instructions CSE processes before flushing.
11439
11440 @item ggc-min-expand
11441
11442 GCC uses a garbage collector to manage its own memory allocation. This
11443 parameter specifies the minimum percentage by which the garbage
11444 collector's heap should be allowed to expand between collections.
11445 Tuning this may improve compilation speed; it has no effect on code
11446 generation.
11447
11448 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11449 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11450 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11451 GCC is not able to calculate RAM on a particular platform, the lower
11452 bound of 30% is used. Setting this parameter and
11453 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11454 every opportunity. This is extremely slow, but can be useful for
11455 debugging.
11456
11457 @item ggc-min-heapsize
11458
11459 Minimum size of the garbage collector's heap before it begins bothering
11460 to collect garbage. The first collection occurs after the heap expands
11461 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11462 tuning this may improve compilation speed, and has no effect on code
11463 generation.
11464
11465 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11466 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11467 with a lower bound of 4096 (four megabytes) and an upper bound of
11468 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11469 particular platform, the lower bound is used. Setting this parameter
11470 very large effectively disables garbage collection. Setting this
11471 parameter and @option{ggc-min-expand} to zero causes a full collection
11472 to occur at every opportunity.
11473
11474 @item max-reload-search-insns
11475 The maximum number of instruction reload should look backward for equivalent
11476 register. Increasing values mean more aggressive optimization, making the
11477 compilation time increase with probably slightly better performance.
11478
11479 @item max-cselib-memory-locations
11480 The maximum number of memory locations cselib should take into account.
11481 Increasing values mean more aggressive optimization, making the compilation time
11482 increase with probably slightly better performance.
11483
11484 @item max-sched-ready-insns
11485 The maximum number of instructions ready to be issued the scheduler should
11486 consider at any given time during the first scheduling pass. Increasing
11487 values mean more thorough searches, making the compilation time increase
11488 with probably little benefit.
11489
11490 @item max-sched-region-blocks
11491 The maximum number of blocks in a region to be considered for
11492 interblock scheduling.
11493
11494 @item max-pipeline-region-blocks
11495 The maximum number of blocks in a region to be considered for
11496 pipelining in the selective scheduler.
11497
11498 @item max-sched-region-insns
11499 The maximum number of insns in a region to be considered for
11500 interblock scheduling.
11501
11502 @item max-pipeline-region-insns
11503 The maximum number of insns in a region to be considered for
11504 pipelining in the selective scheduler.
11505
11506 @item min-spec-prob
11507 The minimum probability (in percents) of reaching a source block
11508 for interblock speculative scheduling.
11509
11510 @item max-sched-extend-regions-iters
11511 The maximum number of iterations through CFG to extend regions.
11512 A value of 0 disables region extensions.
11513
11514 @item max-sched-insn-conflict-delay
11515 The maximum conflict delay for an insn to be considered for speculative motion.
11516
11517 @item sched-spec-prob-cutoff
11518 The minimal probability of speculation success (in percents), so that
11519 speculative insns are scheduled.
11520
11521 @item sched-state-edge-prob-cutoff
11522 The minimum probability an edge must have for the scheduler to save its
11523 state across it.
11524
11525 @item sched-mem-true-dep-cost
11526 Minimal distance (in CPU cycles) between store and load targeting same
11527 memory locations.
11528
11529 @item selsched-max-lookahead
11530 The maximum size of the lookahead window of selective scheduling. It is a
11531 depth of search for available instructions.
11532
11533 @item selsched-max-sched-times
11534 The maximum number of times that an instruction is scheduled during
11535 selective scheduling. This is the limit on the number of iterations
11536 through which the instruction may be pipelined.
11537
11538 @item selsched-insns-to-rename
11539 The maximum number of best instructions in the ready list that are considered
11540 for renaming in the selective scheduler.
11541
11542 @item sms-min-sc
11543 The minimum value of stage count that swing modulo scheduler
11544 generates.
11545
11546 @item max-last-value-rtl
11547 The maximum size measured as number of RTLs that can be recorded in an expression
11548 in combiner for a pseudo register as last known value of that register.
11549
11550 @item max-combine-insns
11551 The maximum number of instructions the RTL combiner tries to combine.
11552
11553 @item integer-share-limit
11554 Small integer constants can use a shared data structure, reducing the
11555 compiler's memory usage and increasing its speed. This sets the maximum
11556 value of a shared integer constant.
11557
11558 @item ssp-buffer-size
11559 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11560 protection when @option{-fstack-protection} is used.
11561
11562 @item min-size-for-stack-sharing
11563 The minimum size of variables taking part in stack slot sharing when not
11564 optimizing.
11565
11566 @item max-jump-thread-duplication-stmts
11567 Maximum number of statements allowed in a block that needs to be
11568 duplicated when threading jumps.
11569
11570 @item max-fields-for-field-sensitive
11571 Maximum number of fields in a structure treated in
11572 a field sensitive manner during pointer analysis.
11573
11574 @item prefetch-latency
11575 Estimate on average number of instructions that are executed before
11576 prefetch finishes. The distance prefetched ahead is proportional
11577 to this constant. Increasing this number may also lead to less
11578 streams being prefetched (see @option{simultaneous-prefetches}).
11579
11580 @item simultaneous-prefetches
11581 Maximum number of prefetches that can run at the same time.
11582
11583 @item l1-cache-line-size
11584 The size of cache line in L1 data cache, in bytes.
11585
11586 @item l1-cache-size
11587 The size of L1 data cache, in kilobytes.
11588
11589 @item l2-cache-size
11590 The size of L2 data cache, in kilobytes.
11591
11592 @item prefetch-dynamic-strides
11593 Whether the loop array prefetch pass should issue software prefetch hints
11594 for strides that are non-constant. In some cases this may be
11595 beneficial, though the fact the stride is non-constant may make it
11596 hard to predict when there is clear benefit to issuing these hints.
11597
11598 Set to 1 if the prefetch hints should be issued for non-constant
11599 strides. Set to 0 if prefetch hints should be issued only for strides that
11600 are known to be constant and below @option{prefetch-minimum-stride}.
11601
11602 @item prefetch-minimum-stride
11603 Minimum constant stride, in bytes, to start using prefetch hints for. If
11604 the stride is less than this threshold, prefetch hints will not be issued.
11605
11606 This setting is useful for processors that have hardware prefetchers, in
11607 which case there may be conflicts between the hardware prefetchers and
11608 the software prefetchers. If the hardware prefetchers have a maximum
11609 stride they can handle, it should be used here to improve the use of
11610 software prefetchers.
11611
11612 A value of -1 means we don't have a threshold and therefore
11613 prefetch hints can be issued for any constant stride.
11614
11615 This setting is only useful for strides that are known and constant.
11616
11617 @item loop-interchange-max-num-stmts
11618 The maximum number of stmts in a loop to be interchanged.
11619
11620 @item loop-interchange-stride-ratio
11621 The minimum ratio between stride of two loops for interchange to be profitable.
11622
11623 @item min-insn-to-prefetch-ratio
11624 The minimum ratio between the number of instructions and the
11625 number of prefetches to enable prefetching in a loop.
11626
11627 @item prefetch-min-insn-to-mem-ratio
11628 The minimum ratio between the number of instructions and the
11629 number of memory references to enable prefetching in a loop.
11630
11631 @item use-canonical-types
11632 Whether the compiler should use the ``canonical'' type system.
11633 Should always be 1, which uses a more efficient internal
11634 mechanism for comparing types in C++ and Objective-C++. However, if
11635 bugs in the canonical type system are causing compilation failures,
11636 set this value to 0 to disable canonical types.
11637
11638 @item switch-conversion-max-branch-ratio
11639 Switch initialization conversion refuses to create arrays that are
11640 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11641 branches in the switch.
11642
11643 @item max-partial-antic-length
11644 Maximum length of the partial antic set computed during the tree
11645 partial redundancy elimination optimization (@option{-ftree-pre}) when
11646 optimizing at @option{-O3} and above. For some sorts of source code
11647 the enhanced partial redundancy elimination optimization can run away,
11648 consuming all of the memory available on the host machine. This
11649 parameter sets a limit on the length of the sets that are computed,
11650 which prevents the runaway behavior. Setting a value of 0 for
11651 this parameter allows an unlimited set length.
11652
11653 @item rpo-vn-max-loop-depth
11654 Maximum loop depth that is value-numbered optimistically.
11655 When the limit hits the innermost
11656 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11657 loop nest are value-numbered optimistically and the remaining ones not.
11658
11659 @item sccvn-max-alias-queries-per-access
11660 Maximum number of alias-oracle queries we perform when looking for
11661 redundancies for loads and stores. If this limit is hit the search
11662 is aborted and the load or store is not considered redundant. The
11663 number of queries is algorithmically limited to the number of
11664 stores on all paths from the load to the function entry.
11665
11666 @item ira-max-loops-num
11667 IRA uses regional register allocation by default. If a function
11668 contains more loops than the number given by this parameter, only at most
11669 the given number of the most frequently-executed loops form regions
11670 for regional register allocation.
11671
11672 @item ira-max-conflict-table-size
11673 Although IRA uses a sophisticated algorithm to compress the conflict
11674 table, the table can still require excessive amounts of memory for
11675 huge functions. If the conflict table for a function could be more
11676 than the size in MB given by this parameter, the register allocator
11677 instead uses a faster, simpler, and lower-quality
11678 algorithm that does not require building a pseudo-register conflict table.
11679
11680 @item ira-loop-reserved-regs
11681 IRA can be used to evaluate more accurate register pressure in loops
11682 for decisions to move loop invariants (see @option{-O3}). The number
11683 of available registers reserved for some other purposes is given
11684 by this parameter. Default of the parameter
11685 is the best found from numerous experiments.
11686
11687 @item lra-inheritance-ebb-probability-cutoff
11688 LRA tries to reuse values reloaded in registers in subsequent insns.
11689 This optimization is called inheritance. EBB is used as a region to
11690 do this optimization. The parameter defines a minimal fall-through
11691 edge probability in percentage used to add BB to inheritance EBB in
11692 LRA. The default value was chosen
11693 from numerous runs of SPEC2000 on x86-64.
11694
11695 @item loop-invariant-max-bbs-in-loop
11696 Loop invariant motion can be very expensive, both in compilation time and
11697 in amount of needed compile-time memory, with very large loops. Loops
11698 with more basic blocks than this parameter won't have loop invariant
11699 motion optimization performed on them.
11700
11701 @item loop-max-datarefs-for-datadeps
11702 Building data dependencies is expensive for very large loops. This
11703 parameter limits the number of data references in loops that are
11704 considered for data dependence analysis. These large loops are no
11705 handled by the optimizations using loop data dependencies.
11706
11707 @item max-vartrack-size
11708 Sets a maximum number of hash table slots to use during variable
11709 tracking dataflow analysis of any function. If this limit is exceeded
11710 with variable tracking at assignments enabled, analysis for that
11711 function is retried without it, after removing all debug insns from
11712 the function. If the limit is exceeded even without debug insns, var
11713 tracking analysis is completely disabled for the function. Setting
11714 the parameter to zero makes it unlimited.
11715
11716 @item max-vartrack-expr-depth
11717 Sets a maximum number of recursion levels when attempting to map
11718 variable names or debug temporaries to value expressions. This trades
11719 compilation time for more complete debug information. If this is set too
11720 low, value expressions that are available and could be represented in
11721 debug information may end up not being used; setting this higher may
11722 enable the compiler to find more complex debug expressions, but compile
11723 time and memory use may grow.
11724
11725 @item max-debug-marker-count
11726 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11727 markers) to avoid complexity explosion at inlining or expanding to RTL.
11728 If a function has more such gimple stmts than the set limit, such stmts
11729 will be dropped from the inlined copy of a function, and from its RTL
11730 expansion.
11731
11732 @item min-nondebug-insn-uid
11733 Use uids starting at this parameter for nondebug insns. The range below
11734 the parameter is reserved exclusively for debug insns created by
11735 @option{-fvar-tracking-assignments}, but debug insns may get
11736 (non-overlapping) uids above it if the reserved range is exhausted.
11737
11738 @item ipa-sra-ptr-growth-factor
11739 IPA-SRA replaces a pointer to an aggregate with one or more new
11740 parameters only when their cumulative size is less or equal to
11741 @option{ipa-sra-ptr-growth-factor} times the size of the original
11742 pointer parameter.
11743
11744 @item sra-max-scalarization-size-Ospeed
11745 @itemx sra-max-scalarization-size-Osize
11746 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11747 replace scalar parts of aggregates with uses of independent scalar
11748 variables. These parameters control the maximum size, in storage units,
11749 of aggregate which is considered for replacement when compiling for
11750 speed
11751 (@option{sra-max-scalarization-size-Ospeed}) or size
11752 (@option{sra-max-scalarization-size-Osize}) respectively.
11753
11754 @item tm-max-aggregate-size
11755 When making copies of thread-local variables in a transaction, this
11756 parameter specifies the size in bytes after which variables are
11757 saved with the logging functions as opposed to save/restore code
11758 sequence pairs. This option only applies when using
11759 @option{-fgnu-tm}.
11760
11761 @item graphite-max-nb-scop-params
11762 To avoid exponential effects in the Graphite loop transforms, the
11763 number of parameters in a Static Control Part (SCoP) is bounded.
11764 A value of zero can be used to lift
11765 the bound. A variable whose value is unknown at compilation time and
11766 defined outside a SCoP is a parameter of the SCoP.
11767
11768 @item loop-block-tile-size
11769 Loop blocking or strip mining transforms, enabled with
11770 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11771 loop in the loop nest by a given number of iterations. The strip
11772 length can be changed using the @option{loop-block-tile-size}
11773 parameter.
11774
11775 @item ipa-cp-value-list-size
11776 IPA-CP attempts to track all possible values and types passed to a function's
11777 parameter in order to propagate them and perform devirtualization.
11778 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11779 stores per one formal parameter of a function.
11780
11781 @item ipa-cp-eval-threshold
11782 IPA-CP calculates its own score of cloning profitability heuristics
11783 and performs those cloning opportunities with scores that exceed
11784 @option{ipa-cp-eval-threshold}.
11785
11786 @item ipa-cp-recursion-penalty
11787 Percentage penalty the recursive functions will receive when they
11788 are evaluated for cloning.
11789
11790 @item ipa-cp-single-call-penalty
11791 Percentage penalty functions containing a single call to another
11792 function will receive when they are evaluated for cloning.
11793
11794 @item ipa-max-agg-items
11795 IPA-CP is also capable to propagate a number of scalar values passed
11796 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11797 number of such values per one parameter.
11798
11799 @item ipa-cp-loop-hint-bonus
11800 When IPA-CP determines that a cloning candidate would make the number
11801 of iterations of a loop known, it adds a bonus of
11802 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11803 the candidate.
11804
11805 @item ipa-cp-array-index-hint-bonus
11806 When IPA-CP determines that a cloning candidate would make the index of
11807 an array access known, it adds a bonus of
11808 @option{ipa-cp-array-index-hint-bonus} to the profitability
11809 score of the candidate.
11810
11811 @item ipa-max-aa-steps
11812 During its analysis of function bodies, IPA-CP employs alias analysis
11813 in order to track values pointed to by function parameters. In order
11814 not spend too much time analyzing huge functions, it gives up and
11815 consider all memory clobbered after examining
11816 @option{ipa-max-aa-steps} statements modifying memory.
11817
11818 @item lto-partitions
11819 Specify desired number of partitions produced during WHOPR compilation.
11820 The number of partitions should exceed the number of CPUs used for compilation.
11821
11822 @item lto-min-partition
11823 Size of minimal partition for WHOPR (in estimated instructions).
11824 This prevents expenses of splitting very small programs into too many
11825 partitions.
11826
11827 @item lto-max-partition
11828 Size of max partition for WHOPR (in estimated instructions).
11829 to provide an upper bound for individual size of partition.
11830 Meant to be used only with balanced partitioning.
11831
11832 @item cxx-max-namespaces-for-diagnostic-help
11833 The maximum number of namespaces to consult for suggestions when C++
11834 name lookup fails for an identifier.
11835
11836 @item sink-frequency-threshold
11837 The maximum relative execution frequency (in percents) of the target block
11838 relative to a statement's original block to allow statement sinking of a
11839 statement. Larger numbers result in more aggressive statement sinking.
11840 A small positive adjustment is applied for
11841 statements with memory operands as those are even more profitable so sink.
11842
11843 @item max-stores-to-sink
11844 The maximum number of conditional store pairs that can be sunk. Set to 0
11845 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11846 (@option{-ftree-loop-if-convert}) is disabled.
11847
11848 @item allow-store-data-races
11849 Allow optimizers to introduce new data races on stores.
11850 Set to 1 to allow, otherwise to 0.
11851
11852 @item case-values-threshold
11853 The smallest number of different values for which it is best to use a
11854 jump-table instead of a tree of conditional branches. If the value is
11855 0, use the default for the machine.
11856
11857 @item tree-reassoc-width
11858 Set the maximum number of instructions executed in parallel in
11859 reassociated tree. This parameter overrides target dependent
11860 heuristics used by default if has non zero value.
11861
11862 @item sched-pressure-algorithm
11863 Choose between the two available implementations of
11864 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11865 and is the more likely to prevent instructions from being reordered.
11866 Algorithm 2 was designed to be a compromise between the relatively
11867 conservative approach taken by algorithm 1 and the rather aggressive
11868 approach taken by the default scheduler. It relies more heavily on
11869 having a regular register file and accurate register pressure classes.
11870 See @file{haifa-sched.c} in the GCC sources for more details.
11871
11872 The default choice depends on the target.
11873
11874 @item max-slsr-cand-scan
11875 Set the maximum number of existing candidates that are considered when
11876 seeking a basis for a new straight-line strength reduction candidate.
11877
11878 @item asan-globals
11879 Enable buffer overflow detection for global objects. This kind
11880 of protection is enabled by default if you are using
11881 @option{-fsanitize=address} option.
11882 To disable global objects protection use @option{--param asan-globals=0}.
11883
11884 @item asan-stack
11885 Enable buffer overflow detection for stack objects. This kind of
11886 protection is enabled by default when using @option{-fsanitize=address}.
11887 To disable stack protection use @option{--param asan-stack=0} option.
11888
11889 @item asan-instrument-reads
11890 Enable buffer overflow detection for memory reads. This kind of
11891 protection is enabled by default when using @option{-fsanitize=address}.
11892 To disable memory reads protection use
11893 @option{--param asan-instrument-reads=0}.
11894
11895 @item asan-instrument-writes
11896 Enable buffer overflow detection for memory writes. This kind of
11897 protection is enabled by default when using @option{-fsanitize=address}.
11898 To disable memory writes protection use
11899 @option{--param asan-instrument-writes=0} option.
11900
11901 @item asan-memintrin
11902 Enable detection for built-in functions. This kind of protection
11903 is enabled by default when using @option{-fsanitize=address}.
11904 To disable built-in functions protection use
11905 @option{--param asan-memintrin=0}.
11906
11907 @item asan-use-after-return
11908 Enable detection of use-after-return. This kind of protection
11909 is enabled by default when using the @option{-fsanitize=address} option.
11910 To disable it use @option{--param asan-use-after-return=0}.
11911
11912 Note: By default the check is disabled at run time. To enable it,
11913 add @code{detect_stack_use_after_return=1} to the environment variable
11914 @env{ASAN_OPTIONS}.
11915
11916 @item asan-instrumentation-with-call-threshold
11917 If number of memory accesses in function being instrumented
11918 is greater or equal to this number, use callbacks instead of inline checks.
11919 E.g. to disable inline code use
11920 @option{--param asan-instrumentation-with-call-threshold=0}.
11921
11922 @item use-after-scope-direct-emission-threshold
11923 If the size of a local variable in bytes is smaller or equal to this
11924 number, directly poison (or unpoison) shadow memory instead of using
11925 run-time callbacks.
11926
11927 @item max-fsm-thread-path-insns
11928 Maximum number of instructions to copy when duplicating blocks on a
11929 finite state automaton jump thread path.
11930
11931 @item max-fsm-thread-length
11932 Maximum number of basic blocks on a finite state automaton jump thread
11933 path.
11934
11935 @item max-fsm-thread-paths
11936 Maximum number of new jump thread paths to create for a finite state
11937 automaton.
11938
11939 @item parloops-chunk-size
11940 Chunk size of omp schedule for loops parallelized by parloops.
11941
11942 @item parloops-schedule
11943 Schedule type of omp schedule for loops parallelized by parloops (static,
11944 dynamic, guided, auto, runtime).
11945
11946 @item parloops-min-per-thread
11947 The minimum number of iterations per thread of an innermost parallelized
11948 loop for which the parallelized variant is preferred over the single threaded
11949 one. Note that for a parallelized loop nest the
11950 minimum number of iterations of the outermost loop per thread is two.
11951
11952 @item max-ssa-name-query-depth
11953 Maximum depth of recursion when querying properties of SSA names in things
11954 like fold routines. One level of recursion corresponds to following a
11955 use-def chain.
11956
11957 @item hsa-gen-debug-stores
11958 Enable emission of special debug stores within HSA kernels which are
11959 then read and reported by libgomp plugin. Generation of these stores
11960 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11961 enable it.
11962
11963 @item max-speculative-devirt-maydefs
11964 The maximum number of may-defs we analyze when looking for a must-def
11965 specifying the dynamic type of an object that invokes a virtual call
11966 we may be able to devirtualize speculatively.
11967
11968 @item max-vrp-switch-assertions
11969 The maximum number of assertions to add along the default edge of a switch
11970 statement during VRP.
11971
11972 @item unroll-jam-min-percent
11973 The minimum percentage of memory references that must be optimized
11974 away for the unroll-and-jam transformation to be considered profitable.
11975
11976 @item unroll-jam-max-unroll
11977 The maximum number of times the outer loop should be unrolled by
11978 the unroll-and-jam transformation.
11979
11980 @item max-rtl-if-conversion-unpredictable-cost
11981 Maximum permissible cost for the sequence that would be generated
11982 by the RTL if-conversion pass for a branch that is considered unpredictable.
11983
11984 @item max-variable-expansions-in-unroller
11985 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11986 of times that an individual variable will be expanded during loop unrolling.
11987
11988 @item tracer-min-branch-probability-feedback
11989 Stop forward growth if the probability of best edge is less than
11990 this threshold (in percent). Used when profile feedback is available.
11991
11992 @item partial-inlining-entry-probability
11993 Maximum probability of the entry BB of split region
11994 (in percent relative to entry BB of the function)
11995 to make partial inlining happen.
11996
11997 @item max-tracked-strlens
11998 Maximum number of strings for which strlen optimization pass will
11999 track string lengths.
12000
12001 @item gcse-after-reload-partial-fraction
12002 The threshold ratio for performing partial redundancy
12003 elimination after reload.
12004
12005 @item gcse-after-reload-critical-fraction
12006 The threshold ratio of critical edges execution count that
12007 permit performing redundancy elimination after reload.
12008
12009 @item max-loop-header-insns
12010 The maximum number of insns in loop header duplicated
12011 by the copy loop headers pass.
12012
12013 @item vect-epilogues-nomask
12014 Enable loop epilogue vectorization using smaller vector size.
12015
12016 @item slp-max-insns-in-bb
12017 Maximum number of instructions in basic block to be
12018 considered for SLP vectorization.
12019
12020 @item avoid-fma-max-bits
12021 Maximum number of bits for which we avoid creating FMAs.
12022
12023 @item sms-loop-average-count-threshold
12024 A threshold on the average loop count considered by the swing modulo scheduler.
12025
12026 @item sms-dfa-history
12027 The number of cycles the swing modulo scheduler considers when checking
12028 conflicts using DFA.
12029
12030 @item hot-bb-count-fraction
12031 Select fraction of the maximal count of repetitions of basic block
12032 in program given basic block needs
12033 to have to be considered hot (used in non-LTO mode)
12034
12035 @item max-inline-insns-recursive-auto
12036 The maximum number of instructions non-inline function
12037 can grow to via recursive inlining.
12038
12039 @item graphite-allow-codegen-errors
12040 Whether codegen errors should be ICEs when @option{-fchecking}.
12041
12042 @item sms-max-ii-factor
12043 A factor for tuning the upper bound that swing modulo scheduler
12044 uses for scheduling a loop.
12045
12046 @item lra-max-considered-reload-pseudos
12047 The max number of reload pseudos which are considered during
12048 spilling a non-reload pseudo.
12049
12050 @item max-pow-sqrt-depth
12051 Maximum depth of sqrt chains to use when synthesizing exponentiation
12052 by a real constant.
12053
12054 @item max-dse-active-local-stores
12055 Maximum number of active local stores in RTL dead store elimination.
12056
12057 @item asan-instrument-allocas
12058 Enable asan allocas/VLAs protection.
12059
12060 @item max-iterations-computation-cost
12061 Bound on the cost of an expression to compute the number of iterations.
12062
12063 @item max-isl-operations
12064 Maximum number of isl operations, 0 means unlimited.
12065
12066 @item graphite-max-arrays-per-scop
12067 Maximum number of arrays per scop.
12068
12069 @item max-vartrack-reverse-op-size
12070 Max. size of loc list for which reverse ops should be added.
12071
12072 @item unlikely-bb-count-fraction
12073 The minimum fraction of profile runs a given basic block execution count
12074 must be not to be considered unlikely.
12075
12076 @item tracer-dynamic-coverage-feedback
12077 The percentage of function, weighted by execution frequency,
12078 that must be covered by trace formation.
12079 Used when profile feedback is available.
12080
12081 @item max-inline-recursive-depth-auto
12082 The maximum depth of recursive inlining for non-inline functions.
12083
12084 @item fsm-scale-path-stmts
12085 Scale factor to apply to the number of statements in a threading path
12086 when comparing to the number of (scaled) blocks.
12087
12088 @item fsm-maximum-phi-arguments
12089 Maximum number of arguments a PHI may have before the FSM threader
12090 will not try to thread through its block.
12091
12092 @item uninit-control-dep-attempts
12093 Maximum number of nested calls to search for control dependencies
12094 during uninitialized variable analysis.
12095
12096 @item indir-call-topn-profile
12097 Track top N target addresses in indirect-call profile.
12098
12099 @item max-once-peeled-insns
12100 The maximum number of insns of a peeled loop that rolls only once.
12101
12102 @item sra-max-scalarization-size-Osize
12103 Maximum size, in storage units, of an aggregate
12104 which should be considered for scalarization when compiling for size.
12105
12106 @item fsm-scale-path-blocks
12107 Scale factor to apply to the number of blocks in a threading path
12108 when comparing to the number of (scaled) statements.
12109
12110 @item sched-autopref-queue-depth
12111 Hardware autoprefetcher scheduler model control flag.
12112 Number of lookahead cycles the model looks into; at '
12113 ' only enable instruction sorting heuristic.
12114
12115 @item loop-versioning-max-inner-insns
12116 The maximum number of instructions that an inner loop can have
12117 before the loop versioning pass considers it too big to copy.
12118
12119 @item loop-versioning-max-outer-insns
12120 The maximum number of instructions that an outer loop can have
12121 before the loop versioning pass considers it too big to copy,
12122 discounting any instructions in inner loops that directly benefit
12123 from versioning.
12124
12125 @end table
12126 @end table
12127
12128 @node Instrumentation Options
12129 @section Program Instrumentation Options
12130 @cindex instrumentation options
12131 @cindex program instrumentation options
12132 @cindex run-time error checking options
12133 @cindex profiling options
12134 @cindex options, program instrumentation
12135 @cindex options, run-time error checking
12136 @cindex options, profiling
12137
12138 GCC supports a number of command-line options that control adding
12139 run-time instrumentation to the code it normally generates.
12140 For example, one purpose of instrumentation is collect profiling
12141 statistics for use in finding program hot spots, code coverage
12142 analysis, or profile-guided optimizations.
12143 Another class of program instrumentation is adding run-time checking
12144 to detect programming errors like invalid pointer
12145 dereferences or out-of-bounds array accesses, as well as deliberately
12146 hostile attacks such as stack smashing or C++ vtable hijacking.
12147 There is also a general hook which can be used to implement other
12148 forms of tracing or function-level instrumentation for debug or
12149 program analysis purposes.
12150
12151 @table @gcctabopt
12152 @cindex @command{prof}
12153 @cindex @command{gprof}
12154 @item -p
12155 @itemx -pg
12156 @opindex p
12157 @opindex pg
12158 Generate extra code to write profile information suitable for the
12159 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12160 (for @option{-pg}). You must use this option when compiling
12161 the source files you want data about, and you must also use it when
12162 linking.
12163
12164 You can use the function attribute @code{no_instrument_function} to
12165 suppress profiling of individual functions when compiling with these options.
12166 @xref{Common Function Attributes}.
12167
12168 @item -fprofile-arcs
12169 @opindex fprofile-arcs
12170 Add code so that program flow @dfn{arcs} are instrumented. During
12171 execution the program records how many times each branch and call is
12172 executed and how many times it is taken or returns. On targets that support
12173 constructors with priority support, profiling properly handles constructors,
12174 destructors and C++ constructors (and destructors) of classes which are used
12175 as a type of a global variable.
12176
12177 When the compiled
12178 program exits it saves this data to a file called
12179 @file{@var{auxname}.gcda} for each source file. The data may be used for
12180 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12181 test coverage analysis (@option{-ftest-coverage}). Each object file's
12182 @var{auxname} is generated from the name of the output file, if
12183 explicitly specified and it is not the final executable, otherwise it is
12184 the basename of the source file. In both cases any suffix is removed
12185 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12186 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12187 @xref{Cross-profiling}.
12188
12189 @cindex @command{gcov}
12190 @item --coverage
12191 @opindex coverage
12192
12193 This option is used to compile and link code instrumented for coverage
12194 analysis. The option is a synonym for @option{-fprofile-arcs}
12195 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12196 linking). See the documentation for those options for more details.
12197
12198 @itemize
12199
12200 @item
12201 Compile the source files with @option{-fprofile-arcs} plus optimization
12202 and code generation options. For test coverage analysis, use the
12203 additional @option{-ftest-coverage} option. You do not need to profile
12204 every source file in a program.
12205
12206 @item
12207 Compile the source files additionally with @option{-fprofile-abs-path}
12208 to create absolute path names in the @file{.gcno} files. This allows
12209 @command{gcov} to find the correct sources in projects where compilations
12210 occur with different working directories.
12211
12212 @item
12213 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12214 (the latter implies the former).
12215
12216 @item
12217 Run the program on a representative workload to generate the arc profile
12218 information. This may be repeated any number of times. You can run
12219 concurrent instances of your program, and provided that the file system
12220 supports locking, the data files will be correctly updated. Unless
12221 a strict ISO C dialect option is in effect, @code{fork} calls are
12222 detected and correctly handled without double counting.
12223
12224 @item
12225 For profile-directed optimizations, compile the source files again with
12226 the same optimization and code generation options plus
12227 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12228 Control Optimization}).
12229
12230 @item
12231 For test coverage analysis, use @command{gcov} to produce human readable
12232 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12233 @command{gcov} documentation for further information.
12234
12235 @end itemize
12236
12237 With @option{-fprofile-arcs}, for each function of your program GCC
12238 creates a program flow graph, then finds a spanning tree for the graph.
12239 Only arcs that are not on the spanning tree have to be instrumented: the
12240 compiler adds code to count the number of times that these arcs are
12241 executed. When an arc is the only exit or only entrance to a block, the
12242 instrumentation code can be added to the block; otherwise, a new basic
12243 block must be created to hold the instrumentation code.
12244
12245 @need 2000
12246 @item -ftest-coverage
12247 @opindex ftest-coverage
12248 Produce a notes file that the @command{gcov} code-coverage utility
12249 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12250 show program coverage. Each source file's note file is called
12251 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12252 above for a description of @var{auxname} and instructions on how to
12253 generate test coverage data. Coverage data matches the source files
12254 more closely if you do not optimize.
12255
12256 @item -fprofile-abs-path
12257 @opindex fprofile-abs-path
12258 Automatically convert relative source file names to absolute path names
12259 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12260 sources in projects where compilations occur with different working
12261 directories.
12262
12263 @item -fprofile-dir=@var{path}
12264 @opindex fprofile-dir
12265
12266 Set the directory to search for the profile data files in to @var{path}.
12267 This option affects only the profile data generated by
12268 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12269 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12270 and its related options. Both absolute and relative paths can be used.
12271 By default, GCC uses the current directory as @var{path}, thus the
12272 profile data file appears in the same directory as the object file.
12273 In order to prevent the file name clashing, if the object file name is
12274 not an absolute path, we mangle the absolute path of the
12275 @file{@var{sourcename}.gcda} file and use it as the file name of a
12276 @file{.gcda} file.
12277
12278 When an executable is run in a massive parallel environment, it is recommended
12279 to save profile to different folders. That can be done with variables
12280 in @var{path} that are exported during run-time:
12281
12282 @table @gcctabopt
12283
12284 @item %p
12285 process ID.
12286
12287 @item %q@{VAR@}
12288 value of environment variable @var{VAR}
12289
12290 @end table
12291
12292 @item -fprofile-generate
12293 @itemx -fprofile-generate=@var{path}
12294 @opindex fprofile-generate
12295
12296 Enable options usually used for instrumenting application to produce
12297 profile useful for later recompilation with profile feedback based
12298 optimization. You must use @option{-fprofile-generate} both when
12299 compiling and when linking your program.
12300
12301 The following options are enabled:
12302 @option{-fprofile-arcs}, @option{-fprofile-values},
12303 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12304
12305 If @var{path} is specified, GCC looks at the @var{path} to find
12306 the profile feedback data files. See @option{-fprofile-dir}.
12307
12308 To optimize the program based on the collected profile information, use
12309 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12310
12311 @item -fprofile-update=@var{method}
12312 @opindex fprofile-update
12313
12314 Alter the update method for an application instrumented for profile
12315 feedback based optimization. The @var{method} argument should be one of
12316 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12317 The first one is useful for single-threaded applications,
12318 while the second one prevents profile corruption by emitting thread-safe code.
12319
12320 @strong{Warning:} When an application does not properly join all threads
12321 (or creates an detached thread), a profile file can be still corrupted.
12322
12323 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12324 when supported by a target, or to @samp{single} otherwise. The GCC driver
12325 automatically selects @samp{prefer-atomic} when @option{-pthread}
12326 is present in the command line.
12327
12328 @item -fprofile-filter-files=@var{regex}
12329 @opindex fprofile-filter-files
12330
12331 Instrument only functions from files where names match
12332 any regular expression (separated by a semi-colon).
12333
12334 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12335 only @file{main.c} and all C files starting with 'module'.
12336
12337 @item -fprofile-exclude-files=@var{regex}
12338 @opindex fprofile-exclude-files
12339
12340 Instrument only functions from files where names do not match
12341 all the regular expressions (separated by a semi-colon).
12342
12343 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12344 of all files that are located in @file{/usr/} folder.
12345
12346 @item -fsanitize=address
12347 @opindex fsanitize=address
12348 Enable AddressSanitizer, a fast memory error detector.
12349 Memory access instructions are instrumented to detect
12350 out-of-bounds and use-after-free bugs.
12351 The option enables @option{-fsanitize-address-use-after-scope}.
12352 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12353 more details. The run-time behavior can be influenced using the
12354 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12355 the available options are shown at startup of the instrumented program. See
12356 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12357 for a list of supported options.
12358 The option cannot be combined with @option{-fsanitize=thread}.
12359
12360 @item -fsanitize=kernel-address
12361 @opindex fsanitize=kernel-address
12362 Enable AddressSanitizer for Linux kernel.
12363 See @uref{https://github.com/google/kasan/wiki} for more details.
12364
12365 @item -fsanitize=pointer-compare
12366 @opindex fsanitize=pointer-compare
12367 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12368 The option must be combined with either @option{-fsanitize=kernel-address} or
12369 @option{-fsanitize=address}
12370 The option cannot be combined with @option{-fsanitize=thread}.
12371 Note: By default the check is disabled at run time. To enable it,
12372 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12373 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12374 invalid operation only when both pointers are non-null.
12375
12376 @item -fsanitize=pointer-subtract
12377 @opindex fsanitize=pointer-subtract
12378 Instrument subtraction with pointer operands.
12379 The option must be combined with either @option{-fsanitize=kernel-address} or
12380 @option{-fsanitize=address}
12381 The option cannot be combined with @option{-fsanitize=thread}.
12382 Note: By default the check is disabled at run time. To enable it,
12383 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12384 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12385 invalid operation only when both pointers are non-null.
12386
12387 @item -fsanitize=thread
12388 @opindex fsanitize=thread
12389 Enable ThreadSanitizer, a fast data race detector.
12390 Memory access instructions are instrumented to detect
12391 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12392 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12393 environment variable; see
12394 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12395 supported options.
12396 The option cannot be combined with @option{-fsanitize=address},
12397 @option{-fsanitize=leak}.
12398
12399 Note that sanitized atomic builtins cannot throw exceptions when
12400 operating on invalid memory addresses with non-call exceptions
12401 (@option{-fnon-call-exceptions}).
12402
12403 @item -fsanitize=leak
12404 @opindex fsanitize=leak
12405 Enable LeakSanitizer, a memory leak detector.
12406 This option only matters for linking of executables and
12407 the executable is linked against a library that overrides @code{malloc}
12408 and other allocator functions. See
12409 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12410 details. The run-time behavior can be influenced using the
12411 @env{LSAN_OPTIONS} environment variable.
12412 The option cannot be combined with @option{-fsanitize=thread}.
12413
12414 @item -fsanitize=undefined
12415 @opindex fsanitize=undefined
12416 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12417 Various computations are instrumented to detect undefined behavior
12418 at runtime. Current suboptions are:
12419
12420 @table @gcctabopt
12421
12422 @item -fsanitize=shift
12423 @opindex fsanitize=shift
12424 This option enables checking that the result of a shift operation is
12425 not undefined. Note that what exactly is considered undefined differs
12426 slightly between C and C++, as well as between ISO C90 and C99, etc.
12427 This option has two suboptions, @option{-fsanitize=shift-base} and
12428 @option{-fsanitize=shift-exponent}.
12429
12430 @item -fsanitize=shift-exponent
12431 @opindex fsanitize=shift-exponent
12432 This option enables checking that the second argument of a shift operation
12433 is not negative and is smaller than the precision of the promoted first
12434 argument.
12435
12436 @item -fsanitize=shift-base
12437 @opindex fsanitize=shift-base
12438 If the second argument of a shift operation is within range, check that the
12439 result of a shift operation is not undefined. Note that what exactly is
12440 considered undefined differs slightly between C and C++, as well as between
12441 ISO C90 and C99, etc.
12442
12443 @item -fsanitize=integer-divide-by-zero
12444 @opindex fsanitize=integer-divide-by-zero
12445 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12446
12447 @item -fsanitize=unreachable
12448 @opindex fsanitize=unreachable
12449 With this option, the compiler turns the @code{__builtin_unreachable}
12450 call into a diagnostics message call instead. When reaching the
12451 @code{__builtin_unreachable} call, the behavior is undefined.
12452
12453 @item -fsanitize=vla-bound
12454 @opindex fsanitize=vla-bound
12455 This option instructs the compiler to check that the size of a variable
12456 length array is positive.
12457
12458 @item -fsanitize=null
12459 @opindex fsanitize=null
12460 This option enables pointer checking. Particularly, the application
12461 built with this option turned on will issue an error message when it
12462 tries to dereference a NULL pointer, or if a reference (possibly an
12463 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12464 on an object pointed by a NULL pointer.
12465
12466 @item -fsanitize=return
12467 @opindex fsanitize=return
12468 This option enables return statement checking. Programs
12469 built with this option turned on will issue an error message
12470 when the end of a non-void function is reached without actually
12471 returning a value. This option works in C++ only.
12472
12473 @item -fsanitize=signed-integer-overflow
12474 @opindex fsanitize=signed-integer-overflow
12475 This option enables signed integer overflow checking. We check that
12476 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12477 does not overflow in the signed arithmetics. Note, integer promotion
12478 rules must be taken into account. That is, the following is not an
12479 overflow:
12480 @smallexample
12481 signed char a = SCHAR_MAX;
12482 a++;
12483 @end smallexample
12484
12485 @item -fsanitize=bounds
12486 @opindex fsanitize=bounds
12487 This option enables instrumentation of array bounds. Various out of bounds
12488 accesses are detected. Flexible array members, flexible array member-like
12489 arrays, and initializers of variables with static storage are not instrumented.
12490
12491 @item -fsanitize=bounds-strict
12492 @opindex fsanitize=bounds-strict
12493 This option enables strict instrumentation of array bounds. Most out of bounds
12494 accesses are detected, including flexible array members and flexible array
12495 member-like arrays. Initializers of variables with static storage are not
12496 instrumented.
12497
12498 @item -fsanitize=alignment
12499 @opindex fsanitize=alignment
12500
12501 This option enables checking of alignment of pointers when they are
12502 dereferenced, or when a reference is bound to insufficiently aligned target,
12503 or when a method or constructor is invoked on insufficiently aligned object.
12504
12505 @item -fsanitize=object-size
12506 @opindex fsanitize=object-size
12507 This option enables instrumentation of memory references using the
12508 @code{__builtin_object_size} function. Various out of bounds pointer
12509 accesses are detected.
12510
12511 @item -fsanitize=float-divide-by-zero
12512 @opindex fsanitize=float-divide-by-zero
12513 Detect floating-point division by zero. Unlike other similar options,
12514 @option{-fsanitize=float-divide-by-zero} is not enabled by
12515 @option{-fsanitize=undefined}, since floating-point division by zero can
12516 be a legitimate way of obtaining infinities and NaNs.
12517
12518 @item -fsanitize=float-cast-overflow
12519 @opindex fsanitize=float-cast-overflow
12520 This option enables floating-point type to integer conversion checking.
12521 We check that the result of the conversion does not overflow.
12522 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12523 not enabled by @option{-fsanitize=undefined}.
12524 This option does not work well with @code{FE_INVALID} exceptions enabled.
12525
12526 @item -fsanitize=nonnull-attribute
12527 @opindex fsanitize=nonnull-attribute
12528
12529 This option enables instrumentation of calls, checking whether null values
12530 are not passed to arguments marked as requiring a non-null value by the
12531 @code{nonnull} function attribute.
12532
12533 @item -fsanitize=returns-nonnull-attribute
12534 @opindex fsanitize=returns-nonnull-attribute
12535
12536 This option enables instrumentation of return statements in functions
12537 marked with @code{returns_nonnull} function attribute, to detect returning
12538 of null values from such functions.
12539
12540 @item -fsanitize=bool
12541 @opindex fsanitize=bool
12542
12543 This option enables instrumentation of loads from bool. If a value other
12544 than 0/1 is loaded, a run-time error is issued.
12545
12546 @item -fsanitize=enum
12547 @opindex fsanitize=enum
12548
12549 This option enables instrumentation of loads from an enum type. If
12550 a value outside the range of values for the enum type is loaded,
12551 a run-time error is issued.
12552
12553 @item -fsanitize=vptr
12554 @opindex fsanitize=vptr
12555
12556 This option enables instrumentation of C++ member function calls, member
12557 accesses and some conversions between pointers to base and derived classes,
12558 to verify the referenced object has the correct dynamic type.
12559
12560 @item -fsanitize=pointer-overflow
12561 @opindex fsanitize=pointer-overflow
12562
12563 This option enables instrumentation of pointer arithmetics. If the pointer
12564 arithmetics overflows, a run-time error is issued.
12565
12566 @item -fsanitize=builtin
12567 @opindex fsanitize=builtin
12568
12569 This option enables instrumentation of arguments to selected builtin
12570 functions. If an invalid value is passed to such arguments, a run-time
12571 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12572 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12573 by this option.
12574
12575 @end table
12576
12577 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12578 @option{-fsanitize=undefined} gives a diagnostic message.
12579 This currently works only for the C family of languages.
12580
12581 @item -fno-sanitize=all
12582 @opindex fno-sanitize=all
12583
12584 This option disables all previously enabled sanitizers.
12585 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12586 together.
12587
12588 @item -fasan-shadow-offset=@var{number}
12589 @opindex fasan-shadow-offset
12590 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12591 It is useful for experimenting with different shadow memory layouts in
12592 Kernel AddressSanitizer.
12593
12594 @item -fsanitize-sections=@var{s1},@var{s2},...
12595 @opindex fsanitize-sections
12596 Sanitize global variables in selected user-defined sections. @var{si} may
12597 contain wildcards.
12598
12599 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12600 @opindex fsanitize-recover
12601 @opindex fno-sanitize-recover
12602 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12603 mentioned in comma-separated list of @var{opts}. Enabling this option
12604 for a sanitizer component causes it to attempt to continue
12605 running the program as if no error happened. This means multiple
12606 runtime errors can be reported in a single program run, and the exit
12607 code of the program may indicate success even when errors
12608 have been reported. The @option{-fno-sanitize-recover=} option
12609 can be used to alter
12610 this behavior: only the first detected error is reported
12611 and program then exits with a non-zero exit code.
12612
12613 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12614 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12615 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12616 @option{-fsanitize=bounds-strict},
12617 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12618 For these sanitizers error recovery is turned on by default,
12619 except @option{-fsanitize=address}, for which this feature is experimental.
12620 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12621 accepted, the former enables recovery for all sanitizers that support it,
12622 the latter disables recovery for all sanitizers that support it.
12623
12624 Even if a recovery mode is turned on the compiler side, it needs to be also
12625 enabled on the runtime library side, otherwise the failures are still fatal.
12626 The runtime library defaults to @code{halt_on_error=0} for
12627 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12628 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12629 setting the @code{halt_on_error} flag in the corresponding environment variable.
12630
12631 Syntax without an explicit @var{opts} parameter is deprecated. It is
12632 equivalent to specifying an @var{opts} list of:
12633
12634 @smallexample
12635 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12636 @end smallexample
12637
12638 @item -fsanitize-address-use-after-scope
12639 @opindex fsanitize-address-use-after-scope
12640 Enable sanitization of local variables to detect use-after-scope bugs.
12641 The option sets @option{-fstack-reuse} to @samp{none}.
12642
12643 @item -fsanitize-undefined-trap-on-error
12644 @opindex fsanitize-undefined-trap-on-error
12645 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12646 report undefined behavior using @code{__builtin_trap} rather than
12647 a @code{libubsan} library routine. The advantage of this is that the
12648 @code{libubsan} library is not needed and is not linked in, so this
12649 is usable even in freestanding environments.
12650
12651 @item -fsanitize-coverage=trace-pc
12652 @opindex fsanitize-coverage=trace-pc
12653 Enable coverage-guided fuzzing code instrumentation.
12654 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12655
12656 @item -fsanitize-coverage=trace-cmp
12657 @opindex fsanitize-coverage=trace-cmp
12658 Enable dataflow guided fuzzing code instrumentation.
12659 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12660 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12661 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12662 variable or @code{__sanitizer_cov_trace_const_cmp1},
12663 @code{__sanitizer_cov_trace_const_cmp2},
12664 @code{__sanitizer_cov_trace_const_cmp4} or
12665 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12666 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12667 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12668 @code{__sanitizer_cov_trace_switch} for switch statements.
12669
12670 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12671 @opindex fcf-protection
12672 Enable code instrumentation of control-flow transfers to increase
12673 program security by checking that target addresses of control-flow
12674 transfer instructions (such as indirect function call, function return,
12675 indirect jump) are valid. This prevents diverting the flow of control
12676 to an unexpected target. This is intended to protect against such
12677 threats as Return-oriented Programming (ROP), and similarly
12678 call/jmp-oriented programming (COP/JOP).
12679
12680 The value @code{branch} tells the compiler to implement checking of
12681 validity of control-flow transfer at the point of indirect branch
12682 instructions, i.e.@: call/jmp instructions. The value @code{return}
12683 implements checking of validity at the point of returning from a
12684 function. The value @code{full} is an alias for specifying both
12685 @code{branch} and @code{return}. The value @code{none} turns off
12686 instrumentation.
12687
12688 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12689 used. The first bit of @code{__CET__} is set to 1 for the value
12690 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12691 the @code{return}.
12692
12693 You can also use the @code{nocf_check} attribute to identify
12694 which functions and calls should be skipped from instrumentation
12695 (@pxref{Function Attributes}).
12696
12697 Currently the x86 GNU/Linux target provides an implementation based
12698 on Intel Control-flow Enforcement Technology (CET).
12699
12700 @item -fstack-protector
12701 @opindex fstack-protector
12702 Emit extra code to check for buffer overflows, such as stack smashing
12703 attacks. This is done by adding a guard variable to functions with
12704 vulnerable objects. This includes functions that call @code{alloca}, and
12705 functions with buffers larger than 8 bytes. The guards are initialized
12706 when a function is entered and then checked when the function exits.
12707 If a guard check fails, an error message is printed and the program exits.
12708
12709 @item -fstack-protector-all
12710 @opindex fstack-protector-all
12711 Like @option{-fstack-protector} except that all functions are protected.
12712
12713 @item -fstack-protector-strong
12714 @opindex fstack-protector-strong
12715 Like @option{-fstack-protector} but includes additional functions to
12716 be protected --- those that have local array definitions, or have
12717 references to local frame addresses.
12718
12719 @item -fstack-protector-explicit
12720 @opindex fstack-protector-explicit
12721 Like @option{-fstack-protector} but only protects those functions which
12722 have the @code{stack_protect} attribute.
12723
12724 @item -fstack-check
12725 @opindex fstack-check
12726 Generate code to verify that you do not go beyond the boundary of the
12727 stack. You should specify this flag if you are running in an
12728 environment with multiple threads, but you only rarely need to specify it in
12729 a single-threaded environment since stack overflow is automatically
12730 detected on nearly all systems if there is only one stack.
12731
12732 Note that this switch does not actually cause checking to be done; the
12733 operating system or the language runtime must do that. The switch causes
12734 generation of code to ensure that they see the stack being extended.
12735
12736 You can additionally specify a string parameter: @samp{no} means no
12737 checking, @samp{generic} means force the use of old-style checking,
12738 @samp{specific} means use the best checking method and is equivalent
12739 to bare @option{-fstack-check}.
12740
12741 Old-style checking is a generic mechanism that requires no specific
12742 target support in the compiler but comes with the following drawbacks:
12743
12744 @enumerate
12745 @item
12746 Modified allocation strategy for large objects: they are always
12747 allocated dynamically if their size exceeds a fixed threshold. Note this
12748 may change the semantics of some code.
12749
12750 @item
12751 Fixed limit on the size of the static frame of functions: when it is
12752 topped by a particular function, stack checking is not reliable and
12753 a warning is issued by the compiler.
12754
12755 @item
12756 Inefficiency: because of both the modified allocation strategy and the
12757 generic implementation, code performance is hampered.
12758 @end enumerate
12759
12760 Note that old-style stack checking is also the fallback method for
12761 @samp{specific} if no target support has been added in the compiler.
12762
12763 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12764 and stack overflows. @samp{specific} is an excellent choice when compiling
12765 Ada code. It is not generally sufficient to protect against stack-clash
12766 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12767
12768 @item -fstack-clash-protection
12769 @opindex fstack-clash-protection
12770 Generate code to prevent stack clash style attacks. When this option is
12771 enabled, the compiler will only allocate one page of stack space at a time
12772 and each page is accessed immediately after allocation. Thus, it prevents
12773 allocations from jumping over any stack guard page provided by the
12774 operating system.
12775
12776 Most targets do not fully support stack clash protection. However, on
12777 those targets @option{-fstack-clash-protection} will protect dynamic stack
12778 allocations. @option{-fstack-clash-protection} may also provide limited
12779 protection for static stack allocations if the target supports
12780 @option{-fstack-check=specific}.
12781
12782 @item -fstack-limit-register=@var{reg}
12783 @itemx -fstack-limit-symbol=@var{sym}
12784 @itemx -fno-stack-limit
12785 @opindex fstack-limit-register
12786 @opindex fstack-limit-symbol
12787 @opindex fno-stack-limit
12788 Generate code to ensure that the stack does not grow beyond a certain value,
12789 either the value of a register or the address of a symbol. If a larger
12790 stack is required, a signal is raised at run time. For most targets,
12791 the signal is raised before the stack overruns the boundary, so
12792 it is possible to catch the signal without taking special precautions.
12793
12794 For instance, if the stack starts at absolute address @samp{0x80000000}
12795 and grows downwards, you can use the flags
12796 @option{-fstack-limit-symbol=__stack_limit} and
12797 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12798 of 128KB@. Note that this may only work with the GNU linker.
12799
12800 You can locally override stack limit checking by using the
12801 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12802
12803 @item -fsplit-stack
12804 @opindex fsplit-stack
12805 Generate code to automatically split the stack before it overflows.
12806 The resulting program has a discontiguous stack which can only
12807 overflow if the program is unable to allocate any more memory. This
12808 is most useful when running threaded programs, as it is no longer
12809 necessary to calculate a good stack size to use for each thread. This
12810 is currently only implemented for the x86 targets running
12811 GNU/Linux.
12812
12813 When code compiled with @option{-fsplit-stack} calls code compiled
12814 without @option{-fsplit-stack}, there may not be much stack space
12815 available for the latter code to run. If compiling all code,
12816 including library code, with @option{-fsplit-stack} is not an option,
12817 then the linker can fix up these calls so that the code compiled
12818 without @option{-fsplit-stack} always has a large stack. Support for
12819 this is implemented in the gold linker in GNU binutils release 2.21
12820 and later.
12821
12822 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12823 @opindex fvtable-verify
12824 This option is only available when compiling C++ code.
12825 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12826 feature that verifies at run time, for every virtual call, that
12827 the vtable pointer through which the call is made is valid for the type of
12828 the object, and has not been corrupted or overwritten. If an invalid vtable
12829 pointer is detected at run time, an error is reported and execution of the
12830 program is immediately halted.
12831
12832 This option causes run-time data structures to be built at program startup,
12833 which are used for verifying the vtable pointers.
12834 The options @samp{std} and @samp{preinit}
12835 control the timing of when these data structures are built. In both cases the
12836 data structures are built before execution reaches @code{main}. Using
12837 @option{-fvtable-verify=std} causes the data structures to be built after
12838 shared libraries have been loaded and initialized.
12839 @option{-fvtable-verify=preinit} causes them to be built before shared
12840 libraries have been loaded and initialized.
12841
12842 If this option appears multiple times in the command line with different
12843 values specified, @samp{none} takes highest priority over both @samp{std} and
12844 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12845
12846 @item -fvtv-debug
12847 @opindex fvtv-debug
12848 When used in conjunction with @option{-fvtable-verify=std} or
12849 @option{-fvtable-verify=preinit}, causes debug versions of the
12850 runtime functions for the vtable verification feature to be called.
12851 This flag also causes the compiler to log information about which
12852 vtable pointers it finds for each class.
12853 This information is written to a file named @file{vtv_set_ptr_data.log}
12854 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12855 if that is defined or the current working directory otherwise.
12856
12857 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12858 file, be sure to delete any existing one.
12859
12860 @item -fvtv-counts
12861 @opindex fvtv-counts
12862 This is a debugging flag. When used in conjunction with
12863 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12864 causes the compiler to keep track of the total number of virtual calls
12865 it encounters and the number of verifications it inserts. It also
12866 counts the number of calls to certain run-time library functions
12867 that it inserts and logs this information for each compilation unit.
12868 The compiler writes this information to a file named
12869 @file{vtv_count_data.log} in the directory named by the environment
12870 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12871 directory otherwise. It also counts the size of the vtable pointer sets
12872 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12873 in the same directory.
12874
12875 Note: This feature @emph{appends} data to the log files. To get fresh log
12876 files, be sure to delete any existing ones.
12877
12878 @item -finstrument-functions
12879 @opindex finstrument-functions
12880 Generate instrumentation calls for entry and exit to functions. Just
12881 after function entry and just before function exit, the following
12882 profiling functions are called with the address of the current
12883 function and its call site. (On some platforms,
12884 @code{__builtin_return_address} does not work beyond the current
12885 function, so the call site information may not be available to the
12886 profiling functions otherwise.)
12887
12888 @smallexample
12889 void __cyg_profile_func_enter (void *this_fn,
12890 void *call_site);
12891 void __cyg_profile_func_exit (void *this_fn,
12892 void *call_site);
12893 @end smallexample
12894
12895 The first argument is the address of the start of the current function,
12896 which may be looked up exactly in the symbol table.
12897
12898 This instrumentation is also done for functions expanded inline in other
12899 functions. The profiling calls indicate where, conceptually, the
12900 inline function is entered and exited. This means that addressable
12901 versions of such functions must be available. If all your uses of a
12902 function are expanded inline, this may mean an additional expansion of
12903 code size. If you use @code{extern inline} in your C code, an
12904 addressable version of such functions must be provided. (This is
12905 normally the case anyway, but if you get lucky and the optimizer always
12906 expands the functions inline, you might have gotten away without
12907 providing static copies.)
12908
12909 A function may be given the attribute @code{no_instrument_function}, in
12910 which case this instrumentation is not done. This can be used, for
12911 example, for the profiling functions listed above, high-priority
12912 interrupt routines, and any functions from which the profiling functions
12913 cannot safely be called (perhaps signal handlers, if the profiling
12914 routines generate output or allocate memory).
12915 @xref{Common Function Attributes}.
12916
12917 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12918 @opindex finstrument-functions-exclude-file-list
12919
12920 Set the list of functions that are excluded from instrumentation (see
12921 the description of @option{-finstrument-functions}). If the file that
12922 contains a function definition matches with one of @var{file}, then
12923 that function is not instrumented. The match is done on substrings:
12924 if the @var{file} parameter is a substring of the file name, it is
12925 considered to be a match.
12926
12927 For example:
12928
12929 @smallexample
12930 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12931 @end smallexample
12932
12933 @noindent
12934 excludes any inline function defined in files whose pathnames
12935 contain @file{/bits/stl} or @file{include/sys}.
12936
12937 If, for some reason, you want to include letter @samp{,} in one of
12938 @var{sym}, write @samp{\,}. For example,
12939 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12940 (note the single quote surrounding the option).
12941
12942 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12943 @opindex finstrument-functions-exclude-function-list
12944
12945 This is similar to @option{-finstrument-functions-exclude-file-list},
12946 but this option sets the list of function names to be excluded from
12947 instrumentation. The function name to be matched is its user-visible
12948 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12949 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12950 match is done on substrings: if the @var{sym} parameter is a substring
12951 of the function name, it is considered to be a match. For C99 and C++
12952 extended identifiers, the function name must be given in UTF-8, not
12953 using universal character names.
12954
12955 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12956 @opindex fpatchable-function-entry
12957 Generate @var{N} NOPs right at the beginning
12958 of each function, with the function entry point before the @var{M}th NOP.
12959 If @var{M} is omitted, it defaults to @code{0} so the
12960 function entry points to the address just at the first NOP.
12961 The NOP instructions reserve extra space which can be used to patch in
12962 any desired instrumentation at run time, provided that the code segment
12963 is writable. The amount of space is controllable indirectly via
12964 the number of NOPs; the NOP instruction used corresponds to the instruction
12965 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12966 is target-specific and may also depend on the architecture variant and/or
12967 other compilation options.
12968
12969 For run-time identification, the starting addresses of these areas,
12970 which correspond to their respective function entries minus @var{M},
12971 are additionally collected in the @code{__patchable_function_entries}
12972 section of the resulting binary.
12973
12974 Note that the value of @code{__attribute__ ((patchable_function_entry
12975 (N,M)))} takes precedence over command-line option
12976 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12977 the area size or to remove it completely on a single function.
12978 If @code{N=0}, no pad location is recorded.
12979
12980 The NOP instructions are inserted at---and maybe before, depending on
12981 @var{M}---the function entry address, even before the prologue.
12982
12983 @end table
12984
12985
12986 @node Preprocessor Options
12987 @section Options Controlling the Preprocessor
12988 @cindex preprocessor options
12989 @cindex options, preprocessor
12990
12991 These options control the C preprocessor, which is run on each C source
12992 file before actual compilation.
12993
12994 If you use the @option{-E} option, nothing is done except preprocessing.
12995 Some of these options make sense only together with @option{-E} because
12996 they cause the preprocessor output to be unsuitable for actual
12997 compilation.
12998
12999 In addition to the options listed here, there are a number of options
13000 to control search paths for include files documented in
13001 @ref{Directory Options}.
13002 Options to control preprocessor diagnostics are listed in
13003 @ref{Warning Options}.
13004
13005 @table @gcctabopt
13006 @include cppopts.texi
13007
13008 @item -Wp,@var{option}
13009 @opindex Wp
13010 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13011 and pass @var{option} directly through to the preprocessor. If
13012 @var{option} contains commas, it is split into multiple options at the
13013 commas. However, many options are modified, translated or interpreted
13014 by the compiler driver before being passed to the preprocessor, and
13015 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13016 interface is undocumented and subject to change, so whenever possible
13017 you should avoid using @option{-Wp} and let the driver handle the
13018 options instead.
13019
13020 @item -Xpreprocessor @var{option}
13021 @opindex Xpreprocessor
13022 Pass @var{option} as an option to the preprocessor. You can use this to
13023 supply system-specific preprocessor options that GCC does not
13024 recognize.
13025
13026 If you want to pass an option that takes an argument, you must use
13027 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13028
13029 @item -no-integrated-cpp
13030 @opindex no-integrated-cpp
13031 Perform preprocessing as a separate pass before compilation.
13032 By default, GCC performs preprocessing as an integrated part of
13033 input tokenization and parsing.
13034 If this option is provided, the appropriate language front end
13035 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13036 and Objective-C, respectively) is instead invoked twice,
13037 once for preprocessing only and once for actual compilation
13038 of the preprocessed input.
13039 This option may be useful in conjunction with the @option{-B} or
13040 @option{-wrapper} options to specify an alternate preprocessor or
13041 perform additional processing of the program source between
13042 normal preprocessing and compilation.
13043
13044 @end table
13045
13046 @node Assembler Options
13047 @section Passing Options to the Assembler
13048
13049 @c prevent bad page break with this line
13050 You can pass options to the assembler.
13051
13052 @table @gcctabopt
13053 @item -Wa,@var{option}
13054 @opindex Wa
13055 Pass @var{option} as an option to the assembler. If @var{option}
13056 contains commas, it is split into multiple options at the commas.
13057
13058 @item -Xassembler @var{option}
13059 @opindex Xassembler
13060 Pass @var{option} as an option to the assembler. You can use this to
13061 supply system-specific assembler options that GCC does not
13062 recognize.
13063
13064 If you want to pass an option that takes an argument, you must use
13065 @option{-Xassembler} twice, once for the option and once for the argument.
13066
13067 @end table
13068
13069 @node Link Options
13070 @section Options for Linking
13071 @cindex link options
13072 @cindex options, linking
13073
13074 These options come into play when the compiler links object files into
13075 an executable output file. They are meaningless if the compiler is
13076 not doing a link step.
13077
13078 @table @gcctabopt
13079 @cindex file names
13080 @item @var{object-file-name}
13081 A file name that does not end in a special recognized suffix is
13082 considered to name an object file or library. (Object files are
13083 distinguished from libraries by the linker according to the file
13084 contents.) If linking is done, these object files are used as input
13085 to the linker.
13086
13087 @item -c
13088 @itemx -S
13089 @itemx -E
13090 @opindex c
13091 @opindex S
13092 @opindex E
13093 If any of these options is used, then the linker is not run, and
13094 object file names should not be used as arguments. @xref{Overall
13095 Options}.
13096
13097 @item -flinker-output=@var{type}
13098 @opindex flinker-output
13099 This option controls the code generation of the link time optimizer. By
13100 default the linker output is determined by the linker plugin automatically. For
13101 debugging the compiler and in the case of incremental linking to non-lto object
13102 file is desired, it may be useful to control the type manually.
13103
13104 If @var{type} is @samp{exec} the code generation is configured to produce static
13105 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
13106
13107 If @var{type} is @samp{dyn} the code generation is configured to produce shared
13108 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
13109 enabled automatically. This makes it possible to build shared libraries without
13110 position independent code on architectures this is possible, i.e.@: on x86.
13111
13112 If @var{type} is @samp{pie} the code generation is configured to produce
13113 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
13114 except that @option{-fpie} is not disabled if specified at compilation time.
13115
13116 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13117 done. The sections containing intermediate code for link-time optimization are
13118 merged, pre-optimized, and output to the resulting object file. In addition, if
13119 @option{-ffat-lto-objects} is specified the binary code is produced for future
13120 non-lto linking. The object file produced by incremental linking will be smaller
13121 than a static library produced from the same object files. At link-time the
13122 result of incremental linking will also load faster to compiler than a static
13123 library assuming that majority of objects in the library are used.
13124
13125 Finally @samp{nolto-rel} configure compiler to for incremental linking where
13126 code generation is forced, final binary is produced and the intermediate code
13127 for later link-time optimization is stripped. When multiple object files are
13128 linked together the resulting code will be optimized better than with link time
13129 optimizations disabled (for example, the cross-module inlining will happen),
13130 most of benefits of whole program optimizations are however lost.
13131
13132 During the incremental link (by @option{-r}) the linker plugin will default to
13133 @option{rel}. With current interfaces to GNU Binutils it is however not
13134 possible to link incrementally LTO objects and non-LTO objects into a single
13135 mixed object file. In the case any of object files in incremental link cannot
13136 be used for link-time optimization the linker plugin will output warning and
13137 use @samp{nolto-rel}. To maintain the whole program optimization it is
13138 recommended to link such objects into static library instead. Alternatively it
13139 is possible to use H.J. Lu's binutils with support for mixed objects.
13140
13141 @item -fuse-ld=bfd
13142 @opindex fuse-ld=bfd
13143 Use the @command{bfd} linker instead of the default linker.
13144
13145 @item -fuse-ld=gold
13146 @opindex fuse-ld=gold
13147 Use the @command{gold} linker instead of the default linker.
13148
13149 @item -fuse-ld=lld
13150 @opindex fuse-ld=lld
13151 Use the LLVM @command{lld} linker instead of the default linker.
13152
13153 @cindex Libraries
13154 @item -l@var{library}
13155 @itemx -l @var{library}
13156 @opindex l
13157 Search the library named @var{library} when linking. (The second
13158 alternative with the library as a separate argument is only for
13159 POSIX compliance and is not recommended.)
13160
13161 The @option{-l} option is passed directly to the linker by GCC. Refer
13162 to your linker documentation for exact details. The general
13163 description below applies to the GNU linker.
13164
13165 The linker searches a standard list of directories for the library.
13166 The directories searched include several standard system directories
13167 plus any that you specify with @option{-L}.
13168
13169 Static libraries are archives of object files, and have file names
13170 like @file{lib@var{library}.a}. Some targets also support shared
13171 libraries, which typically have names like @file{lib@var{library}.so}.
13172 If both static and shared libraries are found, the linker gives
13173 preference to linking with the shared library unless the
13174 @option{-static} option is used.
13175
13176 It makes a difference where in the command you write this option; the
13177 linker searches and processes libraries and object files in the order they
13178 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13179 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13180 to functions in @samp{z}, those functions may not be loaded.
13181
13182 @item -lobjc
13183 @opindex lobjc
13184 You need this special case of the @option{-l} option in order to
13185 link an Objective-C or Objective-C++ program.
13186
13187 @item -nostartfiles
13188 @opindex nostartfiles
13189 Do not use the standard system startup files when linking.
13190 The standard system libraries are used normally, unless @option{-nostdlib},
13191 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13192
13193 @item -nodefaultlibs
13194 @opindex nodefaultlibs
13195 Do not use the standard system libraries when linking.
13196 Only the libraries you specify are passed to the linker, and options
13197 specifying linkage of the system libraries, such as @option{-static-libgcc}
13198 or @option{-shared-libgcc}, are ignored.
13199 The standard startup files are used normally, unless @option{-nostartfiles}
13200 is used.
13201
13202 The compiler may generate calls to @code{memcmp},
13203 @code{memset}, @code{memcpy} and @code{memmove}.
13204 These entries are usually resolved by entries in
13205 libc. These entry points should be supplied through some other
13206 mechanism when this option is specified.
13207
13208 @item -nolibc
13209 @opindex nolibc
13210 Do not use the C library or system libraries tightly coupled with it when
13211 linking. Still link with the startup files, @file{libgcc} or toolchain
13212 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13213 or @file{libstdc++} unless options preventing their inclusion are used as
13214 well. This typically removes @option{-lc} from the link command line, as well
13215 as system libraries that normally go with it and become meaningless when
13216 absence of a C library is assumed, for example @option{-lpthread} or
13217 @option{-lm} in some configurations. This is intended for bare-board
13218 targets when there is indeed no C library available.
13219
13220 @item -nostdlib
13221 @opindex nostdlib
13222 Do not use the standard system startup files or libraries when linking.
13223 No startup files and only the libraries you specify are passed to
13224 the linker, and options specifying linkage of the system libraries, such as
13225 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13226
13227 The compiler may generate calls to @code{memcmp}, @code{memset},
13228 @code{memcpy} and @code{memmove}.
13229 These entries are usually resolved by entries in
13230 libc. These entry points should be supplied through some other
13231 mechanism when this option is specified.
13232
13233 @cindex @option{-lgcc}, use with @option{-nostdlib}
13234 @cindex @option{-nostdlib} and unresolved references
13235 @cindex unresolved references and @option{-nostdlib}
13236 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13237 @cindex @option{-nodefaultlibs} and unresolved references
13238 @cindex unresolved references and @option{-nodefaultlibs}
13239 One of the standard libraries bypassed by @option{-nostdlib} and
13240 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13241 which GCC uses to overcome shortcomings of particular machines, or special
13242 needs for some languages.
13243 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13244 Collection (GCC) Internals},
13245 for more discussion of @file{libgcc.a}.)
13246 In most cases, you need @file{libgcc.a} even when you want to avoid
13247 other standard libraries. In other words, when you specify @option{-nostdlib}
13248 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13249 This ensures that you have no unresolved references to internal GCC
13250 library subroutines.
13251 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13252 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13253 GNU Compiler Collection (GCC) Internals}.)
13254
13255 @item -e @var{entry}
13256 @itemx --entry=@var{entry}
13257 @opindex e
13258 @opindex entry
13259
13260 Specify that the program entry point is @var{entry}. The argument is
13261 interpreted by the linker; the GNU linker accepts either a symbol name
13262 or an address.
13263
13264 @item -pie
13265 @opindex pie
13266 Produce a dynamically linked position independent executable on targets
13267 that support it. For predictable results, you must also specify the same
13268 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13269 or model suboptions) when you specify this linker option.
13270
13271 @item -no-pie
13272 @opindex no-pie
13273 Don't produce a dynamically linked position independent executable.
13274
13275 @item -static-pie
13276 @opindex static-pie
13277 Produce a static position independent executable on targets that support
13278 it. A static position independent executable is similar to a static
13279 executable, but can be loaded at any address without a dynamic linker.
13280 For predictable results, you must also specify the same set of options
13281 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13282 suboptions) when you specify this linker option.
13283
13284 @item -pthread
13285 @opindex pthread
13286 Link with the POSIX threads library. This option is supported on
13287 GNU/Linux targets, most other Unix derivatives, and also on
13288 x86 Cygwin and MinGW targets. On some targets this option also sets
13289 flags for the preprocessor, so it should be used consistently for both
13290 compilation and linking.
13291
13292 @item -r
13293 @opindex r
13294 Produce a relocatable object as output. This is also known as partial
13295 linking.
13296
13297 @item -rdynamic
13298 @opindex rdynamic
13299 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13300 that support it. This instructs the linker to add all symbols, not
13301 only used ones, to the dynamic symbol table. This option is needed
13302 for some uses of @code{dlopen} or to allow obtaining backtraces
13303 from within a program.
13304
13305 @item -s
13306 @opindex s
13307 Remove all symbol table and relocation information from the executable.
13308
13309 @item -static
13310 @opindex static
13311 On systems that support dynamic linking, this overrides @option{-pie}
13312 and prevents linking with the shared libraries. On other systems, this
13313 option has no effect.
13314
13315 @item -shared
13316 @opindex shared
13317 Produce a shared object which can then be linked with other objects to
13318 form an executable. Not all systems support this option. For predictable
13319 results, you must also specify the same set of options used for compilation
13320 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13321 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13322 needs to build supplementary stub code for constructors to work. On
13323 multi-libbed systems, @samp{gcc -shared} must select the correct support
13324 libraries to link against. Failing to supply the correct flags may lead
13325 to subtle defects. Supplying them in cases where they are not necessary
13326 is innocuous.}
13327
13328 @item -shared-libgcc
13329 @itemx -static-libgcc
13330 @opindex shared-libgcc
13331 @opindex static-libgcc
13332 On systems that provide @file{libgcc} as a shared library, these options
13333 force the use of either the shared or static version, respectively.
13334 If no shared version of @file{libgcc} was built when the compiler was
13335 configured, these options have no effect.
13336
13337 There are several situations in which an application should use the
13338 shared @file{libgcc} instead of the static version. The most common
13339 of these is when the application wishes to throw and catch exceptions
13340 across different shared libraries. In that case, each of the libraries
13341 as well as the application itself should use the shared @file{libgcc}.
13342
13343 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13344 whenever you build a shared library or a main executable, because C++
13345 programs typically use exceptions, so this is the right thing to do.
13346
13347 If, instead, you use the GCC driver to create shared libraries, you may
13348 find that they are not always linked with the shared @file{libgcc}.
13349 If GCC finds, at its configuration time, that you have a non-GNU linker
13350 or a GNU linker that does not support option @option{--eh-frame-hdr},
13351 it links the shared version of @file{libgcc} into shared libraries
13352 by default. Otherwise, it takes advantage of the linker and optimizes
13353 away the linking with the shared version of @file{libgcc}, linking with
13354 the static version of libgcc by default. This allows exceptions to
13355 propagate through such shared libraries, without incurring relocation
13356 costs at library load time.
13357
13358 However, if a library or main executable is supposed to throw or catch
13359 exceptions, you must link it using the G++ driver, or using the option
13360 @option{-shared-libgcc}, such that it is linked with the shared
13361 @file{libgcc}.
13362
13363 @item -static-libasan
13364 @opindex static-libasan
13365 When the @option{-fsanitize=address} option is used to link a program,
13366 the GCC driver automatically links against @option{libasan}. If
13367 @file{libasan} is available as a shared library, and the @option{-static}
13368 option is not used, then this links against the shared version of
13369 @file{libasan}. The @option{-static-libasan} option directs the GCC
13370 driver to link @file{libasan} statically, without necessarily linking
13371 other libraries statically.
13372
13373 @item -static-libtsan
13374 @opindex static-libtsan
13375 When the @option{-fsanitize=thread} option is used to link a program,
13376 the GCC driver automatically links against @option{libtsan}. If
13377 @file{libtsan} is available as a shared library, and the @option{-static}
13378 option is not used, then this links against the shared version of
13379 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13380 driver to link @file{libtsan} statically, without necessarily linking
13381 other libraries statically.
13382
13383 @item -static-liblsan
13384 @opindex static-liblsan
13385 When the @option{-fsanitize=leak} option is used to link a program,
13386 the GCC driver automatically links against @option{liblsan}. If
13387 @file{liblsan} is available as a shared library, and the @option{-static}
13388 option is not used, then this links against the shared version of
13389 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13390 driver to link @file{liblsan} statically, without necessarily linking
13391 other libraries statically.
13392
13393 @item -static-libubsan
13394 @opindex static-libubsan
13395 When the @option{-fsanitize=undefined} option is used to link a program,
13396 the GCC driver automatically links against @option{libubsan}. If
13397 @file{libubsan} is available as a shared library, and the @option{-static}
13398 option is not used, then this links against the shared version of
13399 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13400 driver to link @file{libubsan} statically, without necessarily linking
13401 other libraries statically.
13402
13403 @item -static-libstdc++
13404 @opindex static-libstdc++
13405 When the @command{g++} program is used to link a C++ program, it
13406 normally automatically links against @option{libstdc++}. If
13407 @file{libstdc++} is available as a shared library, and the
13408 @option{-static} option is not used, then this links against the
13409 shared version of @file{libstdc++}. That is normally fine. However, it
13410 is sometimes useful to freeze the version of @file{libstdc++} used by
13411 the program without going all the way to a fully static link. The
13412 @option{-static-libstdc++} option directs the @command{g++} driver to
13413 link @file{libstdc++} statically, without necessarily linking other
13414 libraries statically.
13415
13416 @item -symbolic
13417 @opindex symbolic
13418 Bind references to global symbols when building a shared object. Warn
13419 about any unresolved references (unless overridden by the link editor
13420 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13421 this option.
13422
13423 @item -T @var{script}
13424 @opindex T
13425 @cindex linker script
13426 Use @var{script} as the linker script. This option is supported by most
13427 systems using the GNU linker. On some targets, such as bare-board
13428 targets without an operating system, the @option{-T} option may be required
13429 when linking to avoid references to undefined symbols.
13430
13431 @item -Xlinker @var{option}
13432 @opindex Xlinker
13433 Pass @var{option} as an option to the linker. You can use this to
13434 supply system-specific linker options that GCC does not recognize.
13435
13436 If you want to pass an option that takes a separate argument, you must use
13437 @option{-Xlinker} twice, once for the option and once for the argument.
13438 For example, to pass @option{-assert definitions}, you must write
13439 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13440 @option{-Xlinker "-assert definitions"}, because this passes the entire
13441 string as a single argument, which is not what the linker expects.
13442
13443 When using the GNU linker, it is usually more convenient to pass
13444 arguments to linker options using the @option{@var{option}=@var{value}}
13445 syntax than as separate arguments. For example, you can specify
13446 @option{-Xlinker -Map=output.map} rather than
13447 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13448 this syntax for command-line options.
13449
13450 @item -Wl,@var{option}
13451 @opindex Wl
13452 Pass @var{option} as an option to the linker. If @var{option} contains
13453 commas, it is split into multiple options at the commas. You can use this
13454 syntax to pass an argument to the option.
13455 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13456 linker. When using the GNU linker, you can also get the same effect with
13457 @option{-Wl,-Map=output.map}.
13458
13459 @item -u @var{symbol}
13460 @opindex u
13461 Pretend the symbol @var{symbol} is undefined, to force linking of
13462 library modules to define it. You can use @option{-u} multiple times with
13463 different symbols to force loading of additional library modules.
13464
13465 @item -z @var{keyword}
13466 @opindex z
13467 @option{-z} is passed directly on to the linker along with the keyword
13468 @var{keyword}. See the section in the documentation of your linker for
13469 permitted values and their meanings.
13470 @end table
13471
13472 @node Directory Options
13473 @section Options for Directory Search
13474 @cindex directory options
13475 @cindex options, directory search
13476 @cindex search path
13477
13478 These options specify directories to search for header files, for
13479 libraries and for parts of the compiler:
13480
13481 @table @gcctabopt
13482 @include cppdiropts.texi
13483
13484 @item -iplugindir=@var{dir}
13485 @opindex iplugindir=
13486 Set the directory to search for plugins that are passed
13487 by @option{-fplugin=@var{name}} instead of
13488 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13489 to be used by the user, but only passed by the driver.
13490
13491 @item -L@var{dir}
13492 @opindex L
13493 Add directory @var{dir} to the list of directories to be searched
13494 for @option{-l}.
13495
13496 @item -B@var{prefix}
13497 @opindex B
13498 This option specifies where to find the executables, libraries,
13499 include files, and data files of the compiler itself.
13500
13501 The compiler driver program runs one or more of the subprograms
13502 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13503 @var{prefix} as a prefix for each program it tries to run, both with and
13504 without @samp{@var{machine}/@var{version}/} for the corresponding target
13505 machine and compiler version.
13506
13507 For each subprogram to be run, the compiler driver first tries the
13508 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13509 is not specified, the driver tries two standard prefixes,
13510 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13511 those results in a file name that is found, the unmodified program
13512 name is searched for using the directories specified in your
13513 @env{PATH} environment variable.
13514
13515 The compiler checks to see if the path provided by @option{-B}
13516 refers to a directory, and if necessary it adds a directory
13517 separator character at the end of the path.
13518
13519 @option{-B} prefixes that effectively specify directory names also apply
13520 to libraries in the linker, because the compiler translates these
13521 options into @option{-L} options for the linker. They also apply to
13522 include files in the preprocessor, because the compiler translates these
13523 options into @option{-isystem} options for the preprocessor. In this case,
13524 the compiler appends @samp{include} to the prefix.
13525
13526 The runtime support file @file{libgcc.a} can also be searched for using
13527 the @option{-B} prefix, if needed. If it is not found there, the two
13528 standard prefixes above are tried, and that is all. The file is left
13529 out of the link if it is not found by those means.
13530
13531 Another way to specify a prefix much like the @option{-B} prefix is to use
13532 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13533 Variables}.
13534
13535 As a special kludge, if the path provided by @option{-B} is
13536 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13537 9, then it is replaced by @file{[dir/]include}. This is to help
13538 with boot-strapping the compiler.
13539
13540 @item -no-canonical-prefixes
13541 @opindex no-canonical-prefixes
13542 Do not expand any symbolic links, resolve references to @samp{/../}
13543 or @samp{/./}, or make the path absolute when generating a relative
13544 prefix.
13545
13546 @item --sysroot=@var{dir}
13547 @opindex sysroot
13548 Use @var{dir} as the logical root directory for headers and libraries.
13549 For example, if the compiler normally searches for headers in
13550 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13551 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13552
13553 If you use both this option and the @option{-isysroot} option, then
13554 the @option{--sysroot} option applies to libraries, but the
13555 @option{-isysroot} option applies to header files.
13556
13557 The GNU linker (beginning with version 2.16) has the necessary support
13558 for this option. If your linker does not support this option, the
13559 header file aspect of @option{--sysroot} still works, but the
13560 library aspect does not.
13561
13562 @item --no-sysroot-suffix
13563 @opindex no-sysroot-suffix
13564 For some targets, a suffix is added to the root directory specified
13565 with @option{--sysroot}, depending on the other options used, so that
13566 headers may for example be found in
13567 @file{@var{dir}/@var{suffix}/usr/include} instead of
13568 @file{@var{dir}/usr/include}. This option disables the addition of
13569 such a suffix.
13570
13571 @end table
13572
13573 @node Code Gen Options
13574 @section Options for Code Generation Conventions
13575 @cindex code generation conventions
13576 @cindex options, code generation
13577 @cindex run-time options
13578
13579 These machine-independent options control the interface conventions
13580 used in code generation.
13581
13582 Most of them have both positive and negative forms; the negative form
13583 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13584 one of the forms is listed---the one that is not the default. You
13585 can figure out the other form by either removing @samp{no-} or adding
13586 it.
13587
13588 @table @gcctabopt
13589 @item -fstack-reuse=@var{reuse-level}
13590 @opindex fstack_reuse
13591 This option controls stack space reuse for user declared local/auto variables
13592 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13593 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13594 local variables and temporaries, @samp{named_vars} enables the reuse only for
13595 user defined local variables with names, and @samp{none} disables stack reuse
13596 completely. The default value is @samp{all}. The option is needed when the
13597 program extends the lifetime of a scoped local variable or a compiler generated
13598 temporary beyond the end point defined by the language. When a lifetime of
13599 a variable ends, and if the variable lives in memory, the optimizing compiler
13600 has the freedom to reuse its stack space with other temporaries or scoped
13601 local variables whose live range does not overlap with it. Legacy code extending
13602 local lifetime is likely to break with the stack reuse optimization.
13603
13604 For example,
13605
13606 @smallexample
13607 int *p;
13608 @{
13609 int local1;
13610
13611 p = &local1;
13612 local1 = 10;
13613 ....
13614 @}
13615 @{
13616 int local2;
13617 local2 = 20;
13618 ...
13619 @}
13620
13621 if (*p == 10) // out of scope use of local1
13622 @{
13623
13624 @}
13625 @end smallexample
13626
13627 Another example:
13628 @smallexample
13629
13630 struct A
13631 @{
13632 A(int k) : i(k), j(k) @{ @}
13633 int i;
13634 int j;
13635 @};
13636
13637 A *ap;
13638
13639 void foo(const A& ar)
13640 @{
13641 ap = &ar;
13642 @}
13643
13644 void bar()
13645 @{
13646 foo(A(10)); // temp object's lifetime ends when foo returns
13647
13648 @{
13649 A a(20);
13650 ....
13651 @}
13652 ap->i+= 10; // ap references out of scope temp whose space
13653 // is reused with a. What is the value of ap->i?
13654 @}
13655
13656 @end smallexample
13657
13658 The lifetime of a compiler generated temporary is well defined by the C++
13659 standard. When a lifetime of a temporary ends, and if the temporary lives
13660 in memory, the optimizing compiler has the freedom to reuse its stack
13661 space with other temporaries or scoped local variables whose live range
13662 does not overlap with it. However some of the legacy code relies on
13663 the behavior of older compilers in which temporaries' stack space is
13664 not reused, the aggressive stack reuse can lead to runtime errors. This
13665 option is used to control the temporary stack reuse optimization.
13666
13667 @item -ftrapv
13668 @opindex ftrapv
13669 This option generates traps for signed overflow on addition, subtraction,
13670 multiplication operations.
13671 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13672 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13673 @option{-fwrapv} being effective. Note that only active options override, so
13674 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13675 results in @option{-ftrapv} being effective.
13676
13677 @item -fwrapv
13678 @opindex fwrapv
13679 This option instructs the compiler to assume that signed arithmetic
13680 overflow of addition, subtraction and multiplication wraps around
13681 using twos-complement representation. This flag enables some optimizations
13682 and disables others.
13683 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13684 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13685 @option{-fwrapv} being effective. Note that only active options override, so
13686 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13687 results in @option{-ftrapv} being effective.
13688
13689 @item -fwrapv-pointer
13690 @opindex fwrapv-pointer
13691 This option instructs the compiler to assume that pointer arithmetic
13692 overflow on addition and subtraction wraps around using twos-complement
13693 representation. This flag disables some optimizations which assume
13694 pointer overflow is invalid.
13695
13696 @item -fstrict-overflow
13697 @opindex fstrict-overflow
13698 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13699 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13700
13701 @item -fexceptions
13702 @opindex fexceptions
13703 Enable exception handling. Generates extra code needed to propagate
13704 exceptions. For some targets, this implies GCC generates frame
13705 unwind information for all functions, which can produce significant data
13706 size overhead, although it does not affect execution. If you do not
13707 specify this option, GCC enables it by default for languages like
13708 C++ that normally require exception handling, and disables it for
13709 languages like C that do not normally require it. However, you may need
13710 to enable this option when compiling C code that needs to interoperate
13711 properly with exception handlers written in C++. You may also wish to
13712 disable this option if you are compiling older C++ programs that don't
13713 use exception handling.
13714
13715 @item -fnon-call-exceptions
13716 @opindex fnon-call-exceptions
13717 Generate code that allows trapping instructions to throw exceptions.
13718 Note that this requires platform-specific runtime support that does
13719 not exist everywhere. Moreover, it only allows @emph{trapping}
13720 instructions to throw exceptions, i.e.@: memory references or floating-point
13721 instructions. It does not allow exceptions to be thrown from
13722 arbitrary signal handlers such as @code{SIGALRM}.
13723
13724 @item -fdelete-dead-exceptions
13725 @opindex fdelete-dead-exceptions
13726 Consider that instructions that may throw exceptions but don't otherwise
13727 contribute to the execution of the program can be optimized away.
13728 This option is enabled by default for the Ada front end, as permitted by
13729 the Ada language specification.
13730 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13731
13732 @item -funwind-tables
13733 @opindex funwind-tables
13734 Similar to @option{-fexceptions}, except that it just generates any needed
13735 static data, but does not affect the generated code in any other way.
13736 You normally do not need to enable this option; instead, a language processor
13737 that needs this handling enables it on your behalf.
13738
13739 @item -fasynchronous-unwind-tables
13740 @opindex fasynchronous-unwind-tables
13741 Generate unwind table in DWARF format, if supported by target machine. The
13742 table is exact at each instruction boundary, so it can be used for stack
13743 unwinding from asynchronous events (such as debugger or garbage collector).
13744
13745 @item -fno-gnu-unique
13746 @opindex fno-gnu-unique
13747 @opindex fgnu-unique
13748 On systems with recent GNU assembler and C library, the C++ compiler
13749 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13750 of template static data members and static local variables in inline
13751 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13752 is necessary to avoid problems with a library used by two different
13753 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13754 therefore disagreeing with the other one about the binding of the
13755 symbol. But this causes @code{dlclose} to be ignored for affected
13756 DSOs; if your program relies on reinitialization of a DSO via
13757 @code{dlclose} and @code{dlopen}, you can use
13758 @option{-fno-gnu-unique}.
13759
13760 @item -fpcc-struct-return
13761 @opindex fpcc-struct-return
13762 Return ``short'' @code{struct} and @code{union} values in memory like
13763 longer ones, rather than in registers. This convention is less
13764 efficient, but it has the advantage of allowing intercallability between
13765 GCC-compiled files and files compiled with other compilers, particularly
13766 the Portable C Compiler (pcc).
13767
13768 The precise convention for returning structures in memory depends
13769 on the target configuration macros.
13770
13771 Short structures and unions are those whose size and alignment match
13772 that of some integer type.
13773
13774 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13775 switch is not binary compatible with code compiled with the
13776 @option{-freg-struct-return} switch.
13777 Use it to conform to a non-default application binary interface.
13778
13779 @item -freg-struct-return
13780 @opindex freg-struct-return
13781 Return @code{struct} and @code{union} values in registers when possible.
13782 This is more efficient for small structures than
13783 @option{-fpcc-struct-return}.
13784
13785 If you specify neither @option{-fpcc-struct-return} nor
13786 @option{-freg-struct-return}, GCC defaults to whichever convention is
13787 standard for the target. If there is no standard convention, GCC
13788 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13789 the principal compiler. In those cases, we can choose the standard, and
13790 we chose the more efficient register return alternative.
13791
13792 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13793 switch is not binary compatible with code compiled with the
13794 @option{-fpcc-struct-return} switch.
13795 Use it to conform to a non-default application binary interface.
13796
13797 @item -fshort-enums
13798 @opindex fshort-enums
13799 Allocate to an @code{enum} type only as many bytes as it needs for the
13800 declared range of possible values. Specifically, the @code{enum} type
13801 is equivalent to the smallest integer type that has enough room.
13802
13803 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13804 code that is not binary compatible with code generated without that switch.
13805 Use it to conform to a non-default application binary interface.
13806
13807 @item -fshort-wchar
13808 @opindex fshort-wchar
13809 Override the underlying type for @code{wchar_t} to be @code{short
13810 unsigned int} instead of the default for the target. This option is
13811 useful for building programs to run under WINE@.
13812
13813 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13814 code that is not binary compatible with code generated without that switch.
13815 Use it to conform to a non-default application binary interface.
13816
13817 @item -fno-common
13818 @opindex fno-common
13819 @opindex fcommon
13820 @cindex tentative definitions
13821 In C code, this option controls the placement of global variables
13822 defined without an initializer, known as @dfn{tentative definitions}
13823 in the C standard. Tentative definitions are distinct from declarations
13824 of a variable with the @code{extern} keyword, which do not allocate storage.
13825
13826 Unix C compilers have traditionally allocated storage for
13827 uninitialized global variables in a common block. This allows the
13828 linker to resolve all tentative definitions of the same variable
13829 in different compilation units to the same object, or to a non-tentative
13830 definition.
13831 This is the behavior specified by @option{-fcommon}, and is the default for
13832 GCC on most targets.
13833 On the other hand, this behavior is not required by ISO
13834 C, and on some targets may carry a speed or code size penalty on
13835 variable references.
13836
13837 The @option{-fno-common} option specifies that the compiler should instead
13838 place uninitialized global variables in the BSS section of the object file.
13839 This inhibits the merging of tentative definitions by the linker so
13840 you get a multiple-definition error if the same
13841 variable is defined in more than one compilation unit.
13842 Compiling with @option{-fno-common} is useful on targets for which
13843 it provides better performance, or if you wish to verify that the
13844 program will work on other systems that always treat uninitialized
13845 variable definitions this way.
13846
13847 @item -fno-ident
13848 @opindex fno-ident
13849 @opindex fident
13850 Ignore the @code{#ident} directive.
13851
13852 @item -finhibit-size-directive
13853 @opindex finhibit-size-directive
13854 Don't output a @code{.size} assembler directive, or anything else that
13855 would cause trouble if the function is split in the middle, and the
13856 two halves are placed at locations far apart in memory. This option is
13857 used when compiling @file{crtstuff.c}; you should not need to use it
13858 for anything else.
13859
13860 @item -fverbose-asm
13861 @opindex fverbose-asm
13862 Put extra commentary information in the generated assembly code to
13863 make it more readable. This option is generally only of use to those
13864 who actually need to read the generated assembly code (perhaps while
13865 debugging the compiler itself).
13866
13867 @option{-fno-verbose-asm}, the default, causes the
13868 extra information to be omitted and is useful when comparing two assembler
13869 files.
13870
13871 The added comments include:
13872
13873 @itemize @bullet
13874
13875 @item
13876 information on the compiler version and command-line options,
13877
13878 @item
13879 the source code lines associated with the assembly instructions,
13880 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13881
13882 @item
13883 hints on which high-level expressions correspond to
13884 the various assembly instruction operands.
13885
13886 @end itemize
13887
13888 For example, given this C source file:
13889
13890 @smallexample
13891 int test (int n)
13892 @{
13893 int i;
13894 int total = 0;
13895
13896 for (i = 0; i < n; i++)
13897 total += i * i;
13898
13899 return total;
13900 @}
13901 @end smallexample
13902
13903 compiling to (x86_64) assembly via @option{-S} and emitting the result
13904 direct to stdout via @option{-o} @option{-}
13905
13906 @smallexample
13907 gcc -S test.c -fverbose-asm -Os -o -
13908 @end smallexample
13909
13910 gives output similar to this:
13911
13912 @smallexample
13913 .file "test.c"
13914 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13915 [...snip...]
13916 # options passed:
13917 [...snip...]
13918
13919 .text
13920 .globl test
13921 .type test, @@function
13922 test:
13923 .LFB0:
13924 .cfi_startproc
13925 # test.c:4: int total = 0;
13926 xorl %eax, %eax # <retval>
13927 # test.c:6: for (i = 0; i < n; i++)
13928 xorl %edx, %edx # i
13929 .L2:
13930 # test.c:6: for (i = 0; i < n; i++)
13931 cmpl %edi, %edx # n, i
13932 jge .L5 #,
13933 # test.c:7: total += i * i;
13934 movl %edx, %ecx # i, tmp92
13935 imull %edx, %ecx # i, tmp92
13936 # test.c:6: for (i = 0; i < n; i++)
13937 incl %edx # i
13938 # test.c:7: total += i * i;
13939 addl %ecx, %eax # tmp92, <retval>
13940 jmp .L2 #
13941 .L5:
13942 # test.c:10: @}
13943 ret
13944 .cfi_endproc
13945 .LFE0:
13946 .size test, .-test
13947 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13948 .section .note.GNU-stack,"",@@progbits
13949 @end smallexample
13950
13951 The comments are intended for humans rather than machines and hence the
13952 precise format of the comments is subject to change.
13953
13954 @item -frecord-gcc-switches
13955 @opindex frecord-gcc-switches
13956 This switch causes the command line used to invoke the
13957 compiler to be recorded into the object file that is being created.
13958 This switch is only implemented on some targets and the exact format
13959 of the recording is target and binary file format dependent, but it
13960 usually takes the form of a section containing ASCII text. This
13961 switch is related to the @option{-fverbose-asm} switch, but that
13962 switch only records information in the assembler output file as
13963 comments, so it never reaches the object file.
13964 See also @option{-grecord-gcc-switches} for another
13965 way of storing compiler options into the object file.
13966
13967 @item -fpic
13968 @opindex fpic
13969 @cindex global offset table
13970 @cindex PIC
13971 Generate position-independent code (PIC) suitable for use in a shared
13972 library, if supported for the target machine. Such code accesses all
13973 constant addresses through a global offset table (GOT)@. The dynamic
13974 loader resolves the GOT entries when the program starts (the dynamic
13975 loader is not part of GCC; it is part of the operating system). If
13976 the GOT size for the linked executable exceeds a machine-specific
13977 maximum size, you get an error message from the linker indicating that
13978 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13979 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13980 on the m68k and RS/6000. The x86 has no such limit.)
13981
13982 Position-independent code requires special support, and therefore works
13983 only on certain machines. For the x86, GCC supports PIC for System V
13984 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13985 position-independent.
13986
13987 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13988 are defined to 1.
13989
13990 @item -fPIC
13991 @opindex fPIC
13992 If supported for the target machine, emit position-independent code,
13993 suitable for dynamic linking and avoiding any limit on the size of the
13994 global offset table. This option makes a difference on AArch64, m68k,
13995 PowerPC and SPARC@.
13996
13997 Position-independent code requires special support, and therefore works
13998 only on certain machines.
13999
14000 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14001 are defined to 2.
14002
14003 @item -fpie
14004 @itemx -fPIE
14005 @opindex fpie
14006 @opindex fPIE
14007 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14008 generated position-independent code can be only linked into executables.
14009 Usually these options are used to compile code that will be linked using
14010 the @option{-pie} GCC option.
14011
14012 @option{-fpie} and @option{-fPIE} both define the macros
14013 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14014 for @option{-fpie} and 2 for @option{-fPIE}.
14015
14016 @item -fno-plt
14017 @opindex fno-plt
14018 @opindex fplt
14019 Do not use the PLT for external function calls in position-independent code.
14020 Instead, load the callee address at call sites from the GOT and branch to it.
14021 This leads to more efficient code by eliminating PLT stubs and exposing
14022 GOT loads to optimizations. On architectures such as 32-bit x86 where
14023 PLT stubs expect the GOT pointer in a specific register, this gives more
14024 register allocation freedom to the compiler.
14025 Lazy binding requires use of the PLT;
14026 with @option{-fno-plt} all external symbols are resolved at load time.
14027
14028 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14029 through the PLT for specific external functions.
14030
14031 In position-dependent code, a few targets also convert calls to
14032 functions that are marked to not use the PLT to use the GOT instead.
14033
14034 @item -fno-jump-tables
14035 @opindex fno-jump-tables
14036 @opindex fjump-tables
14037 Do not use jump tables for switch statements even where it would be
14038 more efficient than other code generation strategies. This option is
14039 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14040 building code that forms part of a dynamic linker and cannot
14041 reference the address of a jump table. On some targets, jump tables
14042 do not require a GOT and this option is not needed.
14043
14044 @item -ffixed-@var{reg}
14045 @opindex ffixed
14046 Treat the register named @var{reg} as a fixed register; generated code
14047 should never refer to it (except perhaps as a stack pointer, frame
14048 pointer or in some other fixed role).
14049
14050 @var{reg} must be the name of a register. The register names accepted
14051 are machine-specific and are defined in the @code{REGISTER_NAMES}
14052 macro in the machine description macro file.
14053
14054 This flag does not have a negative form, because it specifies a
14055 three-way choice.
14056
14057 @item -fcall-used-@var{reg}
14058 @opindex fcall-used
14059 Treat the register named @var{reg} as an allocable register that is
14060 clobbered by function calls. It may be allocated for temporaries or
14061 variables that do not live across a call. Functions compiled this way
14062 do not save and restore the register @var{reg}.
14063
14064 It is an error to use this flag with the frame pointer or stack pointer.
14065 Use of this flag for other registers that have fixed pervasive roles in
14066 the machine's execution model produces disastrous results.
14067
14068 This flag does not have a negative form, because it specifies a
14069 three-way choice.
14070
14071 @item -fcall-saved-@var{reg}
14072 @opindex fcall-saved
14073 Treat the register named @var{reg} as an allocable register saved by
14074 functions. It may be allocated even for temporaries or variables that
14075 live across a call. Functions compiled this way save and restore
14076 the register @var{reg} if they use it.
14077
14078 It is an error to use this flag with the frame pointer or stack pointer.
14079 Use of this flag for other registers that have fixed pervasive roles in
14080 the machine's execution model produces disastrous results.
14081
14082 A different sort of disaster results from the use of this flag for
14083 a register in which function values may be returned.
14084
14085 This flag does not have a negative form, because it specifies a
14086 three-way choice.
14087
14088 @item -fpack-struct[=@var{n}]
14089 @opindex fpack-struct
14090 Without a value specified, pack all structure members together without
14091 holes. When a value is specified (which must be a small power of two), pack
14092 structure members according to this value, representing the maximum
14093 alignment (that is, objects with default alignment requirements larger than
14094 this are output potentially unaligned at the next fitting location.
14095
14096 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14097 code that is not binary compatible with code generated without that switch.
14098 Additionally, it makes the code suboptimal.
14099 Use it to conform to a non-default application binary interface.
14100
14101 @item -fleading-underscore
14102 @opindex fleading-underscore
14103 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14104 change the way C symbols are represented in the object file. One use
14105 is to help link with legacy assembly code.
14106
14107 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14108 generate code that is not binary compatible with code generated without that
14109 switch. Use it to conform to a non-default application binary interface.
14110 Not all targets provide complete support for this switch.
14111
14112 @item -ftls-model=@var{model}
14113 @opindex ftls-model
14114 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14115 The @var{model} argument should be one of @samp{global-dynamic},
14116 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14117 Note that the choice is subject to optimization: the compiler may use
14118 a more efficient model for symbols not visible outside of the translation
14119 unit, or if @option{-fpic} is not given on the command line.
14120
14121 The default without @option{-fpic} is @samp{initial-exec}; with
14122 @option{-fpic} the default is @samp{global-dynamic}.
14123
14124 @item -ftrampolines
14125 @opindex ftrampolines
14126 For targets that normally need trampolines for nested functions, always
14127 generate them instead of using descriptors. Otherwise, for targets that
14128 do not need them, like for example HP-PA or IA-64, do nothing.
14129
14130 A trampoline is a small piece of code that is created at run time on the
14131 stack when the address of a nested function is taken, and is used to call
14132 the nested function indirectly. Therefore, it requires the stack to be
14133 made executable in order for the program to work properly.
14134
14135 @option{-fno-trampolines} is enabled by default on a language by language
14136 basis to let the compiler avoid generating them, if it computes that this
14137 is safe, and replace them with descriptors. Descriptors are made up of data
14138 only, but the generated code must be prepared to deal with them. As of this
14139 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14140
14141 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14142 @option{-fno-trampolines} are not binary compatible if nested functions are
14143 present. This option must therefore be used on a program-wide basis and be
14144 manipulated with extreme care.
14145
14146 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14147 @opindex fvisibility
14148 Set the default ELF image symbol visibility to the specified option---all
14149 symbols are marked with this unless overridden within the code.
14150 Using this feature can very substantially improve linking and
14151 load times of shared object libraries, produce more optimized
14152 code, provide near-perfect API export and prevent symbol clashes.
14153 It is @strong{strongly} recommended that you use this in any shared objects
14154 you distribute.
14155
14156 Despite the nomenclature, @samp{default} always means public; i.e.,
14157 available to be linked against from outside the shared object.
14158 @samp{protected} and @samp{internal} are pretty useless in real-world
14159 usage so the only other commonly used option is @samp{hidden}.
14160 The default if @option{-fvisibility} isn't specified is
14161 @samp{default}, i.e., make every symbol public.
14162
14163 A good explanation of the benefits offered by ensuring ELF
14164 symbols have the correct visibility is given by ``How To Write
14165 Shared Libraries'' by Ulrich Drepper (which can be found at
14166 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14167 solution made possible by this option to marking things hidden when
14168 the default is public is to make the default hidden and mark things
14169 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14170 and @code{__attribute__ ((visibility("default")))} instead of
14171 @code{__declspec(dllexport)} you get almost identical semantics with
14172 identical syntax. This is a great boon to those working with
14173 cross-platform projects.
14174
14175 For those adding visibility support to existing code, you may find
14176 @code{#pragma GCC visibility} of use. This works by you enclosing
14177 the declarations you wish to set visibility for with (for example)
14178 @code{#pragma GCC visibility push(hidden)} and
14179 @code{#pragma GCC visibility pop}.
14180 Bear in mind that symbol visibility should be viewed @strong{as
14181 part of the API interface contract} and thus all new code should
14182 always specify visibility when it is not the default; i.e., declarations
14183 only for use within the local DSO should @strong{always} be marked explicitly
14184 as hidden as so to avoid PLT indirection overheads---making this
14185 abundantly clear also aids readability and self-documentation of the code.
14186 Note that due to ISO C++ specification requirements, @code{operator new} and
14187 @code{operator delete} must always be of default visibility.
14188
14189 Be aware that headers from outside your project, in particular system
14190 headers and headers from any other library you use, may not be
14191 expecting to be compiled with visibility other than the default. You
14192 may need to explicitly say @code{#pragma GCC visibility push(default)}
14193 before including any such headers.
14194
14195 @code{extern} declarations are not affected by @option{-fvisibility}, so
14196 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14197 no modifications. However, this means that calls to @code{extern}
14198 functions with no explicit visibility use the PLT, so it is more
14199 effective to use @code{__attribute ((visibility))} and/or
14200 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14201 declarations should be treated as hidden.
14202
14203 Note that @option{-fvisibility} does affect C++ vague linkage
14204 entities. This means that, for instance, an exception class that is
14205 be thrown between DSOs must be explicitly marked with default
14206 visibility so that the @samp{type_info} nodes are unified between
14207 the DSOs.
14208
14209 An overview of these techniques, their benefits and how to use them
14210 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14211
14212 @item -fstrict-volatile-bitfields
14213 @opindex fstrict-volatile-bitfields
14214 This option should be used if accesses to volatile bit-fields (or other
14215 structure fields, although the compiler usually honors those types
14216 anyway) should use a single access of the width of the
14217 field's type, aligned to a natural alignment if possible. For
14218 example, targets with memory-mapped peripheral registers might require
14219 all such accesses to be 16 bits wide; with this flag you can
14220 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14221 is 16 bits on these targets) to force GCC to use 16-bit accesses
14222 instead of, perhaps, a more efficient 32-bit access.
14223
14224 If this option is disabled, the compiler uses the most efficient
14225 instruction. In the previous example, that might be a 32-bit load
14226 instruction, even though that accesses bytes that do not contain
14227 any portion of the bit-field, or memory-mapped registers unrelated to
14228 the one being updated.
14229
14230 In some cases, such as when the @code{packed} attribute is applied to a
14231 structure field, it may not be possible to access the field with a single
14232 read or write that is correctly aligned for the target machine. In this
14233 case GCC falls back to generating multiple accesses rather than code that
14234 will fault or truncate the result at run time.
14235
14236 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14237 not allowed to touch non bit-field members. It is therefore recommended
14238 to define all bits of the field's type as bit-field members.
14239
14240 The default value of this option is determined by the application binary
14241 interface for the target processor.
14242
14243 @item -fsync-libcalls
14244 @opindex fsync-libcalls
14245 This option controls whether any out-of-line instance of the @code{__sync}
14246 family of functions may be used to implement the C++11 @code{__atomic}
14247 family of functions.
14248
14249 The default value of this option is enabled, thus the only useful form
14250 of the option is @option{-fno-sync-libcalls}. This option is used in
14251 the implementation of the @file{libatomic} runtime library.
14252
14253 @end table
14254
14255 @node Developer Options
14256 @section GCC Developer Options
14257 @cindex developer options
14258 @cindex debugging GCC
14259 @cindex debug dump options
14260 @cindex dump options
14261 @cindex compilation statistics
14262
14263 This section describes command-line options that are primarily of
14264 interest to GCC developers, including options to support compiler
14265 testing and investigation of compiler bugs and compile-time
14266 performance problems. This includes options that produce debug dumps
14267 at various points in the compilation; that print statistics such as
14268 memory use and execution time; and that print information about GCC's
14269 configuration, such as where it searches for libraries. You should
14270 rarely need to use any of these options for ordinary compilation and
14271 linking tasks.
14272
14273 Many developer options that cause GCC to dump output to a file take an
14274 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14275 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14276 error.
14277
14278 If @samp{=@var{filename}} is omitted, a default dump file name is
14279 constructed by concatenating the base dump file name, a pass number,
14280 phase letter, and pass name. The base dump file name is the name of
14281 output file produced by the compiler if explicitly specified and not
14282 an executable; otherwise it is the source file name.
14283 The pass number is determined by the order passes are registered with
14284 the compiler's pass manager.
14285 This is generally the same as the order of execution, but passes
14286 registered by plugins, target-specific passes, or passes that are
14287 otherwise registered late are numbered higher than the pass named
14288 @samp{final}, even if they are executed earlier. The phase letter is
14289 one of @samp{i} (inter-procedural analysis), @samp{l}
14290 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14291 The files are created in the directory of the output file.
14292
14293 @table @gcctabopt
14294
14295 @item -d@var{letters}
14296 @itemx -fdump-rtl-@var{pass}
14297 @itemx -fdump-rtl-@var{pass}=@var{filename}
14298 @opindex d
14299 @opindex fdump-rtl-@var{pass}
14300 Says to make debugging dumps during compilation at times specified by
14301 @var{letters}. This is used for debugging the RTL-based passes of the
14302 compiler.
14303
14304 Some @option{-d@var{letters}} switches have different meaning when
14305 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14306 for information about preprocessor-specific dump options.
14307
14308 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14309 @option{-d} option @var{letters}. Here are the possible
14310 letters for use in @var{pass} and @var{letters}, and their meanings:
14311
14312 @table @gcctabopt
14313
14314 @item -fdump-rtl-alignments
14315 @opindex fdump-rtl-alignments
14316 Dump after branch alignments have been computed.
14317
14318 @item -fdump-rtl-asmcons
14319 @opindex fdump-rtl-asmcons
14320 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14321
14322 @item -fdump-rtl-auto_inc_dec
14323 @opindex fdump-rtl-auto_inc_dec
14324 Dump after auto-inc-dec discovery. This pass is only run on
14325 architectures that have auto inc or auto dec instructions.
14326
14327 @item -fdump-rtl-barriers
14328 @opindex fdump-rtl-barriers
14329 Dump after cleaning up the barrier instructions.
14330
14331 @item -fdump-rtl-bbpart
14332 @opindex fdump-rtl-bbpart
14333 Dump after partitioning hot and cold basic blocks.
14334
14335 @item -fdump-rtl-bbro
14336 @opindex fdump-rtl-bbro
14337 Dump after block reordering.
14338
14339 @item -fdump-rtl-btl1
14340 @itemx -fdump-rtl-btl2
14341 @opindex fdump-rtl-btl2
14342 @opindex fdump-rtl-btl2
14343 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14344 after the two branch
14345 target load optimization passes.
14346
14347 @item -fdump-rtl-bypass
14348 @opindex fdump-rtl-bypass
14349 Dump after jump bypassing and control flow optimizations.
14350
14351 @item -fdump-rtl-combine
14352 @opindex fdump-rtl-combine
14353 Dump after the RTL instruction combination pass.
14354
14355 @item -fdump-rtl-compgotos
14356 @opindex fdump-rtl-compgotos
14357 Dump after duplicating the computed gotos.
14358
14359 @item -fdump-rtl-ce1
14360 @itemx -fdump-rtl-ce2
14361 @itemx -fdump-rtl-ce3
14362 @opindex fdump-rtl-ce1
14363 @opindex fdump-rtl-ce2
14364 @opindex fdump-rtl-ce3
14365 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14366 @option{-fdump-rtl-ce3} enable dumping after the three
14367 if conversion passes.
14368
14369 @item -fdump-rtl-cprop_hardreg
14370 @opindex fdump-rtl-cprop_hardreg
14371 Dump after hard register copy propagation.
14372
14373 @item -fdump-rtl-csa
14374 @opindex fdump-rtl-csa
14375 Dump after combining stack adjustments.
14376
14377 @item -fdump-rtl-cse1
14378 @itemx -fdump-rtl-cse2
14379 @opindex fdump-rtl-cse1
14380 @opindex fdump-rtl-cse2
14381 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14382 the two common subexpression elimination passes.
14383
14384 @item -fdump-rtl-dce
14385 @opindex fdump-rtl-dce
14386 Dump after the standalone dead code elimination passes.
14387
14388 @item -fdump-rtl-dbr
14389 @opindex fdump-rtl-dbr
14390 Dump after delayed branch scheduling.
14391
14392 @item -fdump-rtl-dce1
14393 @itemx -fdump-rtl-dce2
14394 @opindex fdump-rtl-dce1
14395 @opindex fdump-rtl-dce2
14396 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14397 the two dead store elimination passes.
14398
14399 @item -fdump-rtl-eh
14400 @opindex fdump-rtl-eh
14401 Dump after finalization of EH handling code.
14402
14403 @item -fdump-rtl-eh_ranges
14404 @opindex fdump-rtl-eh_ranges
14405 Dump after conversion of EH handling range regions.
14406
14407 @item -fdump-rtl-expand
14408 @opindex fdump-rtl-expand
14409 Dump after RTL generation.
14410
14411 @item -fdump-rtl-fwprop1
14412 @itemx -fdump-rtl-fwprop2
14413 @opindex fdump-rtl-fwprop1
14414 @opindex fdump-rtl-fwprop2
14415 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14416 dumping after the two forward propagation passes.
14417
14418 @item -fdump-rtl-gcse1
14419 @itemx -fdump-rtl-gcse2
14420 @opindex fdump-rtl-gcse1
14421 @opindex fdump-rtl-gcse2
14422 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14423 after global common subexpression elimination.
14424
14425 @item -fdump-rtl-init-regs
14426 @opindex fdump-rtl-init-regs
14427 Dump after the initialization of the registers.
14428
14429 @item -fdump-rtl-initvals
14430 @opindex fdump-rtl-initvals
14431 Dump after the computation of the initial value sets.
14432
14433 @item -fdump-rtl-into_cfglayout
14434 @opindex fdump-rtl-into_cfglayout
14435 Dump after converting to cfglayout mode.
14436
14437 @item -fdump-rtl-ira
14438 @opindex fdump-rtl-ira
14439 Dump after iterated register allocation.
14440
14441 @item -fdump-rtl-jump
14442 @opindex fdump-rtl-jump
14443 Dump after the second jump optimization.
14444
14445 @item -fdump-rtl-loop2
14446 @opindex fdump-rtl-loop2
14447 @option{-fdump-rtl-loop2} enables dumping after the rtl
14448 loop optimization passes.
14449
14450 @item -fdump-rtl-mach
14451 @opindex fdump-rtl-mach
14452 Dump after performing the machine dependent reorganization pass, if that
14453 pass exists.
14454
14455 @item -fdump-rtl-mode_sw
14456 @opindex fdump-rtl-mode_sw
14457 Dump after removing redundant mode switches.
14458
14459 @item -fdump-rtl-rnreg
14460 @opindex fdump-rtl-rnreg
14461 Dump after register renumbering.
14462
14463 @item -fdump-rtl-outof_cfglayout
14464 @opindex fdump-rtl-outof_cfglayout
14465 Dump after converting from cfglayout mode.
14466
14467 @item -fdump-rtl-peephole2
14468 @opindex fdump-rtl-peephole2
14469 Dump after the peephole pass.
14470
14471 @item -fdump-rtl-postreload
14472 @opindex fdump-rtl-postreload
14473 Dump after post-reload optimizations.
14474
14475 @item -fdump-rtl-pro_and_epilogue
14476 @opindex fdump-rtl-pro_and_epilogue
14477 Dump after generating the function prologues and epilogues.
14478
14479 @item -fdump-rtl-sched1
14480 @itemx -fdump-rtl-sched2
14481 @opindex fdump-rtl-sched1
14482 @opindex fdump-rtl-sched2
14483 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14484 after the basic block scheduling passes.
14485
14486 @item -fdump-rtl-ree
14487 @opindex fdump-rtl-ree
14488 Dump after sign/zero extension elimination.
14489
14490 @item -fdump-rtl-seqabstr
14491 @opindex fdump-rtl-seqabstr
14492 Dump after common sequence discovery.
14493
14494 @item -fdump-rtl-shorten
14495 @opindex fdump-rtl-shorten
14496 Dump after shortening branches.
14497
14498 @item -fdump-rtl-sibling
14499 @opindex fdump-rtl-sibling
14500 Dump after sibling call optimizations.
14501
14502 @item -fdump-rtl-split1
14503 @itemx -fdump-rtl-split2
14504 @itemx -fdump-rtl-split3
14505 @itemx -fdump-rtl-split4
14506 @itemx -fdump-rtl-split5
14507 @opindex fdump-rtl-split1
14508 @opindex fdump-rtl-split2
14509 @opindex fdump-rtl-split3
14510 @opindex fdump-rtl-split4
14511 @opindex fdump-rtl-split5
14512 These options enable dumping after five rounds of
14513 instruction splitting.
14514
14515 @item -fdump-rtl-sms
14516 @opindex fdump-rtl-sms
14517 Dump after modulo scheduling. This pass is only run on some
14518 architectures.
14519
14520 @item -fdump-rtl-stack
14521 @opindex fdump-rtl-stack
14522 Dump after conversion from GCC's ``flat register file'' registers to the
14523 x87's stack-like registers. This pass is only run on x86 variants.
14524
14525 @item -fdump-rtl-subreg1
14526 @itemx -fdump-rtl-subreg2
14527 @opindex fdump-rtl-subreg1
14528 @opindex fdump-rtl-subreg2
14529 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14530 the two subreg expansion passes.
14531
14532 @item -fdump-rtl-unshare
14533 @opindex fdump-rtl-unshare
14534 Dump after all rtl has been unshared.
14535
14536 @item -fdump-rtl-vartrack
14537 @opindex fdump-rtl-vartrack
14538 Dump after variable tracking.
14539
14540 @item -fdump-rtl-vregs
14541 @opindex fdump-rtl-vregs
14542 Dump after converting virtual registers to hard registers.
14543
14544 @item -fdump-rtl-web
14545 @opindex fdump-rtl-web
14546 Dump after live range splitting.
14547
14548 @item -fdump-rtl-regclass
14549 @itemx -fdump-rtl-subregs_of_mode_init
14550 @itemx -fdump-rtl-subregs_of_mode_finish
14551 @itemx -fdump-rtl-dfinit
14552 @itemx -fdump-rtl-dfinish
14553 @opindex fdump-rtl-regclass
14554 @opindex fdump-rtl-subregs_of_mode_init
14555 @opindex fdump-rtl-subregs_of_mode_finish
14556 @opindex fdump-rtl-dfinit
14557 @opindex fdump-rtl-dfinish
14558 These dumps are defined but always produce empty files.
14559
14560 @item -da
14561 @itemx -fdump-rtl-all
14562 @opindex da
14563 @opindex fdump-rtl-all
14564 Produce all the dumps listed above.
14565
14566 @item -dA
14567 @opindex dA
14568 Annotate the assembler output with miscellaneous debugging information.
14569
14570 @item -dD
14571 @opindex dD
14572 Dump all macro definitions, at the end of preprocessing, in addition to
14573 normal output.
14574
14575 @item -dH
14576 @opindex dH
14577 Produce a core dump whenever an error occurs.
14578
14579 @item -dp
14580 @opindex dp
14581 Annotate the assembler output with a comment indicating which
14582 pattern and alternative is used. The length and cost of each instruction are
14583 also printed.
14584
14585 @item -dP
14586 @opindex dP
14587 Dump the RTL in the assembler output as a comment before each instruction.
14588 Also turns on @option{-dp} annotation.
14589
14590 @item -dx
14591 @opindex dx
14592 Just generate RTL for a function instead of compiling it. Usually used
14593 with @option{-fdump-rtl-expand}.
14594 @end table
14595
14596 @item -fdump-debug
14597 @opindex fdump-debug
14598 Dump debugging information generated during the debug
14599 generation phase.
14600
14601 @item -fdump-earlydebug
14602 @opindex fdump-earlydebug
14603 Dump debugging information generated during the early debug
14604 generation phase.
14605
14606 @item -fdump-noaddr
14607 @opindex fdump-noaddr
14608 When doing debugging dumps, suppress address output. This makes it more
14609 feasible to use diff on debugging dumps for compiler invocations with
14610 different compiler binaries and/or different
14611 text / bss / data / heap / stack / dso start locations.
14612
14613 @item -freport-bug
14614 @opindex freport-bug
14615 Collect and dump debug information into a temporary file if an
14616 internal compiler error (ICE) occurs.
14617
14618 @item -fdump-unnumbered
14619 @opindex fdump-unnumbered
14620 When doing debugging dumps, suppress instruction numbers and address output.
14621 This makes it more feasible to use diff on debugging dumps for compiler
14622 invocations with different options, in particular with and without
14623 @option{-g}.
14624
14625 @item -fdump-unnumbered-links
14626 @opindex fdump-unnumbered-links
14627 When doing debugging dumps (see @option{-d} option above), suppress
14628 instruction numbers for the links to the previous and next instructions
14629 in a sequence.
14630
14631 @item -fdump-ipa-@var{switch}
14632 @itemx -fdump-ipa-@var{switch}-@var{options}
14633 @opindex fdump-ipa
14634 Control the dumping at various stages of inter-procedural analysis
14635 language tree to a file. The file name is generated by appending a
14636 switch specific suffix to the source file name, and the file is created
14637 in the same directory as the output file. The following dumps are
14638 possible:
14639
14640 @table @samp
14641 @item all
14642 Enables all inter-procedural analysis dumps.
14643
14644 @item cgraph
14645 Dumps information about call-graph optimization, unused function removal,
14646 and inlining decisions.
14647
14648 @item inline
14649 Dump after function inlining.
14650
14651 @end table
14652
14653 Additionally, the options @option{-optimized}, @option{-missed},
14654 @option{-note}, and @option{-all} can be provided, with the same meaning
14655 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14656
14657 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14658 information on callsites that were inlined, along with callsites
14659 that were not inlined.
14660
14661 By default, the dump will contain messages about successful
14662 optimizations (equivalent to @option{-optimized}) together with
14663 low-level details about the analysis.
14664
14665 @item -fdump-lang-all
14666 @itemx -fdump-lang-@var{switch}
14667 @itemx -fdump-lang-@var{switch}-@var{options}
14668 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14669 @opindex fdump-lang-all
14670 @opindex fdump-lang
14671 Control the dumping of language-specific information. The @var{options}
14672 and @var{filename} portions behave as described in the
14673 @option{-fdump-tree} option. The following @var{switch} values are
14674 accepted:
14675
14676 @table @samp
14677 @item all
14678
14679 Enable all language-specific dumps.
14680
14681 @item class
14682 Dump class hierarchy information. Virtual table information is emitted
14683 unless '@option{slim}' is specified. This option is applicable to C++ only.
14684
14685 @item raw
14686 Dump the raw internal tree data. This option is applicable to C++ only.
14687
14688 @end table
14689
14690 @item -fdump-passes
14691 @opindex fdump-passes
14692 Print on @file{stderr} the list of optimization passes that are turned
14693 on and off by the current command-line options.
14694
14695 @item -fdump-statistics-@var{option}
14696 @opindex fdump-statistics
14697 Enable and control dumping of pass statistics in a separate file. The
14698 file name is generated by appending a suffix ending in
14699 @samp{.statistics} to the source file name, and the file is created in
14700 the same directory as the output file. If the @samp{-@var{option}}
14701 form is used, @samp{-stats} causes counters to be summed over the
14702 whole compilation unit while @samp{-details} dumps every event as
14703 the passes generate them. The default with no option is to sum
14704 counters for each function compiled.
14705
14706 @item -fdump-tree-all
14707 @itemx -fdump-tree-@var{switch}
14708 @itemx -fdump-tree-@var{switch}-@var{options}
14709 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14710 @opindex fdump-tree-all
14711 @opindex fdump-tree
14712 Control the dumping at various stages of processing the intermediate
14713 language tree to a file. If the @samp{-@var{options}}
14714 form is used, @var{options} is a list of @samp{-} separated options
14715 which control the details of the dump. Not all options are applicable
14716 to all dumps; those that are not meaningful are ignored. The
14717 following options are available
14718
14719 @table @samp
14720 @item address
14721 Print the address of each node. Usually this is not meaningful as it
14722 changes according to the environment and source file. Its primary use
14723 is for tying up a dump file with a debug environment.
14724 @item asmname
14725 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14726 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14727 use working backward from mangled names in the assembly file.
14728 @item slim
14729 When dumping front-end intermediate representations, inhibit dumping
14730 of members of a scope or body of a function merely because that scope
14731 has been reached. Only dump such items when they are directly reachable
14732 by some other path.
14733
14734 When dumping pretty-printed trees, this option inhibits dumping the
14735 bodies of control structures.
14736
14737 When dumping RTL, print the RTL in slim (condensed) form instead of
14738 the default LISP-like representation.
14739 @item raw
14740 Print a raw representation of the tree. By default, trees are
14741 pretty-printed into a C-like representation.
14742 @item details
14743 Enable more detailed dumps (not honored by every dump option). Also
14744 include information from the optimization passes.
14745 @item stats
14746 Enable dumping various statistics about the pass (not honored by every dump
14747 option).
14748 @item blocks
14749 Enable showing basic block boundaries (disabled in raw dumps).
14750 @item graph
14751 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14752 dump a representation of the control flow graph suitable for viewing with
14753 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14754 the file is pretty-printed as a subgraph, so that GraphViz can render them
14755 all in a single plot.
14756
14757 This option currently only works for RTL dumps, and the RTL is always
14758 dumped in slim form.
14759 @item vops
14760 Enable showing virtual operands for every statement.
14761 @item lineno
14762 Enable showing line numbers for statements.
14763 @item uid
14764 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14765 @item verbose
14766 Enable showing the tree dump for each statement.
14767 @item eh
14768 Enable showing the EH region number holding each statement.
14769 @item scev
14770 Enable showing scalar evolution analysis details.
14771 @item optimized
14772 Enable showing optimization information (only available in certain
14773 passes).
14774 @item missed
14775 Enable showing missed optimization information (only available in certain
14776 passes).
14777 @item note
14778 Enable other detailed optimization information (only available in
14779 certain passes).
14780 @item all
14781 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14782 and @option{lineno}.
14783 @item optall
14784 Turn on all optimization options, i.e., @option{optimized},
14785 @option{missed}, and @option{note}.
14786 @end table
14787
14788 To determine what tree dumps are available or find the dump for a pass
14789 of interest follow the steps below.
14790
14791 @enumerate
14792 @item
14793 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14794 look for a code that corresponds to the pass you are interested in.
14795 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14796 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14797 The number at the end distinguishes distinct invocations of the same pass.
14798 @item
14799 To enable the creation of the dump file, append the pass code to
14800 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14801 to enable the dump from the Early Value Range Propagation pass, invoke
14802 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14803 specify the name of the dump file. If you don't specify one, GCC
14804 creates as described below.
14805 @item
14806 Find the pass dump in a file whose name is composed of three components
14807 separated by a period: the name of the source file GCC was invoked to
14808 compile, a numeric suffix indicating the pass number followed by the
14809 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14810 and finally the pass code. For example, the Early VRP pass dump might
14811 be in a file named @file{myfile.c.038t.evrp} in the current working
14812 directory. Note that the numeric codes are not stable and may change
14813 from one version of GCC to another.
14814 @end enumerate
14815
14816 @item -fopt-info
14817 @itemx -fopt-info-@var{options}
14818 @itemx -fopt-info-@var{options}=@var{filename}
14819 @opindex fopt-info
14820 Controls optimization dumps from various optimization passes. If the
14821 @samp{-@var{options}} form is used, @var{options} is a list of
14822 @samp{-} separated option keywords to select the dump details and
14823 optimizations.
14824
14825 The @var{options} can be divided into three groups:
14826 @enumerate
14827 @item
14828 options describing what kinds of messages should be emitted,
14829 @item
14830 options describing the verbosity of the dump, and
14831 @item
14832 options describing which optimizations should be included.
14833 @end enumerate
14834 The options from each group can be freely mixed as they are
14835 non-overlapping. However, in case of any conflicts,
14836 the later options override the earlier options on the command
14837 line.
14838
14839 The following options control which kinds of messages should be emitted:
14840
14841 @table @samp
14842 @item optimized
14843 Print information when an optimization is successfully applied. It is
14844 up to a pass to decide which information is relevant. For example, the
14845 vectorizer passes print the source location of loops which are
14846 successfully vectorized.
14847 @item missed
14848 Print information about missed optimizations. Individual passes
14849 control which information to include in the output.
14850 @item note
14851 Print verbose information about optimizations, such as certain
14852 transformations, more detailed messages about decisions etc.
14853 @item all
14854 Print detailed optimization information. This includes
14855 @samp{optimized}, @samp{missed}, and @samp{note}.
14856 @end table
14857
14858 The following option controls the dump verbosity:
14859
14860 @table @samp
14861 @item internals
14862 By default, only ``high-level'' messages are emitted. This option enables
14863 additional, more detailed, messages, which are likely to only be of interest
14864 to GCC developers.
14865 @end table
14866
14867 One or more of the following option keywords can be used to describe a
14868 group of optimizations:
14869
14870 @table @samp
14871 @item ipa
14872 Enable dumps from all interprocedural optimizations.
14873 @item loop
14874 Enable dumps from all loop optimizations.
14875 @item inline
14876 Enable dumps from all inlining optimizations.
14877 @item omp
14878 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14879 @item vec
14880 Enable dumps from all vectorization optimizations.
14881 @item optall
14882 Enable dumps from all optimizations. This is a superset of
14883 the optimization groups listed above.
14884 @end table
14885
14886 If @var{options} is
14887 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14888 about successful optimizations from all the passes, omitting messages
14889 that are treated as ``internals''.
14890
14891 If the @var{filename} is provided, then the dumps from all the
14892 applicable optimizations are concatenated into the @var{filename}.
14893 Otherwise the dump is output onto @file{stderr}. Though multiple
14894 @option{-fopt-info} options are accepted, only one of them can include
14895 a @var{filename}. If other filenames are provided then all but the
14896 first such option are ignored.
14897
14898 Note that the output @var{filename} is overwritten
14899 in case of multiple translation units. If a combined output from
14900 multiple translation units is desired, @file{stderr} should be used
14901 instead.
14902
14903 In the following example, the optimization info is output to
14904 @file{stderr}:
14905
14906 @smallexample
14907 gcc -O3 -fopt-info
14908 @end smallexample
14909
14910 This example:
14911 @smallexample
14912 gcc -O3 -fopt-info-missed=missed.all
14913 @end smallexample
14914
14915 @noindent
14916 outputs missed optimization report from all the passes into
14917 @file{missed.all}, and this one:
14918
14919 @smallexample
14920 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14921 @end smallexample
14922
14923 @noindent
14924 prints information about missed optimization opportunities from
14925 vectorization passes on @file{stderr}.
14926 Note that @option{-fopt-info-vec-missed} is equivalent to
14927 @option{-fopt-info-missed-vec}. The order of the optimization group
14928 names and message types listed after @option{-fopt-info} does not matter.
14929
14930 As another example,
14931 @smallexample
14932 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14933 @end smallexample
14934
14935 @noindent
14936 outputs information about missed optimizations as well as
14937 optimized locations from all the inlining passes into
14938 @file{inline.txt}.
14939
14940 Finally, consider:
14941
14942 @smallexample
14943 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14944 @end smallexample
14945
14946 @noindent
14947 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14948 in conflict since only one output file is allowed. In this case, only
14949 the first option takes effect and the subsequent options are
14950 ignored. Thus only @file{vec.miss} is produced which contains
14951 dumps from the vectorizer about missed opportunities.
14952
14953 @item -fsave-optimization-record
14954 @opindex fsave-optimization-record
14955 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
14956 were performed, for those optimizations that support @option{-fopt-info}.
14957
14958 This option is experimental and the format of the data within the
14959 compressed JSON file is subject to change.
14960
14961 It is roughly equivalent to a machine-readable version of
14962 @option{-fopt-info-all}, as a collection of messages with source file,
14963 line number and column number, with the following additional data for
14964 each message:
14965
14966 @itemize @bullet
14967
14968 @item
14969 the execution count of the code being optimized, along with metadata about
14970 whether this was from actual profile data, or just an estimate, allowing
14971 consumers to prioritize messages by code hotness,
14972
14973 @item
14974 the function name of the code being optimized, where applicable,
14975
14976 @item
14977 the ``inlining chain'' for the code being optimized, so that when
14978 a function is inlined into several different places (which might
14979 themselves be inlined), the reader can distinguish between the copies,
14980
14981 @item
14982 objects identifying those parts of the message that refer to expressions,
14983 statements or symbol-table nodes, which of these categories they are, and,
14984 when available, their source code location,
14985
14986 @item
14987 the GCC pass that emitted the message, and
14988
14989 @item
14990 the location in GCC's own code from which the message was emitted
14991
14992 @end itemize
14993
14994 Additionally, some messages are logically nested within other
14995 messages, reflecting implementation details of the optimization
14996 passes.
14997
14998 @item -fsched-verbose=@var{n}
14999 @opindex fsched-verbose
15000 On targets that use instruction scheduling, this option controls the
15001 amount of debugging output the scheduler prints to the dump files.
15002
15003 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15004 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15005 For @var{n} greater than one, it also output basic block probabilities,
15006 detailed ready list information and unit/insn info. For @var{n} greater
15007 than two, it includes RTL at abort point, control-flow and regions info.
15008 And for @var{n} over four, @option{-fsched-verbose} also includes
15009 dependence info.
15010
15011
15012
15013 @item -fenable-@var{kind}-@var{pass}
15014 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15015 @opindex fdisable-
15016 @opindex fenable-
15017
15018 This is a set of options that are used to explicitly disable/enable
15019 optimization passes. These options are intended for use for debugging GCC.
15020 Compiler users should use regular options for enabling/disabling
15021 passes instead.
15022
15023 @table @gcctabopt
15024
15025 @item -fdisable-ipa-@var{pass}
15026 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15027 statically invoked in the compiler multiple times, the pass name should be
15028 appended with a sequential number starting from 1.
15029
15030 @item -fdisable-rtl-@var{pass}
15031 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15032 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15033 statically invoked in the compiler multiple times, the pass name should be
15034 appended with a sequential number starting from 1. @var{range-list} is a
15035 comma-separated list of function ranges or assembler names. Each range is a number
15036 pair separated by a colon. The range is inclusive in both ends. If the range
15037 is trivial, the number pair can be simplified as a single number. If the
15038 function's call graph node's @var{uid} falls within one of the specified ranges,
15039 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15040 function header of a dump file, and the pass names can be dumped by using
15041 option @option{-fdump-passes}.
15042
15043 @item -fdisable-tree-@var{pass}
15044 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15045 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15046 option arguments.
15047
15048 @item -fenable-ipa-@var{pass}
15049 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15050 statically invoked in the compiler multiple times, the pass name should be
15051 appended with a sequential number starting from 1.
15052
15053 @item -fenable-rtl-@var{pass}
15054 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15055 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15056 description and examples.
15057
15058 @item -fenable-tree-@var{pass}
15059 @itemx -fenable-tree-@var{pass}=@var{range-list}
15060 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15061 of option arguments.
15062
15063 @end table
15064
15065 Here are some examples showing uses of these options.
15066
15067 @smallexample
15068
15069 # disable ccp1 for all functions
15070 -fdisable-tree-ccp1
15071 # disable complete unroll for function whose cgraph node uid is 1
15072 -fenable-tree-cunroll=1
15073 # disable gcse2 for functions at the following ranges [1,1],
15074 # [300,400], and [400,1000]
15075 # disable gcse2 for functions foo and foo2
15076 -fdisable-rtl-gcse2=foo,foo2
15077 # disable early inlining
15078 -fdisable-tree-einline
15079 # disable ipa inlining
15080 -fdisable-ipa-inline
15081 # enable tree full unroll
15082 -fenable-tree-unroll
15083
15084 @end smallexample
15085
15086 @item -fchecking
15087 @itemx -fchecking=@var{n}
15088 @opindex fchecking
15089 @opindex fno-checking
15090 Enable internal consistency checking. The default depends on
15091 the compiler configuration. @option{-fchecking=2} enables further
15092 internal consistency checking that might affect code generation.
15093
15094 @item -frandom-seed=@var{string}
15095 @opindex frandom-seed
15096 This option provides a seed that GCC uses in place of
15097 random numbers in generating certain symbol names
15098 that have to be different in every compiled file. It is also used to
15099 place unique stamps in coverage data files and the object files that
15100 produce them. You can use the @option{-frandom-seed} option to produce
15101 reproducibly identical object files.
15102
15103 The @var{string} can either be a number (decimal, octal or hex) or an
15104 arbitrary string (in which case it's converted to a number by
15105 computing CRC32).
15106
15107 The @var{string} should be different for every file you compile.
15108
15109 @item -save-temps
15110 @itemx -save-temps=cwd
15111 @opindex save-temps
15112 Store the usual ``temporary'' intermediate files permanently; place them
15113 in the current directory and name them based on the source file. Thus,
15114 compiling @file{foo.c} with @option{-c -save-temps} produces files
15115 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15116 preprocessed @file{foo.i} output file even though the compiler now
15117 normally uses an integrated preprocessor.
15118
15119 When used in combination with the @option{-x} command-line option,
15120 @option{-save-temps} is sensible enough to avoid over writing an
15121 input source file with the same extension as an intermediate file.
15122 The corresponding intermediate file may be obtained by renaming the
15123 source file before using @option{-save-temps}.
15124
15125 If you invoke GCC in parallel, compiling several different source
15126 files that share a common base name in different subdirectories or the
15127 same source file compiled for multiple output destinations, it is
15128 likely that the different parallel compilers will interfere with each
15129 other, and overwrite the temporary files. For instance:
15130
15131 @smallexample
15132 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15133 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15134 @end smallexample
15135
15136 may result in @file{foo.i} and @file{foo.o} being written to
15137 simultaneously by both compilers.
15138
15139 @item -save-temps=obj
15140 @opindex save-temps=obj
15141 Store the usual ``temporary'' intermediate files permanently. If the
15142 @option{-o} option is used, the temporary files are based on the
15143 object file. If the @option{-o} option is not used, the
15144 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15145
15146 For example:
15147
15148 @smallexample
15149 gcc -save-temps=obj -c foo.c
15150 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15151 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15152 @end smallexample
15153
15154 @noindent
15155 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15156 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15157 @file{dir2/yfoobar.o}.
15158
15159 @item -time@r{[}=@var{file}@r{]}
15160 @opindex time
15161 Report the CPU time taken by each subprocess in the compilation
15162 sequence. For C source files, this is the compiler proper and assembler
15163 (plus the linker if linking is done).
15164
15165 Without the specification of an output file, the output looks like this:
15166
15167 @smallexample
15168 # cc1 0.12 0.01
15169 # as 0.00 0.01
15170 @end smallexample
15171
15172 The first number on each line is the ``user time'', that is time spent
15173 executing the program itself. The second number is ``system time'',
15174 time spent executing operating system routines on behalf of the program.
15175 Both numbers are in seconds.
15176
15177 With the specification of an output file, the output is appended to the
15178 named file, and it looks like this:
15179
15180 @smallexample
15181 0.12 0.01 cc1 @var{options}
15182 0.00 0.01 as @var{options}
15183 @end smallexample
15184
15185 The ``user time'' and the ``system time'' are moved before the program
15186 name, and the options passed to the program are displayed, so that one
15187 can later tell what file was being compiled, and with which options.
15188
15189 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15190 @opindex fdump-final-insns
15191 Dump the final internal representation (RTL) to @var{file}. If the
15192 optional argument is omitted (or if @var{file} is @code{.}), the name
15193 of the dump file is determined by appending @code{.gkd} to the
15194 compilation output file name.
15195
15196 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15197 @opindex fcompare-debug
15198 @opindex fno-compare-debug
15199 If no error occurs during compilation, run the compiler a second time,
15200 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15201 passed to the second compilation. Dump the final internal
15202 representation in both compilations, and print an error if they differ.
15203
15204 If the equal sign is omitted, the default @option{-gtoggle} is used.
15205
15206 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15207 and nonzero, implicitly enables @option{-fcompare-debug}. If
15208 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15209 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15210 is used.
15211
15212 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15213 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15214 of the final representation and the second compilation, preventing even
15215 @env{GCC_COMPARE_DEBUG} from taking effect.
15216
15217 To verify full coverage during @option{-fcompare-debug} testing, set
15218 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15219 which GCC rejects as an invalid option in any actual compilation
15220 (rather than preprocessing, assembly or linking). To get just a
15221 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15222 not overridden} will do.
15223
15224 @item -fcompare-debug-second
15225 @opindex fcompare-debug-second
15226 This option is implicitly passed to the compiler for the second
15227 compilation requested by @option{-fcompare-debug}, along with options to
15228 silence warnings, and omitting other options that would cause the compiler
15229 to produce output to files or to standard output as a side effect. Dump
15230 files and preserved temporary files are renamed so as to contain the
15231 @code{.gk} additional extension during the second compilation, to avoid
15232 overwriting those generated by the first.
15233
15234 When this option is passed to the compiler driver, it causes the
15235 @emph{first} compilation to be skipped, which makes it useful for little
15236 other than debugging the compiler proper.
15237
15238 @item -gtoggle
15239 @opindex gtoggle
15240 Turn off generation of debug info, if leaving out this option
15241 generates it, or turn it on at level 2 otherwise. The position of this
15242 argument in the command line does not matter; it takes effect after all
15243 other options are processed, and it does so only once, no matter how
15244 many times it is given. This is mainly intended to be used with
15245 @option{-fcompare-debug}.
15246
15247 @item -fvar-tracking-assignments-toggle
15248 @opindex fvar-tracking-assignments-toggle
15249 @opindex fno-var-tracking-assignments-toggle
15250 Toggle @option{-fvar-tracking-assignments}, in the same way that
15251 @option{-gtoggle} toggles @option{-g}.
15252
15253 @item -Q
15254 @opindex Q
15255 Makes the compiler print out each function name as it is compiled, and
15256 print some statistics about each pass when it finishes.
15257
15258 @item -ftime-report
15259 @opindex ftime-report
15260 Makes the compiler print some statistics about the time consumed by each
15261 pass when it finishes.
15262
15263 @item -ftime-report-details
15264 @opindex ftime-report-details
15265 Record the time consumed by infrastructure parts separately for each pass.
15266
15267 @item -fira-verbose=@var{n}
15268 @opindex fira-verbose
15269 Control the verbosity of the dump file for the integrated register allocator.
15270 The default value is 5. If the value @var{n} is greater or equal to 10,
15271 the dump output is sent to stderr using the same format as @var{n} minus 10.
15272
15273 @item -flto-report
15274 @opindex flto-report
15275 Prints a report with internal details on the workings of the link-time
15276 optimizer. The contents of this report vary from version to version.
15277 It is meant to be useful to GCC developers when processing object
15278 files in LTO mode (via @option{-flto}).
15279
15280 Disabled by default.
15281
15282 @item -flto-report-wpa
15283 @opindex flto-report-wpa
15284 Like @option{-flto-report}, but only print for the WPA phase of Link
15285 Time Optimization.
15286
15287 @item -fmem-report
15288 @opindex fmem-report
15289 Makes the compiler print some statistics about permanent memory
15290 allocation when it finishes.
15291
15292 @item -fmem-report-wpa
15293 @opindex fmem-report-wpa
15294 Makes the compiler print some statistics about permanent memory
15295 allocation for the WPA phase only.
15296
15297 @item -fpre-ipa-mem-report
15298 @opindex fpre-ipa-mem-report
15299 @item -fpost-ipa-mem-report
15300 @opindex fpost-ipa-mem-report
15301 Makes the compiler print some statistics about permanent memory
15302 allocation before or after interprocedural optimization.
15303
15304 @item -fprofile-report
15305 @opindex fprofile-report
15306 Makes the compiler print some statistics about consistency of the
15307 (estimated) profile and effect of individual passes.
15308
15309 @item -fstack-usage
15310 @opindex fstack-usage
15311 Makes the compiler output stack usage information for the program, on a
15312 per-function basis. The filename for the dump is made by appending
15313 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15314 the output file, if explicitly specified and it is not an executable,
15315 otherwise it is the basename of the source file. An entry is made up
15316 of three fields:
15317
15318 @itemize
15319 @item
15320 The name of the function.
15321 @item
15322 A number of bytes.
15323 @item
15324 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15325 @end itemize
15326
15327 The qualifier @code{static} means that the function manipulates the stack
15328 statically: a fixed number of bytes are allocated for the frame on function
15329 entry and released on function exit; no stack adjustments are otherwise made
15330 in the function. The second field is this fixed number of bytes.
15331
15332 The qualifier @code{dynamic} means that the function manipulates the stack
15333 dynamically: in addition to the static allocation described above, stack
15334 adjustments are made in the body of the function, for example to push/pop
15335 arguments around function calls. If the qualifier @code{bounded} is also
15336 present, the amount of these adjustments is bounded at compile time and
15337 the second field is an upper bound of the total amount of stack used by
15338 the function. If it is not present, the amount of these adjustments is
15339 not bounded at compile time and the second field only represents the
15340 bounded part.
15341
15342 @item -fstats
15343 @opindex fstats
15344 Emit statistics about front-end processing at the end of the compilation.
15345 This option is supported only by the C++ front end, and
15346 the information is generally only useful to the G++ development team.
15347
15348 @item -fdbg-cnt-list
15349 @opindex fdbg-cnt-list
15350 Print the name and the counter upper bound for all debug counters.
15351
15352
15353 @item -fdbg-cnt=@var{counter-value-list}
15354 @opindex fdbg-cnt
15355 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15356 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15357 tuples which sets the lower and the upper bound of each debug
15358 counter @var{name}. The @var{lower_bound} is optional and is zero
15359 initialized if not set.
15360 All debug counters have the initial upper bound of @code{UINT_MAX};
15361 thus @code{dbg_cnt} returns true always unless the upper bound
15362 is set by this option.
15363 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15364 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15365 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15366
15367 @item -print-file-name=@var{library}
15368 @opindex print-file-name
15369 Print the full absolute name of the library file @var{library} that
15370 would be used when linking---and don't do anything else. With this
15371 option, GCC does not compile or link anything; it just prints the
15372 file name.
15373
15374 @item -print-multi-directory
15375 @opindex print-multi-directory
15376 Print the directory name corresponding to the multilib selected by any
15377 other switches present in the command line. This directory is supposed
15378 to exist in @env{GCC_EXEC_PREFIX}.
15379
15380 @item -print-multi-lib
15381 @opindex print-multi-lib
15382 Print the mapping from multilib directory names to compiler switches
15383 that enable them. The directory name is separated from the switches by
15384 @samp{;}, and each switch starts with an @samp{@@} instead of the
15385 @samp{-}, without spaces between multiple switches. This is supposed to
15386 ease shell processing.
15387
15388 @item -print-multi-os-directory
15389 @opindex print-multi-os-directory
15390 Print the path to OS libraries for the selected
15391 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15392 present in the @file{lib} subdirectory and no multilibs are used, this is
15393 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15394 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15395 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15396 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15397
15398 @item -print-multiarch
15399 @opindex print-multiarch
15400 Print the path to OS libraries for the selected multiarch,
15401 relative to some @file{lib} subdirectory.
15402
15403 @item -print-prog-name=@var{program}
15404 @opindex print-prog-name
15405 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15406
15407 @item -print-libgcc-file-name
15408 @opindex print-libgcc-file-name
15409 Same as @option{-print-file-name=libgcc.a}.
15410
15411 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15412 but you do want to link with @file{libgcc.a}. You can do:
15413
15414 @smallexample
15415 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15416 @end smallexample
15417
15418 @item -print-search-dirs
15419 @opindex print-search-dirs
15420 Print the name of the configured installation directory and a list of
15421 program and library directories @command{gcc} searches---and don't do anything else.
15422
15423 This is useful when @command{gcc} prints the error message
15424 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15425 To resolve this you either need to put @file{cpp0} and the other compiler
15426 components where @command{gcc} expects to find them, or you can set the environment
15427 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15428 Don't forget the trailing @samp{/}.
15429 @xref{Environment Variables}.
15430
15431 @item -print-sysroot
15432 @opindex print-sysroot
15433 Print the target sysroot directory that is used during
15434 compilation. This is the target sysroot specified either at configure
15435 time or using the @option{--sysroot} option, possibly with an extra
15436 suffix that depends on compilation options. If no target sysroot is
15437 specified, the option prints nothing.
15438
15439 @item -print-sysroot-headers-suffix
15440 @opindex print-sysroot-headers-suffix
15441 Print the suffix added to the target sysroot when searching for
15442 headers, or give an error if the compiler is not configured with such
15443 a suffix---and don't do anything else.
15444
15445 @item -dumpmachine
15446 @opindex dumpmachine
15447 Print the compiler's target machine (for example,
15448 @samp{i686-pc-linux-gnu})---and don't do anything else.
15449
15450 @item -dumpversion
15451 @opindex dumpversion
15452 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15453 anything else. This is the compiler version used in filesystem paths and
15454 specs. Depending on how the compiler has been configured it can be just
15455 a single number (major version), two numbers separated by a dot (major and
15456 minor version) or three numbers separated by dots (major, minor and patchlevel
15457 version).
15458
15459 @item -dumpfullversion
15460 @opindex dumpfullversion
15461 Print the full compiler version---and don't do anything else. The output is
15462 always three numbers separated by dots, major, minor and patchlevel version.
15463
15464 @item -dumpspecs
15465 @opindex dumpspecs
15466 Print the compiler's built-in specs---and don't do anything else. (This
15467 is used when GCC itself is being built.) @xref{Spec Files}.
15468 @end table
15469
15470 @node Submodel Options
15471 @section Machine-Dependent Options
15472 @cindex submodel options
15473 @cindex specifying hardware config
15474 @cindex hardware models and configurations, specifying
15475 @cindex target-dependent options
15476 @cindex machine-dependent options
15477
15478 Each target machine supported by GCC can have its own options---for
15479 example, to allow you to compile for a particular processor variant or
15480 ABI, or to control optimizations specific to that machine. By
15481 convention, the names of machine-specific options start with
15482 @samp{-m}.
15483
15484 Some configurations of the compiler also support additional target-specific
15485 options, usually for compatibility with other compilers on the same
15486 platform.
15487
15488 @c This list is ordered alphanumerically by subsection name.
15489 @c It should be the same order and spelling as these options are listed
15490 @c in Machine Dependent Options
15491
15492 @menu
15493 * AArch64 Options::
15494 * Adapteva Epiphany Options::
15495 * AMD GCN Options::
15496 * ARC Options::
15497 * ARM Options::
15498 * AVR Options::
15499 * Blackfin Options::
15500 * C6X Options::
15501 * CRIS Options::
15502 * CR16 Options::
15503 * C-SKY Options::
15504 * Darwin Options::
15505 * DEC Alpha Options::
15506 * FR30 Options::
15507 * FT32 Options::
15508 * FRV Options::
15509 * GNU/Linux Options::
15510 * H8/300 Options::
15511 * HPPA Options::
15512 * IA-64 Options::
15513 * LM32 Options::
15514 * M32C Options::
15515 * M32R/D Options::
15516 * M680x0 Options::
15517 * MCore Options::
15518 * MeP Options::
15519 * MicroBlaze Options::
15520 * MIPS Options::
15521 * MMIX Options::
15522 * MN10300 Options::
15523 * Moxie Options::
15524 * MSP430 Options::
15525 * NDS32 Options::
15526 * Nios II Options::
15527 * Nvidia PTX Options::
15528 * OpenRISC Options::
15529 * PDP-11 Options::
15530 * picoChip Options::
15531 * PowerPC Options::
15532 * RISC-V Options::
15533 * RL78 Options::
15534 * RS/6000 and PowerPC Options::
15535 * RX Options::
15536 * S/390 and zSeries Options::
15537 * Score Options::
15538 * SH Options::
15539 * Solaris 2 Options::
15540 * SPARC Options::
15541 * SPU Options::
15542 * System V Options::
15543 * TILE-Gx Options::
15544 * TILEPro Options::
15545 * V850 Options::
15546 * VAX Options::
15547 * Visium Options::
15548 * VMS Options::
15549 * VxWorks Options::
15550 * x86 Options::
15551 * x86 Windows Options::
15552 * Xstormy16 Options::
15553 * Xtensa Options::
15554 * zSeries Options::
15555 @end menu
15556
15557 @node AArch64 Options
15558 @subsection AArch64 Options
15559 @cindex AArch64 Options
15560
15561 These options are defined for AArch64 implementations:
15562
15563 @table @gcctabopt
15564
15565 @item -mabi=@var{name}
15566 @opindex mabi
15567 Generate code for the specified data model. Permissible values
15568 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15569 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15570 but long int and pointers are 64 bits.
15571
15572 The default depends on the specific target configuration. Note that
15573 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15574 entire program with the same ABI, and link with a compatible set of libraries.
15575
15576 @item -mbig-endian
15577 @opindex mbig-endian
15578 Generate big-endian code. This is the default when GCC is configured for an
15579 @samp{aarch64_be-*-*} target.
15580
15581 @item -mgeneral-regs-only
15582 @opindex mgeneral-regs-only
15583 Generate code which uses only the general-purpose registers. This will prevent
15584 the compiler from using floating-point and Advanced SIMD registers but will not
15585 impose any restrictions on the assembler.
15586
15587 @item -mlittle-endian
15588 @opindex mlittle-endian
15589 Generate little-endian code. This is the default when GCC is configured for an
15590 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15591
15592 @item -mcmodel=tiny
15593 @opindex mcmodel=tiny
15594 Generate code for the tiny code model. The program and its statically defined
15595 symbols must be within 1MB of each other. Programs can be statically or
15596 dynamically linked.
15597
15598 @item -mcmodel=small
15599 @opindex mcmodel=small
15600 Generate code for the small code model. The program and its statically defined
15601 symbols must be within 4GB of each other. Programs can be statically or
15602 dynamically linked. This is the default code model.
15603
15604 @item -mcmodel=large
15605 @opindex mcmodel=large
15606 Generate code for the large code model. This makes no assumptions about
15607 addresses and sizes of sections. Programs can be statically linked only.
15608
15609 @item -mstrict-align
15610 @itemx -mno-strict-align
15611 @opindex mstrict-align
15612 @opindex mno-strict-align
15613 Avoid or allow generating memory accesses that may not be aligned on a natural
15614 object boundary as described in the architecture specification.
15615
15616 @item -momit-leaf-frame-pointer
15617 @itemx -mno-omit-leaf-frame-pointer
15618 @opindex momit-leaf-frame-pointer
15619 @opindex mno-omit-leaf-frame-pointer
15620 Omit or keep the frame pointer in leaf functions. The former behavior is the
15621 default.
15622
15623 @item -mstack-protector-guard=@var{guard}
15624 @itemx -mstack-protector-guard-reg=@var{reg}
15625 @itemx -mstack-protector-guard-offset=@var{offset}
15626 @opindex mstack-protector-guard
15627 @opindex mstack-protector-guard-reg
15628 @opindex mstack-protector-guard-offset
15629 Generate stack protection code using canary at @var{guard}. Supported
15630 locations are @samp{global} for a global canary or @samp{sysreg} for a
15631 canary in an appropriate system register.
15632
15633 With the latter choice the options
15634 @option{-mstack-protector-guard-reg=@var{reg}} and
15635 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15636 which system register to use as base register for reading the canary,
15637 and from what offset from that base register. There is no default
15638 register or offset as this is entirely for use within the Linux
15639 kernel.
15640
15641 @item -mstack-protector-guard=@var{guard}
15642 @itemx -mstack-protector-guard-reg=@var{reg}
15643 @itemx -mstack-protector-guard-offset=@var{offset}
15644 @opindex mstack-protector-guard
15645 @opindex mstack-protector-guard-reg
15646 @opindex mstack-protector-guard-offset
15647 Generate stack protection code using canary at @var{guard}. Supported
15648 locations are @samp{global} for a global canary or @samp{sysreg} for a
15649 canary in an appropriate system register.
15650
15651 With the latter choice the options
15652 @option{-mstack-protector-guard-reg=@var{reg}} and
15653 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15654 which system register to use as base register for reading the canary,
15655 and from what offset from that base register. There is no default
15656 register or offset as this is entirely for use within the Linux
15657 kernel.
15658
15659 @item -mtls-dialect=desc
15660 @opindex mtls-dialect=desc
15661 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15662 of TLS variables. This is the default.
15663
15664 @item -mtls-dialect=traditional
15665 @opindex mtls-dialect=traditional
15666 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15667 of TLS variables.
15668
15669 @item -mtls-size=@var{size}
15670 @opindex mtls-size
15671 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15672 This option requires binutils 2.26 or newer.
15673
15674 @item -mfix-cortex-a53-835769
15675 @itemx -mno-fix-cortex-a53-835769
15676 @opindex mfix-cortex-a53-835769
15677 @opindex mno-fix-cortex-a53-835769
15678 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15679 This involves inserting a NOP instruction between memory instructions and
15680 64-bit integer multiply-accumulate instructions.
15681
15682 @item -mfix-cortex-a53-843419
15683 @itemx -mno-fix-cortex-a53-843419
15684 @opindex mfix-cortex-a53-843419
15685 @opindex mno-fix-cortex-a53-843419
15686 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15687 This erratum workaround is made at link time and this will only pass the
15688 corresponding flag to the linker.
15689
15690 @item -mlow-precision-recip-sqrt
15691 @itemx -mno-low-precision-recip-sqrt
15692 @opindex mlow-precision-recip-sqrt
15693 @opindex mno-low-precision-recip-sqrt
15694 Enable or disable the reciprocal square root approximation.
15695 This option only has an effect if @option{-ffast-math} or
15696 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15697 precision of reciprocal square root results to about 16 bits for
15698 single precision and to 32 bits for double precision.
15699
15700 @item -mlow-precision-sqrt
15701 @itemx -mno-low-precision-sqrt
15702 @opindex mlow-precision-sqrt
15703 @opindex mno-low-precision-sqrt
15704 Enable or disable the square root approximation.
15705 This option only has an effect if @option{-ffast-math} or
15706 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15707 precision of square root results to about 16 bits for
15708 single precision and to 32 bits for double precision.
15709 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15710
15711 @item -mlow-precision-div
15712 @itemx -mno-low-precision-div
15713 @opindex mlow-precision-div
15714 @opindex mno-low-precision-div
15715 Enable or disable the division approximation.
15716 This option only has an effect if @option{-ffast-math} or
15717 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15718 precision of division results to about 16 bits for
15719 single precision and to 32 bits for double precision.
15720
15721 @item -mtrack-speculation
15722 @itemx -mno-track-speculation
15723 Enable or disable generation of additional code to track speculative
15724 execution through conditional branches. The tracking state can then
15725 be used by the compiler when expanding calls to
15726 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15727 sequence to be generated.
15728
15729 @item -march=@var{name}
15730 @opindex march
15731 Specify the name of the target architecture and, optionally, one or
15732 more feature modifiers. This option has the form
15733 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15734
15735 The permissible values for @var{arch} are @samp{armv8-a},
15736 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15737 @samp{armv8.5-a} or @var{native}.
15738
15739 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15740 support for the ARMv8.5-A architecture extensions.
15741
15742 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15743 support for the ARMv8.4-A architecture extensions.
15744
15745 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15746 support for the ARMv8.3-A architecture extensions.
15747
15748 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15749 support for the ARMv8.2-A architecture extensions.
15750
15751 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15752 support for the ARMv8.1-A architecture extension. In particular, it
15753 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15754
15755 The value @samp{native} is available on native AArch64 GNU/Linux and
15756 causes the compiler to pick the architecture of the host system. This
15757 option has no effect if the compiler is unable to recognize the
15758 architecture of the host system,
15759
15760 The permissible values for @var{feature} are listed in the sub-section
15761 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15762 Feature Modifiers}. Where conflicting feature modifiers are
15763 specified, the right-most feature is used.
15764
15765 GCC uses @var{name} to determine what kind of instructions it can emit
15766 when generating assembly code. If @option{-march} is specified
15767 without either of @option{-mtune} or @option{-mcpu} also being
15768 specified, the code is tuned to perform well across a range of target
15769 processors implementing the target architecture.
15770
15771 @item -mtune=@var{name}
15772 @opindex mtune
15773 Specify the name of the target processor for which GCC should tune the
15774 performance of the code. Permissible values for this option are:
15775 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15776 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15777 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15778 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15779 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15780 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15781 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15782 @samp{thunderxt83}, @samp{thunderx2t99},
15783 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15784 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15785 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15786 @samp{native}.
15787
15788 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15789 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15790 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15791 should tune for a big.LITTLE system.
15792
15793 Additionally on native AArch64 GNU/Linux systems the value
15794 @samp{native} tunes performance to the host system. This option has no effect
15795 if the compiler is unable to recognize the processor of the host system.
15796
15797 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15798 are specified, the code is tuned to perform well across a range
15799 of target processors.
15800
15801 This option cannot be suffixed by feature modifiers.
15802
15803 @item -mcpu=@var{name}
15804 @opindex mcpu
15805 Specify the name of the target processor, optionally suffixed by one
15806 or more feature modifiers. This option has the form
15807 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15808 the permissible values for @var{cpu} are the same as those available
15809 for @option{-mtune}. The permissible values for @var{feature} are
15810 documented in the sub-section on
15811 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15812 Feature Modifiers}. Where conflicting feature modifiers are
15813 specified, the right-most feature is used.
15814
15815 GCC uses @var{name} to determine what kind of instructions it can emit when
15816 generating assembly code (as if by @option{-march}) and to determine
15817 the target processor for which to tune for performance (as if
15818 by @option{-mtune}). Where this option is used in conjunction
15819 with @option{-march} or @option{-mtune}, those options take precedence
15820 over the appropriate part of this option.
15821
15822 @item -moverride=@var{string}
15823 @opindex moverride
15824 Override tuning decisions made by the back-end in response to a
15825 @option{-mtune=} switch. The syntax, semantics, and accepted values
15826 for @var{string} in this option are not guaranteed to be consistent
15827 across releases.
15828
15829 This option is only intended to be useful when developing GCC.
15830
15831 @item -mverbose-cost-dump
15832 @opindex mverbose-cost-dump
15833 Enable verbose cost model dumping in the debug dump files. This option is
15834 provided for use in debugging the compiler.
15835
15836 @item -mpc-relative-literal-loads
15837 @itemx -mno-pc-relative-literal-loads
15838 @opindex mpc-relative-literal-loads
15839 @opindex mno-pc-relative-literal-loads
15840 Enable or disable PC-relative literal loads. With this option literal pools are
15841 accessed using a single instruction and emitted after each function. This
15842 limits the maximum size of functions to 1MB. This is enabled by default for
15843 @option{-mcmodel=tiny}.
15844
15845 @item -msign-return-address=@var{scope}
15846 @opindex msign-return-address
15847 Select the function scope on which return address signing will be applied.
15848 Permissible values are @samp{none}, which disables return address signing,
15849 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15850 functions, and @samp{all}, which enables pointer signing for all functions. The
15851 default value is @samp{none}. This option has been deprecated by
15852 -mbranch-protection.
15853
15854 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
15855 @opindex mbranch-protection
15856 Select the branch protection features to use.
15857 @samp{none} is the default and turns off all types of branch protection.
15858 @samp{standard} turns on all types of branch protection features. If a feature
15859 has additional tuning options, then @samp{standard} sets it to its standard
15860 level.
15861 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15862 level: signing functions that save the return address to memory (non-leaf
15863 functions will practically always do this) using the a-key. The optional
15864 argument @samp{leaf} can be used to extend the signing to include leaf
15865 functions.
15866 @samp{bti} turns on branch target identification mechanism.
15867
15868 @item -msve-vector-bits=@var{bits}
15869 @opindex msve-vector-bits
15870 Specify the number of bits in an SVE vector register. This option only has
15871 an effect when SVE is enabled.
15872
15873 GCC supports two forms of SVE code generation: ``vector-length
15874 agnostic'' output that works with any size of vector register and
15875 ``vector-length specific'' output that allows GCC to make assumptions
15876 about the vector length when it is useful for optimization reasons.
15877 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15878 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15879 Specifying @samp{scalable} selects vector-length agnostic
15880 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15881 agnostic output. All other values generate vector-length specific code.
15882 The behavior of these values may change in future releases and no value except
15883 @samp{scalable} should be relied on for producing code that is portable across
15884 different hardware SVE vector lengths.
15885
15886 The default is @samp{-msve-vector-bits=scalable}, which produces
15887 vector-length agnostic code.
15888 @end table
15889
15890 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15891 @anchor{aarch64-feature-modifiers}
15892 @cindex @option{-march} feature modifiers
15893 @cindex @option{-mcpu} feature modifiers
15894 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15895 the following and their inverses @option{no@var{feature}}:
15896
15897 @table @samp
15898 @item crc
15899 Enable CRC extension. This is on by default for
15900 @option{-march=armv8.1-a}.
15901 @item crypto
15902 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15903 instructions.
15904 @item fp
15905 Enable floating-point instructions. This is on by default for all possible
15906 values for options @option{-march} and @option{-mcpu}.
15907 @item simd
15908 Enable Advanced SIMD instructions. This also enables floating-point
15909 instructions. This is on by default for all possible values for options
15910 @option{-march} and @option{-mcpu}.
15911 @item sve
15912 Enable Scalable Vector Extension instructions. This also enables Advanced
15913 SIMD and floating-point instructions.
15914 @item lse
15915 Enable Large System Extension instructions. This is on by default for
15916 @option{-march=armv8.1-a}.
15917 @item rdma
15918 Enable Round Double Multiply Accumulate instructions. This is on by default
15919 for @option{-march=armv8.1-a}.
15920 @item fp16
15921 Enable FP16 extension. This also enables floating-point instructions.
15922 @item fp16fml
15923 Enable FP16 fmla extension. This also enables FP16 extensions and
15924 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.
15925
15926 @item rcpc
15927 Enable the RcPc extension. This does not change code generation from GCC,
15928 but is passed on to the assembler, enabling inline asm statements to use
15929 instructions from the RcPc extension.
15930 @item dotprod
15931 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15932 @item aes
15933 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15934 SIMD instructions.
15935 @item sha2
15936 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15937 @item sha3
15938 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15939 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15940 @item sm4
15941 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15942 Use of this option with architectures prior to Armv8.2-A is not supported.
15943 @item profile
15944 Enable the Statistical Profiling extension. This option is only to enable the
15945 extension at the assembler level and does not affect code generation.
15946 @item rng
15947 Enable the Armv8.5-a Random Number instructions. This option is only to
15948 enable the extension at the assembler level and does not affect code
15949 generation.
15950 @item memtag
15951 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
15952 enable the extension at the assembler level and does not affect code
15953 generation.
15954 @item sb
15955 Enable the Armv8-a Speculation Barrier instruction. This option is only to
15956 enable the extension at the assembler level and does not affect code
15957 generation. This option is enabled by default for @option{-march=armv8.5-a}.
15958 @item ssbs
15959 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
15960 is only to enable the extension at the assembler level and does not affect code
15961 generation. This option is enabled by default for @option{-march=armv8.5-a}.
15962 @item predres
15963 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
15964 This option is only to enable the extension at the assembler level and does
15965 not affect code generation. This option is enabled by default for
15966 @option{-march=armv8.5-a}.
15967
15968 @end table
15969
15970 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15971 which implies @option{fp}.
15972 Conversely, @option{nofp} implies @option{nosimd}, which implies
15973 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15974
15975 @node Adapteva Epiphany Options
15976 @subsection Adapteva Epiphany Options
15977
15978 These @samp{-m} options are defined for Adapteva Epiphany:
15979
15980 @table @gcctabopt
15981 @item -mhalf-reg-file
15982 @opindex mhalf-reg-file
15983 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15984 That allows code to run on hardware variants that lack these registers.
15985
15986 @item -mprefer-short-insn-regs
15987 @opindex mprefer-short-insn-regs
15988 Preferentially allocate registers that allow short instruction generation.
15989 This can result in increased instruction count, so this may either reduce or
15990 increase overall code size.
15991
15992 @item -mbranch-cost=@var{num}
15993 @opindex mbranch-cost
15994 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15995 This cost is only a heuristic and is not guaranteed to produce
15996 consistent results across releases.
15997
15998 @item -mcmove
15999 @opindex mcmove
16000 Enable the generation of conditional moves.
16001
16002 @item -mnops=@var{num}
16003 @opindex mnops
16004 Emit @var{num} NOPs before every other generated instruction.
16005
16006 @item -mno-soft-cmpsf
16007 @opindex mno-soft-cmpsf
16008 @opindex msoft-cmpsf
16009 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16010 and test the flags. This is faster than a software comparison, but can
16011 get incorrect results in the presence of NaNs, or when two different small
16012 numbers are compared such that their difference is calculated as zero.
16013 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16014 software comparisons.
16015
16016 @item -mstack-offset=@var{num}
16017 @opindex mstack-offset
16018 Set the offset between the top of the stack and the stack pointer.
16019 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16020 can be used by leaf functions without stack allocation.
16021 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16022 Note also that this option changes the ABI; compiling a program with a
16023 different stack offset than the libraries have been compiled with
16024 generally does not work.
16025 This option can be useful if you want to evaluate if a different stack
16026 offset would give you better code, but to actually use a different stack
16027 offset to build working programs, it is recommended to configure the
16028 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16029
16030 @item -mno-round-nearest
16031 @opindex mno-round-nearest
16032 @opindex mround-nearest
16033 Make the scheduler assume that the rounding mode has been set to
16034 truncating. The default is @option{-mround-nearest}.
16035
16036 @item -mlong-calls
16037 @opindex mlong-calls
16038 If not otherwise specified by an attribute, assume all calls might be beyond
16039 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16040 function address into a register before performing a (otherwise direct) call.
16041 This is the default.
16042
16043 @item -mshort-calls
16044 @opindex short-calls
16045 If not otherwise specified by an attribute, assume all direct calls are
16046 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16047 for direct calls. The default is @option{-mlong-calls}.
16048
16049 @item -msmall16
16050 @opindex msmall16
16051 Assume addresses can be loaded as 16-bit unsigned values. This does not
16052 apply to function addresses for which @option{-mlong-calls} semantics
16053 are in effect.
16054
16055 @item -mfp-mode=@var{mode}
16056 @opindex mfp-mode
16057 Set the prevailing mode of the floating-point unit.
16058 This determines the floating-point mode that is provided and expected
16059 at function call and return time. Making this mode match the mode you
16060 predominantly need at function start can make your programs smaller and
16061 faster by avoiding unnecessary mode switches.
16062
16063 @var{mode} can be set to one the following values:
16064
16065 @table @samp
16066 @item caller
16067 Any mode at function entry is valid, and retained or restored when
16068 the function returns, and when it calls other functions.
16069 This mode is useful for compiling libraries or other compilation units
16070 you might want to incorporate into different programs with different
16071 prevailing FPU modes, and the convenience of being able to use a single
16072 object file outweighs the size and speed overhead for any extra
16073 mode switching that might be needed, compared with what would be needed
16074 with a more specific choice of prevailing FPU mode.
16075
16076 @item truncate
16077 This is the mode used for floating-point calculations with
16078 truncating (i.e.@: round towards zero) rounding mode. That includes
16079 conversion from floating point to integer.
16080
16081 @item round-nearest
16082 This is the mode used for floating-point calculations with
16083 round-to-nearest-or-even rounding mode.
16084
16085 @item int
16086 This is the mode used to perform integer calculations in the FPU, e.g.@:
16087 integer multiply, or integer multiply-and-accumulate.
16088 @end table
16089
16090 The default is @option{-mfp-mode=caller}
16091
16092 @item -mno-split-lohi
16093 @itemx -mno-postinc
16094 @itemx -mno-postmodify
16095 @opindex mno-split-lohi
16096 @opindex msplit-lohi
16097 @opindex mno-postinc
16098 @opindex mpostinc
16099 @opindex mno-postmodify
16100 @opindex mpostmodify
16101 Code generation tweaks that disable, respectively, splitting of 32-bit
16102 loads, generation of post-increment addresses, and generation of
16103 post-modify addresses. The defaults are @option{msplit-lohi},
16104 @option{-mpost-inc}, and @option{-mpost-modify}.
16105
16106 @item -mnovect-double
16107 @opindex mno-vect-double
16108 @opindex mvect-double
16109 Change the preferred SIMD mode to SImode. The default is
16110 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16111
16112 @item -max-vect-align=@var{num}
16113 @opindex max-vect-align
16114 The maximum alignment for SIMD vector mode types.
16115 @var{num} may be 4 or 8. The default is 8.
16116 Note that this is an ABI change, even though many library function
16117 interfaces are unaffected if they don't use SIMD vector modes
16118 in places that affect size and/or alignment of relevant types.
16119
16120 @item -msplit-vecmove-early
16121 @opindex msplit-vecmove-early
16122 Split vector moves into single word moves before reload. In theory this
16123 can give better register allocation, but so far the reverse seems to be
16124 generally the case.
16125
16126 @item -m1reg-@var{reg}
16127 @opindex m1reg-
16128 Specify a register to hold the constant @minus{}1, which makes loading small negative
16129 constants and certain bitmasks faster.
16130 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16131 which specify use of that register as a fixed register,
16132 and @samp{none}, which means that no register is used for this
16133 purpose. The default is @option{-m1reg-none}.
16134
16135 @end table
16136
16137 @node AMD GCN Options
16138 @subsection AMD GCN Options
16139 @cindex AMD GCN Options
16140
16141 These options are defined specifically for the AMD GCN port.
16142
16143 @table @gcctabopt
16144
16145 @item -march=@var{gpu}
16146 @opindex march
16147 @itemx -mtune=@var{gpu}
16148 @opindex mtune
16149 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16150 are
16151
16152 @table @samp
16153 @opindex fiji
16154 @item fiji
16155 Compile for GCN3 Fiji devices (gfx803).
16156
16157 @item gfx900
16158 Compile for GCN5 Vega 10 devices (gfx900).
16159
16160 @end table
16161
16162 @item -mstack-size=@var{bytes}
16163 @opindex mstack-size
16164 Specify how many @var{bytes} of stack space will be requested for each GPU
16165 thread (wave-front). Beware that there may be many threads and limited memory
16166 available. The size of the stack allocation may also have an impact on
16167 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16168 1MB otherwise.
16169
16170 @end table
16171
16172 @node ARC Options
16173 @subsection ARC Options
16174 @cindex ARC options
16175
16176 The following options control the architecture variant for which code
16177 is being compiled:
16178
16179 @c architecture variants
16180 @table @gcctabopt
16181
16182 @item -mbarrel-shifter
16183 @opindex mbarrel-shifter
16184 Generate instructions supported by barrel shifter. This is the default
16185 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16186
16187 @item -mjli-always
16188 @opindex mjli-alawys
16189 Force to call a function using jli_s instruction. This option is
16190 valid only for ARCv2 architecture.
16191
16192 @item -mcpu=@var{cpu}
16193 @opindex mcpu
16194 Set architecture type, register usage, and instruction scheduling
16195 parameters for @var{cpu}. There are also shortcut alias options
16196 available for backward compatibility and convenience. Supported
16197 values for @var{cpu} are
16198
16199 @table @samp
16200 @opindex mA6
16201 @opindex mARC600
16202 @item arc600
16203 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16204
16205 @item arc601
16206 @opindex mARC601
16207 Compile for ARC601. Alias: @option{-mARC601}.
16208
16209 @item arc700
16210 @opindex mA7
16211 @opindex mARC700
16212 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16213 This is the default when configured with @option{--with-cpu=arc700}@.
16214
16215 @item arcem
16216 Compile for ARC EM.
16217
16218 @item archs
16219 Compile for ARC HS.
16220
16221 @item em
16222 Compile for ARC EM CPU with no hardware extensions.
16223
16224 @item em4
16225 Compile for ARC EM4 CPU.
16226
16227 @item em4_dmips
16228 Compile for ARC EM4 DMIPS CPU.
16229
16230 @item em4_fpus
16231 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16232 extension.
16233
16234 @item em4_fpuda
16235 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16236 double assist instructions.
16237
16238 @item hs
16239 Compile for ARC HS CPU with no hardware extensions except the atomic
16240 instructions.
16241
16242 @item hs34
16243 Compile for ARC HS34 CPU.
16244
16245 @item hs38
16246 Compile for ARC HS38 CPU.
16247
16248 @item hs38_linux
16249 Compile for ARC HS38 CPU with all hardware extensions on.
16250
16251 @item arc600_norm
16252 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16253
16254 @item arc600_mul32x16
16255 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16256 instructions enabled.
16257
16258 @item arc600_mul64
16259 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16260 instructions enabled.
16261
16262 @item arc601_norm
16263 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16264
16265 @item arc601_mul32x16
16266 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16267 instructions enabled.
16268
16269 @item arc601_mul64
16270 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16271 instructions enabled.
16272
16273 @item nps400
16274 Compile for ARC 700 on NPS400 chip.
16275
16276 @item em_mini
16277 Compile for ARC EM minimalist configuration featuring reduced register
16278 set.
16279
16280 @end table
16281
16282 @item -mdpfp
16283 @opindex mdpfp
16284 @itemx -mdpfp-compact
16285 @opindex mdpfp-compact
16286 Generate double-precision FPX instructions, tuned for the compact
16287 implementation.
16288
16289 @item -mdpfp-fast
16290 @opindex mdpfp-fast
16291 Generate double-precision FPX instructions, tuned for the fast
16292 implementation.
16293
16294 @item -mno-dpfp-lrsr
16295 @opindex mno-dpfp-lrsr
16296 Disable @code{lr} and @code{sr} instructions from using FPX extension
16297 aux registers.
16298
16299 @item -mea
16300 @opindex mea
16301 Generate extended arithmetic instructions. Currently only
16302 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16303 supported. This is always enabled for @option{-mcpu=ARC700}.
16304
16305 @item -mno-mpy
16306 @opindex mno-mpy
16307 @opindex mmpy
16308 Do not generate @code{mpy}-family instructions for ARC700. This option is
16309 deprecated.
16310
16311 @item -mmul32x16
16312 @opindex mmul32x16
16313 Generate 32x16-bit multiply and multiply-accumulate instructions.
16314
16315 @item -mmul64
16316 @opindex mmul64
16317 Generate @code{mul64} and @code{mulu64} instructions.
16318 Only valid for @option{-mcpu=ARC600}.
16319
16320 @item -mnorm
16321 @opindex mnorm
16322 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16323 is in effect.
16324
16325 @item -mspfp
16326 @opindex mspfp
16327 @itemx -mspfp-compact
16328 @opindex mspfp-compact
16329 Generate single-precision FPX instructions, tuned for the compact
16330 implementation.
16331
16332 @item -mspfp-fast
16333 @opindex mspfp-fast
16334 Generate single-precision FPX instructions, tuned for the fast
16335 implementation.
16336
16337 @item -msimd
16338 @opindex msimd
16339 Enable generation of ARC SIMD instructions via target-specific
16340 builtins. Only valid for @option{-mcpu=ARC700}.
16341
16342 @item -msoft-float
16343 @opindex msoft-float
16344 This option ignored; it is provided for compatibility purposes only.
16345 Software floating-point code is emitted by default, and this default
16346 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16347 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16348 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16349
16350 @item -mswap
16351 @opindex mswap
16352 Generate @code{swap} instructions.
16353
16354 @item -matomic
16355 @opindex matomic
16356 This enables use of the locked load/store conditional extension to implement
16357 atomic memory built-in functions. Not available for ARC 6xx or ARC
16358 EM cores.
16359
16360 @item -mdiv-rem
16361 @opindex mdiv-rem
16362 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16363
16364 @item -mcode-density
16365 @opindex mcode-density
16366 Enable code density instructions for ARC EM.
16367 This option is on by default for ARC HS.
16368
16369 @item -mll64
16370 @opindex mll64
16371 Enable double load/store operations for ARC HS cores.
16372
16373 @item -mtp-regno=@var{regno}
16374 @opindex mtp-regno
16375 Specify thread pointer register number.
16376
16377 @item -mmpy-option=@var{multo}
16378 @opindex mmpy-option
16379 Compile ARCv2 code with a multiplier design option. You can specify
16380 the option using either a string or numeric value for @var{multo}.
16381 @samp{wlh1} is the default value. The recognized values are:
16382
16383 @table @samp
16384 @item 0
16385 @itemx none
16386 No multiplier available.
16387
16388 @item 1
16389 @itemx w
16390 16x16 multiplier, fully pipelined.
16391 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16392
16393 @item 2
16394 @itemx wlh1
16395 32x32 multiplier, fully
16396 pipelined (1 stage). The following instructions are additionally
16397 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16398
16399 @item 3
16400 @itemx wlh2
16401 32x32 multiplier, fully pipelined
16402 (2 stages). The following instructions are additionally enabled: @code{mpy},
16403 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16404
16405 @item 4
16406 @itemx wlh3
16407 Two 16x16 multipliers, blocking,
16408 sequential. The following instructions are additionally enabled: @code{mpy},
16409 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16410
16411 @item 5
16412 @itemx wlh4
16413 One 16x16 multiplier, blocking,
16414 sequential. The following instructions are additionally enabled: @code{mpy},
16415 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16416
16417 @item 6
16418 @itemx wlh5
16419 One 32x4 multiplier, blocking,
16420 sequential. The following instructions are additionally enabled: @code{mpy},
16421 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16422
16423 @item 7
16424 @itemx plus_dmpy
16425 ARC HS SIMD support.
16426
16427 @item 8
16428 @itemx plus_macd
16429 ARC HS SIMD support.
16430
16431 @item 9
16432 @itemx plus_qmacw
16433 ARC HS SIMD support.
16434
16435 @end table
16436
16437 This option is only available for ARCv2 cores@.
16438
16439 @item -mfpu=@var{fpu}
16440 @opindex mfpu
16441 Enables support for specific floating-point hardware extensions for ARCv2
16442 cores. Supported values for @var{fpu} are:
16443
16444 @table @samp
16445
16446 @item fpus
16447 Enables support for single-precision floating-point hardware
16448 extensions@.
16449
16450 @item fpud
16451 Enables support for double-precision floating-point hardware
16452 extensions. The single-precision floating-point extension is also
16453 enabled. Not available for ARC EM@.
16454
16455 @item fpuda
16456 Enables support for double-precision floating-point hardware
16457 extensions using double-precision assist instructions. The single-precision
16458 floating-point extension is also enabled. This option is
16459 only available for ARC EM@.
16460
16461 @item fpuda_div
16462 Enables support for double-precision floating-point hardware
16463 extensions using double-precision assist instructions.
16464 The single-precision floating-point, square-root, and divide
16465 extensions are also enabled. This option is
16466 only available for ARC EM@.
16467
16468 @item fpuda_fma
16469 Enables support for double-precision floating-point hardware
16470 extensions using double-precision assist instructions.
16471 The single-precision floating-point and fused multiply and add
16472 hardware extensions are also enabled. This option is
16473 only available for ARC EM@.
16474
16475 @item fpuda_all
16476 Enables support for double-precision floating-point hardware
16477 extensions using double-precision assist instructions.
16478 All single-precision floating-point hardware extensions are also
16479 enabled. This option is only available for ARC EM@.
16480
16481 @item fpus_div
16482 Enables support for single-precision floating-point, square-root and divide
16483 hardware extensions@.
16484
16485 @item fpud_div
16486 Enables support for double-precision floating-point, square-root and divide
16487 hardware extensions. This option
16488 includes option @samp{fpus_div}. Not available for ARC EM@.
16489
16490 @item fpus_fma
16491 Enables support for single-precision floating-point and
16492 fused multiply and add hardware extensions@.
16493
16494 @item fpud_fma
16495 Enables support for double-precision floating-point and
16496 fused multiply and add hardware extensions. This option
16497 includes option @samp{fpus_fma}. Not available for ARC EM@.
16498
16499 @item fpus_all
16500 Enables support for all single-precision floating-point hardware
16501 extensions@.
16502
16503 @item fpud_all
16504 Enables support for all single- and double-precision floating-point
16505 hardware extensions. Not available for ARC EM@.
16506
16507 @end table
16508
16509 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16510 @opindex mirq-ctrl-saved
16511 Specifies general-purposes registers that the processor automatically
16512 saves/restores on interrupt entry and exit. @var{register-range} is
16513 specified as two registers separated by a dash. The register range
16514 always starts with @code{r0}, the upper limit is @code{fp} register.
16515 @var{blink} and @var{lp_count} are optional. This option is only
16516 valid for ARC EM and ARC HS cores.
16517
16518 @item -mrgf-banked-regs=@var{number}
16519 @opindex mrgf-banked-regs
16520 Specifies the number of registers replicated in second register bank
16521 on entry to fast interrupt. Fast interrupts are interrupts with the
16522 highest priority level P0. These interrupts save only PC and STATUS32
16523 registers to avoid memory transactions during interrupt entry and exit
16524 sequences. Use this option when you are using fast interrupts in an
16525 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16526
16527 @item -mlpc-width=@var{width}
16528 @opindex mlpc-width
16529 Specify the width of the @code{lp_count} register. Valid values for
16530 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16531 fixed to 32 bits. If the width is less than 32, the compiler does not
16532 attempt to transform loops in your program to use the zero-delay loop
16533 mechanism unless it is known that the @code{lp_count} register can
16534 hold the required loop-counter value. Depending on the width
16535 specified, the compiler and run-time library might continue to use the
16536 loop mechanism for various needs. This option defines macro
16537 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16538
16539 @item -mrf16
16540 @opindex mrf16
16541 This option instructs the compiler to generate code for a 16-entry
16542 register file. This option defines the @code{__ARC_RF16__}
16543 preprocessor macro.
16544
16545 @item -mbranch-index
16546 @opindex mbranch-index
16547 Enable use of @code{bi} or @code{bih} instructions to implement jump
16548 tables.
16549
16550 @end table
16551
16552 The following options are passed through to the assembler, and also
16553 define preprocessor macro symbols.
16554
16555 @c Flags used by the assembler, but for which we define preprocessor
16556 @c macro symbols as well.
16557 @table @gcctabopt
16558 @item -mdsp-packa
16559 @opindex mdsp-packa
16560 Passed down to the assembler to enable the DSP Pack A extensions.
16561 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16562 deprecated.
16563
16564 @item -mdvbf
16565 @opindex mdvbf
16566 Passed down to the assembler to enable the dual Viterbi butterfly
16567 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16568 option is deprecated.
16569
16570 @c ARC700 4.10 extension instruction
16571 @item -mlock
16572 @opindex mlock
16573 Passed down to the assembler to enable the locked load/store
16574 conditional extension. Also sets the preprocessor symbol
16575 @code{__Xlock}.
16576
16577 @item -mmac-d16
16578 @opindex mmac-d16
16579 Passed down to the assembler. Also sets the preprocessor symbol
16580 @code{__Xxmac_d16}. This option is deprecated.
16581
16582 @item -mmac-24
16583 @opindex mmac-24
16584 Passed down to the assembler. Also sets the preprocessor symbol
16585 @code{__Xxmac_24}. This option is deprecated.
16586
16587 @c ARC700 4.10 extension instruction
16588 @item -mrtsc
16589 @opindex mrtsc
16590 Passed down to the assembler to enable the 64-bit time-stamp counter
16591 extension instruction. Also sets the preprocessor symbol
16592 @code{__Xrtsc}. This option is deprecated.
16593
16594 @c ARC700 4.10 extension instruction
16595 @item -mswape
16596 @opindex mswape
16597 Passed down to the assembler to enable the swap byte ordering
16598 extension instruction. Also sets the preprocessor symbol
16599 @code{__Xswape}.
16600
16601 @item -mtelephony
16602 @opindex mtelephony
16603 Passed down to the assembler to enable dual- and single-operand
16604 instructions for telephony. Also sets the preprocessor symbol
16605 @code{__Xtelephony}. This option is deprecated.
16606
16607 @item -mxy
16608 @opindex mxy
16609 Passed down to the assembler to enable the XY memory extension. Also
16610 sets the preprocessor symbol @code{__Xxy}.
16611
16612 @end table
16613
16614 The following options control how the assembly code is annotated:
16615
16616 @c Assembly annotation options
16617 @table @gcctabopt
16618 @item -misize
16619 @opindex misize
16620 Annotate assembler instructions with estimated addresses.
16621
16622 @item -mannotate-align
16623 @opindex mannotate-align
16624 Explain what alignment considerations lead to the decision to make an
16625 instruction short or long.
16626
16627 @end table
16628
16629 The following options are passed through to the linker:
16630
16631 @c options passed through to the linker
16632 @table @gcctabopt
16633 @item -marclinux
16634 @opindex marclinux
16635 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16636 This option is enabled by default in tool chains built for
16637 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16638 when profiling is not requested.
16639
16640 @item -marclinux_prof
16641 @opindex marclinux_prof
16642 Passed through to the linker, to specify use of the
16643 @code{arclinux_prof} emulation. This option is enabled by default in
16644 tool chains built for @w{@code{arc-linux-uclibc}} and
16645 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16646
16647 @end table
16648
16649 The following options control the semantics of generated code:
16650
16651 @c semantically relevant code generation options
16652 @table @gcctabopt
16653 @item -mlong-calls
16654 @opindex mlong-calls
16655 Generate calls as register indirect calls, thus providing access
16656 to the full 32-bit address range.
16657
16658 @item -mmedium-calls
16659 @opindex mmedium-calls
16660 Don't use less than 25-bit addressing range for calls, which is the
16661 offset available for an unconditional branch-and-link
16662 instruction. Conditional execution of function calls is suppressed, to
16663 allow use of the 25-bit range, rather than the 21-bit range with
16664 conditional branch-and-link. This is the default for tool chains built
16665 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16666
16667 @item -G @var{num}
16668 @opindex G
16669 Put definitions of externally-visible data in a small data section if
16670 that data is no bigger than @var{num} bytes. The default value of
16671 @var{num} is 4 for any ARC configuration, or 8 when we have double
16672 load/store operations.
16673
16674 @item -mno-sdata
16675 @opindex mno-sdata
16676 @opindex msdata
16677 Do not generate sdata references. This is the default for tool chains
16678 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16679 targets.
16680
16681 @item -mvolatile-cache
16682 @opindex mvolatile-cache
16683 Use ordinarily cached memory accesses for volatile references. This is the
16684 default.
16685
16686 @item -mno-volatile-cache
16687 @opindex mno-volatile-cache
16688 @opindex mvolatile-cache
16689 Enable cache bypass for volatile references.
16690
16691 @end table
16692
16693 The following options fine tune code generation:
16694 @c code generation tuning options
16695 @table @gcctabopt
16696 @item -malign-call
16697 @opindex malign-call
16698 Do alignment optimizations for call instructions.
16699
16700 @item -mauto-modify-reg
16701 @opindex mauto-modify-reg
16702 Enable the use of pre/post modify with register displacement.
16703
16704 @item -mbbit-peephole
16705 @opindex mbbit-peephole
16706 Enable bbit peephole2.
16707
16708 @item -mno-brcc
16709 @opindex mno-brcc
16710 This option disables a target-specific pass in @file{arc_reorg} to
16711 generate compare-and-branch (@code{br@var{cc}}) instructions.
16712 It has no effect on
16713 generation of these instructions driven by the combiner pass.
16714
16715 @item -mcase-vector-pcrel
16716 @opindex mcase-vector-pcrel
16717 Use PC-relative switch case tables to enable case table shortening.
16718 This is the default for @option{-Os}.
16719
16720 @item -mcompact-casesi
16721 @opindex mcompact-casesi
16722 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16723 and only available for ARCv1 cores. This option is deprecated.
16724
16725 @item -mno-cond-exec
16726 @opindex mno-cond-exec
16727 Disable the ARCompact-specific pass to generate conditional
16728 execution instructions.
16729
16730 Due to delay slot scheduling and interactions between operand numbers,
16731 literal sizes, instruction lengths, and the support for conditional execution,
16732 the target-independent pass to generate conditional execution is often lacking,
16733 so the ARC port has kept a special pass around that tries to find more
16734 conditional execution generation opportunities after register allocation,
16735 branch shortening, and delay slot scheduling have been done. This pass
16736 generally, but not always, improves performance and code size, at the cost of
16737 extra compilation time, which is why there is an option to switch it off.
16738 If you have a problem with call instructions exceeding their allowable
16739 offset range because they are conditionalized, you should consider using
16740 @option{-mmedium-calls} instead.
16741
16742 @item -mearly-cbranchsi
16743 @opindex mearly-cbranchsi
16744 Enable pre-reload use of the @code{cbranchsi} pattern.
16745
16746 @item -mexpand-adddi
16747 @opindex mexpand-adddi
16748 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16749 @code{add.f}, @code{adc} etc. This option is deprecated.
16750
16751 @item -mindexed-loads
16752 @opindex mindexed-loads
16753 Enable the use of indexed loads. This can be problematic because some
16754 optimizers then assume that indexed stores exist, which is not
16755 the case.
16756
16757 @item -mlra
16758 @opindex mlra
16759 Enable Local Register Allocation. This is still experimental for ARC,
16760 so by default the compiler uses standard reload
16761 (i.e.@: @option{-mno-lra}).
16762
16763 @item -mlra-priority-none
16764 @opindex mlra-priority-none
16765 Don't indicate any priority for target registers.
16766
16767 @item -mlra-priority-compact
16768 @opindex mlra-priority-compact
16769 Indicate target register priority for r0..r3 / r12..r15.
16770
16771 @item -mlra-priority-noncompact
16772 @opindex mlra-priority-noncompact
16773 Reduce target register priority for r0..r3 / r12..r15.
16774
16775 @item -mmillicode
16776 @opindex mmillicode
16777 When optimizing for size (using @option{-Os}), prologues and epilogues
16778 that have to save or restore a large number of registers are often
16779 shortened by using call to a special function in libgcc; this is
16780 referred to as a @emph{millicode} call. As these calls can pose
16781 performance issues, and/or cause linking issues when linking in a
16782 nonstandard way, this option is provided to turn on or off millicode
16783 call generation.
16784
16785 @item -mcode-density-frame
16786 @opindex mcode-density-frame
16787 This option enable the compiler to emit @code{enter} and @code{leave}
16788 instructions. These instructions are only valid for CPUs with
16789 code-density feature.
16790
16791 @item -mmixed-code
16792 @opindex mmixed-code
16793 Tweak register allocation to help 16-bit instruction generation.
16794 This generally has the effect of decreasing the average instruction size
16795 while increasing the instruction count.
16796
16797 @item -mq-class
16798 @opindex mq-class
16799 Enable @samp{q} instruction alternatives.
16800 This is the default for @option{-Os}.
16801
16802 @item -mRcq
16803 @opindex mRcq
16804 Enable @samp{Rcq} constraint handling.
16805 Most short code generation depends on this.
16806 This is the default.
16807
16808 @item -mRcw
16809 @opindex mRcw
16810 Enable @samp{Rcw} constraint handling.
16811 Most ccfsm condexec mostly depends on this.
16812 This is the default.
16813
16814 @item -msize-level=@var{level}
16815 @opindex msize-level
16816 Fine-tune size optimization with regards to instruction lengths and alignment.
16817 The recognized values for @var{level} are:
16818 @table @samp
16819 @item 0
16820 No size optimization. This level is deprecated and treated like @samp{1}.
16821
16822 @item 1
16823 Short instructions are used opportunistically.
16824
16825 @item 2
16826 In addition, alignment of loops and of code after barriers are dropped.
16827
16828 @item 3
16829 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16830
16831 @end table
16832
16833 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16834 the behavior when this is not set is equivalent to level @samp{1}.
16835
16836 @item -mtune=@var{cpu}
16837 @opindex mtune
16838 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16839 by @option{-mcpu=}.
16840
16841 Supported values for @var{cpu} are
16842
16843 @table @samp
16844 @item ARC600
16845 Tune for ARC600 CPU.
16846
16847 @item ARC601
16848 Tune for ARC601 CPU.
16849
16850 @item ARC700
16851 Tune for ARC700 CPU with standard multiplier block.
16852
16853 @item ARC700-xmac
16854 Tune for ARC700 CPU with XMAC block.
16855
16856 @item ARC725D
16857 Tune for ARC725D CPU.
16858
16859 @item ARC750D
16860 Tune for ARC750D CPU.
16861
16862 @end table
16863
16864 @item -mmultcost=@var{num}
16865 @opindex mmultcost
16866 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16867 normal instruction.
16868
16869 @item -munalign-prob-threshold=@var{probability}
16870 @opindex munalign-prob-threshold
16871 Set probability threshold for unaligning branches.
16872 When tuning for @samp{ARC700} and optimizing for speed, branches without
16873 filled delay slot are preferably emitted unaligned and long, unless
16874 profiling indicates that the probability for the branch to be taken
16875 is below @var{probability}. @xref{Cross-profiling}.
16876 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16877
16878 @end table
16879
16880 The following options are maintained for backward compatibility, but
16881 are now deprecated and will be removed in a future release:
16882
16883 @c Deprecated options
16884 @table @gcctabopt
16885
16886 @item -margonaut
16887 @opindex margonaut
16888 Obsolete FPX.
16889
16890 @item -mbig-endian
16891 @opindex mbig-endian
16892 @itemx -EB
16893 @opindex EB
16894 Compile code for big-endian targets. Use of these options is now
16895 deprecated. Big-endian code is supported by configuring GCC to build
16896 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16897 for which big endian is the default.
16898
16899 @item -mlittle-endian
16900 @opindex mlittle-endian
16901 @itemx -EL
16902 @opindex EL
16903 Compile code for little-endian targets. Use of these options is now
16904 deprecated. Little-endian code is supported by configuring GCC to build
16905 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16906 for which little endian is the default.
16907
16908 @item -mbarrel_shifter
16909 @opindex mbarrel_shifter
16910 Replaced by @option{-mbarrel-shifter}.
16911
16912 @item -mdpfp_compact
16913 @opindex mdpfp_compact
16914 Replaced by @option{-mdpfp-compact}.
16915
16916 @item -mdpfp_fast
16917 @opindex mdpfp_fast
16918 Replaced by @option{-mdpfp-fast}.
16919
16920 @item -mdsp_packa
16921 @opindex mdsp_packa
16922 Replaced by @option{-mdsp-packa}.
16923
16924 @item -mEA
16925 @opindex mEA
16926 Replaced by @option{-mea}.
16927
16928 @item -mmac_24
16929 @opindex mmac_24
16930 Replaced by @option{-mmac-24}.
16931
16932 @item -mmac_d16
16933 @opindex mmac_d16
16934 Replaced by @option{-mmac-d16}.
16935
16936 @item -mspfp_compact
16937 @opindex mspfp_compact
16938 Replaced by @option{-mspfp-compact}.
16939
16940 @item -mspfp_fast
16941 @opindex mspfp_fast
16942 Replaced by @option{-mspfp-fast}.
16943
16944 @item -mtune=@var{cpu}
16945 @opindex mtune
16946 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16947 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16948 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16949
16950 @item -multcost=@var{num}
16951 @opindex multcost
16952 Replaced by @option{-mmultcost}.
16953
16954 @end table
16955
16956 @node ARM Options
16957 @subsection ARM Options
16958 @cindex ARM options
16959
16960 These @samp{-m} options are defined for the ARM port:
16961
16962 @table @gcctabopt
16963 @item -mabi=@var{name}
16964 @opindex mabi
16965 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16966 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16967
16968 @item -mapcs-frame
16969 @opindex mapcs-frame
16970 Generate a stack frame that is compliant with the ARM Procedure Call
16971 Standard for all functions, even if this is not strictly necessary for
16972 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16973 with this option causes the stack frames not to be generated for
16974 leaf functions. The default is @option{-mno-apcs-frame}.
16975 This option is deprecated.
16976
16977 @item -mapcs
16978 @opindex mapcs
16979 This is a synonym for @option{-mapcs-frame} and is deprecated.
16980
16981 @ignore
16982 @c not currently implemented
16983 @item -mapcs-stack-check
16984 @opindex mapcs-stack-check
16985 Generate code to check the amount of stack space available upon entry to
16986 every function (that actually uses some stack space). If there is
16987 insufficient space available then either the function
16988 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16989 called, depending upon the amount of stack space required. The runtime
16990 system is required to provide these functions. The default is
16991 @option{-mno-apcs-stack-check}, since this produces smaller code.
16992
16993 @c not currently implemented
16994 @item -mapcs-reentrant
16995 @opindex mapcs-reentrant
16996 Generate reentrant, position-independent code. The default is
16997 @option{-mno-apcs-reentrant}.
16998 @end ignore
16999
17000 @item -mthumb-interwork
17001 @opindex mthumb-interwork
17002 Generate code that supports calling between the ARM and Thumb
17003 instruction sets. Without this option, on pre-v5 architectures, the
17004 two instruction sets cannot be reliably used inside one program. The
17005 default is @option{-mno-thumb-interwork}, since slightly larger code
17006 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17007 configurations this option is meaningless.
17008
17009 @item -mno-sched-prolog
17010 @opindex mno-sched-prolog
17011 @opindex msched-prolog
17012 Prevent the reordering of instructions in the function prologue, or the
17013 merging of those instruction with the instructions in the function's
17014 body. This means that all functions start with a recognizable set
17015 of instructions (or in fact one of a choice from a small set of
17016 different function prologues), and this information can be used to
17017 locate the start of functions inside an executable piece of code. The
17018 default is @option{-msched-prolog}.
17019
17020 @item -mfloat-abi=@var{name}
17021 @opindex mfloat-abi
17022 Specifies which floating-point ABI to use. Permissible values
17023 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17024
17025 Specifying @samp{soft} causes GCC to generate output containing
17026 library calls for floating-point operations.
17027 @samp{softfp} allows the generation of code using hardware floating-point
17028 instructions, but still uses the soft-float calling conventions.
17029 @samp{hard} allows generation of floating-point instructions
17030 and uses FPU-specific calling conventions.
17031
17032 The default depends on the specific target configuration. Note that
17033 the hard-float and soft-float ABIs are not link-compatible; you must
17034 compile your entire program with the same ABI, and link with a
17035 compatible set of libraries.
17036
17037 @item -mlittle-endian
17038 @opindex mlittle-endian
17039 Generate code for a processor running in little-endian mode. This is
17040 the default for all standard configurations.
17041
17042 @item -mbig-endian
17043 @opindex mbig-endian
17044 Generate code for a processor running in big-endian mode; the default is
17045 to compile code for a little-endian processor.
17046
17047 @item -mbe8
17048 @itemx -mbe32
17049 @opindex mbe8
17050 When linking a big-endian image select between BE8 and BE32 formats.
17051 The option has no effect for little-endian images and is ignored. The
17052 default is dependent on the selected target architecture. For ARMv6
17053 and later architectures the default is BE8, for older architectures
17054 the default is BE32. BE32 format has been deprecated by ARM.
17055
17056 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17057 @opindex march
17058 This specifies the name of the target ARM architecture. GCC uses this
17059 name to determine what kind of instructions it can emit when generating
17060 assembly code. This option can be used in conjunction with or instead
17061 of the @option{-mcpu=} option.
17062
17063 Permissible names are:
17064 @samp{armv4t},
17065 @samp{armv5t}, @samp{armv5te},
17066 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17067 @samp{armv6z}, @samp{armv6zk},
17068 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17069 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17070 @samp{armv8.4-a},
17071 @samp{armv8.5-a},
17072 @samp{armv7-r},
17073 @samp{armv8-r},
17074 @samp{armv6-m}, @samp{armv6s-m},
17075 @samp{armv7-m}, @samp{armv7e-m},
17076 @samp{armv8-m.base}, @samp{armv8-m.main},
17077 @samp{iwmmxt} and @samp{iwmmxt2}.
17078
17079 Additionally, the following architectures, which lack support for the
17080 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17081
17082 Many of the architectures support extensions. These can be added by
17083 appending @samp{+@var{extension}} to the architecture name. Extension
17084 options are processed in order and capabilities accumulate. An extension
17085 will also enable any necessary base extensions
17086 upon which it depends. For example, the @samp{+crypto} extension
17087 will always enable the @samp{+simd} extension. The exception to the
17088 additive construction is for extensions that are prefixed with
17089 @samp{+no@dots{}}: these extensions disable the specified option and
17090 any other extensions that may depend on the presence of that
17091 extension.
17092
17093 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17094 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17095 entirely disabled by the @samp{+nofp} option that follows it.
17096
17097 Most extension names are generically named, but have an effect that is
17098 dependent upon the architecture to which it is applied. For example,
17099 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17100 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17101 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17102 variant for @samp{armv8-a}.
17103
17104 The table below lists the supported extensions for each architecture.
17105 Architectures not mentioned do not support any extensions.
17106
17107 @table @samp
17108 @item armv5te
17109 @itemx armv6
17110 @itemx armv6j
17111 @itemx armv6k
17112 @itemx armv6kz
17113 @itemx armv6t2
17114 @itemx armv6z
17115 @itemx armv6zk
17116 @table @samp
17117 @item +fp
17118 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17119 used as an alias for this extension.
17120
17121 @item +nofp
17122 Disable the floating-point instructions.
17123 @end table
17124
17125 @item armv7
17126 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17127 @table @samp
17128 @item +fp
17129 The VFPv3 floating-point instructions, with 16 double-precision
17130 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17131 for this extension. Note that floating-point is not supported by the
17132 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17133 ARMv7-R architectures.
17134
17135 @item +nofp
17136 Disable the floating-point instructions.
17137 @end table
17138
17139 @item armv7-a
17140 @table @samp
17141 @item +mp
17142 The multiprocessing extension.
17143
17144 @item +sec
17145 The security extension.
17146
17147 @item +fp
17148 The VFPv3 floating-point instructions, with 16 double-precision
17149 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17150 for this extension.
17151
17152 @item +simd
17153 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17154 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17155 for this extension.
17156
17157 @item +vfpv3
17158 The VFPv3 floating-point instructions, with 32 double-precision
17159 registers.
17160
17161 @item +vfpv3-d16-fp16
17162 The VFPv3 floating-point instructions, with 16 double-precision
17163 registers and the half-precision floating-point conversion operations.
17164
17165 @item +vfpv3-fp16
17166 The VFPv3 floating-point instructions, with 32 double-precision
17167 registers and the half-precision floating-point conversion operations.
17168
17169 @item +vfpv4-d16
17170 The VFPv4 floating-point instructions, with 16 double-precision
17171 registers.
17172
17173 @item +vfpv4
17174 The VFPv4 floating-point instructions, with 32 double-precision
17175 registers.
17176
17177 @item +neon-fp16
17178 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17179 the half-precision floating-point conversion operations.
17180
17181 @item +neon-vfpv4
17182 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17183
17184 @item +nosimd
17185 Disable the Advanced SIMD instructions (does not disable floating point).
17186
17187 @item +nofp
17188 Disable the floating-point and Advanced SIMD instructions.
17189 @end table
17190
17191 @item armv7ve
17192 The extended version of the ARMv7-A architecture with support for
17193 virtualization.
17194 @table @samp
17195 @item +fp
17196 The VFPv4 floating-point instructions, with 16 double-precision registers.
17197 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17198
17199 @item +simd
17200 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17201 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17202
17203 @item +vfpv3-d16
17204 The VFPv3 floating-point instructions, with 16 double-precision
17205 registers.
17206
17207 @item +vfpv3
17208 The VFPv3 floating-point instructions, with 32 double-precision
17209 registers.
17210
17211 @item +vfpv3-d16-fp16
17212 The VFPv3 floating-point instructions, with 16 double-precision
17213 registers and the half-precision floating-point conversion operations.
17214
17215 @item +vfpv3-fp16
17216 The VFPv3 floating-point instructions, with 32 double-precision
17217 registers and the half-precision floating-point conversion operations.
17218
17219 @item +vfpv4-d16
17220 The VFPv4 floating-point instructions, with 16 double-precision
17221 registers.
17222
17223 @item +vfpv4
17224 The VFPv4 floating-point instructions, with 32 double-precision
17225 registers.
17226
17227 @item +neon
17228 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17229 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17230
17231 @item +neon-fp16
17232 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17233 the half-precision floating-point conversion operations.
17234
17235 @item +nosimd
17236 Disable the Advanced SIMD instructions (does not disable floating point).
17237
17238 @item +nofp
17239 Disable the floating-point and Advanced SIMD instructions.
17240 @end table
17241
17242 @item armv8-a
17243 @table @samp
17244 @item +crc
17245 The Cyclic Redundancy Check (CRC) instructions.
17246 @item +simd
17247 The ARMv8-A Advanced SIMD and floating-point instructions.
17248 @item +crypto
17249 The cryptographic instructions.
17250 @item +nocrypto
17251 Disable the cryptographic instructions.
17252 @item +nofp
17253 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17254 @item +sb
17255 Speculation Barrier Instruction.
17256 @item +predres
17257 Execution and Data Prediction Restriction Instructions.
17258 @end table
17259
17260 @item armv8.1-a
17261 @table @samp
17262 @item +simd
17263 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17264
17265 @item +crypto
17266 The cryptographic instructions. This also enables the Advanced SIMD and
17267 floating-point instructions.
17268
17269 @item +nocrypto
17270 Disable the cryptographic instructions.
17271
17272 @item +nofp
17273 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17274
17275 @item +sb
17276 Speculation Barrier Instruction.
17277
17278 @item +predres
17279 Execution and Data Prediction Restriction Instructions.
17280 @end table
17281
17282 @item armv8.2-a
17283 @itemx armv8.3-a
17284 @table @samp
17285 @item +fp16
17286 The half-precision floating-point data processing instructions.
17287 This also enables the Advanced SIMD and floating-point instructions.
17288
17289 @item +fp16fml
17290 The half-precision floating-point fmla extension. This also enables
17291 the half-precision floating-point extension and Advanced SIMD and
17292 floating-point instructions.
17293
17294 @item +simd
17295 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17296
17297 @item +crypto
17298 The cryptographic instructions. This also enables the Advanced SIMD and
17299 floating-point instructions.
17300
17301 @item +dotprod
17302 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17303
17304 @item +nocrypto
17305 Disable the cryptographic extension.
17306
17307 @item +nofp
17308 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17309
17310 @item +sb
17311 Speculation Barrier Instruction.
17312
17313 @item +predres
17314 Execution and Data Prediction Restriction Instructions.
17315 @end table
17316
17317 @item armv8.4-a
17318 @table @samp
17319 @item +fp16
17320 The half-precision floating-point data processing instructions.
17321 This also enables the Advanced SIMD and floating-point instructions as well
17322 as the Dot Product extension and the half-precision floating-point fmla
17323 extension.
17324
17325 @item +simd
17326 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17327 Dot Product extension.
17328
17329 @item +crypto
17330 The cryptographic instructions. This also enables the Advanced SIMD and
17331 floating-point instructions as well as the Dot Product extension.
17332
17333 @item +nocrypto
17334 Disable the cryptographic extension.
17335
17336 @item +nofp
17337 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17338
17339 @item +sb
17340 Speculation Barrier Instruction.
17341
17342 @item +predres
17343 Execution and Data Prediction Restriction Instructions.
17344 @end table
17345
17346 @item armv8.5-a
17347 @table @samp
17348 @item +fp16
17349 The half-precision floating-point data processing instructions.
17350 This also enables the Advanced SIMD and floating-point instructions as well
17351 as the Dot Product extension and the half-precision floating-point fmla
17352 extension.
17353
17354 @item +simd
17355 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17356 Dot Product extension.
17357
17358 @item +crypto
17359 The cryptographic instructions. This also enables the Advanced SIMD and
17360 floating-point instructions as well as the Dot Product extension.
17361
17362 @item +nocrypto
17363 Disable the cryptographic extension.
17364
17365 @item +nofp
17366 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17367 @end table
17368
17369 @item armv7-r
17370 @table @samp
17371 @item +fp.sp
17372 The single-precision VFPv3 floating-point instructions. The extension
17373 @samp{+vfpv3xd} can be used as an alias for this extension.
17374
17375 @item +fp
17376 The VFPv3 floating-point instructions with 16 double-precision registers.
17377 The extension +vfpv3-d16 can be used as an alias for this extension.
17378
17379 @item +vfpv3xd-d16-fp16
17380 The single-precision VFPv3 floating-point instructions with 16 double-precision
17381 registers and the half-precision floating-point conversion operations.
17382
17383 @item +vfpv3-d16-fp16
17384 The VFPv3 floating-point instructions with 16 double-precision
17385 registers and the half-precision floating-point conversion operations.
17386
17387 @item +nofp
17388 Disable the floating-point extension.
17389
17390 @item +idiv
17391 The ARM-state integer division instructions.
17392
17393 @item +noidiv
17394 Disable the ARM-state integer division extension.
17395 @end table
17396
17397 @item armv7e-m
17398 @table @samp
17399 @item +fp
17400 The single-precision VFPv4 floating-point instructions.
17401
17402 @item +fpv5
17403 The single-precision FPv5 floating-point instructions.
17404
17405 @item +fp.dp
17406 The single- and double-precision FPv5 floating-point instructions.
17407
17408 @item +nofp
17409 Disable the floating-point extensions.
17410 @end table
17411
17412 @item armv8-m.main
17413 @table @samp
17414 @item +dsp
17415 The DSP instructions.
17416
17417 @item +nodsp
17418 Disable the DSP extension.
17419
17420 @item +fp
17421 The single-precision floating-point instructions.
17422
17423 @item +fp.dp
17424 The single- and double-precision floating-point instructions.
17425
17426 @item +nofp
17427 Disable the floating-point extension.
17428 @end table
17429
17430 @item armv8-r
17431 @table @samp
17432 @item +crc
17433 The Cyclic Redundancy Check (CRC) instructions.
17434 @item +fp.sp
17435 The single-precision FPv5 floating-point instructions.
17436 @item +simd
17437 The ARMv8-A Advanced SIMD and floating-point instructions.
17438 @item +crypto
17439 The cryptographic instructions.
17440 @item +nocrypto
17441 Disable the cryptographic instructions.
17442 @item +nofp
17443 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17444 @end table
17445
17446 @end table
17447
17448 @option{-march=native} causes the compiler to auto-detect the architecture
17449 of the build computer. At present, this feature is only supported on
17450 GNU/Linux, and not all architectures are recognized. If the auto-detect
17451 is unsuccessful the option has no effect.
17452
17453 @item -mtune=@var{name}
17454 @opindex mtune
17455 This option specifies the name of the target ARM processor for
17456 which GCC should tune the performance of the code.
17457 For some ARM implementations better performance can be obtained by using
17458 this option.
17459 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17460 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17461 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17462 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17463 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17464 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17465 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17466 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17467 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17468 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17469 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17470 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17471 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17472 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17473 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17474 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17475 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17476 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17477 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17478 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526},
17479 @samp{fa626}, @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
17480 @samp{xgene1}.
17481
17482 Additionally, this option can specify that GCC should tune the performance
17483 of the code for a big.LITTLE system. Permissible names are:
17484 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17485 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17486 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17487 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17488
17489 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17490 performance for a blend of processors within architecture @var{arch}.
17491 The aim is to generate code that run well on the current most popular
17492 processors, balancing between optimizations that benefit some CPUs in the
17493 range, and avoiding performance pitfalls of other CPUs. The effects of
17494 this option may change in future GCC versions as CPU models come and go.
17495
17496 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17497 the extension options do not affect the tuning of the generated code.
17498
17499 @option{-mtune=native} causes the compiler to auto-detect the CPU
17500 of the build computer. At present, this feature is only supported on
17501 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17502 unsuccessful the option has no effect.
17503
17504 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17505 @opindex mcpu
17506 This specifies the name of the target ARM processor. GCC uses this name
17507 to derive the name of the target ARM architecture (as if specified
17508 by @option{-march}) and the ARM processor type for which to tune for
17509 performance (as if specified by @option{-mtune}). Where this option
17510 is used in conjunction with @option{-march} or @option{-mtune},
17511 those options take precedence over the appropriate part of this option.
17512
17513 Many of the supported CPUs implement optional architectural
17514 extensions. Where this is so the architectural extensions are
17515 normally enabled by default. If implementations that lack the
17516 extension exist, then the extension syntax can be used to disable
17517 those extensions that have been omitted. For floating-point and
17518 Advanced SIMD (Neon) instructions, the settings of the options
17519 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17520 floating-point and Advanced SIMD instructions will only be used if
17521 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17522 @option{-mfpu} other than @samp{auto} will override the available
17523 floating-point and SIMD extension instructions.
17524
17525 For example, @samp{cortex-a9} can be found in three major
17526 configurations: integer only, with just a floating-point unit or with
17527 floating-point and Advanced SIMD. The default is to enable all the
17528 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17529 be used to disable just the SIMD or both the SIMD and floating-point
17530 instructions respectively.
17531
17532 Permissible names for this option are the same as those for
17533 @option{-mtune}.
17534
17535 The following extension options are common to the listed CPUs:
17536
17537 @table @samp
17538 @item +nodsp
17539 Disable the DSP instructions on @samp{cortex-m33}.
17540
17541 @item +nofp
17542 Disables the floating-point instructions on @samp{arm9e},
17543 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17544 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17545 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17546 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17547 Disables the floating-point and SIMD instructions on
17548 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17549 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17550 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17551 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17552 @samp{cortex-a53} and @samp{cortex-a55}.
17553
17554 @item +nofp.dp
17555 Disables the double-precision component of the floating-point instructions
17556 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17557 @samp{cortex-m7}.
17558
17559 @item +nosimd
17560 Disables the SIMD (but not floating-point) instructions on
17561 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17562 and @samp{cortex-a9}.
17563
17564 @item +crypto
17565 Enables the cryptographic instructions on @samp{cortex-a32},
17566 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17567 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17568 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17569 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17570 @samp{cortex-a75.cortex-a55}.
17571 @end table
17572
17573 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17574 VFPv3 with 16 double-precision registers. It supports the following
17575 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17576 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17577 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17578 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17579 the extensions to @option{-march=armv7-a}.
17580
17581 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17582 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17583 See @option{-mtune} for more information.
17584
17585 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17586 of the build computer. At present, this feature is only supported on
17587 GNU/Linux, and not all architectures are recognized. If the auto-detect
17588 is unsuccessful the option has no effect.
17589
17590 @item -mfpu=@var{name}
17591 @opindex mfpu
17592 This specifies what floating-point hardware (or hardware emulation) is
17593 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17594 @samp{vfpv3},
17595 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17596 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17597 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17598 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17599 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17600 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17601 is an alias for @samp{vfpv2}.
17602
17603 The setting @samp{auto} is the default and is special. It causes the
17604 compiler to select the floating-point and Advanced SIMD instructions
17605 based on the settings of @option{-mcpu} and @option{-march}.
17606
17607 If the selected floating-point hardware includes the NEON extension
17608 (e.g.@: @option{-mfpu=neon}), note that floating-point
17609 operations are not generated by GCC's auto-vectorization pass unless
17610 @option{-funsafe-math-optimizations} is also specified. This is
17611 because NEON hardware does not fully implement the IEEE 754 standard for
17612 floating-point arithmetic (in particular denormal values are treated as
17613 zero), so the use of NEON instructions may lead to a loss of precision.
17614
17615 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}).
17616
17617 @item -mfp16-format=@var{name}
17618 @opindex mfp16-format
17619 Specify the format of the @code{__fp16} half-precision floating-point type.
17620 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17621 the default is @samp{none}, in which case the @code{__fp16} type is not
17622 defined. @xref{Half-Precision}, for more information.
17623
17624 @item -mstructure-size-boundary=@var{n}
17625 @opindex mstructure-size-boundary
17626 The sizes of all structures and unions are rounded up to a multiple
17627 of the number of bits set by this option. Permissible values are 8, 32
17628 and 64. The default value varies for different toolchains. For the COFF
17629 targeted toolchain the default value is 8. A value of 64 is only allowed
17630 if the underlying ABI supports it.
17631
17632 Specifying a larger number can produce faster, more efficient code, but
17633 can also increase the size of the program. Different values are potentially
17634 incompatible. Code compiled with one value cannot necessarily expect to
17635 work with code or libraries compiled with another value, if they exchange
17636 information using structures or unions.
17637
17638 This option is deprecated.
17639
17640 @item -mabort-on-noreturn
17641 @opindex mabort-on-noreturn
17642 Generate a call to the function @code{abort} at the end of a
17643 @code{noreturn} function. It is executed if the function tries to
17644 return.
17645
17646 @item -mlong-calls
17647 @itemx -mno-long-calls
17648 @opindex mlong-calls
17649 @opindex mno-long-calls
17650 Tells the compiler to perform function calls by first loading the
17651 address of the function into a register and then performing a subroutine
17652 call on this register. This switch is needed if the target function
17653 lies outside of the 64-megabyte addressing range of the offset-based
17654 version of subroutine call instruction.
17655
17656 Even if this switch is enabled, not all function calls are turned
17657 into long calls. The heuristic is that static functions, functions
17658 that have the @code{short_call} attribute, functions that are inside
17659 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17660 definitions have already been compiled within the current compilation
17661 unit are not turned into long calls. The exceptions to this rule are
17662 that weak function definitions, functions with the @code{long_call}
17663 attribute or the @code{section} attribute, and functions that are within
17664 the scope of a @code{#pragma long_calls} directive are always
17665 turned into long calls.
17666
17667 This feature is not enabled by default. Specifying
17668 @option{-mno-long-calls} restores the default behavior, as does
17669 placing the function calls within the scope of a @code{#pragma
17670 long_calls_off} directive. Note these switches have no effect on how
17671 the compiler generates code to handle function calls via function
17672 pointers.
17673
17674 @item -msingle-pic-base
17675 @opindex msingle-pic-base
17676 Treat the register used for PIC addressing as read-only, rather than
17677 loading it in the prologue for each function. The runtime system is
17678 responsible for initializing this register with an appropriate value
17679 before execution begins.
17680
17681 @item -mpic-register=@var{reg}
17682 @opindex mpic-register
17683 Specify the register to be used for PIC addressing.
17684 For standard PIC base case, the default is any suitable register
17685 determined by compiler. For single PIC base case, the default is
17686 @samp{R9} if target is EABI based or stack-checking is enabled,
17687 otherwise the default is @samp{R10}.
17688
17689 @item -mpic-data-is-text-relative
17690 @opindex mpic-data-is-text-relative
17691 Assume that the displacement between the text and data segments is fixed
17692 at static link time. This permits using PC-relative addressing
17693 operations to access data known to be in the data segment. For
17694 non-VxWorks RTP targets, this option is enabled by default. When
17695 disabled on such targets, it will enable @option{-msingle-pic-base} by
17696 default.
17697
17698 @item -mpoke-function-name
17699 @opindex mpoke-function-name
17700 Write the name of each function into the text section, directly
17701 preceding the function prologue. The generated code is similar to this:
17702
17703 @smallexample
17704 t0
17705 .ascii "arm_poke_function_name", 0
17706 .align
17707 t1
17708 .word 0xff000000 + (t1 - t0)
17709 arm_poke_function_name
17710 mov ip, sp
17711 stmfd sp!, @{fp, ip, lr, pc@}
17712 sub fp, ip, #4
17713 @end smallexample
17714
17715 When performing a stack backtrace, code can inspect the value of
17716 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17717 location @code{pc - 12} and the top 8 bits are set, then we know that
17718 there is a function name embedded immediately preceding this location
17719 and has length @code{((pc[-3]) & 0xff000000)}.
17720
17721 @item -mthumb
17722 @itemx -marm
17723 @opindex marm
17724 @opindex mthumb
17725
17726 Select between generating code that executes in ARM and Thumb
17727 states. The default for most configurations is to generate code
17728 that executes in ARM state, but the default can be changed by
17729 configuring GCC with the @option{--with-mode=}@var{state}
17730 configure option.
17731
17732 You can also override the ARM and Thumb mode for each function
17733 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17734 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17735
17736 @item -mflip-thumb
17737 @opindex mflip-thumb
17738 Switch ARM/Thumb modes on alternating functions.
17739 This option is provided for regression testing of mixed Thumb/ARM code
17740 generation, and is not intended for ordinary use in compiling code.
17741
17742 @item -mtpcs-frame
17743 @opindex mtpcs-frame
17744 Generate a stack frame that is compliant with the Thumb Procedure Call
17745 Standard for all non-leaf functions. (A leaf function is one that does
17746 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17747
17748 @item -mtpcs-leaf-frame
17749 @opindex mtpcs-leaf-frame
17750 Generate a stack frame that is compliant with the Thumb Procedure Call
17751 Standard for all leaf functions. (A leaf function is one that does
17752 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17753
17754 @item -mcallee-super-interworking
17755 @opindex mcallee-super-interworking
17756 Gives all externally visible functions in the file being compiled an ARM
17757 instruction set header which switches to Thumb mode before executing the
17758 rest of the function. This allows these functions to be called from
17759 non-interworking code. This option is not valid in AAPCS configurations
17760 because interworking is enabled by default.
17761
17762 @item -mcaller-super-interworking
17763 @opindex mcaller-super-interworking
17764 Allows calls via function pointers (including virtual functions) to
17765 execute correctly regardless of whether the target code has been
17766 compiled for interworking or not. There is a small overhead in the cost
17767 of executing a function pointer if this option is enabled. This option
17768 is not valid in AAPCS configurations because interworking is enabled
17769 by default.
17770
17771 @item -mtp=@var{name}
17772 @opindex mtp
17773 Specify the access model for the thread local storage pointer. The valid
17774 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17775 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17776 (supported in the arm6k architecture), and @samp{auto}, which uses the
17777 best available method for the selected processor. The default setting is
17778 @samp{auto}.
17779
17780 @item -mtls-dialect=@var{dialect}
17781 @opindex mtls-dialect
17782 Specify the dialect to use for accessing thread local storage. Two
17783 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17784 @samp{gnu} dialect selects the original GNU scheme for supporting
17785 local and global dynamic TLS models. The @samp{gnu2} dialect
17786 selects the GNU descriptor scheme, which provides better performance
17787 for shared libraries. The GNU descriptor scheme is compatible with
17788 the original scheme, but does require new assembler, linker and
17789 library support. Initial and local exec TLS models are unaffected by
17790 this option and always use the original scheme.
17791
17792 @item -mword-relocations
17793 @opindex mword-relocations
17794 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17795 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17796 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17797 is specified. This option conflicts with @option{-mslow-flash-data}.
17798
17799 @item -mfix-cortex-m3-ldrd
17800 @opindex mfix-cortex-m3-ldrd
17801 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17802 with overlapping destination and base registers are used. This option avoids
17803 generating these instructions. This option is enabled by default when
17804 @option{-mcpu=cortex-m3} is specified.
17805
17806 @item -munaligned-access
17807 @itemx -mno-unaligned-access
17808 @opindex munaligned-access
17809 @opindex mno-unaligned-access
17810 Enables (or disables) reading and writing of 16- and 32- bit values
17811 from addresses that are not 16- or 32- bit aligned. By default
17812 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17813 ARMv8-M Baseline architectures, and enabled for all other
17814 architectures. If unaligned access is not enabled then words in packed
17815 data structures are accessed a byte at a time.
17816
17817 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17818 generated object file to either true or false, depending upon the
17819 setting of this option. If unaligned access is enabled then the
17820 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17821 defined.
17822
17823 @item -mneon-for-64bits
17824 @opindex mneon-for-64bits
17825 Enables using Neon to handle scalar 64-bits operations. This is
17826 disabled by default since the cost of moving data from core registers
17827 to Neon is high.
17828
17829 @item -mslow-flash-data
17830 @opindex mslow-flash-data
17831 Assume loading data from flash is slower than fetching instruction.
17832 Therefore literal load is minimized for better performance.
17833 This option is only supported when compiling for ARMv7 M-profile and
17834 off by default. It conflicts with @option{-mword-relocations}.
17835
17836 @item -masm-syntax-unified
17837 @opindex masm-syntax-unified
17838 Assume inline assembler is using unified asm syntax. The default is
17839 currently off which implies divided syntax. This option has no impact
17840 on Thumb2. However, this may change in future releases of GCC.
17841 Divided syntax should be considered deprecated.
17842
17843 @item -mrestrict-it
17844 @opindex mrestrict-it
17845 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17846 IT blocks can only contain a single 16-bit instruction from a select
17847 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17848
17849 @item -mprint-tune-info
17850 @opindex mprint-tune-info
17851 Print CPU tuning information as comment in assembler file. This is
17852 an option used only for regression testing of the compiler and not
17853 intended for ordinary use in compiling code. This option is disabled
17854 by default.
17855
17856 @item -mverbose-cost-dump
17857 @opindex mverbose-cost-dump
17858 Enable verbose cost model dumping in the debug dump files. This option is
17859 provided for use in debugging the compiler.
17860
17861 @item -mpure-code
17862 @opindex mpure-code
17863 Do not allow constant data to be placed in code sections.
17864 Additionally, when compiling for ELF object format give all text sections the
17865 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17866 is only available when generating non-pic code for M-profile targets with the
17867 MOVT instruction.
17868
17869 @item -mcmse
17870 @opindex mcmse
17871 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17872 Development Tools Engineering Specification", which can be found on
17873 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17874 @end table
17875
17876 @node AVR Options
17877 @subsection AVR Options
17878 @cindex AVR Options
17879
17880 These options are defined for AVR implementations:
17881
17882 @table @gcctabopt
17883 @item -mmcu=@var{mcu}
17884 @opindex mmcu
17885 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17886
17887 The default for this option is@tie{}@samp{avr2}.
17888
17889 GCC supports the following AVR devices and ISAs:
17890
17891 @include avr-mmcu.texi
17892
17893 @item -mabsdata
17894 @opindex mabsdata
17895
17896 Assume that all data in static storage can be accessed by LDS / STS
17897 instructions. This option has only an effect on reduced Tiny devices like
17898 ATtiny40. See also the @code{absdata}
17899 @ref{AVR Variable Attributes,variable attribute}.
17900
17901 @item -maccumulate-args
17902 @opindex maccumulate-args
17903 Accumulate outgoing function arguments and acquire/release the needed
17904 stack space for outgoing function arguments once in function
17905 prologue/epilogue. Without this option, outgoing arguments are pushed
17906 before calling a function and popped afterwards.
17907
17908 Popping the arguments after the function call can be expensive on
17909 AVR so that accumulating the stack space might lead to smaller
17910 executables because arguments need not be removed from the
17911 stack after such a function call.
17912
17913 This option can lead to reduced code size for functions that perform
17914 several calls to functions that get their arguments on the stack like
17915 calls to printf-like functions.
17916
17917 @item -mbranch-cost=@var{cost}
17918 @opindex mbranch-cost
17919 Set the branch costs for conditional branch instructions to
17920 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17921 integers. The default branch cost is 0.
17922
17923 @item -mcall-prologues
17924 @opindex mcall-prologues
17925 Functions prologues/epilogues are expanded as calls to appropriate
17926 subroutines. Code size is smaller.
17927
17928 @item -mgas-isr-prologues
17929 @opindex mgas-isr-prologues
17930 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17931 instruction supported by GNU Binutils.
17932 If this option is on, the feature can still be disabled for individual
17933 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17934 function attribute. This feature is activated per default
17935 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17936 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17937
17938 @item -mint8
17939 @opindex mint8
17940 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17941 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17942 and @code{long long} is 4 bytes. Please note that this option does not
17943 conform to the C standards, but it results in smaller code
17944 size.
17945
17946 @item -mmain-is-OS_task
17947 @opindex mmain-is-OS_task
17948 Do not save registers in @code{main}. The effect is the same like
17949 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17950 to @code{main}. It is activated per default if optimization is on.
17951
17952 @item -mn-flash=@var{num}
17953 @opindex mn-flash
17954 Assume that the flash memory has a size of
17955 @var{num} times 64@tie{}KiB.
17956
17957 @item -mno-interrupts
17958 @opindex mno-interrupts
17959 Generated code is not compatible with hardware interrupts.
17960 Code size is smaller.
17961
17962 @item -mrelax
17963 @opindex mrelax
17964 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17965 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17966 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17967 the assembler's command line and the @option{--relax} option to the
17968 linker's command line.
17969
17970 Jump relaxing is performed by the linker because jump offsets are not
17971 known before code is located. Therefore, the assembler code generated by the
17972 compiler is the same, but the instructions in the executable may
17973 differ from instructions in the assembler code.
17974
17975 Relaxing must be turned on if linker stubs are needed, see the
17976 section on @code{EIND} and linker stubs below.
17977
17978 @item -mrmw
17979 @opindex mrmw
17980 Assume that the device supports the Read-Modify-Write
17981 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17982
17983 @item -mshort-calls
17984 @opindex mshort-calls
17985
17986 Assume that @code{RJMP} and @code{RCALL} can target the whole
17987 program memory.
17988
17989 This option is used internally for multilib selection. It is
17990 not an optimization option, and you don't need to set it by hand.
17991
17992 @item -msp8
17993 @opindex msp8
17994 Treat the stack pointer register as an 8-bit register,
17995 i.e.@: assume the high byte of the stack pointer is zero.
17996 In general, you don't need to set this option by hand.
17997
17998 This option is used internally by the compiler to select and
17999 build multilibs for architectures @code{avr2} and @code{avr25}.
18000 These architectures mix devices with and without @code{SPH}.
18001 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18002 the compiler driver adds or removes this option from the compiler
18003 proper's command line, because the compiler then knows if the device
18004 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18005 register or not.
18006
18007 @item -mstrict-X
18008 @opindex mstrict-X
18009 Use address register @code{X} in a way proposed by the hardware. This means
18010 that @code{X} is only used in indirect, post-increment or
18011 pre-decrement addressing.
18012
18013 Without this option, the @code{X} register may be used in the same way
18014 as @code{Y} or @code{Z} which then is emulated by additional
18015 instructions.
18016 For example, loading a value with @code{X+const} addressing with a
18017 small non-negative @code{const < 64} to a register @var{Rn} is
18018 performed as
18019
18020 @example
18021 adiw r26, const ; X += const
18022 ld @var{Rn}, X ; @var{Rn} = *X
18023 sbiw r26, const ; X -= const
18024 @end example
18025
18026 @item -mtiny-stack
18027 @opindex mtiny-stack
18028 Only change the lower 8@tie{}bits of the stack pointer.
18029
18030 @item -mfract-convert-truncate
18031 @opindex mfract-convert-truncate
18032 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18033
18034 @item -nodevicelib
18035 @opindex nodevicelib
18036 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18037
18038 @item -Waddr-space-convert
18039 @opindex Waddr-space-convert
18040 @opindex Wno-addr-space-convert
18041 Warn about conversions between address spaces in the case where the
18042 resulting address space is not contained in the incoming address space.
18043
18044 @item -Wmisspelled-isr
18045 @opindex Wmisspelled-isr
18046 @opindex Wno-misspelled-isr
18047 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18048 Enabled by default.
18049 @end table
18050
18051 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18052 @cindex @code{EIND}
18053 Pointers in the implementation are 16@tie{}bits wide.
18054 The address of a function or label is represented as word address so
18055 that indirect jumps and calls can target any code address in the
18056 range of 64@tie{}Ki words.
18057
18058 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18059 bytes of program memory space, there is a special function register called
18060 @code{EIND} that serves as most significant part of the target address
18061 when @code{EICALL} or @code{EIJMP} instructions are used.
18062
18063 Indirect jumps and calls on these devices are handled as follows by
18064 the compiler and are subject to some limitations:
18065
18066 @itemize @bullet
18067
18068 @item
18069 The compiler never sets @code{EIND}.
18070
18071 @item
18072 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18073 instructions or might read @code{EIND} directly in order to emulate an
18074 indirect call/jump by means of a @code{RET} instruction.
18075
18076 @item
18077 The compiler assumes that @code{EIND} never changes during the startup
18078 code or during the application. In particular, @code{EIND} is not
18079 saved/restored in function or interrupt service routine
18080 prologue/epilogue.
18081
18082 @item
18083 For indirect calls to functions and computed goto, the linker
18084 generates @emph{stubs}. Stubs are jump pads sometimes also called
18085 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18086 The stub contains a direct jump to the desired address.
18087
18088 @item
18089 Linker relaxation must be turned on so that the linker generates
18090 the stubs correctly in all situations. See the compiler option
18091 @option{-mrelax} and the linker option @option{--relax}.
18092 There are corner cases where the linker is supposed to generate stubs
18093 but aborts without relaxation and without a helpful error message.
18094
18095 @item
18096 The default linker script is arranged for code with @code{EIND = 0}.
18097 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18098 linker script has to be used in order to place the sections whose
18099 name start with @code{.trampolines} into the segment where @code{EIND}
18100 points to.
18101
18102 @item
18103 The startup code from libgcc never sets @code{EIND}.
18104 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18105 For the impact of AVR-LibC on @code{EIND}, see the
18106 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18107
18108 @item
18109 It is legitimate for user-specific startup code to set up @code{EIND}
18110 early, for example by means of initialization code located in
18111 section @code{.init3}. Such code runs prior to general startup code
18112 that initializes RAM and calls constructors, but after the bit
18113 of startup code from AVR-LibC that sets @code{EIND} to the segment
18114 where the vector table is located.
18115 @example
18116 #include <avr/io.h>
18117
18118 static void
18119 __attribute__((section(".init3"),naked,used,no_instrument_function))
18120 init3_set_eind (void)
18121 @{
18122 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18123 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18124 @}
18125 @end example
18126
18127 @noindent
18128 The @code{__trampolines_start} symbol is defined in the linker script.
18129
18130 @item
18131 Stubs are generated automatically by the linker if
18132 the following two conditions are met:
18133 @itemize @minus
18134
18135 @item The address of a label is taken by means of the @code{gs} modifier
18136 (short for @emph{generate stubs}) like so:
18137 @example
18138 LDI r24, lo8(gs(@var{func}))
18139 LDI r25, hi8(gs(@var{func}))
18140 @end example
18141 @item The final location of that label is in a code segment
18142 @emph{outside} the segment where the stubs are located.
18143 @end itemize
18144
18145 @item
18146 The compiler emits such @code{gs} modifiers for code labels in the
18147 following situations:
18148 @itemize @minus
18149 @item Taking address of a function or code label.
18150 @item Computed goto.
18151 @item If prologue-save function is used, see @option{-mcall-prologues}
18152 command-line option.
18153 @item Switch/case dispatch tables. If you do not want such dispatch
18154 tables you can specify the @option{-fno-jump-tables} command-line option.
18155 @item C and C++ constructors/destructors called during startup/shutdown.
18156 @item If the tools hit a @code{gs()} modifier explained above.
18157 @end itemize
18158
18159 @item
18160 Jumping to non-symbolic addresses like so is @emph{not} supported:
18161
18162 @example
18163 int main (void)
18164 @{
18165 /* Call function at word address 0x2 */
18166 return ((int(*)(void)) 0x2)();
18167 @}
18168 @end example
18169
18170 Instead, a stub has to be set up, i.e.@: the function has to be called
18171 through a symbol (@code{func_4} in the example):
18172
18173 @example
18174 int main (void)
18175 @{
18176 extern int func_4 (void);
18177
18178 /* Call function at byte address 0x4 */
18179 return func_4();
18180 @}
18181 @end example
18182
18183 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18184 Alternatively, @code{func_4} can be defined in the linker script.
18185 @end itemize
18186
18187 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18188 @cindex @code{RAMPD}
18189 @cindex @code{RAMPX}
18190 @cindex @code{RAMPY}
18191 @cindex @code{RAMPZ}
18192 Some AVR devices support memories larger than the 64@tie{}KiB range
18193 that can be accessed with 16-bit pointers. To access memory locations
18194 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18195 register is used as high part of the address:
18196 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18197 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18198 register, respectively, to get a wide address. Similarly,
18199 @code{RAMPD} is used together with direct addressing.
18200
18201 @itemize
18202 @item
18203 The startup code initializes the @code{RAMP} special function
18204 registers with zero.
18205
18206 @item
18207 If a @ref{AVR Named Address Spaces,named address space} other than
18208 generic or @code{__flash} is used, then @code{RAMPZ} is set
18209 as needed before the operation.
18210
18211 @item
18212 If the device supports RAM larger than 64@tie{}KiB and the compiler
18213 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18214 is reset to zero after the operation.
18215
18216 @item
18217 If the device comes with a specific @code{RAMP} register, the ISR
18218 prologue/epilogue saves/restores that SFR and initializes it with
18219 zero in case the ISR code might (implicitly) use it.
18220
18221 @item
18222 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18223 If you use inline assembler to read from locations outside the
18224 16-bit address range and change one of the @code{RAMP} registers,
18225 you must reset it to zero after the access.
18226
18227 @end itemize
18228
18229 @subsubsection AVR Built-in Macros
18230
18231 GCC defines several built-in macros so that the user code can test
18232 for the presence or absence of features. Almost any of the following
18233 built-in macros are deduced from device capabilities and thus
18234 triggered by the @option{-mmcu=} command-line option.
18235
18236 For even more AVR-specific built-in macros see
18237 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18238
18239 @table @code
18240
18241 @item __AVR_ARCH__
18242 Build-in macro that resolves to a decimal number that identifies the
18243 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18244 Possible values are:
18245
18246 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18247 @code{4}, @code{5}, @code{51}, @code{6}
18248
18249 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18250 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18251
18252 respectively and
18253
18254 @code{100},
18255 @code{102}, @code{103}, @code{104},
18256 @code{105}, @code{106}, @code{107}
18257
18258 for @var{mcu}=@code{avrtiny},
18259 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18260 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18261 If @var{mcu} specifies a device, this built-in macro is set
18262 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18263 defined to @code{4}.
18264
18265 @item __AVR_@var{Device}__
18266 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18267 the device's name. For example, @option{-mmcu=atmega8} defines the
18268 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18269 @code{__AVR_ATtiny261A__}, etc.
18270
18271 The built-in macros' names follow
18272 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18273 the device name as from the AVR user manual. The difference between
18274 @var{Device} in the built-in macro and @var{device} in
18275 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18276
18277 If @var{device} is not a device but only a core architecture like
18278 @samp{avr51}, this macro is not defined.
18279
18280 @item __AVR_DEVICE_NAME__
18281 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18282 the device's name. For example, with @option{-mmcu=atmega8} the macro
18283 is defined to @code{atmega8}.
18284
18285 If @var{device} is not a device but only a core architecture like
18286 @samp{avr51}, this macro is not defined.
18287
18288 @item __AVR_XMEGA__
18289 The device / architecture belongs to the XMEGA family of devices.
18290
18291 @item __AVR_HAVE_ELPM__
18292 The device has the @code{ELPM} instruction.
18293
18294 @item __AVR_HAVE_ELPMX__
18295 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18296 R@var{n},Z+} instructions.
18297
18298 @item __AVR_HAVE_MOVW__
18299 The device has the @code{MOVW} instruction to perform 16-bit
18300 register-register moves.
18301
18302 @item __AVR_HAVE_LPMX__
18303 The device has the @code{LPM R@var{n},Z} and
18304 @code{LPM R@var{n},Z+} instructions.
18305
18306 @item __AVR_HAVE_MUL__
18307 The device has a hardware multiplier.
18308
18309 @item __AVR_HAVE_JMP_CALL__
18310 The device has the @code{JMP} and @code{CALL} instructions.
18311 This is the case for devices with more than 8@tie{}KiB of program
18312 memory.
18313
18314 @item __AVR_HAVE_EIJMP_EICALL__
18315 @itemx __AVR_3_BYTE_PC__
18316 The device has the @code{EIJMP} and @code{EICALL} instructions.
18317 This is the case for devices with more than 128@tie{}KiB of program memory.
18318 This also means that the program counter
18319 (PC) is 3@tie{}bytes wide.
18320
18321 @item __AVR_2_BYTE_PC__
18322 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18323 with up to 128@tie{}KiB of program memory.
18324
18325 @item __AVR_HAVE_8BIT_SP__
18326 @itemx __AVR_HAVE_16BIT_SP__
18327 The stack pointer (SP) register is treated as 8-bit respectively
18328 16-bit register by the compiler.
18329 The definition of these macros is affected by @option{-mtiny-stack}.
18330
18331 @item __AVR_HAVE_SPH__
18332 @itemx __AVR_SP8__
18333 The device has the SPH (high part of stack pointer) special function
18334 register or has an 8-bit stack pointer, respectively.
18335 The definition of these macros is affected by @option{-mmcu=} and
18336 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18337 by @option{-msp8}.
18338
18339 @item __AVR_HAVE_RAMPD__
18340 @itemx __AVR_HAVE_RAMPX__
18341 @itemx __AVR_HAVE_RAMPY__
18342 @itemx __AVR_HAVE_RAMPZ__
18343 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18344 @code{RAMPZ} special function register, respectively.
18345
18346 @item __NO_INTERRUPTS__
18347 This macro reflects the @option{-mno-interrupts} command-line option.
18348
18349 @item __AVR_ERRATA_SKIP__
18350 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18351 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18352 instructions because of a hardware erratum. Skip instructions are
18353 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18354 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18355 set.
18356
18357 @item __AVR_ISA_RMW__
18358 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18359
18360 @item __AVR_SFR_OFFSET__=@var{offset}
18361 Instructions that can address I/O special function registers directly
18362 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18363 address as if addressed by an instruction to access RAM like @code{LD}
18364 or @code{STS}. This offset depends on the device architecture and has
18365 to be subtracted from the RAM address in order to get the
18366 respective I/O@tie{}address.
18367
18368 @item __AVR_SHORT_CALLS__
18369 The @option{-mshort-calls} command line option is set.
18370
18371 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18372 Some devices support reading from flash memory by means of @code{LD*}
18373 instructions. The flash memory is seen in the data address space
18374 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18375 is not defined, this feature is not available. If defined,
18376 the address space is linear and there is no need to put
18377 @code{.rodata} into RAM. This is handled by the default linker
18378 description file, and is currently available for
18379 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18380 there is no need to use address spaces like @code{__flash} or
18381 features like attribute @code{progmem} and @code{pgm_read_*}.
18382
18383 @item __WITH_AVRLIBC__
18384 The compiler is configured to be used together with AVR-Libc.
18385 See the @option{--with-avrlibc} configure option.
18386
18387 @end table
18388
18389 @node Blackfin Options
18390 @subsection Blackfin Options
18391 @cindex Blackfin Options
18392
18393 @table @gcctabopt
18394 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18395 @opindex mcpu=
18396 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18397 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18398 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18399 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18400 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18401 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18402 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18403 @samp{bf561}, @samp{bf592}.
18404
18405 The optional @var{sirevision} specifies the silicon revision of the target
18406 Blackfin processor. Any workarounds available for the targeted silicon revision
18407 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18408 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18409 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18410 hexadecimal digits representing the major and minor numbers in the silicon
18411 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18412 is not defined. If @var{sirevision} is @samp{any}, the
18413 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18414 If this optional @var{sirevision} is not used, GCC assumes the latest known
18415 silicon revision of the targeted Blackfin processor.
18416
18417 GCC defines a preprocessor macro for the specified @var{cpu}.
18418 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18419 provided by libgloss to be linked in if @option{-msim} is not given.
18420
18421 Without this option, @samp{bf532} is used as the processor by default.
18422
18423 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18424 only the preprocessor macro is defined.
18425
18426 @item -msim
18427 @opindex msim
18428 Specifies that the program will be run on the simulator. This causes
18429 the simulator BSP provided by libgloss to be linked in. This option
18430 has effect only for @samp{bfin-elf} toolchain.
18431 Certain other options, such as @option{-mid-shared-library} and
18432 @option{-mfdpic}, imply @option{-msim}.
18433
18434 @item -momit-leaf-frame-pointer
18435 @opindex momit-leaf-frame-pointer
18436 Don't keep the frame pointer in a register for leaf functions. This
18437 avoids the instructions to save, set up and restore frame pointers and
18438 makes an extra register available in leaf functions.
18439
18440 @item -mspecld-anomaly
18441 @opindex mspecld-anomaly
18442 When enabled, the compiler ensures that the generated code does not
18443 contain speculative loads after jump instructions. If this option is used,
18444 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18445
18446 @item -mno-specld-anomaly
18447 @opindex mno-specld-anomaly
18448 @opindex mspecld-anomaly
18449 Don't generate extra code to prevent speculative loads from occurring.
18450
18451 @item -mcsync-anomaly
18452 @opindex mcsync-anomaly
18453 When enabled, the compiler ensures that the generated code does not
18454 contain CSYNC or SSYNC instructions too soon after conditional branches.
18455 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18456
18457 @item -mno-csync-anomaly
18458 @opindex mno-csync-anomaly
18459 @opindex mcsync-anomaly
18460 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18461 occurring too soon after a conditional branch.
18462
18463 @item -mlow64k
18464 @opindex mlow64k
18465 When enabled, the compiler is free to take advantage of the knowledge that
18466 the entire program fits into the low 64k of memory.
18467
18468 @item -mno-low64k
18469 @opindex mno-low64k
18470 Assume that the program is arbitrarily large. This is the default.
18471
18472 @item -mstack-check-l1
18473 @opindex mstack-check-l1
18474 Do stack checking using information placed into L1 scratchpad memory by the
18475 uClinux kernel.
18476
18477 @item -mid-shared-library
18478 @opindex mid-shared-library
18479 Generate code that supports shared libraries via the library ID method.
18480 This allows for execute in place and shared libraries in an environment
18481 without virtual memory management. This option implies @option{-fPIC}.
18482 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18483
18484 @item -mno-id-shared-library
18485 @opindex mno-id-shared-library
18486 @opindex mid-shared-library
18487 Generate code that doesn't assume ID-based shared libraries are being used.
18488 This is the default.
18489
18490 @item -mleaf-id-shared-library
18491 @opindex mleaf-id-shared-library
18492 Generate code that supports shared libraries via the library ID method,
18493 but assumes that this library or executable won't link against any other
18494 ID shared libraries. That allows the compiler to use faster code for jumps
18495 and calls.
18496
18497 @item -mno-leaf-id-shared-library
18498 @opindex mno-leaf-id-shared-library
18499 @opindex mleaf-id-shared-library
18500 Do not assume that the code being compiled won't link against any ID shared
18501 libraries. Slower code is generated for jump and call insns.
18502
18503 @item -mshared-library-id=n
18504 @opindex mshared-library-id
18505 Specifies the identification number of the ID-based shared library being
18506 compiled. Specifying a value of 0 generates more compact code; specifying
18507 other values forces the allocation of that number to the current
18508 library but is no more space- or time-efficient than omitting this option.
18509
18510 @item -msep-data
18511 @opindex msep-data
18512 Generate code that allows the data segment to be located in a different
18513 area of memory from the text segment. This allows for execute in place in
18514 an environment without virtual memory management by eliminating relocations
18515 against the text section.
18516
18517 @item -mno-sep-data
18518 @opindex mno-sep-data
18519 @opindex msep-data
18520 Generate code that assumes that the data segment follows the text segment.
18521 This is the default.
18522
18523 @item -mlong-calls
18524 @itemx -mno-long-calls
18525 @opindex mlong-calls
18526 @opindex mno-long-calls
18527 Tells the compiler to perform function calls by first loading the
18528 address of the function into a register and then performing a subroutine
18529 call on this register. This switch is needed if the target function
18530 lies outside of the 24-bit addressing range of the offset-based
18531 version of subroutine call instruction.
18532
18533 This feature is not enabled by default. Specifying
18534 @option{-mno-long-calls} restores the default behavior. Note these
18535 switches have no effect on how the compiler generates code to handle
18536 function calls via function pointers.
18537
18538 @item -mfast-fp
18539 @opindex mfast-fp
18540 Link with the fast floating-point library. This library relaxes some of
18541 the IEEE floating-point standard's rules for checking inputs against
18542 Not-a-Number (NAN), in the interest of performance.
18543
18544 @item -minline-plt
18545 @opindex minline-plt
18546 Enable inlining of PLT entries in function calls to functions that are
18547 not known to bind locally. It has no effect without @option{-mfdpic}.
18548
18549 @item -mmulticore
18550 @opindex mmulticore
18551 Build a standalone application for multicore Blackfin processors.
18552 This option causes proper start files and link scripts supporting
18553 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18554 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18555
18556 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18557 selects the one-application-per-core programming model. Without
18558 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18559 programming model is used. In this model, the main function of Core B
18560 should be named as @code{coreb_main}.
18561
18562 If this option is not used, the single-core application programming
18563 model is used.
18564
18565 @item -mcorea
18566 @opindex mcorea
18567 Build a standalone application for Core A of BF561 when using
18568 the one-application-per-core programming model. Proper start files
18569 and link scripts are used to support Core A, and the macro
18570 @code{__BFIN_COREA} is defined.
18571 This option can only be used in conjunction with @option{-mmulticore}.
18572
18573 @item -mcoreb
18574 @opindex mcoreb
18575 Build a standalone application for Core B of BF561 when using
18576 the one-application-per-core programming model. Proper start files
18577 and link scripts are used to support Core B, and the macro
18578 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18579 should be used instead of @code{main}.
18580 This option can only be used in conjunction with @option{-mmulticore}.
18581
18582 @item -msdram
18583 @opindex msdram
18584 Build a standalone application for SDRAM. Proper start files and
18585 link scripts are used to put the application into SDRAM, and the macro
18586 @code{__BFIN_SDRAM} is defined.
18587 The loader should initialize SDRAM before loading the application.
18588
18589 @item -micplb
18590 @opindex micplb
18591 Assume that ICPLBs are enabled at run time. This has an effect on certain
18592 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18593 are enabled; for standalone applications the default is off.
18594 @end table
18595
18596 @node C6X Options
18597 @subsection C6X Options
18598 @cindex C6X Options
18599
18600 @table @gcctabopt
18601 @item -march=@var{name}
18602 @opindex march
18603 This specifies the name of the target architecture. GCC uses this
18604 name to determine what kind of instructions it can emit when generating
18605 assembly code. Permissible names are: @samp{c62x},
18606 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18607
18608 @item -mbig-endian
18609 @opindex mbig-endian
18610 Generate code for a big-endian target.
18611
18612 @item -mlittle-endian
18613 @opindex mlittle-endian
18614 Generate code for a little-endian target. This is the default.
18615
18616 @item -msim
18617 @opindex msim
18618 Choose startup files and linker script suitable for the simulator.
18619
18620 @item -msdata=default
18621 @opindex msdata=default
18622 Put small global and static data in the @code{.neardata} section,
18623 which is pointed to by register @code{B14}. Put small uninitialized
18624 global and static data in the @code{.bss} section, which is adjacent
18625 to the @code{.neardata} section. Put small read-only data into the
18626 @code{.rodata} section. The corresponding sections used for large
18627 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18628
18629 @item -msdata=all
18630 @opindex msdata=all
18631 Put all data, not just small objects, into the sections reserved for
18632 small data, and use addressing relative to the @code{B14} register to
18633 access them.
18634
18635 @item -msdata=none
18636 @opindex msdata=none
18637 Make no use of the sections reserved for small data, and use absolute
18638 addresses to access all data. Put all initialized global and static
18639 data in the @code{.fardata} section, and all uninitialized data in the
18640 @code{.far} section. Put all constant data into the @code{.const}
18641 section.
18642 @end table
18643
18644 @node CRIS Options
18645 @subsection CRIS Options
18646 @cindex CRIS Options
18647
18648 These options are defined specifically for the CRIS ports.
18649
18650 @table @gcctabopt
18651 @item -march=@var{architecture-type}
18652 @itemx -mcpu=@var{architecture-type}
18653 @opindex march
18654 @opindex mcpu
18655 Generate code for the specified architecture. The choices for
18656 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18657 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18658 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18659 @samp{v10}.
18660
18661 @item -mtune=@var{architecture-type}
18662 @opindex mtune
18663 Tune to @var{architecture-type} everything applicable about the generated
18664 code, except for the ABI and the set of available instructions. The
18665 choices for @var{architecture-type} are the same as for
18666 @option{-march=@var{architecture-type}}.
18667
18668 @item -mmax-stack-frame=@var{n}
18669 @opindex mmax-stack-frame
18670 Warn when the stack frame of a function exceeds @var{n} bytes.
18671
18672 @item -metrax4
18673 @itemx -metrax100
18674 @opindex metrax4
18675 @opindex metrax100
18676 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18677 @option{-march=v3} and @option{-march=v8} respectively.
18678
18679 @item -mmul-bug-workaround
18680 @itemx -mno-mul-bug-workaround
18681 @opindex mmul-bug-workaround
18682 @opindex mno-mul-bug-workaround
18683 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18684 models where it applies. This option is active by default.
18685
18686 @item -mpdebug
18687 @opindex mpdebug
18688 Enable CRIS-specific verbose debug-related information in the assembly
18689 code. This option also has the effect of turning off the @samp{#NO_APP}
18690 formatted-code indicator to the assembler at the beginning of the
18691 assembly file.
18692
18693 @item -mcc-init
18694 @opindex mcc-init
18695 Do not use condition-code results from previous instruction; always emit
18696 compare and test instructions before use of condition codes.
18697
18698 @item -mno-side-effects
18699 @opindex mno-side-effects
18700 @opindex mside-effects
18701 Do not emit instructions with side effects in addressing modes other than
18702 post-increment.
18703
18704 @item -mstack-align
18705 @itemx -mno-stack-align
18706 @itemx -mdata-align
18707 @itemx -mno-data-align
18708 @itemx -mconst-align
18709 @itemx -mno-const-align
18710 @opindex mstack-align
18711 @opindex mno-stack-align
18712 @opindex mdata-align
18713 @opindex mno-data-align
18714 @opindex mconst-align
18715 @opindex mno-const-align
18716 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18717 stack frame, individual data and constants to be aligned for the maximum
18718 single data access size for the chosen CPU model. The default is to
18719 arrange for 32-bit alignment. ABI details such as structure layout are
18720 not affected by these options.
18721
18722 @item -m32-bit
18723 @itemx -m16-bit
18724 @itemx -m8-bit
18725 @opindex m32-bit
18726 @opindex m16-bit
18727 @opindex m8-bit
18728 Similar to the stack- data- and const-align options above, these options
18729 arrange for stack frame, writable data and constants to all be 32-bit,
18730 16-bit or 8-bit aligned. The default is 32-bit alignment.
18731
18732 @item -mno-prologue-epilogue
18733 @itemx -mprologue-epilogue
18734 @opindex mno-prologue-epilogue
18735 @opindex mprologue-epilogue
18736 With @option{-mno-prologue-epilogue}, the normal function prologue and
18737 epilogue which set up the stack frame are omitted and no return
18738 instructions or return sequences are generated in the code. Use this
18739 option only together with visual inspection of the compiled code: no
18740 warnings or errors are generated when call-saved registers must be saved,
18741 or storage for local variables needs to be allocated.
18742
18743 @item -mno-gotplt
18744 @itemx -mgotplt
18745 @opindex mno-gotplt
18746 @opindex mgotplt
18747 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18748 instruction sequences that load addresses for functions from the PLT part
18749 of the GOT rather than (traditional on other architectures) calls to the
18750 PLT@. The default is @option{-mgotplt}.
18751
18752 @item -melf
18753 @opindex melf
18754 Legacy no-op option only recognized with the cris-axis-elf and
18755 cris-axis-linux-gnu targets.
18756
18757 @item -mlinux
18758 @opindex mlinux
18759 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18760
18761 @item -sim
18762 @opindex sim
18763 This option, recognized for the cris-axis-elf, arranges
18764 to link with input-output functions from a simulator library. Code,
18765 initialized data and zero-initialized data are allocated consecutively.
18766
18767 @item -sim2
18768 @opindex sim2
18769 Like @option{-sim}, but pass linker options to locate initialized data at
18770 0x40000000 and zero-initialized data at 0x80000000.
18771 @end table
18772
18773 @node CR16 Options
18774 @subsection CR16 Options
18775 @cindex CR16 Options
18776
18777 These options are defined specifically for the CR16 ports.
18778
18779 @table @gcctabopt
18780
18781 @item -mmac
18782 @opindex mmac
18783 Enable the use of multiply-accumulate instructions. Disabled by default.
18784
18785 @item -mcr16cplus
18786 @itemx -mcr16c
18787 @opindex mcr16cplus
18788 @opindex mcr16c
18789 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18790 is default.
18791
18792 @item -msim
18793 @opindex msim
18794 Links the library libsim.a which is in compatible with simulator. Applicable
18795 to ELF compiler only.
18796
18797 @item -mint32
18798 @opindex mint32
18799 Choose integer type as 32-bit wide.
18800
18801 @item -mbit-ops
18802 @opindex mbit-ops
18803 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18804
18805 @item -mdata-model=@var{model}
18806 @opindex mdata-model
18807 Choose a data model. The choices for @var{model} are @samp{near},
18808 @samp{far} or @samp{medium}. @samp{medium} is default.
18809 However, @samp{far} is not valid with @option{-mcr16c}, as the
18810 CR16C architecture does not support the far data model.
18811 @end table
18812
18813 @node C-SKY Options
18814 @subsection C-SKY Options
18815 @cindex C-SKY Options
18816
18817 GCC supports these options when compiling for C-SKY V2 processors.
18818
18819 @table @gcctabopt
18820
18821 @item -march=@var{arch}
18822 @opindex march=
18823 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18824 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18825 The default is @samp{ck810}.
18826
18827 @item -mcpu=@var{cpu}
18828 @opindex mcpu=
18829 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18830 @samp{ck801}, @samp{ck801t},
18831 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18832 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18833 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18834 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18835 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18836 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18837 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18838 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18839 @samp{ck803eftr1}, @samp{ck803efhtr1},
18840 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18841 @samp{ck803sef}, @samp{ck803seft},
18842 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18843 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18844 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18845 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18846
18847 @item -mbig-endian
18848 @opindex mbig-endian
18849 @itemx -EB
18850 @opindex EB
18851 @itemx -mlittle-endian
18852 @opindex mlittle-endian
18853 @itemx -EL
18854 @opindex EL
18855
18856 Select big- or little-endian code. The default is little-endian.
18857
18858 @item -mhard-float
18859 @opindex mhard-float
18860 @itemx -msoft-float
18861 @opindex msoft-float
18862
18863 Select hardware or software floating-point implementations.
18864 The default is soft float.
18865
18866 @item -mdouble-float
18867 @itemx -mno-double-float
18868 @opindex mdouble-float
18869 When @option{-mhard-float} is in effect, enable generation of
18870 double-precision float instructions. This is the default except
18871 when compiling for CK803.
18872
18873 @item -mfdivdu
18874 @itemx -mno-fdivdu
18875 @opindex mfdivdu
18876 When @option{-mhard-float} is in effect, enable generation of
18877 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18878 This is the default except when compiling for CK803.
18879
18880 @item -mfpu=@var{fpu}
18881 @opindex mfpu=
18882 Select the floating-point processor. This option can only be used with
18883 @option{-mhard-float}.
18884 Values for @var{fpu} are
18885 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18886 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18887 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18888
18889 @item -melrw
18890 @itemx -mno-elrw
18891 @opindex melrw
18892 Enable the extended @code{lrw} instruction. This option defaults to on
18893 for CK801 and off otherwise.
18894
18895 @item -mistack
18896 @itemx -mno-istack
18897 @opindex mistack
18898 Enable interrupt stack instructions; the default is off.
18899
18900 The @option{-mistack} option is required to handle the
18901 @code{interrupt} and @code{isr} function attributes
18902 (@pxref{C-SKY Function Attributes}).
18903
18904 @item -mmp
18905 @opindex mmp
18906 Enable multiprocessor instructions; the default is off.
18907
18908 @item -mcp
18909 @opindex mcp
18910 Enable coprocessor instructions; the default is off.
18911
18912 @item -mcache
18913 @opindex mcache
18914 Enable coprocessor instructions; the default is off.
18915
18916 @item -msecurity
18917 @opindex msecurity
18918 Enable C-SKY security instructions; the default is off.
18919
18920 @item -mtrust
18921 @opindex mtrust
18922 Enable C-SKY trust instructions; the default is off.
18923
18924 @item -mdsp
18925 @opindex mdsp
18926 @itemx -medsp
18927 @opindex medsp
18928 @itemx -mvdsp
18929 @opindex mvdsp
18930 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18931 All of these options default to off.
18932
18933 @item -mdiv
18934 @itemx -mno-div
18935 @opindex mdiv
18936 Generate divide instructions. Default is off.
18937
18938 @item -msmart
18939 @itemx -mno-smart
18940 @opindex msmart
18941 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18942 use of 16-bit instructions. This option is ignored for CK801 where this
18943 is the required behavior, and it defaults to on for CK802.
18944 For other targets, the default is off.
18945
18946 @item -mhigh-registers
18947 @itemx -mno-high-registers
18948 @opindex mhigh-registers
18949 Generate code using the high registers numbered 16-31. This option
18950 is not supported on CK801, CK802, or CK803, and is enabled by default
18951 for other processors.
18952
18953 @item -manchor
18954 @itemx -mno-anchor
18955 @opindex manchor
18956 Generate code using global anchor symbol addresses.
18957
18958 @item -mpushpop
18959 @itemx -mno-pushpop
18960 @opindex mpushpop
18961 Generate code using @code{push} and @code{pop} instructions. This option
18962 defaults to on.
18963
18964 @item -mmultiple-stld
18965 @itemx -mstm
18966 @itemx -mno-multiple-stld
18967 @itemx -mno-stm
18968 @opindex mmultiple-stld
18969 Generate code using @code{stm} and @code{ldm} instructions. This option
18970 isn't supported on CK801 but is enabled by default on other processors.
18971
18972 @item -mconstpool
18973 @itemx -mno-constpool
18974 @opindex mconstpool
18975 Create constant pools in the compiler instead of deferring it to the
18976 assembler. This option is the default and required for correct code
18977 generation on CK801 and CK802, and is optional on other processors.
18978
18979 @item -mstack-size
18980 @item -mno-stack-size
18981 @opindex mstack-size
18982 Emit @code{.stack_size} directives for each function in the assembly
18983 output. This option defaults to off.
18984
18985 @item -mccrt
18986 @itemx -mno-ccrt
18987 @opindex mccrt
18988 Generate code for the C-SKY compiler runtime instead of libgcc. This
18989 option defaults to off.
18990
18991 @item -mbranch-cost=@var{n}
18992 @opindex mbranch-cost=
18993 Set the branch costs to roughly @code{n} instructions. The default is 1.
18994
18995 @item -msched-prolog
18996 @itemx -mno-sched-prolog
18997 @opindex msched-prolog
18998 Permit scheduling of function prologue and epilogue sequences. Using
18999 this option can result in code that is not compliant with the C-SKY V2 ABI
19000 prologue requirements and that cannot be debugged or backtraced.
19001 It is disabled by default.
19002
19003 @end table
19004
19005 @node Darwin Options
19006 @subsection Darwin Options
19007 @cindex Darwin options
19008
19009 These options are defined for all architectures running the Darwin operating
19010 system.
19011
19012 FSF GCC on Darwin does not create ``fat'' object files; it creates
19013 an object file for the single architecture that GCC was built to
19014 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19015 @option{-arch} options are used; it does so by running the compiler or
19016 linker multiple times and joining the results together with
19017 @file{lipo}.
19018
19019 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19020 @samp{i686}) is determined by the flags that specify the ISA
19021 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19022 @option{-force_cpusubtype_ALL} option can be used to override this.
19023
19024 The Darwin tools vary in their behavior when presented with an ISA
19025 mismatch. The assembler, @file{as}, only permits instructions to
19026 be used that are valid for the subtype of the file it is generating,
19027 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19028 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19029 and prints an error if asked to create a shared library with a less
19030 restrictive subtype than its input files (for instance, trying to put
19031 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19032 for executables, @command{ld}, quietly gives the executable the most
19033 restrictive subtype of any of its input files.
19034
19035 @table @gcctabopt
19036 @item -F@var{dir}
19037 @opindex F
19038 Add the framework directory @var{dir} to the head of the list of
19039 directories to be searched for header files. These directories are
19040 interleaved with those specified by @option{-I} options and are
19041 scanned in a left-to-right order.
19042
19043 A framework directory is a directory with frameworks in it. A
19044 framework is a directory with a @file{Headers} and/or
19045 @file{PrivateHeaders} directory contained directly in it that ends
19046 in @file{.framework}. The name of a framework is the name of this
19047 directory excluding the @file{.framework}. Headers associated with
19048 the framework are found in one of those two directories, with
19049 @file{Headers} being searched first. A subframework is a framework
19050 directory that is in a framework's @file{Frameworks} directory.
19051 Includes of subframework headers can only appear in a header of a
19052 framework that contains the subframework, or in a sibling subframework
19053 header. Two subframeworks are siblings if they occur in the same
19054 framework. A subframework should not have the same name as a
19055 framework; a warning is issued if this is violated. Currently a
19056 subframework cannot have subframeworks; in the future, the mechanism
19057 may be extended to support this. The standard frameworks can be found
19058 in @file{/System/Library/Frameworks} and
19059 @file{/Library/Frameworks}. An example include looks like
19060 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19061 the name of the framework and @file{header.h} is found in the
19062 @file{PrivateHeaders} or @file{Headers} directory.
19063
19064 @item -iframework@var{dir}
19065 @opindex iframework
19066 Like @option{-F} except the directory is a treated as a system
19067 directory. The main difference between this @option{-iframework} and
19068 @option{-F} is that with @option{-iframework} the compiler does not
19069 warn about constructs contained within header files found via
19070 @var{dir}. This option is valid only for the C family of languages.
19071
19072 @item -gused
19073 @opindex gused
19074 Emit debugging information for symbols that are used. For stabs
19075 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19076 This is by default ON@.
19077
19078 @item -gfull
19079 @opindex gfull
19080 Emit debugging information for all symbols and types.
19081
19082 @item -mmacosx-version-min=@var{version}
19083 The earliest version of MacOS X that this executable will run on
19084 is @var{version}. Typical values of @var{version} include @code{10.1},
19085 @code{10.2}, and @code{10.3.9}.
19086
19087 If the compiler was built to use the system's headers by default,
19088 then the default for this option is the system version on which the
19089 compiler is running, otherwise the default is to make choices that
19090 are compatible with as many systems and code bases as possible.
19091
19092 @item -mkernel
19093 @opindex mkernel
19094 Enable kernel development mode. The @option{-mkernel} option sets
19095 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19096 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19097 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19098 applicable. This mode also sets @option{-mno-altivec},
19099 @option{-msoft-float}, @option{-fno-builtin} and
19100 @option{-mlong-branch} for PowerPC targets.
19101
19102 @item -mone-byte-bool
19103 @opindex mone-byte-bool
19104 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19105 By default @code{sizeof(bool)} is @code{4} when compiling for
19106 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19107 option has no effect on x86.
19108
19109 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19110 to generate code that is not binary compatible with code generated
19111 without that switch. Using this switch may require recompiling all
19112 other modules in a program, including system libraries. Use this
19113 switch to conform to a non-default data model.
19114
19115 @item -mfix-and-continue
19116 @itemx -ffix-and-continue
19117 @itemx -findirect-data
19118 @opindex mfix-and-continue
19119 @opindex ffix-and-continue
19120 @opindex findirect-data
19121 Generate code suitable for fast turnaround development, such as to
19122 allow GDB to dynamically load @file{.o} files into already-running
19123 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19124 are provided for backwards compatibility.
19125
19126 @item -all_load
19127 @opindex all_load
19128 Loads all members of static archive libraries.
19129 See man ld(1) for more information.
19130
19131 @item -arch_errors_fatal
19132 @opindex arch_errors_fatal
19133 Cause the errors having to do with files that have the wrong architecture
19134 to be fatal.
19135
19136 @item -bind_at_load
19137 @opindex bind_at_load
19138 Causes the output file to be marked such that the dynamic linker will
19139 bind all undefined references when the file is loaded or launched.
19140
19141 @item -bundle
19142 @opindex bundle
19143 Produce a Mach-o bundle format file.
19144 See man ld(1) for more information.
19145
19146 @item -bundle_loader @var{executable}
19147 @opindex bundle_loader
19148 This option specifies the @var{executable} that will load the build
19149 output file being linked. See man ld(1) for more information.
19150
19151 @item -dynamiclib
19152 @opindex dynamiclib
19153 When passed this option, GCC produces a dynamic library instead of
19154 an executable when linking, using the Darwin @file{libtool} command.
19155
19156 @item -force_cpusubtype_ALL
19157 @opindex force_cpusubtype_ALL
19158 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19159 one controlled by the @option{-mcpu} or @option{-march} option.
19160
19161 @item -allowable_client @var{client_name}
19162 @itemx -client_name
19163 @itemx -compatibility_version
19164 @itemx -current_version
19165 @itemx -dead_strip
19166 @itemx -dependency-file
19167 @itemx -dylib_file
19168 @itemx -dylinker_install_name
19169 @itemx -dynamic
19170 @itemx -exported_symbols_list
19171 @itemx -filelist
19172 @need 800
19173 @itemx -flat_namespace
19174 @itemx -force_flat_namespace
19175 @itemx -headerpad_max_install_names
19176 @itemx -image_base
19177 @itemx -init
19178 @itemx -install_name
19179 @itemx -keep_private_externs
19180 @itemx -multi_module
19181 @itemx -multiply_defined
19182 @itemx -multiply_defined_unused
19183 @need 800
19184 @itemx -noall_load
19185 @itemx -no_dead_strip_inits_and_terms
19186 @itemx -nofixprebinding
19187 @itemx -nomultidefs
19188 @itemx -noprebind
19189 @itemx -noseglinkedit
19190 @itemx -pagezero_size
19191 @itemx -prebind
19192 @itemx -prebind_all_twolevel_modules
19193 @itemx -private_bundle
19194 @need 800
19195 @itemx -read_only_relocs
19196 @itemx -sectalign
19197 @itemx -sectobjectsymbols
19198 @itemx -whyload
19199 @itemx -seg1addr
19200 @itemx -sectcreate
19201 @itemx -sectobjectsymbols
19202 @itemx -sectorder
19203 @itemx -segaddr
19204 @itemx -segs_read_only_addr
19205 @need 800
19206 @itemx -segs_read_write_addr
19207 @itemx -seg_addr_table
19208 @itemx -seg_addr_table_filename
19209 @itemx -seglinkedit
19210 @itemx -segprot
19211 @itemx -segs_read_only_addr
19212 @itemx -segs_read_write_addr
19213 @itemx -single_module
19214 @itemx -static
19215 @itemx -sub_library
19216 @need 800
19217 @itemx -sub_umbrella
19218 @itemx -twolevel_namespace
19219 @itemx -umbrella
19220 @itemx -undefined
19221 @itemx -unexported_symbols_list
19222 @itemx -weak_reference_mismatches
19223 @itemx -whatsloaded
19224 @opindex allowable_client
19225 @opindex client_name
19226 @opindex compatibility_version
19227 @opindex current_version
19228 @opindex dead_strip
19229 @opindex dependency-file
19230 @opindex dylib_file
19231 @opindex dylinker_install_name
19232 @opindex dynamic
19233 @opindex exported_symbols_list
19234 @opindex filelist
19235 @opindex flat_namespace
19236 @opindex force_flat_namespace
19237 @opindex headerpad_max_install_names
19238 @opindex image_base
19239 @opindex init
19240 @opindex install_name
19241 @opindex keep_private_externs
19242 @opindex multi_module
19243 @opindex multiply_defined
19244 @opindex multiply_defined_unused
19245 @opindex noall_load
19246 @opindex no_dead_strip_inits_and_terms
19247 @opindex nofixprebinding
19248 @opindex nomultidefs
19249 @opindex noprebind
19250 @opindex noseglinkedit
19251 @opindex pagezero_size
19252 @opindex prebind
19253 @opindex prebind_all_twolevel_modules
19254 @opindex private_bundle
19255 @opindex read_only_relocs
19256 @opindex sectalign
19257 @opindex sectobjectsymbols
19258 @opindex whyload
19259 @opindex seg1addr
19260 @opindex sectcreate
19261 @opindex sectobjectsymbols
19262 @opindex sectorder
19263 @opindex segaddr
19264 @opindex segs_read_only_addr
19265 @opindex segs_read_write_addr
19266 @opindex seg_addr_table
19267 @opindex seg_addr_table_filename
19268 @opindex seglinkedit
19269 @opindex segprot
19270 @opindex segs_read_only_addr
19271 @opindex segs_read_write_addr
19272 @opindex single_module
19273 @opindex static
19274 @opindex sub_library
19275 @opindex sub_umbrella
19276 @opindex twolevel_namespace
19277 @opindex umbrella
19278 @opindex undefined
19279 @opindex unexported_symbols_list
19280 @opindex weak_reference_mismatches
19281 @opindex whatsloaded
19282 These options are passed to the Darwin linker. The Darwin linker man page
19283 describes them in detail.
19284 @end table
19285
19286 @node DEC Alpha Options
19287 @subsection DEC Alpha Options
19288
19289 These @samp{-m} options are defined for the DEC Alpha implementations:
19290
19291 @table @gcctabopt
19292 @item -mno-soft-float
19293 @itemx -msoft-float
19294 @opindex mno-soft-float
19295 @opindex msoft-float
19296 Use (do not use) the hardware floating-point instructions for
19297 floating-point operations. When @option{-msoft-float} is specified,
19298 functions in @file{libgcc.a} are used to perform floating-point
19299 operations. Unless they are replaced by routines that emulate the
19300 floating-point operations, or compiled in such a way as to call such
19301 emulations routines, these routines issue floating-point
19302 operations. If you are compiling for an Alpha without floating-point
19303 operations, you must ensure that the library is built so as not to call
19304 them.
19305
19306 Note that Alpha implementations without floating-point operations are
19307 required to have floating-point registers.
19308
19309 @item -mfp-reg
19310 @itemx -mno-fp-regs
19311 @opindex mfp-reg
19312 @opindex mno-fp-regs
19313 Generate code that uses (does not use) the floating-point register set.
19314 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19315 register set is not used, floating-point operands are passed in integer
19316 registers as if they were integers and floating-point results are passed
19317 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19318 so any function with a floating-point argument or return value called by code
19319 compiled with @option{-mno-fp-regs} must also be compiled with that
19320 option.
19321
19322 A typical use of this option is building a kernel that does not use,
19323 and hence need not save and restore, any floating-point registers.
19324
19325 @item -mieee
19326 @opindex mieee
19327 The Alpha architecture implements floating-point hardware optimized for
19328 maximum performance. It is mostly compliant with the IEEE floating-point
19329 standard. However, for full compliance, software assistance is
19330 required. This option generates code fully IEEE-compliant code
19331 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19332 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19333 defined during compilation. The resulting code is less efficient but is
19334 able to correctly support denormalized numbers and exceptional IEEE
19335 values such as not-a-number and plus/minus infinity. Other Alpha
19336 compilers call this option @option{-ieee_with_no_inexact}.
19337
19338 @item -mieee-with-inexact
19339 @opindex mieee-with-inexact
19340 This is like @option{-mieee} except the generated code also maintains
19341 the IEEE @var{inexact-flag}. Turning on this option causes the
19342 generated code to implement fully-compliant IEEE math. In addition to
19343 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19344 macro. On some Alpha implementations the resulting code may execute
19345 significantly slower than the code generated by default. Since there is
19346 very little code that depends on the @var{inexact-flag}, you should
19347 normally not specify this option. Other Alpha compilers call this
19348 option @option{-ieee_with_inexact}.
19349
19350 @item -mfp-trap-mode=@var{trap-mode}
19351 @opindex mfp-trap-mode
19352 This option controls what floating-point related traps are enabled.
19353 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19354 The trap mode can be set to one of four values:
19355
19356 @table @samp
19357 @item n
19358 This is the default (normal) setting. The only traps that are enabled
19359 are the ones that cannot be disabled in software (e.g., division by zero
19360 trap).
19361
19362 @item u
19363 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19364 as well.
19365
19366 @item su
19367 Like @samp{u}, but the instructions are marked to be safe for software
19368 completion (see Alpha architecture manual for details).
19369
19370 @item sui
19371 Like @samp{su}, but inexact traps are enabled as well.
19372 @end table
19373
19374 @item -mfp-rounding-mode=@var{rounding-mode}
19375 @opindex mfp-rounding-mode
19376 Selects the IEEE rounding mode. Other Alpha compilers call this option
19377 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19378 of:
19379
19380 @table @samp
19381 @item n
19382 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19383 the nearest machine number or towards the even machine number in case
19384 of a tie.
19385
19386 @item m
19387 Round towards minus infinity.
19388
19389 @item c
19390 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19391
19392 @item d
19393 Dynamic rounding mode. A field in the floating-point control register
19394 (@var{fpcr}, see Alpha architecture reference manual) controls the
19395 rounding mode in effect. The C library initializes this register for
19396 rounding towards plus infinity. Thus, unless your program modifies the
19397 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19398 @end table
19399
19400 @item -mtrap-precision=@var{trap-precision}
19401 @opindex mtrap-precision
19402 In the Alpha architecture, floating-point traps are imprecise. This
19403 means without software assistance it is impossible to recover from a
19404 floating trap and program execution normally needs to be terminated.
19405 GCC can generate code that can assist operating system trap handlers
19406 in determining the exact location that caused a floating-point trap.
19407 Depending on the requirements of an application, different levels of
19408 precisions can be selected:
19409
19410 @table @samp
19411 @item p
19412 Program precision. This option is the default and means a trap handler
19413 can only identify which program caused a floating-point exception.
19414
19415 @item f
19416 Function precision. The trap handler can determine the function that
19417 caused a floating-point exception.
19418
19419 @item i
19420 Instruction precision. The trap handler can determine the exact
19421 instruction that caused a floating-point exception.
19422 @end table
19423
19424 Other Alpha compilers provide the equivalent options called
19425 @option{-scope_safe} and @option{-resumption_safe}.
19426
19427 @item -mieee-conformant
19428 @opindex mieee-conformant
19429 This option marks the generated code as IEEE conformant. You must not
19430 use this option unless you also specify @option{-mtrap-precision=i} and either
19431 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19432 is to emit the line @samp{.eflag 48} in the function prologue of the
19433 generated assembly file.
19434
19435 @item -mbuild-constants
19436 @opindex mbuild-constants
19437 Normally GCC examines a 32- or 64-bit integer constant to
19438 see if it can construct it from smaller constants in two or three
19439 instructions. If it cannot, it outputs the constant as a literal and
19440 generates code to load it from the data segment at run time.
19441
19442 Use this option to require GCC to construct @emph{all} integer constants
19443 using code, even if it takes more instructions (the maximum is six).
19444
19445 You typically use this option to build a shared library dynamic
19446 loader. Itself a shared library, it must relocate itself in memory
19447 before it can find the variables and constants in its own data segment.
19448
19449 @item -mbwx
19450 @itemx -mno-bwx
19451 @itemx -mcix
19452 @itemx -mno-cix
19453 @itemx -mfix
19454 @itemx -mno-fix
19455 @itemx -mmax
19456 @itemx -mno-max
19457 @opindex mbwx
19458 @opindex mno-bwx
19459 @opindex mcix
19460 @opindex mno-cix
19461 @opindex mfix
19462 @opindex mno-fix
19463 @opindex mmax
19464 @opindex mno-max
19465 Indicate whether GCC should generate code to use the optional BWX,
19466 CIX, FIX and MAX instruction sets. The default is to use the instruction
19467 sets supported by the CPU type specified via @option{-mcpu=} option or that
19468 of the CPU on which GCC was built if none is specified.
19469
19470 @item -mfloat-vax
19471 @itemx -mfloat-ieee
19472 @opindex mfloat-vax
19473 @opindex mfloat-ieee
19474 Generate code that uses (does not use) VAX F and G floating-point
19475 arithmetic instead of IEEE single and double precision.
19476
19477 @item -mexplicit-relocs
19478 @itemx -mno-explicit-relocs
19479 @opindex mexplicit-relocs
19480 @opindex mno-explicit-relocs
19481 Older Alpha assemblers provided no way to generate symbol relocations
19482 except via assembler macros. Use of these macros does not allow
19483 optimal instruction scheduling. GNU binutils as of version 2.12
19484 supports a new syntax that allows the compiler to explicitly mark
19485 which relocations should apply to which instructions. This option
19486 is mostly useful for debugging, as GCC detects the capabilities of
19487 the assembler when it is built and sets the default accordingly.
19488
19489 @item -msmall-data
19490 @itemx -mlarge-data
19491 @opindex msmall-data
19492 @opindex mlarge-data
19493 When @option{-mexplicit-relocs} is in effect, static data is
19494 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19495 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19496 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19497 16-bit relocations off of the @code{$gp} register. This limits the
19498 size of the small data area to 64KB, but allows the variables to be
19499 directly accessed via a single instruction.
19500
19501 The default is @option{-mlarge-data}. With this option the data area
19502 is limited to just below 2GB@. Programs that require more than 2GB of
19503 data must use @code{malloc} or @code{mmap} to allocate the data in the
19504 heap instead of in the program's data segment.
19505
19506 When generating code for shared libraries, @option{-fpic} implies
19507 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19508
19509 @item -msmall-text
19510 @itemx -mlarge-text
19511 @opindex msmall-text
19512 @opindex mlarge-text
19513 When @option{-msmall-text} is used, the compiler assumes that the
19514 code of the entire program (or shared library) fits in 4MB, and is
19515 thus reachable with a branch instruction. When @option{-msmall-data}
19516 is used, the compiler can assume that all local symbols share the
19517 same @code{$gp} value, and thus reduce the number of instructions
19518 required for a function call from 4 to 1.
19519
19520 The default is @option{-mlarge-text}.
19521
19522 @item -mcpu=@var{cpu_type}
19523 @opindex mcpu
19524 Set the instruction set and instruction scheduling parameters for
19525 machine type @var{cpu_type}. You can specify either the @samp{EV}
19526 style name or the corresponding chip number. GCC supports scheduling
19527 parameters for the EV4, EV5 and EV6 family of processors and
19528 chooses the default values for the instruction set from the processor
19529 you specify. If you do not specify a processor type, GCC defaults
19530 to the processor on which the compiler was built.
19531
19532 Supported values for @var{cpu_type} are
19533
19534 @table @samp
19535 @item ev4
19536 @itemx ev45
19537 @itemx 21064
19538 Schedules as an EV4 and has no instruction set extensions.
19539
19540 @item ev5
19541 @itemx 21164
19542 Schedules as an EV5 and has no instruction set extensions.
19543
19544 @item ev56
19545 @itemx 21164a
19546 Schedules as an EV5 and supports the BWX extension.
19547
19548 @item pca56
19549 @itemx 21164pc
19550 @itemx 21164PC
19551 Schedules as an EV5 and supports the BWX and MAX extensions.
19552
19553 @item ev6
19554 @itemx 21264
19555 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19556
19557 @item ev67
19558 @itemx 21264a
19559 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19560 @end table
19561
19562 Native toolchains also support the value @samp{native},
19563 which selects the best architecture option for the host processor.
19564 @option{-mcpu=native} has no effect if GCC does not recognize
19565 the processor.
19566
19567 @item -mtune=@var{cpu_type}
19568 @opindex mtune
19569 Set only the instruction scheduling parameters for machine type
19570 @var{cpu_type}. The instruction set is not changed.
19571
19572 Native toolchains also support the value @samp{native},
19573 which selects the best architecture option for the host processor.
19574 @option{-mtune=native} has no effect if GCC does not recognize
19575 the processor.
19576
19577 @item -mmemory-latency=@var{time}
19578 @opindex mmemory-latency
19579 Sets the latency the scheduler should assume for typical memory
19580 references as seen by the application. This number is highly
19581 dependent on the memory access patterns used by the application
19582 and the size of the external cache on the machine.
19583
19584 Valid options for @var{time} are
19585
19586 @table @samp
19587 @item @var{number}
19588 A decimal number representing clock cycles.
19589
19590 @item L1
19591 @itemx L2
19592 @itemx L3
19593 @itemx main
19594 The compiler contains estimates of the number of clock cycles for
19595 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19596 (also called Dcache, Scache, and Bcache), as well as to main memory.
19597 Note that L3 is only valid for EV5.
19598
19599 @end table
19600 @end table
19601
19602 @node FR30 Options
19603 @subsection FR30 Options
19604 @cindex FR30 Options
19605
19606 These options are defined specifically for the FR30 port.
19607
19608 @table @gcctabopt
19609
19610 @item -msmall-model
19611 @opindex msmall-model
19612 Use the small address space model. This can produce smaller code, but
19613 it does assume that all symbolic values and addresses fit into a
19614 20-bit range.
19615
19616 @item -mno-lsim
19617 @opindex mno-lsim
19618 Assume that runtime support has been provided and so there is no need
19619 to include the simulator library (@file{libsim.a}) on the linker
19620 command line.
19621
19622 @end table
19623
19624 @node FT32 Options
19625 @subsection FT32 Options
19626 @cindex FT32 Options
19627
19628 These options are defined specifically for the FT32 port.
19629
19630 @table @gcctabopt
19631
19632 @item -msim
19633 @opindex msim
19634 Specifies that the program will be run on the simulator. This causes
19635 an alternate runtime startup and library to be linked.
19636 You must not use this option when generating programs that will run on
19637 real hardware; you must provide your own runtime library for whatever
19638 I/O functions are needed.
19639
19640 @item -mlra
19641 @opindex mlra
19642 Enable Local Register Allocation. This is still experimental for FT32,
19643 so by default the compiler uses standard reload.
19644
19645 @item -mnodiv
19646 @opindex mnodiv
19647 Do not use div and mod instructions.
19648
19649 @item -mft32b
19650 @opindex mft32b
19651 Enable use of the extended instructions of the FT32B processor.
19652
19653 @item -mcompress
19654 @opindex mcompress
19655 Compress all code using the Ft32B code compression scheme.
19656
19657 @item -mnopm
19658 @opindex mnopm
19659 Do not generate code that reads program memory.
19660
19661 @end table
19662
19663 @node FRV Options
19664 @subsection FRV Options
19665 @cindex FRV Options
19666
19667 @table @gcctabopt
19668 @item -mgpr-32
19669 @opindex mgpr-32
19670
19671 Only use the first 32 general-purpose registers.
19672
19673 @item -mgpr-64
19674 @opindex mgpr-64
19675
19676 Use all 64 general-purpose registers.
19677
19678 @item -mfpr-32
19679 @opindex mfpr-32
19680
19681 Use only the first 32 floating-point registers.
19682
19683 @item -mfpr-64
19684 @opindex mfpr-64
19685
19686 Use all 64 floating-point registers.
19687
19688 @item -mhard-float
19689 @opindex mhard-float
19690
19691 Use hardware instructions for floating-point operations.
19692
19693 @item -msoft-float
19694 @opindex msoft-float
19695
19696 Use library routines for floating-point operations.
19697
19698 @item -malloc-cc
19699 @opindex malloc-cc
19700
19701 Dynamically allocate condition code registers.
19702
19703 @item -mfixed-cc
19704 @opindex mfixed-cc
19705
19706 Do not try to dynamically allocate condition code registers, only
19707 use @code{icc0} and @code{fcc0}.
19708
19709 @item -mdword
19710 @opindex mdword
19711
19712 Change ABI to use double word insns.
19713
19714 @item -mno-dword
19715 @opindex mno-dword
19716 @opindex mdword
19717
19718 Do not use double word instructions.
19719
19720 @item -mdouble
19721 @opindex mdouble
19722
19723 Use floating-point double instructions.
19724
19725 @item -mno-double
19726 @opindex mno-double
19727
19728 Do not use floating-point double instructions.
19729
19730 @item -mmedia
19731 @opindex mmedia
19732
19733 Use media instructions.
19734
19735 @item -mno-media
19736 @opindex mno-media
19737
19738 Do not use media instructions.
19739
19740 @item -mmuladd
19741 @opindex mmuladd
19742
19743 Use multiply and add/subtract instructions.
19744
19745 @item -mno-muladd
19746 @opindex mno-muladd
19747
19748 Do not use multiply and add/subtract instructions.
19749
19750 @item -mfdpic
19751 @opindex mfdpic
19752
19753 Select the FDPIC ABI, which uses function descriptors to represent
19754 pointers to functions. Without any PIC/PIE-related options, it
19755 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19756 assumes GOT entries and small data are within a 12-bit range from the
19757 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19758 are computed with 32 bits.
19759 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19760
19761 @item -minline-plt
19762 @opindex minline-plt
19763
19764 Enable inlining of PLT entries in function calls to functions that are
19765 not known to bind locally. It has no effect without @option{-mfdpic}.
19766 It's enabled by default if optimizing for speed and compiling for
19767 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19768 optimization option such as @option{-O3} or above is present in the
19769 command line.
19770
19771 @item -mTLS
19772 @opindex mTLS
19773
19774 Assume a large TLS segment when generating thread-local code.
19775
19776 @item -mtls
19777 @opindex mtls
19778
19779 Do not assume a large TLS segment when generating thread-local code.
19780
19781 @item -mgprel-ro
19782 @opindex mgprel-ro
19783
19784 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19785 that is known to be in read-only sections. It's enabled by default,
19786 except for @option{-fpic} or @option{-fpie}: even though it may help
19787 make the global offset table smaller, it trades 1 instruction for 4.
19788 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19789 one of which may be shared by multiple symbols, and it avoids the need
19790 for a GOT entry for the referenced symbol, so it's more likely to be a
19791 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19792
19793 @item -multilib-library-pic
19794 @opindex multilib-library-pic
19795
19796 Link with the (library, not FD) pic libraries. It's implied by
19797 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19798 @option{-fpic} without @option{-mfdpic}. You should never have to use
19799 it explicitly.
19800
19801 @item -mlinked-fp
19802 @opindex mlinked-fp
19803
19804 Follow the EABI requirement of always creating a frame pointer whenever
19805 a stack frame is allocated. This option is enabled by default and can
19806 be disabled with @option{-mno-linked-fp}.
19807
19808 @item -mlong-calls
19809 @opindex mlong-calls
19810
19811 Use indirect addressing to call functions outside the current
19812 compilation unit. This allows the functions to be placed anywhere
19813 within the 32-bit address space.
19814
19815 @item -malign-labels
19816 @opindex malign-labels
19817
19818 Try to align labels to an 8-byte boundary by inserting NOPs into the
19819 previous packet. This option only has an effect when VLIW packing
19820 is enabled. It doesn't create new packets; it merely adds NOPs to
19821 existing ones.
19822
19823 @item -mlibrary-pic
19824 @opindex mlibrary-pic
19825
19826 Generate position-independent EABI code.
19827
19828 @item -macc-4
19829 @opindex macc-4
19830
19831 Use only the first four media accumulator registers.
19832
19833 @item -macc-8
19834 @opindex macc-8
19835
19836 Use all eight media accumulator registers.
19837
19838 @item -mpack
19839 @opindex mpack
19840
19841 Pack VLIW instructions.
19842
19843 @item -mno-pack
19844 @opindex mno-pack
19845
19846 Do not pack VLIW instructions.
19847
19848 @item -mno-eflags
19849 @opindex mno-eflags
19850
19851 Do not mark ABI switches in e_flags.
19852
19853 @item -mcond-move
19854 @opindex mcond-move
19855
19856 Enable the use of conditional-move instructions (default).
19857
19858 This switch is mainly for debugging the compiler and will likely be removed
19859 in a future version.
19860
19861 @item -mno-cond-move
19862 @opindex mno-cond-move
19863
19864 Disable the use of conditional-move instructions.
19865
19866 This switch is mainly for debugging the compiler and will likely be removed
19867 in a future version.
19868
19869 @item -mscc
19870 @opindex mscc
19871
19872 Enable the use of conditional set instructions (default).
19873
19874 This switch is mainly for debugging the compiler and will likely be removed
19875 in a future version.
19876
19877 @item -mno-scc
19878 @opindex mno-scc
19879
19880 Disable the use of conditional set instructions.
19881
19882 This switch is mainly for debugging the compiler and will likely be removed
19883 in a future version.
19884
19885 @item -mcond-exec
19886 @opindex mcond-exec
19887
19888 Enable the use of conditional execution (default).
19889
19890 This switch is mainly for debugging the compiler and will likely be removed
19891 in a future version.
19892
19893 @item -mno-cond-exec
19894 @opindex mno-cond-exec
19895
19896 Disable the use of conditional execution.
19897
19898 This switch is mainly for debugging the compiler and will likely be removed
19899 in a future version.
19900
19901 @item -mvliw-branch
19902 @opindex mvliw-branch
19903
19904 Run a pass to pack branches into VLIW instructions (default).
19905
19906 This switch is mainly for debugging the compiler and will likely be removed
19907 in a future version.
19908
19909 @item -mno-vliw-branch
19910 @opindex mno-vliw-branch
19911
19912 Do not run a pass to pack branches into VLIW instructions.
19913
19914 This switch is mainly for debugging the compiler and will likely be removed
19915 in a future version.
19916
19917 @item -mmulti-cond-exec
19918 @opindex mmulti-cond-exec
19919
19920 Enable optimization of @code{&&} and @code{||} in conditional execution
19921 (default).
19922
19923 This switch is mainly for debugging the compiler and will likely be removed
19924 in a future version.
19925
19926 @item -mno-multi-cond-exec
19927 @opindex mno-multi-cond-exec
19928
19929 Disable optimization of @code{&&} and @code{||} in conditional execution.
19930
19931 This switch is mainly for debugging the compiler and will likely be removed
19932 in a future version.
19933
19934 @item -mnested-cond-exec
19935 @opindex mnested-cond-exec
19936
19937 Enable nested conditional execution optimizations (default).
19938
19939 This switch is mainly for debugging the compiler and will likely be removed
19940 in a future version.
19941
19942 @item -mno-nested-cond-exec
19943 @opindex mno-nested-cond-exec
19944
19945 Disable nested conditional execution optimizations.
19946
19947 This switch is mainly for debugging the compiler and will likely be removed
19948 in a future version.
19949
19950 @item -moptimize-membar
19951 @opindex moptimize-membar
19952
19953 This switch removes redundant @code{membar} instructions from the
19954 compiler-generated code. It is enabled by default.
19955
19956 @item -mno-optimize-membar
19957 @opindex mno-optimize-membar
19958 @opindex moptimize-membar
19959
19960 This switch disables the automatic removal of redundant @code{membar}
19961 instructions from the generated code.
19962
19963 @item -mtomcat-stats
19964 @opindex mtomcat-stats
19965
19966 Cause gas to print out tomcat statistics.
19967
19968 @item -mcpu=@var{cpu}
19969 @opindex mcpu
19970
19971 Select the processor type for which to generate code. Possible values are
19972 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19973 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19974
19975 @end table
19976
19977 @node GNU/Linux Options
19978 @subsection GNU/Linux Options
19979
19980 These @samp{-m} options are defined for GNU/Linux targets:
19981
19982 @table @gcctabopt
19983 @item -mglibc
19984 @opindex mglibc
19985 Use the GNU C library. This is the default except
19986 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19987 @samp{*-*-linux-*android*} targets.
19988
19989 @item -muclibc
19990 @opindex muclibc
19991 Use uClibc C library. This is the default on
19992 @samp{*-*-linux-*uclibc*} targets.
19993
19994 @item -mmusl
19995 @opindex mmusl
19996 Use the musl C library. This is the default on
19997 @samp{*-*-linux-*musl*} targets.
19998
19999 @item -mbionic
20000 @opindex mbionic
20001 Use Bionic C library. This is the default on
20002 @samp{*-*-linux-*android*} targets.
20003
20004 @item -mandroid
20005 @opindex mandroid
20006 Compile code compatible with Android platform. This is the default on
20007 @samp{*-*-linux-*android*} targets.
20008
20009 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20010 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20011 this option makes the GCC driver pass Android-specific options to the linker.
20012 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20013 to be defined.
20014
20015 @item -tno-android-cc
20016 @opindex tno-android-cc
20017 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20018 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20019 @option{-fno-rtti} by default.
20020
20021 @item -tno-android-ld
20022 @opindex tno-android-ld
20023 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20024 linking options to the linker.
20025
20026 @end table
20027
20028 @node H8/300 Options
20029 @subsection H8/300 Options
20030
20031 These @samp{-m} options are defined for the H8/300 implementations:
20032
20033 @table @gcctabopt
20034 @item -mrelax
20035 @opindex mrelax
20036 Shorten some address references at link time, when possible; uses the
20037 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20038 ld, Using ld}, for a fuller description.
20039
20040 @item -mh
20041 @opindex mh
20042 Generate code for the H8/300H@.
20043
20044 @item -ms
20045 @opindex ms
20046 Generate code for the H8S@.
20047
20048 @item -mn
20049 @opindex mn
20050 Generate code for the H8S and H8/300H in the normal mode. This switch
20051 must be used either with @option{-mh} or @option{-ms}.
20052
20053 @item -ms2600
20054 @opindex ms2600
20055 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20056
20057 @item -mexr
20058 @opindex mexr
20059 Extended registers are stored on stack before execution of function
20060 with monitor attribute. Default option is @option{-mexr}.
20061 This option is valid only for H8S targets.
20062
20063 @item -mno-exr
20064 @opindex mno-exr
20065 @opindex mexr
20066 Extended registers are not stored on stack before execution of function
20067 with monitor attribute. Default option is @option{-mno-exr}.
20068 This option is valid only for H8S targets.
20069
20070 @item -mint32
20071 @opindex mint32
20072 Make @code{int} data 32 bits by default.
20073
20074 @item -malign-300
20075 @opindex malign-300
20076 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20077 The default for the H8/300H and H8S is to align longs and floats on
20078 4-byte boundaries.
20079 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20080 This option has no effect on the H8/300.
20081 @end table
20082
20083 @node HPPA Options
20084 @subsection HPPA Options
20085 @cindex HPPA Options
20086
20087 These @samp{-m} options are defined for the HPPA family of computers:
20088
20089 @table @gcctabopt
20090 @item -march=@var{architecture-type}
20091 @opindex march
20092 Generate code for the specified architecture. The choices for
20093 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20094 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20095 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20096 architecture option for your machine. Code compiled for lower numbered
20097 architectures runs on higher numbered architectures, but not the
20098 other way around.
20099
20100 @item -mpa-risc-1-0
20101 @itemx -mpa-risc-1-1
20102 @itemx -mpa-risc-2-0
20103 @opindex mpa-risc-1-0
20104 @opindex mpa-risc-1-1
20105 @opindex mpa-risc-2-0
20106 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20107
20108 @item -mcaller-copies
20109 @opindex mcaller-copies
20110 The caller copies function arguments passed by hidden reference. This
20111 option should be used with care as it is not compatible with the default
20112 32-bit runtime. However, only aggregates larger than eight bytes are
20113 passed by hidden reference and the option provides better compatibility
20114 with OpenMP.
20115
20116 @item -mjump-in-delay
20117 @opindex mjump-in-delay
20118 This option is ignored and provided for compatibility purposes only.
20119
20120 @item -mdisable-fpregs
20121 @opindex mdisable-fpregs
20122 Prevent floating-point registers from being used in any manner. This is
20123 necessary for compiling kernels that perform lazy context switching of
20124 floating-point registers. If you use this option and attempt to perform
20125 floating-point operations, the compiler aborts.
20126
20127 @item -mdisable-indexing
20128 @opindex mdisable-indexing
20129 Prevent the compiler from using indexing address modes. This avoids some
20130 rather obscure problems when compiling MIG generated code under MACH@.
20131
20132 @item -mno-space-regs
20133 @opindex mno-space-regs
20134 @opindex mspace-regs
20135 Generate code that assumes the target has no space registers. This allows
20136 GCC to generate faster indirect calls and use unscaled index address modes.
20137
20138 Such code is suitable for level 0 PA systems and kernels.
20139
20140 @item -mfast-indirect-calls
20141 @opindex mfast-indirect-calls
20142 Generate code that assumes calls never cross space boundaries. This
20143 allows GCC to emit code that performs faster indirect calls.
20144
20145 This option does not work in the presence of shared libraries or nested
20146 functions.
20147
20148 @item -mfixed-range=@var{register-range}
20149 @opindex mfixed-range
20150 Generate code treating the given register range as fixed registers.
20151 A fixed register is one that the register allocator cannot use. This is
20152 useful when compiling kernel code. A register range is specified as
20153 two registers separated by a dash. Multiple register ranges can be
20154 specified separated by a comma.
20155
20156 @item -mlong-load-store
20157 @opindex mlong-load-store
20158 Generate 3-instruction load and store sequences as sometimes required by
20159 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20160 the HP compilers.
20161
20162 @item -mportable-runtime
20163 @opindex mportable-runtime
20164 Use the portable calling conventions proposed by HP for ELF systems.
20165
20166 @item -mgas
20167 @opindex mgas
20168 Enable the use of assembler directives only GAS understands.
20169
20170 @item -mschedule=@var{cpu-type}
20171 @opindex mschedule
20172 Schedule code according to the constraints for the machine type
20173 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20174 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20175 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20176 proper scheduling option for your machine. The default scheduling is
20177 @samp{8000}.
20178
20179 @item -mlinker-opt
20180 @opindex mlinker-opt
20181 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20182 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20183 linkers in which they give bogus error messages when linking some programs.
20184
20185 @item -msoft-float
20186 @opindex msoft-float
20187 Generate output containing library calls for floating point.
20188 @strong{Warning:} the requisite libraries are not available for all HPPA
20189 targets. Normally the facilities of the machine's usual C compiler are
20190 used, but this cannot be done directly in cross-compilation. You must make
20191 your own arrangements to provide suitable library functions for
20192 cross-compilation.
20193
20194 @option{-msoft-float} changes the calling convention in the output file;
20195 therefore, it is only useful if you compile @emph{all} of a program with
20196 this option. In particular, you need to compile @file{libgcc.a}, the
20197 library that comes with GCC, with @option{-msoft-float} in order for
20198 this to work.
20199
20200 @item -msio
20201 @opindex msio
20202 Generate the predefine, @code{_SIO}, for server IO@. The default is
20203 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20204 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20205 options are available under HP-UX and HI-UX@.
20206
20207 @item -mgnu-ld
20208 @opindex mgnu-ld
20209 Use options specific to GNU @command{ld}.
20210 This passes @option{-shared} to @command{ld} when
20211 building a shared library. It is the default when GCC is configured,
20212 explicitly or implicitly, with the GNU linker. This option does not
20213 affect which @command{ld} is called; it only changes what parameters
20214 are passed to that @command{ld}.
20215 The @command{ld} that is called is determined by the
20216 @option{--with-ld} configure option, GCC's program search path, and
20217 finally by the user's @env{PATH}. The linker used by GCC can be printed
20218 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20219 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20220
20221 @item -mhp-ld
20222 @opindex mhp-ld
20223 Use options specific to HP @command{ld}.
20224 This passes @option{-b} to @command{ld} when building
20225 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20226 links. It is the default when GCC is configured, explicitly or
20227 implicitly, with the HP linker. This option does not affect
20228 which @command{ld} is called; it only changes what parameters are passed to that
20229 @command{ld}.
20230 The @command{ld} that is called is determined by the @option{--with-ld}
20231 configure option, GCC's program search path, and finally by the user's
20232 @env{PATH}. The linker used by GCC can be printed using @samp{which
20233 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20234 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20235
20236 @item -mlong-calls
20237 @opindex mno-long-calls
20238 @opindex mlong-calls
20239 Generate code that uses long call sequences. This ensures that a call
20240 is always able to reach linker generated stubs. The default is to generate
20241 long calls only when the distance from the call site to the beginning
20242 of the function or translation unit, as the case may be, exceeds a
20243 predefined limit set by the branch type being used. The limits for
20244 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20245 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20246 240,000 bytes.
20247
20248 Distances are measured from the beginning of functions when using the
20249 @option{-ffunction-sections} option, or when using the @option{-mgas}
20250 and @option{-mno-portable-runtime} options together under HP-UX with
20251 the SOM linker.
20252
20253 It is normally not desirable to use this option as it degrades
20254 performance. However, it may be useful in large applications,
20255 particularly when partial linking is used to build the application.
20256
20257 The types of long calls used depends on the capabilities of the
20258 assembler and linker, and the type of code being generated. The
20259 impact on systems that support long absolute calls, and long pic
20260 symbol-difference or pc-relative calls should be relatively small.
20261 However, an indirect call is used on 32-bit ELF systems in pic code
20262 and it is quite long.
20263
20264 @item -munix=@var{unix-std}
20265 @opindex march
20266 Generate compiler predefines and select a startfile for the specified
20267 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20268 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20269 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20270 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20271 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20272 and later.
20273
20274 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20275 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20276 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20277 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20278 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20279 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20280
20281 It is @emph{important} to note that this option changes the interfaces
20282 for various library routines. It also affects the operational behavior
20283 of the C library. Thus, @emph{extreme} care is needed in using this
20284 option.
20285
20286 Library code that is intended to operate with more than one UNIX
20287 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20288 as appropriate. Most GNU software doesn't provide this capability.
20289
20290 @item -nolibdld
20291 @opindex nolibdld
20292 Suppress the generation of link options to search libdld.sl when the
20293 @option{-static} option is specified on HP-UX 10 and later.
20294
20295 @item -static
20296 @opindex static
20297 The HP-UX implementation of setlocale in libc has a dependency on
20298 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20299 when the @option{-static} option is specified, special link options
20300 are needed to resolve this dependency.
20301
20302 On HP-UX 10 and later, the GCC driver adds the necessary options to
20303 link with libdld.sl when the @option{-static} option is specified.
20304 This causes the resulting binary to be dynamic. On the 64-bit port,
20305 the linkers generate dynamic binaries by default in any case. The
20306 @option{-nolibdld} option can be used to prevent the GCC driver from
20307 adding these link options.
20308
20309 @item -threads
20310 @opindex threads
20311 Add support for multithreading with the @dfn{dce thread} library
20312 under HP-UX@. This option sets flags for both the preprocessor and
20313 linker.
20314 @end table
20315
20316 @node IA-64 Options
20317 @subsection IA-64 Options
20318 @cindex IA-64 Options
20319
20320 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20321
20322 @table @gcctabopt
20323 @item -mbig-endian
20324 @opindex mbig-endian
20325 Generate code for a big-endian target. This is the default for HP-UX@.
20326
20327 @item -mlittle-endian
20328 @opindex mlittle-endian
20329 Generate code for a little-endian target. This is the default for AIX5
20330 and GNU/Linux.
20331
20332 @item -mgnu-as
20333 @itemx -mno-gnu-as
20334 @opindex mgnu-as
20335 @opindex mno-gnu-as
20336 Generate (or don't) code for the GNU assembler. This is the default.
20337 @c Also, this is the default if the configure option @option{--with-gnu-as}
20338 @c is used.
20339
20340 @item -mgnu-ld
20341 @itemx -mno-gnu-ld
20342 @opindex mgnu-ld
20343 @opindex mno-gnu-ld
20344 Generate (or don't) code for the GNU linker. This is the default.
20345 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20346 @c is used.
20347
20348 @item -mno-pic
20349 @opindex mno-pic
20350 Generate code that does not use a global pointer register. The result
20351 is not position independent code, and violates the IA-64 ABI@.
20352
20353 @item -mvolatile-asm-stop
20354 @itemx -mno-volatile-asm-stop
20355 @opindex mvolatile-asm-stop
20356 @opindex mno-volatile-asm-stop
20357 Generate (or don't) a stop bit immediately before and after volatile asm
20358 statements.
20359
20360 @item -mregister-names
20361 @itemx -mno-register-names
20362 @opindex mregister-names
20363 @opindex mno-register-names
20364 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20365 the stacked registers. This may make assembler output more readable.
20366
20367 @item -mno-sdata
20368 @itemx -msdata
20369 @opindex mno-sdata
20370 @opindex msdata
20371 Disable (or enable) optimizations that use the small data section. This may
20372 be useful for working around optimizer bugs.
20373
20374 @item -mconstant-gp
20375 @opindex mconstant-gp
20376 Generate code that uses a single constant global pointer value. This is
20377 useful when compiling kernel code.
20378
20379 @item -mauto-pic
20380 @opindex mauto-pic
20381 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20382 This is useful when compiling firmware code.
20383
20384 @item -minline-float-divide-min-latency
20385 @opindex minline-float-divide-min-latency
20386 Generate code for inline divides of floating-point values
20387 using the minimum latency algorithm.
20388
20389 @item -minline-float-divide-max-throughput
20390 @opindex minline-float-divide-max-throughput
20391 Generate code for inline divides of floating-point values
20392 using the maximum throughput algorithm.
20393
20394 @item -mno-inline-float-divide
20395 @opindex mno-inline-float-divide
20396 Do not generate inline code for divides of floating-point values.
20397
20398 @item -minline-int-divide-min-latency
20399 @opindex minline-int-divide-min-latency
20400 Generate code for inline divides of integer values
20401 using the minimum latency algorithm.
20402
20403 @item -minline-int-divide-max-throughput
20404 @opindex minline-int-divide-max-throughput
20405 Generate code for inline divides of integer values
20406 using the maximum throughput algorithm.
20407
20408 @item -mno-inline-int-divide
20409 @opindex mno-inline-int-divide
20410 @opindex minline-int-divide
20411 Do not generate inline code for divides of integer values.
20412
20413 @item -minline-sqrt-min-latency
20414 @opindex minline-sqrt-min-latency
20415 Generate code for inline square roots
20416 using the minimum latency algorithm.
20417
20418 @item -minline-sqrt-max-throughput
20419 @opindex minline-sqrt-max-throughput
20420 Generate code for inline square roots
20421 using the maximum throughput algorithm.
20422
20423 @item -mno-inline-sqrt
20424 @opindex mno-inline-sqrt
20425 Do not generate inline code for @code{sqrt}.
20426
20427 @item -mfused-madd
20428 @itemx -mno-fused-madd
20429 @opindex mfused-madd
20430 @opindex mno-fused-madd
20431 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20432 instructions. The default is to use these instructions.
20433
20434 @item -mno-dwarf2-asm
20435 @itemx -mdwarf2-asm
20436 @opindex mno-dwarf2-asm
20437 @opindex mdwarf2-asm
20438 Don't (or do) generate assembler code for the DWARF line number debugging
20439 info. This may be useful when not using the GNU assembler.
20440
20441 @item -mearly-stop-bits
20442 @itemx -mno-early-stop-bits
20443 @opindex mearly-stop-bits
20444 @opindex mno-early-stop-bits
20445 Allow stop bits to be placed earlier than immediately preceding the
20446 instruction that triggered the stop bit. This can improve instruction
20447 scheduling, but does not always do so.
20448
20449 @item -mfixed-range=@var{register-range}
20450 @opindex mfixed-range
20451 Generate code treating the given register range as fixed registers.
20452 A fixed register is one that the register allocator cannot use. This is
20453 useful when compiling kernel code. A register range is specified as
20454 two registers separated by a dash. Multiple register ranges can be
20455 specified separated by a comma.
20456
20457 @item -mtls-size=@var{tls-size}
20458 @opindex mtls-size
20459 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20460 64.
20461
20462 @item -mtune=@var{cpu-type}
20463 @opindex mtune
20464 Tune the instruction scheduling for a particular CPU, Valid values are
20465 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20466 and @samp{mckinley}.
20467
20468 @item -milp32
20469 @itemx -mlp64
20470 @opindex milp32
20471 @opindex mlp64
20472 Generate code for a 32-bit or 64-bit environment.
20473 The 32-bit environment sets int, long and pointer to 32 bits.
20474 The 64-bit environment sets int to 32 bits and long and pointer
20475 to 64 bits. These are HP-UX specific flags.
20476
20477 @item -mno-sched-br-data-spec
20478 @itemx -msched-br-data-spec
20479 @opindex mno-sched-br-data-spec
20480 @opindex msched-br-data-spec
20481 (Dis/En)able data speculative scheduling before reload.
20482 This results in generation of @code{ld.a} instructions and
20483 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20484 The default setting is disabled.
20485
20486 @item -msched-ar-data-spec
20487 @itemx -mno-sched-ar-data-spec
20488 @opindex msched-ar-data-spec
20489 @opindex mno-sched-ar-data-spec
20490 (En/Dis)able data speculative scheduling after reload.
20491 This results in generation of @code{ld.a} instructions and
20492 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20493 The default setting is enabled.
20494
20495 @item -mno-sched-control-spec
20496 @itemx -msched-control-spec
20497 @opindex mno-sched-control-spec
20498 @opindex msched-control-spec
20499 (Dis/En)able control speculative scheduling. This feature is
20500 available only during region scheduling (i.e.@: before reload).
20501 This results in generation of the @code{ld.s} instructions and
20502 the corresponding check instructions @code{chk.s}.
20503 The default setting is disabled.
20504
20505 @item -msched-br-in-data-spec
20506 @itemx -mno-sched-br-in-data-spec
20507 @opindex msched-br-in-data-spec
20508 @opindex mno-sched-br-in-data-spec
20509 (En/Dis)able speculative scheduling of the instructions that
20510 are dependent on the data speculative loads before reload.
20511 This is effective only with @option{-msched-br-data-spec} enabled.
20512 The default setting is enabled.
20513
20514 @item -msched-ar-in-data-spec
20515 @itemx -mno-sched-ar-in-data-spec
20516 @opindex msched-ar-in-data-spec
20517 @opindex mno-sched-ar-in-data-spec
20518 (En/Dis)able speculative scheduling of the instructions that
20519 are dependent on the data speculative loads after reload.
20520 This is effective only with @option{-msched-ar-data-spec} enabled.
20521 The default setting is enabled.
20522
20523 @item -msched-in-control-spec
20524 @itemx -mno-sched-in-control-spec
20525 @opindex msched-in-control-spec
20526 @opindex mno-sched-in-control-spec
20527 (En/Dis)able speculative scheduling of the instructions that
20528 are dependent on the control speculative loads.
20529 This is effective only with @option{-msched-control-spec} enabled.
20530 The default setting is enabled.
20531
20532 @item -mno-sched-prefer-non-data-spec-insns
20533 @itemx -msched-prefer-non-data-spec-insns
20534 @opindex mno-sched-prefer-non-data-spec-insns
20535 @opindex msched-prefer-non-data-spec-insns
20536 If enabled, data-speculative instructions are chosen for schedule
20537 only if there are no other choices at the moment. This makes
20538 the use of the data speculation much more conservative.
20539 The default setting is disabled.
20540
20541 @item -mno-sched-prefer-non-control-spec-insns
20542 @itemx -msched-prefer-non-control-spec-insns
20543 @opindex mno-sched-prefer-non-control-spec-insns
20544 @opindex msched-prefer-non-control-spec-insns
20545 If enabled, control-speculative instructions are chosen for schedule
20546 only if there are no other choices at the moment. This makes
20547 the use of the control speculation much more conservative.
20548 The default setting is disabled.
20549
20550 @item -mno-sched-count-spec-in-critical-path
20551 @itemx -msched-count-spec-in-critical-path
20552 @opindex mno-sched-count-spec-in-critical-path
20553 @opindex msched-count-spec-in-critical-path
20554 If enabled, speculative dependencies are considered during
20555 computation of the instructions priorities. This makes the use of the
20556 speculation a bit more conservative.
20557 The default setting is disabled.
20558
20559 @item -msched-spec-ldc
20560 @opindex msched-spec-ldc
20561 Use a simple data speculation check. This option is on by default.
20562
20563 @item -msched-control-spec-ldc
20564 @opindex msched-spec-ldc
20565 Use a simple check for control speculation. This option is on by default.
20566
20567 @item -msched-stop-bits-after-every-cycle
20568 @opindex msched-stop-bits-after-every-cycle
20569 Place a stop bit after every cycle when scheduling. This option is on
20570 by default.
20571
20572 @item -msched-fp-mem-deps-zero-cost
20573 @opindex msched-fp-mem-deps-zero-cost
20574 Assume that floating-point stores and loads are not likely to cause a conflict
20575 when placed into the same instruction group. This option is disabled by
20576 default.
20577
20578 @item -msel-sched-dont-check-control-spec
20579 @opindex msel-sched-dont-check-control-spec
20580 Generate checks for control speculation in selective scheduling.
20581 This flag is disabled by default.
20582
20583 @item -msched-max-memory-insns=@var{max-insns}
20584 @opindex msched-max-memory-insns
20585 Limit on the number of memory insns per instruction group, giving lower
20586 priority to subsequent memory insns attempting to schedule in the same
20587 instruction group. Frequently useful to prevent cache bank conflicts.
20588 The default value is 1.
20589
20590 @item -msched-max-memory-insns-hard-limit
20591 @opindex msched-max-memory-insns-hard-limit
20592 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20593 disallowing more than that number in an instruction group.
20594 Otherwise, the limit is ``soft'', meaning that non-memory operations
20595 are preferred when the limit is reached, but memory operations may still
20596 be scheduled.
20597
20598 @end table
20599
20600 @node LM32 Options
20601 @subsection LM32 Options
20602 @cindex LM32 options
20603
20604 These @option{-m} options are defined for the LatticeMico32 architecture:
20605
20606 @table @gcctabopt
20607 @item -mbarrel-shift-enabled
20608 @opindex mbarrel-shift-enabled
20609 Enable barrel-shift instructions.
20610
20611 @item -mdivide-enabled
20612 @opindex mdivide-enabled
20613 Enable divide and modulus instructions.
20614
20615 @item -mmultiply-enabled
20616 @opindex multiply-enabled
20617 Enable multiply instructions.
20618
20619 @item -msign-extend-enabled
20620 @opindex msign-extend-enabled
20621 Enable sign extend instructions.
20622
20623 @item -muser-enabled
20624 @opindex muser-enabled
20625 Enable user-defined instructions.
20626
20627 @end table
20628
20629 @node M32C Options
20630 @subsection M32C Options
20631 @cindex M32C options
20632
20633 @table @gcctabopt
20634 @item -mcpu=@var{name}
20635 @opindex mcpu=
20636 Select the CPU for which code is generated. @var{name} may be one of
20637 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20638 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20639 the M32C/80 series.
20640
20641 @item -msim
20642 @opindex msim
20643 Specifies that the program will be run on the simulator. This causes
20644 an alternate runtime library to be linked in which supports, for
20645 example, file I/O@. You must not use this option when generating
20646 programs that will run on real hardware; you must provide your own
20647 runtime library for whatever I/O functions are needed.
20648
20649 @item -memregs=@var{number}
20650 @opindex memregs=
20651 Specifies the number of memory-based pseudo-registers GCC uses
20652 during code generation. These pseudo-registers are used like real
20653 registers, so there is a tradeoff between GCC's ability to fit the
20654 code into available registers, and the performance penalty of using
20655 memory instead of registers. Note that all modules in a program must
20656 be compiled with the same value for this option. Because of that, you
20657 must not use this option with GCC's default runtime libraries.
20658
20659 @end table
20660
20661 @node M32R/D Options
20662 @subsection M32R/D Options
20663 @cindex M32R/D options
20664
20665 These @option{-m} options are defined for Renesas M32R/D architectures:
20666
20667 @table @gcctabopt
20668 @item -m32r2
20669 @opindex m32r2
20670 Generate code for the M32R/2@.
20671
20672 @item -m32rx
20673 @opindex m32rx
20674 Generate code for the M32R/X@.
20675
20676 @item -m32r
20677 @opindex m32r
20678 Generate code for the M32R@. This is the default.
20679
20680 @item -mmodel=small
20681 @opindex mmodel=small
20682 Assume all objects live in the lower 16MB of memory (so that their addresses
20683 can be loaded with the @code{ld24} instruction), and assume all subroutines
20684 are reachable with the @code{bl} instruction.
20685 This is the default.
20686
20687 The addressability of a particular object can be set with the
20688 @code{model} attribute.
20689
20690 @item -mmodel=medium
20691 @opindex mmodel=medium
20692 Assume objects may be anywhere in the 32-bit address space (the compiler
20693 generates @code{seth/add3} instructions to load their addresses), and
20694 assume all subroutines are reachable with the @code{bl} instruction.
20695
20696 @item -mmodel=large
20697 @opindex mmodel=large
20698 Assume objects may be anywhere in the 32-bit address space (the compiler
20699 generates @code{seth/add3} instructions to load their addresses), and
20700 assume subroutines may not be reachable with the @code{bl} instruction
20701 (the compiler generates the much slower @code{seth/add3/jl}
20702 instruction sequence).
20703
20704 @item -msdata=none
20705 @opindex msdata=none
20706 Disable use of the small data area. Variables are put into
20707 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20708 @code{section} attribute has been specified).
20709 This is the default.
20710
20711 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20712 Objects may be explicitly put in the small data area with the
20713 @code{section} attribute using one of these sections.
20714
20715 @item -msdata=sdata
20716 @opindex msdata=sdata
20717 Put small global and static data in the small data area, but do not
20718 generate special code to reference them.
20719
20720 @item -msdata=use
20721 @opindex msdata=use
20722 Put small global and static data in the small data area, and generate
20723 special instructions to reference them.
20724
20725 @item -G @var{num}
20726 @opindex G
20727 @cindex smaller data references
20728 Put global and static objects less than or equal to @var{num} bytes
20729 into the small data or BSS sections instead of the normal data or BSS
20730 sections. The default value of @var{num} is 8.
20731 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20732 for this option to have any effect.
20733
20734 All modules should be compiled with the same @option{-G @var{num}} value.
20735 Compiling with different values of @var{num} may or may not work; if it
20736 doesn't the linker gives an error message---incorrect code is not
20737 generated.
20738
20739 @item -mdebug
20740 @opindex mdebug
20741 Makes the M32R-specific code in the compiler display some statistics
20742 that might help in debugging programs.
20743
20744 @item -malign-loops
20745 @opindex malign-loops
20746 Align all loops to a 32-byte boundary.
20747
20748 @item -mno-align-loops
20749 @opindex mno-align-loops
20750 Do not enforce a 32-byte alignment for loops. This is the default.
20751
20752 @item -missue-rate=@var{number}
20753 @opindex missue-rate=@var{number}
20754 Issue @var{number} instructions per cycle. @var{number} can only be 1
20755 or 2.
20756
20757 @item -mbranch-cost=@var{number}
20758 @opindex mbranch-cost=@var{number}
20759 @var{number} can only be 1 or 2. If it is 1 then branches are
20760 preferred over conditional code, if it is 2, then the opposite applies.
20761
20762 @item -mflush-trap=@var{number}
20763 @opindex mflush-trap=@var{number}
20764 Specifies the trap number to use to flush the cache. The default is
20765 12. Valid numbers are between 0 and 15 inclusive.
20766
20767 @item -mno-flush-trap
20768 @opindex mno-flush-trap
20769 Specifies that the cache cannot be flushed by using a trap.
20770
20771 @item -mflush-func=@var{name}
20772 @opindex mflush-func=@var{name}
20773 Specifies the name of the operating system function to call to flush
20774 the cache. The default is @samp{_flush_cache}, but a function call
20775 is only used if a trap is not available.
20776
20777 @item -mno-flush-func
20778 @opindex mno-flush-func
20779 Indicates that there is no OS function for flushing the cache.
20780
20781 @end table
20782
20783 @node M680x0 Options
20784 @subsection M680x0 Options
20785 @cindex M680x0 options
20786
20787 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20788 The default settings depend on which architecture was selected when
20789 the compiler was configured; the defaults for the most common choices
20790 are given below.
20791
20792 @table @gcctabopt
20793 @item -march=@var{arch}
20794 @opindex march
20795 Generate code for a specific M680x0 or ColdFire instruction set
20796 architecture. Permissible values of @var{arch} for M680x0
20797 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20798 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20799 architectures are selected according to Freescale's ISA classification
20800 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20801 @samp{isab} and @samp{isac}.
20802
20803 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20804 code for a ColdFire target. The @var{arch} in this macro is one of the
20805 @option{-march} arguments given above.
20806
20807 When used together, @option{-march} and @option{-mtune} select code
20808 that runs on a family of similar processors but that is optimized
20809 for a particular microarchitecture.
20810
20811 @item -mcpu=@var{cpu}
20812 @opindex mcpu
20813 Generate code for a specific M680x0 or ColdFire processor.
20814 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20815 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20816 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20817 below, which also classifies the CPUs into families:
20818
20819 @multitable @columnfractions 0.20 0.80
20820 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20821 @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}
20822 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20823 @item @samp{5206e} @tab @samp{5206e}
20824 @item @samp{5208} @tab @samp{5207} @samp{5208}
20825 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20826 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20827 @item @samp{5216} @tab @samp{5214} @samp{5216}
20828 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20829 @item @samp{5225} @tab @samp{5224} @samp{5225}
20830 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20831 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20832 @item @samp{5249} @tab @samp{5249}
20833 @item @samp{5250} @tab @samp{5250}
20834 @item @samp{5271} @tab @samp{5270} @samp{5271}
20835 @item @samp{5272} @tab @samp{5272}
20836 @item @samp{5275} @tab @samp{5274} @samp{5275}
20837 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20838 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20839 @item @samp{5307} @tab @samp{5307}
20840 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20841 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20842 @item @samp{5407} @tab @samp{5407}
20843 @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}
20844 @end multitable
20845
20846 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20847 @var{arch} is compatible with @var{cpu}. Other combinations of
20848 @option{-mcpu} and @option{-march} are rejected.
20849
20850 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20851 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20852 where the value of @var{family} is given by the table above.
20853
20854 @item -mtune=@var{tune}
20855 @opindex mtune
20856 Tune the code for a particular microarchitecture within the
20857 constraints set by @option{-march} and @option{-mcpu}.
20858 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20859 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20860 and @samp{cpu32}. The ColdFire microarchitectures
20861 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20862
20863 You can also use @option{-mtune=68020-40} for code that needs
20864 to run relatively well on 68020, 68030 and 68040 targets.
20865 @option{-mtune=68020-60} is similar but includes 68060 targets
20866 as well. These two options select the same tuning decisions as
20867 @option{-m68020-40} and @option{-m68020-60} respectively.
20868
20869 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20870 when tuning for 680x0 architecture @var{arch}. It also defines
20871 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20872 option is used. If GCC is tuning for a range of architectures,
20873 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20874 it defines the macros for every architecture in the range.
20875
20876 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20877 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20878 of the arguments given above.
20879
20880 @item -m68000
20881 @itemx -mc68000
20882 @opindex m68000
20883 @opindex mc68000
20884 Generate output for a 68000. This is the default
20885 when the compiler is configured for 68000-based systems.
20886 It is equivalent to @option{-march=68000}.
20887
20888 Use this option for microcontrollers with a 68000 or EC000 core,
20889 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20890
20891 @item -m68010
20892 @opindex m68010
20893 Generate output for a 68010. This is the default
20894 when the compiler is configured for 68010-based systems.
20895 It is equivalent to @option{-march=68010}.
20896
20897 @item -m68020
20898 @itemx -mc68020
20899 @opindex m68020
20900 @opindex mc68020
20901 Generate output for a 68020. This is the default
20902 when the compiler is configured for 68020-based systems.
20903 It is equivalent to @option{-march=68020}.
20904
20905 @item -m68030
20906 @opindex m68030
20907 Generate output for a 68030. This is the default when the compiler is
20908 configured for 68030-based systems. It is equivalent to
20909 @option{-march=68030}.
20910
20911 @item -m68040
20912 @opindex m68040
20913 Generate output for a 68040. This is the default when the compiler is
20914 configured for 68040-based systems. It is equivalent to
20915 @option{-march=68040}.
20916
20917 This option inhibits the use of 68881/68882 instructions that have to be
20918 emulated by software on the 68040. Use this option if your 68040 does not
20919 have code to emulate those instructions.
20920
20921 @item -m68060
20922 @opindex m68060
20923 Generate output for a 68060. This is the default when the compiler is
20924 configured for 68060-based systems. It is equivalent to
20925 @option{-march=68060}.
20926
20927 This option inhibits the use of 68020 and 68881/68882 instructions that
20928 have to be emulated by software on the 68060. Use this option if your 68060
20929 does not have code to emulate those instructions.
20930
20931 @item -mcpu32
20932 @opindex mcpu32
20933 Generate output for a CPU32. This is the default
20934 when the compiler is configured for CPU32-based systems.
20935 It is equivalent to @option{-march=cpu32}.
20936
20937 Use this option for microcontrollers with a
20938 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20939 68336, 68340, 68341, 68349 and 68360.
20940
20941 @item -m5200
20942 @opindex m5200
20943 Generate output for a 520X ColdFire CPU@. This is the default
20944 when the compiler is configured for 520X-based systems.
20945 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20946 in favor of that option.
20947
20948 Use this option for microcontroller with a 5200 core, including
20949 the MCF5202, MCF5203, MCF5204 and MCF5206.
20950
20951 @item -m5206e
20952 @opindex m5206e
20953 Generate output for a 5206e ColdFire CPU@. The option is now
20954 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20955
20956 @item -m528x
20957 @opindex m528x
20958 Generate output for a member of the ColdFire 528X family.
20959 The option is now deprecated in favor of the equivalent
20960 @option{-mcpu=528x}.
20961
20962 @item -m5307
20963 @opindex m5307
20964 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20965 in favor of the equivalent @option{-mcpu=5307}.
20966
20967 @item -m5407
20968 @opindex m5407
20969 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20970 in favor of the equivalent @option{-mcpu=5407}.
20971
20972 @item -mcfv4e
20973 @opindex mcfv4e
20974 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20975 This includes use of hardware floating-point instructions.
20976 The option is equivalent to @option{-mcpu=547x}, and is now
20977 deprecated in favor of that option.
20978
20979 @item -m68020-40
20980 @opindex m68020-40
20981 Generate output for a 68040, without using any of the new instructions.
20982 This results in code that can run relatively efficiently on either a
20983 68020/68881 or a 68030 or a 68040. The generated code does use the
20984 68881 instructions that are emulated on the 68040.
20985
20986 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20987
20988 @item -m68020-60
20989 @opindex m68020-60
20990 Generate output for a 68060, without using any of the new instructions.
20991 This results in code that can run relatively efficiently on either a
20992 68020/68881 or a 68030 or a 68040. The generated code does use the
20993 68881 instructions that are emulated on the 68060.
20994
20995 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20996
20997 @item -mhard-float
20998 @itemx -m68881
20999 @opindex mhard-float
21000 @opindex m68881
21001 Generate floating-point instructions. This is the default for 68020
21002 and above, and for ColdFire devices that have an FPU@. It defines the
21003 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21004 on ColdFire targets.
21005
21006 @item -msoft-float
21007 @opindex msoft-float
21008 Do not generate floating-point instructions; use library calls instead.
21009 This is the default for 68000, 68010, and 68832 targets. It is also
21010 the default for ColdFire devices that have no FPU.
21011
21012 @item -mdiv
21013 @itemx -mno-div
21014 @opindex mdiv
21015 @opindex mno-div
21016 Generate (do not generate) ColdFire hardware divide and remainder
21017 instructions. If @option{-march} is used without @option{-mcpu},
21018 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21019 architectures. Otherwise, the default is taken from the target CPU
21020 (either the default CPU, or the one specified by @option{-mcpu}). For
21021 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21022 @option{-mcpu=5206e}.
21023
21024 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21025
21026 @item -mshort
21027 @opindex mshort
21028 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21029 Additionally, parameters passed on the stack are also aligned to a
21030 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21031
21032 @item -mno-short
21033 @opindex mno-short
21034 Do not consider type @code{int} to be 16 bits wide. This is the default.
21035
21036 @item -mnobitfield
21037 @itemx -mno-bitfield
21038 @opindex mnobitfield
21039 @opindex mno-bitfield
21040 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21041 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21042
21043 @item -mbitfield
21044 @opindex mbitfield
21045 Do use the bit-field instructions. The @option{-m68020} option implies
21046 @option{-mbitfield}. This is the default if you use a configuration
21047 designed for a 68020.
21048
21049 @item -mrtd
21050 @opindex mrtd
21051 Use a different function-calling convention, in which functions
21052 that take a fixed number of arguments return with the @code{rtd}
21053 instruction, which pops their arguments while returning. This
21054 saves one instruction in the caller since there is no need to pop
21055 the arguments there.
21056
21057 This calling convention is incompatible with the one normally
21058 used on Unix, so you cannot use it if you need to call libraries
21059 compiled with the Unix compiler.
21060
21061 Also, you must provide function prototypes for all functions that
21062 take variable numbers of arguments (including @code{printf});
21063 otherwise incorrect code is generated for calls to those
21064 functions.
21065
21066 In addition, seriously incorrect code results if you call a
21067 function with too many arguments. (Normally, extra arguments are
21068 harmlessly ignored.)
21069
21070 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21071 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21072
21073 The default is @option{-mno-rtd}.
21074
21075 @item -malign-int
21076 @itemx -mno-align-int
21077 @opindex malign-int
21078 @opindex mno-align-int
21079 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21080 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21081 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21082 Aligning variables on 32-bit boundaries produces code that runs somewhat
21083 faster on processors with 32-bit busses at the expense of more memory.
21084
21085 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21086 aligns structures containing the above types differently than
21087 most published application binary interface specifications for the m68k.
21088
21089 @item -mpcrel
21090 @opindex mpcrel
21091 Use the pc-relative addressing mode of the 68000 directly, instead of
21092 using a global offset table. At present, this option implies @option{-fpic},
21093 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21094 not presently supported with @option{-mpcrel}, though this could be supported for
21095 68020 and higher processors.
21096
21097 @item -mno-strict-align
21098 @itemx -mstrict-align
21099 @opindex mno-strict-align
21100 @opindex mstrict-align
21101 Do not (do) assume that unaligned memory references are handled by
21102 the system.
21103
21104 @item -msep-data
21105 Generate code that allows the data segment to be located in a different
21106 area of memory from the text segment. This allows for execute-in-place in
21107 an environment without virtual memory management. This option implies
21108 @option{-fPIC}.
21109
21110 @item -mno-sep-data
21111 Generate code that assumes that the data segment follows the text segment.
21112 This is the default.
21113
21114 @item -mid-shared-library
21115 Generate code that supports shared libraries via the library ID method.
21116 This allows for execute-in-place and shared libraries in an environment
21117 without virtual memory management. This option implies @option{-fPIC}.
21118
21119 @item -mno-id-shared-library
21120 Generate code that doesn't assume ID-based shared libraries are being used.
21121 This is the default.
21122
21123 @item -mshared-library-id=n
21124 Specifies the identification number of the ID-based shared library being
21125 compiled. Specifying a value of 0 generates more compact code; specifying
21126 other values forces the allocation of that number to the current
21127 library, but is no more space- or time-efficient than omitting this option.
21128
21129 @item -mxgot
21130 @itemx -mno-xgot
21131 @opindex mxgot
21132 @opindex mno-xgot
21133 When generating position-independent code for ColdFire, generate code
21134 that works if the GOT has more than 8192 entries. This code is
21135 larger and slower than code generated without this option. On M680x0
21136 processors, this option is not needed; @option{-fPIC} suffices.
21137
21138 GCC normally uses a single instruction to load values from the GOT@.
21139 While this is relatively efficient, it only works if the GOT
21140 is smaller than about 64k. Anything larger causes the linker
21141 to report an error such as:
21142
21143 @cindex relocation truncated to fit (ColdFire)
21144 @smallexample
21145 relocation truncated to fit: R_68K_GOT16O foobar
21146 @end smallexample
21147
21148 If this happens, you should recompile your code with @option{-mxgot}.
21149 It should then work with very large GOTs. However, code generated with
21150 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21151 the value of a global symbol.
21152
21153 Note that some linkers, including newer versions of the GNU linker,
21154 can create multiple GOTs and sort GOT entries. If you have such a linker,
21155 you should only need to use @option{-mxgot} when compiling a single
21156 object file that accesses more than 8192 GOT entries. Very few do.
21157
21158 These options have no effect unless GCC is generating
21159 position-independent code.
21160
21161 @item -mlong-jump-table-offsets
21162 @opindex mlong-jump-table-offsets
21163 Use 32-bit offsets in @code{switch} tables. The default is to use
21164 16-bit offsets.
21165
21166 @end table
21167
21168 @node MCore Options
21169 @subsection MCore Options
21170 @cindex MCore options
21171
21172 These are the @samp{-m} options defined for the Motorola M*Core
21173 processors.
21174
21175 @table @gcctabopt
21176
21177 @item -mhardlit
21178 @itemx -mno-hardlit
21179 @opindex mhardlit
21180 @opindex mno-hardlit
21181 Inline constants into the code stream if it can be done in two
21182 instructions or less.
21183
21184 @item -mdiv
21185 @itemx -mno-div
21186 @opindex mdiv
21187 @opindex mno-div
21188 Use the divide instruction. (Enabled by default).
21189
21190 @item -mrelax-immediate
21191 @itemx -mno-relax-immediate
21192 @opindex mrelax-immediate
21193 @opindex mno-relax-immediate
21194 Allow arbitrary-sized immediates in bit operations.
21195
21196 @item -mwide-bitfields
21197 @itemx -mno-wide-bitfields
21198 @opindex mwide-bitfields
21199 @opindex mno-wide-bitfields
21200 Always treat bit-fields as @code{int}-sized.
21201
21202 @item -m4byte-functions
21203 @itemx -mno-4byte-functions
21204 @opindex m4byte-functions
21205 @opindex mno-4byte-functions
21206 Force all functions to be aligned to a 4-byte boundary.
21207
21208 @item -mcallgraph-data
21209 @itemx -mno-callgraph-data
21210 @opindex mcallgraph-data
21211 @opindex mno-callgraph-data
21212 Emit callgraph information.
21213
21214 @item -mslow-bytes
21215 @itemx -mno-slow-bytes
21216 @opindex mslow-bytes
21217 @opindex mno-slow-bytes
21218 Prefer word access when reading byte quantities.
21219
21220 @item -mlittle-endian
21221 @itemx -mbig-endian
21222 @opindex mlittle-endian
21223 @opindex mbig-endian
21224 Generate code for a little-endian target.
21225
21226 @item -m210
21227 @itemx -m340
21228 @opindex m210
21229 @opindex m340
21230 Generate code for the 210 processor.
21231
21232 @item -mno-lsim
21233 @opindex mno-lsim
21234 Assume that runtime support has been provided and so omit the
21235 simulator library (@file{libsim.a)} from the linker command line.
21236
21237 @item -mstack-increment=@var{size}
21238 @opindex mstack-increment
21239 Set the maximum amount for a single stack increment operation. Large
21240 values can increase the speed of programs that contain functions
21241 that need a large amount of stack space, but they can also trigger a
21242 segmentation fault if the stack is extended too much. The default
21243 value is 0x1000.
21244
21245 @end table
21246
21247 @node MeP Options
21248 @subsection MeP Options
21249 @cindex MeP options
21250
21251 @table @gcctabopt
21252
21253 @item -mabsdiff
21254 @opindex mabsdiff
21255 Enables the @code{abs} instruction, which is the absolute difference
21256 between two registers.
21257
21258 @item -mall-opts
21259 @opindex mall-opts
21260 Enables all the optional instructions---average, multiply, divide, bit
21261 operations, leading zero, absolute difference, min/max, clip, and
21262 saturation.
21263
21264
21265 @item -maverage
21266 @opindex maverage
21267 Enables the @code{ave} instruction, which computes the average of two
21268 registers.
21269
21270 @item -mbased=@var{n}
21271 @opindex mbased=
21272 Variables of size @var{n} bytes or smaller are placed in the
21273 @code{.based} section by default. Based variables use the @code{$tp}
21274 register as a base register, and there is a 128-byte limit to the
21275 @code{.based} section.
21276
21277 @item -mbitops
21278 @opindex mbitops
21279 Enables the bit operation instructions---bit test (@code{btstm}), set
21280 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21281 test-and-set (@code{tas}).
21282
21283 @item -mc=@var{name}
21284 @opindex mc=
21285 Selects which section constant data is placed in. @var{name} may
21286 be @samp{tiny}, @samp{near}, or @samp{far}.
21287
21288 @item -mclip
21289 @opindex mclip
21290 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21291 useful unless you also provide @option{-mminmax}.
21292
21293 @item -mconfig=@var{name}
21294 @opindex mconfig=
21295 Selects one of the built-in core configurations. Each MeP chip has
21296 one or more modules in it; each module has a core CPU and a variety of
21297 coprocessors, optional instructions, and peripherals. The
21298 @code{MeP-Integrator} tool, not part of GCC, provides these
21299 configurations through this option; using this option is the same as
21300 using all the corresponding command-line options. The default
21301 configuration is @samp{default}.
21302
21303 @item -mcop
21304 @opindex mcop
21305 Enables the coprocessor instructions. By default, this is a 32-bit
21306 coprocessor. Note that the coprocessor is normally enabled via the
21307 @option{-mconfig=} option.
21308
21309 @item -mcop32
21310 @opindex mcop32
21311 Enables the 32-bit coprocessor's instructions.
21312
21313 @item -mcop64
21314 @opindex mcop64
21315 Enables the 64-bit coprocessor's instructions.
21316
21317 @item -mivc2
21318 @opindex mivc2
21319 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21320
21321 @item -mdc
21322 @opindex mdc
21323 Causes constant variables to be placed in the @code{.near} section.
21324
21325 @item -mdiv
21326 @opindex mdiv
21327 Enables the @code{div} and @code{divu} instructions.
21328
21329 @item -meb
21330 @opindex meb
21331 Generate big-endian code.
21332
21333 @item -mel
21334 @opindex mel
21335 Generate little-endian code.
21336
21337 @item -mio-volatile
21338 @opindex mio-volatile
21339 Tells the compiler that any variable marked with the @code{io}
21340 attribute is to be considered volatile.
21341
21342 @item -ml
21343 @opindex ml
21344 Causes variables to be assigned to the @code{.far} section by default.
21345
21346 @item -mleadz
21347 @opindex mleadz
21348 Enables the @code{leadz} (leading zero) instruction.
21349
21350 @item -mm
21351 @opindex mm
21352 Causes variables to be assigned to the @code{.near} section by default.
21353
21354 @item -mminmax
21355 @opindex mminmax
21356 Enables the @code{min} and @code{max} instructions.
21357
21358 @item -mmult
21359 @opindex mmult
21360 Enables the multiplication and multiply-accumulate instructions.
21361
21362 @item -mno-opts
21363 @opindex mno-opts
21364 Disables all the optional instructions enabled by @option{-mall-opts}.
21365
21366 @item -mrepeat
21367 @opindex mrepeat
21368 Enables the @code{repeat} and @code{erepeat} instructions, used for
21369 low-overhead looping.
21370
21371 @item -ms
21372 @opindex ms
21373 Causes all variables to default to the @code{.tiny} section. Note
21374 that there is a 65536-byte limit to this section. Accesses to these
21375 variables use the @code{%gp} base register.
21376
21377 @item -msatur
21378 @opindex msatur
21379 Enables the saturation instructions. Note that the compiler does not
21380 currently generate these itself, but this option is included for
21381 compatibility with other tools, like @code{as}.
21382
21383 @item -msdram
21384 @opindex msdram
21385 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21386
21387 @item -msim
21388 @opindex msim
21389 Link the simulator run-time libraries.
21390
21391 @item -msimnovec
21392 @opindex msimnovec
21393 Link the simulator runtime libraries, excluding built-in support
21394 for reset and exception vectors and tables.
21395
21396 @item -mtf
21397 @opindex mtf
21398 Causes all functions to default to the @code{.far} section. Without
21399 this option, functions default to the @code{.near} section.
21400
21401 @item -mtiny=@var{n}
21402 @opindex mtiny=
21403 Variables that are @var{n} bytes or smaller are allocated to the
21404 @code{.tiny} section. These variables use the @code{$gp} base
21405 register. The default for this option is 4, but note that there's a
21406 65536-byte limit to the @code{.tiny} section.
21407
21408 @end table
21409
21410 @node MicroBlaze Options
21411 @subsection MicroBlaze Options
21412 @cindex MicroBlaze Options
21413
21414 @table @gcctabopt
21415
21416 @item -msoft-float
21417 @opindex msoft-float
21418 Use software emulation for floating point (default).
21419
21420 @item -mhard-float
21421 @opindex mhard-float
21422 Use hardware floating-point instructions.
21423
21424 @item -mmemcpy
21425 @opindex mmemcpy
21426 Do not optimize block moves, use @code{memcpy}.
21427
21428 @item -mno-clearbss
21429 @opindex mno-clearbss
21430 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21431
21432 @item -mcpu=@var{cpu-type}
21433 @opindex mcpu=
21434 Use features of, and schedule code for, the given CPU.
21435 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21436 where @var{X} is a major version, @var{YY} is the minor version, and
21437 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21438 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21439
21440 @item -mxl-soft-mul
21441 @opindex mxl-soft-mul
21442 Use software multiply emulation (default).
21443
21444 @item -mxl-soft-div
21445 @opindex mxl-soft-div
21446 Use software emulation for divides (default).
21447
21448 @item -mxl-barrel-shift
21449 @opindex mxl-barrel-shift
21450 Use the hardware barrel shifter.
21451
21452 @item -mxl-pattern-compare
21453 @opindex mxl-pattern-compare
21454 Use pattern compare instructions.
21455
21456 @item -msmall-divides
21457 @opindex msmall-divides
21458 Use table lookup optimization for small signed integer divisions.
21459
21460 @item -mxl-stack-check
21461 @opindex mxl-stack-check
21462 This option is deprecated. Use @option{-fstack-check} instead.
21463
21464 @item -mxl-gp-opt
21465 @opindex mxl-gp-opt
21466 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21467
21468 @item -mxl-multiply-high
21469 @opindex mxl-multiply-high
21470 Use multiply high instructions for high part of 32x32 multiply.
21471
21472 @item -mxl-float-convert
21473 @opindex mxl-float-convert
21474 Use hardware floating-point conversion instructions.
21475
21476 @item -mxl-float-sqrt
21477 @opindex mxl-float-sqrt
21478 Use hardware floating-point square root instruction.
21479
21480 @item -mbig-endian
21481 @opindex mbig-endian
21482 Generate code for a big-endian target.
21483
21484 @item -mlittle-endian
21485 @opindex mlittle-endian
21486 Generate code for a little-endian target.
21487
21488 @item -mxl-reorder
21489 @opindex mxl-reorder
21490 Use reorder instructions (swap and byte reversed load/store).
21491
21492 @item -mxl-mode-@var{app-model}
21493 Select application model @var{app-model}. Valid models are
21494 @table @samp
21495 @item executable
21496 normal executable (default), uses startup code @file{crt0.o}.
21497
21498 @item -mpic-data-is-text-relative
21499 @opindex mpic-data-is-text-relative
21500 Assume that the displacement between the text and data segments is fixed
21501 at static link time. This allows data to be referenced by offset from start of
21502 text address instead of GOT since PC-relative addressing is not supported.
21503
21504 @item xmdstub
21505 for use with Xilinx Microprocessor Debugger (XMD) based
21506 software intrusive debug agent called xmdstub. This uses startup file
21507 @file{crt1.o} and sets the start address of the program to 0x800.
21508
21509 @item bootstrap
21510 for applications that are loaded using a bootloader.
21511 This model uses startup file @file{crt2.o} which does not contain a processor
21512 reset vector handler. This is suitable for transferring control on a
21513 processor reset to the bootloader rather than the application.
21514
21515 @item novectors
21516 for applications that do not require any of the
21517 MicroBlaze vectors. This option may be useful for applications running
21518 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21519 @end table
21520
21521 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21522 @option{-mxl-mode-@var{app-model}}.
21523
21524 @end table
21525
21526 @node MIPS Options
21527 @subsection MIPS Options
21528 @cindex MIPS options
21529
21530 @table @gcctabopt
21531
21532 @item -EB
21533 @opindex EB
21534 Generate big-endian code.
21535
21536 @item -EL
21537 @opindex EL
21538 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21539 configurations.
21540
21541 @item -march=@var{arch}
21542 @opindex march
21543 Generate code that runs on @var{arch}, which can be the name of a
21544 generic MIPS ISA, or the name of a particular processor.
21545 The ISA names are:
21546 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21547 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21548 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21549 @samp{mips64r5} and @samp{mips64r6}.
21550 The processor names are:
21551 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21552 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21553 @samp{5kc}, @samp{5kf},
21554 @samp{20kc},
21555 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21556 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21557 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21558 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21559 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21560 @samp{i6400}, @samp{i6500},
21561 @samp{interaptiv},
21562 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21563 @samp{gs464e}, @samp{gs264e},
21564 @samp{m4k},
21565 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21566 @samp{m5100}, @samp{m5101},
21567 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21568 @samp{orion},
21569 @samp{p5600}, @samp{p6600},
21570 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21571 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21572 @samp{r6000}, @samp{r8000},
21573 @samp{rm7000}, @samp{rm9000},
21574 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21575 @samp{sb1},
21576 @samp{sr71000},
21577 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21578 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21579 @samp{xlr} and @samp{xlp}.
21580 The special value @samp{from-abi} selects the
21581 most compatible architecture for the selected ABI (that is,
21582 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21583
21584 The native Linux/GNU toolchain also supports the value @samp{native},
21585 which selects the best architecture option for the host processor.
21586 @option{-march=native} has no effect if GCC does not recognize
21587 the processor.
21588
21589 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21590 (for example, @option{-march=r2k}). Prefixes are optional, and
21591 @samp{vr} may be written @samp{r}.
21592
21593 Names of the form @samp{@var{n}f2_1} refer to processors with
21594 FPUs clocked at half the rate of the core, names of the form
21595 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21596 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21597 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21598 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21599 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21600 accepted as synonyms for @samp{@var{n}f1_1}.
21601
21602 GCC defines two macros based on the value of this option. The first
21603 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21604 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21605 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21606 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21607 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21608
21609 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21610 above. In other words, it has the full prefix and does not
21611 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21612 the macro names the resolved architecture (either @code{"mips1"} or
21613 @code{"mips3"}). It names the default architecture when no
21614 @option{-march} option is given.
21615
21616 @item -mtune=@var{arch}
21617 @opindex mtune
21618 Optimize for @var{arch}. Among other things, this option controls
21619 the way instructions are scheduled, and the perceived cost of arithmetic
21620 operations. The list of @var{arch} values is the same as for
21621 @option{-march}.
21622
21623 When this option is not used, GCC optimizes for the processor
21624 specified by @option{-march}. By using @option{-march} and
21625 @option{-mtune} together, it is possible to generate code that
21626 runs on a family of processors, but optimize the code for one
21627 particular member of that family.
21628
21629 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21630 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21631 @option{-march} ones described above.
21632
21633 @item -mips1
21634 @opindex mips1
21635 Equivalent to @option{-march=mips1}.
21636
21637 @item -mips2
21638 @opindex mips2
21639 Equivalent to @option{-march=mips2}.
21640
21641 @item -mips3
21642 @opindex mips3
21643 Equivalent to @option{-march=mips3}.
21644
21645 @item -mips4
21646 @opindex mips4
21647 Equivalent to @option{-march=mips4}.
21648
21649 @item -mips32
21650 @opindex mips32
21651 Equivalent to @option{-march=mips32}.
21652
21653 @item -mips32r3
21654 @opindex mips32r3
21655 Equivalent to @option{-march=mips32r3}.
21656
21657 @item -mips32r5
21658 @opindex mips32r5
21659 Equivalent to @option{-march=mips32r5}.
21660
21661 @item -mips32r6
21662 @opindex mips32r6
21663 Equivalent to @option{-march=mips32r6}.
21664
21665 @item -mips64
21666 @opindex mips64
21667 Equivalent to @option{-march=mips64}.
21668
21669 @item -mips64r2
21670 @opindex mips64r2
21671 Equivalent to @option{-march=mips64r2}.
21672
21673 @item -mips64r3
21674 @opindex mips64r3
21675 Equivalent to @option{-march=mips64r3}.
21676
21677 @item -mips64r5
21678 @opindex mips64r5
21679 Equivalent to @option{-march=mips64r5}.
21680
21681 @item -mips64r6
21682 @opindex mips64r6
21683 Equivalent to @option{-march=mips64r6}.
21684
21685 @item -mips16
21686 @itemx -mno-mips16
21687 @opindex mips16
21688 @opindex mno-mips16
21689 Generate (do not generate) MIPS16 code. If GCC is targeting a
21690 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21691
21692 MIPS16 code generation can also be controlled on a per-function basis
21693 by means of @code{mips16} and @code{nomips16} attributes.
21694 @xref{Function Attributes}, for more information.
21695
21696 @item -mflip-mips16
21697 @opindex mflip-mips16
21698 Generate MIPS16 code on alternating functions. This option is provided
21699 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21700 not intended for ordinary use in compiling user code.
21701
21702 @item -minterlink-compressed
21703 @itemx -mno-interlink-compressed
21704 @opindex minterlink-compressed
21705 @opindex mno-interlink-compressed
21706 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21707 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21708
21709 For example, code using the standard ISA encoding cannot jump directly
21710 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21711 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21712 knows that the target of the jump is not compressed.
21713
21714 @item -minterlink-mips16
21715 @itemx -mno-interlink-mips16
21716 @opindex minterlink-mips16
21717 @opindex mno-interlink-mips16
21718 Aliases of @option{-minterlink-compressed} and
21719 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21720 and are retained for backwards compatibility.
21721
21722 @item -mabi=32
21723 @itemx -mabi=o64
21724 @itemx -mabi=n32
21725 @itemx -mabi=64
21726 @itemx -mabi=eabi
21727 @opindex mabi=32
21728 @opindex mabi=o64
21729 @opindex mabi=n32
21730 @opindex mabi=64
21731 @opindex mabi=eabi
21732 Generate code for the given ABI@.
21733
21734 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21735 generates 64-bit code when you select a 64-bit architecture, but you
21736 can use @option{-mgp32} to get 32-bit code instead.
21737
21738 For information about the O64 ABI, see
21739 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21740
21741 GCC supports a variant of the o32 ABI in which floating-point registers
21742 are 64 rather than 32 bits wide. You can select this combination with
21743 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21744 and @code{mfhc1} instructions and is therefore only supported for
21745 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21746
21747 The register assignments for arguments and return values remain the
21748 same, but each scalar value is passed in a single 64-bit register
21749 rather than a pair of 32-bit registers. For example, scalar
21750 floating-point values are returned in @samp{$f0} only, not a
21751 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21752 remains the same in that the even-numbered double-precision registers
21753 are saved.
21754
21755 Two additional variants of the o32 ABI are supported to enable
21756 a transition from 32-bit to 64-bit registers. These are FPXX
21757 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21758 The FPXX extension mandates that all code must execute correctly
21759 when run using 32-bit or 64-bit registers. The code can be interlinked
21760 with either FP32 or FP64, but not both.
21761 The FP64A extension is similar to the FP64 extension but forbids the
21762 use of odd-numbered single-precision registers. This can be used
21763 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21764 processors and allows both FP32 and FP64A code to interlink and
21765 run in the same process without changing FPU modes.
21766
21767 @item -mabicalls
21768 @itemx -mno-abicalls
21769 @opindex mabicalls
21770 @opindex mno-abicalls
21771 Generate (do not generate) code that is suitable for SVR4-style
21772 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21773 systems.
21774
21775 @item -mshared
21776 @itemx -mno-shared
21777 Generate (do not generate) code that is fully position-independent,
21778 and that can therefore be linked into shared libraries. This option
21779 only affects @option{-mabicalls}.
21780
21781 All @option{-mabicalls} code has traditionally been position-independent,
21782 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21783 as an extension, the GNU toolchain allows executables to use absolute
21784 accesses for locally-binding symbols. It can also use shorter GP
21785 initialization sequences and generate direct calls to locally-defined
21786 functions. This mode is selected by @option{-mno-shared}.
21787
21788 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21789 objects that can only be linked by the GNU linker. However, the option
21790 does not affect the ABI of the final executable; it only affects the ABI
21791 of relocatable objects. Using @option{-mno-shared} generally makes
21792 executables both smaller and quicker.
21793
21794 @option{-mshared} is the default.
21795
21796 @item -mplt
21797 @itemx -mno-plt
21798 @opindex mplt
21799 @opindex mno-plt
21800 Assume (do not assume) that the static and dynamic linkers
21801 support PLTs and copy relocations. This option only affects
21802 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21803 has no effect without @option{-msym32}.
21804
21805 You can make @option{-mplt} the default by configuring
21806 GCC with @option{--with-mips-plt}. The default is
21807 @option{-mno-plt} otherwise.
21808
21809 @item -mxgot
21810 @itemx -mno-xgot
21811 @opindex mxgot
21812 @opindex mno-xgot
21813 Lift (do not lift) the usual restrictions on the size of the global
21814 offset table.
21815
21816 GCC normally uses a single instruction to load values from the GOT@.
21817 While this is relatively efficient, it only works if the GOT
21818 is smaller than about 64k. Anything larger causes the linker
21819 to report an error such as:
21820
21821 @cindex relocation truncated to fit (MIPS)
21822 @smallexample
21823 relocation truncated to fit: R_MIPS_GOT16 foobar
21824 @end smallexample
21825
21826 If this happens, you should recompile your code with @option{-mxgot}.
21827 This works with very large GOTs, although the code is also
21828 less efficient, since it takes three instructions to fetch the
21829 value of a global symbol.
21830
21831 Note that some linkers can create multiple GOTs. If you have such a
21832 linker, you should only need to use @option{-mxgot} when a single object
21833 file accesses more than 64k's worth of GOT entries. Very few do.
21834
21835 These options have no effect unless GCC is generating position
21836 independent code.
21837
21838 @item -mgp32
21839 @opindex mgp32
21840 Assume that general-purpose registers are 32 bits wide.
21841
21842 @item -mgp64
21843 @opindex mgp64
21844 Assume that general-purpose registers are 64 bits wide.
21845
21846 @item -mfp32
21847 @opindex mfp32
21848 Assume that floating-point registers are 32 bits wide.
21849
21850 @item -mfp64
21851 @opindex mfp64
21852 Assume that floating-point registers are 64 bits wide.
21853
21854 @item -mfpxx
21855 @opindex mfpxx
21856 Do not assume the width of floating-point registers.
21857
21858 @item -mhard-float
21859 @opindex mhard-float
21860 Use floating-point coprocessor instructions.
21861
21862 @item -msoft-float
21863 @opindex msoft-float
21864 Do not use floating-point coprocessor instructions. Implement
21865 floating-point calculations using library calls instead.
21866
21867 @item -mno-float
21868 @opindex mno-float
21869 Equivalent to @option{-msoft-float}, but additionally asserts that the
21870 program being compiled does not perform any floating-point operations.
21871 This option is presently supported only by some bare-metal MIPS
21872 configurations, where it may select a special set of libraries
21873 that lack all floating-point support (including, for example, the
21874 floating-point @code{printf} formats).
21875 If code compiled with @option{-mno-float} accidentally contains
21876 floating-point operations, it is likely to suffer a link-time
21877 or run-time failure.
21878
21879 @item -msingle-float
21880 @opindex msingle-float
21881 Assume that the floating-point coprocessor only supports single-precision
21882 operations.
21883
21884 @item -mdouble-float
21885 @opindex mdouble-float
21886 Assume that the floating-point coprocessor supports double-precision
21887 operations. This is the default.
21888
21889 @item -modd-spreg
21890 @itemx -mno-odd-spreg
21891 @opindex modd-spreg
21892 @opindex mno-odd-spreg
21893 Enable the use of odd-numbered single-precision floating-point registers
21894 for the o32 ABI. This is the default for processors that are known to
21895 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21896 is set by default.
21897
21898 @item -mabs=2008
21899 @itemx -mabs=legacy
21900 @opindex mabs=2008
21901 @opindex mabs=legacy
21902 These options control the treatment of the special not-a-number (NaN)
21903 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21904 @code{neg.@i{fmt}} machine instructions.
21905
21906 By default or when @option{-mabs=legacy} is used the legacy
21907 treatment is selected. In this case these instructions are considered
21908 arithmetic and avoided where correct operation is required and the
21909 input operand might be a NaN. A longer sequence of instructions that
21910 manipulate the sign bit of floating-point datum manually is used
21911 instead unless the @option{-ffinite-math-only} option has also been
21912 specified.
21913
21914 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21915 this case these instructions are considered non-arithmetic and therefore
21916 operating correctly in all cases, including in particular where the
21917 input operand is a NaN. These instructions are therefore always used
21918 for the respective operations.
21919
21920 @item -mnan=2008
21921 @itemx -mnan=legacy
21922 @opindex mnan=2008
21923 @opindex mnan=legacy
21924 These options control the encoding of the special not-a-number (NaN)
21925 IEEE 754 floating-point data.
21926
21927 The @option{-mnan=legacy} option selects the legacy encoding. In this
21928 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21929 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21930 by the first bit of their trailing significand field being 1.
21931
21932 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21933 this case qNaNs are denoted by the first bit of their trailing
21934 significand field being 1, whereas sNaNs are denoted by the first bit of
21935 their trailing significand field being 0.
21936
21937 The default is @option{-mnan=legacy} unless GCC has been configured with
21938 @option{--with-nan=2008}.
21939
21940 @item -mllsc
21941 @itemx -mno-llsc
21942 @opindex mllsc
21943 @opindex mno-llsc
21944 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21945 implement atomic memory built-in functions. When neither option is
21946 specified, GCC uses the instructions if the target architecture
21947 supports them.
21948
21949 @option{-mllsc} is useful if the runtime environment can emulate the
21950 instructions and @option{-mno-llsc} can be useful when compiling for
21951 nonstandard ISAs. You can make either option the default by
21952 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21953 respectively. @option{--with-llsc} is the default for some
21954 configurations; see the installation documentation for details.
21955
21956 @item -mdsp
21957 @itemx -mno-dsp
21958 @opindex mdsp
21959 @opindex mno-dsp
21960 Use (do not use) revision 1 of the MIPS DSP ASE@.
21961 @xref{MIPS DSP Built-in Functions}. This option defines the
21962 preprocessor macro @code{__mips_dsp}. It also defines
21963 @code{__mips_dsp_rev} to 1.
21964
21965 @item -mdspr2
21966 @itemx -mno-dspr2
21967 @opindex mdspr2
21968 @opindex mno-dspr2
21969 Use (do not use) revision 2 of the MIPS DSP ASE@.
21970 @xref{MIPS DSP Built-in Functions}. This option defines the
21971 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21972 It also defines @code{__mips_dsp_rev} to 2.
21973
21974 @item -msmartmips
21975 @itemx -mno-smartmips
21976 @opindex msmartmips
21977 @opindex mno-smartmips
21978 Use (do not use) the MIPS SmartMIPS ASE.
21979
21980 @item -mpaired-single
21981 @itemx -mno-paired-single
21982 @opindex mpaired-single
21983 @opindex mno-paired-single
21984 Use (do not use) paired-single floating-point instructions.
21985 @xref{MIPS Paired-Single Support}. This option requires
21986 hardware floating-point support to be enabled.
21987
21988 @item -mdmx
21989 @itemx -mno-mdmx
21990 @opindex mdmx
21991 @opindex mno-mdmx
21992 Use (do not use) MIPS Digital Media Extension instructions.
21993 This option can only be used when generating 64-bit code and requires
21994 hardware floating-point support to be enabled.
21995
21996 @item -mips3d
21997 @itemx -mno-mips3d
21998 @opindex mips3d
21999 @opindex mno-mips3d
22000 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22001 The option @option{-mips3d} implies @option{-mpaired-single}.
22002
22003 @item -mmicromips
22004 @itemx -mno-micromips
22005 @opindex mmicromips
22006 @opindex mno-mmicromips
22007 Generate (do not generate) microMIPS code.
22008
22009 MicroMIPS code generation can also be controlled on a per-function basis
22010 by means of @code{micromips} and @code{nomicromips} attributes.
22011 @xref{Function Attributes}, for more information.
22012
22013 @item -mmt
22014 @itemx -mno-mt
22015 @opindex mmt
22016 @opindex mno-mt
22017 Use (do not use) MT Multithreading instructions.
22018
22019 @item -mmcu
22020 @itemx -mno-mcu
22021 @opindex mmcu
22022 @opindex mno-mcu
22023 Use (do not use) the MIPS MCU ASE instructions.
22024
22025 @item -meva
22026 @itemx -mno-eva
22027 @opindex meva
22028 @opindex mno-eva
22029 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22030
22031 @item -mvirt
22032 @itemx -mno-virt
22033 @opindex mvirt
22034 @opindex mno-virt
22035 Use (do not use) the MIPS Virtualization (VZ) instructions.
22036
22037 @item -mxpa
22038 @itemx -mno-xpa
22039 @opindex mxpa
22040 @opindex mno-xpa
22041 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22042
22043 @item -mcrc
22044 @itemx -mno-crc
22045 @opindex mcrc
22046 @opindex mno-crc
22047 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22048
22049 @item -mginv
22050 @itemx -mno-ginv
22051 @opindex mginv
22052 @opindex mno-ginv
22053 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22054
22055 @item -mloongson-mmi
22056 @itemx -mno-loongson-mmi
22057 @opindex mloongson-mmi
22058 @opindex mno-loongson-mmi
22059 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22060
22061 @item -mloongson-ext
22062 @itemx -mno-loongson-ext
22063 @opindex mloongson-ext
22064 @opindex mno-loongson-ext
22065 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22066
22067 @item -mloongson-ext2
22068 @itemx -mno-loongson-ext2
22069 @opindex mloongson-ext2
22070 @opindex mno-loongson-ext2
22071 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22072
22073 @item -mlong64
22074 @opindex mlong64
22075 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22076 an explanation of the default and the way that the pointer size is
22077 determined.
22078
22079 @item -mlong32
22080 @opindex mlong32
22081 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22082
22083 The default size of @code{int}s, @code{long}s and pointers depends on
22084 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22085 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22086 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22087 or the same size as integer registers, whichever is smaller.
22088
22089 @item -msym32
22090 @itemx -mno-sym32
22091 @opindex msym32
22092 @opindex mno-sym32
22093 Assume (do not assume) that all symbols have 32-bit values, regardless
22094 of the selected ABI@. This option is useful in combination with
22095 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22096 to generate shorter and faster references to symbolic addresses.
22097
22098 @item -G @var{num}
22099 @opindex G
22100 Put definitions of externally-visible data in a small data section
22101 if that data is no bigger than @var{num} bytes. GCC can then generate
22102 more efficient accesses to the data; see @option{-mgpopt} for details.
22103
22104 The default @option{-G} option depends on the configuration.
22105
22106 @item -mlocal-sdata
22107 @itemx -mno-local-sdata
22108 @opindex mlocal-sdata
22109 @opindex mno-local-sdata
22110 Extend (do not extend) the @option{-G} behavior to local data too,
22111 such as to static variables in C@. @option{-mlocal-sdata} is the
22112 default for all configurations.
22113
22114 If the linker complains that an application is using too much small data,
22115 you might want to try rebuilding the less performance-critical parts with
22116 @option{-mno-local-sdata}. You might also want to build large
22117 libraries with @option{-mno-local-sdata}, so that the libraries leave
22118 more room for the main program.
22119
22120 @item -mextern-sdata
22121 @itemx -mno-extern-sdata
22122 @opindex mextern-sdata
22123 @opindex mno-extern-sdata
22124 Assume (do not assume) that externally-defined data is in
22125 a small data section if the size of that data is within the @option{-G} limit.
22126 @option{-mextern-sdata} is the default for all configurations.
22127
22128 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22129 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22130 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22131 is placed in a small data section. If @var{Var} is defined by another
22132 module, you must either compile that module with a high-enough
22133 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22134 definition. If @var{Var} is common, you must link the application
22135 with a high-enough @option{-G} setting.
22136
22137 The easiest way of satisfying these restrictions is to compile
22138 and link every module with the same @option{-G} option. However,
22139 you may wish to build a library that supports several different
22140 small data limits. You can do this by compiling the library with
22141 the highest supported @option{-G} setting and additionally using
22142 @option{-mno-extern-sdata} to stop the library from making assumptions
22143 about externally-defined data.
22144
22145 @item -mgpopt
22146 @itemx -mno-gpopt
22147 @opindex mgpopt
22148 @opindex mno-gpopt
22149 Use (do not use) GP-relative accesses for symbols that are known to be
22150 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22151 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22152 configurations.
22153
22154 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22155 might not hold the value of @code{_gp}. For example, if the code is
22156 part of a library that might be used in a boot monitor, programs that
22157 call boot monitor routines pass an unknown value in @code{$gp}.
22158 (In such situations, the boot monitor itself is usually compiled
22159 with @option{-G0}.)
22160
22161 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22162 @option{-mno-extern-sdata}.
22163
22164 @item -membedded-data
22165 @itemx -mno-embedded-data
22166 @opindex membedded-data
22167 @opindex mno-embedded-data
22168 Allocate variables to the read-only data section first if possible, then
22169 next in the small data section if possible, otherwise in data. This gives
22170 slightly slower code than the default, but reduces the amount of RAM required
22171 when executing, and thus may be preferred for some embedded systems.
22172
22173 @item -muninit-const-in-rodata
22174 @itemx -mno-uninit-const-in-rodata
22175 @opindex muninit-const-in-rodata
22176 @opindex mno-uninit-const-in-rodata
22177 Put uninitialized @code{const} variables in the read-only data section.
22178 This option is only meaningful in conjunction with @option{-membedded-data}.
22179
22180 @item -mcode-readable=@var{setting}
22181 @opindex mcode-readable
22182 Specify whether GCC may generate code that reads from executable sections.
22183 There are three possible settings:
22184
22185 @table @gcctabopt
22186 @item -mcode-readable=yes
22187 Instructions may freely access executable sections. This is the
22188 default setting.
22189
22190 @item -mcode-readable=pcrel
22191 MIPS16 PC-relative load instructions can access executable sections,
22192 but other instructions must not do so. This option is useful on 4KSc
22193 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22194 It is also useful on processors that can be configured to have a dual
22195 instruction/data SRAM interface and that, like the M4K, automatically
22196 redirect PC-relative loads to the instruction RAM.
22197
22198 @item -mcode-readable=no
22199 Instructions must not access executable sections. This option can be
22200 useful on targets that are configured to have a dual instruction/data
22201 SRAM interface but that (unlike the M4K) do not automatically redirect
22202 PC-relative loads to the instruction RAM.
22203 @end table
22204
22205 @item -msplit-addresses
22206 @itemx -mno-split-addresses
22207 @opindex msplit-addresses
22208 @opindex mno-split-addresses
22209 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22210 relocation operators. This option has been superseded by
22211 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22212
22213 @item -mexplicit-relocs
22214 @itemx -mno-explicit-relocs
22215 @opindex mexplicit-relocs
22216 @opindex mno-explicit-relocs
22217 Use (do not use) assembler relocation operators when dealing with symbolic
22218 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22219 is to use assembler macros instead.
22220
22221 @option{-mexplicit-relocs} is the default if GCC was configured
22222 to use an assembler that supports relocation operators.
22223
22224 @item -mcheck-zero-division
22225 @itemx -mno-check-zero-division
22226 @opindex mcheck-zero-division
22227 @opindex mno-check-zero-division
22228 Trap (do not trap) on integer division by zero.
22229
22230 The default is @option{-mcheck-zero-division}.
22231
22232 @item -mdivide-traps
22233 @itemx -mdivide-breaks
22234 @opindex mdivide-traps
22235 @opindex mdivide-breaks
22236 MIPS systems check for division by zero by generating either a
22237 conditional trap or a break instruction. Using traps results in
22238 smaller code, but is only supported on MIPS II and later. Also, some
22239 versions of the Linux kernel have a bug that prevents trap from
22240 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22241 allow conditional traps on architectures that support them and
22242 @option{-mdivide-breaks} to force the use of breaks.
22243
22244 The default is usually @option{-mdivide-traps}, but this can be
22245 overridden at configure time using @option{--with-divide=breaks}.
22246 Divide-by-zero checks can be completely disabled using
22247 @option{-mno-check-zero-division}.
22248
22249 @item -mload-store-pairs
22250 @itemx -mno-load-store-pairs
22251 @opindex mload-store-pairs
22252 @opindex mno-load-store-pairs
22253 Enable (disable) an optimization that pairs consecutive load or store
22254 instructions to enable load/store bonding. This option is enabled by
22255 default but only takes effect when the selected architecture is known
22256 to support bonding.
22257
22258 @item -mmemcpy
22259 @itemx -mno-memcpy
22260 @opindex mmemcpy
22261 @opindex mno-memcpy
22262 Force (do not force) the use of @code{memcpy} for non-trivial block
22263 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22264 most constant-sized copies.
22265
22266 @item -mlong-calls
22267 @itemx -mno-long-calls
22268 @opindex mlong-calls
22269 @opindex mno-long-calls
22270 Disable (do not disable) use of the @code{jal} instruction. Calling
22271 functions using @code{jal} is more efficient but requires the caller
22272 and callee to be in the same 256 megabyte segment.
22273
22274 This option has no effect on abicalls code. The default is
22275 @option{-mno-long-calls}.
22276
22277 @item -mmad
22278 @itemx -mno-mad
22279 @opindex mmad
22280 @opindex mno-mad
22281 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22282 instructions, as provided by the R4650 ISA@.
22283
22284 @item -mimadd
22285 @itemx -mno-imadd
22286 @opindex mimadd
22287 @opindex mno-imadd
22288 Enable (disable) use of the @code{madd} and @code{msub} integer
22289 instructions. The default is @option{-mimadd} on architectures
22290 that support @code{madd} and @code{msub} except for the 74k
22291 architecture where it was found to generate slower code.
22292
22293 @item -mfused-madd
22294 @itemx -mno-fused-madd
22295 @opindex mfused-madd
22296 @opindex mno-fused-madd
22297 Enable (disable) use of the floating-point multiply-accumulate
22298 instructions, when they are available. The default is
22299 @option{-mfused-madd}.
22300
22301 On the R8000 CPU when multiply-accumulate instructions are used,
22302 the intermediate product is calculated to infinite precision
22303 and is not subject to the FCSR Flush to Zero bit. This may be
22304 undesirable in some circumstances. On other processors the result
22305 is numerically identical to the equivalent computation using
22306 separate multiply, add, subtract and negate instructions.
22307
22308 @item -nocpp
22309 @opindex nocpp
22310 Tell the MIPS assembler to not run its preprocessor over user
22311 assembler files (with a @samp{.s} suffix) when assembling them.
22312
22313 @item -mfix-24k
22314 @itemx -mno-fix-24k
22315 @opindex mfix-24k
22316 @opindex mno-fix-24k
22317 Work around the 24K E48 (lost data on stores during refill) errata.
22318 The workarounds are implemented by the assembler rather than by GCC@.
22319
22320 @item -mfix-r4000
22321 @itemx -mno-fix-r4000
22322 @opindex mfix-r4000
22323 @opindex mno-fix-r4000
22324 Work around certain R4000 CPU errata:
22325 @itemize @minus
22326 @item
22327 A double-word or a variable shift may give an incorrect result if executed
22328 immediately after starting an integer division.
22329 @item
22330 A double-word or a variable shift may give an incorrect result if executed
22331 while an integer multiplication is in progress.
22332 @item
22333 An integer division may give an incorrect result if started in a delay slot
22334 of a taken branch or a jump.
22335 @end itemize
22336
22337 @item -mfix-r4400
22338 @itemx -mno-fix-r4400
22339 @opindex mfix-r4400
22340 @opindex mno-fix-r4400
22341 Work around certain R4400 CPU errata:
22342 @itemize @minus
22343 @item
22344 A double-word or a variable shift may give an incorrect result if executed
22345 immediately after starting an integer division.
22346 @end itemize
22347
22348 @item -mfix-r10000
22349 @itemx -mno-fix-r10000
22350 @opindex mfix-r10000
22351 @opindex mno-fix-r10000
22352 Work around certain R10000 errata:
22353 @itemize @minus
22354 @item
22355 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22356 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22357 @end itemize
22358
22359 This option can only be used if the target architecture supports
22360 branch-likely instructions. @option{-mfix-r10000} is the default when
22361 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22362 otherwise.
22363
22364 @item -mfix-r5900
22365 @itemx -mno-fix-r5900
22366 @opindex mfix-r5900
22367 Do not attempt to schedule the preceding instruction into the delay slot
22368 of a branch instruction placed at the end of a short loop of six
22369 instructions or fewer and always schedule a @code{nop} instruction there
22370 instead. The short loop bug under certain conditions causes loops to
22371 execute only once or twice, due to a hardware bug in the R5900 chip. The
22372 workaround is implemented by the assembler rather than by GCC@.
22373
22374 @item -mfix-rm7000
22375 @itemx -mno-fix-rm7000
22376 @opindex mfix-rm7000
22377 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22378 workarounds are implemented by the assembler rather than by GCC@.
22379
22380 @item -mfix-vr4120
22381 @itemx -mno-fix-vr4120
22382 @opindex mfix-vr4120
22383 Work around certain VR4120 errata:
22384 @itemize @minus
22385 @item
22386 @code{dmultu} does not always produce the correct result.
22387 @item
22388 @code{div} and @code{ddiv} do not always produce the correct result if one
22389 of the operands is negative.
22390 @end itemize
22391 The workarounds for the division errata rely on special functions in
22392 @file{libgcc.a}. At present, these functions are only provided by
22393 the @code{mips64vr*-elf} configurations.
22394
22395 Other VR4120 errata require a NOP to be inserted between certain pairs of
22396 instructions. These errata are handled by the assembler, not by GCC itself.
22397
22398 @item -mfix-vr4130
22399 @opindex mfix-vr4130
22400 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22401 workarounds are implemented by the assembler rather than by GCC,
22402 although GCC avoids using @code{mflo} and @code{mfhi} if the
22403 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22404 instructions are available instead.
22405
22406 @item -mfix-sb1
22407 @itemx -mno-fix-sb1
22408 @opindex mfix-sb1
22409 Work around certain SB-1 CPU core errata.
22410 (This flag currently works around the SB-1 revision 2
22411 ``F1'' and ``F2'' floating-point errata.)
22412
22413 @item -mr10k-cache-barrier=@var{setting}
22414 @opindex mr10k-cache-barrier
22415 Specify whether GCC should insert cache barriers to avoid the
22416 side effects of speculation on R10K processors.
22417
22418 In common with many processors, the R10K tries to predict the outcome
22419 of a conditional branch and speculatively executes instructions from
22420 the ``taken'' branch. It later aborts these instructions if the
22421 predicted outcome is wrong. However, on the R10K, even aborted
22422 instructions can have side effects.
22423
22424 This problem only affects kernel stores and, depending on the system,
22425 kernel loads. As an example, a speculatively-executed store may load
22426 the target memory into cache and mark the cache line as dirty, even if
22427 the store itself is later aborted. If a DMA operation writes to the
22428 same area of memory before the ``dirty'' line is flushed, the cached
22429 data overwrites the DMA-ed data. See the R10K processor manual
22430 for a full description, including other potential problems.
22431
22432 One workaround is to insert cache barrier instructions before every memory
22433 access that might be speculatively executed and that might have side
22434 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22435 controls GCC's implementation of this workaround. It assumes that
22436 aborted accesses to any byte in the following regions does not have
22437 side effects:
22438
22439 @enumerate
22440 @item
22441 the memory occupied by the current function's stack frame;
22442
22443 @item
22444 the memory occupied by an incoming stack argument;
22445
22446 @item
22447 the memory occupied by an object with a link-time-constant address.
22448 @end enumerate
22449
22450 It is the kernel's responsibility to ensure that speculative
22451 accesses to these regions are indeed safe.
22452
22453 If the input program contains a function declaration such as:
22454
22455 @smallexample
22456 void foo (void);
22457 @end smallexample
22458
22459 then the implementation of @code{foo} must allow @code{j foo} and
22460 @code{jal foo} to be executed speculatively. GCC honors this
22461 restriction for functions it compiles itself. It expects non-GCC
22462 functions (such as hand-written assembly code) to do the same.
22463
22464 The option has three forms:
22465
22466 @table @gcctabopt
22467 @item -mr10k-cache-barrier=load-store
22468 Insert a cache barrier before a load or store that might be
22469 speculatively executed and that might have side effects even
22470 if aborted.
22471
22472 @item -mr10k-cache-barrier=store
22473 Insert a cache barrier before a store that might be speculatively
22474 executed and that might have side effects even if aborted.
22475
22476 @item -mr10k-cache-barrier=none
22477 Disable the insertion of cache barriers. This is the default setting.
22478 @end table
22479
22480 @item -mflush-func=@var{func}
22481 @itemx -mno-flush-func
22482 @opindex mflush-func
22483 Specifies the function to call to flush the I and D caches, or to not
22484 call any such function. If called, the function must take the same
22485 arguments as the common @code{_flush_func}, that is, the address of the
22486 memory range for which the cache is being flushed, the size of the
22487 memory range, and the number 3 (to flush both caches). The default
22488 depends on the target GCC was configured for, but commonly is either
22489 @code{_flush_func} or @code{__cpu_flush}.
22490
22491 @item mbranch-cost=@var{num}
22492 @opindex mbranch-cost
22493 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22494 This cost is only a heuristic and is not guaranteed to produce
22495 consistent results across releases. A zero cost redundantly selects
22496 the default, which is based on the @option{-mtune} setting.
22497
22498 @item -mbranch-likely
22499 @itemx -mno-branch-likely
22500 @opindex mbranch-likely
22501 @opindex mno-branch-likely
22502 Enable or disable use of Branch Likely instructions, regardless of the
22503 default for the selected architecture. By default, Branch Likely
22504 instructions may be generated if they are supported by the selected
22505 architecture. An exception is for the MIPS32 and MIPS64 architectures
22506 and processors that implement those architectures; for those, Branch
22507 Likely instructions are not be generated by default because the MIPS32
22508 and MIPS64 architectures specifically deprecate their use.
22509
22510 @item -mcompact-branches=never
22511 @itemx -mcompact-branches=optimal
22512 @itemx -mcompact-branches=always
22513 @opindex mcompact-branches=never
22514 @opindex mcompact-branches=optimal
22515 @opindex mcompact-branches=always
22516 These options control which form of branches will be generated. The
22517 default is @option{-mcompact-branches=optimal}.
22518
22519 The @option{-mcompact-branches=never} option ensures that compact branch
22520 instructions will never be generated.
22521
22522 The @option{-mcompact-branches=always} option ensures that a compact
22523 branch instruction will be generated if available. If a compact branch
22524 instruction is not available, a delay slot form of the branch will be
22525 used instead.
22526
22527 This option is supported from MIPS Release 6 onwards.
22528
22529 The @option{-mcompact-branches=optimal} option will cause a delay slot
22530 branch to be used if one is available in the current ISA and the delay
22531 slot is successfully filled. If the delay slot is not filled, a compact
22532 branch will be chosen if one is available.
22533
22534 @item -mfp-exceptions
22535 @itemx -mno-fp-exceptions
22536 @opindex mfp-exceptions
22537 Specifies whether FP exceptions are enabled. This affects how
22538 FP instructions are scheduled for some processors.
22539 The default is that FP exceptions are
22540 enabled.
22541
22542 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22543 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22544 FP pipe.
22545
22546 @item -mvr4130-align
22547 @itemx -mno-vr4130-align
22548 @opindex mvr4130-align
22549 The VR4130 pipeline is two-way superscalar, but can only issue two
22550 instructions together if the first one is 8-byte aligned. When this
22551 option is enabled, GCC aligns pairs of instructions that it
22552 thinks should execute in parallel.
22553
22554 This option only has an effect when optimizing for the VR4130.
22555 It normally makes code faster, but at the expense of making it bigger.
22556 It is enabled by default at optimization level @option{-O3}.
22557
22558 @item -msynci
22559 @itemx -mno-synci
22560 @opindex msynci
22561 Enable (disable) generation of @code{synci} instructions on
22562 architectures that support it. The @code{synci} instructions (if
22563 enabled) are generated when @code{__builtin___clear_cache} is
22564 compiled.
22565
22566 This option defaults to @option{-mno-synci}, but the default can be
22567 overridden by configuring GCC with @option{--with-synci}.
22568
22569 When compiling code for single processor systems, it is generally safe
22570 to use @code{synci}. However, on many multi-core (SMP) systems, it
22571 does not invalidate the instruction caches on all cores and may lead
22572 to undefined behavior.
22573
22574 @item -mrelax-pic-calls
22575 @itemx -mno-relax-pic-calls
22576 @opindex mrelax-pic-calls
22577 Try to turn PIC calls that are normally dispatched via register
22578 @code{$25} into direct calls. This is only possible if the linker can
22579 resolve the destination at link time and if the destination is within
22580 range for a direct call.
22581
22582 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22583 an assembler and a linker that support the @code{.reloc} assembly
22584 directive and @option{-mexplicit-relocs} is in effect. With
22585 @option{-mno-explicit-relocs}, this optimization can be performed by the
22586 assembler and the linker alone without help from the compiler.
22587
22588 @item -mmcount-ra-address
22589 @itemx -mno-mcount-ra-address
22590 @opindex mmcount-ra-address
22591 @opindex mno-mcount-ra-address
22592 Emit (do not emit) code that allows @code{_mcount} to modify the
22593 calling function's return address. When enabled, this option extends
22594 the usual @code{_mcount} interface with a new @var{ra-address}
22595 parameter, which has type @code{intptr_t *} and is passed in register
22596 @code{$12}. @code{_mcount} can then modify the return address by
22597 doing both of the following:
22598 @itemize
22599 @item
22600 Returning the new address in register @code{$31}.
22601 @item
22602 Storing the new address in @code{*@var{ra-address}},
22603 if @var{ra-address} is nonnull.
22604 @end itemize
22605
22606 The default is @option{-mno-mcount-ra-address}.
22607
22608 @item -mframe-header-opt
22609 @itemx -mno-frame-header-opt
22610 @opindex mframe-header-opt
22611 Enable (disable) frame header optimization in the o32 ABI. When using the
22612 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22613 function to write out register arguments. When enabled, this optimization
22614 will suppress the allocation of the frame header if it can be determined that
22615 it is unused.
22616
22617 This optimization is off by default at all optimization levels.
22618
22619 @item -mlxc1-sxc1
22620 @itemx -mno-lxc1-sxc1
22621 @opindex mlxc1-sxc1
22622 When applicable, enable (disable) the generation of @code{lwxc1},
22623 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22624
22625 @item -mmadd4
22626 @itemx -mno-madd4
22627 @opindex mmadd4
22628 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22629 @code{madd.d} and related instructions. Enabled by default.
22630
22631 @end table
22632
22633 @node MMIX Options
22634 @subsection MMIX Options
22635 @cindex MMIX Options
22636
22637 These options are defined for the MMIX:
22638
22639 @table @gcctabopt
22640 @item -mlibfuncs
22641 @itemx -mno-libfuncs
22642 @opindex mlibfuncs
22643 @opindex mno-libfuncs
22644 Specify that intrinsic library functions are being compiled, passing all
22645 values in registers, no matter the size.
22646
22647 @item -mepsilon
22648 @itemx -mno-epsilon
22649 @opindex mepsilon
22650 @opindex mno-epsilon
22651 Generate floating-point comparison instructions that compare with respect
22652 to the @code{rE} epsilon register.
22653
22654 @item -mabi=mmixware
22655 @itemx -mabi=gnu
22656 @opindex mabi=mmixware
22657 @opindex mabi=gnu
22658 Generate code that passes function parameters and return values that (in
22659 the called function) are seen as registers @code{$0} and up, as opposed to
22660 the GNU ABI which uses global registers @code{$231} and up.
22661
22662 @item -mzero-extend
22663 @itemx -mno-zero-extend
22664 @opindex mzero-extend
22665 @opindex mno-zero-extend
22666 When reading data from memory in sizes shorter than 64 bits, use (do not
22667 use) zero-extending load instructions by default, rather than
22668 sign-extending ones.
22669
22670 @item -mknuthdiv
22671 @itemx -mno-knuthdiv
22672 @opindex mknuthdiv
22673 @opindex mno-knuthdiv
22674 Make the result of a division yielding a remainder have the same sign as
22675 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22676 remainder follows the sign of the dividend. Both methods are
22677 arithmetically valid, the latter being almost exclusively used.
22678
22679 @item -mtoplevel-symbols
22680 @itemx -mno-toplevel-symbols
22681 @opindex mtoplevel-symbols
22682 @opindex mno-toplevel-symbols
22683 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22684 code can be used with the @code{PREFIX} assembly directive.
22685
22686 @item -melf
22687 @opindex melf
22688 Generate an executable in the ELF format, rather than the default
22689 @samp{mmo} format used by the @command{mmix} simulator.
22690
22691 @item -mbranch-predict
22692 @itemx -mno-branch-predict
22693 @opindex mbranch-predict
22694 @opindex mno-branch-predict
22695 Use (do not use) the probable-branch instructions, when static branch
22696 prediction indicates a probable branch.
22697
22698 @item -mbase-addresses
22699 @itemx -mno-base-addresses
22700 @opindex mbase-addresses
22701 @opindex mno-base-addresses
22702 Generate (do not generate) code that uses @emph{base addresses}. Using a
22703 base address automatically generates a request (handled by the assembler
22704 and the linker) for a constant to be set up in a global register. The
22705 register is used for one or more base address requests within the range 0
22706 to 255 from the value held in the register. The generally leads to short
22707 and fast code, but the number of different data items that can be
22708 addressed is limited. This means that a program that uses lots of static
22709 data may require @option{-mno-base-addresses}.
22710
22711 @item -msingle-exit
22712 @itemx -mno-single-exit
22713 @opindex msingle-exit
22714 @opindex mno-single-exit
22715 Force (do not force) generated code to have a single exit point in each
22716 function.
22717 @end table
22718
22719 @node MN10300 Options
22720 @subsection MN10300 Options
22721 @cindex MN10300 options
22722
22723 These @option{-m} options are defined for Matsushita MN10300 architectures:
22724
22725 @table @gcctabopt
22726 @item -mmult-bug
22727 @opindex mmult-bug
22728 Generate code to avoid bugs in the multiply instructions for the MN10300
22729 processors. This is the default.
22730
22731 @item -mno-mult-bug
22732 @opindex mno-mult-bug
22733 Do not generate code to avoid bugs in the multiply instructions for the
22734 MN10300 processors.
22735
22736 @item -mam33
22737 @opindex mam33
22738 Generate code using features specific to the AM33 processor.
22739
22740 @item -mno-am33
22741 @opindex mno-am33
22742 Do not generate code using features specific to the AM33 processor. This
22743 is the default.
22744
22745 @item -mam33-2
22746 @opindex mam33-2
22747 Generate code using features specific to the AM33/2.0 processor.
22748
22749 @item -mam34
22750 @opindex mam34
22751 Generate code using features specific to the AM34 processor.
22752
22753 @item -mtune=@var{cpu-type}
22754 @opindex mtune
22755 Use the timing characteristics of the indicated CPU type when
22756 scheduling instructions. This does not change the targeted processor
22757 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22758 @samp{am33-2} or @samp{am34}.
22759
22760 @item -mreturn-pointer-on-d0
22761 @opindex mreturn-pointer-on-d0
22762 When generating a function that returns a pointer, return the pointer
22763 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22764 only in @code{a0}, and attempts to call such functions without a prototype
22765 result in errors. Note that this option is on by default; use
22766 @option{-mno-return-pointer-on-d0} to disable it.
22767
22768 @item -mno-crt0
22769 @opindex mno-crt0
22770 Do not link in the C run-time initialization object file.
22771
22772 @item -mrelax
22773 @opindex mrelax
22774 Indicate to the linker that it should perform a relaxation optimization pass
22775 to shorten branches, calls and absolute memory addresses. This option only
22776 has an effect when used on the command line for the final link step.
22777
22778 This option makes symbolic debugging impossible.
22779
22780 @item -mliw
22781 @opindex mliw
22782 Allow the compiler to generate @emph{Long Instruction Word}
22783 instructions if the target is the @samp{AM33} or later. This is the
22784 default. This option defines the preprocessor macro @code{__LIW__}.
22785
22786 @item -mno-liw
22787 @opindex mno-liw
22788 Do not allow the compiler to generate @emph{Long Instruction Word}
22789 instructions. This option defines the preprocessor macro
22790 @code{__NO_LIW__}.
22791
22792 @item -msetlb
22793 @opindex msetlb
22794 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22795 instructions if the target is the @samp{AM33} or later. This is the
22796 default. This option defines the preprocessor macro @code{__SETLB__}.
22797
22798 @item -mno-setlb
22799 @opindex mno-setlb
22800 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22801 instructions. This option defines the preprocessor macro
22802 @code{__NO_SETLB__}.
22803
22804 @end table
22805
22806 @node Moxie Options
22807 @subsection Moxie Options
22808 @cindex Moxie Options
22809
22810 @table @gcctabopt
22811
22812 @item -meb
22813 @opindex meb
22814 Generate big-endian code. This is the default for @samp{moxie-*-*}
22815 configurations.
22816
22817 @item -mel
22818 @opindex mel
22819 Generate little-endian code.
22820
22821 @item -mmul.x
22822 @opindex mmul.x
22823 Generate mul.x and umul.x instructions. This is the default for
22824 @samp{moxiebox-*-*} configurations.
22825
22826 @item -mno-crt0
22827 @opindex mno-crt0
22828 Do not link in the C run-time initialization object file.
22829
22830 @end table
22831
22832 @node MSP430 Options
22833 @subsection MSP430 Options
22834 @cindex MSP430 Options
22835
22836 These options are defined for the MSP430:
22837
22838 @table @gcctabopt
22839
22840 @item -masm-hex
22841 @opindex masm-hex
22842 Force assembly output to always use hex constants. Normally such
22843 constants are signed decimals, but this option is available for
22844 testsuite and/or aesthetic purposes.
22845
22846 @item -mmcu=
22847 @opindex mmcu=
22848 Select the MCU to target. This is used to create a C preprocessor
22849 symbol based upon the MCU name, converted to upper case and pre- and
22850 post-fixed with @samp{__}. This in turn is used by the
22851 @file{msp430.h} header file to select an MCU-specific supplementary
22852 header file.
22853
22854 The option also sets the ISA to use. If the MCU name is one that is
22855 known to only support the 430 ISA then that is selected, otherwise the
22856 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22857 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22858 name selects the 430X ISA.
22859
22860 In addition an MCU-specific linker script is added to the linker
22861 command line. The script's name is the name of the MCU with
22862 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22863 command line defines the C preprocessor symbol @code{__XXX__} and
22864 cause the linker to search for a script called @file{xxx.ld}.
22865
22866 This option is also passed on to the assembler.
22867
22868 @item -mwarn-mcu
22869 @itemx -mno-warn-mcu
22870 @opindex mwarn-mcu
22871 @opindex mno-warn-mcu
22872 This option enables or disables warnings about conflicts between the
22873 MCU name specified by the @option{-mmcu} option and the ISA set by the
22874 @option{-mcpu} option and/or the hardware multiply support set by the
22875 @option{-mhwmult} option. It also toggles warnings about unrecognized
22876 MCU names. This option is on by default.
22877
22878 @item -mcpu=
22879 @opindex mcpu=
22880 Specifies the ISA to use. Accepted values are @samp{msp430},
22881 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22882 @option{-mmcu=} option should be used to select the ISA.
22883
22884 @item -msim
22885 @opindex msim
22886 Link to the simulator runtime libraries and linker script. Overrides
22887 any scripts that would be selected by the @option{-mmcu=} option.
22888
22889 @item -mlarge
22890 @opindex mlarge
22891 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22892
22893 @item -msmall
22894 @opindex msmall
22895 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22896
22897 @item -mrelax
22898 @opindex mrelax
22899 This option is passed to the assembler and linker, and allows the
22900 linker to perform certain optimizations that cannot be done until
22901 the final link.
22902
22903 @item mhwmult=
22904 @opindex mhwmult=
22905 Describes the type of hardware multiply supported by the target.
22906 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22907 for the original 16-bit-only multiply supported by early MCUs.
22908 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22909 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22910 A value of @samp{auto} can also be given. This tells GCC to deduce
22911 the hardware multiply support based upon the MCU name provided by the
22912 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22913 the MCU name is not recognized then no hardware multiply support is
22914 assumed. @code{auto} is the default setting.
22915
22916 Hardware multiplies are normally performed by calling a library
22917 routine. This saves space in the generated code. When compiling at
22918 @option{-O3} or higher however the hardware multiplier is invoked
22919 inline. This makes for bigger, but faster code.
22920
22921 The hardware multiply routines disable interrupts whilst running and
22922 restore the previous interrupt state when they finish. This makes
22923 them safe to use inside interrupt handlers as well as in normal code.
22924
22925 @item -minrt
22926 @opindex minrt
22927 Enable the use of a minimum runtime environment - no static
22928 initializers or constructors. This is intended for memory-constrained
22929 devices. The compiler includes special symbols in some objects
22930 that tell the linker and runtime which code fragments are required.
22931
22932 @item -mcode-region=
22933 @itemx -mdata-region=
22934 @opindex mcode-region
22935 @opindex mdata-region
22936 These options tell the compiler where to place functions and data that
22937 do not have one of the @code{lower}, @code{upper}, @code{either} or
22938 @code{section} attributes. Possible values are @code{lower},
22939 @code{upper}, @code{either} or @code{any}. The first three behave
22940 like the corresponding attribute. The fourth possible value -
22941 @code{any} - is the default. It leaves placement entirely up to the
22942 linker script and how it assigns the standard sections
22943 (@code{.text}, @code{.data}, etc) to the memory regions.
22944
22945 @item -msilicon-errata=
22946 @opindex msilicon-errata
22947 This option passes on a request to assembler to enable the fixes for
22948 the named silicon errata.
22949
22950 @item -msilicon-errata-warn=
22951 @opindex msilicon-errata-warn
22952 This option passes on a request to the assembler to enable warning
22953 messages when a silicon errata might need to be applied.
22954
22955 @end table
22956
22957 @node NDS32 Options
22958 @subsection NDS32 Options
22959 @cindex NDS32 Options
22960
22961 These options are defined for NDS32 implementations:
22962
22963 @table @gcctabopt
22964
22965 @item -mbig-endian
22966 @opindex mbig-endian
22967 Generate code in big-endian mode.
22968
22969 @item -mlittle-endian
22970 @opindex mlittle-endian
22971 Generate code in little-endian mode.
22972
22973 @item -mreduced-regs
22974 @opindex mreduced-regs
22975 Use reduced-set registers for register allocation.
22976
22977 @item -mfull-regs
22978 @opindex mfull-regs
22979 Use full-set registers for register allocation.
22980
22981 @item -mcmov
22982 @opindex mcmov
22983 Generate conditional move instructions.
22984
22985 @item -mno-cmov
22986 @opindex mno-cmov
22987 Do not generate conditional move instructions.
22988
22989 @item -mext-perf
22990 @opindex mext-perf
22991 Generate performance extension instructions.
22992
22993 @item -mno-ext-perf
22994 @opindex mno-ext-perf
22995 Do not generate performance extension instructions.
22996
22997 @item -mext-perf2
22998 @opindex mext-perf2
22999 Generate performance extension 2 instructions.
23000
23001 @item -mno-ext-perf2
23002 @opindex mno-ext-perf2
23003 Do not generate performance extension 2 instructions.
23004
23005 @item -mext-string
23006 @opindex mext-string
23007 Generate string extension instructions.
23008
23009 @item -mno-ext-string
23010 @opindex mno-ext-string
23011 Do not generate string extension instructions.
23012
23013 @item -mv3push
23014 @opindex mv3push
23015 Generate v3 push25/pop25 instructions.
23016
23017 @item -mno-v3push
23018 @opindex mno-v3push
23019 Do not generate v3 push25/pop25 instructions.
23020
23021 @item -m16-bit
23022 @opindex m16-bit
23023 Generate 16-bit instructions.
23024
23025 @item -mno-16-bit
23026 @opindex mno-16-bit
23027 Do not generate 16-bit instructions.
23028
23029 @item -misr-vector-size=@var{num}
23030 @opindex misr-vector-size
23031 Specify the size of each interrupt vector, which must be 4 or 16.
23032
23033 @item -mcache-block-size=@var{num}
23034 @opindex mcache-block-size
23035 Specify the size of each cache block,
23036 which must be a power of 2 between 4 and 512.
23037
23038 @item -march=@var{arch}
23039 @opindex march
23040 Specify the name of the target architecture.
23041
23042 @item -mcmodel=@var{code-model}
23043 @opindex mcmodel
23044 Set the code model to one of
23045 @table @asis
23046 @item @samp{small}
23047 All the data and read-only data segments must be within 512KB addressing space.
23048 The text segment must be within 16MB addressing space.
23049 @item @samp{medium}
23050 The data segment must be within 512KB while the read-only data segment can be
23051 within 4GB addressing space. The text segment should be still within 16MB
23052 addressing space.
23053 @item @samp{large}
23054 All the text and data segments can be within 4GB addressing space.
23055 @end table
23056
23057 @item -mctor-dtor
23058 @opindex mctor-dtor
23059 Enable constructor/destructor feature.
23060
23061 @item -mrelax
23062 @opindex mrelax
23063 Guide linker to relax instructions.
23064
23065 @end table
23066
23067 @node Nios II Options
23068 @subsection Nios II Options
23069 @cindex Nios II options
23070 @cindex Altera Nios II options
23071
23072 These are the options defined for the Altera Nios II processor.
23073
23074 @table @gcctabopt
23075
23076 @item -G @var{num}
23077 @opindex G
23078 @cindex smaller data references
23079 Put global and static objects less than or equal to @var{num} bytes
23080 into the small data or BSS sections instead of the normal data or BSS
23081 sections. The default value of @var{num} is 8.
23082
23083 @item -mgpopt=@var{option}
23084 @itemx -mgpopt
23085 @itemx -mno-gpopt
23086 @opindex mgpopt
23087 @opindex mno-gpopt
23088 Generate (do not generate) GP-relative accesses. The following
23089 @var{option} names are recognized:
23090
23091 @table @samp
23092
23093 @item none
23094 Do not generate GP-relative accesses.
23095
23096 @item local
23097 Generate GP-relative accesses for small data objects that are not
23098 external, weak, or uninitialized common symbols.
23099 Also use GP-relative addressing for objects that
23100 have been explicitly placed in a small data section via a @code{section}
23101 attribute.
23102
23103 @item global
23104 As for @samp{local}, but also generate GP-relative accesses for
23105 small data objects that are external, weak, or common. If you use this option,
23106 you must ensure that all parts of your program (including libraries) are
23107 compiled with the same @option{-G} setting.
23108
23109 @item data
23110 Generate GP-relative accesses for all data objects in the program. If you
23111 use this option, the entire data and BSS segments
23112 of your program must fit in 64K of memory and you must use an appropriate
23113 linker script to allocate them within the addressable range of the
23114 global pointer.
23115
23116 @item all
23117 Generate GP-relative addresses for function pointers as well as data
23118 pointers. If you use this option, the entire text, data, and BSS segments
23119 of your program must fit in 64K of memory and you must use an appropriate
23120 linker script to allocate them within the addressable range of the
23121 global pointer.
23122
23123 @end table
23124
23125 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23126 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23127
23128 The default is @option{-mgpopt} except when @option{-fpic} or
23129 @option{-fPIC} is specified to generate position-independent code.
23130 Note that the Nios II ABI does not permit GP-relative accesses from
23131 shared libraries.
23132
23133 You may need to specify @option{-mno-gpopt} explicitly when building
23134 programs that include large amounts of small data, including large
23135 GOT data sections. In this case, the 16-bit offset for GP-relative
23136 addressing may not be large enough to allow access to the entire
23137 small data section.
23138
23139 @item -mgprel-sec=@var{regexp}
23140 @opindex mgprel-sec
23141 This option specifies additional section names that can be accessed via
23142 GP-relative addressing. It is most useful in conjunction with
23143 @code{section} attributes on variable declarations
23144 (@pxref{Common Variable Attributes}) and a custom linker script.
23145 The @var{regexp} is a POSIX Extended Regular Expression.
23146
23147 This option does not affect the behavior of the @option{-G} option, and
23148 the specified sections are in addition to the standard @code{.sdata}
23149 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23150
23151 @item -mr0rel-sec=@var{regexp}
23152 @opindex mr0rel-sec
23153 This option specifies names of sections that can be accessed via a
23154 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23155 of the 32-bit address space. It is most useful in conjunction with
23156 @code{section} attributes on variable declarations
23157 (@pxref{Common Variable Attributes}) and a custom linker script.
23158 The @var{regexp} is a POSIX Extended Regular Expression.
23159
23160 In contrast to the use of GP-relative addressing for small data,
23161 zero-based addressing is never generated by default and there are no
23162 conventional section names used in standard linker scripts for sections
23163 in the low or high areas of memory.
23164
23165 @item -mel
23166 @itemx -meb
23167 @opindex mel
23168 @opindex meb
23169 Generate little-endian (default) or big-endian (experimental) code,
23170 respectively.
23171
23172 @item -march=@var{arch}
23173 @opindex march
23174 This specifies the name of the target Nios II architecture. GCC uses this
23175 name to determine what kind of instructions it can emit when generating
23176 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23177
23178 The preprocessor macro @code{__nios2_arch__} is available to programs,
23179 with value 1 or 2, indicating the targeted ISA level.
23180
23181 @item -mbypass-cache
23182 @itemx -mno-bypass-cache
23183 @opindex mno-bypass-cache
23184 @opindex mbypass-cache
23185 Force all load and store instructions to always bypass cache by
23186 using I/O variants of the instructions. The default is not to
23187 bypass the cache.
23188
23189 @item -mno-cache-volatile
23190 @itemx -mcache-volatile
23191 @opindex mcache-volatile
23192 @opindex mno-cache-volatile
23193 Volatile memory access bypass the cache using the I/O variants of
23194 the load and store instructions. The default is not to bypass the cache.
23195
23196 @item -mno-fast-sw-div
23197 @itemx -mfast-sw-div
23198 @opindex mno-fast-sw-div
23199 @opindex mfast-sw-div
23200 Do not use table-based fast divide for small numbers. The default
23201 is to use the fast divide at @option{-O3} and above.
23202
23203 @item -mno-hw-mul
23204 @itemx -mhw-mul
23205 @itemx -mno-hw-mulx
23206 @itemx -mhw-mulx
23207 @itemx -mno-hw-div
23208 @itemx -mhw-div
23209 @opindex mno-hw-mul
23210 @opindex mhw-mul
23211 @opindex mno-hw-mulx
23212 @opindex mhw-mulx
23213 @opindex mno-hw-div
23214 @opindex mhw-div
23215 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23216 instructions by the compiler. The default is to emit @code{mul}
23217 and not emit @code{div} and @code{mulx}.
23218
23219 @item -mbmx
23220 @itemx -mno-bmx
23221 @itemx -mcdx
23222 @itemx -mno-cdx
23223 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23224 CDX (code density) instructions. Enabling these instructions also
23225 requires @option{-march=r2}. Since these instructions are optional
23226 extensions to the R2 architecture, the default is not to emit them.
23227
23228 @item -mcustom-@var{insn}=@var{N}
23229 @itemx -mno-custom-@var{insn}
23230 @opindex mcustom-@var{insn}
23231 @opindex mno-custom-@var{insn}
23232 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23233 custom instruction with encoding @var{N} when generating code that uses
23234 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23235 instruction 253 for single-precision floating-point add operations instead
23236 of the default behavior of using a library call.
23237
23238 The following values of @var{insn} are supported. Except as otherwise
23239 noted, floating-point operations are expected to be implemented with
23240 normal IEEE 754 semantics and correspond directly to the C operators or the
23241 equivalent GCC built-in functions (@pxref{Other Builtins}).
23242
23243 Single-precision floating point:
23244 @table @asis
23245
23246 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23247 Binary arithmetic operations.
23248
23249 @item @samp{fnegs}
23250 Unary negation.
23251
23252 @item @samp{fabss}
23253 Unary absolute value.
23254
23255 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23256 Comparison operations.
23257
23258 @item @samp{fmins}, @samp{fmaxs}
23259 Floating-point minimum and maximum. These instructions are only
23260 generated if @option{-ffinite-math-only} is specified.
23261
23262 @item @samp{fsqrts}
23263 Unary square root operation.
23264
23265 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23266 Floating-point trigonometric and exponential functions. These instructions
23267 are only generated if @option{-funsafe-math-optimizations} is also specified.
23268
23269 @end table
23270
23271 Double-precision floating point:
23272 @table @asis
23273
23274 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23275 Binary arithmetic operations.
23276
23277 @item @samp{fnegd}
23278 Unary negation.
23279
23280 @item @samp{fabsd}
23281 Unary absolute value.
23282
23283 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23284 Comparison operations.
23285
23286 @item @samp{fmind}, @samp{fmaxd}
23287 Double-precision minimum and maximum. These instructions are only
23288 generated if @option{-ffinite-math-only} is specified.
23289
23290 @item @samp{fsqrtd}
23291 Unary square root operation.
23292
23293 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23294 Double-precision trigonometric and exponential functions. These instructions
23295 are only generated if @option{-funsafe-math-optimizations} is also specified.
23296
23297 @end table
23298
23299 Conversions:
23300 @table @asis
23301 @item @samp{fextsd}
23302 Conversion from single precision to double precision.
23303
23304 @item @samp{ftruncds}
23305 Conversion from double precision to single precision.
23306
23307 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23308 Conversion from floating point to signed or unsigned integer types, with
23309 truncation towards zero.
23310
23311 @item @samp{round}
23312 Conversion from single-precision floating point to signed integer,
23313 rounding to the nearest integer and ties away from zero.
23314 This corresponds to the @code{__builtin_lroundf} function when
23315 @option{-fno-math-errno} is used.
23316
23317 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23318 Conversion from signed or unsigned integer types to floating-point types.
23319
23320 @end table
23321
23322 In addition, all of the following transfer instructions for internal
23323 registers X and Y must be provided to use any of the double-precision
23324 floating-point instructions. Custom instructions taking two
23325 double-precision source operands expect the first operand in the
23326 64-bit register X. The other operand (or only operand of a unary
23327 operation) is given to the custom arithmetic instruction with the
23328 least significant half in source register @var{src1} and the most
23329 significant half in @var{src2}. A custom instruction that returns a
23330 double-precision result returns the most significant 32 bits in the
23331 destination register and the other half in 32-bit register Y.
23332 GCC automatically generates the necessary code sequences to write
23333 register X and/or read register Y when double-precision floating-point
23334 instructions are used.
23335
23336 @table @asis
23337
23338 @item @samp{fwrx}
23339 Write @var{src1} into the least significant half of X and @var{src2} into
23340 the most significant half of X.
23341
23342 @item @samp{fwry}
23343 Write @var{src1} into Y.
23344
23345 @item @samp{frdxhi}, @samp{frdxlo}
23346 Read the most or least (respectively) significant half of X and store it in
23347 @var{dest}.
23348
23349 @item @samp{frdy}
23350 Read the value of Y and store it into @var{dest}.
23351 @end table
23352
23353 Note that you can gain more local control over generation of Nios II custom
23354 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23355 and @code{target("no-custom-@var{insn}")} function attributes
23356 (@pxref{Function Attributes})
23357 or pragmas (@pxref{Function Specific Option Pragmas}).
23358
23359 @item -mcustom-fpu-cfg=@var{name}
23360 @opindex mcustom-fpu-cfg
23361
23362 This option enables a predefined, named set of custom instruction encodings
23363 (see @option{-mcustom-@var{insn}} above).
23364 Currently, the following sets are defined:
23365
23366 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23367 @gccoptlist{-mcustom-fmuls=252 @gol
23368 -mcustom-fadds=253 @gol
23369 -mcustom-fsubs=254 @gol
23370 -fsingle-precision-constant}
23371
23372 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23373 @gccoptlist{-mcustom-fmuls=252 @gol
23374 -mcustom-fadds=253 @gol
23375 -mcustom-fsubs=254 @gol
23376 -mcustom-fdivs=255 @gol
23377 -fsingle-precision-constant}
23378
23379 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23380 @gccoptlist{-mcustom-floatus=243 @gol
23381 -mcustom-fixsi=244 @gol
23382 -mcustom-floatis=245 @gol
23383 -mcustom-fcmpgts=246 @gol
23384 -mcustom-fcmples=249 @gol
23385 -mcustom-fcmpeqs=250 @gol
23386 -mcustom-fcmpnes=251 @gol
23387 -mcustom-fmuls=252 @gol
23388 -mcustom-fadds=253 @gol
23389 -mcustom-fsubs=254 @gol
23390 -mcustom-fdivs=255 @gol
23391 -fsingle-precision-constant}
23392
23393 Custom instruction assignments given by individual
23394 @option{-mcustom-@var{insn}=} options override those given by
23395 @option{-mcustom-fpu-cfg=}, regardless of the
23396 order of the options on the command line.
23397
23398 Note that you can gain more local control over selection of a FPU
23399 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23400 function attribute (@pxref{Function Attributes})
23401 or pragma (@pxref{Function Specific Option Pragmas}).
23402
23403 @end table
23404
23405 These additional @samp{-m} options are available for the Altera Nios II
23406 ELF (bare-metal) target:
23407
23408 @table @gcctabopt
23409
23410 @item -mhal
23411 @opindex mhal
23412 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23413 startup and termination code, and is typically used in conjunction with
23414 @option{-msys-crt0=} to specify the location of the alternate startup code
23415 provided by the HAL BSP.
23416
23417 @item -msmallc
23418 @opindex msmallc
23419 Link with a limited version of the C library, @option{-lsmallc}, rather than
23420 Newlib.
23421
23422 @item -msys-crt0=@var{startfile}
23423 @opindex msys-crt0
23424 @var{startfile} is the file name of the startfile (crt0) to use
23425 when linking. This option is only useful in conjunction with @option{-mhal}.
23426
23427 @item -msys-lib=@var{systemlib}
23428 @opindex msys-lib
23429 @var{systemlib} is the library name of the library that provides
23430 low-level system calls required by the C library,
23431 e.g.@: @code{read} and @code{write}.
23432 This option is typically used to link with a library provided by a HAL BSP.
23433
23434 @end table
23435
23436 @node Nvidia PTX Options
23437 @subsection Nvidia PTX Options
23438 @cindex Nvidia PTX options
23439 @cindex nvptx options
23440
23441 These options are defined for Nvidia PTX:
23442
23443 @table @gcctabopt
23444
23445 @item -m32
23446 @itemx -m64
23447 @opindex m32
23448 @opindex m64
23449 Generate code for 32-bit or 64-bit ABI.
23450
23451 @item -misa=@var{ISA-string}
23452 @opindex march
23453 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23454 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23455 @samp{sm_35}. The default ISA is sm_30.
23456
23457 @item -mmainkernel
23458 @opindex mmainkernel
23459 Link in code for a __main kernel. This is for stand-alone instead of
23460 offloading execution.
23461
23462 @item -moptimize
23463 @opindex moptimize
23464 Apply partitioned execution optimizations. This is the default when any
23465 level of optimization is selected.
23466
23467 @item -msoft-stack
23468 @opindex msoft-stack
23469 Generate code that does not use @code{.local} memory
23470 directly for stack storage. Instead, a per-warp stack pointer is
23471 maintained explicitly. This enables variable-length stack allocation (with
23472 variable-length arrays or @code{alloca}), and when global memory is used for
23473 underlying storage, makes it possible to access automatic variables from other
23474 threads, or with atomic instructions. This code generation variant is used
23475 for OpenMP offloading, but the option is exposed on its own for the purpose
23476 of testing the compiler; to generate code suitable for linking into programs
23477 using OpenMP offloading, use option @option{-mgomp}.
23478
23479 @item -muniform-simt
23480 @opindex muniform-simt
23481 Switch to code generation variant that allows to execute all threads in each
23482 warp, while maintaining memory state and side effects as if only one thread
23483 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23484 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23485 current lane index equals the master lane index), and the register being
23486 assigned is copied via a shuffle instruction from the master lane. Outside of
23487 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23488 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23489 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23490 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23491 with current lane index to compute the master lane index.
23492
23493 @item -mgomp
23494 @opindex mgomp
23495 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23496 @option{-muniform-simt} options, and selects corresponding multilib variant.
23497
23498 @end table
23499
23500 @node OpenRISC Options
23501 @subsection OpenRISC Options
23502 @cindex OpenRISC Options
23503
23504 These options are defined for OpenRISC:
23505
23506 @table @gcctabopt
23507
23508 @item -mboard=@var{name}
23509 @opindex mboard
23510 Configure a board specific runtime. This will be passed to the linker for
23511 newlib board library linking. The default is @code{or1ksim}.
23512
23513 @item -mnewlib
23514 @opindex mnewlib
23515 For compatibility, it's always newlib for elf now.
23516
23517 @item -mhard-div
23518 @opindex mhard-div
23519 Generate code for hardware which supports divide instructions. This is the
23520 default.
23521
23522 @item -mhard-mul
23523 @opindex mhard-mul
23524 Generate code for hardware which supports multiply instructions. This is the
23525 default.
23526
23527 @item -mcmov
23528 @opindex mcmov
23529 Generate code for hardware which supports the conditional move (@code{l.cmov})
23530 instruction.
23531
23532 @item -mror
23533 @opindex mror
23534 Generate code for hardware which supports rotate right instructions.
23535
23536 @item -msext
23537 @opindex msext
23538 Generate code for hardware which supports sign-extension instructions.
23539
23540 @item -msfimm
23541 @opindex msfimm
23542 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23543 instructions.
23544
23545 @item -mshftimm
23546 @opindex mshftimm
23547 Generate code for hardware which supports shift immediate related instructions
23548 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23549 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23550 also be specified.
23551
23552 @item -msoft-div
23553 @opindex msoft-div
23554 Generate code for hardware which requires divide instruction emulation.
23555
23556 @item -msoft-mul
23557 @opindex msoft-mul
23558 Generate code for hardware which requires multiply instruction emulation.
23559
23560 @end table
23561
23562 @node PDP-11 Options
23563 @subsection PDP-11 Options
23564 @cindex PDP-11 Options
23565
23566 These options are defined for the PDP-11:
23567
23568 @table @gcctabopt
23569 @item -mfpu
23570 @opindex mfpu
23571 Use hardware FPP floating point. This is the default. (FIS floating
23572 point on the PDP-11/40 is not supported.) Implies -m45.
23573
23574 @item -msoft-float
23575 @opindex msoft-float
23576 Do not use hardware floating point.
23577
23578 @item -mac0
23579 @opindex mac0
23580 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23581
23582 @item -mno-ac0
23583 @opindex mno-ac0
23584 Return floating-point results in memory. This is the default.
23585
23586 @item -m40
23587 @opindex m40
23588 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23589
23590 @item -m45
23591 @opindex m45
23592 Generate code for a PDP-11/45. This is the default.
23593
23594 @item -m10
23595 @opindex m10
23596 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23597
23598 @item -mint16
23599 @itemx -mno-int32
23600 @opindex mint16
23601 @opindex mno-int32
23602 Use 16-bit @code{int}. This is the default.
23603
23604 @item -mint32
23605 @itemx -mno-int16
23606 @opindex mint32
23607 @opindex mno-int16
23608 Use 32-bit @code{int}.
23609
23610 @item -msplit
23611 @opindex msplit
23612 Target has split instruction and data space. Implies -m45.
23613
23614 @item -munix-asm
23615 @opindex munix-asm
23616 Use Unix assembler syntax.
23617
23618 @item -mdec-asm
23619 @opindex mdec-asm
23620 Use DEC assembler syntax.
23621
23622 @item -mgnu-asm
23623 @opindex mgnu-asm
23624 Use GNU assembler syntax. This is the default.
23625
23626 @item -mlra
23627 @opindex mlra
23628 Use the new LRA register allocator. By default, the old ``reload''
23629 allocator is used.
23630 @end table
23631
23632 @node picoChip Options
23633 @subsection picoChip Options
23634 @cindex picoChip options
23635
23636 These @samp{-m} options are defined for picoChip implementations:
23637
23638 @table @gcctabopt
23639
23640 @item -mae=@var{ae_type}
23641 @opindex mcpu
23642 Set the instruction set, register set, and instruction scheduling
23643 parameters for array element type @var{ae_type}. Supported values
23644 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23645
23646 @option{-mae=ANY} selects a completely generic AE type. Code
23647 generated with this option runs on any of the other AE types. The
23648 code is not as efficient as it would be if compiled for a specific
23649 AE type, and some types of operation (e.g., multiplication) do not
23650 work properly on all types of AE.
23651
23652 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23653 for compiled code, and is the default.
23654
23655 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23656 option may suffer from poor performance of byte (char) manipulation,
23657 since the DSP AE does not provide hardware support for byte load/stores.
23658
23659 @item -msymbol-as-address
23660 Enable the compiler to directly use a symbol name as an address in a
23661 load/store instruction, without first loading it into a
23662 register. Typically, the use of this option generates larger
23663 programs, which run faster than when the option isn't used. However, the
23664 results vary from program to program, so it is left as a user option,
23665 rather than being permanently enabled.
23666
23667 @item -mno-inefficient-warnings
23668 Disables warnings about the generation of inefficient code. These
23669 warnings can be generated, for example, when compiling code that
23670 performs byte-level memory operations on the MAC AE type. The MAC AE has
23671 no hardware support for byte-level memory operations, so all byte
23672 load/stores must be synthesized from word load/store operations. This is
23673 inefficient and a warning is generated to indicate
23674 that you should rewrite the code to avoid byte operations, or to target
23675 an AE type that has the necessary hardware support. This option disables
23676 these warnings.
23677
23678 @end table
23679
23680 @node PowerPC Options
23681 @subsection PowerPC Options
23682 @cindex PowerPC options
23683
23684 These are listed under @xref{RS/6000 and PowerPC Options}.
23685
23686 @node RISC-V Options
23687 @subsection RISC-V Options
23688 @cindex RISC-V Options
23689
23690 These command-line options are defined for RISC-V targets:
23691
23692 @table @gcctabopt
23693 @item -mbranch-cost=@var{n}
23694 @opindex mbranch-cost
23695 Set the cost of branches to roughly @var{n} instructions.
23696
23697 @item -mplt
23698 @itemx -mno-plt
23699 @opindex plt
23700 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23701 non-PIC. The default is @option{-mplt}.
23702
23703 @item -mabi=@var{ABI-string}
23704 @opindex mabi
23705 Specify integer and floating-point calling convention. @var{ABI-string}
23706 contains two parts: the size of integer types and the registers used for
23707 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23708 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23709 32-bit), and that floating-point values up to 64 bits wide are passed in F
23710 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23711 allows the compiler to generate code that uses the F and D extensions but only
23712 allows floating-point values up to 32 bits long to be passed in registers; or
23713 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23714 passed in registers.
23715
23716 The default for this argument is system dependent, users who want a specific
23717 calling convention should specify one explicitly. The valid calling
23718 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23719 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23720 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23721 invalid because the ABI requires 64-bit values be passed in F registers, but F
23722 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23723 only be used with the @samp{rv32e} architecture. This ABI is not well
23724 specified at present, and is subject to change.
23725
23726 @item -mfdiv
23727 @itemx -mno-fdiv
23728 @opindex mfdiv
23729 Do or don't use hardware floating-point divide and square root instructions.
23730 This requires the F or D extensions for floating-point registers. The default
23731 is to use them if the specified architecture has these instructions.
23732
23733 @item -mdiv
23734 @itemx -mno-div
23735 @opindex mdiv
23736 Do or don't use hardware instructions for integer division. This requires the
23737 M extension. The default is to use them if the specified architecture has
23738 these instructions.
23739
23740 @item -march=@var{ISA-string}
23741 @opindex march
23742 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23743 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23744 @samp{rv32imaf}.
23745
23746 @item -mtune=@var{processor-string}
23747 @opindex mtune
23748 Optimize the output for the given processor, specified by microarchitecture
23749 name.
23750
23751 @item -mpreferred-stack-boundary=@var{num}
23752 @opindex mpreferred-stack-boundary
23753 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23754 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23755 the default is 4 (16 bytes or 128-bits).
23756
23757 @strong{Warning:} If you use this switch, then you must build all modules with
23758 the same value, including any libraries. This includes the system libraries
23759 and startup modules.
23760
23761 @item -msmall-data-limit=@var{n}
23762 @opindex msmall-data-limit
23763 Put global and static data smaller than @var{n} bytes into a special section
23764 (on some targets).
23765
23766 @item -msave-restore
23767 @itemx -mno-save-restore
23768 @opindex msave-restore
23769 Do or don't use smaller but slower prologue and epilogue code that uses
23770 library function calls. The default is to use fast inline prologues and
23771 epilogues.
23772
23773 @item -mstrict-align
23774 @itemx -mno-strict-align
23775 @opindex mstrict-align
23776 Do not or do generate unaligned memory accesses. The default is set depending
23777 on whether the processor we are optimizing for supports fast unaligned access
23778 or not.
23779
23780 @item -mcmodel=medlow
23781 @opindex mcmodel=medlow
23782 Generate code for the medium-low code model. The program and its statically
23783 defined symbols must lie within a single 2 GiB address range and must lie
23784 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23785 statically or dynamically linked. This is the default code model.
23786
23787 @item -mcmodel=medany
23788 @opindex mcmodel=medany
23789 Generate code for the medium-any code model. The program and its statically
23790 defined symbols must be within any single 2 GiB address range. Programs can be
23791 statically or dynamically linked.
23792
23793 @item -mexplicit-relocs
23794 @itemx -mno-exlicit-relocs
23795 Use or do not use assembler relocation operators when dealing with symbolic
23796 addresses. The alternative is to use assembler macros instead, which may
23797 limit optimization.
23798
23799 @item -mrelax
23800 @itemx -mno-relax
23801 Take advantage of linker relaxations to reduce the number of instructions
23802 required to materialize symbol addresses. The default is to take advantage of
23803 linker relaxations.
23804
23805 @end table
23806
23807 @node RL78 Options
23808 @subsection RL78 Options
23809 @cindex RL78 Options
23810
23811 @table @gcctabopt
23812
23813 @item -msim
23814 @opindex msim
23815 Links in additional target libraries to support operation within a
23816 simulator.
23817
23818 @item -mmul=none
23819 @itemx -mmul=g10
23820 @itemx -mmul=g13
23821 @itemx -mmul=g14
23822 @itemx -mmul=rl78
23823 @opindex mmul
23824 Specifies the type of hardware multiplication and division support to
23825 be used. The simplest is @code{none}, which uses software for both
23826 multiplication and division. This is the default. The @code{g13}
23827 value is for the hardware multiply/divide peripheral found on the
23828 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23829 the multiplication and division instructions supported by the RL78/G14
23830 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23831 the value @code{mg10} is an alias for @code{none}.
23832
23833 In addition a C preprocessor macro is defined, based upon the setting
23834 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23835 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23836
23837 @item -mcpu=g10
23838 @itemx -mcpu=g13
23839 @itemx -mcpu=g14
23840 @itemx -mcpu=rl78
23841 @opindex mcpu
23842 Specifies the RL78 core to target. The default is the G14 core, also
23843 known as an S3 core or just RL78. The G13 or S2 core does not have
23844 multiply or divide instructions, instead it uses a hardware peripheral
23845 for these operations. The G10 or S1 core does not have register
23846 banks, so it uses a different calling convention.
23847
23848 If this option is set it also selects the type of hardware multiply
23849 support to use, unless this is overridden by an explicit
23850 @option{-mmul=none} option on the command line. Thus specifying
23851 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23852 peripheral and specifying @option{-mcpu=g10} disables the use of
23853 hardware multiplications altogether.
23854
23855 Note, although the RL78/G14 core is the default target, specifying
23856 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23857 change the behavior of the toolchain since it also enables G14
23858 hardware multiply support. If these options are not specified on the
23859 command line then software multiplication routines will be used even
23860 though the code targets the RL78 core. This is for backwards
23861 compatibility with older toolchains which did not have hardware
23862 multiply and divide support.
23863
23864 In addition a C preprocessor macro is defined, based upon the setting
23865 of this option. Possible values are: @code{__RL78_G10__},
23866 @code{__RL78_G13__} or @code{__RL78_G14__}.
23867
23868 @item -mg10
23869 @itemx -mg13
23870 @itemx -mg14
23871 @itemx -mrl78
23872 @opindex mg10
23873 @opindex mg13
23874 @opindex mg14
23875 @opindex mrl78
23876 These are aliases for the corresponding @option{-mcpu=} option. They
23877 are provided for backwards compatibility.
23878
23879 @item -mallregs
23880 @opindex mallregs
23881 Allow the compiler to use all of the available registers. By default
23882 registers @code{r24..r31} are reserved for use in interrupt handlers.
23883 With this option enabled these registers can be used in ordinary
23884 functions as well.
23885
23886 @item -m64bit-doubles
23887 @itemx -m32bit-doubles
23888 @opindex m64bit-doubles
23889 @opindex m32bit-doubles
23890 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23891 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23892 @option{-m32bit-doubles}.
23893
23894 @item -msave-mduc-in-interrupts
23895 @itemx -mno-save-mduc-in-interrupts
23896 @opindex msave-mduc-in-interrupts
23897 @opindex mno-save-mduc-in-interrupts
23898 Specifies that interrupt handler functions should preserve the
23899 MDUC registers. This is only necessary if normal code might use
23900 the MDUC registers, for example because it performs multiplication
23901 and division operations. The default is to ignore the MDUC registers
23902 as this makes the interrupt handlers faster. The target option -mg13
23903 needs to be passed for this to work as this feature is only available
23904 on the G13 target (S2 core). The MDUC registers will only be saved
23905 if the interrupt handler performs a multiplication or division
23906 operation or it calls another function.
23907
23908 @end table
23909
23910 @node RS/6000 and PowerPC Options
23911 @subsection IBM RS/6000 and PowerPC Options
23912 @cindex RS/6000 and PowerPC Options
23913 @cindex IBM RS/6000 and PowerPC Options
23914
23915 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23916 @table @gcctabopt
23917 @item -mpowerpc-gpopt
23918 @itemx -mno-powerpc-gpopt
23919 @itemx -mpowerpc-gfxopt
23920 @itemx -mno-powerpc-gfxopt
23921 @need 800
23922 @itemx -mpowerpc64
23923 @itemx -mno-powerpc64
23924 @itemx -mmfcrf
23925 @itemx -mno-mfcrf
23926 @itemx -mpopcntb
23927 @itemx -mno-popcntb
23928 @itemx -mpopcntd
23929 @itemx -mno-popcntd
23930 @itemx -mfprnd
23931 @itemx -mno-fprnd
23932 @need 800
23933 @itemx -mcmpb
23934 @itemx -mno-cmpb
23935 @itemx -mmfpgpr
23936 @itemx -mno-mfpgpr
23937 @itemx -mhard-dfp
23938 @itemx -mno-hard-dfp
23939 @opindex mpowerpc-gpopt
23940 @opindex mno-powerpc-gpopt
23941 @opindex mpowerpc-gfxopt
23942 @opindex mno-powerpc-gfxopt
23943 @opindex mpowerpc64
23944 @opindex mno-powerpc64
23945 @opindex mmfcrf
23946 @opindex mno-mfcrf
23947 @opindex mpopcntb
23948 @opindex mno-popcntb
23949 @opindex mpopcntd
23950 @opindex mno-popcntd
23951 @opindex mfprnd
23952 @opindex mno-fprnd
23953 @opindex mcmpb
23954 @opindex mno-cmpb
23955 @opindex mmfpgpr
23956 @opindex mno-mfpgpr
23957 @opindex mhard-dfp
23958 @opindex mno-hard-dfp
23959 You use these options to specify which instructions are available on the
23960 processor you are using. The default value of these options is
23961 determined when configuring GCC@. Specifying the
23962 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23963 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23964 rather than the options listed above.
23965
23966 Specifying @option{-mpowerpc-gpopt} allows
23967 GCC to use the optional PowerPC architecture instructions in the
23968 General Purpose group, including floating-point square root. Specifying
23969 @option{-mpowerpc-gfxopt} allows GCC to
23970 use the optional PowerPC architecture instructions in the Graphics
23971 group, including floating-point select.
23972
23973 The @option{-mmfcrf} option allows GCC to generate the move from
23974 condition register field instruction implemented on the POWER4
23975 processor and other processors that support the PowerPC V2.01
23976 architecture.
23977 The @option{-mpopcntb} option allows GCC to generate the popcount and
23978 double-precision FP reciprocal estimate instruction implemented on the
23979 POWER5 processor and other processors that support the PowerPC V2.02
23980 architecture.
23981 The @option{-mpopcntd} option allows GCC to generate the popcount
23982 instruction implemented on the POWER7 processor and other processors
23983 that support the PowerPC V2.06 architecture.
23984 The @option{-mfprnd} option allows GCC to generate the FP round to
23985 integer instructions implemented on the POWER5+ processor and other
23986 processors that support the PowerPC V2.03 architecture.
23987 The @option{-mcmpb} option allows GCC to generate the compare bytes
23988 instruction implemented on the POWER6 processor and other processors
23989 that support the PowerPC V2.05 architecture.
23990 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23991 general-purpose register instructions implemented on the POWER6X
23992 processor and other processors that support the extended PowerPC V2.05
23993 architecture.
23994 The @option{-mhard-dfp} option allows GCC to generate the decimal
23995 floating-point instructions implemented on some POWER processors.
23996
23997 The @option{-mpowerpc64} option allows GCC to generate the additional
23998 64-bit instructions that are found in the full PowerPC64 architecture
23999 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24000 @option{-mno-powerpc64}.
24001
24002 @item -mcpu=@var{cpu_type}
24003 @opindex mcpu
24004 Set architecture type, register usage, and
24005 instruction scheduling parameters for machine type @var{cpu_type}.
24006 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24007 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24008 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24009 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24010 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24011 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24012 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24013 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24014 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24015 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24016 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24017 @samp{rs64}, and @samp{native}.
24018
24019 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24020 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24021 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24022 architecture machine types, with an appropriate, generic processor
24023 model assumed for scheduling purposes.
24024
24025 Specifying @samp{native} as cpu type detects and selects the
24026 architecture option that corresponds to the host processor of the
24027 system performing the compilation.
24028 @option{-mcpu=native} has no effect if GCC does not recognize the
24029 processor.
24030
24031 The other options specify a specific processor. Code generated under
24032 those options runs best on that processor, and may not run at all on
24033 others.
24034
24035 The @option{-mcpu} options automatically enable or disable the
24036 following options:
24037
24038 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24039 -mpopcntb -mpopcntd -mpowerpc64 @gol
24040 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24041 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24042 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24043 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24044
24045 The particular options set for any particular CPU varies between
24046 compiler versions, depending on what setting seems to produce optimal
24047 code for that CPU; it doesn't necessarily reflect the actual hardware's
24048 capabilities. If you wish to set an individual option to a particular
24049 value, you may specify it after the @option{-mcpu} option, like
24050 @option{-mcpu=970 -mno-altivec}.
24051
24052 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24053 not enabled or disabled by the @option{-mcpu} option at present because
24054 AIX does not have full support for these options. You may still
24055 enable or disable them individually if you're sure it'll work in your
24056 environment.
24057
24058 @item -mtune=@var{cpu_type}
24059 @opindex mtune
24060 Set the instruction scheduling parameters for machine type
24061 @var{cpu_type}, but do not set the architecture type or register usage,
24062 as @option{-mcpu=@var{cpu_type}} does. The same
24063 values for @var{cpu_type} are used for @option{-mtune} as for
24064 @option{-mcpu}. If both are specified, the code generated uses the
24065 architecture and registers set by @option{-mcpu}, but the
24066 scheduling parameters set by @option{-mtune}.
24067
24068 @item -mcmodel=small
24069 @opindex mcmodel=small
24070 Generate PowerPC64 code for the small model: The TOC is limited to
24071 64k.
24072
24073 @item -mcmodel=medium
24074 @opindex mcmodel=medium
24075 Generate PowerPC64 code for the medium model: The TOC and other static
24076 data may be up to a total of 4G in size. This is the default for 64-bit
24077 Linux.
24078
24079 @item -mcmodel=large
24080 @opindex mcmodel=large
24081 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24082 in size. Other data and code is only limited by the 64-bit address
24083 space.
24084
24085 @item -maltivec
24086 @itemx -mno-altivec
24087 @opindex maltivec
24088 @opindex mno-altivec
24089 Generate code that uses (does not use) AltiVec instructions, and also
24090 enable the use of built-in functions that allow more direct access to
24091 the AltiVec instruction set. You may also need to set
24092 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24093 enhancements.
24094
24095 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24096 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24097 match array element order corresponding to the endianness of the
24098 target. That is, element zero identifies the leftmost element in a
24099 vector register when targeting a big-endian platform, and identifies
24100 the rightmost element in a vector register when targeting a
24101 little-endian platform.
24102
24103 @item -mvrsave
24104 @itemx -mno-vrsave
24105 @opindex mvrsave
24106 @opindex mno-vrsave
24107 Generate VRSAVE instructions when generating AltiVec code.
24108
24109 @item -msecure-plt
24110 @opindex msecure-plt
24111 Generate code that allows @command{ld} and @command{ld.so}
24112 to build executables and shared
24113 libraries with non-executable @code{.plt} and @code{.got} sections.
24114 This is a PowerPC
24115 32-bit SYSV ABI option.
24116
24117 @item -mbss-plt
24118 @opindex mbss-plt
24119 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24120 fills in, and
24121 requires @code{.plt} and @code{.got}
24122 sections that are both writable and executable.
24123 This is a PowerPC 32-bit SYSV ABI option.
24124
24125 @item -misel
24126 @itemx -mno-isel
24127 @opindex misel
24128 @opindex mno-isel
24129 This switch enables or disables the generation of ISEL instructions.
24130
24131 @item -mvsx
24132 @itemx -mno-vsx
24133 @opindex mvsx
24134 @opindex mno-vsx
24135 Generate code that uses (does not use) vector/scalar (VSX)
24136 instructions, and also enable the use of built-in functions that allow
24137 more direct access to the VSX instruction set.
24138
24139 @item -mcrypto
24140 @itemx -mno-crypto
24141 @opindex mcrypto
24142 @opindex mno-crypto
24143 Enable the use (disable) of the built-in functions that allow direct
24144 access to the cryptographic instructions that were added in version
24145 2.07 of the PowerPC ISA.
24146
24147 @item -mhtm
24148 @itemx -mno-htm
24149 @opindex mhtm
24150 @opindex mno-htm
24151 Enable (disable) the use of the built-in functions that allow direct
24152 access to the Hardware Transactional Memory (HTM) instructions that
24153 were added in version 2.07 of the PowerPC ISA.
24154
24155 @item -mpower8-fusion
24156 @itemx -mno-power8-fusion
24157 @opindex mpower8-fusion
24158 @opindex mno-power8-fusion
24159 Generate code that keeps (does not keeps) some integer operations
24160 adjacent so that the instructions can be fused together on power8 and
24161 later processors.
24162
24163 @item -mpower8-vector
24164 @itemx -mno-power8-vector
24165 @opindex mpower8-vector
24166 @opindex mno-power8-vector
24167 Generate code that uses (does not use) the vector and scalar
24168 instructions that were added in version 2.07 of the PowerPC ISA. Also
24169 enable the use of built-in functions that allow more direct access to
24170 the vector instructions.
24171
24172 @item -mquad-memory
24173 @itemx -mno-quad-memory
24174 @opindex mquad-memory
24175 @opindex mno-quad-memory
24176 Generate code that uses (does not use) the non-atomic quad word memory
24177 instructions. The @option{-mquad-memory} option requires use of
24178 64-bit mode.
24179
24180 @item -mquad-memory-atomic
24181 @itemx -mno-quad-memory-atomic
24182 @opindex mquad-memory-atomic
24183 @opindex mno-quad-memory-atomic
24184 Generate code that uses (does not use) the atomic quad word memory
24185 instructions. The @option{-mquad-memory-atomic} option requires use of
24186 64-bit mode.
24187
24188 @item -mfloat128
24189 @itemx -mno-float128
24190 @opindex mfloat128
24191 @opindex mno-float128
24192 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24193 and use either software emulation for IEEE 128-bit floating point or
24194 hardware instructions.
24195
24196 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24197 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24198 use the IEEE 128-bit floating point support. The IEEE 128-bit
24199 floating point support only works on PowerPC Linux systems.
24200
24201 The default for @option{-mfloat128} is enabled on PowerPC Linux
24202 systems using the VSX instruction set, and disabled on other systems.
24203
24204 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24205 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24206 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24207 floating point instructions. Otherwise, if you do not specify to
24208 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24209 system, IEEE 128-bit floating point will be done with software
24210 emulation.
24211
24212 @item -mfloat128-hardware
24213 @itemx -mno-float128-hardware
24214 @opindex mfloat128-hardware
24215 @opindex mno-float128-hardware
24216 Enable/disable using ISA 3.0 hardware instructions to support the
24217 @var{__float128} data type.
24218
24219 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24220 Linux systems using the ISA 3.0 instruction set, and disabled on other
24221 systems.
24222
24223 @item -m32
24224 @itemx -m64
24225 @opindex m32
24226 @opindex m64
24227 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24228 targets (including GNU/Linux). The 32-bit environment sets int, long
24229 and pointer to 32 bits and generates code that runs on any PowerPC
24230 variant. The 64-bit environment sets int to 32 bits and long and
24231 pointer to 64 bits, and generates code for PowerPC64, as for
24232 @option{-mpowerpc64}.
24233
24234 @item -mfull-toc
24235 @itemx -mno-fp-in-toc
24236 @itemx -mno-sum-in-toc
24237 @itemx -mminimal-toc
24238 @opindex mfull-toc
24239 @opindex mno-fp-in-toc
24240 @opindex mno-sum-in-toc
24241 @opindex mminimal-toc
24242 Modify generation of the TOC (Table Of Contents), which is created for
24243 every executable file. The @option{-mfull-toc} option is selected by
24244 default. In that case, GCC allocates at least one TOC entry for
24245 each unique non-automatic variable reference in your program. GCC
24246 also places floating-point constants in the TOC@. However, only
24247 16,384 entries are available in the TOC@.
24248
24249 If you receive a linker error message that saying you have overflowed
24250 the available TOC space, you can reduce the amount of TOC space used
24251 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24252 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24253 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24254 generate code to calculate the sum of an address and a constant at
24255 run time instead of putting that sum into the TOC@. You may specify one
24256 or both of these options. Each causes GCC to produce very slightly
24257 slower and larger code at the expense of conserving TOC space.
24258
24259 If you still run out of space in the TOC even when you specify both of
24260 these options, specify @option{-mminimal-toc} instead. This option causes
24261 GCC to make only one TOC entry for every file. When you specify this
24262 option, GCC produces code that is slower and larger but which
24263 uses extremely little TOC space. You may wish to use this option
24264 only on files that contain less frequently-executed code.
24265
24266 @item -maix64
24267 @itemx -maix32
24268 @opindex maix64
24269 @opindex maix32
24270 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24271 @code{long} type, and the infrastructure needed to support them.
24272 Specifying @option{-maix64} implies @option{-mpowerpc64},
24273 while @option{-maix32} disables the 64-bit ABI and
24274 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24275
24276 @item -mxl-compat
24277 @itemx -mno-xl-compat
24278 @opindex mxl-compat
24279 @opindex mno-xl-compat
24280 Produce code that conforms more closely to IBM XL compiler semantics
24281 when using AIX-compatible ABI@. Pass floating-point arguments to
24282 prototyped functions beyond the register save area (RSA) on the stack
24283 in addition to argument FPRs. Do not assume that most significant
24284 double in 128-bit long double value is properly rounded when comparing
24285 values and converting to double. Use XL symbol names for long double
24286 support routines.
24287
24288 The AIX calling convention was extended but not initially documented to
24289 handle an obscure K&R C case of calling a function that takes the
24290 address of its arguments with fewer arguments than declared. IBM XL
24291 compilers access floating-point arguments that do not fit in the
24292 RSA from the stack when a subroutine is compiled without
24293 optimization. Because always storing floating-point arguments on the
24294 stack is inefficient and rarely needed, this option is not enabled by
24295 default and only is necessary when calling subroutines compiled by IBM
24296 XL compilers without optimization.
24297
24298 @item -mpe
24299 @opindex mpe
24300 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24301 application written to use message passing with special startup code to
24302 enable the application to run. The system must have PE installed in the
24303 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24304 must be overridden with the @option{-specs=} option to specify the
24305 appropriate directory location. The Parallel Environment does not
24306 support threads, so the @option{-mpe} option and the @option{-pthread}
24307 option are incompatible.
24308
24309 @item -malign-natural
24310 @itemx -malign-power
24311 @opindex malign-natural
24312 @opindex malign-power
24313 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24314 @option{-malign-natural} overrides the ABI-defined alignment of larger
24315 types, such as floating-point doubles, on their natural size-based boundary.
24316 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24317 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24318
24319 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24320 is not supported.
24321
24322 @item -msoft-float
24323 @itemx -mhard-float
24324 @opindex msoft-float
24325 @opindex mhard-float
24326 Generate code that does not use (uses) the floating-point register set.
24327 Software floating-point emulation is provided if you use the
24328 @option{-msoft-float} option, and pass the option to GCC when linking.
24329
24330 @item -mmultiple
24331 @itemx -mno-multiple
24332 @opindex mmultiple
24333 @opindex mno-multiple
24334 Generate code that uses (does not use) the load multiple word
24335 instructions and the store multiple word instructions. These
24336 instructions are generated by default on POWER systems, and not
24337 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24338 PowerPC systems, since those instructions do not work when the
24339 processor is in little-endian mode. The exceptions are PPC740 and
24340 PPC750 which permit these instructions in little-endian mode.
24341
24342 @item -mupdate
24343 @itemx -mno-update
24344 @opindex mupdate
24345 @opindex mno-update
24346 Generate code that uses (does not use) the load or store instructions
24347 that update the base register to the address of the calculated memory
24348 location. These instructions are generated by default. If you use
24349 @option{-mno-update}, there is a small window between the time that the
24350 stack pointer is updated and the address of the previous frame is
24351 stored, which means code that walks the stack frame across interrupts or
24352 signals may get corrupted data.
24353
24354 @item -mavoid-indexed-addresses
24355 @itemx -mno-avoid-indexed-addresses
24356 @opindex mavoid-indexed-addresses
24357 @opindex mno-avoid-indexed-addresses
24358 Generate code that tries to avoid (not avoid) the use of indexed load
24359 or store instructions. These instructions can incur a performance
24360 penalty on Power6 processors in certain situations, such as when
24361 stepping through large arrays that cross a 16M boundary. This option
24362 is enabled by default when targeting Power6 and disabled otherwise.
24363
24364 @item -mfused-madd
24365 @itemx -mno-fused-madd
24366 @opindex mfused-madd
24367 @opindex mno-fused-madd
24368 Generate code that uses (does not use) the floating-point multiply and
24369 accumulate instructions. These instructions are generated by default
24370 if hardware floating point is used. The machine-dependent
24371 @option{-mfused-madd} option is now mapped to the machine-independent
24372 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24373 mapped to @option{-ffp-contract=off}.
24374
24375 @item -mmulhw
24376 @itemx -mno-mulhw
24377 @opindex mmulhw
24378 @opindex mno-mulhw
24379 Generate code that uses (does not use) the half-word multiply and
24380 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24381 These instructions are generated by default when targeting those
24382 processors.
24383
24384 @item -mdlmzb
24385 @itemx -mno-dlmzb
24386 @opindex mdlmzb
24387 @opindex mno-dlmzb
24388 Generate code that uses (does not use) the string-search @samp{dlmzb}
24389 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24390 generated by default when targeting those processors.
24391
24392 @item -mno-bit-align
24393 @itemx -mbit-align
24394 @opindex mno-bit-align
24395 @opindex mbit-align
24396 On System V.4 and embedded PowerPC systems do not (do) force structures
24397 and unions that contain bit-fields to be aligned to the base type of the
24398 bit-field.
24399
24400 For example, by default a structure containing nothing but 8
24401 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24402 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24403 the structure is aligned to a 1-byte boundary and is 1 byte in
24404 size.
24405
24406 @item -mno-strict-align
24407 @itemx -mstrict-align
24408 @opindex mno-strict-align
24409 @opindex mstrict-align
24410 On System V.4 and embedded PowerPC systems do not (do) assume that
24411 unaligned memory references are handled by the system.
24412
24413 @item -mrelocatable
24414 @itemx -mno-relocatable
24415 @opindex mrelocatable
24416 @opindex mno-relocatable
24417 Generate code that allows (does not allow) a static executable to be
24418 relocated to a different address at run time. A simple embedded
24419 PowerPC system loader should relocate the entire contents of
24420 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24421 a table of 32-bit addresses generated by this option. For this to
24422 work, all objects linked together must be compiled with
24423 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24424 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24425
24426 @item -mrelocatable-lib
24427 @itemx -mno-relocatable-lib
24428 @opindex mrelocatable-lib
24429 @opindex mno-relocatable-lib
24430 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24431 @code{.fixup} section to allow static executables to be relocated at
24432 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24433 alignment of @option{-mrelocatable}. Objects compiled with
24434 @option{-mrelocatable-lib} may be linked with objects compiled with
24435 any combination of the @option{-mrelocatable} options.
24436
24437 @item -mno-toc
24438 @itemx -mtoc
24439 @opindex mno-toc
24440 @opindex mtoc
24441 On System V.4 and embedded PowerPC systems do not (do) assume that
24442 register 2 contains a pointer to a global area pointing to the addresses
24443 used in the program.
24444
24445 @item -mlittle
24446 @itemx -mlittle-endian
24447 @opindex mlittle
24448 @opindex mlittle-endian
24449 On System V.4 and embedded PowerPC systems compile code for the
24450 processor in little-endian mode. The @option{-mlittle-endian} option is
24451 the same as @option{-mlittle}.
24452
24453 @item -mbig
24454 @itemx -mbig-endian
24455 @opindex mbig
24456 @opindex mbig-endian
24457 On System V.4 and embedded PowerPC systems compile code for the
24458 processor in big-endian mode. The @option{-mbig-endian} option is
24459 the same as @option{-mbig}.
24460
24461 @item -mdynamic-no-pic
24462 @opindex mdynamic-no-pic
24463 On Darwin and Mac OS X systems, compile code so that it is not
24464 relocatable, but that its external references are relocatable. The
24465 resulting code is suitable for applications, but not shared
24466 libraries.
24467
24468 @item -msingle-pic-base
24469 @opindex msingle-pic-base
24470 Treat the register used for PIC addressing as read-only, rather than
24471 loading it in the prologue for each function. The runtime system is
24472 responsible for initializing this register with an appropriate value
24473 before execution begins.
24474
24475 @item -mprioritize-restricted-insns=@var{priority}
24476 @opindex mprioritize-restricted-insns
24477 This option controls the priority that is assigned to
24478 dispatch-slot restricted instructions during the second scheduling
24479 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24480 or @samp{2} to assign no, highest, or second-highest (respectively)
24481 priority to dispatch-slot restricted
24482 instructions.
24483
24484 @item -msched-costly-dep=@var{dependence_type}
24485 @opindex msched-costly-dep
24486 This option controls which dependences are considered costly
24487 by the target during instruction scheduling. The argument
24488 @var{dependence_type} takes one of the following values:
24489
24490 @table @asis
24491 @item @samp{no}
24492 No dependence is costly.
24493
24494 @item @samp{all}
24495 All dependences are costly.
24496
24497 @item @samp{true_store_to_load}
24498 A true dependence from store to load is costly.
24499
24500 @item @samp{store_to_load}
24501 Any dependence from store to load is costly.
24502
24503 @item @var{number}
24504 Any dependence for which the latency is greater than or equal to
24505 @var{number} is costly.
24506 @end table
24507
24508 @item -minsert-sched-nops=@var{scheme}
24509 @opindex minsert-sched-nops
24510 This option controls which NOP insertion scheme is used during
24511 the second scheduling pass. The argument @var{scheme} takes one of the
24512 following values:
24513
24514 @table @asis
24515 @item @samp{no}
24516 Don't insert NOPs.
24517
24518 @item @samp{pad}
24519 Pad with NOPs any dispatch group that has vacant issue slots,
24520 according to the scheduler's grouping.
24521
24522 @item @samp{regroup_exact}
24523 Insert NOPs to force costly dependent insns into
24524 separate groups. Insert exactly as many NOPs as needed to force an insn
24525 to a new group, according to the estimated processor grouping.
24526
24527 @item @var{number}
24528 Insert NOPs to force costly dependent insns into
24529 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24530 @end table
24531
24532 @item -mcall-sysv
24533 @opindex mcall-sysv
24534 On System V.4 and embedded PowerPC systems compile code using calling
24535 conventions that adhere to the March 1995 draft of the System V
24536 Application Binary Interface, PowerPC processor supplement. This is the
24537 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24538
24539 @item -mcall-sysv-eabi
24540 @itemx -mcall-eabi
24541 @opindex mcall-sysv-eabi
24542 @opindex mcall-eabi
24543 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24544
24545 @item -mcall-sysv-noeabi
24546 @opindex mcall-sysv-noeabi
24547 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24548
24549 @item -mcall-aixdesc
24550 @opindex m
24551 On System V.4 and embedded PowerPC systems compile code for the AIX
24552 operating system.
24553
24554 @item -mcall-linux
24555 @opindex mcall-linux
24556 On System V.4 and embedded PowerPC systems compile code for the
24557 Linux-based GNU system.
24558
24559 @item -mcall-freebsd
24560 @opindex mcall-freebsd
24561 On System V.4 and embedded PowerPC systems compile code for the
24562 FreeBSD operating system.
24563
24564 @item -mcall-netbsd
24565 @opindex mcall-netbsd
24566 On System V.4 and embedded PowerPC systems compile code for the
24567 NetBSD operating system.
24568
24569 @item -mcall-openbsd
24570 @opindex mcall-netbsd
24571 On System V.4 and embedded PowerPC systems compile code for the
24572 OpenBSD operating system.
24573
24574 @item -mtraceback=@var{traceback_type}
24575 @opindex mtraceback
24576 Select the type of traceback table. Valid values for @var{traceback_type}
24577 are @samp{full}, @samp{part}, and @samp{no}.
24578
24579 @item -maix-struct-return
24580 @opindex maix-struct-return
24581 Return all structures in memory (as specified by the AIX ABI)@.
24582
24583 @item -msvr4-struct-return
24584 @opindex msvr4-struct-return
24585 Return structures smaller than 8 bytes in registers (as specified by the
24586 SVR4 ABI)@.
24587
24588 @item -mabi=@var{abi-type}
24589 @opindex mabi
24590 Extend the current ABI with a particular extension, or remove such extension.
24591 Valid values are @samp{altivec}, @samp{no-altivec},
24592 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24593 @samp{elfv1}, @samp{elfv2}@.
24594
24595 @item -mabi=ibmlongdouble
24596 @opindex mabi=ibmlongdouble
24597 Change the current ABI to use IBM extended-precision long double.
24598 This is not likely to work if your system defaults to using IEEE
24599 extended-precision long double. If you change the long double type
24600 from IEEE extended-precision, the compiler will issue a warning unless
24601 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24602 to be enabled.
24603
24604 @item -mabi=ieeelongdouble
24605 @opindex mabi=ieeelongdouble
24606 Change the current ABI to use IEEE extended-precision long double.
24607 This is not likely to work if your system defaults to using IBM
24608 extended-precision long double. If you change the long double type
24609 from IBM extended-precision, the compiler will issue a warning unless
24610 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24611 to be enabled.
24612
24613 @item -mabi=elfv1
24614 @opindex mabi=elfv1
24615 Change the current ABI to use the ELFv1 ABI.
24616 This is the default ABI for big-endian PowerPC 64-bit Linux.
24617 Overriding the default ABI requires special system support and is
24618 likely to fail in spectacular ways.
24619
24620 @item -mabi=elfv2
24621 @opindex mabi=elfv2
24622 Change the current ABI to use the ELFv2 ABI.
24623 This is the default ABI for little-endian PowerPC 64-bit Linux.
24624 Overriding the default ABI requires special system support and is
24625 likely to fail in spectacular ways.
24626
24627 @item -mgnu-attribute
24628 @itemx -mno-gnu-attribute
24629 @opindex mgnu-attribute
24630 @opindex mno-gnu-attribute
24631 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24632 .gnu.attributes section that specify ABI variations in function
24633 parameters or return values.
24634
24635 @item -mprototype
24636 @itemx -mno-prototype
24637 @opindex mprototype
24638 @opindex mno-prototype
24639 On System V.4 and embedded PowerPC systems assume that all calls to
24640 variable argument functions are properly prototyped. Otherwise, the
24641 compiler must insert an instruction before every non-prototyped call to
24642 set or clear bit 6 of the condition code register (@code{CR}) to
24643 indicate whether floating-point values are passed in the floating-point
24644 registers in case the function takes variable arguments. With
24645 @option{-mprototype}, only calls to prototyped variable argument functions
24646 set or clear the bit.
24647
24648 @item -msim
24649 @opindex msim
24650 On embedded PowerPC systems, assume that the startup module is called
24651 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24652 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24653 configurations.
24654
24655 @item -mmvme
24656 @opindex mmvme
24657 On embedded PowerPC systems, assume that the startup module is called
24658 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24659 @file{libc.a}.
24660
24661 @item -mads
24662 @opindex mads
24663 On embedded PowerPC systems, assume that the startup module is called
24664 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24665 @file{libc.a}.
24666
24667 @item -myellowknife
24668 @opindex myellowknife
24669 On embedded PowerPC systems, assume that the startup module is called
24670 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24671 @file{libc.a}.
24672
24673 @item -mvxworks
24674 @opindex mvxworks
24675 On System V.4 and embedded PowerPC systems, specify that you are
24676 compiling for a VxWorks system.
24677
24678 @item -memb
24679 @opindex memb
24680 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24681 header to indicate that @samp{eabi} extended relocations are used.
24682
24683 @item -meabi
24684 @itemx -mno-eabi
24685 @opindex meabi
24686 @opindex mno-eabi
24687 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24688 Embedded Applications Binary Interface (EABI), which is a set of
24689 modifications to the System V.4 specifications. Selecting @option{-meabi}
24690 means that the stack is aligned to an 8-byte boundary, a function
24691 @code{__eabi} is called from @code{main} to set up the EABI
24692 environment, and the @option{-msdata} option can use both @code{r2} and
24693 @code{r13} to point to two separate small data areas. Selecting
24694 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24695 no EABI initialization function is called from @code{main}, and the
24696 @option{-msdata} option only uses @code{r13} to point to a single
24697 small data area. The @option{-meabi} option is on by default if you
24698 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24699
24700 @item -msdata=eabi
24701 @opindex msdata=eabi
24702 On System V.4 and embedded PowerPC systems, put small initialized
24703 @code{const} global and static data in the @code{.sdata2} section, which
24704 is pointed to by register @code{r2}. Put small initialized
24705 non-@code{const} global and static data in the @code{.sdata} section,
24706 which is pointed to by register @code{r13}. Put small uninitialized
24707 global and static data in the @code{.sbss} section, which is adjacent to
24708 the @code{.sdata} section. The @option{-msdata=eabi} option is
24709 incompatible with the @option{-mrelocatable} option. The
24710 @option{-msdata=eabi} option also sets the @option{-memb} option.
24711
24712 @item -msdata=sysv
24713 @opindex msdata=sysv
24714 On System V.4 and embedded PowerPC systems, put small global and static
24715 data in the @code{.sdata} section, which is pointed to by register
24716 @code{r13}. Put small uninitialized global and static data in the
24717 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24718 The @option{-msdata=sysv} option is incompatible with the
24719 @option{-mrelocatable} option.
24720
24721 @item -msdata=default
24722 @itemx -msdata
24723 @opindex msdata=default
24724 @opindex msdata
24725 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24726 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24727 same as @option{-msdata=sysv}.
24728
24729 @item -msdata=data
24730 @opindex msdata=data
24731 On System V.4 and embedded PowerPC systems, put small global
24732 data in the @code{.sdata} section. Put small uninitialized global
24733 data in the @code{.sbss} section. Do not use register @code{r13}
24734 to address small data however. This is the default behavior unless
24735 other @option{-msdata} options are used.
24736
24737 @item -msdata=none
24738 @itemx -mno-sdata
24739 @opindex msdata=none
24740 @opindex mno-sdata
24741 On embedded PowerPC systems, put all initialized global and static data
24742 in the @code{.data} section, and all uninitialized data in the
24743 @code{.bss} section.
24744
24745 @item -mreadonly-in-sdata
24746 @opindex mreadonly-in-sdata
24747 @opindex mno-readonly-in-sdata
24748 Put read-only objects in the @code{.sdata} section as well. This is the
24749 default.
24750
24751 @item -mblock-move-inline-limit=@var{num}
24752 @opindex mblock-move-inline-limit
24753 Inline all block moves (such as calls to @code{memcpy} or structure
24754 copies) less than or equal to @var{num} bytes. The minimum value for
24755 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24756 targets. The default value is target-specific.
24757
24758 @item -mblock-compare-inline-limit=@var{num}
24759 @opindex mblock-compare-inline-limit
24760 Generate non-looping inline code for all block compares (such as calls
24761 to @code{memcmp} or structure compares) less than or equal to @var{num}
24762 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24763 block compare is disabled. The default value is target-specific.
24764
24765 @item -mblock-compare-inline-loop-limit=@var{num}
24766 @opindex mblock-compare-inline-loop-limit
24767 Generate an inline expansion using loop code for all block compares that
24768 are less than or equal to @var{num} bytes, but greater than the limit
24769 for non-loop inline block compare expansion. If the block length is not
24770 constant, at most @var{num} bytes will be compared before @code{memcmp}
24771 is called to compare the remainder of the block. The default value is
24772 target-specific.
24773
24774 @item -mstring-compare-inline-limit=@var{num}
24775 @opindex mstring-compare-inline-limit
24776 Compare at most @var{num} string bytes with inline code.
24777 If the difference or end of string is not found at the
24778 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24779 take care of the rest of the comparison. The default is 64 bytes.
24780
24781 @item -G @var{num}
24782 @opindex G
24783 @cindex smaller data references (PowerPC)
24784 @cindex .sdata/.sdata2 references (PowerPC)
24785 On embedded PowerPC systems, put global and static items less than or
24786 equal to @var{num} bytes into the small data or BSS sections instead of
24787 the normal data or BSS section. By default, @var{num} is 8. The
24788 @option{-G @var{num}} switch is also passed to the linker.
24789 All modules should be compiled with the same @option{-G @var{num}} value.
24790
24791 @item -mregnames
24792 @itemx -mno-regnames
24793 @opindex mregnames
24794 @opindex mno-regnames
24795 On System V.4 and embedded PowerPC systems do (do not) emit register
24796 names in the assembly language output using symbolic forms.
24797
24798 @item -mlongcall
24799 @itemx -mno-longcall
24800 @opindex mlongcall
24801 @opindex mno-longcall
24802 By default assume that all calls are far away so that a longer and more
24803 expensive calling sequence is required. This is required for calls
24804 farther than 32 megabytes (33,554,432 bytes) from the current location.
24805 A short call is generated if the compiler knows
24806 the call cannot be that far away. This setting can be overridden by
24807 the @code{shortcall} function attribute, or by @code{#pragma
24808 longcall(0)}.
24809
24810 Some linkers are capable of detecting out-of-range calls and generating
24811 glue code on the fly. On these systems, long calls are unnecessary and
24812 generate slower code. As of this writing, the AIX linker can do this,
24813 as can the GNU linker for PowerPC/64. It is planned to add this feature
24814 to the GNU linker for 32-bit PowerPC systems as well.
24815
24816 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
24817 GCC can generate long calls using an inline PLT call sequence (see
24818 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
24819 ELFv1 (big-endian) do not support inline PLT calls.
24820
24821 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24822 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24823 addresses represent the callee and the branch island. The
24824 Darwin/PPC linker prefers the first address and generates a @code{bl
24825 callee} if the PPC @code{bl} instruction reaches the callee directly;
24826 otherwise, the linker generates @code{bl L42} to call the branch
24827 island. The branch island is appended to the body of the
24828 calling function; it computes the full 32-bit address of the callee
24829 and jumps to it.
24830
24831 On Mach-O (Darwin) systems, this option directs the compiler emit to
24832 the glue for every direct call, and the Darwin linker decides whether
24833 to use or discard it.
24834
24835 In the future, GCC may ignore all longcall specifications
24836 when the linker is known to generate glue.
24837
24838 @item -mpltseq
24839 @itemx -mno-pltseq
24840 @opindex mpltseq
24841 @opindex mno-pltseq
24842 Implement (do not implement) -fno-plt and long calls using an inline
24843 PLT call sequence that supports lazy linking and long calls to
24844 functions in dlopen'd shared libraries. Inline PLT calls are only
24845 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24846 linkers, and are enabled by default if the support is detected when
24847 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
24848 configured with @option{--enable-secureplt}. @option{-mpltseq} code
24849 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
24850 linked together.
24851
24852 @item -mtls-markers
24853 @itemx -mno-tls-markers
24854 @opindex mtls-markers
24855 @opindex mno-tls-markers
24856 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24857 specifying the function argument. The relocation allows the linker to
24858 reliably associate function call with argument setup instructions for
24859 TLS optimization, which in turn allows GCC to better schedule the
24860 sequence.
24861
24862 @item -mrecip
24863 @itemx -mno-recip
24864 @opindex mrecip
24865 This option enables use of the reciprocal estimate and
24866 reciprocal square root estimate instructions with additional
24867 Newton-Raphson steps to increase precision instead of doing a divide or
24868 square root and divide for floating-point arguments. You should use
24869 the @option{-ffast-math} option when using @option{-mrecip} (or at
24870 least @option{-funsafe-math-optimizations},
24871 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24872 @option{-fno-trapping-math}). Note that while the throughput of the
24873 sequence is generally higher than the throughput of the non-reciprocal
24874 instruction, the precision of the sequence can be decreased by up to 2
24875 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24876 roots.
24877
24878 @item -mrecip=@var{opt}
24879 @opindex mrecip=opt
24880 This option controls which reciprocal estimate instructions
24881 may be used. @var{opt} is a comma-separated list of options, which may
24882 be preceded by a @code{!} to invert the option:
24883
24884 @table @samp
24885
24886 @item all
24887 Enable all estimate instructions.
24888
24889 @item default
24890 Enable the default instructions, equivalent to @option{-mrecip}.
24891
24892 @item none
24893 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24894
24895 @item div
24896 Enable the reciprocal approximation instructions for both
24897 single and double precision.
24898
24899 @item divf
24900 Enable the single-precision reciprocal approximation instructions.
24901
24902 @item divd
24903 Enable the double-precision reciprocal approximation instructions.
24904
24905 @item rsqrt
24906 Enable the reciprocal square root approximation instructions for both
24907 single and double precision.
24908
24909 @item rsqrtf
24910 Enable the single-precision reciprocal square root approximation instructions.
24911
24912 @item rsqrtd
24913 Enable the double-precision reciprocal square root approximation instructions.
24914
24915 @end table
24916
24917 So, for example, @option{-mrecip=all,!rsqrtd} enables
24918 all of the reciprocal estimate instructions, except for the
24919 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24920 which handle the double-precision reciprocal square root calculations.
24921
24922 @item -mrecip-precision
24923 @itemx -mno-recip-precision
24924 @opindex mrecip-precision
24925 Assume (do not assume) that the reciprocal estimate instructions
24926 provide higher-precision estimates than is mandated by the PowerPC
24927 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24928 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24929 The double-precision square root estimate instructions are not generated by
24930 default on low-precision machines, since they do not provide an
24931 estimate that converges after three steps.
24932
24933 @item -mveclibabi=@var{type}
24934 @opindex mveclibabi
24935 Specifies the ABI type to use for vectorizing intrinsics using an
24936 external library. The only type supported at present is @samp{mass},
24937 which specifies to use IBM's Mathematical Acceleration Subsystem
24938 (MASS) libraries for vectorizing intrinsics using external libraries.
24939 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24940 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24941 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24942 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24943 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24944 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24945 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24946 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24947 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24948 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24949 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24950 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24951 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24952 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24953 for power7. Both @option{-ftree-vectorize} and
24954 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24955 libraries must be specified at link time.
24956
24957 @item -mfriz
24958 @itemx -mno-friz
24959 @opindex mfriz
24960 Generate (do not generate) the @code{friz} instruction when the
24961 @option{-funsafe-math-optimizations} option is used to optimize
24962 rounding of floating-point values to 64-bit integer and back to floating
24963 point. The @code{friz} instruction does not return the same value if
24964 the floating-point number is too large to fit in an integer.
24965
24966 @item -mpointers-to-nested-functions
24967 @itemx -mno-pointers-to-nested-functions
24968 @opindex mpointers-to-nested-functions
24969 Generate (do not generate) code to load up the static chain register
24970 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24971 systems where a function pointer points to a 3-word descriptor giving
24972 the function address, TOC value to be loaded in register @code{r2}, and
24973 static chain value to be loaded in register @code{r11}. The
24974 @option{-mpointers-to-nested-functions} is on by default. You cannot
24975 call through pointers to nested functions or pointers
24976 to functions compiled in other languages that use the static chain if
24977 you use @option{-mno-pointers-to-nested-functions}.
24978
24979 @item -msave-toc-indirect
24980 @itemx -mno-save-toc-indirect
24981 @opindex msave-toc-indirect
24982 Generate (do not generate) code to save the TOC value in the reserved
24983 stack location in the function prologue if the function calls through
24984 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24985 saved in the prologue, it is saved just before the call through the
24986 pointer. The @option{-mno-save-toc-indirect} option is the default.
24987
24988 @item -mcompat-align-parm
24989 @itemx -mno-compat-align-parm
24990 @opindex mcompat-align-parm
24991 Generate (do not generate) code to pass structure parameters with a
24992 maximum alignment of 64 bits, for compatibility with older versions
24993 of GCC.
24994
24995 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24996 structure parameter on a 128-bit boundary when that structure contained
24997 a member requiring 128-bit alignment. This is corrected in more
24998 recent versions of GCC. This option may be used to generate code
24999 that is compatible with functions compiled with older versions of
25000 GCC.
25001
25002 The @option{-mno-compat-align-parm} option is the default.
25003
25004 @item -mstack-protector-guard=@var{guard}
25005 @itemx -mstack-protector-guard-reg=@var{reg}
25006 @itemx -mstack-protector-guard-offset=@var{offset}
25007 @itemx -mstack-protector-guard-symbol=@var{symbol}
25008 @opindex mstack-protector-guard
25009 @opindex mstack-protector-guard-reg
25010 @opindex mstack-protector-guard-offset
25011 @opindex mstack-protector-guard-symbol
25012 Generate stack protection code using canary at @var{guard}. Supported
25013 locations are @samp{global} for global canary or @samp{tls} for per-thread
25014 canary in the TLS block (the default with GNU libc version 2.4 or later).
25015
25016 With the latter choice the options
25017 @option{-mstack-protector-guard-reg=@var{reg}} and
25018 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25019 which register to use as base register for reading the canary, and from what
25020 offset from that base register. The default for those is as specified in the
25021 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25022 the offset with a symbol reference to a canary in the TLS block.
25023 @end table
25024
25025 @node RX Options
25026 @subsection RX Options
25027 @cindex RX Options
25028
25029 These command-line options are defined for RX targets:
25030
25031 @table @gcctabopt
25032 @item -m64bit-doubles
25033 @itemx -m32bit-doubles
25034 @opindex m64bit-doubles
25035 @opindex m32bit-doubles
25036 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25037 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25038 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25039 works on 32-bit values, which is why the default is
25040 @option{-m32bit-doubles}.
25041
25042 @item -fpu
25043 @itemx -nofpu
25044 @opindex fpu
25045 @opindex nofpu
25046 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25047 floating-point hardware. The default is enabled for the RX600
25048 series and disabled for the RX200 series.
25049
25050 Floating-point instructions are only generated for 32-bit floating-point
25051 values, however, so the FPU hardware is not used for doubles if the
25052 @option{-m64bit-doubles} option is used.
25053
25054 @emph{Note} If the @option{-fpu} option is enabled then
25055 @option{-funsafe-math-optimizations} is also enabled automatically.
25056 This is because the RX FPU instructions are themselves unsafe.
25057
25058 @item -mcpu=@var{name}
25059 @opindex mcpu
25060 Selects the type of RX CPU to be targeted. Currently three types are
25061 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25062 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25063
25064 The only difference between @samp{RX600} and @samp{RX610} is that the
25065 @samp{RX610} does not support the @code{MVTIPL} instruction.
25066
25067 The @samp{RX200} series does not have a hardware floating-point unit
25068 and so @option{-nofpu} is enabled by default when this type is
25069 selected.
25070
25071 @item -mbig-endian-data
25072 @itemx -mlittle-endian-data
25073 @opindex mbig-endian-data
25074 @opindex mlittle-endian-data
25075 Store data (but not code) in the big-endian format. The default is
25076 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25077 format.
25078
25079 @item -msmall-data-limit=@var{N}
25080 @opindex msmall-data-limit
25081 Specifies the maximum size in bytes of global and static variables
25082 which can be placed into the small data area. Using the small data
25083 area can lead to smaller and faster code, but the size of area is
25084 limited and it is up to the programmer to ensure that the area does
25085 not overflow. Also when the small data area is used one of the RX's
25086 registers (usually @code{r13}) is reserved for use pointing to this
25087 area, so it is no longer available for use by the compiler. This
25088 could result in slower and/or larger code if variables are pushed onto
25089 the stack instead of being held in this register.
25090
25091 Note, common variables (variables that have not been initialized) and
25092 constants are not placed into the small data area as they are assigned
25093 to other sections in the output executable.
25094
25095 The default value is zero, which disables this feature. Note, this
25096 feature is not enabled by default with higher optimization levels
25097 (@option{-O2} etc) because of the potentially detrimental effects of
25098 reserving a register. It is up to the programmer to experiment and
25099 discover whether this feature is of benefit to their program. See the
25100 description of the @option{-mpid} option for a description of how the
25101 actual register to hold the small data area pointer is chosen.
25102
25103 @item -msim
25104 @itemx -mno-sim
25105 @opindex msim
25106 @opindex mno-sim
25107 Use the simulator runtime. The default is to use the libgloss
25108 board-specific runtime.
25109
25110 @item -mas100-syntax
25111 @itemx -mno-as100-syntax
25112 @opindex mas100-syntax
25113 @opindex mno-as100-syntax
25114 When generating assembler output use a syntax that is compatible with
25115 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25116 assembler, but it has some restrictions so it is not generated by default.
25117
25118 @item -mmax-constant-size=@var{N}
25119 @opindex mmax-constant-size
25120 Specifies the maximum size, in bytes, of a constant that can be used as
25121 an operand in a RX instruction. Although the RX instruction set does
25122 allow constants of up to 4 bytes in length to be used in instructions,
25123 a longer value equates to a longer instruction. Thus in some
25124 circumstances it can be beneficial to restrict the size of constants
25125 that are used in instructions. Constants that are too big are instead
25126 placed into a constant pool and referenced via register indirection.
25127
25128 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25129 or 4 means that constants of any size are allowed.
25130
25131 @item -mrelax
25132 @opindex mrelax
25133 Enable linker relaxation. Linker relaxation is a process whereby the
25134 linker attempts to reduce the size of a program by finding shorter
25135 versions of various instructions. Disabled by default.
25136
25137 @item -mint-register=@var{N}
25138 @opindex mint-register
25139 Specify the number of registers to reserve for fast interrupt handler
25140 functions. The value @var{N} can be between 0 and 4. A value of 1
25141 means that register @code{r13} is reserved for the exclusive use
25142 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25143 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25144 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25145 A value of 0, the default, does not reserve any registers.
25146
25147 @item -msave-acc-in-interrupts
25148 @opindex msave-acc-in-interrupts
25149 Specifies that interrupt handler functions should preserve the
25150 accumulator register. This is only necessary if normal code might use
25151 the accumulator register, for example because it performs 64-bit
25152 multiplications. The default is to ignore the accumulator as this
25153 makes the interrupt handlers faster.
25154
25155 @item -mpid
25156 @itemx -mno-pid
25157 @opindex mpid
25158 @opindex mno-pid
25159 Enables the generation of position independent data. When enabled any
25160 access to constant data is done via an offset from a base address
25161 held in a register. This allows the location of constant data to be
25162 determined at run time without requiring the executable to be
25163 relocated, which is a benefit to embedded applications with tight
25164 memory constraints. Data that can be modified is not affected by this
25165 option.
25166
25167 Note, using this feature reserves a register, usually @code{r13}, for
25168 the constant data base address. This can result in slower and/or
25169 larger code, especially in complicated functions.
25170
25171 The actual register chosen to hold the constant data base address
25172 depends upon whether the @option{-msmall-data-limit} and/or the
25173 @option{-mint-register} command-line options are enabled. Starting
25174 with register @code{r13} and proceeding downwards, registers are
25175 allocated first to satisfy the requirements of @option{-mint-register},
25176 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25177 is possible for the small data area register to be @code{r8} if both
25178 @option{-mint-register=4} and @option{-mpid} are specified on the
25179 command line.
25180
25181 By default this feature is not enabled. The default can be restored
25182 via the @option{-mno-pid} command-line option.
25183
25184 @item -mno-warn-multiple-fast-interrupts
25185 @itemx -mwarn-multiple-fast-interrupts
25186 @opindex mno-warn-multiple-fast-interrupts
25187 @opindex mwarn-multiple-fast-interrupts
25188 Prevents GCC from issuing a warning message if it finds more than one
25189 fast interrupt handler when it is compiling a file. The default is to
25190 issue a warning for each extra fast interrupt handler found, as the RX
25191 only supports one such interrupt.
25192
25193 @item -mallow-string-insns
25194 @itemx -mno-allow-string-insns
25195 @opindex mallow-string-insns
25196 @opindex mno-allow-string-insns
25197 Enables or disables the use of the string manipulation instructions
25198 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25199 @code{SWHILE} and also the @code{RMPA} instruction. These
25200 instructions may prefetch data, which is not safe to do if accessing
25201 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25202 for more information).
25203
25204 The default is to allow these instructions, but it is not possible for
25205 GCC to reliably detect all circumstances where a string instruction
25206 might be used to access an I/O register, so their use cannot be
25207 disabled automatically. Instead it is reliant upon the programmer to
25208 use the @option{-mno-allow-string-insns} option if their program
25209 accesses I/O space.
25210
25211 When the instructions are enabled GCC defines the C preprocessor
25212 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25213 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25214
25215 @item -mjsr
25216 @itemx -mno-jsr
25217 @opindex mjsr
25218 @opindex mno-jsr
25219 Use only (or not only) @code{JSR} instructions to access functions.
25220 This option can be used when code size exceeds the range of @code{BSR}
25221 instructions. Note that @option{-mno-jsr} does not mean to not use
25222 @code{JSR} but instead means that any type of branch may be used.
25223 @end table
25224
25225 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25226 has special significance to the RX port when used with the
25227 @code{interrupt} function attribute. This attribute indicates a
25228 function intended to process fast interrupts. GCC ensures
25229 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25230 and/or @code{r13} and only provided that the normal use of the
25231 corresponding registers have been restricted via the
25232 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25233 options.
25234
25235 @node S/390 and zSeries Options
25236 @subsection S/390 and zSeries Options
25237 @cindex S/390 and zSeries Options
25238
25239 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25240
25241 @table @gcctabopt
25242 @item -mhard-float
25243 @itemx -msoft-float
25244 @opindex mhard-float
25245 @opindex msoft-float
25246 Use (do not use) the hardware floating-point instructions and registers
25247 for floating-point operations. When @option{-msoft-float} is specified,
25248 functions in @file{libgcc.a} are used to perform floating-point
25249 operations. When @option{-mhard-float} is specified, the compiler
25250 generates IEEE floating-point instructions. This is the default.
25251
25252 @item -mhard-dfp
25253 @itemx -mno-hard-dfp
25254 @opindex mhard-dfp
25255 @opindex mno-hard-dfp
25256 Use (do not use) the hardware decimal-floating-point instructions for
25257 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25258 specified, functions in @file{libgcc.a} are used to perform
25259 decimal-floating-point operations. When @option{-mhard-dfp} is
25260 specified, the compiler generates decimal-floating-point hardware
25261 instructions. This is the default for @option{-march=z9-ec} or higher.
25262
25263 @item -mlong-double-64
25264 @itemx -mlong-double-128
25265 @opindex mlong-double-64
25266 @opindex mlong-double-128
25267 These switches control the size of @code{long double} type. A size
25268 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25269 type. This is the default.
25270
25271 @item -mbackchain
25272 @itemx -mno-backchain
25273 @opindex mbackchain
25274 @opindex mno-backchain
25275 Store (do not store) the address of the caller's frame as backchain pointer
25276 into the callee's stack frame.
25277 A backchain may be needed to allow debugging using tools that do not understand
25278 DWARF call frame information.
25279 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25280 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25281 the backchain is placed into the topmost word of the 96/160 byte register
25282 save area.
25283
25284 In general, code compiled with @option{-mbackchain} is call-compatible with
25285 code compiled with @option{-mmo-backchain}; however, use of the backchain
25286 for debugging purposes usually requires that the whole binary is built with
25287 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25288 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25289 to build a linux kernel use @option{-msoft-float}.
25290
25291 The default is to not maintain the backchain.
25292
25293 @item -mpacked-stack
25294 @itemx -mno-packed-stack
25295 @opindex mpacked-stack
25296 @opindex mno-packed-stack
25297 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25298 specified, the compiler uses the all fields of the 96/160 byte register save
25299 area only for their default purpose; unused fields still take up stack space.
25300 When @option{-mpacked-stack} is specified, register save slots are densely
25301 packed at the top of the register save area; unused space is reused for other
25302 purposes, allowing for more efficient use of the available stack space.
25303 However, when @option{-mbackchain} is also in effect, the topmost word of
25304 the save area is always used to store the backchain, and the return address
25305 register is always saved two words below the backchain.
25306
25307 As long as the stack frame backchain is not used, code generated with
25308 @option{-mpacked-stack} is call-compatible with code generated with
25309 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25310 S/390 or zSeries generated code that uses the stack frame backchain at run
25311 time, not just for debugging purposes. Such code is not call-compatible
25312 with code compiled with @option{-mpacked-stack}. Also, note that the
25313 combination of @option{-mbackchain},
25314 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25315 to build a linux kernel use @option{-msoft-float}.
25316
25317 The default is to not use the packed stack layout.
25318
25319 @item -msmall-exec
25320 @itemx -mno-small-exec
25321 @opindex msmall-exec
25322 @opindex mno-small-exec
25323 Generate (or do not generate) code using the @code{bras} instruction
25324 to do subroutine calls.
25325 This only works reliably if the total executable size does not
25326 exceed 64k. The default is to use the @code{basr} instruction instead,
25327 which does not have this limitation.
25328
25329 @item -m64
25330 @itemx -m31
25331 @opindex m64
25332 @opindex m31
25333 When @option{-m31} is specified, generate code compliant to the
25334 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25335 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25336 particular to generate 64-bit instructions. For the @samp{s390}
25337 targets, the default is @option{-m31}, while the @samp{s390x}
25338 targets default to @option{-m64}.
25339
25340 @item -mzarch
25341 @itemx -mesa
25342 @opindex mzarch
25343 @opindex mesa
25344 When @option{-mzarch} is specified, generate code using the
25345 instructions available on z/Architecture.
25346 When @option{-mesa} is specified, generate code using the
25347 instructions available on ESA/390. Note that @option{-mesa} is
25348 not possible with @option{-m64}.
25349 When generating code compliant to the GNU/Linux for S/390 ABI,
25350 the default is @option{-mesa}. When generating code compliant
25351 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25352
25353 @item -mhtm
25354 @itemx -mno-htm
25355 @opindex mhtm
25356 @opindex mno-htm
25357 The @option{-mhtm} option enables a set of builtins making use of
25358 instructions available with the transactional execution facility
25359 introduced with the IBM zEnterprise EC12 machine generation
25360 @ref{S/390 System z Built-in Functions}.
25361 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25362
25363 @item -mvx
25364 @itemx -mno-vx
25365 @opindex mvx
25366 @opindex mno-vx
25367 When @option{-mvx} is specified, generate code using the instructions
25368 available with the vector extension facility introduced with the IBM
25369 z13 machine generation.
25370 This option changes the ABI for some vector type values with regard to
25371 alignment and calling conventions. In case vector type values are
25372 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25373 command will be added to mark the resulting binary with the ABI used.
25374 @option{-mvx} is enabled by default when using @option{-march=z13}.
25375
25376 @item -mzvector
25377 @itemx -mno-zvector
25378 @opindex mzvector
25379 @opindex mno-zvector
25380 The @option{-mzvector} option enables vector language extensions and
25381 builtins using instructions available with the vector extension
25382 facility introduced with the IBM z13 machine generation.
25383 This option adds support for @samp{vector} to be used as a keyword to
25384 define vector type variables and arguments. @samp{vector} is only
25385 available when GNU extensions are enabled. It will not be expanded
25386 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25387 In addition to the GCC low-level builtins @option{-mzvector} enables
25388 a set of builtins added for compatibility with AltiVec-style
25389 implementations like Power and Cell. In order to make use of these
25390 builtins the header file @file{vecintrin.h} needs to be included.
25391 @option{-mzvector} is disabled by default.
25392
25393 @item -mmvcle
25394 @itemx -mno-mvcle
25395 @opindex mmvcle
25396 @opindex mno-mvcle
25397 Generate (or do not generate) code using the @code{mvcle} instruction
25398 to perform block moves. When @option{-mno-mvcle} is specified,
25399 use a @code{mvc} loop instead. This is the default unless optimizing for
25400 size.
25401
25402 @item -mdebug
25403 @itemx -mno-debug
25404 @opindex mdebug
25405 @opindex mno-debug
25406 Print (or do not print) additional debug information when compiling.
25407 The default is to not print debug information.
25408
25409 @item -march=@var{cpu-type}
25410 @opindex march
25411 Generate code that runs on @var{cpu-type}, which is the name of a
25412 system representing a certain processor type. Possible values for
25413 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25414 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25415 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25416 @samp{z14}/@samp{arch12}, and @samp{native}.
25417
25418 The default is @option{-march=z900}.
25419
25420 Specifying @samp{native} as cpu type can be used to select the best
25421 architecture option for the host processor.
25422 @option{-march=native} has no effect if GCC does not recognize the
25423 processor.
25424
25425 @item -mtune=@var{cpu-type}
25426 @opindex mtune
25427 Tune to @var{cpu-type} everything applicable about the generated code,
25428 except for the ABI and the set of available instructions.
25429 The list of @var{cpu-type} values is the same as for @option{-march}.
25430 The default is the value used for @option{-march}.
25431
25432 @item -mtpf-trace
25433 @itemx -mno-tpf-trace
25434 @opindex mtpf-trace
25435 @opindex mno-tpf-trace
25436 Generate code that adds (does not add) in TPF OS specific branches to trace
25437 routines in the operating system. This option is off by default, even
25438 when compiling for the TPF OS@.
25439
25440 @item -mfused-madd
25441 @itemx -mno-fused-madd
25442 @opindex mfused-madd
25443 @opindex mno-fused-madd
25444 Generate code that uses (does not use) the floating-point multiply and
25445 accumulate instructions. These instructions are generated by default if
25446 hardware floating point is used.
25447
25448 @item -mwarn-framesize=@var{framesize}
25449 @opindex mwarn-framesize
25450 Emit a warning if the current function exceeds the given frame size. Because
25451 this is a compile-time check it doesn't need to be a real problem when the program
25452 runs. It is intended to identify functions that most probably cause
25453 a stack overflow. It is useful to be used in an environment with limited stack
25454 size e.g.@: the linux kernel.
25455
25456 @item -mwarn-dynamicstack
25457 @opindex mwarn-dynamicstack
25458 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25459 arrays. This is generally a bad idea with a limited stack size.
25460
25461 @item -mstack-guard=@var{stack-guard}
25462 @itemx -mstack-size=@var{stack-size}
25463 @opindex mstack-guard
25464 @opindex mstack-size
25465 If these options are provided the S/390 back end emits additional instructions in
25466 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25467 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25468 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25469 the frame size of the compiled function is chosen.
25470 These options are intended to be used to help debugging stack overflow problems.
25471 The additionally emitted code causes only little overhead and hence can also be
25472 used in production-like systems without greater performance degradation. The given
25473 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25474 @var{stack-guard} without exceeding 64k.
25475 In order to be efficient the extra code makes the assumption that the stack starts
25476 at an address aligned to the value given by @var{stack-size}.
25477 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25478
25479 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25480 @opindex mhotpatch
25481 If the hotpatch option is enabled, a ``hot-patching'' function
25482 prologue is generated for all functions in the compilation unit.
25483 The funtion label is prepended with the given number of two-byte
25484 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25485 the label, 2 * @var{post-halfwords} bytes are appended, using the
25486 largest NOP like instructions the architecture allows (maximum
25487 1000000).
25488
25489 If both arguments are zero, hotpatching is disabled.
25490
25491 This option can be overridden for individual functions with the
25492 @code{hotpatch} attribute.
25493 @end table
25494
25495 @node Score Options
25496 @subsection Score Options
25497 @cindex Score Options
25498
25499 These options are defined for Score implementations:
25500
25501 @table @gcctabopt
25502 @item -meb
25503 @opindex meb
25504 Compile code for big-endian mode. This is the default.
25505
25506 @item -mel
25507 @opindex mel
25508 Compile code for little-endian mode.
25509
25510 @item -mnhwloop
25511 @opindex mnhwloop
25512 Disable generation of @code{bcnz} instructions.
25513
25514 @item -muls
25515 @opindex muls
25516 Enable generation of unaligned load and store instructions.
25517
25518 @item -mmac
25519 @opindex mmac
25520 Enable the use of multiply-accumulate instructions. Disabled by default.
25521
25522 @item -mscore5
25523 @opindex mscore5
25524 Specify the SCORE5 as the target architecture.
25525
25526 @item -mscore5u
25527 @opindex mscore5u
25528 Specify the SCORE5U of the target architecture.
25529
25530 @item -mscore7
25531 @opindex mscore7
25532 Specify the SCORE7 as the target architecture. This is the default.
25533
25534 @item -mscore7d
25535 @opindex mscore7d
25536 Specify the SCORE7D as the target architecture.
25537 @end table
25538
25539 @node SH Options
25540 @subsection SH Options
25541
25542 These @samp{-m} options are defined for the SH implementations:
25543
25544 @table @gcctabopt
25545 @item -m1
25546 @opindex m1
25547 Generate code for the SH1.
25548
25549 @item -m2
25550 @opindex m2
25551 Generate code for the SH2.
25552
25553 @item -m2e
25554 Generate code for the SH2e.
25555
25556 @item -m2a-nofpu
25557 @opindex m2a-nofpu
25558 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25559 that the floating-point unit is not used.
25560
25561 @item -m2a-single-only
25562 @opindex m2a-single-only
25563 Generate code for the SH2a-FPU, in such a way that no double-precision
25564 floating-point operations are used.
25565
25566 @item -m2a-single
25567 @opindex m2a-single
25568 Generate code for the SH2a-FPU assuming the floating-point unit is in
25569 single-precision mode by default.
25570
25571 @item -m2a
25572 @opindex m2a
25573 Generate code for the SH2a-FPU assuming the floating-point unit is in
25574 double-precision mode by default.
25575
25576 @item -m3
25577 @opindex m3
25578 Generate code for the SH3.
25579
25580 @item -m3e
25581 @opindex m3e
25582 Generate code for the SH3e.
25583
25584 @item -m4-nofpu
25585 @opindex m4-nofpu
25586 Generate code for the SH4 without a floating-point unit.
25587
25588 @item -m4-single-only
25589 @opindex m4-single-only
25590 Generate code for the SH4 with a floating-point unit that only
25591 supports single-precision arithmetic.
25592
25593 @item -m4-single
25594 @opindex m4-single
25595 Generate code for the SH4 assuming the floating-point unit is in
25596 single-precision mode by default.
25597
25598 @item -m4
25599 @opindex m4
25600 Generate code for the SH4.
25601
25602 @item -m4-100
25603 @opindex m4-100
25604 Generate code for SH4-100.
25605
25606 @item -m4-100-nofpu
25607 @opindex m4-100-nofpu
25608 Generate code for SH4-100 in such a way that the
25609 floating-point unit is not used.
25610
25611 @item -m4-100-single
25612 @opindex m4-100-single
25613 Generate code for SH4-100 assuming the floating-point unit is in
25614 single-precision mode by default.
25615
25616 @item -m4-100-single-only
25617 @opindex m4-100-single-only
25618 Generate code for SH4-100 in such a way that no double-precision
25619 floating-point operations are used.
25620
25621 @item -m4-200
25622 @opindex m4-200
25623 Generate code for SH4-200.
25624
25625 @item -m4-200-nofpu
25626 @opindex m4-200-nofpu
25627 Generate code for SH4-200 without in such a way that the
25628 floating-point unit is not used.
25629
25630 @item -m4-200-single
25631 @opindex m4-200-single
25632 Generate code for SH4-200 assuming the floating-point unit is in
25633 single-precision mode by default.
25634
25635 @item -m4-200-single-only
25636 @opindex m4-200-single-only
25637 Generate code for SH4-200 in such a way that no double-precision
25638 floating-point operations are used.
25639
25640 @item -m4-300
25641 @opindex m4-300
25642 Generate code for SH4-300.
25643
25644 @item -m4-300-nofpu
25645 @opindex m4-300-nofpu
25646 Generate code for SH4-300 without in such a way that the
25647 floating-point unit is not used.
25648
25649 @item -m4-300-single
25650 @opindex m4-300-single
25651 Generate code for SH4-300 in such a way that no double-precision
25652 floating-point operations are used.
25653
25654 @item -m4-300-single-only
25655 @opindex m4-300-single-only
25656 Generate code for SH4-300 in such a way that no double-precision
25657 floating-point operations are used.
25658
25659 @item -m4-340
25660 @opindex m4-340
25661 Generate code for SH4-340 (no MMU, no FPU).
25662
25663 @item -m4-500
25664 @opindex m4-500
25665 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25666 assembler.
25667
25668 @item -m4a-nofpu
25669 @opindex m4a-nofpu
25670 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25671 floating-point unit is not used.
25672
25673 @item -m4a-single-only
25674 @opindex m4a-single-only
25675 Generate code for the SH4a, in such a way that no double-precision
25676 floating-point operations are used.
25677
25678 @item -m4a-single
25679 @opindex m4a-single
25680 Generate code for the SH4a assuming the floating-point unit is in
25681 single-precision mode by default.
25682
25683 @item -m4a
25684 @opindex m4a
25685 Generate code for the SH4a.
25686
25687 @item -m4al
25688 @opindex m4al
25689 Same as @option{-m4a-nofpu}, except that it implicitly passes
25690 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25691 instructions at the moment.
25692
25693 @item -mb
25694 @opindex mb
25695 Compile code for the processor in big-endian mode.
25696
25697 @item -ml
25698 @opindex ml
25699 Compile code for the processor in little-endian mode.
25700
25701 @item -mdalign
25702 @opindex mdalign
25703 Align doubles at 64-bit boundaries. Note that this changes the calling
25704 conventions, and thus some functions from the standard C library do
25705 not work unless you recompile it first with @option{-mdalign}.
25706
25707 @item -mrelax
25708 @opindex mrelax
25709 Shorten some address references at link time, when possible; uses the
25710 linker option @option{-relax}.
25711
25712 @item -mbigtable
25713 @opindex mbigtable
25714 Use 32-bit offsets in @code{switch} tables. The default is to use
25715 16-bit offsets.
25716
25717 @item -mbitops
25718 @opindex mbitops
25719 Enable the use of bit manipulation instructions on SH2A.
25720
25721 @item -mfmovd
25722 @opindex mfmovd
25723 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25724 alignment constraints.
25725
25726 @item -mrenesas
25727 @opindex mrenesas
25728 Comply with the calling conventions defined by Renesas.
25729
25730 @item -mno-renesas
25731 @opindex mno-renesas
25732 Comply with the calling conventions defined for GCC before the Renesas
25733 conventions were available. This option is the default for all
25734 targets of the SH toolchain.
25735
25736 @item -mnomacsave
25737 @opindex mnomacsave
25738 Mark the @code{MAC} register as call-clobbered, even if
25739 @option{-mrenesas} is given.
25740
25741 @item -mieee
25742 @itemx -mno-ieee
25743 @opindex mieee
25744 @opindex mno-ieee
25745 Control the IEEE compliance of floating-point comparisons, which affects the
25746 handling of cases where the result of a comparison is unordered. By default
25747 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25748 enabled @option{-mno-ieee} is implicitly set, which results in faster
25749 floating-point greater-equal and less-equal comparisons. The implicit settings
25750 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25751
25752 @item -minline-ic_invalidate
25753 @opindex minline-ic_invalidate
25754 Inline code to invalidate instruction cache entries after setting up
25755 nested function trampolines.
25756 This option has no effect if @option{-musermode} is in effect and the selected
25757 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25758 instruction.
25759 If the selected code generation option does not allow the use of the @code{icbi}
25760 instruction, and @option{-musermode} is not in effect, the inlined code
25761 manipulates the instruction cache address array directly with an associative
25762 write. This not only requires privileged mode at run time, but it also
25763 fails if the cache line had been mapped via the TLB and has become unmapped.
25764
25765 @item -misize
25766 @opindex misize
25767 Dump instruction size and location in the assembly code.
25768
25769 @item -mpadstruct
25770 @opindex mpadstruct
25771 This option is deprecated. It pads structures to multiple of 4 bytes,
25772 which is incompatible with the SH ABI@.
25773
25774 @item -matomic-model=@var{model}
25775 @opindex matomic-model=@var{model}
25776 Sets the model of atomic operations and additional parameters as a comma
25777 separated list. For details on the atomic built-in functions see
25778 @ref{__atomic Builtins}. The following models and parameters are supported:
25779
25780 @table @samp
25781
25782 @item none
25783 Disable compiler generated atomic sequences and emit library calls for atomic
25784 operations. This is the default if the target is not @code{sh*-*-linux*}.
25785
25786 @item soft-gusa
25787 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25788 built-in functions. The generated atomic sequences require additional support
25789 from the interrupt/exception handling code of the system and are only suitable
25790 for SH3* and SH4* single-core systems. This option is enabled by default when
25791 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25792 this option also partially utilizes the hardware atomic instructions
25793 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25794 @samp{strict} is specified.
25795
25796 @item soft-tcb
25797 Generate software atomic sequences that use a variable in the thread control
25798 block. This is a variation of the gUSA sequences which can also be used on
25799 SH1* and SH2* targets. The generated atomic sequences require additional
25800 support from the interrupt/exception handling code of the system and are only
25801 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25802 parameter has to be specified as well.
25803
25804 @item soft-imask
25805 Generate software atomic sequences that temporarily disable interrupts by
25806 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25807 in privileged mode and is only suitable for single-core systems. Additional
25808 support from the interrupt/exception handling code of the system is not
25809 required. This model is enabled by default when the target is
25810 @code{sh*-*-linux*} and SH1* or SH2*.
25811
25812 @item hard-llcs
25813 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25814 instructions only. This is only available on SH4A and is suitable for
25815 multi-core systems. Since the hardware instructions support only 32 bit atomic
25816 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25817 Code compiled with this option is also compatible with other software
25818 atomic model interrupt/exception handling systems if executed on an SH4A
25819 system. Additional support from the interrupt/exception handling code of the
25820 system is not required for this model.
25821
25822 @item gbr-offset=
25823 This parameter specifies the offset in bytes of the variable in the thread
25824 control block structure that should be used by the generated atomic sequences
25825 when the @samp{soft-tcb} model has been selected. For other models this
25826 parameter is ignored. The specified value must be an integer multiple of four
25827 and in the range 0-1020.
25828
25829 @item strict
25830 This parameter prevents mixed usage of multiple atomic models, even if they
25831 are compatible, and makes the compiler generate atomic sequences of the
25832 specified model only.
25833
25834 @end table
25835
25836 @item -mtas
25837 @opindex mtas
25838 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25839 Notice that depending on the particular hardware and software configuration
25840 this can degrade overall performance due to the operand cache line flushes
25841 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25842 processors the @code{tas.b} instruction must be used with caution since it
25843 can result in data corruption for certain cache configurations.
25844
25845 @item -mprefergot
25846 @opindex mprefergot
25847 When generating position-independent code, emit function calls using
25848 the Global Offset Table instead of the Procedure Linkage Table.
25849
25850 @item -musermode
25851 @itemx -mno-usermode
25852 @opindex musermode
25853 @opindex mno-usermode
25854 Don't allow (allow) the compiler generating privileged mode code. Specifying
25855 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25856 inlined code would not work in user mode. @option{-musermode} is the default
25857 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25858 @option{-musermode} has no effect, since there is no user mode.
25859
25860 @item -multcost=@var{number}
25861 @opindex multcost=@var{number}
25862 Set the cost to assume for a multiply insn.
25863
25864 @item -mdiv=@var{strategy}
25865 @opindex mdiv=@var{strategy}
25866 Set the division strategy to be used for integer division operations.
25867 @var{strategy} can be one of:
25868
25869 @table @samp
25870
25871 @item call-div1
25872 Calls a library function that uses the single-step division instruction
25873 @code{div1} to perform the operation. Division by zero calculates an
25874 unspecified result and does not trap. This is the default except for SH4,
25875 SH2A and SHcompact.
25876
25877 @item call-fp
25878 Calls a library function that performs the operation in double precision
25879 floating point. Division by zero causes a floating-point exception. This is
25880 the default for SHcompact with FPU. Specifying this for targets that do not
25881 have a double precision FPU defaults to @code{call-div1}.
25882
25883 @item call-table
25884 Calls a library function that uses a lookup table for small divisors and
25885 the @code{div1} instruction with case distinction for larger divisors. Division
25886 by zero calculates an unspecified result and does not trap. This is the default
25887 for SH4. Specifying this for targets that do not have dynamic shift
25888 instructions defaults to @code{call-div1}.
25889
25890 @end table
25891
25892 When a division strategy has not been specified the default strategy is
25893 selected based on the current target. For SH2A the default strategy is to
25894 use the @code{divs} and @code{divu} instructions instead of library function
25895 calls.
25896
25897 @item -maccumulate-outgoing-args
25898 @opindex maccumulate-outgoing-args
25899 Reserve space once for outgoing arguments in the function prologue rather
25900 than around each call. Generally beneficial for performance and size. Also
25901 needed for unwinding to avoid changing the stack frame around conditional code.
25902
25903 @item -mdivsi3_libfunc=@var{name}
25904 @opindex mdivsi3_libfunc=@var{name}
25905 Set the name of the library function used for 32-bit signed division to
25906 @var{name}.
25907 This only affects the name used in the @samp{call} division strategies, and
25908 the compiler still expects the same sets of input/output/clobbered registers as
25909 if this option were not present.
25910
25911 @item -mfixed-range=@var{register-range}
25912 @opindex mfixed-range
25913 Generate code treating the given register range as fixed registers.
25914 A fixed register is one that the register allocator cannot use. This is
25915 useful when compiling kernel code. A register range is specified as
25916 two registers separated by a dash. Multiple register ranges can be
25917 specified separated by a comma.
25918
25919 @item -mbranch-cost=@var{num}
25920 @opindex mbranch-cost=@var{num}
25921 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25922 make the compiler try to generate more branch-free code if possible.
25923 If not specified the value is selected depending on the processor type that
25924 is being compiled for.
25925
25926 @item -mzdcbranch
25927 @itemx -mno-zdcbranch
25928 @opindex mzdcbranch
25929 @opindex mno-zdcbranch
25930 Assume (do not assume) that zero displacement conditional branch instructions
25931 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25932 compiler prefers zero displacement branch code sequences. This is
25933 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25934 disabled by specifying @option{-mno-zdcbranch}.
25935
25936 @item -mcbranch-force-delay-slot
25937 @opindex mcbranch-force-delay-slot
25938 Force the usage of delay slots for conditional branches, which stuffs the delay
25939 slot with a @code{nop} if a suitable instruction cannot be found. By default
25940 this option is disabled. It can be enabled to work around hardware bugs as
25941 found in the original SH7055.
25942
25943 @item -mfused-madd
25944 @itemx -mno-fused-madd
25945 @opindex mfused-madd
25946 @opindex mno-fused-madd
25947 Generate code that uses (does not use) the floating-point multiply and
25948 accumulate instructions. These instructions are generated by default
25949 if hardware floating point is used. The machine-dependent
25950 @option{-mfused-madd} option is now mapped to the machine-independent
25951 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25952 mapped to @option{-ffp-contract=off}.
25953
25954 @item -mfsca
25955 @itemx -mno-fsca
25956 @opindex mfsca
25957 @opindex mno-fsca
25958 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25959 and cosine approximations. The option @option{-mfsca} must be used in
25960 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25961 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25962 approximations even if @option{-funsafe-math-optimizations} is in effect.
25963
25964 @item -mfsrra
25965 @itemx -mno-fsrra
25966 @opindex mfsrra
25967 @opindex mno-fsrra
25968 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25969 reciprocal square root approximations. The option @option{-mfsrra} must be used
25970 in combination with @option{-funsafe-math-optimizations} and
25971 @option{-ffinite-math-only}. It is enabled by default when generating code for
25972 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25973 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25974 in effect.
25975
25976 @item -mpretend-cmove
25977 @opindex mpretend-cmove
25978 Prefer zero-displacement conditional branches for conditional move instruction
25979 patterns. This can result in faster code on the SH4 processor.
25980
25981 @item -mfdpic
25982 @opindex fdpic
25983 Generate code using the FDPIC ABI.
25984
25985 @end table
25986
25987 @node Solaris 2 Options
25988 @subsection Solaris 2 Options
25989 @cindex Solaris 2 options
25990
25991 These @samp{-m} options are supported on Solaris 2:
25992
25993 @table @gcctabopt
25994 @item -mclear-hwcap
25995 @opindex mclear-hwcap
25996 @option{-mclear-hwcap} tells the compiler to remove the hardware
25997 capabilities generated by the Solaris assembler. This is only necessary
25998 when object files use ISA extensions not supported by the current
25999 machine, but check at runtime whether or not to use them.
26000
26001 @item -mimpure-text
26002 @opindex mimpure-text
26003 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26004 the compiler to not pass @option{-z text} to the linker when linking a
26005 shared object. Using this option, you can link position-dependent
26006 code into a shared object.
26007
26008 @option{-mimpure-text} suppresses the ``relocations remain against
26009 allocatable but non-writable sections'' linker error message.
26010 However, the necessary relocations trigger copy-on-write, and the
26011 shared object is not actually shared across processes. Instead of
26012 using @option{-mimpure-text}, you should compile all source code with
26013 @option{-fpic} or @option{-fPIC}.
26014
26015 @end table
26016
26017 These switches are supported in addition to the above on Solaris 2:
26018
26019 @table @gcctabopt
26020 @item -pthreads
26021 @opindex pthreads
26022 This is a synonym for @option{-pthread}.
26023 @end table
26024
26025 @node SPARC Options
26026 @subsection SPARC Options
26027 @cindex SPARC options
26028
26029 These @samp{-m} options are supported on the SPARC:
26030
26031 @table @gcctabopt
26032 @item -mno-app-regs
26033 @itemx -mapp-regs
26034 @opindex mno-app-regs
26035 @opindex mapp-regs
26036 Specify @option{-mapp-regs} to generate output using the global registers
26037 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26038 global register 1, each global register 2 through 4 is then treated as an
26039 allocable register that is clobbered by function calls. This is the default.
26040
26041 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26042 specify @option{-mno-app-regs}. You should compile libraries and system
26043 software with this option.
26044
26045 @item -mflat
26046 @itemx -mno-flat
26047 @opindex mflat
26048 @opindex mno-flat
26049 With @option{-mflat}, the compiler does not generate save/restore instructions
26050 and uses a ``flat'' or single register window model. This model is compatible
26051 with the regular register window model. The local registers and the input
26052 registers (0--5) are still treated as ``call-saved'' registers and are
26053 saved on the stack as needed.
26054
26055 With @option{-mno-flat} (the default), the compiler generates save/restore
26056 instructions (except for leaf functions). This is the normal operating mode.
26057
26058 @item -mfpu
26059 @itemx -mhard-float
26060 @opindex mfpu
26061 @opindex mhard-float
26062 Generate output containing floating-point instructions. This is the
26063 default.
26064
26065 @item -mno-fpu
26066 @itemx -msoft-float
26067 @opindex mno-fpu
26068 @opindex msoft-float
26069 Generate output containing library calls for floating point.
26070 @strong{Warning:} the requisite libraries are not available for all SPARC
26071 targets. Normally the facilities of the machine's usual C compiler are
26072 used, but this cannot be done directly in cross-compilation. You must make
26073 your own arrangements to provide suitable library functions for
26074 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26075 @samp{sparclite-*-*} do provide software floating-point support.
26076
26077 @option{-msoft-float} changes the calling convention in the output file;
26078 therefore, it is only useful if you compile @emph{all} of a program with
26079 this option. In particular, you need to compile @file{libgcc.a}, the
26080 library that comes with GCC, with @option{-msoft-float} in order for
26081 this to work.
26082
26083 @item -mhard-quad-float
26084 @opindex mhard-quad-float
26085 Generate output containing quad-word (long double) floating-point
26086 instructions.
26087
26088 @item -msoft-quad-float
26089 @opindex msoft-quad-float
26090 Generate output containing library calls for quad-word (long double)
26091 floating-point instructions. The functions called are those specified
26092 in the SPARC ABI@. This is the default.
26093
26094 As of this writing, there are no SPARC implementations that have hardware
26095 support for the quad-word floating-point instructions. They all invoke
26096 a trap handler for one of these instructions, and then the trap handler
26097 emulates the effect of the instruction. Because of the trap handler overhead,
26098 this is much slower than calling the ABI library routines. Thus the
26099 @option{-msoft-quad-float} option is the default.
26100
26101 @item -mno-unaligned-doubles
26102 @itemx -munaligned-doubles
26103 @opindex mno-unaligned-doubles
26104 @opindex munaligned-doubles
26105 Assume that doubles have 8-byte alignment. This is the default.
26106
26107 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26108 alignment only if they are contained in another type, or if they have an
26109 absolute address. Otherwise, it assumes they have 4-byte alignment.
26110 Specifying this option avoids some rare compatibility problems with code
26111 generated by other compilers. It is not the default because it results
26112 in a performance loss, especially for floating-point code.
26113
26114 @item -muser-mode
26115 @itemx -mno-user-mode
26116 @opindex muser-mode
26117 @opindex mno-user-mode
26118 Do not generate code that can only run in supervisor mode. This is relevant
26119 only for the @code{casa} instruction emitted for the LEON3 processor. This
26120 is the default.
26121
26122 @item -mfaster-structs
26123 @itemx -mno-faster-structs
26124 @opindex mfaster-structs
26125 @opindex mno-faster-structs
26126 With @option{-mfaster-structs}, the compiler assumes that structures
26127 should have 8-byte alignment. This enables the use of pairs of
26128 @code{ldd} and @code{std} instructions for copies in structure
26129 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26130 However, the use of this changed alignment directly violates the SPARC
26131 ABI@. Thus, it's intended only for use on targets where the developer
26132 acknowledges that their resulting code is not directly in line with
26133 the rules of the ABI@.
26134
26135 @item -mstd-struct-return
26136 @itemx -mno-std-struct-return
26137 @opindex mstd-struct-return
26138 @opindex mno-std-struct-return
26139 With @option{-mstd-struct-return}, the compiler generates checking code
26140 in functions returning structures or unions to detect size mismatches
26141 between the two sides of function calls, as per the 32-bit ABI@.
26142
26143 The default is @option{-mno-std-struct-return}. This option has no effect
26144 in 64-bit mode.
26145
26146 @item -mlra
26147 @itemx -mno-lra
26148 @opindex mlra
26149 @opindex mno-lra
26150 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26151 so @option{-mno-lra} needs to be passed to get old Reload.
26152
26153 @item -mcpu=@var{cpu_type}
26154 @opindex mcpu
26155 Set the instruction set, register set, and instruction scheduling parameters
26156 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26157 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26158 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26159 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26160 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26161 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26162
26163 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26164 which selects the best architecture option for the host processor.
26165 @option{-mcpu=native} has no effect if GCC does not recognize
26166 the processor.
26167
26168 Default instruction scheduling parameters are used for values that select
26169 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26170 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26171
26172 Here is a list of each supported architecture and their supported
26173 implementations.
26174
26175 @table @asis
26176 @item v7
26177 cypress, leon3v7
26178
26179 @item v8
26180 supersparc, hypersparc, leon, leon3
26181
26182 @item sparclite
26183 f930, f934, sparclite86x
26184
26185 @item sparclet
26186 tsc701
26187
26188 @item v9
26189 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26190 niagara7, m8
26191 @end table
26192
26193 By default (unless configured otherwise), GCC generates code for the V7
26194 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26195 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26196 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26197 SPARCStation 1, 2, IPX etc.
26198
26199 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26200 architecture. The only difference from V7 code is that the compiler emits
26201 the integer multiply and integer divide instructions which exist in SPARC-V8
26202 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26203 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26204 2000 series.
26205
26206 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26207 the SPARC architecture. This adds the integer multiply, integer divide step
26208 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26209 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26210 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26211 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26212 MB86934 chip, which is the more recent SPARClite with FPU@.
26213
26214 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26215 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26216 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26217 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26218 optimizes it for the TEMIC SPARClet chip.
26219
26220 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26221 architecture. This adds 64-bit integer and floating-point move instructions,
26222 3 additional floating-point condition code registers and conditional move
26223 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26224 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26225 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26226 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26227 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26228 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26229 additionally optimizes it for Sun UltraSPARC T2 chips. With
26230 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26231 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26232 additionally optimizes it for Sun UltraSPARC T4 chips. With
26233 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26234 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26235 additionally optimizes it for Oracle M8 chips.
26236
26237 @item -mtune=@var{cpu_type}
26238 @opindex mtune
26239 Set the instruction scheduling parameters for machine type
26240 @var{cpu_type}, but do not set the instruction set or register set that the
26241 option @option{-mcpu=@var{cpu_type}} does.
26242
26243 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26244 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26245 that select a particular CPU implementation. Those are
26246 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26247 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26248 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26249 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26250 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26251 and GNU/Linux toolchains, @samp{native} can also be used.
26252
26253 @item -mv8plus
26254 @itemx -mno-v8plus
26255 @opindex mv8plus
26256 @opindex mno-v8plus
26257 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26258 difference from the V8 ABI is that the global and out registers are
26259 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26260 mode for all SPARC-V9 processors.
26261
26262 @item -mvis
26263 @itemx -mno-vis
26264 @opindex mvis
26265 @opindex mno-vis
26266 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26267 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26268
26269 @item -mvis2
26270 @itemx -mno-vis2
26271 @opindex mvis2
26272 @opindex mno-vis2
26273 With @option{-mvis2}, GCC generates code that takes advantage of
26274 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26275 default is @option{-mvis2} when targeting a cpu that supports such
26276 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26277 also sets @option{-mvis}.
26278
26279 @item -mvis3
26280 @itemx -mno-vis3
26281 @opindex mvis3
26282 @opindex mno-vis3
26283 With @option{-mvis3}, GCC generates code that takes advantage of
26284 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26285 default is @option{-mvis3} when targeting a cpu that supports such
26286 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26287 also sets @option{-mvis2} and @option{-mvis}.
26288
26289 @item -mvis4
26290 @itemx -mno-vis4
26291 @opindex mvis4
26292 @opindex mno-vis4
26293 With @option{-mvis4}, GCC generates code that takes advantage of
26294 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26295 default is @option{-mvis4} when targeting a cpu that supports such
26296 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26297 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26298
26299 @item -mvis4b
26300 @itemx -mno-vis4b
26301 @opindex mvis4b
26302 @opindex mno-vis4b
26303 With @option{-mvis4b}, GCC generates code that takes advantage of
26304 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26305 the additional VIS instructions introduced in the Oracle SPARC
26306 Architecture 2017. The default is @option{-mvis4b} when targeting a
26307 cpu that supports such instructions, such as m8 and later. Setting
26308 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26309 @option{-mvis2} and @option{-mvis}.
26310
26311 @item -mcbcond
26312 @itemx -mno-cbcond
26313 @opindex mcbcond
26314 @opindex mno-cbcond
26315 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26316 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26317 when targeting a CPU that supports such instructions, such as Niagara-4 and
26318 later.
26319
26320 @item -mfmaf
26321 @itemx -mno-fmaf
26322 @opindex mfmaf
26323 @opindex mno-fmaf
26324 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26325 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26326 when targeting a CPU that supports such instructions, such as Niagara-3 and
26327 later.
26328
26329 @item -mfsmuld
26330 @itemx -mno-fsmuld
26331 @opindex mfsmuld
26332 @opindex mno-fsmuld
26333 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26334 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26335 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26336 or V9 with FPU except @option{-mcpu=leon}.
26337
26338 @item -mpopc
26339 @itemx -mno-popc
26340 @opindex mpopc
26341 @opindex mno-popc
26342 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26343 Population Count instruction. The default is @option{-mpopc}
26344 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26345 later.
26346
26347 @item -msubxc
26348 @itemx -mno-subxc
26349 @opindex msubxc
26350 @opindex mno-subxc
26351 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26352 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26353 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26354 later.
26355
26356 @item -mfix-at697f
26357 @opindex mfix-at697f
26358 Enable the documented workaround for the single erratum of the Atmel AT697F
26359 processor (which corresponds to erratum #13 of the AT697E processor).
26360
26361 @item -mfix-ut699
26362 @opindex mfix-ut699
26363 Enable the documented workarounds for the floating-point errata and the data
26364 cache nullify errata of the UT699 processor.
26365
26366 @item -mfix-ut700
26367 @opindex mfix-ut700
26368 Enable the documented workaround for the back-to-back store errata of
26369 the UT699E/UT700 processor.
26370
26371 @item -mfix-gr712rc
26372 @opindex mfix-gr712rc
26373 Enable the documented workaround for the back-to-back store errata of
26374 the GR712RC processor.
26375 @end table
26376
26377 These @samp{-m} options are supported in addition to the above
26378 on SPARC-V9 processors in 64-bit environments:
26379
26380 @table @gcctabopt
26381 @item -m32
26382 @itemx -m64
26383 @opindex m32
26384 @opindex m64
26385 Generate code for a 32-bit or 64-bit environment.
26386 The 32-bit environment sets int, long and pointer to 32 bits.
26387 The 64-bit environment sets int to 32 bits and long and pointer
26388 to 64 bits.
26389
26390 @item -mcmodel=@var{which}
26391 @opindex mcmodel
26392 Set the code model to one of
26393
26394 @table @samp
26395 @item medlow
26396 The Medium/Low code model: 64-bit addresses, programs
26397 must be linked in the low 32 bits of memory. Programs can be statically
26398 or dynamically linked.
26399
26400 @item medmid
26401 The Medium/Middle code model: 64-bit addresses, programs
26402 must be linked in the low 44 bits of memory, the text and data segments must
26403 be less than 2GB in size and the data segment must be located within 2GB of
26404 the text segment.
26405
26406 @item medany
26407 The Medium/Anywhere code model: 64-bit addresses, programs
26408 may be linked anywhere in memory, the text and data segments must be less
26409 than 2GB in size and the data segment must be located within 2GB of the
26410 text segment.
26411
26412 @item embmedany
26413 The Medium/Anywhere code model for embedded systems:
26414 64-bit addresses, the text and data segments must be less than 2GB in
26415 size, both starting anywhere in memory (determined at link time). The
26416 global register %g4 points to the base of the data segment. Programs
26417 are statically linked and PIC is not supported.
26418 @end table
26419
26420 @item -mmemory-model=@var{mem-model}
26421 @opindex mmemory-model
26422 Set the memory model in force on the processor to one of
26423
26424 @table @samp
26425 @item default
26426 The default memory model for the processor and operating system.
26427
26428 @item rmo
26429 Relaxed Memory Order
26430
26431 @item pso
26432 Partial Store Order
26433
26434 @item tso
26435 Total Store Order
26436
26437 @item sc
26438 Sequential Consistency
26439 @end table
26440
26441 These memory models are formally defined in Appendix D of the SPARC-V9
26442 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26443
26444 @item -mstack-bias
26445 @itemx -mno-stack-bias
26446 @opindex mstack-bias
26447 @opindex mno-stack-bias
26448 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26449 frame pointer if present, are offset by @minus{}2047 which must be added back
26450 when making stack frame references. This is the default in 64-bit mode.
26451 Otherwise, assume no such offset is present.
26452 @end table
26453
26454 @node SPU Options
26455 @subsection SPU Options
26456 @cindex SPU options
26457
26458 These @samp{-m} options are supported on the SPU:
26459
26460 @table @gcctabopt
26461 @item -mwarn-reloc
26462 @itemx -merror-reloc
26463 @opindex mwarn-reloc
26464 @opindex merror-reloc
26465
26466 The loader for SPU does not handle dynamic relocations. By default, GCC
26467 gives an error when it generates code that requires a dynamic
26468 relocation. @option{-mno-error-reloc} disables the error,
26469 @option{-mwarn-reloc} generates a warning instead.
26470
26471 @item -msafe-dma
26472 @itemx -munsafe-dma
26473 @opindex msafe-dma
26474 @opindex munsafe-dma
26475
26476 Instructions that initiate or test completion of DMA must not be
26477 reordered with respect to loads and stores of the memory that is being
26478 accessed.
26479 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26480 memory accesses, but that can lead to inefficient code in places where the
26481 memory is known to not change. Rather than mark the memory as volatile,
26482 you can use @option{-msafe-dma} to tell the compiler to treat
26483 the DMA instructions as potentially affecting all memory.
26484
26485 @item -mbranch-hints
26486 @opindex mbranch-hints
26487
26488 By default, GCC generates a branch hint instruction to avoid
26489 pipeline stalls for always-taken or probably-taken branches. A hint
26490 is not generated closer than 8 instructions away from its branch.
26491 There is little reason to disable them, except for debugging purposes,
26492 or to make an object a little bit smaller.
26493
26494 @item -msmall-mem
26495 @itemx -mlarge-mem
26496 @opindex msmall-mem
26497 @opindex mlarge-mem
26498
26499 By default, GCC generates code assuming that addresses are never larger
26500 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26501 a full 32-bit address.
26502
26503 @item -mstdmain
26504 @opindex mstdmain
26505
26506 By default, GCC links against startup code that assumes the SPU-style
26507 main function interface (which has an unconventional parameter list).
26508 With @option{-mstdmain}, GCC links your program against startup
26509 code that assumes a C99-style interface to @code{main}, including a
26510 local copy of @code{argv} strings.
26511
26512 @item -mfixed-range=@var{register-range}
26513 @opindex mfixed-range
26514 Generate code treating the given register range as fixed registers.
26515 A fixed register is one that the register allocator cannot use. This is
26516 useful when compiling kernel code. A register range is specified as
26517 two registers separated by a dash. Multiple register ranges can be
26518 specified separated by a comma.
26519
26520 @item -mea32
26521 @itemx -mea64
26522 @opindex mea32
26523 @opindex mea64
26524 Compile code assuming that pointers to the PPU address space accessed
26525 via the @code{__ea} named address space qualifier are either 32 or 64
26526 bits wide. The default is 32 bits. As this is an ABI-changing option,
26527 all object code in an executable must be compiled with the same setting.
26528
26529 @item -maddress-space-conversion
26530 @itemx -mno-address-space-conversion
26531 @opindex maddress-space-conversion
26532 @opindex mno-address-space-conversion
26533 Allow/disallow treating the @code{__ea} address space as superset
26534 of the generic address space. This enables explicit type casts
26535 between @code{__ea} and generic pointer as well as implicit
26536 conversions of generic pointers to @code{__ea} pointers. The
26537 default is to allow address space pointer conversions.
26538
26539 @item -mcache-size=@var{cache-size}
26540 @opindex mcache-size
26541 This option controls the version of libgcc that the compiler links to an
26542 executable and selects a software-managed cache for accessing variables
26543 in the @code{__ea} address space with a particular cache size. Possible
26544 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26545 and @samp{128}. The default cache size is 64KB.
26546
26547 @item -matomic-updates
26548 @itemx -mno-atomic-updates
26549 @opindex matomic-updates
26550 @opindex mno-atomic-updates
26551 This option controls the version of libgcc that the compiler links to an
26552 executable and selects whether atomic updates to the software-managed
26553 cache of PPU-side variables are used. If you use atomic updates, changes
26554 to a PPU variable from SPU code using the @code{__ea} named address space
26555 qualifier do not interfere with changes to other PPU variables residing
26556 in the same cache line from PPU code. If you do not use atomic updates,
26557 such interference may occur; however, writing back cache lines is
26558 more efficient. The default behavior is to use atomic updates.
26559
26560 @item -mdual-nops
26561 @itemx -mdual-nops=@var{n}
26562 @opindex mdual-nops
26563 By default, GCC inserts NOPs to increase dual issue when it expects
26564 it to increase performance. @var{n} can be a value from 0 to 10. A
26565 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26566 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26567
26568 @item -mhint-max-nops=@var{n}
26569 @opindex mhint-max-nops
26570 Maximum number of NOPs to insert for a branch hint. A branch hint must
26571 be at least 8 instructions away from the branch it is affecting. GCC
26572 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26573 generate the branch hint.
26574
26575 @item -mhint-max-distance=@var{n}
26576 @opindex mhint-max-distance
26577 The encoding of the branch hint instruction limits the hint to be within
26578 256 instructions of the branch it is affecting. By default, GCC makes
26579 sure it is within 125.
26580
26581 @item -msafe-hints
26582 @opindex msafe-hints
26583 Work around a hardware bug that causes the SPU to stall indefinitely.
26584 By default, GCC inserts the @code{hbrp} instruction to make sure
26585 this stall won't happen.
26586
26587 @end table
26588
26589 @node System V Options
26590 @subsection Options for System V
26591
26592 These additional options are available on System V Release 4 for
26593 compatibility with other compilers on those systems:
26594
26595 @table @gcctabopt
26596 @item -G
26597 @opindex G
26598 Create a shared object.
26599 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26600
26601 @item -Qy
26602 @opindex Qy
26603 Identify the versions of each tool used by the compiler, in a
26604 @code{.ident} assembler directive in the output.
26605
26606 @item -Qn
26607 @opindex Qn
26608 Refrain from adding @code{.ident} directives to the output file (this is
26609 the default).
26610
26611 @item -YP,@var{dirs}
26612 @opindex YP
26613 Search the directories @var{dirs}, and no others, for libraries
26614 specified with @option{-l}.
26615
26616 @item -Ym,@var{dir}
26617 @opindex Ym
26618 Look in the directory @var{dir} to find the M4 preprocessor.
26619 The assembler uses this option.
26620 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26621 @c the generic assembler that comes with Solaris takes just -Ym.
26622 @end table
26623
26624 @node TILE-Gx Options
26625 @subsection TILE-Gx Options
26626 @cindex TILE-Gx options
26627
26628 These @samp{-m} options are supported on the TILE-Gx:
26629
26630 @table @gcctabopt
26631 @item -mcmodel=small
26632 @opindex mcmodel=small
26633 Generate code for the small model. The distance for direct calls is
26634 limited to 500M in either direction. PC-relative addresses are 32
26635 bits. Absolute addresses support the full address range.
26636
26637 @item -mcmodel=large
26638 @opindex mcmodel=large
26639 Generate code for the large model. There is no limitation on call
26640 distance, pc-relative addresses, or absolute addresses.
26641
26642 @item -mcpu=@var{name}
26643 @opindex mcpu
26644 Selects the type of CPU to be targeted. Currently the only supported
26645 type is @samp{tilegx}.
26646
26647 @item -m32
26648 @itemx -m64
26649 @opindex m32
26650 @opindex m64
26651 Generate code for a 32-bit or 64-bit environment. The 32-bit
26652 environment sets int, long, and pointer to 32 bits. The 64-bit
26653 environment sets int to 32 bits and long and pointer to 64 bits.
26654
26655 @item -mbig-endian
26656 @itemx -mlittle-endian
26657 @opindex mbig-endian
26658 @opindex mlittle-endian
26659 Generate code in big/little endian mode, respectively.
26660 @end table
26661
26662 @node TILEPro Options
26663 @subsection TILEPro Options
26664 @cindex TILEPro options
26665
26666 These @samp{-m} options are supported on the TILEPro:
26667
26668 @table @gcctabopt
26669 @item -mcpu=@var{name}
26670 @opindex mcpu
26671 Selects the type of CPU to be targeted. Currently the only supported
26672 type is @samp{tilepro}.
26673
26674 @item -m32
26675 @opindex m32
26676 Generate code for a 32-bit environment, which sets int, long, and
26677 pointer to 32 bits. This is the only supported behavior so the flag
26678 is essentially ignored.
26679 @end table
26680
26681 @node V850 Options
26682 @subsection V850 Options
26683 @cindex V850 Options
26684
26685 These @samp{-m} options are defined for V850 implementations:
26686
26687 @table @gcctabopt
26688 @item -mlong-calls
26689 @itemx -mno-long-calls
26690 @opindex mlong-calls
26691 @opindex mno-long-calls
26692 Treat all calls as being far away (near). If calls are assumed to be
26693 far away, the compiler always loads the function's address into a
26694 register, and calls indirect through the pointer.
26695
26696 @item -mno-ep
26697 @itemx -mep
26698 @opindex mno-ep
26699 @opindex mep
26700 Do not optimize (do optimize) basic blocks that use the same index
26701 pointer 4 or more times to copy pointer into the @code{ep} register, and
26702 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26703 option is on by default if you optimize.
26704
26705 @item -mno-prolog-function
26706 @itemx -mprolog-function
26707 @opindex mno-prolog-function
26708 @opindex mprolog-function
26709 Do not use (do use) external functions to save and restore registers
26710 at the prologue and epilogue of a function. The external functions
26711 are slower, but use less code space if more than one function saves
26712 the same number of registers. The @option{-mprolog-function} option
26713 is on by default if you optimize.
26714
26715 @item -mspace
26716 @opindex mspace
26717 Try to make the code as small as possible. At present, this just turns
26718 on the @option{-mep} and @option{-mprolog-function} options.
26719
26720 @item -mtda=@var{n}
26721 @opindex mtda
26722 Put static or global variables whose size is @var{n} bytes or less into
26723 the tiny data area that register @code{ep} points to. The tiny data
26724 area can hold up to 256 bytes in total (128 bytes for byte references).
26725
26726 @item -msda=@var{n}
26727 @opindex msda
26728 Put static or global variables whose size is @var{n} bytes or less into
26729 the small data area that register @code{gp} points to. The small data
26730 area can hold up to 64 kilobytes.
26731
26732 @item -mzda=@var{n}
26733 @opindex mzda
26734 Put static or global variables whose size is @var{n} bytes or less into
26735 the first 32 kilobytes of memory.
26736
26737 @item -mv850
26738 @opindex mv850
26739 Specify that the target processor is the V850.
26740
26741 @item -mv850e3v5
26742 @opindex mv850e3v5
26743 Specify that the target processor is the V850E3V5. The preprocessor
26744 constant @code{__v850e3v5__} is defined if this option is used.
26745
26746 @item -mv850e2v4
26747 @opindex mv850e2v4
26748 Specify that the target processor is the V850E3V5. This is an alias for
26749 the @option{-mv850e3v5} option.
26750
26751 @item -mv850e2v3
26752 @opindex mv850e2v3
26753 Specify that the target processor is the V850E2V3. The preprocessor
26754 constant @code{__v850e2v3__} is defined if this option is used.
26755
26756 @item -mv850e2
26757 @opindex mv850e2
26758 Specify that the target processor is the V850E2. The preprocessor
26759 constant @code{__v850e2__} is defined if this option is used.
26760
26761 @item -mv850e1
26762 @opindex mv850e1
26763 Specify that the target processor is the V850E1. The preprocessor
26764 constants @code{__v850e1__} and @code{__v850e__} are defined if
26765 this option is used.
26766
26767 @item -mv850es
26768 @opindex mv850es
26769 Specify that the target processor is the V850ES. This is an alias for
26770 the @option{-mv850e1} option.
26771
26772 @item -mv850e
26773 @opindex mv850e
26774 Specify that the target processor is the V850E@. The preprocessor
26775 constant @code{__v850e__} is defined if this option is used.
26776
26777 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26778 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26779 are defined then a default target processor is chosen and the
26780 relevant @samp{__v850*__} preprocessor constant is defined.
26781
26782 The preprocessor constants @code{__v850} and @code{__v851__} are always
26783 defined, regardless of which processor variant is the target.
26784
26785 @item -mdisable-callt
26786 @itemx -mno-disable-callt
26787 @opindex mdisable-callt
26788 @opindex mno-disable-callt
26789 This option suppresses generation of the @code{CALLT} instruction for the
26790 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26791 architecture.
26792
26793 This option is enabled by default when the RH850 ABI is
26794 in use (see @option{-mrh850-abi}), and disabled by default when the
26795 GCC ABI is in use. If @code{CALLT} instructions are being generated
26796 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26797
26798 @item -mrelax
26799 @itemx -mno-relax
26800 @opindex mrelax
26801 @opindex mno-relax
26802 Pass on (or do not pass on) the @option{-mrelax} command-line option
26803 to the assembler.
26804
26805 @item -mlong-jumps
26806 @itemx -mno-long-jumps
26807 @opindex mlong-jumps
26808 @opindex mno-long-jumps
26809 Disable (or re-enable) the generation of PC-relative jump instructions.
26810
26811 @item -msoft-float
26812 @itemx -mhard-float
26813 @opindex msoft-float
26814 @opindex mhard-float
26815 Disable (or re-enable) the generation of hardware floating point
26816 instructions. This option is only significant when the target
26817 architecture is @samp{V850E2V3} or higher. If hardware floating point
26818 instructions are being generated then the C preprocessor symbol
26819 @code{__FPU_OK__} is defined, otherwise the symbol
26820 @code{__NO_FPU__} is defined.
26821
26822 @item -mloop
26823 @opindex mloop
26824 Enables the use of the e3v5 LOOP instruction. The use of this
26825 instruction is not enabled by default when the e3v5 architecture is
26826 selected because its use is still experimental.
26827
26828 @item -mrh850-abi
26829 @itemx -mghs
26830 @opindex mrh850-abi
26831 @opindex mghs
26832 Enables support for the RH850 version of the V850 ABI. This is the
26833 default. With this version of the ABI the following rules apply:
26834
26835 @itemize
26836 @item
26837 Integer sized structures and unions are returned via a memory pointer
26838 rather than a register.
26839
26840 @item
26841 Large structures and unions (more than 8 bytes in size) are passed by
26842 value.
26843
26844 @item
26845 Functions are aligned to 16-bit boundaries.
26846
26847 @item
26848 The @option{-m8byte-align} command-line option is supported.
26849
26850 @item
26851 The @option{-mdisable-callt} command-line option is enabled by
26852 default. The @option{-mno-disable-callt} command-line option is not
26853 supported.
26854 @end itemize
26855
26856 When this version of the ABI is enabled the C preprocessor symbol
26857 @code{__V850_RH850_ABI__} is defined.
26858
26859 @item -mgcc-abi
26860 @opindex mgcc-abi
26861 Enables support for the old GCC version of the V850 ABI. With this
26862 version of the ABI the following rules apply:
26863
26864 @itemize
26865 @item
26866 Integer sized structures and unions are returned in register @code{r10}.
26867
26868 @item
26869 Large structures and unions (more than 8 bytes in size) are passed by
26870 reference.
26871
26872 @item
26873 Functions are aligned to 32-bit boundaries, unless optimizing for
26874 size.
26875
26876 @item
26877 The @option{-m8byte-align} command-line option is not supported.
26878
26879 @item
26880 The @option{-mdisable-callt} command-line option is supported but not
26881 enabled by default.
26882 @end itemize
26883
26884 When this version of the ABI is enabled the C preprocessor symbol
26885 @code{__V850_GCC_ABI__} is defined.
26886
26887 @item -m8byte-align
26888 @itemx -mno-8byte-align
26889 @opindex m8byte-align
26890 @opindex mno-8byte-align
26891 Enables support for @code{double} and @code{long long} types to be
26892 aligned on 8-byte boundaries. The default is to restrict the
26893 alignment of all objects to at most 4-bytes. When
26894 @option{-m8byte-align} is in effect the C preprocessor symbol
26895 @code{__V850_8BYTE_ALIGN__} is defined.
26896
26897 @item -mbig-switch
26898 @opindex mbig-switch
26899 Generate code suitable for big switch tables. Use this option only if
26900 the assembler/linker complain about out of range branches within a switch
26901 table.
26902
26903 @item -mapp-regs
26904 @opindex mapp-regs
26905 This option causes r2 and r5 to be used in the code generated by
26906 the compiler. This setting is the default.
26907
26908 @item -mno-app-regs
26909 @opindex mno-app-regs
26910 This option causes r2 and r5 to be treated as fixed registers.
26911
26912 @end table
26913
26914 @node VAX Options
26915 @subsection VAX Options
26916 @cindex VAX options
26917
26918 These @samp{-m} options are defined for the VAX:
26919
26920 @table @gcctabopt
26921 @item -munix
26922 @opindex munix
26923 Do not output certain jump instructions (@code{aobleq} and so on)
26924 that the Unix assembler for the VAX cannot handle across long
26925 ranges.
26926
26927 @item -mgnu
26928 @opindex mgnu
26929 Do output those jump instructions, on the assumption that the
26930 GNU assembler is being used.
26931
26932 @item -mg
26933 @opindex mg
26934 Output code for G-format floating-point numbers instead of D-format.
26935 @end table
26936
26937 @node Visium Options
26938 @subsection Visium Options
26939 @cindex Visium options
26940
26941 @table @gcctabopt
26942
26943 @item -mdebug
26944 @opindex mdebug
26945 A program which performs file I/O and is destined to run on an MCM target
26946 should be linked with this option. It causes the libraries libc.a and
26947 libdebug.a to be linked. The program should be run on the target under
26948 the control of the GDB remote debugging stub.
26949
26950 @item -msim
26951 @opindex msim
26952 A program which performs file I/O and is destined to run on the simulator
26953 should be linked with option. This causes libraries libc.a and libsim.a to
26954 be linked.
26955
26956 @item -mfpu
26957 @itemx -mhard-float
26958 @opindex mfpu
26959 @opindex mhard-float
26960 Generate code containing floating-point instructions. This is the
26961 default.
26962
26963 @item -mno-fpu
26964 @itemx -msoft-float
26965 @opindex mno-fpu
26966 @opindex msoft-float
26967 Generate code containing library calls for floating-point.
26968
26969 @option{-msoft-float} changes the calling convention in the output file;
26970 therefore, it is only useful if you compile @emph{all} of a program with
26971 this option. In particular, you need to compile @file{libgcc.a}, the
26972 library that comes with GCC, with @option{-msoft-float} in order for
26973 this to work.
26974
26975 @item -mcpu=@var{cpu_type}
26976 @opindex mcpu
26977 Set the instruction set, register set, and instruction scheduling parameters
26978 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26979 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26980
26981 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26982
26983 By default (unless configured otherwise), GCC generates code for the GR5
26984 variant of the Visium architecture.
26985
26986 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26987 architecture. The only difference from GR5 code is that the compiler will
26988 generate block move instructions.
26989
26990 @item -mtune=@var{cpu_type}
26991 @opindex mtune
26992 Set the instruction scheduling parameters for machine type @var{cpu_type},
26993 but do not set the instruction set or register set that the option
26994 @option{-mcpu=@var{cpu_type}} would.
26995
26996 @item -msv-mode
26997 @opindex msv-mode
26998 Generate code for the supervisor mode, where there are no restrictions on
26999 the access to general registers. This is the default.
27000
27001 @item -muser-mode
27002 @opindex muser-mode
27003 Generate code for the user mode, where the access to some general registers
27004 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27005 mode; on the GR6, only registers r29 to r31 are affected.
27006 @end table
27007
27008 @node VMS Options
27009 @subsection VMS Options
27010
27011 These @samp{-m} options are defined for the VMS implementations:
27012
27013 @table @gcctabopt
27014 @item -mvms-return-codes
27015 @opindex mvms-return-codes
27016 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27017 condition (e.g.@: error) codes.
27018
27019 @item -mdebug-main=@var{prefix}
27020 @opindex mdebug-main=@var{prefix}
27021 Flag the first routine whose name starts with @var{prefix} as the main
27022 routine for the debugger.
27023
27024 @item -mmalloc64
27025 @opindex mmalloc64
27026 Default to 64-bit memory allocation routines.
27027
27028 @item -mpointer-size=@var{size}
27029 @opindex mpointer-size=@var{size}
27030 Set the default size of pointers. Possible options for @var{size} are
27031 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27032 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27033 The later option disables @code{pragma pointer_size}.
27034 @end table
27035
27036 @node VxWorks Options
27037 @subsection VxWorks Options
27038 @cindex VxWorks Options
27039
27040 The options in this section are defined for all VxWorks targets.
27041 Options specific to the target hardware are listed with the other
27042 options for that target.
27043
27044 @table @gcctabopt
27045 @item -mrtp
27046 @opindex mrtp
27047 GCC can generate code for both VxWorks kernels and real time processes
27048 (RTPs). This option switches from the former to the latter. It also
27049 defines the preprocessor macro @code{__RTP__}.
27050
27051 @item -non-static
27052 @opindex non-static
27053 Link an RTP executable against shared libraries rather than static
27054 libraries. The options @option{-static} and @option{-shared} can
27055 also be used for RTPs (@pxref{Link Options}); @option{-static}
27056 is the default.
27057
27058 @item -Bstatic
27059 @itemx -Bdynamic
27060 @opindex Bstatic
27061 @opindex Bdynamic
27062 These options are passed down to the linker. They are defined for
27063 compatibility with Diab.
27064
27065 @item -Xbind-lazy
27066 @opindex Xbind-lazy
27067 Enable lazy binding of function calls. This option is equivalent to
27068 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27069
27070 @item -Xbind-now
27071 @opindex Xbind-now
27072 Disable lazy binding of function calls. This option is the default and
27073 is defined for compatibility with Diab.
27074 @end table
27075
27076 @node x86 Options
27077 @subsection x86 Options
27078 @cindex x86 Options
27079
27080 These @samp{-m} options are defined for the x86 family of computers.
27081
27082 @table @gcctabopt
27083
27084 @item -march=@var{cpu-type}
27085 @opindex march
27086 Generate instructions for the machine type @var{cpu-type}. In contrast to
27087 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27088 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27089 to generate code that may not run at all on processors other than the one
27090 indicated. Specifying @option{-march=@var{cpu-type}} implies
27091 @option{-mtune=@var{cpu-type}}.
27092
27093 The choices for @var{cpu-type} are:
27094
27095 @table @samp
27096 @item native
27097 This selects the CPU to generate code for at compilation time by determining
27098 the processor type of the compiling machine. Using @option{-march=native}
27099 enables all instruction subsets supported by the local machine (hence
27100 the result might not run on different machines). Using @option{-mtune=native}
27101 produces code optimized for the local machine under the constraints
27102 of the selected instruction set.
27103
27104 @item x86-64
27105 A generic CPU with 64-bit extensions.
27106
27107 @item i386
27108 Original Intel i386 CPU@.
27109
27110 @item i486
27111 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27112
27113 @item i586
27114 @itemx pentium
27115 Intel Pentium CPU with no MMX support.
27116
27117 @item lakemont
27118 Intel Lakemont MCU, based on Intel Pentium CPU.
27119
27120 @item pentium-mmx
27121 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27122
27123 @item pentiumpro
27124 Intel Pentium Pro CPU@.
27125
27126 @item i686
27127 When used with @option{-march}, the Pentium Pro
27128 instruction set is used, so the code runs on all i686 family chips.
27129 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27130
27131 @item pentium2
27132 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27133 support.
27134
27135 @item pentium3
27136 @itemx pentium3m
27137 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27138 set support.
27139
27140 @item pentium-m
27141 Intel Pentium M; low-power version of Intel Pentium III CPU
27142 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27143
27144 @item pentium4
27145 @itemx pentium4m
27146 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27147
27148 @item prescott
27149 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27150 set support.
27151
27152 @item nocona
27153 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27154 SSE2 and SSE3 instruction set support.
27155
27156 @item core2
27157 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27158 instruction set support.
27159
27160 @item nehalem
27161 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27162 SSE4.1, SSE4.2 and POPCNT instruction set support.
27163
27164 @item westmere
27165 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27166 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27167
27168 @item sandybridge
27169 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27170 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27171
27172 @item ivybridge
27173 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27174 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27175 instruction set support.
27176
27177 @item haswell
27178 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27179 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27180 BMI, BMI2 and F16C instruction set support.
27181
27182 @item broadwell
27183 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27184 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27185 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27186
27187 @item skylake
27188 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27189 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27190 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27191 XSAVES instruction set support.
27192
27193 @item bonnell
27194 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27195 instruction set support.
27196
27197 @item silvermont
27198 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27199 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27200
27201 @item goldmont
27202 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27203 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27204 instruction set support.
27205
27206 @item goldmont-plus
27207 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27208 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27209 PTWRITE, RDPID, SGX and UMIP instruction set support.
27210
27211 @item tremont
27212 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27213 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27214 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27215
27216 @item knl
27217 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27218 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27219 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27220 AVX512CD instruction set support.
27221
27222 @item knm
27223 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27224 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27225 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27226 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27227
27228 @item skylake-avx512
27229 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27230 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27231 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27232 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27233
27234 @item cannonlake
27235 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27236 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27237 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27238 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27239 AVX512IFMA, SHA and UMIP instruction set support.
27240
27241 @item icelake-client
27242 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27243 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27244 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27245 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27246 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27247 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27248
27249 @item icelake-server
27250 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27251 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27252 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27253 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27254 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27255 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27256 set support.
27257
27258 @item cascadelake
27259 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27260 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27261 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27262 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27263
27264 @item k6
27265 AMD K6 CPU with MMX instruction set support.
27266
27267 @item k6-2
27268 @itemx k6-3
27269 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27270
27271 @item athlon
27272 @itemx athlon-tbird
27273 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27274 support.
27275
27276 @item athlon-4
27277 @itemx athlon-xp
27278 @itemx athlon-mp
27279 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27280 instruction set support.
27281
27282 @item k8
27283 @itemx opteron
27284 @itemx athlon64
27285 @itemx athlon-fx
27286 Processors based on the AMD K8 core with x86-64 instruction set support,
27287 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27288 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27289 instruction set extensions.)
27290
27291 @item k8-sse3
27292 @itemx opteron-sse3
27293 @itemx athlon64-sse3
27294 Improved versions of AMD K8 cores with SSE3 instruction set support.
27295
27296 @item amdfam10
27297 @itemx barcelona
27298 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27299 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27300 instruction set extensions.)
27301
27302 @item bdver1
27303 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27304 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27305 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27306 @item bdver2
27307 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27308 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27309 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27310 extensions.)
27311 @item bdver3
27312 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27313 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27314 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27315 64-bit instruction set extensions.
27316 @item bdver4
27317 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27318 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27319 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27320 SSE4.2, ABM and 64-bit instruction set extensions.
27321
27322 @item znver1
27323 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27324 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27325 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27326 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27327 instruction set extensions.
27328 @item znver2
27329 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27330 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27331 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27332 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27333 instruction set extensions.)
27334
27335
27336 @item btver1
27337 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27338 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27339 instruction set extensions.)
27340
27341 @item btver2
27342 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27343 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27344 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27345
27346 @item winchip-c6
27347 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27348 set support.
27349
27350 @item winchip2
27351 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27352 instruction set support.
27353
27354 @item c3
27355 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27356 (No scheduling is implemented for this chip.)
27357
27358 @item c3-2
27359 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27360 (No scheduling is implemented for this chip.)
27361
27362 @item c7
27363 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27364 (No scheduling is implemented for this chip.)
27365
27366 @item samuel-2
27367 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27368 (No scheduling is implemented for this chip.)
27369
27370 @item nehemiah
27371 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27372 (No scheduling is implemented for this chip.)
27373
27374 @item esther
27375 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27376 (No scheduling is implemented for this chip.)
27377
27378 @item eden-x2
27379 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27380 (No scheduling is implemented for this chip.)
27381
27382 @item eden-x4
27383 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27384 AVX and AVX2 instruction set support.
27385 (No scheduling is implemented for this chip.)
27386
27387 @item nano
27388 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27389 instruction set support.
27390 (No scheduling is implemented for this chip.)
27391
27392 @item nano-1000
27393 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27394 instruction set support.
27395 (No scheduling is implemented for this chip.)
27396
27397 @item nano-2000
27398 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27399 instruction set support.
27400 (No scheduling is implemented for this chip.)
27401
27402 @item nano-3000
27403 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27404 instruction set support.
27405 (No scheduling is implemented for this chip.)
27406
27407 @item nano-x2
27408 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27409 instruction set support.
27410 (No scheduling is implemented for this chip.)
27411
27412 @item nano-x4
27413 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27414 instruction set support.
27415 (No scheduling is implemented for this chip.)
27416
27417 @item geode
27418 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27419 @end table
27420
27421 @item -mtune=@var{cpu-type}
27422 @opindex mtune
27423 Tune to @var{cpu-type} everything applicable about the generated code, except
27424 for the ABI and the set of available instructions.
27425 While picking a specific @var{cpu-type} schedules things appropriately
27426 for that particular chip, the compiler does not generate any code that
27427 cannot run on the default machine type unless you use a
27428 @option{-march=@var{cpu-type}} option.
27429 For example, if GCC is configured for i686-pc-linux-gnu
27430 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27431 but still runs on i686 machines.
27432
27433 The choices for @var{cpu-type} are the same as for @option{-march}.
27434 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27435
27436 @table @samp
27437 @item generic
27438 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27439 If you know the CPU on which your code will run, then you should use
27440 the corresponding @option{-mtune} or @option{-march} option instead of
27441 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27442 of your application will have, then you should use this option.
27443
27444 As new processors are deployed in the marketplace, the behavior of this
27445 option will change. Therefore, if you upgrade to a newer version of
27446 GCC, code generation controlled by this option will change to reflect
27447 the processors
27448 that are most common at the time that version of GCC is released.
27449
27450 There is no @option{-march=generic} option because @option{-march}
27451 indicates the instruction set the compiler can use, and there is no
27452 generic instruction set applicable to all processors. In contrast,
27453 @option{-mtune} indicates the processor (or, in this case, collection of
27454 processors) for which the code is optimized.
27455
27456 @item intel
27457 Produce code optimized for the most current Intel processors, which are
27458 Haswell and Silvermont for this version of GCC. If you know the CPU
27459 on which your code will run, then you should use the corresponding
27460 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27461 But, if you want your application performs better on both Haswell and
27462 Silvermont, then you should use this option.
27463
27464 As new Intel processors are deployed in the marketplace, the behavior of
27465 this option will change. Therefore, if you upgrade to a newer version of
27466 GCC, code generation controlled by this option will change to reflect
27467 the most current Intel processors at the time that version of GCC is
27468 released.
27469
27470 There is no @option{-march=intel} option because @option{-march} indicates
27471 the instruction set the compiler can use, and there is no common
27472 instruction set applicable to all processors. In contrast,
27473 @option{-mtune} indicates the processor (or, in this case, collection of
27474 processors) for which the code is optimized.
27475 @end table
27476
27477 @item -mcpu=@var{cpu-type}
27478 @opindex mcpu
27479 A deprecated synonym for @option{-mtune}.
27480
27481 @item -mfpmath=@var{unit}
27482 @opindex mfpmath
27483 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27484 for @var{unit} are:
27485
27486 @table @samp
27487 @item 387
27488 Use the standard 387 floating-point coprocessor present on the majority of chips and
27489 emulated otherwise. Code compiled with this option runs almost everywhere.
27490 The temporary results are computed in 80-bit precision instead of the precision
27491 specified by the type, resulting in slightly different results compared to most
27492 of other chips. See @option{-ffloat-store} for more detailed description.
27493
27494 This is the default choice for non-Darwin x86-32 targets.
27495
27496 @item sse
27497 Use scalar floating-point instructions present in the SSE instruction set.
27498 This instruction set is supported by Pentium III and newer chips,
27499 and in the AMD line
27500 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27501 instruction set supports only single-precision arithmetic, thus the double and
27502 extended-precision arithmetic are still done using 387. A later version, present
27503 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27504 arithmetic too.
27505
27506 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27507 or @option{-msse2} switches to enable SSE extensions and make this option
27508 effective. For the x86-64 compiler, these extensions are enabled by default.
27509
27510 The resulting code should be considerably faster in the majority of cases and avoid
27511 the numerical instability problems of 387 code, but may break some existing
27512 code that expects temporaries to be 80 bits.
27513
27514 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27515 and the default choice for x86-32 targets with the SSE2 instruction set
27516 when @option{-ffast-math} is enabled.
27517
27518 @item sse,387
27519 @itemx sse+387
27520 @itemx both
27521 Attempt to utilize both instruction sets at once. This effectively doubles the
27522 amount of available registers, and on chips with separate execution units for
27523 387 and SSE the execution resources too. Use this option with care, as it is
27524 still experimental, because the GCC register allocator does not model separate
27525 functional units well, resulting in unstable performance.
27526 @end table
27527
27528 @item -masm=@var{dialect}
27529 @opindex masm=@var{dialect}
27530 Output assembly instructions using selected @var{dialect}. Also affects
27531 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27532 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27533 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27534 not support @samp{intel}.
27535
27536 @item -mieee-fp
27537 @itemx -mno-ieee-fp
27538 @opindex mieee-fp
27539 @opindex mno-ieee-fp
27540 Control whether or not the compiler uses IEEE floating-point
27541 comparisons. These correctly handle the case where the result of a
27542 comparison is unordered.
27543
27544 @item -m80387
27545 @itemx -mhard-float
27546 @opindex 80387
27547 @opindex mhard-float
27548 Generate output containing 80387 instructions for floating point.
27549
27550 @item -mno-80387
27551 @itemx -msoft-float
27552 @opindex no-80387
27553 @opindex msoft-float
27554 Generate output containing library calls for floating point.
27555
27556 @strong{Warning:} the requisite libraries are not part of GCC@.
27557 Normally the facilities of the machine's usual C compiler are used, but
27558 this cannot be done directly in cross-compilation. You must make your
27559 own arrangements to provide suitable library functions for
27560 cross-compilation.
27561
27562 On machines where a function returns floating-point results in the 80387
27563 register stack, some floating-point opcodes may be emitted even if
27564 @option{-msoft-float} is used.
27565
27566 @item -mno-fp-ret-in-387
27567 @opindex mno-fp-ret-in-387
27568 @opindex mfp-ret-in-387
27569 Do not use the FPU registers for return values of functions.
27570
27571 The usual calling convention has functions return values of types
27572 @code{float} and @code{double} in an FPU register, even if there
27573 is no FPU@. The idea is that the operating system should emulate
27574 an FPU@.
27575
27576 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27577 in ordinary CPU registers instead.
27578
27579 @item -mno-fancy-math-387
27580 @opindex mno-fancy-math-387
27581 @opindex mfancy-math-387
27582 Some 387 emulators do not support the @code{sin}, @code{cos} and
27583 @code{sqrt} instructions for the 387. Specify this option to avoid
27584 generating those instructions.
27585 This option is overridden when @option{-march}
27586 indicates that the target CPU always has an FPU and so the
27587 instruction does not need emulation. These
27588 instructions are not generated unless you also use the
27589 @option{-funsafe-math-optimizations} switch.
27590
27591 @item -malign-double
27592 @itemx -mno-align-double
27593 @opindex malign-double
27594 @opindex mno-align-double
27595 Control whether GCC aligns @code{double}, @code{long double}, and
27596 @code{long long} variables on a two-word boundary or a one-word
27597 boundary. Aligning @code{double} variables on a two-word boundary
27598 produces code that runs somewhat faster on a Pentium at the
27599 expense of more memory.
27600
27601 On x86-64, @option{-malign-double} is enabled by default.
27602
27603 @strong{Warning:} if you use the @option{-malign-double} switch,
27604 structures containing the above types are aligned differently than
27605 the published application binary interface specifications for the x86-32
27606 and are not binary compatible with structures in code compiled
27607 without that switch.
27608
27609 @item -m96bit-long-double
27610 @itemx -m128bit-long-double
27611 @opindex m96bit-long-double
27612 @opindex m128bit-long-double
27613 These switches control the size of @code{long double} type. The x86-32
27614 application binary interface specifies the size to be 96 bits,
27615 so @option{-m96bit-long-double} is the default in 32-bit mode.
27616
27617 Modern architectures (Pentium and newer) prefer @code{long double}
27618 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27619 conforming to the ABI, this is not possible. So specifying
27620 @option{-m128bit-long-double} aligns @code{long double}
27621 to a 16-byte boundary by padding the @code{long double} with an additional
27622 32-bit zero.
27623
27624 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27625 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27626
27627 Notice that neither of these options enable any extra precision over the x87
27628 standard of 80 bits for a @code{long double}.
27629
27630 @strong{Warning:} if you override the default value for your target ABI, this
27631 changes the size of
27632 structures and arrays containing @code{long double} variables,
27633 as well as modifying the function calling convention for functions taking
27634 @code{long double}. Hence they are not binary-compatible
27635 with code compiled without that switch.
27636
27637 @item -mlong-double-64
27638 @itemx -mlong-double-80
27639 @itemx -mlong-double-128
27640 @opindex mlong-double-64
27641 @opindex mlong-double-80
27642 @opindex mlong-double-128
27643 These switches control the size of @code{long double} type. A size
27644 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27645 type. This is the default for 32-bit Bionic C library. A size
27646 of 128 bits makes the @code{long double} type equivalent to the
27647 @code{__float128} type. This is the default for 64-bit Bionic C library.
27648
27649 @strong{Warning:} if you override the default value for your target ABI, this
27650 changes the size of
27651 structures and arrays containing @code{long double} variables,
27652 as well as modifying the function calling convention for functions taking
27653 @code{long double}. Hence they are not binary-compatible
27654 with code compiled without that switch.
27655
27656 @item -malign-data=@var{type}
27657 @opindex malign-data
27658 Control how GCC aligns variables. Supported values for @var{type} are
27659 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27660 and earlier, @samp{abi} uses alignment value as specified by the
27661 psABI, and @samp{cacheline} uses increased alignment value to match
27662 the cache line size. @samp{compat} is the default.
27663
27664 @item -mlarge-data-threshold=@var{threshold}
27665 @opindex mlarge-data-threshold
27666 When @option{-mcmodel=medium} is specified, data objects larger than
27667 @var{threshold} are placed in the large data section. This value must be the
27668 same across all objects linked into the binary, and defaults to 65535.
27669
27670 @item -mrtd
27671 @opindex mrtd
27672 Use a different function-calling convention, in which functions that
27673 take a fixed number of arguments return with the @code{ret @var{num}}
27674 instruction, which pops their arguments while returning. This saves one
27675 instruction in the caller since there is no need to pop the arguments
27676 there.
27677
27678 You can specify that an individual function is called with this calling
27679 sequence with the function attribute @code{stdcall}. You can also
27680 override the @option{-mrtd} option by using the function attribute
27681 @code{cdecl}. @xref{Function Attributes}.
27682
27683 @strong{Warning:} this calling convention is incompatible with the one
27684 normally used on Unix, so you cannot use it if you need to call
27685 libraries compiled with the Unix compiler.
27686
27687 Also, you must provide function prototypes for all functions that
27688 take variable numbers of arguments (including @code{printf});
27689 otherwise incorrect code is generated for calls to those
27690 functions.
27691
27692 In addition, seriously incorrect code results if you call a
27693 function with too many arguments. (Normally, extra arguments are
27694 harmlessly ignored.)
27695
27696 @item -mregparm=@var{num}
27697 @opindex mregparm
27698 Control how many registers are used to pass integer arguments. By
27699 default, no registers are used to pass arguments, and at most 3
27700 registers can be used. You can control this behavior for a specific
27701 function by using the function attribute @code{regparm}.
27702 @xref{Function Attributes}.
27703
27704 @strong{Warning:} if you use this switch, and
27705 @var{num} is nonzero, then you must build all modules with the same
27706 value, including any libraries. This includes the system libraries and
27707 startup modules.
27708
27709 @item -msseregparm
27710 @opindex msseregparm
27711 Use SSE register passing conventions for float and double arguments
27712 and return values. You can control this behavior for a specific
27713 function by using the function attribute @code{sseregparm}.
27714 @xref{Function Attributes}.
27715
27716 @strong{Warning:} if you use this switch then you must build all
27717 modules with the same value, including any libraries. This includes
27718 the system libraries and startup modules.
27719
27720 @item -mvect8-ret-in-mem
27721 @opindex mvect8-ret-in-mem
27722 Return 8-byte vectors in memory instead of MMX registers. This is the
27723 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27724 Studio compilers until version 12. Later compiler versions (starting
27725 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27726 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27727 you need to remain compatible with existing code produced by those
27728 previous compiler versions or older versions of GCC@.
27729
27730 @item -mpc32
27731 @itemx -mpc64
27732 @itemx -mpc80
27733 @opindex mpc32
27734 @opindex mpc64
27735 @opindex mpc80
27736
27737 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27738 is specified, the significands of results of floating-point operations are
27739 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27740 significands of results of floating-point operations to 53 bits (double
27741 precision) and @option{-mpc80} rounds the significands of results of
27742 floating-point operations to 64 bits (extended double precision), which is
27743 the default. When this option is used, floating-point operations in higher
27744 precisions are not available to the programmer without setting the FPU
27745 control word explicitly.
27746
27747 Setting the rounding of floating-point operations to less than the default
27748 80 bits can speed some programs by 2% or more. Note that some mathematical
27749 libraries assume that extended-precision (80-bit) floating-point operations
27750 are enabled by default; routines in such libraries could suffer significant
27751 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27752 when this option is used to set the precision to less than extended precision.
27753
27754 @item -mstackrealign
27755 @opindex mstackrealign
27756 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27757 option generates an alternate prologue and epilogue that realigns the
27758 run-time stack if necessary. This supports mixing legacy codes that keep
27759 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27760 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27761 applicable to individual functions.
27762
27763 @item -mpreferred-stack-boundary=@var{num}
27764 @opindex mpreferred-stack-boundary
27765 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27766 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27767 the default is 4 (16 bytes or 128 bits).
27768
27769 @strong{Warning:} When generating code for the x86-64 architecture with
27770 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27771 used to keep the stack boundary aligned to 8 byte boundary. Since
27772 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27773 intended to be used in controlled environment where stack space is
27774 important limitation. This option leads to wrong code when functions
27775 compiled with 16 byte stack alignment (such as functions from a standard
27776 library) are called with misaligned stack. In this case, SSE
27777 instructions may lead to misaligned memory access traps. In addition,
27778 variable arguments are handled incorrectly for 16 byte aligned
27779 objects (including x87 long double and __int128), leading to wrong
27780 results. You must build all modules with
27781 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27782 includes the system libraries and startup modules.
27783
27784 @item -mincoming-stack-boundary=@var{num}
27785 @opindex mincoming-stack-boundary
27786 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27787 boundary. If @option{-mincoming-stack-boundary} is not specified,
27788 the one specified by @option{-mpreferred-stack-boundary} is used.
27789
27790 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27791 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27792 suffer significant run time performance penalties. On Pentium III, the
27793 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27794 properly if it is not 16-byte aligned.
27795
27796 To ensure proper alignment of this values on the stack, the stack boundary
27797 must be as aligned as that required by any value stored on the stack.
27798 Further, every function must be generated such that it keeps the stack
27799 aligned. Thus calling a function compiled with a higher preferred
27800 stack boundary from a function compiled with a lower preferred stack
27801 boundary most likely misaligns the stack. It is recommended that
27802 libraries that use callbacks always use the default setting.
27803
27804 This extra alignment does consume extra stack space, and generally
27805 increases code size. Code that is sensitive to stack space usage, such
27806 as embedded systems and operating system kernels, may want to reduce the
27807 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27808
27809 @need 200
27810 @item -mmmx
27811 @opindex mmmx
27812 @need 200
27813 @itemx -msse
27814 @opindex msse
27815 @need 200
27816 @itemx -msse2
27817 @opindex msse2
27818 @need 200
27819 @itemx -msse3
27820 @opindex msse3
27821 @need 200
27822 @itemx -mssse3
27823 @opindex mssse3
27824 @need 200
27825 @itemx -msse4
27826 @opindex msse4
27827 @need 200
27828 @itemx -msse4a
27829 @opindex msse4a
27830 @need 200
27831 @itemx -msse4.1
27832 @opindex msse4.1
27833 @need 200
27834 @itemx -msse4.2
27835 @opindex msse4.2
27836 @need 200
27837 @itemx -mavx
27838 @opindex mavx
27839 @need 200
27840 @itemx -mavx2
27841 @opindex mavx2
27842 @need 200
27843 @itemx -mavx512f
27844 @opindex mavx512f
27845 @need 200
27846 @itemx -mavx512pf
27847 @opindex mavx512pf
27848 @need 200
27849 @itemx -mavx512er
27850 @opindex mavx512er
27851 @need 200
27852 @itemx -mavx512cd
27853 @opindex mavx512cd
27854 @need 200
27855 @itemx -mavx512vl
27856 @opindex mavx512vl
27857 @need 200
27858 @itemx -mavx512bw
27859 @opindex mavx512bw
27860 @need 200
27861 @itemx -mavx512dq
27862 @opindex mavx512dq
27863 @need 200
27864 @itemx -mavx512ifma
27865 @opindex mavx512ifma
27866 @need 200
27867 @itemx -mavx512vbmi
27868 @opindex mavx512vbmi
27869 @need 200
27870 @itemx -msha
27871 @opindex msha
27872 @need 200
27873 @itemx -maes
27874 @opindex maes
27875 @need 200
27876 @itemx -mpclmul
27877 @opindex mpclmul
27878 @need 200
27879 @itemx -mclflushopt
27880 @opindex mclflushopt
27881 @need 200
27882 @itemx -mclwb
27883 @opindex mclwb
27884 @need 200
27885 @itemx -mfsgsbase
27886 @opindex mfsgsbase
27887 @need 200
27888 @itemx -mptwrite
27889 @opindex mptwrite
27890 @need 200
27891 @itemx -mrdrnd
27892 @opindex mrdrnd
27893 @need 200
27894 @itemx -mf16c
27895 @opindex mf16c
27896 @need 200
27897 @itemx -mfma
27898 @opindex mfma
27899 @need 200
27900 @itemx -mpconfig
27901 @opindex mpconfig
27902 @need 200
27903 @itemx -mwbnoinvd
27904 @opindex mwbnoinvd
27905 @need 200
27906 @itemx -mfma4
27907 @opindex mfma4
27908 @need 200
27909 @itemx -mprfchw
27910 @opindex mprfchw
27911 @need 200
27912 @itemx -mrdpid
27913 @opindex mrdpid
27914 @need 200
27915 @itemx -mprefetchwt1
27916 @opindex mprefetchwt1
27917 @need 200
27918 @itemx -mrdseed
27919 @opindex mrdseed
27920 @need 200
27921 @itemx -msgx
27922 @opindex msgx
27923 @need 200
27924 @itemx -mxop
27925 @opindex mxop
27926 @need 200
27927 @itemx -mlwp
27928 @opindex mlwp
27929 @need 200
27930 @itemx -m3dnow
27931 @opindex m3dnow
27932 @need 200
27933 @itemx -m3dnowa
27934 @opindex m3dnowa
27935 @need 200
27936 @itemx -mpopcnt
27937 @opindex mpopcnt
27938 @need 200
27939 @itemx -mabm
27940 @opindex mabm
27941 @need 200
27942 @itemx -madx
27943 @opindex madx
27944 @need 200
27945 @itemx -mbmi
27946 @opindex mbmi
27947 @need 200
27948 @itemx -mbmi2
27949 @opindex mbmi2
27950 @need 200
27951 @itemx -mlzcnt
27952 @opindex mlzcnt
27953 @need 200
27954 @itemx -mfxsr
27955 @opindex mfxsr
27956 @need 200
27957 @itemx -mxsave
27958 @opindex mxsave
27959 @need 200
27960 @itemx -mxsaveopt
27961 @opindex mxsaveopt
27962 @need 200
27963 @itemx -mxsavec
27964 @opindex mxsavec
27965 @need 200
27966 @itemx -mxsaves
27967 @opindex mxsaves
27968 @need 200
27969 @itemx -mrtm
27970 @opindex mrtm
27971 @need 200
27972 @itemx -mhle
27973 @opindex mhle
27974 @need 200
27975 @itemx -mtbm
27976 @opindex mtbm
27977 @need 200
27978 @itemx -mmwaitx
27979 @opindex mmwaitx
27980 @need 200
27981 @itemx -mclzero
27982 @opindex mclzero
27983 @need 200
27984 @itemx -mpku
27985 @opindex mpku
27986 @need 200
27987 @itemx -mavx512vbmi2
27988 @opindex mavx512vbmi2
27989 @need 200
27990 @itemx -mgfni
27991 @opindex mgfni
27992 @need 200
27993 @itemx -mvaes
27994 @opindex mvaes
27995 @need 200
27996 @itemx -mwaitpkg
27997 @opindex mwaitpkg
27998 @need 200
27999 @itemx -mvpclmulqdq
28000 @opindex mvpclmulqdq
28001 @need 200
28002 @itemx -mavx512bitalg
28003 @opindex mavx512bitalg
28004 @need 200
28005 @itemx -mmovdiri
28006 @opindex mmovdiri
28007 @need 200
28008 @itemx -mmovdir64b
28009 @opindex mmovdir64b
28010 @need 200
28011 @itemx -mavx512vpopcntdq
28012 @opindex mavx512vpopcntdq
28013 @need 200
28014 @itemx -mavx5124fmaps
28015 @opindex mavx5124fmaps
28016 @need 200
28017 @itemx -mavx512vnni
28018 @opindex mavx512vnni
28019 @need 200
28020 @itemx -mavx5124vnniw
28021 @opindex mavx5124vnniw
28022 @need 200
28023 @itemx -mcldemote
28024 @opindex mcldemote
28025 These switches enable the use of instructions in the MMX, SSE,
28026 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28027 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28028 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28029 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28030 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28031 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28032 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28033 AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28034 extended instruction sets. Each has a corresponding @option{-mno-} option to
28035 disable use of these instructions.
28036
28037 These extensions are also available as built-in functions: see
28038 @ref{x86 Built-in Functions}, for details of the functions enabled and
28039 disabled by these switches.
28040
28041 To generate SSE/SSE2 instructions automatically from floating-point
28042 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28043
28044 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28045 generates new AVX instructions or AVX equivalence for all SSEx instructions
28046 when needed.
28047
28048 These options enable GCC to use these extended instructions in
28049 generated code, even without @option{-mfpmath=sse}. Applications that
28050 perform run-time CPU detection must compile separate files for each
28051 supported architecture, using the appropriate flags. In particular,
28052 the file containing the CPU detection code should be compiled without
28053 these options.
28054
28055 @item -mdump-tune-features
28056 @opindex mdump-tune-features
28057 This option instructs GCC to dump the names of the x86 performance
28058 tuning features and default settings. The names can be used in
28059 @option{-mtune-ctrl=@var{feature-list}}.
28060
28061 @item -mtune-ctrl=@var{feature-list}
28062 @opindex mtune-ctrl=@var{feature-list}
28063 This option is used to do fine grain control of x86 code generation features.
28064 @var{feature-list} is a comma separated list of @var{feature} names. See also
28065 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28066 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28067 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28068 developers. Using it may lead to code paths not covered by testing and can
28069 potentially result in compiler ICEs or runtime errors.
28070
28071 @item -mno-default
28072 @opindex mno-default
28073 This option instructs GCC to turn off all tunable features. See also
28074 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28075
28076 @item -mcld
28077 @opindex mcld
28078 This option instructs GCC to emit a @code{cld} instruction in the prologue
28079 of functions that use string instructions. String instructions depend on
28080 the DF flag to select between autoincrement or autodecrement mode. While the
28081 ABI specifies the DF flag to be cleared on function entry, some operating
28082 systems violate this specification by not clearing the DF flag in their
28083 exception dispatchers. The exception handler can be invoked with the DF flag
28084 set, which leads to wrong direction mode when string instructions are used.
28085 This option can be enabled by default on 32-bit x86 targets by configuring
28086 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28087 instructions can be suppressed with the @option{-mno-cld} compiler option
28088 in this case.
28089
28090 @item -mvzeroupper
28091 @opindex mvzeroupper
28092 This option instructs GCC to emit a @code{vzeroupper} instruction
28093 before a transfer of control flow out of the function to minimize
28094 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28095 intrinsics.
28096
28097 @item -mprefer-avx128
28098 @opindex mprefer-avx128
28099 This option instructs GCC to use 128-bit AVX instructions instead of
28100 256-bit AVX instructions in the auto-vectorizer.
28101
28102 @item -mprefer-vector-width=@var{opt}
28103 @opindex mprefer-vector-width
28104 This option instructs GCC to use @var{opt}-bit vector width in instructions
28105 instead of default on the selected platform.
28106
28107 @table @samp
28108 @item none
28109 No extra limitations applied to GCC other than defined by the selected platform.
28110
28111 @item 128
28112 Prefer 128-bit vector width for instructions.
28113
28114 @item 256
28115 Prefer 256-bit vector width for instructions.
28116
28117 @item 512
28118 Prefer 512-bit vector width for instructions.
28119 @end table
28120
28121 @item -mcx16
28122 @opindex mcx16
28123 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28124 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28125 objects. This is useful for atomic updates of data structures exceeding one
28126 machine word in size. The compiler uses this instruction to implement
28127 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28128 128-bit integers, a library call is always used.
28129
28130 @item -msahf
28131 @opindex msahf
28132 This option enables generation of @code{SAHF} instructions in 64-bit code.
28133 Early Intel Pentium 4 CPUs with Intel 64 support,
28134 prior to the introduction of Pentium 4 G1 step in December 2005,
28135 lacked the @code{LAHF} and @code{SAHF} instructions
28136 which are supported by AMD64.
28137 These are load and store instructions, respectively, for certain status flags.
28138 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28139 @code{drem}, and @code{remainder} built-in functions;
28140 see @ref{Other Builtins} for details.
28141
28142 @item -mmovbe
28143 @opindex mmovbe
28144 This option enables use of the @code{movbe} instruction to implement
28145 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28146
28147 @item -mshstk
28148 @opindex mshstk
28149 The @option{-mshstk} option enables shadow stack built-in functions
28150 from x86 Control-flow Enforcement Technology (CET).
28151
28152 @item -mcrc32
28153 @opindex mcrc32
28154 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28155 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28156 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28157
28158 @item -mrecip
28159 @opindex mrecip
28160 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28161 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28162 with an additional Newton-Raphson step
28163 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28164 (and their vectorized
28165 variants) for single-precision floating-point arguments. These instructions
28166 are generated only when @option{-funsafe-math-optimizations} is enabled
28167 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28168 Note that while the throughput of the sequence is higher than the throughput
28169 of the non-reciprocal instruction, the precision of the sequence can be
28170 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28171
28172 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28173 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28174 combination), and doesn't need @option{-mrecip}.
28175
28176 Also note that GCC emits the above sequence with additional Newton-Raphson step
28177 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28178 already with @option{-ffast-math} (or the above option combination), and
28179 doesn't need @option{-mrecip}.
28180
28181 @item -mrecip=@var{opt}
28182 @opindex mrecip=opt
28183 This option controls which reciprocal estimate instructions
28184 may be used. @var{opt} is a comma-separated list of options, which may
28185 be preceded by a @samp{!} to invert the option:
28186
28187 @table @samp
28188 @item all
28189 Enable all estimate instructions.
28190
28191 @item default
28192 Enable the default instructions, equivalent to @option{-mrecip}.
28193
28194 @item none
28195 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28196
28197 @item div
28198 Enable the approximation for scalar division.
28199
28200 @item vec-div
28201 Enable the approximation for vectorized division.
28202
28203 @item sqrt
28204 Enable the approximation for scalar square root.
28205
28206 @item vec-sqrt
28207 Enable the approximation for vectorized square root.
28208 @end table
28209
28210 So, for example, @option{-mrecip=all,!sqrt} enables
28211 all of the reciprocal approximations, except for square root.
28212
28213 @item -mveclibabi=@var{type}
28214 @opindex mveclibabi
28215 Specifies the ABI type to use for vectorizing intrinsics using an
28216 external library. Supported values for @var{type} are @samp{svml}
28217 for the Intel short
28218 vector math library and @samp{acml} for the AMD math core library.
28219 To use this option, both @option{-ftree-vectorize} and
28220 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28221 ABI-compatible library must be specified at link time.
28222
28223 GCC currently emits calls to @code{vmldExp2},
28224 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28225 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28226 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28227 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28228 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28229 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28230 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28231 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28232 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28233 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28234 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28235 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28236 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28237 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28238 when @option{-mveclibabi=acml} is used.
28239
28240 @item -mabi=@var{name}
28241 @opindex mabi
28242 Generate code for the specified calling convention. Permissible values
28243 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28244 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28245 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28246 You can control this behavior for specific functions by
28247 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28248 @xref{Function Attributes}.
28249
28250 @item -mforce-indirect-call
28251 @opindex mforce-indirect-call
28252 Force all calls to functions to be indirect. This is useful
28253 when using Intel Processor Trace where it generates more precise timing
28254 information for function calls.
28255
28256 @item -mmanual-endbr
28257 @opindex mmanual-endbr
28258 Insert ENDBR instruction at function entry only via the @code{cf_check}
28259 function attribute. This is useful when used with the option
28260 @option{-fcf-protection=branch} to control ENDBR insertion at the
28261 function entry.
28262
28263 @item -mcall-ms2sysv-xlogues
28264 @opindex mcall-ms2sysv-xlogues
28265 @opindex mno-call-ms2sysv-xlogues
28266 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28267 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28268 default, the code for saving and restoring these registers is emitted inline,
28269 resulting in fairly lengthy prologues and epilogues. Using
28270 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28271 use stubs in the static portion of libgcc to perform these saves and restores,
28272 thus reducing function size at the cost of a few extra instructions.
28273
28274 @item -mtls-dialect=@var{type}
28275 @opindex mtls-dialect
28276 Generate code to access thread-local storage using the @samp{gnu} or
28277 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28278 @samp{gnu2} is more efficient, but it may add compile- and run-time
28279 requirements that cannot be satisfied on all systems.
28280
28281 @item -mpush-args
28282 @itemx -mno-push-args
28283 @opindex mpush-args
28284 @opindex mno-push-args
28285 Use PUSH operations to store outgoing parameters. This method is shorter
28286 and usually equally fast as method using SUB/MOV operations and is enabled
28287 by default. In some cases disabling it may improve performance because of
28288 improved scheduling and reduced dependencies.
28289
28290 @item -maccumulate-outgoing-args
28291 @opindex maccumulate-outgoing-args
28292 If enabled, the maximum amount of space required for outgoing arguments is
28293 computed in the function prologue. This is faster on most modern CPUs
28294 because of reduced dependencies, improved scheduling and reduced stack usage
28295 when the preferred stack boundary is not equal to 2. The drawback is a notable
28296 increase in code size. This switch implies @option{-mno-push-args}.
28297
28298 @item -mthreads
28299 @opindex mthreads
28300 Support thread-safe exception handling on MinGW. Programs that rely
28301 on thread-safe exception handling must compile and link all code with the
28302 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28303 @option{-D_MT}; when linking, it links in a special thread helper library
28304 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28305
28306 @item -mms-bitfields
28307 @itemx -mno-ms-bitfields
28308 @opindex mms-bitfields
28309 @opindex mno-ms-bitfields
28310
28311 Enable/disable bit-field layout compatible with the native Microsoft
28312 Windows compiler.
28313
28314 If @code{packed} is used on a structure, or if bit-fields are used,
28315 it may be that the Microsoft ABI lays out the structure differently
28316 than the way GCC normally does. Particularly when moving packed
28317 data between functions compiled with GCC and the native Microsoft compiler
28318 (either via function call or as data in a file), it may be necessary to access
28319 either format.
28320
28321 This option is enabled by default for Microsoft Windows
28322 targets. This behavior can also be controlled locally by use of variable
28323 or type attributes. For more information, see @ref{x86 Variable Attributes}
28324 and @ref{x86 Type Attributes}.
28325
28326 The Microsoft structure layout algorithm is fairly simple with the exception
28327 of the bit-field packing.
28328 The padding and alignment of members of structures and whether a bit-field
28329 can straddle a storage-unit boundary are determine by these rules:
28330
28331 @enumerate
28332 @item Structure members are stored sequentially in the order in which they are
28333 declared: the first member has the lowest memory address and the last member
28334 the highest.
28335
28336 @item Every data object has an alignment requirement. The alignment requirement
28337 for all data except structures, unions, and arrays is either the size of the
28338 object or the current packing size (specified with either the
28339 @code{aligned} attribute or the @code{pack} pragma),
28340 whichever is less. For structures, unions, and arrays,
28341 the alignment requirement is the largest alignment requirement of its members.
28342 Every object is allocated an offset so that:
28343
28344 @smallexample
28345 offset % alignment_requirement == 0
28346 @end smallexample
28347
28348 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28349 unit if the integral types are the same size and if the next bit-field fits
28350 into the current allocation unit without crossing the boundary imposed by the
28351 common alignment requirements of the bit-fields.
28352 @end enumerate
28353
28354 MSVC interprets zero-length bit-fields in the following ways:
28355
28356 @enumerate
28357 @item If a zero-length bit-field is inserted between two bit-fields that
28358 are normally coalesced, the bit-fields are not coalesced.
28359
28360 For example:
28361
28362 @smallexample
28363 struct
28364 @{
28365 unsigned long bf_1 : 12;
28366 unsigned long : 0;
28367 unsigned long bf_2 : 12;
28368 @} t1;
28369 @end smallexample
28370
28371 @noindent
28372 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28373 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28374
28375 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28376 alignment of the zero-length bit-field is greater than the member that follows it,
28377 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28378
28379 For example:
28380
28381 @smallexample
28382 struct
28383 @{
28384 char foo : 4;
28385 short : 0;
28386 char bar;
28387 @} t2;
28388
28389 struct
28390 @{
28391 char foo : 4;
28392 short : 0;
28393 double bar;
28394 @} t3;
28395 @end smallexample
28396
28397 @noindent
28398 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28399 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28400 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28401 of the structure.
28402
28403 Taking this into account, it is important to note the following:
28404
28405 @enumerate
28406 @item If a zero-length bit-field follows a normal bit-field, the type of the
28407 zero-length bit-field may affect the alignment of the structure as whole. For
28408 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28409 normal bit-field, and is of type short.
28410
28411 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28412 still affect the alignment of the structure:
28413
28414 @smallexample
28415 struct
28416 @{
28417 char foo : 6;
28418 long : 0;
28419 @} t4;
28420 @end smallexample
28421
28422 @noindent
28423 Here, @code{t4} takes up 4 bytes.
28424 @end enumerate
28425
28426 @item Zero-length bit-fields following non-bit-field members are ignored:
28427
28428 @smallexample
28429 struct
28430 @{
28431 char foo;
28432 long : 0;
28433 char bar;
28434 @} t5;
28435 @end smallexample
28436
28437 @noindent
28438 Here, @code{t5} takes up 2 bytes.
28439 @end enumerate
28440
28441
28442 @item -mno-align-stringops
28443 @opindex mno-align-stringops
28444 @opindex malign-stringops
28445 Do not align the destination of inlined string operations. This switch reduces
28446 code size and improves performance in case the destination is already aligned,
28447 but GCC doesn't know about it.
28448
28449 @item -minline-all-stringops
28450 @opindex minline-all-stringops
28451 By default GCC inlines string operations only when the destination is
28452 known to be aligned to least a 4-byte boundary.
28453 This enables more inlining and increases code
28454 size, but may improve performance of code that depends on fast
28455 @code{memcpy}, @code{strlen},
28456 and @code{memset} for short lengths.
28457
28458 @item -minline-stringops-dynamically
28459 @opindex minline-stringops-dynamically
28460 For string operations of unknown size, use run-time checks with
28461 inline code for small blocks and a library call for large blocks.
28462
28463 @item -mstringop-strategy=@var{alg}
28464 @opindex mstringop-strategy=@var{alg}
28465 Override the internal decision heuristic for the particular algorithm to use
28466 for inlining string operations. The allowed values for @var{alg} are:
28467
28468 @table @samp
28469 @item rep_byte
28470 @itemx rep_4byte
28471 @itemx rep_8byte
28472 Expand using i386 @code{rep} prefix of the specified size.
28473
28474 @item byte_loop
28475 @itemx loop
28476 @itemx unrolled_loop
28477 Expand into an inline loop.
28478
28479 @item libcall
28480 Always use a library call.
28481 @end table
28482
28483 @item -mmemcpy-strategy=@var{strategy}
28484 @opindex mmemcpy-strategy=@var{strategy}
28485 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28486 should be inlined and what inline algorithm to use when the expected size
28487 of the copy operation is known. @var{strategy}
28488 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28489 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28490 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28491 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28492 in the list must be specified in increasing order. The minimal byte size for
28493 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28494 preceding range.
28495
28496 @item -mmemset-strategy=@var{strategy}
28497 @opindex mmemset-strategy=@var{strategy}
28498 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28499 @code{__builtin_memset} expansion.
28500
28501 @item -momit-leaf-frame-pointer
28502 @opindex momit-leaf-frame-pointer
28503 Don't keep the frame pointer in a register for leaf functions. This
28504 avoids the instructions to save, set up, and restore frame pointers and
28505 makes an extra register available in leaf functions. The option
28506 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28507 which might make debugging harder.
28508
28509 @item -mtls-direct-seg-refs
28510 @itemx -mno-tls-direct-seg-refs
28511 @opindex mtls-direct-seg-refs
28512 Controls whether TLS variables may be accessed with offsets from the
28513 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28514 or whether the thread base pointer must be added. Whether or not this
28515 is valid depends on the operating system, and whether it maps the
28516 segment to cover the entire TLS area.
28517
28518 For systems that use the GNU C Library, the default is on.
28519
28520 @item -msse2avx
28521 @itemx -mno-sse2avx
28522 @opindex msse2avx
28523 Specify that the assembler should encode SSE instructions with VEX
28524 prefix. The option @option{-mavx} turns this on by default.
28525
28526 @item -mfentry
28527 @itemx -mno-fentry
28528 @opindex mfentry
28529 If profiling is active (@option{-pg}), put the profiling
28530 counter call before the prologue.
28531 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28532 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28533
28534 @item -mrecord-mcount
28535 @itemx -mno-record-mcount
28536 @opindex mrecord-mcount
28537 If profiling is active (@option{-pg}), generate a __mcount_loc section
28538 that contains pointers to each profiling call. This is useful for
28539 automatically patching and out calls.
28540
28541 @item -mnop-mcount
28542 @itemx -mno-nop-mcount
28543 @opindex mnop-mcount
28544 If profiling is active (@option{-pg}), generate the calls to
28545 the profiling functions as NOPs. This is useful when they
28546 should be patched in later dynamically. This is likely only
28547 useful together with @option{-mrecord-mcount}.
28548
28549 @item -minstrument-return=@var{type}
28550 @opindex minstrument-return
28551 Instrument function exit in -pg -mfentry instrumented functions with
28552 call to specified function. This only instruments true returns ending
28553 with ret, but not sibling calls ending with jump. Valid types
28554 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28555 or @var{nop5} to generate a 5 byte nop.
28556
28557 @item -mrecord-return
28558 @itemx -mno-record-return
28559 @opindex mrecord-return
28560 Generate a __return_loc section pointing to all return instrumentation code.
28561
28562 @item -mfentry-name=@var{name}
28563 @opindex mfentry-name
28564 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28565
28566 @item -mfentry-section=@var{name}
28567 @opindex mfentry-section
28568 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28569
28570 @item -mskip-rax-setup
28571 @itemx -mno-skip-rax-setup
28572 @opindex mskip-rax-setup
28573 When generating code for the x86-64 architecture with SSE extensions
28574 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28575 register when there are no variable arguments passed in vector registers.
28576
28577 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28578 saving vector registers on stack when passing variable arguments, the
28579 impacts of this option are callees may waste some stack space,
28580 misbehave or jump to a random location. GCC 4.4 or newer don't have
28581 those issues, regardless the RAX register value.
28582
28583 @item -m8bit-idiv
28584 @itemx -mno-8bit-idiv
28585 @opindex m8bit-idiv
28586 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28587 much faster than 32-bit/64-bit integer divide. This option generates a
28588 run-time check. If both dividend and divisor are within range of 0
28589 to 255, 8-bit unsigned integer divide is used instead of
28590 32-bit/64-bit integer divide.
28591
28592 @item -mavx256-split-unaligned-load
28593 @itemx -mavx256-split-unaligned-store
28594 @opindex mavx256-split-unaligned-load
28595 @opindex mavx256-split-unaligned-store
28596 Split 32-byte AVX unaligned load and store.
28597
28598 @item -mstack-protector-guard=@var{guard}
28599 @itemx -mstack-protector-guard-reg=@var{reg}
28600 @itemx -mstack-protector-guard-offset=@var{offset}
28601 @opindex mstack-protector-guard
28602 @opindex mstack-protector-guard-reg
28603 @opindex mstack-protector-guard-offset
28604 Generate stack protection code using canary at @var{guard}. Supported
28605 locations are @samp{global} for global canary or @samp{tls} for per-thread
28606 canary in the TLS block (the default). This option has effect only when
28607 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28608
28609 With the latter choice the options
28610 @option{-mstack-protector-guard-reg=@var{reg}} and
28611 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28612 which segment register (@code{%fs} or @code{%gs}) to use as base register
28613 for reading the canary, and from what offset from that base register.
28614 The default for those is as specified in the relevant ABI.
28615
28616 @item -mgeneral-regs-only
28617 @opindex mgeneral-regs-only
28618 Generate code that uses only the general-purpose registers. This
28619 prevents the compiler from using floating-point, vector, mask and bound
28620 registers.
28621
28622 @item -mindirect-branch=@var{choice}
28623 @opindex mindirect-branch
28624 Convert indirect call and jump with @var{choice}. The default is
28625 @samp{keep}, which keeps indirect call and jump unmodified.
28626 @samp{thunk} converts indirect call and jump to call and return thunk.
28627 @samp{thunk-inline} converts indirect call and jump to inlined call
28628 and return thunk. @samp{thunk-extern} converts indirect call and jump
28629 to external call and return thunk provided in a separate object file.
28630 You can control this behavior for a specific function by using the
28631 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28632
28633 Note that @option{-mcmodel=large} is incompatible with
28634 @option{-mindirect-branch=thunk} and
28635 @option{-mindirect-branch=thunk-extern} since the thunk function may
28636 not be reachable in the large code model.
28637
28638 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28639 @option{-fcf-protection=branch} since the external thunk cannot be modified
28640 to disable control-flow check.
28641
28642 @item -mfunction-return=@var{choice}
28643 @opindex mfunction-return
28644 Convert function return with @var{choice}. The default is @samp{keep},
28645 which keeps function return unmodified. @samp{thunk} converts function
28646 return to call and return thunk. @samp{thunk-inline} converts function
28647 return to inlined call and return thunk. @samp{thunk-extern} converts
28648 function return to external call and return thunk provided in a separate
28649 object file. You can control this behavior for a specific function by
28650 using the function attribute @code{function_return}.
28651 @xref{Function Attributes}.
28652
28653 Note that @option{-mcmodel=large} is incompatible with
28654 @option{-mfunction-return=thunk} and
28655 @option{-mfunction-return=thunk-extern} since the thunk function may
28656 not be reachable in the large code model.
28657
28658
28659 @item -mindirect-branch-register
28660 @opindex mindirect-branch-register
28661 Force indirect call and jump via register.
28662
28663 @end table
28664
28665 These @samp{-m} switches are supported in addition to the above
28666 on x86-64 processors in 64-bit environments.
28667
28668 @table @gcctabopt
28669 @item -m32
28670 @itemx -m64
28671 @itemx -mx32
28672 @itemx -m16
28673 @itemx -miamcu
28674 @opindex m32
28675 @opindex m64
28676 @opindex mx32
28677 @opindex m16
28678 @opindex miamcu
28679 Generate code for a 16-bit, 32-bit or 64-bit environment.
28680 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28681 to 32 bits, and
28682 generates code that runs on any i386 system.
28683
28684 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28685 types to 64 bits, and generates code for the x86-64 architecture.
28686 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28687 and @option{-mdynamic-no-pic} options.
28688
28689 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28690 to 32 bits, and
28691 generates code for the x86-64 architecture.
28692
28693 The @option{-m16} option is the same as @option{-m32}, except for that
28694 it outputs the @code{.code16gcc} assembly directive at the beginning of
28695 the assembly output so that the binary can run in 16-bit mode.
28696
28697 The @option{-miamcu} option generates code which conforms to Intel MCU
28698 psABI. It requires the @option{-m32} option to be turned on.
28699
28700 @item -mno-red-zone
28701 @opindex mno-red-zone
28702 @opindex mred-zone
28703 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28704 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28705 stack pointer that is not modified by signal or interrupt handlers
28706 and therefore can be used for temporary data without adjusting the stack
28707 pointer. The flag @option{-mno-red-zone} disables this red zone.
28708
28709 @item -mcmodel=small
28710 @opindex mcmodel=small
28711 Generate code for the small code model: the program and its symbols must
28712 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28713 Programs can be statically or dynamically linked. This is the default
28714 code model.
28715
28716 @item -mcmodel=kernel
28717 @opindex mcmodel=kernel
28718 Generate code for the kernel code model. The kernel runs in the
28719 negative 2 GB of the address space.
28720 This model has to be used for Linux kernel code.
28721
28722 @item -mcmodel=medium
28723 @opindex mcmodel=medium
28724 Generate code for the medium model: the program is linked in the lower 2
28725 GB of the address space. Small symbols are also placed there. Symbols
28726 with sizes larger than @option{-mlarge-data-threshold} are put into
28727 large data or BSS sections and can be located above 2GB. Programs can
28728 be statically or dynamically linked.
28729
28730 @item -mcmodel=large
28731 @opindex mcmodel=large
28732 Generate code for the large model. This model makes no assumptions
28733 about addresses and sizes of sections.
28734
28735 @item -maddress-mode=long
28736 @opindex maddress-mode=long
28737 Generate code for long address mode. This is only supported for 64-bit
28738 and x32 environments. It is the default address mode for 64-bit
28739 environments.
28740
28741 @item -maddress-mode=short
28742 @opindex maddress-mode=short
28743 Generate code for short address mode. This is only supported for 32-bit
28744 and x32 environments. It is the default address mode for 32-bit and
28745 x32 environments.
28746 @end table
28747
28748 @node x86 Windows Options
28749 @subsection x86 Windows Options
28750 @cindex x86 Windows Options
28751 @cindex Windows Options for x86
28752
28753 These additional options are available for Microsoft Windows targets:
28754
28755 @table @gcctabopt
28756 @item -mconsole
28757 @opindex mconsole
28758 This option
28759 specifies that a console application is to be generated, by
28760 instructing the linker to set the PE header subsystem type
28761 required for console applications.
28762 This option is available for Cygwin and MinGW targets and is
28763 enabled by default on those targets.
28764
28765 @item -mdll
28766 @opindex mdll
28767 This option is available for Cygwin and MinGW targets. It
28768 specifies that a DLL---a dynamic link library---is to be
28769 generated, enabling the selection of the required runtime
28770 startup object and entry point.
28771
28772 @item -mnop-fun-dllimport
28773 @opindex mnop-fun-dllimport
28774 This option is available for Cygwin and MinGW targets. It
28775 specifies that the @code{dllimport} attribute should be ignored.
28776
28777 @item -mthread
28778 @opindex mthread
28779 This option is available for MinGW targets. It specifies
28780 that MinGW-specific thread support is to be used.
28781
28782 @item -municode
28783 @opindex municode
28784 This option is available for MinGW-w64 targets. It causes
28785 the @code{UNICODE} preprocessor macro to be predefined, and
28786 chooses Unicode-capable runtime startup code.
28787
28788 @item -mwin32
28789 @opindex mwin32
28790 This option is available for Cygwin and MinGW targets. It
28791 specifies that the typical Microsoft Windows predefined macros are to
28792 be set in the pre-processor, but does not influence the choice
28793 of runtime library/startup code.
28794
28795 @item -mwindows
28796 @opindex mwindows
28797 This option is available for Cygwin and MinGW targets. It
28798 specifies that a GUI application is to be generated by
28799 instructing the linker to set the PE header subsystem type
28800 appropriately.
28801
28802 @item -fno-set-stack-executable
28803 @opindex fno-set-stack-executable
28804 @opindex fset-stack-executable
28805 This option is available for MinGW targets. It specifies that
28806 the executable flag for the stack used by nested functions isn't
28807 set. This is necessary for binaries running in kernel mode of
28808 Microsoft Windows, as there the User32 API, which is used to set executable
28809 privileges, isn't available.
28810
28811 @item -fwritable-relocated-rdata
28812 @opindex fno-writable-relocated-rdata
28813 @opindex fwritable-relocated-rdata
28814 This option is available for MinGW and Cygwin targets. It specifies
28815 that relocated-data in read-only section is put into the @code{.data}
28816 section. This is a necessary for older runtimes not supporting
28817 modification of @code{.rdata} sections for pseudo-relocation.
28818
28819 @item -mpe-aligned-commons
28820 @opindex mpe-aligned-commons
28821 This option is available for Cygwin and MinGW targets. It
28822 specifies that the GNU extension to the PE file format that
28823 permits the correct alignment of COMMON variables should be
28824 used when generating code. It is enabled by default if
28825 GCC detects that the target assembler found during configuration
28826 supports the feature.
28827 @end table
28828
28829 See also under @ref{x86 Options} for standard options.
28830
28831 @node Xstormy16 Options
28832 @subsection Xstormy16 Options
28833 @cindex Xstormy16 Options
28834
28835 These options are defined for Xstormy16:
28836
28837 @table @gcctabopt
28838 @item -msim
28839 @opindex msim
28840 Choose startup files and linker script suitable for the simulator.
28841 @end table
28842
28843 @node Xtensa Options
28844 @subsection Xtensa Options
28845 @cindex Xtensa Options
28846
28847 These options are supported for Xtensa targets:
28848
28849 @table @gcctabopt
28850 @item -mconst16
28851 @itemx -mno-const16
28852 @opindex mconst16
28853 @opindex mno-const16
28854 Enable or disable use of @code{CONST16} instructions for loading
28855 constant values. The @code{CONST16} instruction is currently not a
28856 standard option from Tensilica. When enabled, @code{CONST16}
28857 instructions are always used in place of the standard @code{L32R}
28858 instructions. The use of @code{CONST16} is enabled by default only if
28859 the @code{L32R} instruction is not available.
28860
28861 @item -mfused-madd
28862 @itemx -mno-fused-madd
28863 @opindex mfused-madd
28864 @opindex mno-fused-madd
28865 Enable or disable use of fused multiply/add and multiply/subtract
28866 instructions in the floating-point option. This has no effect if the
28867 floating-point option is not also enabled. Disabling fused multiply/add
28868 and multiply/subtract instructions forces the compiler to use separate
28869 instructions for the multiply and add/subtract operations. This may be
28870 desirable in some cases where strict IEEE 754-compliant results are
28871 required: the fused multiply add/subtract instructions do not round the
28872 intermediate result, thereby producing results with @emph{more} bits of
28873 precision than specified by the IEEE standard. Disabling fused multiply
28874 add/subtract instructions also ensures that the program output is not
28875 sensitive to the compiler's ability to combine multiply and add/subtract
28876 operations.
28877
28878 @item -mserialize-volatile
28879 @itemx -mno-serialize-volatile
28880 @opindex mserialize-volatile
28881 @opindex mno-serialize-volatile
28882 When this option is enabled, GCC inserts @code{MEMW} instructions before
28883 @code{volatile} memory references to guarantee sequential consistency.
28884 The default is @option{-mserialize-volatile}. Use
28885 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28886
28887 @item -mforce-no-pic
28888 @opindex mforce-no-pic
28889 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28890 position-independent code (PIC), this option disables PIC for compiling
28891 kernel code.
28892
28893 @item -mtext-section-literals
28894 @itemx -mno-text-section-literals
28895 @opindex mtext-section-literals
28896 @opindex mno-text-section-literals
28897 These options control the treatment of literal pools. The default is
28898 @option{-mno-text-section-literals}, which places literals in a separate
28899 section in the output file. This allows the literal pool to be placed
28900 in a data RAM/ROM, and it also allows the linker to combine literal
28901 pools from separate object files to remove redundant literals and
28902 improve code size. With @option{-mtext-section-literals}, the literals
28903 are interspersed in the text section in order to keep them as close as
28904 possible to their references. This may be necessary for large assembly
28905 files. Literals for each function are placed right before that function.
28906
28907 @item -mauto-litpools
28908 @itemx -mno-auto-litpools
28909 @opindex mauto-litpools
28910 @opindex mno-auto-litpools
28911 These options control the treatment of literal pools. The default is
28912 @option{-mno-auto-litpools}, which places literals in a separate
28913 section in the output file unless @option{-mtext-section-literals} is
28914 used. With @option{-mauto-litpools} the literals are interspersed in
28915 the text section by the assembler. Compiler does not produce explicit
28916 @code{.literal} directives and loads literals into registers with
28917 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28918 do relaxation and place literals as necessary. This option allows
28919 assembler to create several literal pools per function and assemble
28920 very big functions, which may not be possible with
28921 @option{-mtext-section-literals}.
28922
28923 @item -mtarget-align
28924 @itemx -mno-target-align
28925 @opindex mtarget-align
28926 @opindex mno-target-align
28927 When this option is enabled, GCC instructs the assembler to
28928 automatically align instructions to reduce branch penalties at the
28929 expense of some code density. The assembler attempts to widen density
28930 instructions to align branch targets and the instructions following call
28931 instructions. If there are not enough preceding safe density
28932 instructions to align a target, no widening is performed. The
28933 default is @option{-mtarget-align}. These options do not affect the
28934 treatment of auto-aligned instructions like @code{LOOP}, which the
28935 assembler always aligns, either by widening density instructions or
28936 by inserting NOP instructions.
28937
28938 @item -mlongcalls
28939 @itemx -mno-longcalls
28940 @opindex mlongcalls
28941 @opindex mno-longcalls
28942 When this option is enabled, GCC instructs the assembler to translate
28943 direct calls to indirect calls unless it can determine that the target
28944 of a direct call is in the range allowed by the call instruction. This
28945 translation typically occurs for calls to functions in other source
28946 files. Specifically, the assembler translates a direct @code{CALL}
28947 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28948 The default is @option{-mno-longcalls}. This option should be used in
28949 programs where the call target can potentially be out of range. This
28950 option is implemented in the assembler, not the compiler, so the
28951 assembly code generated by GCC still shows direct call
28952 instructions---look at the disassembled object code to see the actual
28953 instructions. Note that the assembler uses an indirect call for
28954 every cross-file call, not just those that really are out of range.
28955 @end table
28956
28957 @node zSeries Options
28958 @subsection zSeries Options
28959 @cindex zSeries options
28960
28961 These are listed under @xref{S/390 and zSeries Options}.
28962
28963
28964 @c man end
28965
28966 @node Spec Files
28967 @section Specifying Subprocesses and the Switches to Pass to Them
28968 @cindex Spec Files
28969
28970 @command{gcc} is a driver program. It performs its job by invoking a
28971 sequence of other programs to do the work of compiling, assembling and
28972 linking. GCC interprets its command-line parameters and uses these to
28973 deduce which programs it should invoke, and which command-line options
28974 it ought to place on their command lines. This behavior is controlled
28975 by @dfn{spec strings}. In most cases there is one spec string for each
28976 program that GCC can invoke, but a few programs have multiple spec
28977 strings to control their behavior. The spec strings built into GCC can
28978 be overridden by using the @option{-specs=} command-line switch to specify
28979 a spec file.
28980
28981 @dfn{Spec files} are plain-text files that are used to construct spec
28982 strings. They consist of a sequence of directives separated by blank
28983 lines. The type of directive is determined by the first non-whitespace
28984 character on the line, which can be one of the following:
28985
28986 @table @code
28987 @item %@var{command}
28988 Issues a @var{command} to the spec file processor. The commands that can
28989 appear here are:
28990
28991 @table @code
28992 @item %include <@var{file}>
28993 @cindex @code{%include}
28994 Search for @var{file} and insert its text at the current point in the
28995 specs file.
28996
28997 @item %include_noerr <@var{file}>
28998 @cindex @code{%include_noerr}
28999 Just like @samp{%include}, but do not generate an error message if the include
29000 file cannot be found.
29001
29002 @item %rename @var{old_name} @var{new_name}
29003 @cindex @code{%rename}
29004 Rename the spec string @var{old_name} to @var{new_name}.
29005
29006 @end table
29007
29008 @item *[@var{spec_name}]:
29009 This tells the compiler to create, override or delete the named spec
29010 string. All lines after this directive up to the next directive or
29011 blank line are considered to be the text for the spec string. If this
29012 results in an empty string then the spec is deleted. (Or, if the
29013 spec did not exist, then nothing happens.) Otherwise, if the spec
29014 does not currently exist a new spec is created. If the spec does
29015 exist then its contents are overridden by the text of this
29016 directive, unless the first character of that text is the @samp{+}
29017 character, in which case the text is appended to the spec.
29018
29019 @item [@var{suffix}]:
29020 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29021 and up to the next directive or blank line are considered to make up the
29022 spec string for the indicated suffix. When the compiler encounters an
29023 input file with the named suffix, it processes the spec string in
29024 order to work out how to compile that file. For example:
29025
29026 @smallexample
29027 .ZZ:
29028 z-compile -input %i
29029 @end smallexample
29030
29031 This says that any input file whose name ends in @samp{.ZZ} should be
29032 passed to the program @samp{z-compile}, which should be invoked with the
29033 command-line switch @option{-input} and with the result of performing the
29034 @samp{%i} substitution. (See below.)
29035
29036 As an alternative to providing a spec string, the text following a
29037 suffix directive can be one of the following:
29038
29039 @table @code
29040 @item @@@var{language}
29041 This says that the suffix is an alias for a known @var{language}. This is
29042 similar to using the @option{-x} command-line switch to GCC to specify a
29043 language explicitly. For example:
29044
29045 @smallexample
29046 .ZZ:
29047 @@c++
29048 @end smallexample
29049
29050 Says that .ZZ files are, in fact, C++ source files.
29051
29052 @item #@var{name}
29053 This causes an error messages saying:
29054
29055 @smallexample
29056 @var{name} compiler not installed on this system.
29057 @end smallexample
29058 @end table
29059
29060 GCC already has an extensive list of suffixes built into it.
29061 This directive adds an entry to the end of the list of suffixes, but
29062 since the list is searched from the end backwards, it is effectively
29063 possible to override earlier entries using this technique.
29064
29065 @end table
29066
29067 GCC has the following spec strings built into it. Spec files can
29068 override these strings or create their own. Note that individual
29069 targets can also add their own spec strings to this list.
29070
29071 @smallexample
29072 asm Options to pass to the assembler
29073 asm_final Options to pass to the assembler post-processor
29074 cpp Options to pass to the C preprocessor
29075 cc1 Options to pass to the C compiler
29076 cc1plus Options to pass to the C++ compiler
29077 endfile Object files to include at the end of the link
29078 link Options to pass to the linker
29079 lib Libraries to include on the command line to the linker
29080 libgcc Decides which GCC support library to pass to the linker
29081 linker Sets the name of the linker
29082 predefines Defines to be passed to the C preprocessor
29083 signed_char Defines to pass to CPP to say whether @code{char} is signed
29084 by default
29085 startfile Object files to include at the start of the link
29086 @end smallexample
29087
29088 Here is a small example of a spec file:
29089
29090 @smallexample
29091 %rename lib old_lib
29092
29093 *lib:
29094 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29095 @end smallexample
29096
29097 This example renames the spec called @samp{lib} to @samp{old_lib} and
29098 then overrides the previous definition of @samp{lib} with a new one.
29099 The new definition adds in some extra command-line options before
29100 including the text of the old definition.
29101
29102 @dfn{Spec strings} are a list of command-line options to be passed to their
29103 corresponding program. In addition, the spec strings can contain
29104 @samp{%}-prefixed sequences to substitute variable text or to
29105 conditionally insert text into the command line. Using these constructs
29106 it is possible to generate quite complex command lines.
29107
29108 Here is a table of all defined @samp{%}-sequences for spec
29109 strings. Note that spaces are not generated automatically around the
29110 results of expanding these sequences. Therefore you can concatenate them
29111 together or combine them with constant text in a single argument.
29112
29113 @table @code
29114 @item %%
29115 Substitute one @samp{%} into the program name or argument.
29116
29117 @item %i
29118 Substitute the name of the input file being processed.
29119
29120 @item %b
29121 Substitute the basename of the input file being processed.
29122 This is the substring up to (and not including) the last period
29123 and not including the directory.
29124
29125 @item %B
29126 This is the same as @samp{%b}, but include the file suffix (text after
29127 the last period).
29128
29129 @item %d
29130 Marks the argument containing or following the @samp{%d} as a
29131 temporary file name, so that that file is deleted if GCC exits
29132 successfully. Unlike @samp{%g}, this contributes no text to the
29133 argument.
29134
29135 @item %g@var{suffix}
29136 Substitute a file name that has suffix @var{suffix} and is chosen
29137 once per compilation, and mark the argument in the same way as
29138 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29139 name is now chosen in a way that is hard to predict even when previously
29140 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29141 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29142 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29143 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29144 was simply substituted with a file name chosen once per compilation,
29145 without regard to any appended suffix (which was therefore treated
29146 just like ordinary text), making such attacks more likely to succeed.
29147
29148 @item %u@var{suffix}
29149 Like @samp{%g}, but generates a new temporary file name
29150 each time it appears instead of once per compilation.
29151
29152 @item %U@var{suffix}
29153 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29154 new one if there is no such last file name. In the absence of any
29155 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29156 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29157 involves the generation of two distinct file names, one
29158 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29159 simply substituted with a file name chosen for the previous @samp{%u},
29160 without regard to any appended suffix.
29161
29162 @item %j@var{suffix}
29163 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29164 writable, and if @option{-save-temps} is not used;
29165 otherwise, substitute the name
29166 of a temporary file, just like @samp{%u}. This temporary file is not
29167 meant for communication between processes, but rather as a junk
29168 disposal mechanism.
29169
29170 @item %|@var{suffix}
29171 @itemx %m@var{suffix}
29172 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29173 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29174 all. These are the two most common ways to instruct a program that it
29175 should read from standard input or write to standard output. If you
29176 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29177 construct: see for example @file{f/lang-specs.h}.
29178
29179 @item %.@var{SUFFIX}
29180 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29181 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29182 terminated by the next space or %.
29183
29184 @item %w
29185 Marks the argument containing or following the @samp{%w} as the
29186 designated output file of this compilation. This puts the argument
29187 into the sequence of arguments that @samp{%o} substitutes.
29188
29189 @item %o
29190 Substitutes the names of all the output files, with spaces
29191 automatically placed around them. You should write spaces
29192 around the @samp{%o} as well or the results are undefined.
29193 @samp{%o} is for use in the specs for running the linker.
29194 Input files whose names have no recognized suffix are not compiled
29195 at all, but they are included among the output files, so they are
29196 linked.
29197
29198 @item %O
29199 Substitutes the suffix for object files. Note that this is
29200 handled specially when it immediately follows @samp{%g, %u, or %U},
29201 because of the need for those to form complete file names. The
29202 handling is such that @samp{%O} is treated exactly as if it had already
29203 been substituted, except that @samp{%g, %u, and %U} do not currently
29204 support additional @var{suffix} characters following @samp{%O} as they do
29205 following, for example, @samp{.o}.
29206
29207 @item %p
29208 Substitutes the standard macro predefinitions for the
29209 current target machine. Use this when running @command{cpp}.
29210
29211 @item %P
29212 Like @samp{%p}, but puts @samp{__} before and after the name of each
29213 predefined macro, except for macros that start with @samp{__} or with
29214 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29215 C@.
29216
29217 @item %I
29218 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29219 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29220 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29221 and @option{-imultilib} as necessary.
29222
29223 @item %s
29224 Current argument is the name of a library or startup file of some sort.
29225 Search for that file in a standard list of directories and substitute
29226 the full name found. The current working directory is included in the
29227 list of directories scanned.
29228
29229 @item %T
29230 Current argument is the name of a linker script. Search for that file
29231 in the current list of directories to scan for libraries. If the file
29232 is located insert a @option{--script} option into the command line
29233 followed by the full path name found. If the file is not found then
29234 generate an error message. Note: the current working directory is not
29235 searched.
29236
29237 @item %e@var{str}
29238 Print @var{str} as an error message. @var{str} is terminated by a newline.
29239 Use this when inconsistent options are detected.
29240
29241 @item %(@var{name})
29242 Substitute the contents of spec string @var{name} at this point.
29243
29244 @item %x@{@var{option}@}
29245 Accumulate an option for @samp{%X}.
29246
29247 @item %X
29248 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29249 spec string.
29250
29251 @item %Y
29252 Output the accumulated assembler options specified by @option{-Wa}.
29253
29254 @item %Z
29255 Output the accumulated preprocessor options specified by @option{-Wp}.
29256
29257 @item %a
29258 Process the @code{asm} spec. This is used to compute the
29259 switches to be passed to the assembler.
29260
29261 @item %A
29262 Process the @code{asm_final} spec. This is a spec string for
29263 passing switches to an assembler post-processor, if such a program is
29264 needed.
29265
29266 @item %l
29267 Process the @code{link} spec. This is the spec for computing the
29268 command line passed to the linker. Typically it makes use of the
29269 @samp{%L %G %S %D and %E} sequences.
29270
29271 @item %D
29272 Dump out a @option{-L} option for each directory that GCC believes might
29273 contain startup files. If the target supports multilibs then the
29274 current multilib directory is prepended to each of these paths.
29275
29276 @item %L
29277 Process the @code{lib} spec. This is a spec string for deciding which
29278 libraries are included on the command line to the linker.
29279
29280 @item %G
29281 Process the @code{libgcc} spec. This is a spec string for deciding
29282 which GCC support library is included on the command line to the linker.
29283
29284 @item %S
29285 Process the @code{startfile} spec. This is a spec for deciding which
29286 object files are the first ones passed to the linker. Typically
29287 this might be a file named @file{crt0.o}.
29288
29289 @item %E
29290 Process the @code{endfile} spec. This is a spec string that specifies
29291 the last object files that are passed to the linker.
29292
29293 @item %C
29294 Process the @code{cpp} spec. This is used to construct the arguments
29295 to be passed to the C preprocessor.
29296
29297 @item %1
29298 Process the @code{cc1} spec. This is used to construct the options to be
29299 passed to the actual C compiler (@command{cc1}).
29300
29301 @item %2
29302 Process the @code{cc1plus} spec. This is used to construct the options to be
29303 passed to the actual C++ compiler (@command{cc1plus}).
29304
29305 @item %*
29306 Substitute the variable part of a matched option. See below.
29307 Note that each comma in the substituted string is replaced by
29308 a single space.
29309
29310 @item %<S
29311 Remove all occurrences of @code{-S} from the command line. Note---this
29312 command is position dependent. @samp{%} commands in the spec string
29313 before this one see @code{-S}, @samp{%} commands in the spec string
29314 after this one do not.
29315
29316 @item %:@var{function}(@var{args})
29317 Call the named function @var{function}, passing it @var{args}.
29318 @var{args} is first processed as a nested spec string, then split
29319 into an argument vector in the usual fashion. The function returns
29320 a string which is processed as if it had appeared literally as part
29321 of the current spec.
29322
29323 The following built-in spec functions are provided:
29324
29325 @table @code
29326 @item @code{getenv}
29327 The @code{getenv} spec function takes two arguments: an environment
29328 variable name and a string. If the environment variable is not
29329 defined, a fatal error is issued. Otherwise, the return value is the
29330 value of the environment variable concatenated with the string. For
29331 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29332
29333 @smallexample
29334 %:getenv(TOPDIR /include)
29335 @end smallexample
29336
29337 expands to @file{/path/to/top/include}.
29338
29339 @item @code{if-exists}
29340 The @code{if-exists} spec function takes one argument, an absolute
29341 pathname to a file. If the file exists, @code{if-exists} returns the
29342 pathname. Here is a small example of its usage:
29343
29344 @smallexample
29345 *startfile:
29346 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29347 @end smallexample
29348
29349 @item @code{if-exists-else}
29350 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29351 spec function, except that it takes two arguments. The first argument is
29352 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29353 returns the pathname. If it does not exist, it returns the second argument.
29354 This way, @code{if-exists-else} can be used to select one file or another,
29355 based on the existence of the first. Here is a small example of its usage:
29356
29357 @smallexample
29358 *startfile:
29359 crt0%O%s %:if-exists(crti%O%s) \
29360 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29361 @end smallexample
29362
29363 @item @code{replace-outfile}
29364 The @code{replace-outfile} spec function takes two arguments. It looks for the
29365 first argument in the outfiles array and replaces it with the second argument. Here
29366 is a small example of its usage:
29367
29368 @smallexample
29369 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29370 @end smallexample
29371
29372 @item @code{remove-outfile}
29373 The @code{remove-outfile} spec function takes one argument. It looks for the
29374 first argument in the outfiles array and removes it. Here is a small example
29375 its usage:
29376
29377 @smallexample
29378 %:remove-outfile(-lm)
29379 @end smallexample
29380
29381 @item @code{pass-through-libs}
29382 The @code{pass-through-libs} spec function takes any number of arguments. It
29383 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29384 assumes are the names of linker input library archive files) and returns a
29385 result containing all the found arguments each prepended by
29386 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29387 intended to be passed to the LTO linker plugin.
29388
29389 @smallexample
29390 %:pass-through-libs(%G %L %G)
29391 @end smallexample
29392
29393 @item @code{print-asm-header}
29394 The @code{print-asm-header} function takes no arguments and simply
29395 prints a banner like:
29396
29397 @smallexample
29398 Assembler options
29399 =================
29400
29401 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29402 @end smallexample
29403
29404 It is used to separate compiler options from assembler options
29405 in the @option{--target-help} output.
29406 @end table
29407
29408 @item %@{S@}
29409 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29410 If that switch is not specified, this substitutes nothing. Note that
29411 the leading dash is omitted when specifying this option, and it is
29412 automatically inserted if the substitution is performed. Thus the spec
29413 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29414 and outputs the command-line option @option{-foo}.
29415
29416 @item %W@{S@}
29417 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29418 deleted on failure.
29419
29420 @item %@{S*@}
29421 Substitutes all the switches specified to GCC whose names start
29422 with @code{-S}, but which also take an argument. This is used for
29423 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29424 GCC considers @option{-o foo} as being
29425 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29426 text, including the space. Thus two arguments are generated.
29427
29428 @item %@{S*&T*@}
29429 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29430 (the order of @code{S} and @code{T} in the spec is not significant).
29431 There can be any number of ampersand-separated variables; for each the
29432 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29433
29434 @item %@{S:X@}
29435 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29436
29437 @item %@{!S:X@}
29438 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29439
29440 @item %@{S*:X@}
29441 Substitutes @code{X} if one or more switches whose names start with
29442 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29443 once, no matter how many such switches appeared. However, if @code{%*}
29444 appears somewhere in @code{X}, then @code{X} is substituted once
29445 for each matching switch, with the @code{%*} replaced by the part of
29446 that switch matching the @code{*}.
29447
29448 If @code{%*} appears as the last part of a spec sequence then a space
29449 is added after the end of the last substitution. If there is more
29450 text in the sequence, however, then a space is not generated. This
29451 allows the @code{%*} substitution to be used as part of a larger
29452 string. For example, a spec string like this:
29453
29454 @smallexample
29455 %@{mcu=*:--script=%*/memory.ld@}
29456 @end smallexample
29457
29458 @noindent
29459 when matching an option like @option{-mcu=newchip} produces:
29460
29461 @smallexample
29462 --script=newchip/memory.ld
29463 @end smallexample
29464
29465 @item %@{.S:X@}
29466 Substitutes @code{X}, if processing a file with suffix @code{S}.
29467
29468 @item %@{!.S:X@}
29469 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29470
29471 @item %@{,S:X@}
29472 Substitutes @code{X}, if processing a file for language @code{S}.
29473
29474 @item %@{!,S:X@}
29475 Substitutes @code{X}, if not processing a file for language @code{S}.
29476
29477 @item %@{S|P:X@}
29478 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29479 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29480 @code{*} sequences as well, although they have a stronger binding than
29481 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29482 alternatives must be starred, and only the first matching alternative
29483 is substituted.
29484
29485 For example, a spec string like this:
29486
29487 @smallexample
29488 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29489 @end smallexample
29490
29491 @noindent
29492 outputs the following command-line options from the following input
29493 command-line options:
29494
29495 @smallexample
29496 fred.c -foo -baz
29497 jim.d -bar -boggle
29498 -d fred.c -foo -baz -boggle
29499 -d jim.d -bar -baz -boggle
29500 @end smallexample
29501
29502 @item %@{S:X; T:Y; :D@}
29503
29504 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29505 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29506 be as many clauses as you need. This may be combined with @code{.},
29507 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29508
29509
29510 @end table
29511
29512 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29513 or similar construct can use a backslash to ignore the special meaning
29514 of the character following it, thus allowing literal matching of a
29515 character that is otherwise specially treated. For example,
29516 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29517 @option{-std=iso9899:1999} option is given.
29518
29519 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29520 construct may contain other nested @samp{%} constructs or spaces, or
29521 even newlines. They are processed as usual, as described above.
29522 Trailing white space in @code{X} is ignored. White space may also
29523 appear anywhere on the left side of the colon in these constructs,
29524 except between @code{.} or @code{*} and the corresponding word.
29525
29526 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29527 handled specifically in these constructs. If another value of
29528 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29529 @option{-W} switch is found later in the command line, the earlier
29530 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29531 just one letter, which passes all matching options.
29532
29533 The character @samp{|} at the beginning of the predicate text is used to
29534 indicate that a command should be piped to the following command, but
29535 only if @option{-pipe} is specified.
29536
29537 It is built into GCC which switches take arguments and which do not.
29538 (You might think it would be useful to generalize this to allow each
29539 compiler's spec to say which switches take arguments. But this cannot
29540 be done in a consistent fashion. GCC cannot even decide which input
29541 files have been specified without knowing which switches take arguments,
29542 and it must know which input files to compile in order to tell which
29543 compilers to run).
29544
29545 GCC also knows implicitly that arguments starting in @option{-l} are to be
29546 treated as compiler output files, and passed to the linker in their
29547 proper position among the other output files.
29548
29549 @node Environment Variables
29550 @section Environment Variables Affecting GCC
29551 @cindex environment variables
29552
29553 @c man begin ENVIRONMENT
29554 This section describes several environment variables that affect how GCC
29555 operates. Some of them work by specifying directories or prefixes to use
29556 when searching for various kinds of files. Some are used to specify other
29557 aspects of the compilation environment.
29558
29559 Note that you can also specify places to search using options such as
29560 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29561 take precedence over places specified using environment variables, which
29562 in turn take precedence over those specified by the configuration of GCC@.
29563 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29564 GNU Compiler Collection (GCC) Internals}.
29565
29566 @table @env
29567 @item LANG
29568 @itemx LC_CTYPE
29569 @c @itemx LC_COLLATE
29570 @itemx LC_MESSAGES
29571 @c @itemx LC_MONETARY
29572 @c @itemx LC_NUMERIC
29573 @c @itemx LC_TIME
29574 @itemx LC_ALL
29575 @findex LANG
29576 @findex LC_CTYPE
29577 @c @findex LC_COLLATE
29578 @findex LC_MESSAGES
29579 @c @findex LC_MONETARY
29580 @c @findex LC_NUMERIC
29581 @c @findex LC_TIME
29582 @findex LC_ALL
29583 @cindex locale
29584 These environment variables control the way that GCC uses
29585 localization information which allows GCC to work with different
29586 national conventions. GCC inspects the locale categories
29587 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29588 so. These locale categories can be set to any value supported by your
29589 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29590 Kingdom encoded in UTF-8.
29591
29592 The @env{LC_CTYPE} environment variable specifies character
29593 classification. GCC uses it to determine the character boundaries in
29594 a string; this is needed for some multibyte encodings that contain quote
29595 and escape characters that are otherwise interpreted as a string
29596 end or escape.
29597
29598 The @env{LC_MESSAGES} environment variable specifies the language to
29599 use in diagnostic messages.
29600
29601 If the @env{LC_ALL} environment variable is set, it overrides the value
29602 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29603 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29604 environment variable. If none of these variables are set, GCC
29605 defaults to traditional C English behavior.
29606
29607 @item TMPDIR
29608 @findex TMPDIR
29609 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29610 files. GCC uses temporary files to hold the output of one stage of
29611 compilation which is to be used as input to the next stage: for example,
29612 the output of the preprocessor, which is the input to the compiler
29613 proper.
29614
29615 @item GCC_COMPARE_DEBUG
29616 @findex GCC_COMPARE_DEBUG
29617 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29618 @option{-fcompare-debug} to the compiler driver. See the documentation
29619 of this option for more details.
29620
29621 @item GCC_EXEC_PREFIX
29622 @findex GCC_EXEC_PREFIX
29623 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29624 names of the subprograms executed by the compiler. No slash is added
29625 when this prefix is combined with the name of a subprogram, but you can
29626 specify a prefix that ends with a slash if you wish.
29627
29628 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29629 an appropriate prefix to use based on the pathname it is invoked with.
29630
29631 If GCC cannot find the subprogram using the specified prefix, it
29632 tries looking in the usual places for the subprogram.
29633
29634 The default value of @env{GCC_EXEC_PREFIX} is
29635 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29636 the installed compiler. In many cases @var{prefix} is the value
29637 of @code{prefix} when you ran the @file{configure} script.
29638
29639 Other prefixes specified with @option{-B} take precedence over this prefix.
29640
29641 This prefix is also used for finding files such as @file{crt0.o} that are
29642 used for linking.
29643
29644 In addition, the prefix is used in an unusual way in finding the
29645 directories to search for header files. For each of the standard
29646 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29647 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29648 replacing that beginning with the specified prefix to produce an
29649 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29650 @file{foo/bar} just before it searches the standard directory
29651 @file{/usr/local/lib/bar}.
29652 If a standard directory begins with the configured
29653 @var{prefix} then the value of @var{prefix} is replaced by
29654 @env{GCC_EXEC_PREFIX} when looking for header files.
29655
29656 @item COMPILER_PATH
29657 @findex COMPILER_PATH
29658 The value of @env{COMPILER_PATH} is a colon-separated list of
29659 directories, much like @env{PATH}. GCC tries the directories thus
29660 specified when searching for subprograms, if it cannot find the
29661 subprograms using @env{GCC_EXEC_PREFIX}.
29662
29663 @item LIBRARY_PATH
29664 @findex LIBRARY_PATH
29665 The value of @env{LIBRARY_PATH} is a colon-separated list of
29666 directories, much like @env{PATH}. When configured as a native compiler,
29667 GCC tries the directories thus specified when searching for special
29668 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29669 using GCC also uses these directories when searching for ordinary
29670 libraries for the @option{-l} option (but directories specified with
29671 @option{-L} come first).
29672
29673 @item LANG
29674 @findex LANG
29675 @cindex locale definition
29676 This variable is used to pass locale information to the compiler. One way in
29677 which this information is used is to determine the character set to be used
29678 when character literals, string literals and comments are parsed in C and C++.
29679 When the compiler is configured to allow multibyte characters,
29680 the following values for @env{LANG} are recognized:
29681
29682 @table @samp
29683 @item C-JIS
29684 Recognize JIS characters.
29685 @item C-SJIS
29686 Recognize SJIS characters.
29687 @item C-EUCJP
29688 Recognize EUCJP characters.
29689 @end table
29690
29691 If @env{LANG} is not defined, or if it has some other value, then the
29692 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29693 recognize and translate multibyte characters.
29694 @end table
29695
29696 @noindent
29697 Some additional environment variables affect the behavior of the
29698 preprocessor.
29699
29700 @include cppenv.texi
29701
29702 @c man end
29703
29704 @node Precompiled Headers
29705 @section Using Precompiled Headers
29706 @cindex precompiled headers
29707 @cindex speed of compilation
29708
29709 Often large projects have many header files that are included in every
29710 source file. The time the compiler takes to process these header files
29711 over and over again can account for nearly all of the time required to
29712 build the project. To make builds faster, GCC allows you to
29713 @dfn{precompile} a header file.
29714
29715 To create a precompiled header file, simply compile it as you would any
29716 other file, if necessary using the @option{-x} option to make the driver
29717 treat it as a C or C++ header file. You may want to use a
29718 tool like @command{make} to keep the precompiled header up-to-date when
29719 the headers it contains change.
29720
29721 A precompiled header file is searched for when @code{#include} is
29722 seen in the compilation. As it searches for the included file
29723 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29724 compiler looks for a precompiled header in each directory just before it
29725 looks for the include file in that directory. The name searched for is
29726 the name specified in the @code{#include} with @samp{.gch} appended. If
29727 the precompiled header file cannot be used, it is ignored.
29728
29729 For instance, if you have @code{#include "all.h"}, and you have
29730 @file{all.h.gch} in the same directory as @file{all.h}, then the
29731 precompiled header file is used if possible, and the original
29732 header is used otherwise.
29733
29734 Alternatively, you might decide to put the precompiled header file in a
29735 directory and use @option{-I} to ensure that directory is searched
29736 before (or instead of) the directory containing the original header.
29737 Then, if you want to check that the precompiled header file is always
29738 used, you can put a file of the same name as the original header in this
29739 directory containing an @code{#error} command.
29740
29741 This also works with @option{-include}. So yet another way to use
29742 precompiled headers, good for projects not designed with precompiled
29743 header files in mind, is to simply take most of the header files used by
29744 a project, include them from another header file, precompile that header
29745 file, and @option{-include} the precompiled header. If the header files
29746 have guards against multiple inclusion, they are skipped because
29747 they've already been included (in the precompiled header).
29748
29749 If you need to precompile the same header file for different
29750 languages, targets, or compiler options, you can instead make a
29751 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29752 header in the directory, perhaps using @option{-o}. It doesn't matter
29753 what you call the files in the directory; every precompiled header in
29754 the directory is considered. The first precompiled header
29755 encountered in the directory that is valid for this compilation is
29756 used; they're searched in no particular order.
29757
29758 There are many other possibilities, limited only by your imagination,
29759 good sense, and the constraints of your build system.
29760
29761 A precompiled header file can be used only when these conditions apply:
29762
29763 @itemize
29764 @item
29765 Only one precompiled header can be used in a particular compilation.
29766
29767 @item
29768 A precompiled header cannot be used once the first C token is seen. You
29769 can have preprocessor directives before a precompiled header; you cannot
29770 include a precompiled header from inside another header.
29771
29772 @item
29773 The precompiled header file must be produced for the same language as
29774 the current compilation. You cannot use a C precompiled header for a C++
29775 compilation.
29776
29777 @item
29778 The precompiled header file must have been produced by the same compiler
29779 binary as the current compilation is using.
29780
29781 @item
29782 Any macros defined before the precompiled header is included must
29783 either be defined in the same way as when the precompiled header was
29784 generated, or must not affect the precompiled header, which usually
29785 means that they don't appear in the precompiled header at all.
29786
29787 The @option{-D} option is one way to define a macro before a
29788 precompiled header is included; using a @code{#define} can also do it.
29789 There are also some options that define macros implicitly, like
29790 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29791 defined this way.
29792
29793 @item If debugging information is output when using the precompiled
29794 header, using @option{-g} or similar, the same kind of debugging information
29795 must have been output when building the precompiled header. However,
29796 a precompiled header built using @option{-g} can be used in a compilation
29797 when no debugging information is being output.
29798
29799 @item The same @option{-m} options must generally be used when building
29800 and using the precompiled header. @xref{Submodel Options},
29801 for any cases where this rule is relaxed.
29802
29803 @item Each of the following options must be the same when building and using
29804 the precompiled header:
29805
29806 @gccoptlist{-fexceptions}
29807
29808 @item
29809 Some other command-line options starting with @option{-f},
29810 @option{-p}, or @option{-O} must be defined in the same way as when
29811 the precompiled header was generated. At present, it's not clear
29812 which options are safe to change and which are not; the safest choice
29813 is to use exactly the same options when generating and using the
29814 precompiled header. The following are known to be safe:
29815
29816 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29817 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29818 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29819 -pedantic-errors}
29820
29821 @end itemize
29822
29823 For all of these except the last, the compiler automatically
29824 ignores the precompiled header if the conditions aren't met. If you
29825 find an option combination that doesn't work and doesn't cause the
29826 precompiled header to be ignored, please consider filing a bug report,
29827 see @ref{Bugs}.
29828
29829 If you do use differing options when generating and using the
29830 precompiled header, the actual behavior is a mixture of the
29831 behavior for the options. For instance, if you use @option{-g} to
29832 generate the precompiled header but not when using it, you may or may
29833 not get debugging information for routines in the precompiled header.