]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
PR c++/55442 - memory-hog with highly recursive constexpr.
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
207
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
223 -fno-optional-diags -fpermissive @gol
224 -fno-pretty-templates @gol
225 -frepo -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
234 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
235 -Wliteral-suffix @gol
236 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
237 -Wnamespaces -Wnarrowing @gol
238 -Wpessimizing-move -Wredundant-move @gol
239 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
240 -Wnon-virtual-dtor -Wreorder -Wregister @gol
241 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
242 -Wno-non-template-friend -Wold-style-cast @gol
243 -Woverloaded-virtual -Wno-pmf-conversions @gol
244 -Wno-class-conversion -Wno-terminate @gol
245 -Wsign-promo -Wvirtual-inheritance}
246
247 @item Objective-C and Objective-C++ Language Options
248 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
249 Objective-C and Objective-C++ Dialects}.
250 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
251 -fgnu-runtime -fnext-runtime @gol
252 -fno-nil-receivers @gol
253 -fobjc-abi-version=@var{n} @gol
254 -fobjc-call-cxx-cdtors @gol
255 -fobjc-direct-dispatch @gol
256 -fobjc-exceptions @gol
257 -fobjc-gc @gol
258 -fobjc-nilcheck @gol
259 -fobjc-std=objc1 @gol
260 -fno-local-ivars @gol
261 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
262 -freplace-objc-classes @gol
263 -fzero-link @gol
264 -gen-decls @gol
265 -Wassign-intercept @gol
266 -Wno-protocol -Wselector @gol
267 -Wstrict-selector-match @gol
268 -Wundeclared-selector}
269
270 @item Diagnostic Message Formatting Options
271 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
272 @gccoptlist{-fmessage-length=@var{n} @gol
273 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
274 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
275 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
276 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
277 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
278 -fdiagnostics-minimum-margin-width=@var{width} @gol
279 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
280 -fdiagnostics-show-template-tree -fno-elide-type @gol
281 -fno-show-column}
282
283 @item Warning Options
284 @xref{Warning Options,,Options to Request or Suppress Warnings}.
285 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
286 -pedantic-errors @gol
287 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
288 -Waggregate-return -Waligned-new @gol
289 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
290 -Walloca -Walloca-larger-than=@var{byte-size} @gol
291 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
292 -Wno-attributes -Wattribute-alias=@var{n} @gol
293 -Wbool-compare -Wbool-operation @gol
294 -Wno-builtin-declaration-mismatch @gol
295 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
296 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
297 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
298 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
299 -Wclobbered -Wcomment -Wconditionally-supported @gol
300 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
301 -Wdelete-incomplete @gol
302 -Wno-attribute-warning @gol
303 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
304 -Wdisabled-optimization @gol
305 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
306 -Wno-div-by-zero -Wdouble-promotion @gol
307 -Wduplicated-branches -Wduplicated-cond @gol
308 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
309 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
310 -Wfloat-equal -Wformat -Wformat=2 @gol
311 -Wno-format-contains-nul -Wno-format-extra-args @gol
312 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
313 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
314 -Wformat-y2k -Wframe-address @gol
315 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
316 -Wjump-misses-init @gol
317 -Whsa -Wif-not-aligned @gol
318 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
319 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
320 -Wimplicit-function-declaration -Wimplicit-int @gol
321 -Winaccessible-base @gol
322 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
323 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
324 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
325 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
326 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
327 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
328 -Wmissing-field-initializers -Wmissing-format-attribute @gol
329 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
330 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
331 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
332 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
333 -Woverride-init-side-effects -Woverlength-strings @gol
334 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
335 -Wparentheses -Wno-pedantic-ms-format @gol
336 -Wplacement-new -Wplacement-new=@var{n} @gol
337 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
338 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
339 -Wrestrict -Wno-return-local-addr @gol
340 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
341 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
342 -Wshift-overflow -Wshift-overflow=@var{n} @gol
343 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
344 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
345 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
346 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
347 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
348 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
349 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
350 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
351 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
352 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
353 -Wswitch-unreachable -Wsync-nand @gol
354 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
355 -Wtype-limits -Wundef @gol
356 -Wuninitialized -Wunknown-pragmas @gol
357 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
358 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
359 -Wunused-parameter -Wno-unused-result @gol
360 -Wunused-value -Wunused-variable @gol
361 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
362 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
363 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
364 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
365 -Wwrite-strings @gol
366 -Wzero-as-null-pointer-constant}
367
368 @item C and Objective-C-only Warning Options
369 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
370 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
371 -Wold-style-declaration -Wold-style-definition @gol
372 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
373 -Wdeclaration-after-statement -Wpointer-sign}
374
375 @item Debugging Options
376 @xref{Debugging Options,,Options for Debugging Your Program}.
377 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
378 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
379 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
380 -gas-loc-support -gno-as-loc-support @gol
381 -gas-locview-support -gno-as-locview-support @gol
382 -gcolumn-info -gno-column-info @gol
383 -gstatement-frontiers -gno-statement-frontiers @gol
384 -gvariable-location-views -gno-variable-location-views @gol
385 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
386 -ginline-points -gno-inline-points @gol
387 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
388 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
389 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
390 -fno-eliminate-unused-debug-types @gol
391 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
392 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
393 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
394 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
395 -fvar-tracking -fvar-tracking-assignments}
396
397 @item Optimization Options
398 @xref{Optimize Options,,Options that Control Optimization}.
399 @gccoptlist{-faggressive-loop-optimizations @gol
400 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
405 -fauto-inc-dec -fbranch-probabilities @gol
406 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
407 -fbtr-bb-exclusive -fcaller-saves @gol
408 -fcombine-stack-adjustments -fconserve-stack @gol
409 -fcompare-elim -fcprop-registers -fcrossjumping @gol
410 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
411 -fcx-limited-range @gol
412 -fdata-sections -fdce -fdelayed-branch @gol
413 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
414 -fdevirtualize-at-ltrans -fdse @gol
415 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
416 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
417 -ffinite-loops @gol
418 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
419 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
420 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
421 -fif-conversion2 -findirect-inlining @gol
422 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
423 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
424 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
425 -fipa-reference -fipa-reference-addressable @gol
426 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
427 -flive-patching=@var{level} @gol
428 -fira-region=@var{region} -fira-hoist-pressure @gol
429 -fira-loop-pressure -fno-ira-share-save-slots @gol
430 -fno-ira-share-spill-slots @gol
431 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
432 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
433 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
434 -floop-block -floop-interchange -floop-strip-mine @gol
435 -floop-unroll-and-jam -floop-nest-optimize @gol
436 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
437 -flto-partition=@var{alg} -fmerge-all-constants @gol
438 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
439 -fmove-loop-invariants -fno-branch-count-reg @gol
440 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
441 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
442 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
443 -fno-sched-spec -fno-signed-zeros @gol
444 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
445 -fomit-frame-pointer -foptimize-sibling-calls @gol
446 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
447 -fprefetch-loop-arrays @gol
448 -fprofile-correction @gol
449 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
450 -fprofile-reorder-functions @gol
451 -freciprocal-math -free -frename-registers -freorder-blocks @gol
452 -freorder-blocks-algorithm=@var{algorithm} @gol
453 -freorder-blocks-and-partition -freorder-functions @gol
454 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
455 -frounding-math -fsave-optimization-record @gol
456 -fsched2-use-superblocks -fsched-pressure @gol
457 -fsched-spec-load -fsched-spec-load-dangerous @gol
458 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
459 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
460 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
461 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
462 -fschedule-fusion @gol
463 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
464 -fselective-scheduling -fselective-scheduling2 @gol
465 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
466 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
467 -fsignaling-nans @gol
468 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
469 -fsplit-paths @gol
470 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
471 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
472 -fthread-jumps -ftracer -ftree-bit-ccp @gol
473 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
474 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
475 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
476 -ftree-loop-if-convert -ftree-loop-im @gol
477 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
478 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
479 -ftree-loop-vectorize @gol
480 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
481 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
482 -ftree-switch-conversion -ftree-tail-merge @gol
483 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
484 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
485 -funsafe-math-optimizations -funswitch-loops @gol
486 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
487 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
488 --param @var{name}=@var{value}
489 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
490
491 @item Program Instrumentation Options
492 @xref{Instrumentation Options,,Program Instrumentation Options}.
493 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
494 -fprofile-abs-path @gol
495 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
496 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
497 -fprofile-exclude-files=@var{regex} @gol
498 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
499 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
500 -fsanitize-undefined-trap-on-error -fbounds-check @gol
501 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
502 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
503 -fstack-protector-explicit -fstack-check @gol
504 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
505 -fno-stack-limit -fsplit-stack @gol
506 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
507 -fvtv-counts -fvtv-debug @gol
508 -finstrument-functions @gol
509 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
510 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
511
512 @item Preprocessor Options
513 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
514 @gccoptlist{-A@var{question}=@var{answer} @gol
515 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
516 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
517 -dD -dI -dM -dN -dU @gol
518 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
519 -fexec-charset=@var{charset} -fextended-identifiers @gol
520 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
521 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
522 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
523 -fwide-exec-charset=@var{charset} -fworking-directory @gol
524 -H -imacros @var{file} -include @var{file} @gol
525 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
526 -no-integrated-cpp -P -pthread -remap @gol
527 -traditional -traditional-cpp -trigraphs @gol
528 -U@var{macro} -undef @gol
529 -Wp,@var{option} -Xpreprocessor @var{option}}
530
531 @item Assembler Options
532 @xref{Assembler Options,,Passing Options to the Assembler}.
533 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
534
535 @item Linker Options
536 @xref{Link Options,,Options for Linking}.
537 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
538 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
539 -e @var{entry} --entry=@var{entry} @gol
540 -pie -pthread -r -rdynamic @gol
541 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
542 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
543 -shared -shared-libgcc -symbolic @gol
544 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
545 -u @var{symbol} -z @var{keyword}}
546
547 @item Directory Options
548 @xref{Directory Options,,Options for Directory Search}.
549 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
550 -idirafter @var{dir} @gol
551 -imacros @var{file} -imultilib @var{dir} @gol
552 -iplugindir=@var{dir} -iprefix @var{file} @gol
553 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
554 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
555 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
556 -nostdinc -nostdinc++ --sysroot=@var{dir}}
557
558 @item Code Generation Options
559 @xref{Code Gen Options,,Options for Code Generation Conventions}.
560 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
561 -ffixed-@var{reg} -fexceptions @gol
562 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
563 -fasynchronous-unwind-tables @gol
564 -fno-gnu-unique @gol
565 -finhibit-size-directive -fno-common -fno-ident @gol
566 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
567 -fno-jump-tables @gol
568 -frecord-gcc-switches @gol
569 -freg-struct-return -fshort-enums -fshort-wchar @gol
570 -fverbose-asm -fpack-struct[=@var{n}] @gol
571 -fleading-underscore -ftls-model=@var{model} @gol
572 -fstack-reuse=@var{reuse_level} @gol
573 -ftrampolines -ftrapv -fwrapv @gol
574 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
575 -fstrict-volatile-bitfields -fsync-libcalls}
576
577 @item Developer Options
578 @xref{Developer Options,,GCC Developer Options}.
579 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
580 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
581 -fdbg-cnt=@var{counter-value-list} @gol
582 -fdisable-ipa-@var{pass_name} @gol
583 -fdisable-rtl-@var{pass_name} @gol
584 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
585 -fdisable-tree-@var{pass_name} @gol
586 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
587 -fdump-debug -fdump-earlydebug @gol
588 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
589 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
590 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
591 -fdump-lang-all @gol
592 -fdump-lang-@var{switch} @gol
593 -fdump-lang-@var{switch}-@var{options} @gol
594 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
595 -fdump-passes @gol
596 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
597 -fdump-statistics @gol
598 -fdump-tree-all @gol
599 -fdump-tree-@var{switch} @gol
600 -fdump-tree-@var{switch}-@var{options} @gol
601 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
602 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
603 -fenable-@var{kind}-@var{pass} @gol
604 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
605 -fira-verbose=@var{n} @gol
606 -flto-report -flto-report-wpa -fmem-report-wpa @gol
607 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
608 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
609 -fprofile-report @gol
610 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
611 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
612 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
613 -fvar-tracking-assignments-toggle -gtoggle @gol
614 -print-file-name=@var{library} -print-libgcc-file-name @gol
615 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
616 -print-prog-name=@var{program} -print-search-dirs -Q @gol
617 -print-sysroot -print-sysroot-headers-suffix @gol
618 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
619
620 @item Machine-Dependent Options
621 @xref{Submodel Options,,Machine-Dependent Options}.
622 @c This list is ordered alphanumerically by subsection name.
623 @c Try and put the significant identifier (CPU or system) first,
624 @c so users have a clue at guessing where the ones they want will be.
625
626 @emph{AArch64 Options}
627 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
628 -mgeneral-regs-only @gol
629 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
630 -mstrict-align -mno-strict-align @gol
631 -momit-leaf-frame-pointer @gol
632 -mtls-dialect=desc -mtls-dialect=traditional @gol
633 -mtls-size=@var{size} @gol
634 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
635 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
636 -mpc-relative-literal-loads @gol
637 -msign-return-address=@var{scope} @gol
638 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
639 +@var{b-key}]|@var{bti} @gol
640 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
641 -moverride=@var{string} -mverbose-cost-dump @gol
642 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
643 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
644
645 @emph{Adapteva Epiphany Options}
646 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
647 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
648 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
649 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
650 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
651 -msplit-vecmove-early -m1reg-@var{reg}}
652
653 @emph{AMD GCN Options}
654 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
655
656 @emph{ARC Options}
657 @gccoptlist{-mbarrel-shifter -mjli-always @gol
658 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
659 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
660 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
661 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
662 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
663 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
664 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
665 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
666 -mvolatile-cache -mtp-regno=@var{regno} @gol
667 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
668 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
669 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
670 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
671 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
672 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
673 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
674 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
675
676 @emph{ARM Options}
677 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
678 -mabi=@var{name} @gol
679 -mapcs-stack-check -mno-apcs-stack-check @gol
680 -mapcs-reentrant -mno-apcs-reentrant @gol
681 -mgeneral-regs-only @gol
682 -msched-prolog -mno-sched-prolog @gol
683 -mlittle-endian -mbig-endian @gol
684 -mbe8 -mbe32 @gol
685 -mfloat-abi=@var{name} @gol
686 -mfp16-format=@var{name}
687 -mthumb-interwork -mno-thumb-interwork @gol
688 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
689 -mtune=@var{name} -mprint-tune-info @gol
690 -mstructure-size-boundary=@var{n} @gol
691 -mabort-on-noreturn @gol
692 -mlong-calls -mno-long-calls @gol
693 -msingle-pic-base -mno-single-pic-base @gol
694 -mpic-register=@var{reg} @gol
695 -mnop-fun-dllimport @gol
696 -mpoke-function-name @gol
697 -mthumb -marm -mflip-thumb @gol
698 -mtpcs-frame -mtpcs-leaf-frame @gol
699 -mcaller-super-interworking -mcallee-super-interworking @gol
700 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
701 -mword-relocations @gol
702 -mfix-cortex-m3-ldrd @gol
703 -munaligned-access @gol
704 -mneon-for-64bits @gol
705 -mslow-flash-data @gol
706 -masm-syntax-unified @gol
707 -mrestrict-it @gol
708 -mverbose-cost-dump @gol
709 -mpure-code @gol
710 -mcmse}
711
712 @emph{AVR Options}
713 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
714 -mbranch-cost=@var{cost} @gol
715 -mcall-prologues -mgas-isr-prologues -mint8 @gol
716 -mn_flash=@var{size} -mno-interrupts @gol
717 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
718 -mfract-convert-truncate @gol
719 -mshort-calls -nodevicelib @gol
720 -Waddr-space-convert -Wmisspelled-isr}
721
722 @emph{Blackfin Options}
723 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
724 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
725 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
726 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
727 -mno-id-shared-library -mshared-library-id=@var{n} @gol
728 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
729 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
730 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
731 -micplb}
732
733 @emph{C6X Options}
734 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
735 -msim -msdata=@var{sdata-type}}
736
737 @emph{CRIS Options}
738 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
739 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
740 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
741 -mstack-align -mdata-align -mconst-align @gol
742 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
743 -melf -maout -melinux -mlinux -sim -sim2 @gol
744 -mmul-bug-workaround -mno-mul-bug-workaround}
745
746 @emph{CR16 Options}
747 @gccoptlist{-mmac @gol
748 -mcr16cplus -mcr16c @gol
749 -msim -mint32 -mbit-ops
750 -mdata-model=@var{model}}
751
752 @emph{C-SKY Options}
753 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
754 -mbig-endian -EB -mlittle-endian -EL @gol
755 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
756 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
757 -mdsp -medsp -mvdsp @gol
758 -mdiv -msmart -mhigh-registers -manchor @gol
759 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
760 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
761
762 @emph{Darwin Options}
763 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
764 -arch_only -bind_at_load -bundle -bundle_loader @gol
765 -client_name -compatibility_version -current_version @gol
766 -dead_strip @gol
767 -dependency-file -dylib_file -dylinker_install_name @gol
768 -dynamic -dynamiclib -exported_symbols_list @gol
769 -filelist -flat_namespace -force_cpusubtype_ALL @gol
770 -force_flat_namespace -headerpad_max_install_names @gol
771 -iframework @gol
772 -image_base -init -install_name -keep_private_externs @gol
773 -multi_module -multiply_defined -multiply_defined_unused @gol
774 -noall_load -no_dead_strip_inits_and_terms @gol
775 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
776 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
777 -private_bundle -read_only_relocs -sectalign @gol
778 -sectobjectsymbols -whyload -seg1addr @gol
779 -sectcreate -sectobjectsymbols -sectorder @gol
780 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
781 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
782 -segprot -segs_read_only_addr -segs_read_write_addr @gol
783 -single_module -static -sub_library -sub_umbrella @gol
784 -twolevel_namespace -umbrella -undefined @gol
785 -unexported_symbols_list -weak_reference_mismatches @gol
786 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
787 -mkernel -mone-byte-bool}
788
789 @emph{DEC Alpha Options}
790 @gccoptlist{-mno-fp-regs -msoft-float @gol
791 -mieee -mieee-with-inexact -mieee-conformant @gol
792 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
793 -mtrap-precision=@var{mode} -mbuild-constants @gol
794 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
795 -mbwx -mmax -mfix -mcix @gol
796 -mfloat-vax -mfloat-ieee @gol
797 -mexplicit-relocs -msmall-data -mlarge-data @gol
798 -msmall-text -mlarge-text @gol
799 -mmemory-latency=@var{time}}
800
801 @emph{FR30 Options}
802 @gccoptlist{-msmall-model -mno-lsim}
803
804 @emph{FT32 Options}
805 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
806
807 @emph{FRV Options}
808 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
809 -mhard-float -msoft-float @gol
810 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
811 -mdouble -mno-double @gol
812 -mmedia -mno-media -mmuladd -mno-muladd @gol
813 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
814 -mlinked-fp -mlong-calls -malign-labels @gol
815 -mlibrary-pic -macc-4 -macc-8 @gol
816 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
817 -moptimize-membar -mno-optimize-membar @gol
818 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
819 -mvliw-branch -mno-vliw-branch @gol
820 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
821 -mno-nested-cond-exec -mtomcat-stats @gol
822 -mTLS -mtls @gol
823 -mcpu=@var{cpu}}
824
825 @emph{GNU/Linux Options}
826 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
827 -tno-android-cc -tno-android-ld}
828
829 @emph{H8/300 Options}
830 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
831
832 @emph{HPPA Options}
833 @gccoptlist{-march=@var{architecture-type} @gol
834 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
835 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
836 -mfixed-range=@var{register-range} @gol
837 -mjump-in-delay -mlinker-opt -mlong-calls @gol
838 -mlong-load-store -mno-disable-fpregs @gol
839 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
840 -mno-jump-in-delay -mno-long-load-store @gol
841 -mno-portable-runtime -mno-soft-float @gol
842 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
843 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
844 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
845 -munix=@var{unix-std} -nolibdld -static -threads}
846
847 @emph{IA-64 Options}
848 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
849 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
850 -mconstant-gp -mauto-pic -mfused-madd @gol
851 -minline-float-divide-min-latency @gol
852 -minline-float-divide-max-throughput @gol
853 -mno-inline-float-divide @gol
854 -minline-int-divide-min-latency @gol
855 -minline-int-divide-max-throughput @gol
856 -mno-inline-int-divide @gol
857 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
858 -mno-inline-sqrt @gol
859 -mdwarf2-asm -mearly-stop-bits @gol
860 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
861 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
862 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
863 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
864 -msched-spec-ldc -msched-spec-control-ldc @gol
865 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
866 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
867 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
868 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
869
870 @emph{LM32 Options}
871 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
872 -msign-extend-enabled -muser-enabled}
873
874 @emph{M32R/D Options}
875 @gccoptlist{-m32r2 -m32rx -m32r @gol
876 -mdebug @gol
877 -malign-loops -mno-align-loops @gol
878 -missue-rate=@var{number} @gol
879 -mbranch-cost=@var{number} @gol
880 -mmodel=@var{code-size-model-type} @gol
881 -msdata=@var{sdata-type} @gol
882 -mno-flush-func -mflush-func=@var{name} @gol
883 -mno-flush-trap -mflush-trap=@var{number} @gol
884 -G @var{num}}
885
886 @emph{M32C Options}
887 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
888
889 @emph{M680x0 Options}
890 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
891 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
892 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
893 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
894 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
895 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
896 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
897 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
898 -mxgot -mno-xgot -mlong-jump-table-offsets}
899
900 @emph{MCore Options}
901 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
902 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
903 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
904 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
905 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
906
907 @emph{MeP Options}
908 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
909 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
910 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
911 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
912 -mtiny=@var{n}}
913
914 @emph{MicroBlaze Options}
915 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
916 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
917 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
918 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
919 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
920 -mpic-data-is-text-relative}
921
922 @emph{MIPS Options}
923 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
924 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
925 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
926 -mips16 -mno-mips16 -mflip-mips16 @gol
927 -minterlink-compressed -mno-interlink-compressed @gol
928 -minterlink-mips16 -mno-interlink-mips16 @gol
929 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
930 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
931 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
932 -mno-float -msingle-float -mdouble-float @gol
933 -modd-spreg -mno-odd-spreg @gol
934 -mabs=@var{mode} -mnan=@var{encoding} @gol
935 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
936 -mmcu -mmno-mcu @gol
937 -meva -mno-eva @gol
938 -mvirt -mno-virt @gol
939 -mxpa -mno-xpa @gol
940 -mcrc -mno-crc @gol
941 -mginv -mno-ginv @gol
942 -mmicromips -mno-micromips @gol
943 -mmsa -mno-msa @gol
944 -mloongson-mmi -mno-loongson-mmi @gol
945 -mloongson-ext -mno-loongson-ext @gol
946 -mloongson-ext2 -mno-loongson-ext2 @gol
947 -mfpu=@var{fpu-type} @gol
948 -msmartmips -mno-smartmips @gol
949 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
950 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
951 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
952 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
953 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
954 -membedded-data -mno-embedded-data @gol
955 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
956 -mcode-readable=@var{setting} @gol
957 -msplit-addresses -mno-split-addresses @gol
958 -mexplicit-relocs -mno-explicit-relocs @gol
959 -mcheck-zero-division -mno-check-zero-division @gol
960 -mdivide-traps -mdivide-breaks @gol
961 -mload-store-pairs -mno-load-store-pairs @gol
962 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
963 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
964 -mfix-24k -mno-fix-24k @gol
965 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
966 -mfix-r5900 -mno-fix-r5900 @gol
967 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
968 -mfix-vr4120 -mno-fix-vr4120 @gol
969 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
970 -mflush-func=@var{func} -mno-flush-func @gol
971 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
972 -mcompact-branches=@var{policy} @gol
973 -mfp-exceptions -mno-fp-exceptions @gol
974 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
975 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
976 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
977 -mframe-header-opt -mno-frame-header-opt}
978
979 @emph{MMIX Options}
980 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
981 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
982 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
983 -mno-base-addresses -msingle-exit -mno-single-exit}
984
985 @emph{MN10300 Options}
986 @gccoptlist{-mmult-bug -mno-mult-bug @gol
987 -mno-am33 -mam33 -mam33-2 -mam34 @gol
988 -mtune=@var{cpu-type} @gol
989 -mreturn-pointer-on-d0 @gol
990 -mno-crt0 -mrelax -mliw -msetlb}
991
992 @emph{Moxie Options}
993 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
994
995 @emph{MSP430 Options}
996 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
997 -mwarn-mcu @gol
998 -mcode-region= -mdata-region= @gol
999 -msilicon-errata= -msilicon-errata-warn= @gol
1000 -mhwmult= -minrt}
1001
1002 @emph{NDS32 Options}
1003 @gccoptlist{-mbig-endian -mlittle-endian @gol
1004 -mreduced-regs -mfull-regs @gol
1005 -mcmov -mno-cmov @gol
1006 -mext-perf -mno-ext-perf @gol
1007 -mext-perf2 -mno-ext-perf2 @gol
1008 -mext-string -mno-ext-string @gol
1009 -mv3push -mno-v3push @gol
1010 -m16bit -mno-16bit @gol
1011 -misr-vector-size=@var{num} @gol
1012 -mcache-block-size=@var{num} @gol
1013 -march=@var{arch} @gol
1014 -mcmodel=@var{code-model} @gol
1015 -mctor-dtor -mrelax}
1016
1017 @emph{Nios II Options}
1018 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1019 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1020 -mel -meb @gol
1021 -mno-bypass-cache -mbypass-cache @gol
1022 -mno-cache-volatile -mcache-volatile @gol
1023 -mno-fast-sw-div -mfast-sw-div @gol
1024 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1025 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1026 -mcustom-fpu-cfg=@var{name} @gol
1027 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1028 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1029
1030 @emph{Nvidia PTX Options}
1031 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1032
1033 @emph{OpenRISC Options}
1034 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1035 -msoft-mul -msoft-div @gol
1036 -mcmov -mror -msext -msfimm -mshftimm}
1037
1038 @emph{PDP-11 Options}
1039 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1040 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1041 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1042
1043 @emph{picoChip Options}
1044 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1045 -msymbol-as-address -mno-inefficient-warnings}
1046
1047 @emph{PowerPC Options}
1048 See RS/6000 and PowerPC Options.
1049
1050 @emph{PRU Options}
1051 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1052 -mabi=@var{variant} @gol}
1053
1054 @emph{RISC-V Options}
1055 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1056 -mplt -mno-plt @gol
1057 -mabi=@var{ABI-string} @gol
1058 -mfdiv -mno-fdiv @gol
1059 -mdiv -mno-div @gol
1060 -march=@var{ISA-string} @gol
1061 -mtune=@var{processor-string} @gol
1062 -mpreferred-stack-boundary=@var{num} @gol
1063 -msmall-data-limit=@var{N-bytes} @gol
1064 -msave-restore -mno-save-restore @gol
1065 -mstrict-align -mno-strict-align @gol
1066 -mcmodel=medlow -mcmodel=medany @gol
1067 -mexplicit-relocs -mno-explicit-relocs @gol
1068 -mrelax -mno-relax @gol
1069 -mriscv-attribute -mmo-riscv-attribute}
1070
1071 @emph{RL78 Options}
1072 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1073 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1074 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1075
1076 @emph{RS/6000 and PowerPC Options}
1077 @gccoptlist{-mcpu=@var{cpu-type} @gol
1078 -mtune=@var{cpu-type} @gol
1079 -mcmodel=@var{code-model} @gol
1080 -mpowerpc64 @gol
1081 -maltivec -mno-altivec @gol
1082 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1083 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1084 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1085 -mfprnd -mno-fprnd @gol
1086 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1087 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1088 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1089 -malign-power -malign-natural @gol
1090 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1091 -mupdate -mno-update @gol
1092 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1093 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1094 -mstrict-align -mno-strict-align -mrelocatable @gol
1095 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1096 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1097 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1098 -mprioritize-restricted-insns=@var{priority} @gol
1099 -msched-costly-dep=@var{dependence_type} @gol
1100 -minsert-sched-nops=@var{scheme} @gol
1101 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1102 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1103 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1104 -mtraceback=@var{traceback_type} @gol
1105 -maix-struct-return -msvr4-struct-return @gol
1106 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1107 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1108 -mblock-move-inline-limit=@var{num} @gol
1109 -mblock-compare-inline-limit=@var{num} @gol
1110 -mblock-compare-inline-loop-limit=@var{num} @gol
1111 -mstring-compare-inline-limit=@var{num} @gol
1112 -misel -mno-isel @gol
1113 -mvrsave -mno-vrsave @gol
1114 -mmulhw -mno-mulhw @gol
1115 -mdlmzb -mno-dlmzb @gol
1116 -mprototype -mno-prototype @gol
1117 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1118 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1119 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1120 -mno-recip-precision @gol
1121 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1122 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1123 -msave-toc-indirect -mno-save-toc-indirect @gol
1124 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1125 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1126 -mquad-memory -mno-quad-memory @gol
1127 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1128 -mcompat-align-parm -mno-compat-align-parm @gol
1129 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1130 -mgnu-attribute -mno-gnu-attribute @gol
1131 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1132 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1133
1134 @emph{RX Options}
1135 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1136 -mcpu=@gol
1137 -mbig-endian-data -mlittle-endian-data @gol
1138 -msmall-data @gol
1139 -msim -mno-sim@gol
1140 -mas100-syntax -mno-as100-syntax@gol
1141 -mrelax@gol
1142 -mmax-constant-size=@gol
1143 -mint-register=@gol
1144 -mpid@gol
1145 -mallow-string-insns -mno-allow-string-insns@gol
1146 -mjsr@gol
1147 -mno-warn-multiple-fast-interrupts@gol
1148 -msave-acc-in-interrupts}
1149
1150 @emph{S/390 and zSeries Options}
1151 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1152 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1153 -mlong-double-64 -mlong-double-128 @gol
1154 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1155 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1156 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1157 -mhtm -mvx -mzvector @gol
1158 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1159 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1160 -mhotpatch=@var{halfwords},@var{halfwords}}
1161
1162 @emph{Score Options}
1163 @gccoptlist{-meb -mel @gol
1164 -mnhwloop @gol
1165 -muls @gol
1166 -mmac @gol
1167 -mscore5 -mscore5u -mscore7 -mscore7d}
1168
1169 @emph{SH Options}
1170 @gccoptlist{-m1 -m2 -m2e @gol
1171 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1172 -m3 -m3e @gol
1173 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1174 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1175 -mb -ml -mdalign -mrelax @gol
1176 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1177 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1178 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1179 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1180 -maccumulate-outgoing-args @gol
1181 -matomic-model=@var{atomic-model} @gol
1182 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1183 -mcbranch-force-delay-slot @gol
1184 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1185 -mpretend-cmove -mtas}
1186
1187 @emph{Solaris 2 Options}
1188 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1189 -pthreads}
1190
1191 @emph{SPARC Options}
1192 @gccoptlist{-mcpu=@var{cpu-type} @gol
1193 -mtune=@var{cpu-type} @gol
1194 -mcmodel=@var{code-model} @gol
1195 -mmemory-model=@var{mem-model} @gol
1196 -m32 -m64 -mapp-regs -mno-app-regs @gol
1197 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1198 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1199 -mhard-quad-float -msoft-quad-float @gol
1200 -mstack-bias -mno-stack-bias @gol
1201 -mstd-struct-return -mno-std-struct-return @gol
1202 -munaligned-doubles -mno-unaligned-doubles @gol
1203 -muser-mode -mno-user-mode @gol
1204 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1205 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1206 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1207 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1208 -mpopc -mno-popc -msubxc -mno-subxc @gol
1209 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1210 -mlra -mno-lra}
1211
1212 @emph{SPU Options}
1213 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1214 -msafe-dma -munsafe-dma @gol
1215 -mbranch-hints @gol
1216 -msmall-mem -mlarge-mem -mstdmain @gol
1217 -mfixed-range=@var{register-range} @gol
1218 -mea32 -mea64 @gol
1219 -maddress-space-conversion -mno-address-space-conversion @gol
1220 -mcache-size=@var{cache-size} @gol
1221 -matomic-updates -mno-atomic-updates}
1222
1223 @emph{System V Options}
1224 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1225
1226 @emph{TILE-Gx Options}
1227 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1228 -mcmodel=@var{code-model}}
1229
1230 @emph{TILEPro Options}
1231 @gccoptlist{-mcpu=@var{cpu} -m32}
1232
1233 @emph{V850 Options}
1234 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1235 -mprolog-function -mno-prolog-function -mspace @gol
1236 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1237 -mapp-regs -mno-app-regs @gol
1238 -mdisable-callt -mno-disable-callt @gol
1239 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1240 -mv850e -mv850 -mv850e3v5 @gol
1241 -mloop @gol
1242 -mrelax @gol
1243 -mlong-jumps @gol
1244 -msoft-float @gol
1245 -mhard-float @gol
1246 -mgcc-abi @gol
1247 -mrh850-abi @gol
1248 -mbig-switch}
1249
1250 @emph{VAX Options}
1251 @gccoptlist{-mg -mgnu -munix}
1252
1253 @emph{Visium Options}
1254 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1255 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1256
1257 @emph{VMS Options}
1258 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1259 -mpointer-size=@var{size}}
1260
1261 @emph{VxWorks Options}
1262 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1263 -Xbind-lazy -Xbind-now}
1264
1265 @emph{x86 Options}
1266 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1267 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1268 -mfpmath=@var{unit} @gol
1269 -masm=@var{dialect} -mno-fancy-math-387 @gol
1270 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1271 -mno-wide-multiply -mrtd -malign-double @gol
1272 -mpreferred-stack-boundary=@var{num} @gol
1273 -mincoming-stack-boundary=@var{num} @gol
1274 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1275 -mrecip -mrecip=@var{opt} @gol
1276 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1277 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1278 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1279 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1280 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1281 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1282 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1283 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1284 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1285 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1286 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1287 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1288 -mrdseed -msgx -mavx512vp2intersect@gol
1289 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1290 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1291 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1292 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1293 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1294 -mregparm=@var{num} -msseregparm @gol
1295 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1296 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1297 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1298 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1299 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1300 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1301 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1302 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1303 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1304 -mstack-protector-guard-reg=@var{reg} @gol
1305 -mstack-protector-guard-offset=@var{offset} @gol
1306 -mstack-protector-guard-symbol=@var{symbol} @gol
1307 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1308 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1309 -mindirect-branch-register}
1310
1311 @emph{x86 Windows Options}
1312 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1313 -mnop-fun-dllimport -mthread @gol
1314 -municode -mwin32 -mwindows -fno-set-stack-executable}
1315
1316 @emph{Xstormy16 Options}
1317 @gccoptlist{-msim}
1318
1319 @emph{Xtensa Options}
1320 @gccoptlist{-mconst16 -mno-const16 @gol
1321 -mfused-madd -mno-fused-madd @gol
1322 -mforce-no-pic @gol
1323 -mserialize-volatile -mno-serialize-volatile @gol
1324 -mtext-section-literals -mno-text-section-literals @gol
1325 -mauto-litpools -mno-auto-litpools @gol
1326 -mtarget-align -mno-target-align @gol
1327 -mlongcalls -mno-longcalls}
1328
1329 @emph{zSeries Options}
1330 See S/390 and zSeries Options.
1331 @end table
1332
1333
1334 @node Overall Options
1335 @section Options Controlling the Kind of Output
1336
1337 Compilation can involve up to four stages: preprocessing, compilation
1338 proper, assembly and linking, always in that order. GCC is capable of
1339 preprocessing and compiling several files either into several
1340 assembler input files, or into one assembler input file; then each
1341 assembler input file produces an object file, and linking combines all
1342 the object files (those newly compiled, and those specified as input)
1343 into an executable file.
1344
1345 @cindex file name suffix
1346 For any given input file, the file name suffix determines what kind of
1347 compilation is done:
1348
1349 @table @gcctabopt
1350 @item @var{file}.c
1351 C source code that must be preprocessed.
1352
1353 @item @var{file}.i
1354 C source code that should not be preprocessed.
1355
1356 @item @var{file}.ii
1357 C++ source code that should not be preprocessed.
1358
1359 @item @var{file}.m
1360 Objective-C source code. Note that you must link with the @file{libobjc}
1361 library to make an Objective-C program work.
1362
1363 @item @var{file}.mi
1364 Objective-C source code that should not be preprocessed.
1365
1366 @item @var{file}.mm
1367 @itemx @var{file}.M
1368 Objective-C++ source code. Note that you must link with the @file{libobjc}
1369 library to make an Objective-C++ program work. Note that @samp{.M} refers
1370 to a literal capital M@.
1371
1372 @item @var{file}.mii
1373 Objective-C++ source code that should not be preprocessed.
1374
1375 @item @var{file}.h
1376 C, C++, Objective-C or Objective-C++ header file to be turned into a
1377 precompiled header (default), or C, C++ header file to be turned into an
1378 Ada spec (via the @option{-fdump-ada-spec} switch).
1379
1380 @item @var{file}.cc
1381 @itemx @var{file}.cp
1382 @itemx @var{file}.cxx
1383 @itemx @var{file}.cpp
1384 @itemx @var{file}.CPP
1385 @itemx @var{file}.c++
1386 @itemx @var{file}.C
1387 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1388 the last two letters must both be literally @samp{x}. Likewise,
1389 @samp{.C} refers to a literal capital C@.
1390
1391 @item @var{file}.mm
1392 @itemx @var{file}.M
1393 Objective-C++ source code that must be preprocessed.
1394
1395 @item @var{file}.mii
1396 Objective-C++ source code that should not be preprocessed.
1397
1398 @item @var{file}.hh
1399 @itemx @var{file}.H
1400 @itemx @var{file}.hp
1401 @itemx @var{file}.hxx
1402 @itemx @var{file}.hpp
1403 @itemx @var{file}.HPP
1404 @itemx @var{file}.h++
1405 @itemx @var{file}.tcc
1406 C++ header file to be turned into a precompiled header or Ada spec.
1407
1408 @item @var{file}.f
1409 @itemx @var{file}.for
1410 @itemx @var{file}.ftn
1411 Fixed form Fortran source code that should not be preprocessed.
1412
1413 @item @var{file}.F
1414 @itemx @var{file}.FOR
1415 @itemx @var{file}.fpp
1416 @itemx @var{file}.FPP
1417 @itemx @var{file}.FTN
1418 Fixed form Fortran source code that must be preprocessed (with the traditional
1419 preprocessor).
1420
1421 @item @var{file}.f90
1422 @itemx @var{file}.f95
1423 @itemx @var{file}.f03
1424 @itemx @var{file}.f08
1425 Free form Fortran source code that should not be preprocessed.
1426
1427 @item @var{file}.F90
1428 @itemx @var{file}.F95
1429 @itemx @var{file}.F03
1430 @itemx @var{file}.F08
1431 Free form Fortran source code that must be preprocessed (with the
1432 traditional preprocessor).
1433
1434 @item @var{file}.go
1435 Go source code.
1436
1437 @item @var{file}.brig
1438 BRIG files (binary representation of HSAIL).
1439
1440 @item @var{file}.d
1441 D source code.
1442
1443 @item @var{file}.di
1444 D interface file.
1445
1446 @item @var{file}.dd
1447 D documentation code (Ddoc).
1448
1449 @item @var{file}.ads
1450 Ada source code file that contains a library unit declaration (a
1451 declaration of a package, subprogram, or generic, or a generic
1452 instantiation), or a library unit renaming declaration (a package,
1453 generic, or subprogram renaming declaration). Such files are also
1454 called @dfn{specs}.
1455
1456 @item @var{file}.adb
1457 Ada source code file containing a library unit body (a subprogram or
1458 package body). Such files are also called @dfn{bodies}.
1459
1460 @c GCC also knows about some suffixes for languages not yet included:
1461 @c Ratfor:
1462 @c @var{file}.r
1463
1464 @item @var{file}.s
1465 Assembler code.
1466
1467 @item @var{file}.S
1468 @itemx @var{file}.sx
1469 Assembler code that must be preprocessed.
1470
1471 @item @var{other}
1472 An object file to be fed straight into linking.
1473 Any file name with no recognized suffix is treated this way.
1474 @end table
1475
1476 @opindex x
1477 You can specify the input language explicitly with the @option{-x} option:
1478
1479 @table @gcctabopt
1480 @item -x @var{language}
1481 Specify explicitly the @var{language} for the following input files
1482 (rather than letting the compiler choose a default based on the file
1483 name suffix). This option applies to all following input files until
1484 the next @option{-x} option. Possible values for @var{language} are:
1485 @smallexample
1486 c c-header cpp-output
1487 c++ c++-header c++-cpp-output
1488 objective-c objective-c-header objective-c-cpp-output
1489 objective-c++ objective-c++-header objective-c++-cpp-output
1490 assembler assembler-with-cpp
1491 ada
1492 d
1493 f77 f77-cpp-input f95 f95-cpp-input
1494 go
1495 brig
1496 @end smallexample
1497
1498 @item -x none
1499 Turn off any specification of a language, so that subsequent files are
1500 handled according to their file name suffixes (as they are if @option{-x}
1501 has not been used at all).
1502 @end table
1503
1504 If you only want some of the stages of compilation, you can use
1505 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1506 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1507 @command{gcc} is to stop. Note that some combinations (for example,
1508 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1509
1510 @table @gcctabopt
1511 @item -c
1512 @opindex c
1513 Compile or assemble the source files, but do not link. The linking
1514 stage simply is not done. The ultimate output is in the form of an
1515 object file for each source file.
1516
1517 By default, the object file name for a source file is made by replacing
1518 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1519
1520 Unrecognized input files, not requiring compilation or assembly, are
1521 ignored.
1522
1523 @item -S
1524 @opindex S
1525 Stop after the stage of compilation proper; do not assemble. The output
1526 is in the form of an assembler code file for each non-assembler input
1527 file specified.
1528
1529 By default, the assembler file name for a source file is made by
1530 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1531
1532 Input files that don't require compilation are ignored.
1533
1534 @item -E
1535 @opindex E
1536 Stop after the preprocessing stage; do not run the compiler proper. The
1537 output is in the form of preprocessed source code, which is sent to the
1538 standard output.
1539
1540 Input files that don't require preprocessing are ignored.
1541
1542 @cindex output file option
1543 @item -o @var{file}
1544 @opindex o
1545 Place output in file @var{file}. This applies to whatever
1546 sort of output is being produced, whether it be an executable file,
1547 an object file, an assembler file or preprocessed C code.
1548
1549 If @option{-o} is not specified, the default is to put an executable
1550 file in @file{a.out}, the object file for
1551 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1552 assembler file in @file{@var{source}.s}, a precompiled header file in
1553 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1554 standard output.
1555
1556 @item -v
1557 @opindex v
1558 Print (on standard error output) the commands executed to run the stages
1559 of compilation. Also print the version number of the compiler driver
1560 program and of the preprocessor and the compiler proper.
1561
1562 @item -###
1563 @opindex ###
1564 Like @option{-v} except the commands are not executed and arguments
1565 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1566 This is useful for shell scripts to capture the driver-generated command lines.
1567
1568 @item --help
1569 @opindex help
1570 Print (on the standard output) a description of the command-line options
1571 understood by @command{gcc}. If the @option{-v} option is also specified
1572 then @option{--help} is also passed on to the various processes
1573 invoked by @command{gcc}, so that they can display the command-line options
1574 they accept. If the @option{-Wextra} option has also been specified
1575 (prior to the @option{--help} option), then command-line options that
1576 have no documentation associated with them are also displayed.
1577
1578 @item --target-help
1579 @opindex target-help
1580 Print (on the standard output) a description of target-specific command-line
1581 options for each tool. For some targets extra target-specific
1582 information may also be printed.
1583
1584 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1585 Print (on the standard output) a description of the command-line
1586 options understood by the compiler that fit into all specified classes
1587 and qualifiers. These are the supported classes:
1588
1589 @table @asis
1590 @item @samp{optimizers}
1591 Display all of the optimization options supported by the
1592 compiler.
1593
1594 @item @samp{warnings}
1595 Display all of the options controlling warning messages
1596 produced by the compiler.
1597
1598 @item @samp{target}
1599 Display target-specific options. Unlike the
1600 @option{--target-help} option however, target-specific options of the
1601 linker and assembler are not displayed. This is because those
1602 tools do not currently support the extended @option{--help=} syntax.
1603
1604 @item @samp{params}
1605 Display the values recognized by the @option{--param}
1606 option.
1607
1608 @item @var{language}
1609 Display the options supported for @var{language}, where
1610 @var{language} is the name of one of the languages supported in this
1611 version of GCC@.
1612
1613 @item @samp{common}
1614 Display the options that are common to all languages.
1615 @end table
1616
1617 These are the supported qualifiers:
1618
1619 @table @asis
1620 @item @samp{undocumented}
1621 Display only those options that are undocumented.
1622
1623 @item @samp{joined}
1624 Display options taking an argument that appears after an equal
1625 sign in the same continuous piece of text, such as:
1626 @samp{--help=target}.
1627
1628 @item @samp{separate}
1629 Display options taking an argument that appears as a separate word
1630 following the original option, such as: @samp{-o output-file}.
1631 @end table
1632
1633 Thus for example to display all the undocumented target-specific
1634 switches supported by the compiler, use:
1635
1636 @smallexample
1637 --help=target,undocumented
1638 @end smallexample
1639
1640 The sense of a qualifier can be inverted by prefixing it with the
1641 @samp{^} character, so for example to display all binary warning
1642 options (i.e., ones that are either on or off and that do not take an
1643 argument) that have a description, use:
1644
1645 @smallexample
1646 --help=warnings,^joined,^undocumented
1647 @end smallexample
1648
1649 The argument to @option{--help=} should not consist solely of inverted
1650 qualifiers.
1651
1652 Combining several classes is possible, although this usually
1653 restricts the output so much that there is nothing to display. One
1654 case where it does work, however, is when one of the classes is
1655 @var{target}. For example, to display all the target-specific
1656 optimization options, use:
1657
1658 @smallexample
1659 --help=target,optimizers
1660 @end smallexample
1661
1662 The @option{--help=} option can be repeated on the command line. Each
1663 successive use displays its requested class of options, skipping
1664 those that have already been displayed. If @option{--help} is also
1665 specified anywhere on the command line then this takes precedence
1666 over any @option{--help=} option.
1667
1668 If the @option{-Q} option appears on the command line before the
1669 @option{--help=} option, then the descriptive text displayed by
1670 @option{--help=} is changed. Instead of describing the displayed
1671 options, an indication is given as to whether the option is enabled,
1672 disabled or set to a specific value (assuming that the compiler
1673 knows this at the point where the @option{--help=} option is used).
1674
1675 Here is a truncated example from the ARM port of @command{gcc}:
1676
1677 @smallexample
1678 % gcc -Q -mabi=2 --help=target -c
1679 The following options are target specific:
1680 -mabi= 2
1681 -mabort-on-noreturn [disabled]
1682 -mapcs [disabled]
1683 @end smallexample
1684
1685 The output is sensitive to the effects of previous command-line
1686 options, so for example it is possible to find out which optimizations
1687 are enabled at @option{-O2} by using:
1688
1689 @smallexample
1690 -Q -O2 --help=optimizers
1691 @end smallexample
1692
1693 Alternatively you can discover which binary optimizations are enabled
1694 by @option{-O3} by using:
1695
1696 @smallexample
1697 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1698 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1699 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1700 @end smallexample
1701
1702 @item --version
1703 @opindex version
1704 Display the version number and copyrights of the invoked GCC@.
1705
1706 @item -pass-exit-codes
1707 @opindex pass-exit-codes
1708 Normally the @command{gcc} program exits with the code of 1 if any
1709 phase of the compiler returns a non-success return code. If you specify
1710 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1711 the numerically highest error produced by any phase returning an error
1712 indication. The C, C++, and Fortran front ends return 4 if an internal
1713 compiler error is encountered.
1714
1715 @item -pipe
1716 @opindex pipe
1717 Use pipes rather than temporary files for communication between the
1718 various stages of compilation. This fails to work on some systems where
1719 the assembler is unable to read from a pipe; but the GNU assembler has
1720 no trouble.
1721
1722 @item -specs=@var{file}
1723 @opindex specs
1724 Process @var{file} after the compiler reads in the standard @file{specs}
1725 file, in order to override the defaults which the @command{gcc} driver
1726 program uses when determining what switches to pass to @command{cc1},
1727 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1728 @option{-specs=@var{file}} can be specified on the command line, and they
1729 are processed in order, from left to right. @xref{Spec Files}, for
1730 information about the format of the @var{file}.
1731
1732 @item -wrapper
1733 @opindex wrapper
1734 Invoke all subcommands under a wrapper program. The name of the
1735 wrapper program and its parameters are passed as a comma separated
1736 list.
1737
1738 @smallexample
1739 gcc -c t.c -wrapper gdb,--args
1740 @end smallexample
1741
1742 @noindent
1743 This invokes all subprograms of @command{gcc} under
1744 @samp{gdb --args}, thus the invocation of @command{cc1} is
1745 @samp{gdb --args cc1 @dots{}}.
1746
1747 @item -ffile-prefix-map=@var{old}=@var{new}
1748 @opindex ffile-prefix-map
1749 When compiling files residing in directory @file{@var{old}}, record
1750 any references to them in the result of the compilation as if the
1751 files resided in directory @file{@var{new}} instead. Specifying this
1752 option is equivalent to specifying all the individual
1753 @option{-f*-prefix-map} options. This can be used to make reproducible
1754 builds that are location independent. See also
1755 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1756
1757 @item -fplugin=@var{name}.so
1758 @opindex fplugin
1759 Load the plugin code in file @var{name}.so, assumed to be a
1760 shared object to be dlopen'd by the compiler. The base name of
1761 the shared object file is used to identify the plugin for the
1762 purposes of argument parsing (See
1763 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1764 Each plugin should define the callback functions specified in the
1765 Plugins API.
1766
1767 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1768 @opindex fplugin-arg
1769 Define an argument called @var{key} with a value of @var{value}
1770 for the plugin called @var{name}.
1771
1772 @item -fdump-ada-spec@r{[}-slim@r{]}
1773 @opindex fdump-ada-spec
1774 For C and C++ source and include files, generate corresponding Ada specs.
1775 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1776 GNAT User's Guide}, which provides detailed documentation on this feature.
1777
1778 @item -fada-spec-parent=@var{unit}
1779 @opindex fada-spec-parent
1780 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1781 Ada specs as child units of parent @var{unit}.
1782
1783 @item -fdump-go-spec=@var{file}
1784 @opindex fdump-go-spec
1785 For input files in any language, generate corresponding Go
1786 declarations in @var{file}. This generates Go @code{const},
1787 @code{type}, @code{var}, and @code{func} declarations which may be a
1788 useful way to start writing a Go interface to code written in some
1789 other language.
1790
1791 @include @value{srcdir}/../libiberty/at-file.texi
1792 @end table
1793
1794 @node Invoking G++
1795 @section Compiling C++ Programs
1796
1797 @cindex suffixes for C++ source
1798 @cindex C++ source file suffixes
1799 C++ source files conventionally use one of the suffixes @samp{.C},
1800 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1801 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1802 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1803 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1804 files with these names and compiles them as C++ programs even if you
1805 call the compiler the same way as for compiling C programs (usually
1806 with the name @command{gcc}).
1807
1808 @findex g++
1809 @findex c++
1810 However, the use of @command{gcc} does not add the C++ library.
1811 @command{g++} is a program that calls GCC and automatically specifies linking
1812 against the C++ library. It treats @samp{.c},
1813 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1814 files unless @option{-x} is used. This program is also useful when
1815 precompiling a C header file with a @samp{.h} extension for use in C++
1816 compilations. On many systems, @command{g++} is also installed with
1817 the name @command{c++}.
1818
1819 @cindex invoking @command{g++}
1820 When you compile C++ programs, you may specify many of the same
1821 command-line options that you use for compiling programs in any
1822 language; or command-line options meaningful for C and related
1823 languages; or options that are meaningful only for C++ programs.
1824 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1825 explanations of options for languages related to C@.
1826 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1827 explanations of options that are meaningful only for C++ programs.
1828
1829 @node C Dialect Options
1830 @section Options Controlling C Dialect
1831 @cindex dialect options
1832 @cindex language dialect options
1833 @cindex options, dialect
1834
1835 The following options control the dialect of C (or languages derived
1836 from C, such as C++, Objective-C and Objective-C++) that the compiler
1837 accepts:
1838
1839 @table @gcctabopt
1840 @cindex ANSI support
1841 @cindex ISO support
1842 @item -ansi
1843 @opindex ansi
1844 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1845 equivalent to @option{-std=c++98}.
1846
1847 This turns off certain features of GCC that are incompatible with ISO
1848 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1849 such as the @code{asm} and @code{typeof} keywords, and
1850 predefined macros such as @code{unix} and @code{vax} that identify the
1851 type of system you are using. It also enables the undesirable and
1852 rarely used ISO trigraph feature. For the C compiler,
1853 it disables recognition of C++ style @samp{//} comments as well as
1854 the @code{inline} keyword.
1855
1856 The alternate keywords @code{__asm__}, @code{__extension__},
1857 @code{__inline__} and @code{__typeof__} continue to work despite
1858 @option{-ansi}. You would not want to use them in an ISO C program, of
1859 course, but it is useful to put them in header files that might be included
1860 in compilations done with @option{-ansi}. Alternate predefined macros
1861 such as @code{__unix__} and @code{__vax__} are also available, with or
1862 without @option{-ansi}.
1863
1864 The @option{-ansi} option does not cause non-ISO programs to be
1865 rejected gratuitously. For that, @option{-Wpedantic} is required in
1866 addition to @option{-ansi}. @xref{Warning Options}.
1867
1868 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1869 option is used. Some header files may notice this macro and refrain
1870 from declaring certain functions or defining certain macros that the
1871 ISO standard doesn't call for; this is to avoid interfering with any
1872 programs that might use these names for other things.
1873
1874 Functions that are normally built in but do not have semantics
1875 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1876 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1877 built-in functions provided by GCC}, for details of the functions
1878 affected.
1879
1880 @item -std=
1881 @opindex std
1882 Determine the language standard. @xref{Standards,,Language Standards
1883 Supported by GCC}, for details of these standard versions. This option
1884 is currently only supported when compiling C or C++.
1885
1886 The compiler can accept several base standards, such as @samp{c90} or
1887 @samp{c++98}, and GNU dialects of those standards, such as
1888 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1889 compiler accepts all programs following that standard plus those
1890 using GNU extensions that do not contradict it. For example,
1891 @option{-std=c90} turns off certain features of GCC that are
1892 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1893 keywords, but not other GNU extensions that do not have a meaning in
1894 ISO C90, such as omitting the middle term of a @code{?:}
1895 expression. On the other hand, when a GNU dialect of a standard is
1896 specified, all features supported by the compiler are enabled, even when
1897 those features change the meaning of the base standard. As a result, some
1898 strict-conforming programs may be rejected. The particular standard
1899 is used by @option{-Wpedantic} to identify which features are GNU
1900 extensions given that version of the standard. For example
1901 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1902 comments, while @option{-std=gnu99 -Wpedantic} does not.
1903
1904 A value for this option must be provided; possible values are
1905
1906 @table @samp
1907 @item c90
1908 @itemx c89
1909 @itemx iso9899:1990
1910 Support all ISO C90 programs (certain GNU extensions that conflict
1911 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1912
1913 @item iso9899:199409
1914 ISO C90 as modified in amendment 1.
1915
1916 @item c99
1917 @itemx c9x
1918 @itemx iso9899:1999
1919 @itemx iso9899:199x
1920 ISO C99. This standard is substantially completely supported, modulo
1921 bugs and floating-point issues
1922 (mainly but not entirely relating to optional C99 features from
1923 Annexes F and G). See
1924 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1925 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1926
1927 @item c11
1928 @itemx c1x
1929 @itemx iso9899:2011
1930 ISO C11, the 2011 revision of the ISO C standard. This standard is
1931 substantially completely supported, modulo bugs, floating-point issues
1932 (mainly but not entirely relating to optional C11 features from
1933 Annexes F and G) and the optional Annexes K (Bounds-checking
1934 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1935
1936 @item c17
1937 @itemx c18
1938 @itemx iso9899:2017
1939 @itemx iso9899:2018
1940 ISO C17, the 2017 revision of the ISO C standard
1941 (published in 2018). This standard is
1942 same as C11 except for corrections of defects (all of which are also
1943 applied with @option{-std=c11}) and a new value of
1944 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1945
1946 @item c2x
1947 The next version of the ISO C standard, still under development. The
1948 support for this version is experimental and incomplete.
1949
1950 @item gnu90
1951 @itemx gnu89
1952 GNU dialect of ISO C90 (including some C99 features).
1953
1954 @item gnu99
1955 @itemx gnu9x
1956 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1957
1958 @item gnu11
1959 @itemx gnu1x
1960 GNU dialect of ISO C11.
1961 The name @samp{gnu1x} is deprecated.
1962
1963 @item gnu17
1964 @itemx gnu18
1965 GNU dialect of ISO C17. This is the default for C code.
1966
1967 @item gnu2x
1968 The next version of the ISO C standard, still under development, plus
1969 GNU extensions. The support for this version is experimental and
1970 incomplete.
1971
1972 @item c++98
1973 @itemx c++03
1974 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1975 additional defect reports. Same as @option{-ansi} for C++ code.
1976
1977 @item gnu++98
1978 @itemx gnu++03
1979 GNU dialect of @option{-std=c++98}.
1980
1981 @item c++11
1982 @itemx c++0x
1983 The 2011 ISO C++ standard plus amendments.
1984 The name @samp{c++0x} is deprecated.
1985
1986 @item gnu++11
1987 @itemx gnu++0x
1988 GNU dialect of @option{-std=c++11}.
1989 The name @samp{gnu++0x} is deprecated.
1990
1991 @item c++14
1992 @itemx c++1y
1993 The 2014 ISO C++ standard plus amendments.
1994 The name @samp{c++1y} is deprecated.
1995
1996 @item gnu++14
1997 @itemx gnu++1y
1998 GNU dialect of @option{-std=c++14}.
1999 This is the default for C++ code.
2000 The name @samp{gnu++1y} is deprecated.
2001
2002 @item c++17
2003 @itemx c++1z
2004 The 2017 ISO C++ standard plus amendments.
2005 The name @samp{c++1z} is deprecated.
2006
2007 @item gnu++17
2008 @itemx gnu++1z
2009 GNU dialect of @option{-std=c++17}.
2010 The name @samp{gnu++1z} is deprecated.
2011
2012 @item c++2a
2013 The next revision of the ISO C++ standard, tentatively planned for
2014 2020. Support is highly experimental, and will almost certainly
2015 change in incompatible ways in future releases.
2016
2017 @item gnu++2a
2018 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2019 and will almost certainly change in incompatible ways in future
2020 releases.
2021 @end table
2022
2023 @item -fgnu89-inline
2024 @opindex fgnu89-inline
2025 The option @option{-fgnu89-inline} tells GCC to use the traditional
2026 GNU semantics for @code{inline} functions when in C99 mode.
2027 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2028 Using this option is roughly equivalent to adding the
2029 @code{gnu_inline} function attribute to all inline functions
2030 (@pxref{Function Attributes}).
2031
2032 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2033 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2034 specifies the default behavior).
2035 This option is not supported in @option{-std=c90} or
2036 @option{-std=gnu90} mode.
2037
2038 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2039 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2040 in effect for @code{inline} functions. @xref{Common Predefined
2041 Macros,,,cpp,The C Preprocessor}.
2042
2043 @item -fpermitted-flt-eval-methods=@var{style}
2044 @opindex fpermitted-flt-eval-methods
2045 @opindex fpermitted-flt-eval-methods=c11
2046 @opindex fpermitted-flt-eval-methods=ts-18661-3
2047 ISO/IEC TS 18661-3 defines new permissible values for
2048 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2049 a semantic type that is an interchange or extended format should be
2050 evaluated to the precision and range of that type. These new values are
2051 a superset of those permitted under C99/C11, which does not specify the
2052 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2053 conforming to C11 may not have been written expecting the possibility of
2054 the new values.
2055
2056 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2057 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2058 or the extended set of values specified in ISO/IEC TS 18661-3.
2059
2060 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2061
2062 The default when in a standards compliant mode (@option{-std=c11} or similar)
2063 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2064 dialect (@option{-std=gnu11} or similar) is
2065 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2066
2067 @item -aux-info @var{filename}
2068 @opindex aux-info
2069 Output to the given filename prototyped declarations for all functions
2070 declared and/or defined in a translation unit, including those in header
2071 files. This option is silently ignored in any language other than C@.
2072
2073 Besides declarations, the file indicates, in comments, the origin of
2074 each declaration (source file and line), whether the declaration was
2075 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2076 @samp{O} for old, respectively, in the first character after the line
2077 number and the colon), and whether it came from a declaration or a
2078 definition (@samp{C} or @samp{F}, respectively, in the following
2079 character). In the case of function definitions, a K&R-style list of
2080 arguments followed by their declarations is also provided, inside
2081 comments, after the declaration.
2082
2083 @item -fallow-parameterless-variadic-functions
2084 @opindex fallow-parameterless-variadic-functions
2085 Accept variadic functions without named parameters.
2086
2087 Although it is possible to define such a function, this is not very
2088 useful as it is not possible to read the arguments. This is only
2089 supported for C as this construct is allowed by C++.
2090
2091 @item -fno-asm
2092 @opindex fno-asm
2093 @opindex fasm
2094 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2095 keyword, so that code can use these words as identifiers. You can use
2096 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2097 instead. @option{-ansi} implies @option{-fno-asm}.
2098
2099 In C++, this switch only affects the @code{typeof} keyword, since
2100 @code{asm} and @code{inline} are standard keywords. You may want to
2101 use the @option{-fno-gnu-keywords} flag instead, which has the same
2102 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2103 switch only affects the @code{asm} and @code{typeof} keywords, since
2104 @code{inline} is a standard keyword in ISO C99.
2105
2106 @item -fno-builtin
2107 @itemx -fno-builtin-@var{function}
2108 @opindex fno-builtin
2109 @opindex fbuiltin
2110 @cindex built-in functions
2111 Don't recognize built-in functions that do not begin with
2112 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2113 functions provided by GCC}, for details of the functions affected,
2114 including those which are not built-in functions when @option{-ansi} or
2115 @option{-std} options for strict ISO C conformance are used because they
2116 do not have an ISO standard meaning.
2117
2118 GCC normally generates special code to handle certain built-in functions
2119 more efficiently; for instance, calls to @code{alloca} may become single
2120 instructions which adjust the stack directly, and calls to @code{memcpy}
2121 may become inline copy loops. The resulting code is often both smaller
2122 and faster, but since the function calls no longer appear as such, you
2123 cannot set a breakpoint on those calls, nor can you change the behavior
2124 of the functions by linking with a different library. In addition,
2125 when a function is recognized as a built-in function, GCC may use
2126 information about that function to warn about problems with calls to
2127 that function, or to generate more efficient code, even if the
2128 resulting code still contains calls to that function. For example,
2129 warnings are given with @option{-Wformat} for bad calls to
2130 @code{printf} when @code{printf} is built in and @code{strlen} is
2131 known not to modify global memory.
2132
2133 With the @option{-fno-builtin-@var{function}} option
2134 only the built-in function @var{function} is
2135 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2136 function is named that is not built-in in this version of GCC, this
2137 option is ignored. There is no corresponding
2138 @option{-fbuiltin-@var{function}} option; if you wish to enable
2139 built-in functions selectively when using @option{-fno-builtin} or
2140 @option{-ffreestanding}, you may define macros such as:
2141
2142 @smallexample
2143 #define abs(n) __builtin_abs ((n))
2144 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2145 @end smallexample
2146
2147 @item -fgimple
2148 @opindex fgimple
2149
2150 Enable parsing of function definitions marked with @code{__GIMPLE}.
2151 This is an experimental feature that allows unit testing of GIMPLE
2152 passes.
2153
2154 @item -fhosted
2155 @opindex fhosted
2156 @cindex hosted environment
2157
2158 Assert that compilation targets a hosted environment. This implies
2159 @option{-fbuiltin}. A hosted environment is one in which the
2160 entire standard library is available, and in which @code{main} has a return
2161 type of @code{int}. Examples are nearly everything except a kernel.
2162 This is equivalent to @option{-fno-freestanding}.
2163
2164 @item -ffreestanding
2165 @opindex ffreestanding
2166 @cindex hosted environment
2167
2168 Assert that compilation targets a freestanding environment. This
2169 implies @option{-fno-builtin}. A freestanding environment
2170 is one in which the standard library may not exist, and program startup may
2171 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2172 This is equivalent to @option{-fno-hosted}.
2173
2174 @xref{Standards,,Language Standards Supported by GCC}, for details of
2175 freestanding and hosted environments.
2176
2177 @item -fopenacc
2178 @opindex fopenacc
2179 @cindex OpenACC accelerator programming
2180 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2181 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2182 compiler generates accelerated code according to the OpenACC Application
2183 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2184 implies @option{-pthread}, and thus is only supported on targets that
2185 have support for @option{-pthread}.
2186
2187 @item -fopenacc-dim=@var{geom}
2188 @opindex fopenacc-dim
2189 @cindex OpenACC accelerator programming
2190 Specify default compute dimensions for parallel offload regions that do
2191 not explicitly specify. The @var{geom} value is a triple of
2192 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2193 can be omitted, to use a target-specific default value.
2194
2195 @item -fopenmp
2196 @opindex fopenmp
2197 @cindex OpenMP parallel
2198 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2199 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2200 compiler generates parallel code according to the OpenMP Application
2201 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2202 implies @option{-pthread}, and thus is only supported on targets that
2203 have support for @option{-pthread}. @option{-fopenmp} implies
2204 @option{-fopenmp-simd}.
2205
2206 @item -fopenmp-simd
2207 @opindex fopenmp-simd
2208 @cindex OpenMP SIMD
2209 @cindex SIMD
2210 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2211 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2212 are ignored.
2213
2214 @item -fgnu-tm
2215 @opindex fgnu-tm
2216 When the option @option{-fgnu-tm} is specified, the compiler
2217 generates code for the Linux variant of Intel's current Transactional
2218 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2219 an experimental feature whose interface may change in future versions
2220 of GCC, as the official specification changes. Please note that not
2221 all architectures are supported for this feature.
2222
2223 For more information on GCC's support for transactional memory,
2224 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2225 Transactional Memory Library}.
2226
2227 Note that the transactional memory feature is not supported with
2228 non-call exceptions (@option{-fnon-call-exceptions}).
2229
2230 @item -fms-extensions
2231 @opindex fms-extensions
2232 Accept some non-standard constructs used in Microsoft header files.
2233
2234 In C++ code, this allows member names in structures to be similar
2235 to previous types declarations.
2236
2237 @smallexample
2238 typedef int UOW;
2239 struct ABC @{
2240 UOW UOW;
2241 @};
2242 @end smallexample
2243
2244 Some cases of unnamed fields in structures and unions are only
2245 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2246 fields within structs/unions}, for details.
2247
2248 Note that this option is off for all targets except for x86
2249 targets using ms-abi.
2250
2251 @item -fplan9-extensions
2252 @opindex fplan9-extensions
2253 Accept some non-standard constructs used in Plan 9 code.
2254
2255 This enables @option{-fms-extensions}, permits passing pointers to
2256 structures with anonymous fields to functions that expect pointers to
2257 elements of the type of the field, and permits referring to anonymous
2258 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2259 struct/union fields within structs/unions}, for details. This is only
2260 supported for C, not C++.
2261
2262 @item -fcond-mismatch
2263 @opindex fcond-mismatch
2264 Allow conditional expressions with mismatched types in the second and
2265 third arguments. The value of such an expression is void. This option
2266 is not supported for C++.
2267
2268 @item -flax-vector-conversions
2269 @opindex flax-vector-conversions
2270 Allow implicit conversions between vectors with differing numbers of
2271 elements and/or incompatible element types. This option should not be
2272 used for new code.
2273
2274 @item -funsigned-char
2275 @opindex funsigned-char
2276 Let the type @code{char} be unsigned, like @code{unsigned char}.
2277
2278 Each kind of machine has a default for what @code{char} should
2279 be. It is either like @code{unsigned char} by default or like
2280 @code{signed char} by default.
2281
2282 Ideally, a portable program should always use @code{signed char} or
2283 @code{unsigned char} when it depends on the signedness of an object.
2284 But many programs have been written to use plain @code{char} and
2285 expect it to be signed, or expect it to be unsigned, depending on the
2286 machines they were written for. This option, and its inverse, let you
2287 make such a program work with the opposite default.
2288
2289 The type @code{char} is always a distinct type from each of
2290 @code{signed char} or @code{unsigned char}, even though its behavior
2291 is always just like one of those two.
2292
2293 @item -fsigned-char
2294 @opindex fsigned-char
2295 Let the type @code{char} be signed, like @code{signed char}.
2296
2297 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2298 the negative form of @option{-funsigned-char}. Likewise, the option
2299 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2300
2301 @item -fsigned-bitfields
2302 @itemx -funsigned-bitfields
2303 @itemx -fno-signed-bitfields
2304 @itemx -fno-unsigned-bitfields
2305 @opindex fsigned-bitfields
2306 @opindex funsigned-bitfields
2307 @opindex fno-signed-bitfields
2308 @opindex fno-unsigned-bitfields
2309 These options control whether a bit-field is signed or unsigned, when the
2310 declaration does not use either @code{signed} or @code{unsigned}. By
2311 default, such a bit-field is signed, because this is consistent: the
2312 basic integer types such as @code{int} are signed types.
2313
2314 @item -fsso-struct=@var{endianness}
2315 @opindex fsso-struct
2316 Set the default scalar storage order of structures and unions to the
2317 specified endianness. The accepted values are @samp{big-endian},
2318 @samp{little-endian} and @samp{native} for the native endianness of
2319 the target (the default). This option is not supported for C++.
2320
2321 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2322 code that is not binary compatible with code generated without it if the
2323 specified endianness is not the native endianness of the target.
2324 @end table
2325
2326 @node C++ Dialect Options
2327 @section Options Controlling C++ Dialect
2328
2329 @cindex compiler options, C++
2330 @cindex C++ options, command-line
2331 @cindex options, C++
2332 This section describes the command-line options that are only meaningful
2333 for C++ programs. You can also use most of the GNU compiler options
2334 regardless of what language your program is in. For example, you
2335 might compile a file @file{firstClass.C} like this:
2336
2337 @smallexample
2338 g++ -g -fstrict-enums -O -c firstClass.C
2339 @end smallexample
2340
2341 @noindent
2342 In this example, only @option{-fstrict-enums} is an option meant
2343 only for C++ programs; you can use the other options with any
2344 language supported by GCC@.
2345
2346 Some options for compiling C programs, such as @option{-std}, are also
2347 relevant for C++ programs.
2348 @xref{C Dialect Options,,Options Controlling C Dialect}.
2349
2350 Here is a list of options that are @emph{only} for compiling C++ programs:
2351
2352 @table @gcctabopt
2353
2354 @item -fabi-version=@var{n}
2355 @opindex fabi-version
2356 Use version @var{n} of the C++ ABI@. The default is version 0.
2357
2358 Version 0 refers to the version conforming most closely to
2359 the C++ ABI specification. Therefore, the ABI obtained using version 0
2360 will change in different versions of G++ as ABI bugs are fixed.
2361
2362 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2363
2364 Version 2 is the version of the C++ ABI that first appeared in G++
2365 3.4, and was the default through G++ 4.9.
2366
2367 Version 3 corrects an error in mangling a constant address as a
2368 template argument.
2369
2370 Version 4, which first appeared in G++ 4.5, implements a standard
2371 mangling for vector types.
2372
2373 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2374 attribute const/volatile on function pointer types, decltype of a
2375 plain decl, and use of a function parameter in the declaration of
2376 another parameter.
2377
2378 Version 6, which first appeared in G++ 4.7, corrects the promotion
2379 behavior of C++11 scoped enums and the mangling of template argument
2380 packs, const/static_cast, prefix ++ and --, and a class scope function
2381 used as a template argument.
2382
2383 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2384 builtin type and corrects the mangling of lambdas in default argument
2385 scope.
2386
2387 Version 8, which first appeared in G++ 4.9, corrects the substitution
2388 behavior of function types with function-cv-qualifiers.
2389
2390 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2391 @code{nullptr_t}.
2392
2393 Version 10, which first appeared in G++ 6.1, adds mangling of
2394 attributes that affect type identity, such as ia32 calling convention
2395 attributes (e.g.@: @samp{stdcall}).
2396
2397 Version 11, which first appeared in G++ 7, corrects the mangling of
2398 sizeof... expressions and operator names. For multiple entities with
2399 the same name within a function, that are declared in different scopes,
2400 the mangling now changes starting with the twelfth occurrence. It also
2401 implies @option{-fnew-inheriting-ctors}.
2402
2403 Version 12, which first appeared in G++ 8, corrects the calling
2404 conventions for empty classes on the x86_64 target and for classes
2405 with only deleted copy/move constructors. It accidentally changes the
2406 calling convention for classes with a deleted copy constructor and a
2407 trivial move constructor.
2408
2409 Version 13, which first appeared in G++ 8.2, fixes the accidental
2410 change in version 12.
2411
2412 See also @option{-Wabi}.
2413
2414 @item -fabi-compat-version=@var{n}
2415 @opindex fabi-compat-version
2416 On targets that support strong aliases, G++
2417 works around mangling changes by creating an alias with the correct
2418 mangled name when defining a symbol with an incorrect mangled name.
2419 This switch specifies which ABI version to use for the alias.
2420
2421 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2422 compatibility). If another ABI version is explicitly selected, this
2423 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2424 use @option{-fabi-compat-version=2}.
2425
2426 If this option is not provided but @option{-Wabi=@var{n}} is, that
2427 version is used for compatibility aliases. If this option is provided
2428 along with @option{-Wabi} (without the version), the version from this
2429 option is used for the warning.
2430
2431 @item -fno-access-control
2432 @opindex fno-access-control
2433 @opindex faccess-control
2434 Turn off all access checking. This switch is mainly useful for working
2435 around bugs in the access control code.
2436
2437 @item -faligned-new
2438 @opindex faligned-new
2439 Enable support for C++17 @code{new} of types that require more
2440 alignment than @code{void* ::operator new(std::size_t)} provides. A
2441 numeric argument such as @code{-faligned-new=32} can be used to
2442 specify how much alignment (in bytes) is provided by that function,
2443 but few users will need to override the default of
2444 @code{alignof(std::max_align_t)}.
2445
2446 This flag is enabled by default for @option{-std=c++17}.
2447
2448 @item -fchar8_t
2449 @itemx -fno-char8_t
2450 @opindex fchar8_t
2451 @opindex fno-char8_t
2452 Enable support for @code{char8_t} as adopted for C++2a. This includes
2453 the addition of a new @code{char8_t} fundamental type, changes to the
2454 types of UTF-8 string and character literals, new signatures for
2455 user-defined literals, associated standard library updates, and new
2456 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2457
2458 This option enables functions to be overloaded for ordinary and UTF-8
2459 strings:
2460
2461 @smallexample
2462 int f(const char *); // #1
2463 int f(const char8_t *); // #2
2464 int v1 = f("text"); // Calls #1
2465 int v2 = f(u8"text"); // Calls #2
2466 @end smallexample
2467
2468 @noindent
2469 and introduces new signatures for user-defined literals:
2470
2471 @smallexample
2472 int operator""_udl1(char8_t);
2473 int v3 = u8'x'_udl1;
2474 int operator""_udl2(const char8_t*, std::size_t);
2475 int v4 = u8"text"_udl2;
2476 template<typename T, T...> int operator""_udl3();
2477 int v5 = u8"text"_udl3;
2478 @end smallexample
2479
2480 @noindent
2481 The change to the types of UTF-8 string and character literals introduces
2482 incompatibilities with ISO C++11 and later standards. For example, the
2483 following code is well-formed under ISO C++11, but is ill-formed when
2484 @option{-fchar8_t} is specified.
2485
2486 @smallexample
2487 char ca[] = u8"xx"; // error: char-array initialized from wide
2488 // string
2489 const char *cp = u8"xx";// error: invalid conversion from
2490 // `const char8_t*' to `const char*'
2491 int f(const char*);
2492 auto v = f(u8"xx"); // error: invalid conversion from
2493 // `const char8_t*' to `const char*'
2494 std::string s@{u8"xx"@}; // error: no matching function for call to
2495 // `std::basic_string<char>::basic_string()'
2496 using namespace std::literals;
2497 s = u8"xx"s; // error: conversion from
2498 // `basic_string<char8_t>' to non-scalar
2499 // type `basic_string<char>' requested
2500 @end smallexample
2501
2502 @item -fcheck-new
2503 @opindex fcheck-new
2504 Check that the pointer returned by @code{operator new} is non-null
2505 before attempting to modify the storage allocated. This check is
2506 normally unnecessary because the C++ standard specifies that
2507 @code{operator new} only returns @code{0} if it is declared
2508 @code{throw()}, in which case the compiler always checks the
2509 return value even without this option. In all other cases, when
2510 @code{operator new} has a non-empty exception specification, memory
2511 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2512 @samp{new (nothrow)}.
2513
2514 @item -fconcepts
2515 @opindex fconcepts
2516 Enable support for the C++ Extensions for Concepts Technical
2517 Specification, ISO 19217 (2015), which allows code like
2518
2519 @smallexample
2520 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2521 template <Addable T> T add (T a, T b) @{ return a + b; @}
2522 @end smallexample
2523
2524 @item -fconstexpr-depth=@var{n}
2525 @opindex fconstexpr-depth
2526 Set the maximum nested evaluation depth for C++11 constexpr functions
2527 to @var{n}. A limit is needed to detect endless recursion during
2528 constant expression evaluation. The minimum specified by the standard
2529 is 512.
2530
2531 @item -fconstexpr-cache-depth=@var{n}
2532 @opindex fconstexpr-cache-depth
2533 Set the maximum level of nested evaluation depth for C++11 constexpr
2534 functions that will be cached to @var{n}. This is a heuristic that
2535 trades off compilation speed (when the cache avoids repeated
2536 calculations) against memory consumption (when the cache grows very
2537 large from highly recursive evaluations). The default is 8. Very few
2538 users are likely to want to adjust it, but if your code does heavy
2539 constexpr calculations you might want to experiment to find which
2540 value works best for you.
2541
2542 @item -fconstexpr-loop-limit=@var{n}
2543 @opindex fconstexpr-loop-limit
2544 Set the maximum number of iterations for a loop in C++14 constexpr functions
2545 to @var{n}. A limit is needed to detect infinite loops during
2546 constant expression evaluation. The default is 262144 (1<<18).
2547
2548 @item -fconstexpr-ops-limit=@var{n}
2549 @opindex fconstexpr-ops-limit
2550 Set the maximum number of operations during a single constexpr evaluation.
2551 Even when number of iterations of a single loop is limited with the above limit,
2552 if there are several nested loops and each of them has many iterations but still
2553 smaller than the above limit, or if in a body of some loop or even outside
2554 of a loop too many expressions need to be evaluated, the resulting constexpr
2555 evaluation might take too long.
2556 The default is 33554432 (1<<25).
2557
2558 @item -fdeduce-init-list
2559 @opindex fdeduce-init-list
2560 Enable deduction of a template type parameter as
2561 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2562
2563 @smallexample
2564 template <class T> auto forward(T t) -> decltype (realfn (t))
2565 @{
2566 return realfn (t);
2567 @}
2568
2569 void f()
2570 @{
2571 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2572 @}
2573 @end smallexample
2574
2575 This deduction was implemented as a possible extension to the
2576 originally proposed semantics for the C++11 standard, but was not part
2577 of the final standard, so it is disabled by default. This option is
2578 deprecated, and may be removed in a future version of G++.
2579
2580 @item -fno-elide-constructors
2581 @opindex fno-elide-constructors
2582 @opindex felide-constructors
2583 The C++ standard allows an implementation to omit creating a temporary
2584 that is only used to initialize another object of the same type.
2585 Specifying this option disables that optimization, and forces G++ to
2586 call the copy constructor in all cases. This option also causes G++
2587 to call trivial member functions which otherwise would be expanded inline.
2588
2589 In C++17, the compiler is required to omit these temporaries, but this
2590 option still affects trivial member functions.
2591
2592 @item -fno-enforce-eh-specs
2593 @opindex fno-enforce-eh-specs
2594 @opindex fenforce-eh-specs
2595 Don't generate code to check for violation of exception specifications
2596 at run time. This option violates the C++ standard, but may be useful
2597 for reducing code size in production builds, much like defining
2598 @code{NDEBUG}. This does not give user code permission to throw
2599 exceptions in violation of the exception specifications; the compiler
2600 still optimizes based on the specifications, so throwing an
2601 unexpected exception results in undefined behavior at run time.
2602
2603 @item -fextern-tls-init
2604 @itemx -fno-extern-tls-init
2605 @opindex fextern-tls-init
2606 @opindex fno-extern-tls-init
2607 The C++11 and OpenMP standards allow @code{thread_local} and
2608 @code{threadprivate} variables to have dynamic (runtime)
2609 initialization. To support this, any use of such a variable goes
2610 through a wrapper function that performs any necessary initialization.
2611 When the use and definition of the variable are in the same
2612 translation unit, this overhead can be optimized away, but when the
2613 use is in a different translation unit there is significant overhead
2614 even if the variable doesn't actually need dynamic initialization. If
2615 the programmer can be sure that no use of the variable in a
2616 non-defining TU needs to trigger dynamic initialization (either
2617 because the variable is statically initialized, or a use of the
2618 variable in the defining TU will be executed before any uses in
2619 another TU), they can avoid this overhead with the
2620 @option{-fno-extern-tls-init} option.
2621
2622 On targets that support symbol aliases, the default is
2623 @option{-fextern-tls-init}. On targets that do not support symbol
2624 aliases, the default is @option{-fno-extern-tls-init}.
2625
2626 @item -fno-gnu-keywords
2627 @opindex fno-gnu-keywords
2628 @opindex fgnu-keywords
2629 Do not recognize @code{typeof} as a keyword, so that code can use this
2630 word as an identifier. You can use the keyword @code{__typeof__} instead.
2631 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2632 @option{-std=c++98}, @option{-std=c++11}, etc.
2633
2634 @item -fno-implicit-templates
2635 @opindex fno-implicit-templates
2636 @opindex fimplicit-templates
2637 Never emit code for non-inline templates that are instantiated
2638 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2639 If you use this option, you must take care to structure your code to
2640 include all the necessary explicit instantiations to avoid getting
2641 undefined symbols at link time.
2642 @xref{Template Instantiation}, for more information.
2643
2644 @item -fno-implicit-inline-templates
2645 @opindex fno-implicit-inline-templates
2646 @opindex fimplicit-inline-templates
2647 Don't emit code for implicit instantiations of inline templates, either.
2648 The default is to handle inlines differently so that compiles with and
2649 without optimization need the same set of explicit instantiations.
2650
2651 @item -fno-implement-inlines
2652 @opindex fno-implement-inlines
2653 @opindex fimplement-inlines
2654 To save space, do not emit out-of-line copies of inline functions
2655 controlled by @code{#pragma implementation}. This causes linker
2656 errors if these functions are not inlined everywhere they are called.
2657
2658 @item -fms-extensions
2659 @opindex fms-extensions
2660 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2661 int and getting a pointer to member function via non-standard syntax.
2662
2663 @item -fnew-inheriting-ctors
2664 @opindex fnew-inheriting-ctors
2665 Enable the P0136 adjustment to the semantics of C++11 constructor
2666 inheritance. This is part of C++17 but also considered to be a Defect
2667 Report against C++11 and C++14. This flag is enabled by default
2668 unless @option{-fabi-version=10} or lower is specified.
2669
2670 @item -fnew-ttp-matching
2671 @opindex fnew-ttp-matching
2672 Enable the P0522 resolution to Core issue 150, template template
2673 parameters and default arguments: this allows a template with default
2674 template arguments as an argument for a template template parameter
2675 with fewer template parameters. This flag is enabled by default for
2676 @option{-std=c++17}.
2677
2678 @item -fno-nonansi-builtins
2679 @opindex fno-nonansi-builtins
2680 @opindex fnonansi-builtins
2681 Disable built-in declarations of functions that are not mandated by
2682 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2683 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2684
2685 @item -fnothrow-opt
2686 @opindex fnothrow-opt
2687 Treat a @code{throw()} exception specification as if it were a
2688 @code{noexcept} specification to reduce or eliminate the text size
2689 overhead relative to a function with no exception specification. If
2690 the function has local variables of types with non-trivial
2691 destructors, the exception specification actually makes the
2692 function smaller because the EH cleanups for those variables can be
2693 optimized away. The semantic effect is that an exception thrown out of
2694 a function with such an exception specification results in a call
2695 to @code{terminate} rather than @code{unexpected}.
2696
2697 @item -fno-operator-names
2698 @opindex fno-operator-names
2699 @opindex foperator-names
2700 Do not treat the operator name keywords @code{and}, @code{bitand},
2701 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2702 synonyms as keywords.
2703
2704 @item -fno-optional-diags
2705 @opindex fno-optional-diags
2706 @opindex foptional-diags
2707 Disable diagnostics that the standard says a compiler does not need to
2708 issue. Currently, the only such diagnostic issued by G++ is the one for
2709 a name having multiple meanings within a class.
2710
2711 @item -fpermissive
2712 @opindex fpermissive
2713 Downgrade some diagnostics about nonconformant code from errors to
2714 warnings. Thus, using @option{-fpermissive} allows some
2715 nonconforming code to compile.
2716
2717 @item -fno-pretty-templates
2718 @opindex fno-pretty-templates
2719 @opindex fpretty-templates
2720 When an error message refers to a specialization of a function
2721 template, the compiler normally prints the signature of the
2722 template followed by the template arguments and any typedefs or
2723 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2724 rather than @code{void f(int)}) so that it's clear which template is
2725 involved. When an error message refers to a specialization of a class
2726 template, the compiler omits any template arguments that match
2727 the default template arguments for that template. If either of these
2728 behaviors make it harder to understand the error message rather than
2729 easier, you can use @option{-fno-pretty-templates} to disable them.
2730
2731 @item -frepo
2732 @opindex frepo
2733 Enable automatic template instantiation at link time. This option also
2734 implies @option{-fno-implicit-templates}. @xref{Template
2735 Instantiation}, for more information.
2736
2737 @item -fno-rtti
2738 @opindex fno-rtti
2739 @opindex frtti
2740 Disable generation of information about every class with virtual
2741 functions for use by the C++ run-time type identification features
2742 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2743 of the language, you can save some space by using this flag. Note that
2744 exception handling uses the same information, but G++ generates it as
2745 needed. The @code{dynamic_cast} operator can still be used for casts that
2746 do not require run-time type information, i.e.@: casts to @code{void *} or to
2747 unambiguous base classes.
2748
2749 Mixing code compiled with @option{-frtti} with that compiled with
2750 @option{-fno-rtti} may not work. For example, programs may
2751 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2752 for a class compiled with @option{-frtti}.
2753
2754 @item -fsized-deallocation
2755 @opindex fsized-deallocation
2756 Enable the built-in global declarations
2757 @smallexample
2758 void operator delete (void *, std::size_t) noexcept;
2759 void operator delete[] (void *, std::size_t) noexcept;
2760 @end smallexample
2761 as introduced in C++14. This is useful for user-defined replacement
2762 deallocation functions that, for example, use the size of the object
2763 to make deallocation faster. Enabled by default under
2764 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2765 warns about places that might want to add a definition.
2766
2767 @item -fstrict-enums
2768 @opindex fstrict-enums
2769 Allow the compiler to optimize using the assumption that a value of
2770 enumerated type can only be one of the values of the enumeration (as
2771 defined in the C++ standard; basically, a value that can be
2772 represented in the minimum number of bits needed to represent all the
2773 enumerators). This assumption may not be valid if the program uses a
2774 cast to convert an arbitrary integer value to the enumerated type.
2775
2776 @item -fstrong-eval-order
2777 @opindex fstrong-eval-order
2778 Evaluate member access, array subscripting, and shift expressions in
2779 left-to-right order, and evaluate assignment in right-to-left order,
2780 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2781 @option{-fstrong-eval-order=some} enables just the ordering of member
2782 access and shift expressions, and is the default without
2783 @option{-std=c++17}.
2784
2785 @item -ftemplate-backtrace-limit=@var{n}
2786 @opindex ftemplate-backtrace-limit
2787 Set the maximum number of template instantiation notes for a single
2788 warning or error to @var{n}. The default value is 10.
2789
2790 @item -ftemplate-depth=@var{n}
2791 @opindex ftemplate-depth
2792 Set the maximum instantiation depth for template classes to @var{n}.
2793 A limit on the template instantiation depth is needed to detect
2794 endless recursions during template class instantiation. ANSI/ISO C++
2795 conforming programs must not rely on a maximum depth greater than 17
2796 (changed to 1024 in C++11). The default value is 900, as the compiler
2797 can run out of stack space before hitting 1024 in some situations.
2798
2799 @item -fno-threadsafe-statics
2800 @opindex fno-threadsafe-statics
2801 @opindex fthreadsafe-statics
2802 Do not emit the extra code to use the routines specified in the C++
2803 ABI for thread-safe initialization of local statics. You can use this
2804 option to reduce code size slightly in code that doesn't need to be
2805 thread-safe.
2806
2807 @item -fuse-cxa-atexit
2808 @opindex fuse-cxa-atexit
2809 Register destructors for objects with static storage duration with the
2810 @code{__cxa_atexit} function rather than the @code{atexit} function.
2811 This option is required for fully standards-compliant handling of static
2812 destructors, but only works if your C library supports
2813 @code{__cxa_atexit}.
2814
2815 @item -fno-use-cxa-get-exception-ptr
2816 @opindex fno-use-cxa-get-exception-ptr
2817 @opindex fuse-cxa-get-exception-ptr
2818 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2819 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2820 if the runtime routine is not available.
2821
2822 @item -fvisibility-inlines-hidden
2823 @opindex fvisibility-inlines-hidden
2824 This switch declares that the user does not attempt to compare
2825 pointers to inline functions or methods where the addresses of the two functions
2826 are taken in different shared objects.
2827
2828 The effect of this is that GCC may, effectively, mark inline methods with
2829 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2830 appear in the export table of a DSO and do not require a PLT indirection
2831 when used within the DSO@. Enabling this option can have a dramatic effect
2832 on load and link times of a DSO as it massively reduces the size of the
2833 dynamic export table when the library makes heavy use of templates.
2834
2835 The behavior of this switch is not quite the same as marking the
2836 methods as hidden directly, because it does not affect static variables
2837 local to the function or cause the compiler to deduce that
2838 the function is defined in only one shared object.
2839
2840 You may mark a method as having a visibility explicitly to negate the
2841 effect of the switch for that method. For example, if you do want to
2842 compare pointers to a particular inline method, you might mark it as
2843 having default visibility. Marking the enclosing class with explicit
2844 visibility has no effect.
2845
2846 Explicitly instantiated inline methods are unaffected by this option
2847 as their linkage might otherwise cross a shared library boundary.
2848 @xref{Template Instantiation}.
2849
2850 @item -fvisibility-ms-compat
2851 @opindex fvisibility-ms-compat
2852 This flag attempts to use visibility settings to make GCC's C++
2853 linkage model compatible with that of Microsoft Visual Studio.
2854
2855 The flag makes these changes to GCC's linkage model:
2856
2857 @enumerate
2858 @item
2859 It sets the default visibility to @code{hidden}, like
2860 @option{-fvisibility=hidden}.
2861
2862 @item
2863 Types, but not their members, are not hidden by default.
2864
2865 @item
2866 The One Definition Rule is relaxed for types without explicit
2867 visibility specifications that are defined in more than one
2868 shared object: those declarations are permitted if they are
2869 permitted when this option is not used.
2870 @end enumerate
2871
2872 In new code it is better to use @option{-fvisibility=hidden} and
2873 export those classes that are intended to be externally visible.
2874 Unfortunately it is possible for code to rely, perhaps accidentally,
2875 on the Visual Studio behavior.
2876
2877 Among the consequences of these changes are that static data members
2878 of the same type with the same name but defined in different shared
2879 objects are different, so changing one does not change the other;
2880 and that pointers to function members defined in different shared
2881 objects may not compare equal. When this flag is given, it is a
2882 violation of the ODR to define types with the same name differently.
2883
2884 @item -fno-weak
2885 @opindex fno-weak
2886 @opindex fweak
2887 Do not use weak symbol support, even if it is provided by the linker.
2888 By default, G++ uses weak symbols if they are available. This
2889 option exists only for testing, and should not be used by end-users;
2890 it results in inferior code and has no benefits. This option may
2891 be removed in a future release of G++.
2892
2893 @item -nostdinc++
2894 @opindex nostdinc++
2895 Do not search for header files in the standard directories specific to
2896 C++, but do still search the other standard directories. (This option
2897 is used when building the C++ library.)
2898 @end table
2899
2900 In addition, these optimization, warning, and code generation options
2901 have meanings only for C++ programs:
2902
2903 @table @gcctabopt
2904 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2905 @opindex Wabi
2906 @opindex Wno-abi
2907 Warn when G++ it generates code that is probably not compatible with
2908 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2909 ABI with each major release, normally @option{-Wabi} will warn only if
2910 there is a check added later in a release series for an ABI issue
2911 discovered since the initial release. @option{-Wabi} will warn about
2912 more things if an older ABI version is selected (with
2913 @option{-fabi-version=@var{n}}).
2914
2915 @option{-Wabi} can also be used with an explicit version number to
2916 warn about compatibility with a particular @option{-fabi-version}
2917 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2918 @option{-fabi-version=2}.
2919
2920 If an explicit version number is provided and
2921 @option{-fabi-compat-version} is not specified, the version number
2922 from this option is used for compatibility aliases. If no explicit
2923 version number is provided with this option, but
2924 @option{-fabi-compat-version} is specified, that version number is
2925 used for ABI warnings.
2926
2927 Although an effort has been made to warn about
2928 all such cases, there are probably some cases that are not warned about,
2929 even though G++ is generating incompatible code. There may also be
2930 cases where warnings are emitted even though the code that is generated
2931 is compatible.
2932
2933 You should rewrite your code to avoid these warnings if you are
2934 concerned about the fact that code generated by G++ may not be binary
2935 compatible with code generated by other compilers.
2936
2937 Known incompatibilities in @option{-fabi-version=2} (which was the
2938 default from GCC 3.4 to 4.9) include:
2939
2940 @itemize @bullet
2941
2942 @item
2943 A template with a non-type template parameter of reference type was
2944 mangled incorrectly:
2945 @smallexample
2946 extern int N;
2947 template <int &> struct S @{@};
2948 void n (S<N>) @{2@}
2949 @end smallexample
2950
2951 This was fixed in @option{-fabi-version=3}.
2952
2953 @item
2954 SIMD vector types declared using @code{__attribute ((vector_size))} were
2955 mangled in a non-standard way that does not allow for overloading of
2956 functions taking vectors of different sizes.
2957
2958 The mangling was changed in @option{-fabi-version=4}.
2959
2960 @item
2961 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2962 qualifiers, and @code{decltype} of a plain declaration was folded away.
2963
2964 These mangling issues were fixed in @option{-fabi-version=5}.
2965
2966 @item
2967 Scoped enumerators passed as arguments to a variadic function are
2968 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2969 On most targets this does not actually affect the parameter passing
2970 ABI, as there is no way to pass an argument smaller than @code{int}.
2971
2972 Also, the ABI changed the mangling of template argument packs,
2973 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2974 a class scope function used as a template argument.
2975
2976 These issues were corrected in @option{-fabi-version=6}.
2977
2978 @item
2979 Lambdas in default argument scope were mangled incorrectly, and the
2980 ABI changed the mangling of @code{nullptr_t}.
2981
2982 These issues were corrected in @option{-fabi-version=7}.
2983
2984 @item
2985 When mangling a function type with function-cv-qualifiers, the
2986 un-qualified function type was incorrectly treated as a substitution
2987 candidate.
2988
2989 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2990
2991 @item
2992 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2993 unaligned accesses. Note that this did not affect the ABI of a
2994 function with a @code{nullptr_t} parameter, as parameters have a
2995 minimum alignment.
2996
2997 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2998
2999 @item
3000 Target-specific attributes that affect the identity of a type, such as
3001 ia32 calling conventions on a function type (stdcall, regparm, etc.),
3002 did not affect the mangled name, leading to name collisions when
3003 function pointers were used as template arguments.
3004
3005 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3006
3007 @end itemize
3008
3009 It also warns about psABI-related changes. The known psABI changes at this
3010 point include:
3011
3012 @itemize @bullet
3013
3014 @item
3015 For SysV/x86-64, unions with @code{long double} members are
3016 passed in memory as specified in psABI. For example:
3017
3018 @smallexample
3019 union U @{
3020 long double ld;
3021 int i;
3022 @};
3023 @end smallexample
3024
3025 @noindent
3026 @code{union U} is always passed in memory.
3027
3028 @end itemize
3029
3030 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3031 @opindex Wabi-tag
3032 @opindex Wabi-tag
3033 Warn when a type with an ABI tag is used in a context that does not
3034 have that ABI tag. See @ref{C++ Attributes} for more information
3035 about ABI tags.
3036
3037 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3038 @opindex Wctor-dtor-privacy
3039 @opindex Wno-ctor-dtor-privacy
3040 Warn when a class seems unusable because all the constructors or
3041 destructors in that class are private, and it has neither friends nor
3042 public static member functions. Also warn if there are no non-private
3043 methods, and there's at least one private member function that isn't
3044 a constructor or destructor.
3045
3046 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3047 @opindex Wdelete-non-virtual-dtor
3048 @opindex Wno-delete-non-virtual-dtor
3049 Warn when @code{delete} is used to destroy an instance of a class that
3050 has virtual functions and non-virtual destructor. It is unsafe to delete
3051 an instance of a derived class through a pointer to a base class if the
3052 base class does not have a virtual destructor. This warning is enabled
3053 by @option{-Wall}.
3054
3055 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3056 @opindex Wdeprecated-copy
3057 @opindex Wno-deprecated-copy
3058 Warn that the implicit declaration of a copy constructor or copy
3059 assignment operator is deprecated if the class has a user-provided
3060 copy constructor or copy assignment operator, in C++11 and up. This
3061 warning is enabled by @option{-Wextra}. With
3062 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3063 user-provided destructor.
3064
3065 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3066 @opindex Winit-list-lifetime
3067 @opindex Wno-init-list-lifetime
3068 Do not warn about uses of @code{std::initializer_list} that are likely
3069 to result in dangling pointers. Since the underlying array for an
3070 @code{initializer_list} is handled like a normal C++ temporary object,
3071 it is easy to inadvertently keep a pointer to the array past the end
3072 of the array's lifetime. For example:
3073
3074 @itemize @bullet
3075 @item
3076 If a function returns a temporary @code{initializer_list}, or a local
3077 @code{initializer_list} variable, the array's lifetime ends at the end
3078 of the return statement, so the value returned has a dangling pointer.
3079
3080 @item
3081 If a new-expression creates an @code{initializer_list}, the array only
3082 lives until the end of the enclosing full-expression, so the
3083 @code{initializer_list} in the heap has a dangling pointer.
3084
3085 @item
3086 When an @code{initializer_list} variable is assigned from a
3087 brace-enclosed initializer list, the temporary array created for the
3088 right side of the assignment only lives until the end of the
3089 full-expression, so at the next statement the @code{initializer_list}
3090 variable has a dangling pointer.
3091
3092 @smallexample
3093 // li's initial underlying array lives as long as li
3094 std::initializer_list<int> li = @{ 1,2,3 @};
3095 // assignment changes li to point to a temporary array
3096 li = @{ 4, 5 @};
3097 // now the temporary is gone and li has a dangling pointer
3098 int i = li.begin()[0] // undefined behavior
3099 @end smallexample
3100
3101 @item
3102 When a list constructor stores the @code{begin} pointer from the
3103 @code{initializer_list} argument, this doesn't extend the lifetime of
3104 the array, so if a class variable is constructed from a temporary
3105 @code{initializer_list}, the pointer is left dangling by the end of
3106 the variable declaration statement.
3107
3108 @end itemize
3109
3110 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3111 @opindex Wliteral-suffix
3112 @opindex Wno-literal-suffix
3113 Warn when a string or character literal is followed by a ud-suffix which does
3114 not begin with an underscore. As a conforming extension, GCC treats such
3115 suffixes as separate preprocessing tokens in order to maintain backwards
3116 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3117 For example:
3118
3119 @smallexample
3120 #define __STDC_FORMAT_MACROS
3121 #include <inttypes.h>
3122 #include <stdio.h>
3123
3124 int main() @{
3125 int64_t i64 = 123;
3126 printf("My int64: %" PRId64"\n", i64);
3127 @}
3128 @end smallexample
3129
3130 In this case, @code{PRId64} is treated as a separate preprocessing token.
3131
3132 Additionally, warn when a user-defined literal operator is declared with
3133 a literal suffix identifier that doesn't begin with an underscore. Literal
3134 suffix identifiers that don't begin with an underscore are reserved for
3135 future standardization.
3136
3137 This warning is enabled by default.
3138
3139 @item -Wlto-type-mismatch
3140 @opindex Wlto-type-mismatch
3141 @opindex Wno-lto-type-mismatch
3142
3143 During the link-time optimization warn about type mismatches in
3144 global declarations from different compilation units.
3145 Requires @option{-flto} to be enabled. Enabled by default.
3146
3147 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3148 @opindex Wnarrowing
3149 @opindex Wno-narrowing
3150 For C++11 and later standards, narrowing conversions are diagnosed by default,
3151 as required by the standard. A narrowing conversion from a constant produces
3152 an error, and a narrowing conversion from a non-constant produces a warning,
3153 but @option{-Wno-narrowing} suppresses the diagnostic.
3154 Note that this does not affect the meaning of well-formed code;
3155 narrowing conversions are still considered ill-formed in SFINAE contexts.
3156
3157 With @option{-Wnarrowing} in C++98, warn when a narrowing
3158 conversion prohibited by C++11 occurs within
3159 @samp{@{ @}}, e.g.
3160
3161 @smallexample
3162 int i = @{ 2.2 @}; // error: narrowing from double to int
3163 @end smallexample
3164
3165 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3166
3167 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3168 @opindex Wnoexcept
3169 @opindex Wno-noexcept
3170 Warn when a noexcept-expression evaluates to false because of a call
3171 to a function that does not have a non-throwing exception
3172 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3173 the compiler to never throw an exception.
3174
3175 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3176 @opindex Wnoexcept-type
3177 @opindex Wno-noexcept-type
3178 Warn if the C++17 feature making @code{noexcept} part of a function
3179 type changes the mangled name of a symbol relative to C++14. Enabled
3180 by @option{-Wabi} and @option{-Wc++17-compat}.
3181
3182 As an example:
3183
3184 @smallexample
3185 template <class T> void f(T t) @{ t(); @};
3186 void g() noexcept;
3187 void h() @{ f(g); @}
3188 @end smallexample
3189
3190 @noindent
3191 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3192 C++17 it calls @code{f<void(*)()noexcept>}.
3193
3194 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3195 @opindex Wclass-memaccess
3196 @opindex Wno-class-memaccess
3197 Warn when the destination of a call to a raw memory function such as
3198 @code{memset} or @code{memcpy} is an object of class type, and when writing
3199 into such an object might bypass the class non-trivial or deleted constructor
3200 or copy assignment, violate const-correctness or encapsulation, or corrupt
3201 virtual table pointers. Modifying the representation of such objects may
3202 violate invariants maintained by member functions of the class. For example,
3203 the call to @code{memset} below is undefined because it modifies a non-trivial
3204 class object and is, therefore, diagnosed. The safe way to either initialize
3205 or clear the storage of objects of such types is by using the appropriate
3206 constructor or assignment operator, if one is available.
3207 @smallexample
3208 std::string str = "abc";
3209 memset (&str, 0, sizeof str);
3210 @end smallexample
3211 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3212 Explicitly casting the pointer to the class object to @code{void *} or
3213 to a type that can be safely accessed by the raw memory function suppresses
3214 the warning.
3215
3216 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3217 @opindex Wnon-virtual-dtor
3218 @opindex Wno-non-virtual-dtor
3219 Warn when a class has virtual functions and an accessible non-virtual
3220 destructor itself or in an accessible polymorphic base class, in which
3221 case it is possible but unsafe to delete an instance of a derived
3222 class through a pointer to the class itself or base class. This
3223 warning is automatically enabled if @option{-Weffc++} is specified.
3224
3225 @item -Wregister @r{(C++ and Objective-C++ only)}
3226 @opindex Wregister
3227 @opindex Wno-register
3228 Warn on uses of the @code{register} storage class specifier, except
3229 when it is part of the GNU @ref{Explicit Register Variables} extension.
3230 The use of the @code{register} keyword as storage class specifier has
3231 been deprecated in C++11 and removed in C++17.
3232 Enabled by default with @option{-std=c++17}.
3233
3234 @item -Wreorder @r{(C++ and Objective-C++ only)}
3235 @opindex Wreorder
3236 @opindex Wno-reorder
3237 @cindex reordering, warning
3238 @cindex warning for reordering of member initializers
3239 Warn when the order of member initializers given in the code does not
3240 match the order in which they must be executed. For instance:
3241
3242 @smallexample
3243 struct A @{
3244 int i;
3245 int j;
3246 A(): j (0), i (1) @{ @}
3247 @};
3248 @end smallexample
3249
3250 @noindent
3251 The compiler rearranges the member initializers for @code{i}
3252 and @code{j} to match the declaration order of the members, emitting
3253 a warning to that effect. This warning is enabled by @option{-Wall}.
3254
3255 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3256 @opindex Wpessimizing-move
3257 @opindex Wno-pessimizing-move
3258 This warning warns when a call to @code{std::move} prevents copy
3259 elision. A typical scenario when copy elision can occur is when returning in
3260 a function with a class return type, when the expression being returned is the
3261 name of a non-volatile automatic object, and is not a function parameter, and
3262 has the same type as the function return type.
3263
3264 @smallexample
3265 struct T @{
3266 @dots{}
3267 @};
3268 T fn()
3269 @{
3270 T t;
3271 @dots{}
3272 return std::move (t);
3273 @}
3274 @end smallexample
3275
3276 But in this example, the @code{std::move} call prevents copy elision.
3277
3278 This warning is enabled by @option{-Wall}.
3279
3280 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3281 @opindex Wredundant-move
3282 @opindex Wno-redundant-move
3283 This warning warns about redundant calls to @code{std::move}; that is, when
3284 a move operation would have been performed even without the @code{std::move}
3285 call. This happens because the compiler is forced to treat the object as if
3286 it were an rvalue in certain situations such as returning a local variable,
3287 where copy elision isn't applicable. Consider:
3288
3289 @smallexample
3290 struct T @{
3291 @dots{}
3292 @};
3293 T fn(T t)
3294 @{
3295 @dots{}
3296 return std::move (t);
3297 @}
3298 @end smallexample
3299
3300 Here, the @code{std::move} call is redundant. Because G++ implements Core
3301 Issue 1579, another example is:
3302
3303 @smallexample
3304 struct T @{ // convertible to U
3305 @dots{}
3306 @};
3307 struct U @{
3308 @dots{}
3309 @};
3310 U fn()
3311 @{
3312 T t;
3313 @dots{}
3314 return std::move (t);
3315 @}
3316 @end smallexample
3317 In this example, copy elision isn't applicable because the type of the
3318 expression being returned and the function return type differ, yet G++
3319 treats the return value as if it were designated by an rvalue.
3320
3321 This warning is enabled by @option{-Wextra}.
3322
3323 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3324 @opindex fext-numeric-literals
3325 @opindex fno-ext-numeric-literals
3326 Accept imaginary, fixed-point, or machine-defined
3327 literal number suffixes as GNU extensions.
3328 When this option is turned off these suffixes are treated
3329 as C++11 user-defined literal numeric suffixes.
3330 This is on by default for all pre-C++11 dialects and all GNU dialects:
3331 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3332 @option{-std=gnu++14}.
3333 This option is off by default
3334 for ISO C++11 onwards (@option{-std=c++11}, ...).
3335 @end table
3336
3337 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3338
3339 @table @gcctabopt
3340 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3341 @opindex Weffc++
3342 @opindex Wno-effc++
3343 Warn about violations of the following style guidelines from Scott Meyers'
3344 @cite{Effective C++} series of books:
3345
3346 @itemize @bullet
3347 @item
3348 Define a copy constructor and an assignment operator for classes
3349 with dynamically-allocated memory.
3350
3351 @item
3352 Prefer initialization to assignment in constructors.
3353
3354 @item
3355 Have @code{operator=} return a reference to @code{*this}.
3356
3357 @item
3358 Don't try to return a reference when you must return an object.
3359
3360 @item
3361 Distinguish between prefix and postfix forms of increment and
3362 decrement operators.
3363
3364 @item
3365 Never overload @code{&&}, @code{||}, or @code{,}.
3366
3367 @end itemize
3368
3369 This option also enables @option{-Wnon-virtual-dtor}, which is also
3370 one of the effective C++ recommendations. However, the check is
3371 extended to warn about the lack of virtual destructor in accessible
3372 non-polymorphic bases classes too.
3373
3374 When selecting this option, be aware that the standard library
3375 headers do not obey all of these guidelines; use @samp{grep -v}
3376 to filter out those warnings.
3377
3378 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3379 @opindex Wstrict-null-sentinel
3380 @opindex Wno-strict-null-sentinel
3381 Warn about the use of an uncasted @code{NULL} as sentinel. When
3382 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3383 to @code{__null}. Although it is a null pointer constant rather than a
3384 null pointer, it is guaranteed to be of the same size as a pointer.
3385 But this use is not portable across different compilers.
3386
3387 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3388 @opindex Wno-non-template-friend
3389 @opindex Wnon-template-friend
3390 Disable warnings when non-template friend functions are declared
3391 within a template. In very old versions of GCC that predate implementation
3392 of the ISO standard, declarations such as
3393 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3394 could be interpreted as a particular specialization of a template
3395 function; the warning exists to diagnose compatibility problems,
3396 and is enabled by default.
3397
3398 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3399 @opindex Wold-style-cast
3400 @opindex Wno-old-style-cast
3401 Warn if an old-style (C-style) cast to a non-void type is used within
3402 a C++ program. The new-style casts (@code{dynamic_cast},
3403 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3404 less vulnerable to unintended effects and much easier to search for.
3405
3406 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3407 @opindex Woverloaded-virtual
3408 @opindex Wno-overloaded-virtual
3409 @cindex overloaded virtual function, warning
3410 @cindex warning for overloaded virtual function
3411 Warn when a function declaration hides virtual functions from a
3412 base class. For example, in:
3413
3414 @smallexample
3415 struct A @{
3416 virtual void f();
3417 @};
3418
3419 struct B: public A @{
3420 void f(int);
3421 @};
3422 @end smallexample
3423
3424 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3425 like:
3426
3427 @smallexample
3428 B* b;
3429 b->f();
3430 @end smallexample
3431
3432 @noindent
3433 fails to compile.
3434
3435 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3436 @opindex Wno-pmf-conversions
3437 @opindex Wpmf-conversions
3438 Disable the diagnostic for converting a bound pointer to member function
3439 to a plain pointer.
3440
3441 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3442 @opindex Wsign-promo
3443 @opindex Wno-sign-promo
3444 Warn when overload resolution chooses a promotion from unsigned or
3445 enumerated type to a signed type, over a conversion to an unsigned type of
3446 the same size. Previous versions of G++ tried to preserve
3447 unsignedness, but the standard mandates the current behavior.
3448
3449 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3450 @opindex Wtemplates
3451 @opindex Wno-templates
3452 Warn when a primary template declaration is encountered. Some coding
3453 rules disallow templates, and this may be used to enforce that rule.
3454 The warning is inactive inside a system header file, such as the STL, so
3455 one can still use the STL. One may also instantiate or specialize
3456 templates.
3457
3458 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3459 @opindex Wmultiple-inheritance
3460 @opindex Wno-multiple-inheritance
3461 Warn when a class is defined with multiple direct base classes. Some
3462 coding rules disallow multiple inheritance, and this may be used to
3463 enforce that rule. The warning is inactive inside a system header file,
3464 such as the STL, so one can still use the STL. One may also define
3465 classes that indirectly use multiple inheritance.
3466
3467 @item -Wvirtual-inheritance
3468 @opindex Wvirtual-inheritance
3469 @opindex Wno-virtual-inheritance
3470 Warn when a class is defined with a virtual direct base class. Some
3471 coding rules disallow multiple inheritance, and this may be used to
3472 enforce that rule. The warning is inactive inside a system header file,
3473 such as the STL, so one can still use the STL. One may also define
3474 classes that indirectly use virtual inheritance.
3475
3476 @item -Wnamespaces
3477 @opindex Wnamespaces
3478 @opindex Wno-namespaces
3479 Warn when a namespace definition is opened. Some coding rules disallow
3480 namespaces, and this may be used to enforce that rule. The warning is
3481 inactive inside a system header file, such as the STL, so one can still
3482 use the STL. One may also use using directives and qualified names.
3483
3484 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3485 @opindex Wterminate
3486 @opindex Wno-terminate
3487 Disable the warning about a throw-expression that will immediately
3488 result in a call to @code{terminate}.
3489
3490 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3491 @opindex Wno-class-conversion
3492 @opindex Wclass-conversion
3493 Disable the warning about the case when a conversion function converts an
3494 object to the same type, to a base class of that type, or to void; such
3495 a conversion function will never be called.
3496 @end table
3497
3498 @node Objective-C and Objective-C++ Dialect Options
3499 @section Options Controlling Objective-C and Objective-C++ Dialects
3500
3501 @cindex compiler options, Objective-C and Objective-C++
3502 @cindex Objective-C and Objective-C++ options, command-line
3503 @cindex options, Objective-C and Objective-C++
3504 (NOTE: This manual does not describe the Objective-C and Objective-C++
3505 languages themselves. @xref{Standards,,Language Standards
3506 Supported by GCC}, for references.)
3507
3508 This section describes the command-line options that are only meaningful
3509 for Objective-C and Objective-C++ programs. You can also use most of
3510 the language-independent GNU compiler options.
3511 For example, you might compile a file @file{some_class.m} like this:
3512
3513 @smallexample
3514 gcc -g -fgnu-runtime -O -c some_class.m
3515 @end smallexample
3516
3517 @noindent
3518 In this example, @option{-fgnu-runtime} is an option meant only for
3519 Objective-C and Objective-C++ programs; you can use the other options with
3520 any language supported by GCC@.
3521
3522 Note that since Objective-C is an extension of the C language, Objective-C
3523 compilations may also use options specific to the C front-end (e.g.,
3524 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3525 C++-specific options (e.g., @option{-Wabi}).
3526
3527 Here is a list of options that are @emph{only} for compiling Objective-C
3528 and Objective-C++ programs:
3529
3530 @table @gcctabopt
3531 @item -fconstant-string-class=@var{class-name}
3532 @opindex fconstant-string-class
3533 Use @var{class-name} as the name of the class to instantiate for each
3534 literal string specified with the syntax @code{@@"@dots{}"}. The default
3535 class name is @code{NXConstantString} if the GNU runtime is being used, and
3536 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3537 @option{-fconstant-cfstrings} option, if also present, overrides the
3538 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3539 to be laid out as constant CoreFoundation strings.
3540
3541 @item -fgnu-runtime
3542 @opindex fgnu-runtime
3543 Generate object code compatible with the standard GNU Objective-C
3544 runtime. This is the default for most types of systems.
3545
3546 @item -fnext-runtime
3547 @opindex fnext-runtime
3548 Generate output compatible with the NeXT runtime. This is the default
3549 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3550 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3551 used.
3552
3553 @item -fno-nil-receivers
3554 @opindex fno-nil-receivers
3555 @opindex fnil-receivers
3556 Assume that all Objective-C message dispatches (@code{[receiver
3557 message:arg]}) in this translation unit ensure that the receiver is
3558 not @code{nil}. This allows for more efficient entry points in the
3559 runtime to be used. This option is only available in conjunction with
3560 the NeXT runtime and ABI version 0 or 1.
3561
3562 @item -fobjc-abi-version=@var{n}
3563 @opindex fobjc-abi-version
3564 Use version @var{n} of the Objective-C ABI for the selected runtime.
3565 This option is currently supported only for the NeXT runtime. In that
3566 case, Version 0 is the traditional (32-bit) ABI without support for
3567 properties and other Objective-C 2.0 additions. Version 1 is the
3568 traditional (32-bit) ABI with support for properties and other
3569 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3570 nothing is specified, the default is Version 0 on 32-bit target
3571 machines, and Version 2 on 64-bit target machines.
3572
3573 @item -fobjc-call-cxx-cdtors
3574 @opindex fobjc-call-cxx-cdtors
3575 For each Objective-C class, check if any of its instance variables is a
3576 C++ object with a non-trivial default constructor. If so, synthesize a
3577 special @code{- (id) .cxx_construct} instance method which runs
3578 non-trivial default constructors on any such instance variables, in order,
3579 and then return @code{self}. Similarly, check if any instance variable
3580 is a C++ object with a non-trivial destructor, and if so, synthesize a
3581 special @code{- (void) .cxx_destruct} method which runs
3582 all such default destructors, in reverse order.
3583
3584 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3585 methods thusly generated only operate on instance variables
3586 declared in the current Objective-C class, and not those inherited
3587 from superclasses. It is the responsibility of the Objective-C
3588 runtime to invoke all such methods in an object's inheritance
3589 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3590 by the runtime immediately after a new object instance is allocated;
3591 the @code{- (void) .cxx_destruct} methods are invoked immediately
3592 before the runtime deallocates an object instance.
3593
3594 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3595 support for invoking the @code{- (id) .cxx_construct} and
3596 @code{- (void) .cxx_destruct} methods.
3597
3598 @item -fobjc-direct-dispatch
3599 @opindex fobjc-direct-dispatch
3600 Allow fast jumps to the message dispatcher. On Darwin this is
3601 accomplished via the comm page.
3602
3603 @item -fobjc-exceptions
3604 @opindex fobjc-exceptions
3605 Enable syntactic support for structured exception handling in
3606 Objective-C, similar to what is offered by C++. This option
3607 is required to use the Objective-C keywords @code{@@try},
3608 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3609 @code{@@synchronized}. This option is available with both the GNU
3610 runtime and the NeXT runtime (but not available in conjunction with
3611 the NeXT runtime on Mac OS X 10.2 and earlier).
3612
3613 @item -fobjc-gc
3614 @opindex fobjc-gc
3615 Enable garbage collection (GC) in Objective-C and Objective-C++
3616 programs. This option is only available with the NeXT runtime; the
3617 GNU runtime has a different garbage collection implementation that
3618 does not require special compiler flags.
3619
3620 @item -fobjc-nilcheck
3621 @opindex fobjc-nilcheck
3622 For the NeXT runtime with version 2 of the ABI, check for a nil
3623 receiver in method invocations before doing the actual method call.
3624 This is the default and can be disabled using
3625 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3626 checked for nil in this way no matter what this flag is set to.
3627 Currently this flag does nothing when the GNU runtime, or an older
3628 version of the NeXT runtime ABI, is used.
3629
3630 @item -fobjc-std=objc1
3631 @opindex fobjc-std
3632 Conform to the language syntax of Objective-C 1.0, the language
3633 recognized by GCC 4.0. This only affects the Objective-C additions to
3634 the C/C++ language; it does not affect conformance to C/C++ standards,
3635 which is controlled by the separate C/C++ dialect option flags. When
3636 this option is used with the Objective-C or Objective-C++ compiler,
3637 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3638 This is useful if you need to make sure that your Objective-C code can
3639 be compiled with older versions of GCC@.
3640
3641 @item -freplace-objc-classes
3642 @opindex freplace-objc-classes
3643 Emit a special marker instructing @command{ld(1)} not to statically link in
3644 the resulting object file, and allow @command{dyld(1)} to load it in at
3645 run time instead. This is used in conjunction with the Fix-and-Continue
3646 debugging mode, where the object file in question may be recompiled and
3647 dynamically reloaded in the course of program execution, without the need
3648 to restart the program itself. Currently, Fix-and-Continue functionality
3649 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3650 and later.
3651
3652 @item -fzero-link
3653 @opindex fzero-link
3654 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3655 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3656 compile time) with static class references that get initialized at load time,
3657 which improves run-time performance. Specifying the @option{-fzero-link} flag
3658 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3659 to be retained. This is useful in Zero-Link debugging mode, since it allows
3660 for individual class implementations to be modified during program execution.
3661 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3662 regardless of command-line options.
3663
3664 @item -fno-local-ivars
3665 @opindex fno-local-ivars
3666 @opindex flocal-ivars
3667 By default instance variables in Objective-C can be accessed as if
3668 they were local variables from within the methods of the class they're
3669 declared in. This can lead to shadowing between instance variables
3670 and other variables declared either locally inside a class method or
3671 globally with the same name. Specifying the @option{-fno-local-ivars}
3672 flag disables this behavior thus avoiding variable shadowing issues.
3673
3674 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3675 @opindex fivar-visibility
3676 Set the default instance variable visibility to the specified option
3677 so that instance variables declared outside the scope of any access
3678 modifier directives default to the specified visibility.
3679
3680 @item -gen-decls
3681 @opindex gen-decls
3682 Dump interface declarations for all classes seen in the source file to a
3683 file named @file{@var{sourcename}.decl}.
3684
3685 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3686 @opindex Wassign-intercept
3687 @opindex Wno-assign-intercept
3688 Warn whenever an Objective-C assignment is being intercepted by the
3689 garbage collector.
3690
3691 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3692 @opindex Wno-protocol
3693 @opindex Wprotocol
3694 If a class is declared to implement a protocol, a warning is issued for
3695 every method in the protocol that is not implemented by the class. The
3696 default behavior is to issue a warning for every method not explicitly
3697 implemented in the class, even if a method implementation is inherited
3698 from the superclass. If you use the @option{-Wno-protocol} option, then
3699 methods inherited from the superclass are considered to be implemented,
3700 and no warning is issued for them.
3701
3702 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3703 @opindex Wselector
3704 @opindex Wno-selector
3705 Warn if multiple methods of different types for the same selector are
3706 found during compilation. The check is performed on the list of methods
3707 in the final stage of compilation. Additionally, a check is performed
3708 for each selector appearing in a @code{@@selector(@dots{})}
3709 expression, and a corresponding method for that selector has been found
3710 during compilation. Because these checks scan the method table only at
3711 the end of compilation, these warnings are not produced if the final
3712 stage of compilation is not reached, for example because an error is
3713 found during compilation, or because the @option{-fsyntax-only} option is
3714 being used.
3715
3716 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3717 @opindex Wstrict-selector-match
3718 @opindex Wno-strict-selector-match
3719 Warn if multiple methods with differing argument and/or return types are
3720 found for a given selector when attempting to send a message using this
3721 selector to a receiver of type @code{id} or @code{Class}. When this flag
3722 is off (which is the default behavior), the compiler omits such warnings
3723 if any differences found are confined to types that share the same size
3724 and alignment.
3725
3726 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3727 @opindex Wundeclared-selector
3728 @opindex Wno-undeclared-selector
3729 Warn if a @code{@@selector(@dots{})} expression referring to an
3730 undeclared selector is found. A selector is considered undeclared if no
3731 method with that name has been declared before the
3732 @code{@@selector(@dots{})} expression, either explicitly in an
3733 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3734 an @code{@@implementation} section. This option always performs its
3735 checks as soon as a @code{@@selector(@dots{})} expression is found,
3736 while @option{-Wselector} only performs its checks in the final stage of
3737 compilation. This also enforces the coding style convention
3738 that methods and selectors must be declared before being used.
3739
3740 @item -print-objc-runtime-info
3741 @opindex print-objc-runtime-info
3742 Generate C header describing the largest structure that is passed by
3743 value, if any.
3744
3745 @end table
3746
3747 @node Diagnostic Message Formatting Options
3748 @section Options to Control Diagnostic Messages Formatting
3749 @cindex options to control diagnostics formatting
3750 @cindex diagnostic messages
3751 @cindex message formatting
3752
3753 Traditionally, diagnostic messages have been formatted irrespective of
3754 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3755 options described below
3756 to control the formatting algorithm for diagnostic messages,
3757 e.g.@: how many characters per line, how often source location
3758 information should be reported. Note that some language front ends may not
3759 honor these options.
3760
3761 @table @gcctabopt
3762 @item -fmessage-length=@var{n}
3763 @opindex fmessage-length
3764 Try to format error messages so that they fit on lines of about
3765 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3766 done; each error message appears on a single line. This is the
3767 default for all front ends.
3768
3769 Note - this option also affects the display of the @samp{#error} and
3770 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3771 function/type/variable attribute. It does not however affect the
3772 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3773
3774 @item -fdiagnostics-show-location=once
3775 @opindex fdiagnostics-show-location
3776 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3777 reporter to emit source location information @emph{once}; that is, in
3778 case the message is too long to fit on a single physical line and has to
3779 be wrapped, the source location won't be emitted (as prefix) again,
3780 over and over, in subsequent continuation lines. This is the default
3781 behavior.
3782
3783 @item -fdiagnostics-show-location=every-line
3784 Only meaningful in line-wrapping mode. Instructs the diagnostic
3785 messages reporter to emit the same source location information (as
3786 prefix) for physical lines that result from the process of breaking
3787 a message which is too long to fit on a single line.
3788
3789 @item -fdiagnostics-color[=@var{WHEN}]
3790 @itemx -fno-diagnostics-color
3791 @opindex fdiagnostics-color
3792 @cindex highlight, color
3793 @vindex GCC_COLORS @r{environment variable}
3794 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3795 or @samp{auto}. The default depends on how the compiler has been configured,
3796 it can be any of the above @var{WHEN} options or also @samp{never}
3797 if @env{GCC_COLORS} environment variable isn't present in the environment,
3798 and @samp{auto} otherwise.
3799 @samp{auto} means to use color only when the standard error is a terminal.
3800 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3801 aliases for @option{-fdiagnostics-color=always} and
3802 @option{-fdiagnostics-color=never}, respectively.
3803
3804 The colors are defined by the environment variable @env{GCC_COLORS}.
3805 Its value is a colon-separated list of capabilities and Select Graphic
3806 Rendition (SGR) substrings. SGR commands are interpreted by the
3807 terminal or terminal emulator. (See the section in the documentation
3808 of your text terminal for permitted values and their meanings as
3809 character attributes.) These substring values are integers in decimal
3810 representation and can be concatenated with semicolons.
3811 Common values to concatenate include
3812 @samp{1} for bold,
3813 @samp{4} for underline,
3814 @samp{5} for blink,
3815 @samp{7} for inverse,
3816 @samp{39} for default foreground color,
3817 @samp{30} to @samp{37} for foreground colors,
3818 @samp{90} to @samp{97} for 16-color mode foreground colors,
3819 @samp{38;5;0} to @samp{38;5;255}
3820 for 88-color and 256-color modes foreground colors,
3821 @samp{49} for default background color,
3822 @samp{40} to @samp{47} for background colors,
3823 @samp{100} to @samp{107} for 16-color mode background colors,
3824 and @samp{48;5;0} to @samp{48;5;255}
3825 for 88-color and 256-color modes background colors.
3826
3827 The default @env{GCC_COLORS} is
3828 @smallexample
3829 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3830 quote=01:fixit-insert=32:fixit-delete=31:\
3831 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3832 type-diff=01;32
3833 @end smallexample
3834 @noindent
3835 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3836 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3837 @samp{01} is bold, and @samp{31} is red.
3838 Setting @env{GCC_COLORS} to the empty string disables colors.
3839 Supported capabilities are as follows.
3840
3841 @table @code
3842 @item error=
3843 @vindex error GCC_COLORS @r{capability}
3844 SGR substring for error: markers.
3845
3846 @item warning=
3847 @vindex warning GCC_COLORS @r{capability}
3848 SGR substring for warning: markers.
3849
3850 @item note=
3851 @vindex note GCC_COLORS @r{capability}
3852 SGR substring for note: markers.
3853
3854 @item range1=
3855 @vindex range1 GCC_COLORS @r{capability}
3856 SGR substring for first additional range.
3857
3858 @item range2=
3859 @vindex range2 GCC_COLORS @r{capability}
3860 SGR substring for second additional range.
3861
3862 @item locus=
3863 @vindex locus GCC_COLORS @r{capability}
3864 SGR substring for location information, @samp{file:line} or
3865 @samp{file:line:column} etc.
3866
3867 @item quote=
3868 @vindex quote GCC_COLORS @r{capability}
3869 SGR substring for information printed within quotes.
3870
3871 @item fixit-insert=
3872 @vindex fixit-insert GCC_COLORS @r{capability}
3873 SGR substring for fix-it hints suggesting text to
3874 be inserted or replaced.
3875
3876 @item fixit-delete=
3877 @vindex fixit-delete GCC_COLORS @r{capability}
3878 SGR substring for fix-it hints suggesting text to
3879 be deleted.
3880
3881 @item diff-filename=
3882 @vindex diff-filename GCC_COLORS @r{capability}
3883 SGR substring for filename headers within generated patches.
3884
3885 @item diff-hunk=
3886 @vindex diff-hunk GCC_COLORS @r{capability}
3887 SGR substring for the starts of hunks within generated patches.
3888
3889 @item diff-delete=
3890 @vindex diff-delete GCC_COLORS @r{capability}
3891 SGR substring for deleted lines within generated patches.
3892
3893 @item diff-insert=
3894 @vindex diff-insert GCC_COLORS @r{capability}
3895 SGR substring for inserted lines within generated patches.
3896
3897 @item type-diff=
3898 @vindex type-diff GCC_COLORS @r{capability}
3899 SGR substring for highlighting mismatching types within template
3900 arguments in the C++ frontend.
3901 @end table
3902
3903 @item -fno-diagnostics-show-option
3904 @opindex fno-diagnostics-show-option
3905 @opindex fdiagnostics-show-option
3906 By default, each diagnostic emitted includes text indicating the
3907 command-line option that directly controls the diagnostic (if such an
3908 option is known to the diagnostic machinery). Specifying the
3909 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3910
3911 @item -fno-diagnostics-show-caret
3912 @opindex fno-diagnostics-show-caret
3913 @opindex fdiagnostics-show-caret
3914 By default, each diagnostic emitted includes the original source line
3915 and a caret @samp{^} indicating the column. This option suppresses this
3916 information. The source line is truncated to @var{n} characters, if
3917 the @option{-fmessage-length=n} option is given. When the output is done
3918 to the terminal, the width is limited to the width given by the
3919 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3920
3921 @item -fno-diagnostics-show-labels
3922 @opindex fno-diagnostics-show-labels
3923 @opindex fdiagnostics-show-labels
3924 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3925 diagnostics can label ranges of source code with pertinent information, such
3926 as the types of expressions:
3927
3928 @smallexample
3929 printf ("foo %s bar", long_i + long_j);
3930 ~^ ~~~~~~~~~~~~~~~
3931 | |
3932 char * long int
3933 @end smallexample
3934
3935 This option suppresses the printing of these labels (in the example above,
3936 the vertical bars and the ``char *'' and ``long int'' text).
3937
3938 @item -fno-diagnostics-show-line-numbers
3939 @opindex fno-diagnostics-show-line-numbers
3940 @opindex fdiagnostics-show-line-numbers
3941 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3942 a left margin is printed, showing line numbers. This option suppresses this
3943 left margin.
3944
3945 @item -fdiagnostics-minimum-margin-width=@var{width}
3946 @opindex fdiagnostics-minimum-margin-width
3947 This option controls the minimum width of the left margin printed by
3948 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3949
3950 @item -fdiagnostics-parseable-fixits
3951 @opindex fdiagnostics-parseable-fixits
3952 Emit fix-it hints in a machine-parseable format, suitable for consumption
3953 by IDEs. For each fix-it, a line will be printed after the relevant
3954 diagnostic, starting with the string ``fix-it:''. For example:
3955
3956 @smallexample
3957 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3958 @end smallexample
3959
3960 The location is expressed as a half-open range, expressed as a count of
3961 bytes, starting at byte 1 for the initial column. In the above example,
3962 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3963 given string:
3964
3965 @smallexample
3966 00000000011111111112222222222
3967 12345678901234567890123456789
3968 gtk_widget_showall (dlg);
3969 ^^^^^^^^^^^^^^^^^^
3970 gtk_widget_show_all
3971 @end smallexample
3972
3973 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3974 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3975 (e.g. vertical tab as ``\013'').
3976
3977 An empty replacement string indicates that the given range is to be removed.
3978 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3979 be inserted at the given position.
3980
3981 @item -fdiagnostics-generate-patch
3982 @opindex fdiagnostics-generate-patch
3983 Print fix-it hints to stderr in unified diff format, after any diagnostics
3984 are printed. For example:
3985
3986 @smallexample
3987 --- test.c
3988 +++ test.c
3989 @@ -42,5 +42,5 @@
3990
3991 void show_cb(GtkDialog *dlg)
3992 @{
3993 - gtk_widget_showall(dlg);
3994 + gtk_widget_show_all(dlg);
3995 @}
3996
3997 @end smallexample
3998
3999 The diff may or may not be colorized, following the same rules
4000 as for diagnostics (see @option{-fdiagnostics-color}).
4001
4002 @item -fdiagnostics-show-template-tree
4003 @opindex fdiagnostics-show-template-tree
4004
4005 In the C++ frontend, when printing diagnostics showing mismatching
4006 template types, such as:
4007
4008 @smallexample
4009 could not convert 'std::map<int, std::vector<double> >()'
4010 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4011 @end smallexample
4012
4013 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4014 tree-like structure showing the common and differing parts of the types,
4015 such as:
4016
4017 @smallexample
4018 map<
4019 [...],
4020 vector<
4021 [double != float]>>
4022 @end smallexample
4023
4024 The parts that differ are highlighted with color (``double'' and
4025 ``float'' in this case).
4026
4027 @item -fno-elide-type
4028 @opindex fno-elide-type
4029 @opindex felide-type
4030 By default when the C++ frontend prints diagnostics showing mismatching
4031 template types, common parts of the types are printed as ``[...]'' to
4032 simplify the error message. For example:
4033
4034 @smallexample
4035 could not convert 'std::map<int, std::vector<double> >()'
4036 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4037 @end smallexample
4038
4039 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4040 This flag also affects the output of the
4041 @option{-fdiagnostics-show-template-tree} flag.
4042
4043 @item -fno-show-column
4044 @opindex fno-show-column
4045 @opindex fshow-column
4046 Do not print column numbers in diagnostics. This may be necessary if
4047 diagnostics are being scanned by a program that does not understand the
4048 column numbers, such as @command{dejagnu}.
4049
4050 @item -fdiagnostics-format=@var{FORMAT}
4051 @opindex fdiagnostics-format
4052 Select a different format for printing diagnostics.
4053 @var{FORMAT} is @samp{text} or @samp{json}.
4054 The default is @samp{text}.
4055
4056 The @samp{json} format consists of a top-level JSON array containing JSON
4057 objects representing the diagnostics.
4058
4059 The JSON is emitted as one line, without formatting; the examples below
4060 have been formatted for clarity.
4061
4062 Diagnostics can have child diagnostics. For example, this error and note:
4063
4064 @smallexample
4065 misleading-indentation.c:15:3: warning: this 'if' clause does not
4066 guard... [-Wmisleading-indentation]
4067 15 | if (flag)
4068 | ^~
4069 misleading-indentation.c:17:5: note: ...this statement, but the latter
4070 is misleadingly indented as if it were guarded by the 'if'
4071 17 | y = 2;
4072 | ^
4073 @end smallexample
4074
4075 @noindent
4076 might be printed in JSON form (after formatting) like this:
4077
4078 @smallexample
4079 [
4080 @{
4081 "kind": "warning",
4082 "locations": [
4083 @{
4084 "caret": @{
4085 "column": 3,
4086 "file": "misleading-indentation.c",
4087 "line": 15
4088 @},
4089 "finish": @{
4090 "column": 4,
4091 "file": "misleading-indentation.c",
4092 "line": 15
4093 @}
4094 @}
4095 ],
4096 "message": "this \u2018if\u2019 clause does not guard...",
4097 "option": "-Wmisleading-indentation",
4098 "children": [
4099 @{
4100 "kind": "note",
4101 "locations": [
4102 @{
4103 "caret": @{
4104 "column": 5,
4105 "file": "misleading-indentation.c",
4106 "line": 17
4107 @}
4108 @}
4109 ],
4110 "message": "...this statement, but the latter is @dots{}"
4111 @}
4112 ]
4113 @},
4114 @dots{}
4115 ]
4116 @end smallexample
4117
4118 @noindent
4119 where the @code{note} is a child of the @code{warning}.
4120
4121 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4122 an @code{option} key describing the command-line option controlling the
4123 warning.
4124
4125 A diagnostic can contain zero or more locations. Each location has up
4126 to three positions within it: a @code{caret} position and optional
4127 @code{start} and @code{finish} positions. A location can also have
4128 an optional @code{label} string. For example, this error:
4129
4130 @smallexample
4131 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4132 'struct s'@} and 'T' @{aka 'struct t'@})
4133 64 | return callee_4a () + callee_4b ();
4134 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4135 | | |
4136 | | T @{aka struct t@}
4137 | S @{aka struct s@}
4138 @end smallexample
4139
4140 @noindent
4141 has three locations. Its primary location is at the ``+'' token at column
4142 23. It has two secondary locations, describing the left and right-hand sides
4143 of the expression, which have labels. It might be printed in JSON form as:
4144
4145 @smallexample
4146 @{
4147 "children": [],
4148 "kind": "error",
4149 "locations": [
4150 @{
4151 "caret": @{
4152 "column": 23, "file": "bad-binary-ops.c", "line": 64
4153 @}
4154 @},
4155 @{
4156 "caret": @{
4157 "column": 10, "file": "bad-binary-ops.c", "line": 64
4158 @},
4159 "finish": @{
4160 "column": 21, "file": "bad-binary-ops.c", "line": 64
4161 @},
4162 "label": "S @{aka struct s@}"
4163 @},
4164 @{
4165 "caret": @{
4166 "column": 25, "file": "bad-binary-ops.c", "line": 64
4167 @},
4168 "finish": @{
4169 "column": 36, "file": "bad-binary-ops.c", "line": 64
4170 @},
4171 "label": "T @{aka struct t@}"
4172 @}
4173 ],
4174 "message": "invalid operands to binary + @dots{}"
4175 @}
4176 @end smallexample
4177
4178 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4179 consisting of half-open intervals, similar to the output of
4180 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4181 with a replacement fix-it hint:
4182
4183 @smallexample
4184 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4185 mean 'color'?
4186 8 | return ptr->colour;
4187 | ^~~~~~
4188 | color
4189 @end smallexample
4190
4191 @noindent
4192 might be printed in JSON form as:
4193
4194 @smallexample
4195 @{
4196 "children": [],
4197 "fixits": [
4198 @{
4199 "next": @{
4200 "column": 21,
4201 "file": "demo.c",
4202 "line": 8
4203 @},
4204 "start": @{
4205 "column": 15,
4206 "file": "demo.c",
4207 "line": 8
4208 @},
4209 "string": "color"
4210 @}
4211 ],
4212 "kind": "error",
4213 "locations": [
4214 @{
4215 "caret": @{
4216 "column": 15,
4217 "file": "demo.c",
4218 "line": 8
4219 @},
4220 "finish": @{
4221 "column": 20,
4222 "file": "demo.c",
4223 "line": 8
4224 @}
4225 @}
4226 ],
4227 "message": "\u2018struct s\u2019 has no member named @dots{}"
4228 @}
4229 @end smallexample
4230
4231 @noindent
4232 where the fix-it hint suggests replacing the text from @code{start} up
4233 to but not including @code{next} with @code{string}'s value. Deletions
4234 are expressed via an empty value for @code{string}, insertions by
4235 having @code{start} equal @code{next}.
4236
4237 @end table
4238
4239 @node Warning Options
4240 @section Options to Request or Suppress Warnings
4241 @cindex options to control warnings
4242 @cindex warning messages
4243 @cindex messages, warning
4244 @cindex suppressing warnings
4245
4246 Warnings are diagnostic messages that report constructions that
4247 are not inherently erroneous but that are risky or suggest there
4248 may have been an error.
4249
4250 The following language-independent options do not enable specific
4251 warnings but control the kinds of diagnostics produced by GCC@.
4252
4253 @table @gcctabopt
4254 @cindex syntax checking
4255 @item -fsyntax-only
4256 @opindex fsyntax-only
4257 Check the code for syntax errors, but don't do anything beyond that.
4258
4259 @item -fmax-errors=@var{n}
4260 @opindex fmax-errors
4261 Limits the maximum number of error messages to @var{n}, at which point
4262 GCC bails out rather than attempting to continue processing the source
4263 code. If @var{n} is 0 (the default), there is no limit on the number
4264 of error messages produced. If @option{-Wfatal-errors} is also
4265 specified, then @option{-Wfatal-errors} takes precedence over this
4266 option.
4267
4268 @item -w
4269 @opindex w
4270 Inhibit all warning messages.
4271
4272 @item -Werror
4273 @opindex Werror
4274 @opindex Wno-error
4275 Make all warnings into errors.
4276
4277 @item -Werror=
4278 @opindex Werror=
4279 @opindex Wno-error=
4280 Make the specified warning into an error. The specifier for a warning
4281 is appended; for example @option{-Werror=switch} turns the warnings
4282 controlled by @option{-Wswitch} into errors. This switch takes a
4283 negative form, to be used to negate @option{-Werror} for specific
4284 warnings; for example @option{-Wno-error=switch} makes
4285 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4286 is in effect.
4287
4288 The warning message for each controllable warning includes the
4289 option that controls the warning. That option can then be used with
4290 @option{-Werror=} and @option{-Wno-error=} as described above.
4291 (Printing of the option in the warning message can be disabled using the
4292 @option{-fno-diagnostics-show-option} flag.)
4293
4294 Note that specifying @option{-Werror=}@var{foo} automatically implies
4295 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4296 imply anything.
4297
4298 @item -Wfatal-errors
4299 @opindex Wfatal-errors
4300 @opindex Wno-fatal-errors
4301 This option causes the compiler to abort compilation on the first error
4302 occurred rather than trying to keep going and printing further error
4303 messages.
4304
4305 @end table
4306
4307 You can request many specific warnings with options beginning with
4308 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4309 implicit declarations. Each of these specific warning options also
4310 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4311 example, @option{-Wno-implicit}. This manual lists only one of the
4312 two forms, whichever is not the default. For further
4313 language-specific options also refer to @ref{C++ Dialect Options} and
4314 @ref{Objective-C and Objective-C++ Dialect Options}.
4315
4316 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4317 options, such as @option{-Wunused}, which may turn on further options,
4318 such as @option{-Wunused-value}. The combined effect of positive and
4319 negative forms is that more specific options have priority over less
4320 specific ones, independently of their position in the command-line. For
4321 options of the same specificity, the last one takes effect. Options
4322 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4323 as if they appeared at the end of the command-line.
4324
4325 When an unrecognized warning option is requested (e.g.,
4326 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4327 that the option is not recognized. However, if the @option{-Wno-} form
4328 is used, the behavior is slightly different: no diagnostic is
4329 produced for @option{-Wno-unknown-warning} unless other diagnostics
4330 are being produced. This allows the use of new @option{-Wno-} options
4331 with old compilers, but if something goes wrong, the compiler
4332 warns that an unrecognized option is present.
4333
4334 @table @gcctabopt
4335 @item -Wpedantic
4336 @itemx -pedantic
4337 @opindex pedantic
4338 @opindex Wpedantic
4339 @opindex Wno-pedantic
4340 Issue all the warnings demanded by strict ISO C and ISO C++;
4341 reject all programs that use forbidden extensions, and some other
4342 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4343 version of the ISO C standard specified by any @option{-std} option used.
4344
4345 Valid ISO C and ISO C++ programs should compile properly with or without
4346 this option (though a rare few require @option{-ansi} or a
4347 @option{-std} option specifying the required version of ISO C)@. However,
4348 without this option, certain GNU extensions and traditional C and C++
4349 features are supported as well. With this option, they are rejected.
4350
4351 @option{-Wpedantic} does not cause warning messages for use of the
4352 alternate keywords whose names begin and end with @samp{__}. This alternate
4353 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4354 i.e. @samp{__intN__}.
4355 Pedantic warnings are also disabled in the expression that follows
4356 @code{__extension__}. However, only system header files should use
4357 these escape routes; application programs should avoid them.
4358 @xref{Alternate Keywords}.
4359
4360 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4361 C conformance. They soon find that it does not do quite what they want:
4362 it finds some non-ISO practices, but not all---only those for which
4363 ISO C @emph{requires} a diagnostic, and some others for which
4364 diagnostics have been added.
4365
4366 A feature to report any failure to conform to ISO C might be useful in
4367 some instances, but would require considerable additional work and would
4368 be quite different from @option{-Wpedantic}. We don't have plans to
4369 support such a feature in the near future.
4370
4371 Where the standard specified with @option{-std} represents a GNU
4372 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4373 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4374 extended dialect is based. Warnings from @option{-Wpedantic} are given
4375 where they are required by the base standard. (It does not make sense
4376 for such warnings to be given only for features not in the specified GNU
4377 C dialect, since by definition the GNU dialects of C include all
4378 features the compiler supports with the given option, and there would be
4379 nothing to warn about.)
4380
4381 @item -pedantic-errors
4382 @opindex pedantic-errors
4383 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4384 requires a diagnostic, in some cases where there is undefined behavior
4385 at compile-time and in some other cases that do not prevent compilation
4386 of programs that are valid according to the standard. This is not
4387 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4388 by this option and not enabled by the latter and vice versa.
4389
4390 @item -Wall
4391 @opindex Wall
4392 @opindex Wno-all
4393 This enables all the warnings about constructions that some users
4394 consider questionable, and that are easy to avoid (or modify to
4395 prevent the warning), even in conjunction with macros. This also
4396 enables some language-specific warnings described in @ref{C++ Dialect
4397 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4398
4399 @option{-Wall} turns on the following warning flags:
4400
4401 @gccoptlist{-Waddress @gol
4402 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4403 -Wbool-compare @gol
4404 -Wbool-operation @gol
4405 -Wc++11-compat -Wc++14-compat @gol
4406 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4407 -Wchar-subscripts @gol
4408 -Wcomment @gol
4409 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4410 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4411 -Wformat @gol
4412 -Wint-in-bool-context @gol
4413 -Wimplicit @r{(C and Objective-C only)} @gol
4414 -Wimplicit-int @r{(C and Objective-C only)} @gol
4415 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4416 -Winit-self @r{(only for C++)} @gol
4417 -Wlogical-not-parentheses @gol
4418 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4419 -Wmaybe-uninitialized @gol
4420 -Wmemset-elt-size @gol
4421 -Wmemset-transposed-args @gol
4422 -Wmisleading-indentation @r{(only for C/C++)} @gol
4423 -Wmissing-attributes @gol
4424 -Wmissing-braces @r{(only for C/ObjC)} @gol
4425 -Wmultistatement-macros @gol
4426 -Wnarrowing @r{(only for C++)} @gol
4427 -Wnonnull @gol
4428 -Wnonnull-compare @gol
4429 -Wopenmp-simd @gol
4430 -Wparentheses @gol
4431 -Wpessimizing-move @r{(only for C++)} @gol
4432 -Wpointer-sign @gol
4433 -Wreorder @gol
4434 -Wrestrict @gol
4435 -Wreturn-type @gol
4436 -Wsequence-point @gol
4437 -Wsign-compare @r{(only in C++)} @gol
4438 -Wsizeof-pointer-div @gol
4439 -Wsizeof-pointer-memaccess @gol
4440 -Wstrict-aliasing @gol
4441 -Wstrict-overflow=1 @gol
4442 -Wswitch @gol
4443 -Wtautological-compare @gol
4444 -Wtrigraphs @gol
4445 -Wuninitialized @gol
4446 -Wunknown-pragmas @gol
4447 -Wunused-function @gol
4448 -Wunused-label @gol
4449 -Wunused-value @gol
4450 -Wunused-variable @gol
4451 -Wvolatile-register-var}
4452
4453 Note that some warning flags are not implied by @option{-Wall}. Some of
4454 them warn about constructions that users generally do not consider
4455 questionable, but which occasionally you might wish to check for;
4456 others warn about constructions that are necessary or hard to avoid in
4457 some cases, and there is no simple way to modify the code to suppress
4458 the warning. Some of them are enabled by @option{-Wextra} but many of
4459 them must be enabled individually.
4460
4461 @item -Wextra
4462 @opindex W
4463 @opindex Wextra
4464 @opindex Wno-extra
4465 This enables some extra warning flags that are not enabled by
4466 @option{-Wall}. (This option used to be called @option{-W}. The older
4467 name is still supported, but the newer name is more descriptive.)
4468
4469 @gccoptlist{-Wclobbered @gol
4470 -Wcast-function-type @gol
4471 -Wdeprecated-copy @r{(C++ only)} @gol
4472 -Wempty-body @gol
4473 -Wignored-qualifiers @gol
4474 -Wimplicit-fallthrough=3 @gol
4475 -Wmissing-field-initializers @gol
4476 -Wmissing-parameter-type @r{(C only)} @gol
4477 -Wold-style-declaration @r{(C only)} @gol
4478 -Woverride-init @gol
4479 -Wsign-compare @r{(C only)} @gol
4480 -Wredundant-move @r{(only for C++)} @gol
4481 -Wtype-limits @gol
4482 -Wuninitialized @gol
4483 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4484 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4485 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4486
4487
4488 The option @option{-Wextra} also prints warning messages for the
4489 following cases:
4490
4491 @itemize @bullet
4492
4493 @item
4494 A pointer is compared against integer zero with @code{<}, @code{<=},
4495 @code{>}, or @code{>=}.
4496
4497 @item
4498 (C++ only) An enumerator and a non-enumerator both appear in a
4499 conditional expression.
4500
4501 @item
4502 (C++ only) Ambiguous virtual bases.
4503
4504 @item
4505 (C++ only) Subscripting an array that has been declared @code{register}.
4506
4507 @item
4508 (C++ only) Taking the address of a variable that has been declared
4509 @code{register}.
4510
4511 @item
4512 (C++ only) A base class is not initialized in the copy constructor
4513 of a derived class.
4514
4515 @end itemize
4516
4517 @item -Wchar-subscripts
4518 @opindex Wchar-subscripts
4519 @opindex Wno-char-subscripts
4520 Warn if an array subscript has type @code{char}. This is a common cause
4521 of error, as programmers often forget that this type is signed on some
4522 machines.
4523 This warning is enabled by @option{-Wall}.
4524
4525 @item -Wno-coverage-mismatch
4526 @opindex Wno-coverage-mismatch
4527 @opindex Wcoverage-mismatch
4528 Warn if feedback profiles do not match when using the
4529 @option{-fprofile-use} option.
4530 If a source file is changed between compiling with @option{-fprofile-generate}
4531 and with @option{-fprofile-use}, the files with the profile feedback can fail
4532 to match the source file and GCC cannot use the profile feedback
4533 information. By default, this warning is enabled and is treated as an
4534 error. @option{-Wno-coverage-mismatch} can be used to disable the
4535 warning or @option{-Wno-error=coverage-mismatch} can be used to
4536 disable the error. Disabling the error for this warning can result in
4537 poorly optimized code and is useful only in the
4538 case of very minor changes such as bug fixes to an existing code-base.
4539 Completely disabling the warning is not recommended.
4540
4541 @item -Wno-cpp
4542 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4543
4544 Suppress warning messages emitted by @code{#warning} directives.
4545
4546 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4547 @opindex Wdouble-promotion
4548 @opindex Wno-double-promotion
4549 Give a warning when a value of type @code{float} is implicitly
4550 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4551 floating-point unit implement @code{float} in hardware, but emulate
4552 @code{double} in software. On such a machine, doing computations
4553 using @code{double} values is much more expensive because of the
4554 overhead required for software emulation.
4555
4556 It is easy to accidentally do computations with @code{double} because
4557 floating-point literals are implicitly of type @code{double}. For
4558 example, in:
4559 @smallexample
4560 @group
4561 float area(float radius)
4562 @{
4563 return 3.14159 * radius * radius;
4564 @}
4565 @end group
4566 @end smallexample
4567 the compiler performs the entire computation with @code{double}
4568 because the floating-point literal is a @code{double}.
4569
4570 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4571 @opindex Wduplicate-decl-specifier
4572 @opindex Wno-duplicate-decl-specifier
4573 Warn if a declaration has duplicate @code{const}, @code{volatile},
4574 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4575 @option{-Wall}.
4576
4577 @item -Wformat
4578 @itemx -Wformat=@var{n}
4579 @opindex Wformat
4580 @opindex Wno-format
4581 @opindex ffreestanding
4582 @opindex fno-builtin
4583 @opindex Wformat=
4584 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4585 the arguments supplied have types appropriate to the format string
4586 specified, and that the conversions specified in the format string make
4587 sense. This includes standard functions, and others specified by format
4588 attributes (@pxref{Function Attributes}), in the @code{printf},
4589 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4590 not in the C standard) families (or other target-specific families).
4591 Which functions are checked without format attributes having been
4592 specified depends on the standard version selected, and such checks of
4593 functions without the attribute specified are disabled by
4594 @option{-ffreestanding} or @option{-fno-builtin}.
4595
4596 The formats are checked against the format features supported by GNU
4597 libc version 2.2. These include all ISO C90 and C99 features, as well
4598 as features from the Single Unix Specification and some BSD and GNU
4599 extensions. Other library implementations may not support all these
4600 features; GCC does not support warning about features that go beyond a
4601 particular library's limitations. However, if @option{-Wpedantic} is used
4602 with @option{-Wformat}, warnings are given about format features not
4603 in the selected standard version (but not for @code{strfmon} formats,
4604 since those are not in any version of the C standard). @xref{C Dialect
4605 Options,,Options Controlling C Dialect}.
4606
4607 @table @gcctabopt
4608 @item -Wformat=1
4609 @itemx -Wformat
4610 @opindex Wformat
4611 @opindex Wformat=1
4612 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4613 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4614 @option{-Wformat} also checks for null format arguments for several
4615 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4616 aspects of this level of format checking can be disabled by the
4617 options: @option{-Wno-format-contains-nul},
4618 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4619 @option{-Wformat} is enabled by @option{-Wall}.
4620
4621 @item -Wno-format-contains-nul
4622 @opindex Wno-format-contains-nul
4623 @opindex Wformat-contains-nul
4624 If @option{-Wformat} is specified, do not warn about format strings that
4625 contain NUL bytes.
4626
4627 @item -Wno-format-extra-args
4628 @opindex Wno-format-extra-args
4629 @opindex Wformat-extra-args
4630 If @option{-Wformat} is specified, do not warn about excess arguments to a
4631 @code{printf} or @code{scanf} format function. The C standard specifies
4632 that such arguments are ignored.
4633
4634 Where the unused arguments lie between used arguments that are
4635 specified with @samp{$} operand number specifications, normally
4636 warnings are still given, since the implementation could not know what
4637 type to pass to @code{va_arg} to skip the unused arguments. However,
4638 in the case of @code{scanf} formats, this option suppresses the
4639 warning if the unused arguments are all pointers, since the Single
4640 Unix Specification says that such unused arguments are allowed.
4641
4642 @item -Wformat-overflow
4643 @itemx -Wformat-overflow=@var{level}
4644 @opindex Wformat-overflow
4645 @opindex Wno-format-overflow
4646 Warn about calls to formatted input/output functions such as @code{sprintf}
4647 and @code{vsprintf} that might overflow the destination buffer. When the
4648 exact number of bytes written by a format directive cannot be determined
4649 at compile-time it is estimated based on heuristics that depend on the
4650 @var{level} argument and on optimization. While enabling optimization
4651 will in most cases improve the accuracy of the warning, it may also
4652 result in false positives.
4653
4654 @table @gcctabopt
4655 @item -Wformat-overflow
4656 @itemx -Wformat-overflow=1
4657 @opindex Wformat-overflow
4658 @opindex Wno-format-overflow
4659 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4660 employs a conservative approach that warns only about calls that most
4661 likely overflow the buffer. At this level, numeric arguments to format
4662 directives with unknown values are assumed to have the value of one, and
4663 strings of unknown length to be empty. Numeric arguments that are known
4664 to be bounded to a subrange of their type, or string arguments whose output
4665 is bounded either by their directive's precision or by a finite set of
4666 string literals, are assumed to take on the value within the range that
4667 results in the most bytes on output. For example, the call to @code{sprintf}
4668 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4669 the terminating NUL character (@code{'\0'}) appended by the function
4670 to the destination buffer will be written past its end. Increasing
4671 the size of the buffer by a single byte is sufficient to avoid the
4672 warning, though it may not be sufficient to avoid the overflow.
4673
4674 @smallexample
4675 void f (int a, int b)
4676 @{
4677 char buf [13];
4678 sprintf (buf, "a = %i, b = %i\n", a, b);
4679 @}
4680 @end smallexample
4681
4682 @item -Wformat-overflow=2
4683 Level @var{2} warns also about calls that might overflow the destination
4684 buffer given an argument of sufficient length or magnitude. At level
4685 @var{2}, unknown numeric arguments are assumed to have the minimum
4686 representable value for signed types with a precision greater than 1, and
4687 the maximum representable value otherwise. Unknown string arguments whose
4688 length cannot be assumed to be bounded either by the directive's precision,
4689 or by a finite set of string literals they may evaluate to, or the character
4690 array they may point to, are assumed to be 1 character long.
4691
4692 At level @var{2}, the call in the example above is again diagnosed, but
4693 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4694 @code{%i} directive will write some of its digits beyond the end of
4695 the destination buffer. To make the call safe regardless of the values
4696 of the two variables, the size of the destination buffer must be increased
4697 to at least 34 bytes. GCC includes the minimum size of the buffer in
4698 an informational note following the warning.
4699
4700 An alternative to increasing the size of the destination buffer is to
4701 constrain the range of formatted values. The maximum length of string
4702 arguments can be bounded by specifying the precision in the format
4703 directive. When numeric arguments of format directives can be assumed
4704 to be bounded by less than the precision of their type, choosing
4705 an appropriate length modifier to the format specifier will reduce
4706 the required buffer size. For example, if @var{a} and @var{b} in the
4707 example above can be assumed to be within the precision of
4708 the @code{short int} type then using either the @code{%hi} format
4709 directive or casting the argument to @code{short} reduces the maximum
4710 required size of the buffer to 24 bytes.
4711
4712 @smallexample
4713 void f (int a, int b)
4714 @{
4715 char buf [23];
4716 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4717 @}
4718 @end smallexample
4719 @end table
4720
4721 @item -Wno-format-zero-length
4722 @opindex Wno-format-zero-length
4723 @opindex Wformat-zero-length
4724 If @option{-Wformat} is specified, do not warn about zero-length formats.
4725 The C standard specifies that zero-length formats are allowed.
4726
4727
4728 @item -Wformat=2
4729 @opindex Wformat=2
4730 Enable @option{-Wformat} plus additional format checks. Currently
4731 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4732 -Wformat-y2k}.
4733
4734 @item -Wformat-nonliteral
4735 @opindex Wformat-nonliteral
4736 @opindex Wno-format-nonliteral
4737 If @option{-Wformat} is specified, also warn if the format string is not a
4738 string literal and so cannot be checked, unless the format function
4739 takes its format arguments as a @code{va_list}.
4740
4741 @item -Wformat-security
4742 @opindex Wformat-security
4743 @opindex Wno-format-security
4744 If @option{-Wformat} is specified, also warn about uses of format
4745 functions that represent possible security problems. At present, this
4746 warns about calls to @code{printf} and @code{scanf} functions where the
4747 format string is not a string literal and there are no format arguments,
4748 as in @code{printf (foo);}. This may be a security hole if the format
4749 string came from untrusted input and contains @samp{%n}. (This is
4750 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4751 in future warnings may be added to @option{-Wformat-security} that are not
4752 included in @option{-Wformat-nonliteral}.)
4753
4754 @item -Wformat-signedness
4755 @opindex Wformat-signedness
4756 @opindex Wno-format-signedness
4757 If @option{-Wformat} is specified, also warn if the format string
4758 requires an unsigned argument and the argument is signed and vice versa.
4759
4760 @item -Wformat-truncation
4761 @itemx -Wformat-truncation=@var{level}
4762 @opindex Wformat-truncation
4763 @opindex Wno-format-truncation
4764 Warn about calls to formatted input/output functions such as @code{snprintf}
4765 and @code{vsnprintf} that might result in output truncation. When the exact
4766 number of bytes written by a format directive cannot be determined at
4767 compile-time it is estimated based on heuristics that depend on
4768 the @var{level} argument and on optimization. While enabling optimization
4769 will in most cases improve the accuracy of the warning, it may also result
4770 in false positives. Except as noted otherwise, the option uses the same
4771 logic @option{-Wformat-overflow}.
4772
4773 @table @gcctabopt
4774 @item -Wformat-truncation
4775 @itemx -Wformat-truncation=1
4776 @opindex Wformat-truncation
4777 @opindex Wno-format-truncation
4778 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4779 employs a conservative approach that warns only about calls to bounded
4780 functions whose return value is unused and that will most likely result
4781 in output truncation.
4782
4783 @item -Wformat-truncation=2
4784 Level @var{2} warns also about calls to bounded functions whose return
4785 value is used and that might result in truncation given an argument of
4786 sufficient length or magnitude.
4787 @end table
4788
4789 @item -Wformat-y2k
4790 @opindex Wformat-y2k
4791 @opindex Wno-format-y2k
4792 If @option{-Wformat} is specified, also warn about @code{strftime}
4793 formats that may yield only a two-digit year.
4794 @end table
4795
4796 @item -Wnonnull
4797 @opindex Wnonnull
4798 @opindex Wno-nonnull
4799 Warn about passing a null pointer for arguments marked as
4800 requiring a non-null value by the @code{nonnull} function attribute.
4801
4802 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4803 can be disabled with the @option{-Wno-nonnull} option.
4804
4805 @item -Wnonnull-compare
4806 @opindex Wnonnull-compare
4807 @opindex Wno-nonnull-compare
4808 Warn when comparing an argument marked with the @code{nonnull}
4809 function attribute against null inside the function.
4810
4811 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4812 can be disabled with the @option{-Wno-nonnull-compare} option.
4813
4814 @item -Wnull-dereference
4815 @opindex Wnull-dereference
4816 @opindex Wno-null-dereference
4817 Warn if the compiler detects paths that trigger erroneous or
4818 undefined behavior due to dereferencing a null pointer. This option
4819 is only active when @option{-fdelete-null-pointer-checks} is active,
4820 which is enabled by optimizations in most targets. The precision of
4821 the warnings depends on the optimization options used.
4822
4823 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4824 @opindex Winaccessible-base
4825 @opindex Wno-inaccessible-base
4826 Warn when a base class is inaccessible in a class derived from it due to
4827 ambiguity. The warning is enabled by default. Note the warning for virtual
4828 bases is enabled by the @option{-Wextra} option.
4829 @smallexample
4830 @group
4831 struct A @{ int a; @};
4832
4833 struct B : A @{ @};
4834
4835 struct C : B, A @{ @};
4836 @end group
4837 @end smallexample
4838
4839 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4840 @opindex Winit-self
4841 @opindex Wno-init-self
4842 Warn about uninitialized variables that are initialized with themselves.
4843 Note this option can only be used with the @option{-Wuninitialized} option.
4844
4845 For example, GCC warns about @code{i} being uninitialized in the
4846 following snippet only when @option{-Winit-self} has been specified:
4847 @smallexample
4848 @group
4849 int f()
4850 @{
4851 int i = i;
4852 return i;
4853 @}
4854 @end group
4855 @end smallexample
4856
4857 This warning is enabled by @option{-Wall} in C++.
4858
4859 @item -Wimplicit-int @r{(C and Objective-C only)}
4860 @opindex Wimplicit-int
4861 @opindex Wno-implicit-int
4862 Warn when a declaration does not specify a type.
4863 This warning is enabled by @option{-Wall}.
4864
4865 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4866 @opindex Wimplicit-function-declaration
4867 @opindex Wno-implicit-function-declaration
4868 Give a warning whenever a function is used before being declared. In
4869 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4870 enabled by default and it is made into an error by
4871 @option{-pedantic-errors}. This warning is also enabled by
4872 @option{-Wall}.
4873
4874 @item -Wimplicit @r{(C and Objective-C only)}
4875 @opindex Wimplicit
4876 @opindex Wno-implicit
4877 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4878 This warning is enabled by @option{-Wall}.
4879
4880 @item -Wimplicit-fallthrough
4881 @opindex Wimplicit-fallthrough
4882 @opindex Wno-implicit-fallthrough
4883 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4884 and @option{-Wno-implicit-fallthrough} is the same as
4885 @option{-Wimplicit-fallthrough=0}.
4886
4887 @item -Wimplicit-fallthrough=@var{n}
4888 @opindex Wimplicit-fallthrough=
4889 Warn when a switch case falls through. For example:
4890
4891 @smallexample
4892 @group
4893 switch (cond)
4894 @{
4895 case 1:
4896 a = 1;
4897 break;
4898 case 2:
4899 a = 2;
4900 case 3:
4901 a = 3;
4902 break;
4903 @}
4904 @end group
4905 @end smallexample
4906
4907 This warning does not warn when the last statement of a case cannot
4908 fall through, e.g. when there is a return statement or a call to function
4909 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4910 also takes into account control flow statements, such as ifs, and only
4911 warns when appropriate. E.g.@:
4912
4913 @smallexample
4914 @group
4915 switch (cond)
4916 @{
4917 case 1:
4918 if (i > 3) @{
4919 bar (5);
4920 break;
4921 @} else if (i < 1) @{
4922 bar (0);
4923 @} else
4924 return;
4925 default:
4926 @dots{}
4927 @}
4928 @end group
4929 @end smallexample
4930
4931 Since there are occasions where a switch case fall through is desirable,
4932 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4933 to be used along with a null statement to suppress this warning that
4934 would normally occur:
4935
4936 @smallexample
4937 @group
4938 switch (cond)
4939 @{
4940 case 1:
4941 bar (0);
4942 __attribute__ ((fallthrough));
4943 default:
4944 @dots{}
4945 @}
4946 @end group
4947 @end smallexample
4948
4949 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4950 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4951 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4952 Instead of these attributes, it is also possible to add a fallthrough comment
4953 to silence the warning. The whole body of the C or C++ style comment should
4954 match the given regular expressions listed below. The option argument @var{n}
4955 specifies what kind of comments are accepted:
4956
4957 @itemize @bullet
4958
4959 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4960
4961 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4962 expression, any comment is used as fallthrough comment.
4963
4964 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4965 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4966
4967 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4968 following regular expressions:
4969
4970 @itemize @bullet
4971
4972 @item @code{-fallthrough}
4973
4974 @item @code{@@fallthrough@@}
4975
4976 @item @code{lint -fallthrough[ \t]*}
4977
4978 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4979
4980 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4981
4982 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4983
4984 @end itemize
4985
4986 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4987 following regular expressions:
4988
4989 @itemize @bullet
4990
4991 @item @code{-fallthrough}
4992
4993 @item @code{@@fallthrough@@}
4994
4995 @item @code{lint -fallthrough[ \t]*}
4996
4997 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4998
4999 @end itemize
5000
5001 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5002 fallthrough comments, only attributes disable the warning.
5003
5004 @end itemize
5005
5006 The comment needs to be followed after optional whitespace and other comments
5007 by @code{case} or @code{default} keywords or by a user label that precedes some
5008 @code{case} or @code{default} label.
5009
5010 @smallexample
5011 @group
5012 switch (cond)
5013 @{
5014 case 1:
5015 bar (0);
5016 /* FALLTHRU */
5017 default:
5018 @dots{}
5019 @}
5020 @end group
5021 @end smallexample
5022
5023 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5024
5025 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5026 @opindex Wif-not-aligned
5027 @opindex Wno-if-not-aligned
5028 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5029 should be issued. This is enabled by default.
5030 Use @option{-Wno-if-not-aligned} to disable it.
5031
5032 @item -Wignored-qualifiers @r{(C and C++ only)}
5033 @opindex Wignored-qualifiers
5034 @opindex Wno-ignored-qualifiers
5035 Warn if the return type of a function has a type qualifier
5036 such as @code{const}. For ISO C such a type qualifier has no effect,
5037 since the value returned by a function is not an lvalue.
5038 For C++, the warning is only emitted for scalar types or @code{void}.
5039 ISO C prohibits qualified @code{void} return types on function
5040 definitions, so such return types always receive a warning
5041 even without this option.
5042
5043 This warning is also enabled by @option{-Wextra}.
5044
5045 @item -Wignored-attributes @r{(C and C++ only)}
5046 @opindex Wignored-attributes
5047 @opindex Wno-ignored-attributes
5048 Warn when an attribute is ignored. This is different from the
5049 @option{-Wattributes} option in that it warns whenever the compiler decides
5050 to drop an attribute, not that the attribute is either unknown, used in a
5051 wrong place, etc. This warning is enabled by default.
5052
5053 @item -Wmain
5054 @opindex Wmain
5055 @opindex Wno-main
5056 Warn if the type of @code{main} is suspicious. @code{main} should be
5057 a function with external linkage, returning int, taking either zero
5058 arguments, two, or three arguments of appropriate types. This warning
5059 is enabled by default in C++ and is enabled by either @option{-Wall}
5060 or @option{-Wpedantic}.
5061
5062 @item -Wmisleading-indentation @r{(C and C++ only)}
5063 @opindex Wmisleading-indentation
5064 @opindex Wno-misleading-indentation
5065 Warn when the indentation of the code does not reflect the block structure.
5066 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5067 @code{for} clauses with a guarded statement that does not use braces,
5068 followed by an unguarded statement with the same indentation.
5069
5070 In the following example, the call to ``bar'' is misleadingly indented as
5071 if it were guarded by the ``if'' conditional.
5072
5073 @smallexample
5074 if (some_condition ())
5075 foo ();
5076 bar (); /* Gotcha: this is not guarded by the "if". */
5077 @end smallexample
5078
5079 In the case of mixed tabs and spaces, the warning uses the
5080 @option{-ftabstop=} option to determine if the statements line up
5081 (defaulting to 8).
5082
5083 The warning is not issued for code involving multiline preprocessor logic
5084 such as the following example.
5085
5086 @smallexample
5087 if (flagA)
5088 foo (0);
5089 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5090 if (flagB)
5091 #endif
5092 foo (1);
5093 @end smallexample
5094
5095 The warning is not issued after a @code{#line} directive, since this
5096 typically indicates autogenerated code, and no assumptions can be made
5097 about the layout of the file that the directive references.
5098
5099 This warning is enabled by @option{-Wall} in C and C++.
5100
5101 @item -Wmissing-attributes
5102 @opindex Wmissing-attributes
5103 @opindex Wno-missing-attributes
5104 Warn when a declaration of a function is missing one or more attributes
5105 that a related function is declared with and whose absence may adversely
5106 affect the correctness or efficiency of generated code. For example,
5107 the warning is issued for declarations of aliases that use attributes
5108 to specify less restrictive requirements than those of their targets.
5109 This typically represents a potential optimization opportunity.
5110 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5111 issued when the alias is more restrictive than the target, which could
5112 lead to incorrect code generation.
5113 Attributes considered include @code{alloc_align}, @code{alloc_size},
5114 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5115 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5116 @code{returns_nonnull}, and @code{returns_twice}.
5117
5118 In C++, the warning is issued when an explicit specialization of a primary
5119 template declared with attribute @code{alloc_align}, @code{alloc_size},
5120 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5121 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5122 @code{error}, and @code{warning} suppress the warning.
5123 (@pxref{Function Attributes}).
5124
5125 You can use the @code{copy} attribute to apply the same
5126 set of attributes to a declaration as that on another declaration without
5127 explicitly enumerating the attributes. This attribute can be applied
5128 to declarations of functions (@pxref{Common Function Attributes}),
5129 variables (@pxref{Common Variable Attributes}), or types
5130 (@pxref{Common Type Attributes}).
5131
5132 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5133
5134 For example, since the declaration of the primary function template
5135 below makes use of both attribute @code{malloc} and @code{alloc_size}
5136 the declaration of the explicit specialization of the template is
5137 diagnosed because it is missing one of the attributes.
5138
5139 @smallexample
5140 template <class T>
5141 T* __attribute__ ((malloc, alloc_size (1)))
5142 allocate (size_t);
5143
5144 template <>
5145 void* __attribute__ ((malloc)) // missing alloc_size
5146 allocate<void> (size_t);
5147 @end smallexample
5148
5149 @item -Wmissing-braces
5150 @opindex Wmissing-braces
5151 @opindex Wno-missing-braces
5152 Warn if an aggregate or union initializer is not fully bracketed. In
5153 the following example, the initializer for @code{a} is not fully
5154 bracketed, but that for @code{b} is fully bracketed. This warning is
5155 enabled by @option{-Wall} in C.
5156
5157 @smallexample
5158 int a[2][2] = @{ 0, 1, 2, 3 @};
5159 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5160 @end smallexample
5161
5162 This warning is enabled by @option{-Wall}.
5163
5164 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5165 @opindex Wmissing-include-dirs
5166 @opindex Wno-missing-include-dirs
5167 Warn if a user-supplied include directory does not exist.
5168
5169 @item -Wmissing-profile
5170 @opindex Wmissing-profile
5171 @opindex Wno-missing-profile
5172 Warn if feedback profiles are missing when using the
5173 @option{-fprofile-use} option.
5174 This option diagnoses those cases where a new function or a new file is added
5175 to the user code between compiling with @option{-fprofile-generate} and with
5176 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5177 profile feedback data files do not contain any profile feedback information for
5178 the newly added function or file respectively. Also, in the case when profile
5179 count data (.gcda) files are removed, GCC cannot use any profile feedback
5180 information. In all these cases, warnings are issued to inform the user that a
5181 profile generation step is due. @option{-Wno-missing-profile} can be used to
5182 disable the warning. Ignoring the warning can result in poorly optimized code.
5183 Completely disabling the warning is not recommended and should be done only
5184 when non-existent profile data is justified.
5185
5186 @item -Wmultistatement-macros
5187 @opindex Wmultistatement-macros
5188 @opindex Wno-multistatement-macros
5189 Warn about unsafe multiple statement macros that appear to be guarded
5190 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5191 @code{while}, in which only the first statement is actually guarded after
5192 the macro is expanded.
5193
5194 For example:
5195
5196 @smallexample
5197 #define DOIT x++; y++
5198 if (c)
5199 DOIT;
5200 @end smallexample
5201
5202 will increment @code{y} unconditionally, not just when @code{c} holds.
5203 The can usually be fixed by wrapping the macro in a do-while loop:
5204 @smallexample
5205 #define DOIT do @{ x++; y++; @} while (0)
5206 if (c)
5207 DOIT;
5208 @end smallexample
5209
5210 This warning is enabled by @option{-Wall} in C and C++.
5211
5212 @item -Wparentheses
5213 @opindex Wparentheses
5214 @opindex Wno-parentheses
5215 Warn if parentheses are omitted in certain contexts, such
5216 as when there is an assignment in a context where a truth value
5217 is expected, or when operators are nested whose precedence people
5218 often get confused about.
5219
5220 Also warn if a comparison like @code{x<=y<=z} appears; this is
5221 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5222 interpretation from that of ordinary mathematical notation.
5223
5224 Also warn for dangerous uses of the GNU extension to
5225 @code{?:} with omitted middle operand. When the condition
5226 in the @code{?}: operator is a boolean expression, the omitted value is
5227 always 1. Often programmers expect it to be a value computed
5228 inside the conditional expression instead.
5229
5230 For C++ this also warns for some cases of unnecessary parentheses in
5231 declarations, which can indicate an attempt at a function call instead
5232 of a declaration:
5233 @smallexample
5234 @{
5235 // Declares a local variable called mymutex.
5236 std::unique_lock<std::mutex> (mymutex);
5237 // User meant std::unique_lock<std::mutex> lock (mymutex);
5238 @}
5239 @end smallexample
5240
5241 This warning is enabled by @option{-Wall}.
5242
5243 @item -Wsequence-point
5244 @opindex Wsequence-point
5245 @opindex Wno-sequence-point
5246 Warn about code that may have undefined semantics because of violations
5247 of sequence point rules in the C and C++ standards.
5248
5249 The C and C++ standards define the order in which expressions in a C/C++
5250 program are evaluated in terms of @dfn{sequence points}, which represent
5251 a partial ordering between the execution of parts of the program: those
5252 executed before the sequence point, and those executed after it. These
5253 occur after the evaluation of a full expression (one which is not part
5254 of a larger expression), after the evaluation of the first operand of a
5255 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5256 function is called (but after the evaluation of its arguments and the
5257 expression denoting the called function), and in certain other places.
5258 Other than as expressed by the sequence point rules, the order of
5259 evaluation of subexpressions of an expression is not specified. All
5260 these rules describe only a partial order rather than a total order,
5261 since, for example, if two functions are called within one expression
5262 with no sequence point between them, the order in which the functions
5263 are called is not specified. However, the standards committee have
5264 ruled that function calls do not overlap.
5265
5266 It is not specified when between sequence points modifications to the
5267 values of objects take effect. Programs whose behavior depends on this
5268 have undefined behavior; the C and C++ standards specify that ``Between
5269 the previous and next sequence point an object shall have its stored
5270 value modified at most once by the evaluation of an expression.
5271 Furthermore, the prior value shall be read only to determine the value
5272 to be stored.''. If a program breaks these rules, the results on any
5273 particular implementation are entirely unpredictable.
5274
5275 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5276 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5277 diagnosed by this option, and it may give an occasional false positive
5278 result, but in general it has been found fairly effective at detecting
5279 this sort of problem in programs.
5280
5281 The C++17 standard will define the order of evaluation of operands in
5282 more cases: in particular it requires that the right-hand side of an
5283 assignment be evaluated before the left-hand side, so the above
5284 examples are no longer undefined. But this warning will still warn
5285 about them, to help people avoid writing code that is undefined in C
5286 and earlier revisions of C++.
5287
5288 The standard is worded confusingly, therefore there is some debate
5289 over the precise meaning of the sequence point rules in subtle cases.
5290 Links to discussions of the problem, including proposed formal
5291 definitions, may be found on the GCC readings page, at
5292 @uref{http://gcc.gnu.org/@/readings.html}.
5293
5294 This warning is enabled by @option{-Wall} for C and C++.
5295
5296 @item -Wno-return-local-addr
5297 @opindex Wno-return-local-addr
5298 @opindex Wreturn-local-addr
5299 Do not warn about returning a pointer (or in C++, a reference) to a
5300 variable that goes out of scope after the function returns.
5301
5302 @item -Wreturn-type
5303 @opindex Wreturn-type
5304 @opindex Wno-return-type
5305 Warn whenever a function is defined with a return type that defaults
5306 to @code{int}. Also warn about any @code{return} statement with no
5307 return value in a function whose return type is not @code{void}
5308 (falling off the end of the function body is considered returning
5309 without a value).
5310
5311 For C only, warn about a @code{return} statement with an expression in a
5312 function whose return type is @code{void}, unless the expression type is
5313 also @code{void}. As a GNU extension, the latter case is accepted
5314 without a warning unless @option{-Wpedantic} is used. Attempting
5315 to use the return value of a non-@code{void} function other than @code{main}
5316 that flows off the end by reaching the closing curly brace that terminates
5317 the function is undefined.
5318
5319 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5320 than @code{main} results in undefined behavior even when the value of
5321 the function is not used.
5322
5323 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5324
5325 @item -Wshift-count-negative
5326 @opindex Wshift-count-negative
5327 @opindex Wno-shift-count-negative
5328 Warn if shift count is negative. This warning is enabled by default.
5329
5330 @item -Wshift-count-overflow
5331 @opindex Wshift-count-overflow
5332 @opindex Wno-shift-count-overflow
5333 Warn if shift count >= width of type. This warning is enabled by default.
5334
5335 @item -Wshift-negative-value
5336 @opindex Wshift-negative-value
5337 @opindex Wno-shift-negative-value
5338 Warn if left shifting a negative value. This warning is enabled by
5339 @option{-Wextra} in C99 and C++11 modes (and newer).
5340
5341 @item -Wshift-overflow
5342 @itemx -Wshift-overflow=@var{n}
5343 @opindex Wshift-overflow
5344 @opindex Wno-shift-overflow
5345 Warn about left shift overflows. This warning is enabled by
5346 default in C99 and C++11 modes (and newer).
5347
5348 @table @gcctabopt
5349 @item -Wshift-overflow=1
5350 This is the warning level of @option{-Wshift-overflow} and is enabled
5351 by default in C99 and C++11 modes (and newer). This warning level does
5352 not warn about left-shifting 1 into the sign bit. (However, in C, such
5353 an overflow is still rejected in contexts where an integer constant expression
5354 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5355 shifts always wrap.
5356
5357 @item -Wshift-overflow=2
5358 This warning level also warns about left-shifting 1 into the sign bit,
5359 unless C++14 mode (or newer) is active.
5360 @end table
5361
5362 @item -Wswitch
5363 @opindex Wswitch
5364 @opindex Wno-switch
5365 Warn whenever a @code{switch} statement has an index of enumerated type
5366 and lacks a @code{case} for one or more of the named codes of that
5367 enumeration. (The presence of a @code{default} label prevents this
5368 warning.) @code{case} labels outside the enumeration range also
5369 provoke warnings when this option is used (even if there is a
5370 @code{default} label).
5371 This warning is enabled by @option{-Wall}.
5372
5373 @item -Wswitch-default
5374 @opindex Wswitch-default
5375 @opindex Wno-switch-default
5376 Warn whenever a @code{switch} statement does not have a @code{default}
5377 case.
5378
5379 @item -Wswitch-enum
5380 @opindex Wswitch-enum
5381 @opindex Wno-switch-enum
5382 Warn whenever a @code{switch} statement has an index of enumerated type
5383 and lacks a @code{case} for one or more of the named codes of that
5384 enumeration. @code{case} labels outside the enumeration range also
5385 provoke warnings when this option is used. The only difference
5386 between @option{-Wswitch} and this option is that this option gives a
5387 warning about an omitted enumeration code even if there is a
5388 @code{default} label.
5389
5390 @item -Wswitch-bool
5391 @opindex Wswitch-bool
5392 @opindex Wno-switch-bool
5393 Warn whenever a @code{switch} statement has an index of boolean type
5394 and the case values are outside the range of a boolean type.
5395 It is possible to suppress this warning by casting the controlling
5396 expression to a type other than @code{bool}. For example:
5397 @smallexample
5398 @group
5399 switch ((int) (a == 4))
5400 @{
5401 @dots{}
5402 @}
5403 @end group
5404 @end smallexample
5405 This warning is enabled by default for C and C++ programs.
5406
5407 @item -Wswitch-outside-range
5408 @opindex Wswitch-outside-range
5409 @opindex Wno-switch-outside-range
5410 Warn whenever a @code{switch} case has a value that is outside of its
5411 respective type range. This warning is enabled by default for
5412 C and C++ programs.
5413
5414 @item -Wswitch-unreachable
5415 @opindex Wswitch-unreachable
5416 @opindex Wno-switch-unreachable
5417 Warn whenever a @code{switch} statement contains statements between the
5418 controlling expression and the first case label, which will never be
5419 executed. For example:
5420 @smallexample
5421 @group
5422 switch (cond)
5423 @{
5424 i = 15;
5425 @dots{}
5426 case 5:
5427 @dots{}
5428 @}
5429 @end group
5430 @end smallexample
5431 @option{-Wswitch-unreachable} does not warn if the statement between the
5432 controlling expression and the first case label is just a declaration:
5433 @smallexample
5434 @group
5435 switch (cond)
5436 @{
5437 int i;
5438 @dots{}
5439 case 5:
5440 i = 5;
5441 @dots{}
5442 @}
5443 @end group
5444 @end smallexample
5445 This warning is enabled by default for C and C++ programs.
5446
5447 @item -Wsync-nand @r{(C and C++ only)}
5448 @opindex Wsync-nand
5449 @opindex Wno-sync-nand
5450 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5451 built-in functions are used. These functions changed semantics in GCC 4.4.
5452
5453 @item -Wunused-but-set-parameter
5454 @opindex Wunused-but-set-parameter
5455 @opindex Wno-unused-but-set-parameter
5456 Warn whenever a function parameter is assigned to, but otherwise unused
5457 (aside from its declaration).
5458
5459 To suppress this warning use the @code{unused} attribute
5460 (@pxref{Variable Attributes}).
5461
5462 This warning is also enabled by @option{-Wunused} together with
5463 @option{-Wextra}.
5464
5465 @item -Wunused-but-set-variable
5466 @opindex Wunused-but-set-variable
5467 @opindex Wno-unused-but-set-variable
5468 Warn whenever a local variable is assigned to, but otherwise unused
5469 (aside from its declaration).
5470 This warning is enabled by @option{-Wall}.
5471
5472 To suppress this warning use the @code{unused} attribute
5473 (@pxref{Variable Attributes}).
5474
5475 This warning is also enabled by @option{-Wunused}, which is enabled
5476 by @option{-Wall}.
5477
5478 @item -Wunused-function
5479 @opindex Wunused-function
5480 @opindex Wno-unused-function
5481 Warn whenever a static function is declared but not defined or a
5482 non-inline static function is unused.
5483 This warning is enabled by @option{-Wall}.
5484
5485 @item -Wunused-label
5486 @opindex Wunused-label
5487 @opindex Wno-unused-label
5488 Warn whenever a label is declared but not used.
5489 This warning is enabled by @option{-Wall}.
5490
5491 To suppress this warning use the @code{unused} attribute
5492 (@pxref{Variable Attributes}).
5493
5494 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5495 @opindex Wunused-local-typedefs
5496 @opindex Wno-unused-local-typedefs
5497 Warn when a typedef locally defined in a function is not used.
5498 This warning is enabled by @option{-Wall}.
5499
5500 @item -Wunused-parameter
5501 @opindex Wunused-parameter
5502 @opindex Wno-unused-parameter
5503 Warn whenever a function parameter is unused aside from its declaration.
5504
5505 To suppress this warning use the @code{unused} attribute
5506 (@pxref{Variable Attributes}).
5507
5508 @item -Wno-unused-result
5509 @opindex Wunused-result
5510 @opindex Wno-unused-result
5511 Do not warn if a caller of a function marked with attribute
5512 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5513 its return value. The default is @option{-Wunused-result}.
5514
5515 @item -Wunused-variable
5516 @opindex Wunused-variable
5517 @opindex Wno-unused-variable
5518 Warn whenever a local or static variable is unused aside from its
5519 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5520 but not for C++. This warning is enabled by @option{-Wall}.
5521
5522 To suppress this warning use the @code{unused} attribute
5523 (@pxref{Variable Attributes}).
5524
5525 @item -Wunused-const-variable
5526 @itemx -Wunused-const-variable=@var{n}
5527 @opindex Wunused-const-variable
5528 @opindex Wno-unused-const-variable
5529 Warn whenever a constant static variable is unused aside from its declaration.
5530 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5531 for C, but not for C++. In C this declares variable storage, but in C++ this
5532 is not an error since const variables take the place of @code{#define}s.
5533
5534 To suppress this warning use the @code{unused} attribute
5535 (@pxref{Variable Attributes}).
5536
5537 @table @gcctabopt
5538 @item -Wunused-const-variable=1
5539 This is the warning level that is enabled by @option{-Wunused-variable} for
5540 C. It warns only about unused static const variables defined in the main
5541 compilation unit, but not about static const variables declared in any
5542 header included.
5543
5544 @item -Wunused-const-variable=2
5545 This warning level also warns for unused constant static variables in
5546 headers (excluding system headers). This is the warning level of
5547 @option{-Wunused-const-variable} and must be explicitly requested since
5548 in C++ this isn't an error and in C it might be harder to clean up all
5549 headers included.
5550 @end table
5551
5552 @item -Wunused-value
5553 @opindex Wunused-value
5554 @opindex Wno-unused-value
5555 Warn whenever a statement computes a result that is explicitly not
5556 used. To suppress this warning cast the unused expression to
5557 @code{void}. This includes an expression-statement or the left-hand
5558 side of a comma expression that contains no side effects. For example,
5559 an expression such as @code{x[i,j]} causes a warning, while
5560 @code{x[(void)i,j]} does not.
5561
5562 This warning is enabled by @option{-Wall}.
5563
5564 @item -Wunused
5565 @opindex Wunused
5566 @opindex Wno-unused
5567 All the above @option{-Wunused} options combined.
5568
5569 In order to get a warning about an unused function parameter, you must
5570 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5571 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5572
5573 @item -Wuninitialized
5574 @opindex Wuninitialized
5575 @opindex Wno-uninitialized
5576 Warn if an automatic variable is used without first being initialized
5577 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5578 warn if a non-static reference or non-static @code{const} member
5579 appears in a class without constructors.
5580
5581 If you want to warn about code that uses the uninitialized value of the
5582 variable in its own initializer, use the @option{-Winit-self} option.
5583
5584 These warnings occur for individual uninitialized or clobbered
5585 elements of structure, union or array variables as well as for
5586 variables that are uninitialized or clobbered as a whole. They do
5587 not occur for variables or elements declared @code{volatile}. Because
5588 these warnings depend on optimization, the exact variables or elements
5589 for which there are warnings depends on the precise optimization
5590 options and version of GCC used.
5591
5592 Note that there may be no warning about a variable that is used only
5593 to compute a value that itself is never used, because such
5594 computations may be deleted by data flow analysis before the warnings
5595 are printed.
5596
5597 @item -Winvalid-memory-model
5598 @opindex Winvalid-memory-model
5599 @opindex Wno-invalid-memory-model
5600 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5601 and the C11 atomic generic functions with a memory consistency argument
5602 that is either invalid for the operation or outside the range of values
5603 of the @code{memory_order} enumeration. For example, since the
5604 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5605 defined for the relaxed, release, and sequentially consistent memory
5606 orders the following code is diagnosed:
5607
5608 @smallexample
5609 void store (int *i)
5610 @{
5611 __atomic_store_n (i, 0, memory_order_consume);
5612 @}
5613 @end smallexample
5614
5615 @option{-Winvalid-memory-model} is enabled by default.
5616
5617 @item -Wmaybe-uninitialized
5618 @opindex Wmaybe-uninitialized
5619 @opindex Wno-maybe-uninitialized
5620 For an automatic (i.e.@: local) variable, if there exists a path from the
5621 function entry to a use of the variable that is initialized, but there exist
5622 some other paths for which the variable is not initialized, the compiler
5623 emits a warning if it cannot prove the uninitialized paths are not
5624 executed at run time.
5625
5626 These warnings are only possible in optimizing compilation, because otherwise
5627 GCC does not keep track of the state of variables.
5628
5629 These warnings are made optional because GCC may not be able to determine when
5630 the code is correct in spite of appearing to have an error. Here is one
5631 example of how this can happen:
5632
5633 @smallexample
5634 @group
5635 @{
5636 int x;
5637 switch (y)
5638 @{
5639 case 1: x = 1;
5640 break;
5641 case 2: x = 4;
5642 break;
5643 case 3: x = 5;
5644 @}
5645 foo (x);
5646 @}
5647 @end group
5648 @end smallexample
5649
5650 @noindent
5651 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5652 always initialized, but GCC doesn't know this. To suppress the
5653 warning, you need to provide a default case with assert(0) or
5654 similar code.
5655
5656 @cindex @code{longjmp} warnings
5657 This option also warns when a non-volatile automatic variable might be
5658 changed by a call to @code{longjmp}.
5659 The compiler sees only the calls to @code{setjmp}. It cannot know
5660 where @code{longjmp} will be called; in fact, a signal handler could
5661 call it at any point in the code. As a result, you may get a warning
5662 even when there is in fact no problem because @code{longjmp} cannot
5663 in fact be called at the place that would cause a problem.
5664
5665 Some spurious warnings can be avoided if you declare all the functions
5666 you use that never return as @code{noreturn}. @xref{Function
5667 Attributes}.
5668
5669 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5670
5671 @item -Wunknown-pragmas
5672 @opindex Wunknown-pragmas
5673 @opindex Wno-unknown-pragmas
5674 @cindex warning for unknown pragmas
5675 @cindex unknown pragmas, warning
5676 @cindex pragmas, warning of unknown
5677 Warn when a @code{#pragma} directive is encountered that is not understood by
5678 GCC@. If this command-line option is used, warnings are even issued
5679 for unknown pragmas in system header files. This is not the case if
5680 the warnings are only enabled by the @option{-Wall} command-line option.
5681
5682 @item -Wno-pragmas
5683 @opindex Wno-pragmas
5684 @opindex Wpragmas
5685 Do not warn about misuses of pragmas, such as incorrect parameters,
5686 invalid syntax, or conflicts between pragmas. See also
5687 @option{-Wunknown-pragmas}.
5688
5689 @item -Wno-prio-ctor-dtor
5690 @opindex Wno-prio-ctor-dtor
5691 @opindex Wprio-ctor-dtor
5692 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5693 The use of constructor and destructor attributes allow you to assign a
5694 priority to the constructor/destructor to control its order of execution
5695 before @code{main} is called or after it returns. The priority values must be
5696 greater than 100 as the compiler reserves priority values between 0--100 for
5697 the implementation.
5698
5699 @item -Wstrict-aliasing
5700 @opindex Wstrict-aliasing
5701 @opindex Wno-strict-aliasing
5702 This option is only active when @option{-fstrict-aliasing} is active.
5703 It warns about code that might break the strict aliasing rules that the
5704 compiler is using for optimization. The warning does not catch all
5705 cases, but does attempt to catch the more common pitfalls. It is
5706 included in @option{-Wall}.
5707 It is equivalent to @option{-Wstrict-aliasing=3}
5708
5709 @item -Wstrict-aliasing=n
5710 @opindex Wstrict-aliasing=n
5711 This option is only active when @option{-fstrict-aliasing} is active.
5712 It warns about code that might break the strict aliasing rules that the
5713 compiler is using for optimization.
5714 Higher levels correspond to higher accuracy (fewer false positives).
5715 Higher levels also correspond to more effort, similar to the way @option{-O}
5716 works.
5717 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5718
5719 Level 1: Most aggressive, quick, least accurate.
5720 Possibly useful when higher levels
5721 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5722 false negatives. However, it has many false positives.
5723 Warns for all pointer conversions between possibly incompatible types,
5724 even if never dereferenced. Runs in the front end only.
5725
5726 Level 2: Aggressive, quick, not too precise.
5727 May still have many false positives (not as many as level 1 though),
5728 and few false negatives (but possibly more than level 1).
5729 Unlike level 1, it only warns when an address is taken. Warns about
5730 incomplete types. Runs in the front end only.
5731
5732 Level 3 (default for @option{-Wstrict-aliasing}):
5733 Should have very few false positives and few false
5734 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5735 Takes care of the common pun+dereference pattern in the front end:
5736 @code{*(int*)&some_float}.
5737 If optimization is enabled, it also runs in the back end, where it deals
5738 with multiple statement cases using flow-sensitive points-to information.
5739 Only warns when the converted pointer is dereferenced.
5740 Does not warn about incomplete types.
5741
5742 @item -Wstrict-overflow
5743 @itemx -Wstrict-overflow=@var{n}
5744 @opindex Wstrict-overflow
5745 @opindex Wno-strict-overflow
5746 This option is only active when signed overflow is undefined.
5747 It warns about cases where the compiler optimizes based on the
5748 assumption that signed overflow does not occur. Note that it does not
5749 warn about all cases where the code might overflow: it only warns
5750 about cases where the compiler implements some optimization. Thus
5751 this warning depends on the optimization level.
5752
5753 An optimization that assumes that signed overflow does not occur is
5754 perfectly safe if the values of the variables involved are such that
5755 overflow never does, in fact, occur. Therefore this warning can
5756 easily give a false positive: a warning about code that is not
5757 actually a problem. To help focus on important issues, several
5758 warning levels are defined. No warnings are issued for the use of
5759 undefined signed overflow when estimating how many iterations a loop
5760 requires, in particular when determining whether a loop will be
5761 executed at all.
5762
5763 @table @gcctabopt
5764 @item -Wstrict-overflow=1
5765 Warn about cases that are both questionable and easy to avoid. For
5766 example the compiler simplifies
5767 @code{x + 1 > x} to @code{1}. This level of
5768 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5769 are not, and must be explicitly requested.
5770
5771 @item -Wstrict-overflow=2
5772 Also warn about other cases where a comparison is simplified to a
5773 constant. For example: @code{abs (x) >= 0}. This can only be
5774 simplified when signed integer overflow is undefined, because
5775 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5776 zero. @option{-Wstrict-overflow} (with no level) is the same as
5777 @option{-Wstrict-overflow=2}.
5778
5779 @item -Wstrict-overflow=3
5780 Also warn about other cases where a comparison is simplified. For
5781 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5782
5783 @item -Wstrict-overflow=4
5784 Also warn about other simplifications not covered by the above cases.
5785 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5786
5787 @item -Wstrict-overflow=5
5788 Also warn about cases where the compiler reduces the magnitude of a
5789 constant involved in a comparison. For example: @code{x + 2 > y} is
5790 simplified to @code{x + 1 >= y}. This is reported only at the
5791 highest warning level because this simplification applies to many
5792 comparisons, so this warning level gives a very large number of
5793 false positives.
5794 @end table
5795
5796 @item -Wstringop-overflow
5797 @itemx -Wstringop-overflow=@var{type}
5798 @opindex Wstringop-overflow
5799 @opindex Wno-stringop-overflow
5800 Warn for calls to string manipulation functions such as @code{memcpy} and
5801 @code{strcpy} that are determined to overflow the destination buffer. The
5802 optional argument is one greater than the type of Object Size Checking to
5803 perform to determine the size of the destination. @xref{Object Size Checking}.
5804 The argument is meaningful only for functions that operate on character arrays
5805 but not for raw memory functions like @code{memcpy} which always make use
5806 of Object Size type-0. The option also warns for calls that specify a size
5807 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5808 The option produces the best results with optimization enabled but can detect
5809 a small subset of simple buffer overflows even without optimization in
5810 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5811 correspond to the standard functions. In any case, the option warns about
5812 just a subset of buffer overflows detected by the corresponding overflow
5813 checking built-ins. For example, the option will issue a warning for
5814 the @code{strcpy} call below because it copies at least 5 characters
5815 (the string @code{"blue"} including the terminating NUL) into the buffer
5816 of size 4.
5817
5818 @smallexample
5819 enum Color @{ blue, purple, yellow @};
5820 const char* f (enum Color clr)
5821 @{
5822 static char buf [4];
5823 const char *str;
5824 switch (clr)
5825 @{
5826 case blue: str = "blue"; break;
5827 case purple: str = "purple"; break;
5828 case yellow: str = "yellow"; break;
5829 @}
5830
5831 return strcpy (buf, str); // warning here
5832 @}
5833 @end smallexample
5834
5835 Option @option{-Wstringop-overflow=2} is enabled by default.
5836
5837 @table @gcctabopt
5838 @item -Wstringop-overflow
5839 @itemx -Wstringop-overflow=1
5840 @opindex Wstringop-overflow
5841 @opindex Wno-stringop-overflow
5842 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5843 to determine the sizes of destination objects. This is the default setting
5844 of the option. At this setting the option will not warn for writes past
5845 the end of subobjects of larger objects accessed by pointers unless the
5846 size of the largest surrounding object is known. When the destination may
5847 be one of several objects it is assumed to be the largest one of them. On
5848 Linux systems, when optimization is enabled at this setting the option warns
5849 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5850 a non-zero value.
5851
5852 @item -Wstringop-overflow=2
5853 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5854 to determine the sizes of destination objects. At this setting the option
5855 will warn about overflows when writing to members of the largest complete
5856 objects whose exact size is known. It will, however, not warn for excessive
5857 writes to the same members of unknown objects referenced by pointers since
5858 they may point to arrays containing unknown numbers of elements.
5859
5860 @item -Wstringop-overflow=3
5861 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5862 to determine the sizes of destination objects. At this setting the option
5863 warns about overflowing the smallest object or data member. This is the
5864 most restrictive setting of the option that may result in warnings for safe
5865 code.
5866
5867 @item -Wstringop-overflow=4
5868 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5869 to determine the sizes of destination objects. At this setting the option
5870 will warn about overflowing any data members, and when the destination is
5871 one of several objects it uses the size of the largest of them to decide
5872 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5873 setting of the option may result in warnings for benign code.
5874 @end table
5875
5876 @item -Wstringop-truncation
5877 @opindex Wstringop-truncation
5878 @opindex Wno-stringop-truncation
5879 Warn for calls to bounded string manipulation functions such as @code{strncat},
5880 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5881 or leave the destination unchanged.
5882
5883 In the following example, the call to @code{strncat} specifies a bound that
5884 is less than the length of the source string. As a result, the copy of
5885 the source will be truncated and so the call is diagnosed. To avoid the
5886 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5887
5888 @smallexample
5889 void append (char *buf, size_t bufsize)
5890 @{
5891 strncat (buf, ".txt", 3);
5892 @}
5893 @end smallexample
5894
5895 As another example, the following call to @code{strncpy} results in copying
5896 to @code{d} just the characters preceding the terminating NUL, without
5897 appending the NUL to the end. Assuming the result of @code{strncpy} is
5898 necessarily a NUL-terminated string is a common mistake, and so the call
5899 is diagnosed. To avoid the warning when the result is not expected to be
5900 NUL-terminated, call @code{memcpy} instead.
5901
5902 @smallexample
5903 void copy (char *d, const char *s)
5904 @{
5905 strncpy (d, s, strlen (s));
5906 @}
5907 @end smallexample
5908
5909 In the following example, the call to @code{strncpy} specifies the size
5910 of the destination buffer as the bound. If the length of the source
5911 string is equal to or greater than this size the result of the copy will
5912 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5913 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5914 element of the buffer to @code{NUL}.
5915
5916 @smallexample
5917 void copy (const char *s)
5918 @{
5919 char buf[80];
5920 strncpy (buf, s, sizeof buf);
5921 @dots{}
5922 @}
5923 @end smallexample
5924
5925 In situations where a character array is intended to store a sequence
5926 of bytes with no terminating @code{NUL} such an array may be annotated
5927 with attribute @code{nonstring} to avoid this warning. Such arrays,
5928 however, are not suitable arguments to functions that expect
5929 @code{NUL}-terminated strings. To help detect accidental misuses of
5930 such arrays GCC issues warnings unless it can prove that the use is
5931 safe. @xref{Common Variable Attributes}.
5932
5933 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5934 @opindex Wsuggest-attribute=
5935 @opindex Wno-suggest-attribute=
5936 Warn for cases where adding an attribute may be beneficial. The
5937 attributes currently supported are listed below.
5938
5939 @table @gcctabopt
5940 @item -Wsuggest-attribute=pure
5941 @itemx -Wsuggest-attribute=const
5942 @itemx -Wsuggest-attribute=noreturn
5943 @itemx -Wmissing-noreturn
5944 @itemx -Wsuggest-attribute=malloc
5945 @opindex Wsuggest-attribute=pure
5946 @opindex Wno-suggest-attribute=pure
5947 @opindex Wsuggest-attribute=const
5948 @opindex Wno-suggest-attribute=const
5949 @opindex Wsuggest-attribute=noreturn
5950 @opindex Wno-suggest-attribute=noreturn
5951 @opindex Wmissing-noreturn
5952 @opindex Wno-missing-noreturn
5953 @opindex Wsuggest-attribute=malloc
5954 @opindex Wno-suggest-attribute=malloc
5955
5956 Warn about functions that might be candidates for attributes
5957 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5958 only warns for functions visible in other compilation units or (in the case of
5959 @code{pure} and @code{const}) if it cannot prove that the function returns
5960 normally. A function returns normally if it doesn't contain an infinite loop or
5961 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5962 requires option @option{-fipa-pure-const}, which is enabled by default at
5963 @option{-O} and higher. Higher optimization levels improve the accuracy
5964 of the analysis.
5965
5966 @item -Wsuggest-attribute=format
5967 @itemx -Wmissing-format-attribute
5968 @opindex Wsuggest-attribute=format
5969 @opindex Wmissing-format-attribute
5970 @opindex Wno-suggest-attribute=format
5971 @opindex Wno-missing-format-attribute
5972 @opindex Wformat
5973 @opindex Wno-format
5974
5975 Warn about function pointers that might be candidates for @code{format}
5976 attributes. Note these are only possible candidates, not absolute ones.
5977 GCC guesses that function pointers with @code{format} attributes that
5978 are used in assignment, initialization, parameter passing or return
5979 statements should have a corresponding @code{format} attribute in the
5980 resulting type. I.e.@: the left-hand side of the assignment or
5981 initialization, the type of the parameter variable, or the return type
5982 of the containing function respectively should also have a @code{format}
5983 attribute to avoid the warning.
5984
5985 GCC also warns about function definitions that might be
5986 candidates for @code{format} attributes. Again, these are only
5987 possible candidates. GCC guesses that @code{format} attributes
5988 might be appropriate for any function that calls a function like
5989 @code{vprintf} or @code{vscanf}, but this might not always be the
5990 case, and some functions for which @code{format} attributes are
5991 appropriate may not be detected.
5992
5993 @item -Wsuggest-attribute=cold
5994 @opindex Wsuggest-attribute=cold
5995 @opindex Wno-suggest-attribute=cold
5996
5997 Warn about functions that might be candidates for @code{cold} attribute. This
5998 is based on static detection and generally will only warn about functions which
5999 always leads to a call to another @code{cold} function such as wrappers of
6000 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6001 @end table
6002
6003 @item -Wsuggest-final-types
6004 @opindex Wno-suggest-final-types
6005 @opindex Wsuggest-final-types
6006 Warn about types with virtual methods where code quality would be improved
6007 if the type were declared with the C++11 @code{final} specifier,
6008 or, if possible,
6009 declared in an anonymous namespace. This allows GCC to more aggressively
6010 devirtualize the polymorphic calls. This warning is more effective with link
6011 time optimization, where the information about the class hierarchy graph is
6012 more complete.
6013
6014 @item -Wsuggest-final-methods
6015 @opindex Wno-suggest-final-methods
6016 @opindex Wsuggest-final-methods
6017 Warn about virtual methods where code quality would be improved if the method
6018 were declared with the C++11 @code{final} specifier,
6019 or, if possible, its type were
6020 declared in an anonymous namespace or with the @code{final} specifier.
6021 This warning is
6022 more effective with link-time optimization, where the information about the
6023 class hierarchy graph is more complete. It is recommended to first consider
6024 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6025 annotations.
6026
6027 @item -Wsuggest-override
6028 Warn about overriding virtual functions that are not marked with the override
6029 keyword.
6030
6031 @item -Walloc-zero
6032 @opindex Wno-alloc-zero
6033 @opindex Walloc-zero
6034 Warn about calls to allocation functions decorated with attribute
6035 @code{alloc_size} that specify zero bytes, including those to the built-in
6036 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6037 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6038 when called with a zero size differs among implementations (and in the case
6039 of @code{realloc} has been deprecated) relying on it may result in subtle
6040 portability bugs and should be avoided.
6041
6042 @item -Walloc-size-larger-than=@var{byte-size}
6043 @opindex Walloc-size-larger-than=
6044 @opindex Wno-alloc-size-larger-than
6045 Warn about calls to functions decorated with attribute @code{alloc_size}
6046 that attempt to allocate objects larger than the specified number of bytes,
6047 or where the result of the size computation in an integer type with infinite
6048 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6049 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6050 Warnings controlled by the option can be disabled either by specifying
6051 @var{byte-size} of @samp{SIZE_MAX} or more or by
6052 @option{-Wno-alloc-size-larger-than}.
6053 @xref{Function Attributes}.
6054
6055 @item -Wno-alloc-size-larger-than
6056 @opindex Wno-alloc-size-larger-than
6057 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6058 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6059 larger.
6060
6061 @item -Walloca
6062 @opindex Wno-alloca
6063 @opindex Walloca
6064 This option warns on all uses of @code{alloca} in the source.
6065
6066 @item -Walloca-larger-than=@var{byte-size}
6067 @opindex Walloca-larger-than=
6068 @opindex Wno-alloca-larger-than
6069 This option warns on calls to @code{alloca} with an integer argument whose
6070 value is either zero, or that is not bounded by a controlling predicate
6071 that limits its value to at most @var{byte-size}. It also warns for calls
6072 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6073 types are considered unbounded even if they appear to be constrained to
6074 the expected range.
6075
6076 For example, a bounded case of @code{alloca} could be:
6077
6078 @smallexample
6079 void func (size_t n)
6080 @{
6081 void *p;
6082 if (n <= 1000)
6083 p = alloca (n);
6084 else
6085 p = malloc (n);
6086 f (p);
6087 @}
6088 @end smallexample
6089
6090 In the above example, passing @code{-Walloca-larger-than=1000} would not
6091 issue a warning because the call to @code{alloca} is known to be at most
6092 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6093 the compiler would emit a warning.
6094
6095 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6096 controlling predicate constraining its integer argument. For example:
6097
6098 @smallexample
6099 void func ()
6100 @{
6101 void *p = alloca (n);
6102 f (p);
6103 @}
6104 @end smallexample
6105
6106 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6107 a warning, but this time because of the lack of bounds checking.
6108
6109 Note, that even seemingly correct code involving signed integers could
6110 cause a warning:
6111
6112 @smallexample
6113 void func (signed int n)
6114 @{
6115 if (n < 500)
6116 @{
6117 p = alloca (n);
6118 f (p);
6119 @}
6120 @}
6121 @end smallexample
6122
6123 In the above example, @var{n} could be negative, causing a larger than
6124 expected argument to be implicitly cast into the @code{alloca} call.
6125
6126 This option also warns when @code{alloca} is used in a loop.
6127
6128 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6129 but is usually only effective when @option{-ftree-vrp} is active (default
6130 for @option{-O2} and above).
6131
6132 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6133
6134 @item -Wno-alloca-larger-than
6135 @opindex Wno-alloca-larger-than
6136 Disable @option{-Walloca-larger-than=} warnings. The option is
6137 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6138
6139 @item -Warray-bounds
6140 @itemx -Warray-bounds=@var{n}
6141 @opindex Wno-array-bounds
6142 @opindex Warray-bounds
6143 This option is only active when @option{-ftree-vrp} is active
6144 (default for @option{-O2} and above). It warns about subscripts to arrays
6145 that are always out of bounds. This warning is enabled by @option{-Wall}.
6146
6147 @table @gcctabopt
6148 @item -Warray-bounds=1
6149 This is the warning level of @option{-Warray-bounds} and is enabled
6150 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6151
6152 @item -Warray-bounds=2
6153 This warning level also warns about out of bounds access for
6154 arrays at the end of a struct and for arrays accessed through
6155 pointers. This warning level may give a larger number of
6156 false positives and is deactivated by default.
6157 @end table
6158
6159 @item -Wattribute-alias=@var{n}
6160 @itemx -Wno-attribute-alias
6161 @opindex Wattribute-alias
6162 @opindex Wno-attribute-alias
6163 Warn about declarations using the @code{alias} and similar attributes whose
6164 target is incompatible with the type of the alias.
6165 @xref{Function Attributes,,Declaring Attributes of Functions}.
6166
6167 @table @gcctabopt
6168 @item -Wattribute-alias=1
6169 The default warning level of the @option{-Wattribute-alias} option diagnoses
6170 incompatibilities between the type of the alias declaration and that of its
6171 target. Such incompatibilities are typically indicative of bugs.
6172
6173 @item -Wattribute-alias=2
6174
6175 At this level @option{-Wattribute-alias} also diagnoses cases where
6176 the attributes of the alias declaration are more restrictive than the
6177 attributes applied to its target. These mismatches can potentially
6178 result in incorrect code generation. In other cases they may be
6179 benign and could be resolved simply by adding the missing attribute to
6180 the target. For comparison, see the @option{-Wmissing-attributes}
6181 option, which controls diagnostics when the alias declaration is less
6182 restrictive than the target, rather than more restrictive.
6183
6184 Attributes considered include @code{alloc_align}, @code{alloc_size},
6185 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6186 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6187 @code{returns_nonnull}, and @code{returns_twice}.
6188 @end table
6189
6190 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6191 This is the default. You can disable these warnings with either
6192 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6193
6194 @item -Wbool-compare
6195 @opindex Wno-bool-compare
6196 @opindex Wbool-compare
6197 Warn about boolean expression compared with an integer value different from
6198 @code{true}/@code{false}. For instance, the following comparison is
6199 always false:
6200 @smallexample
6201 int n = 5;
6202 @dots{}
6203 if ((n > 1) == 2) @{ @dots{} @}
6204 @end smallexample
6205 This warning is enabled by @option{-Wall}.
6206
6207 @item -Wbool-operation
6208 @opindex Wno-bool-operation
6209 @opindex Wbool-operation
6210 Warn about suspicious operations on expressions of a boolean type. For
6211 instance, bitwise negation of a boolean is very likely a bug in the program.
6212 For C, this warning also warns about incrementing or decrementing a boolean,
6213 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6214 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6215
6216 This warning is enabled by @option{-Wall}.
6217
6218 @item -Wduplicated-branches
6219 @opindex Wno-duplicated-branches
6220 @opindex Wduplicated-branches
6221 Warn when an if-else has identical branches. This warning detects cases like
6222 @smallexample
6223 if (p != NULL)
6224 return 0;
6225 else
6226 return 0;
6227 @end smallexample
6228 It doesn't warn when both branches contain just a null statement. This warning
6229 also warn for conditional operators:
6230 @smallexample
6231 int i = x ? *p : *p;
6232 @end smallexample
6233
6234 @item -Wduplicated-cond
6235 @opindex Wno-duplicated-cond
6236 @opindex Wduplicated-cond
6237 Warn about duplicated conditions in an if-else-if chain. For instance,
6238 warn for the following code:
6239 @smallexample
6240 if (p->q != NULL) @{ @dots{} @}
6241 else if (p->q != NULL) @{ @dots{} @}
6242 @end smallexample
6243
6244 @item -Wframe-address
6245 @opindex Wno-frame-address
6246 @opindex Wframe-address
6247 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6248 is called with an argument greater than 0. Such calls may return indeterminate
6249 values or crash the program. The warning is included in @option{-Wall}.
6250
6251 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6252 @opindex Wno-discarded-qualifiers
6253 @opindex Wdiscarded-qualifiers
6254 Do not warn if type qualifiers on pointers are being discarded.
6255 Typically, the compiler warns if a @code{const char *} variable is
6256 passed to a function that takes a @code{char *} parameter. This option
6257 can be used to suppress such a warning.
6258
6259 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6260 @opindex Wno-discarded-array-qualifiers
6261 @opindex Wdiscarded-array-qualifiers
6262 Do not warn if type qualifiers on arrays which are pointer targets
6263 are being discarded. Typically, the compiler warns if a
6264 @code{const int (*)[]} variable is passed to a function that
6265 takes a @code{int (*)[]} parameter. This option can be used to
6266 suppress such a warning.
6267
6268 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6269 @opindex Wno-incompatible-pointer-types
6270 @opindex Wincompatible-pointer-types
6271 Do not warn when there is a conversion between pointers that have incompatible
6272 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6273 which warns for pointer argument passing or assignment with different
6274 signedness.
6275
6276 @item -Wno-int-conversion @r{(C and Objective-C only)}
6277 @opindex Wno-int-conversion
6278 @opindex Wint-conversion
6279 Do not warn about incompatible integer to pointer and pointer to integer
6280 conversions. This warning is about implicit conversions; for explicit
6281 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6282 @option{-Wno-pointer-to-int-cast} may be used.
6283
6284 @item -Wno-div-by-zero
6285 @opindex Wno-div-by-zero
6286 @opindex Wdiv-by-zero
6287 Do not warn about compile-time integer division by zero. Floating-point
6288 division by zero is not warned about, as it can be a legitimate way of
6289 obtaining infinities and NaNs.
6290
6291 @item -Wsystem-headers
6292 @opindex Wsystem-headers
6293 @opindex Wno-system-headers
6294 @cindex warnings from system headers
6295 @cindex system headers, warnings from
6296 Print warning messages for constructs found in system header files.
6297 Warnings from system headers are normally suppressed, on the assumption
6298 that they usually do not indicate real problems and would only make the
6299 compiler output harder to read. Using this command-line option tells
6300 GCC to emit warnings from system headers as if they occurred in user
6301 code. However, note that using @option{-Wall} in conjunction with this
6302 option does @emph{not} warn about unknown pragmas in system
6303 headers---for that, @option{-Wunknown-pragmas} must also be used.
6304
6305 @item -Wtautological-compare
6306 @opindex Wtautological-compare
6307 @opindex Wno-tautological-compare
6308 Warn if a self-comparison always evaluates to true or false. This
6309 warning detects various mistakes such as:
6310 @smallexample
6311 int i = 1;
6312 @dots{}
6313 if (i > i) @{ @dots{} @}
6314 @end smallexample
6315
6316 This warning also warns about bitwise comparisons that always evaluate
6317 to true or false, for instance:
6318 @smallexample
6319 if ((a & 16) == 10) @{ @dots{} @}
6320 @end smallexample
6321 will always be false.
6322
6323 This warning is enabled by @option{-Wall}.
6324
6325 @item -Wtrampolines
6326 @opindex Wtrampolines
6327 @opindex Wno-trampolines
6328 Warn about trampolines generated for pointers to nested functions.
6329 A trampoline is a small piece of data or code that is created at run
6330 time on the stack when the address of a nested function is taken, and is
6331 used to call the nested function indirectly. For some targets, it is
6332 made up of data only and thus requires no special treatment. But, for
6333 most targets, it is made up of code and thus requires the stack to be
6334 made executable in order for the program to work properly.
6335
6336 @item -Wfloat-equal
6337 @opindex Wfloat-equal
6338 @opindex Wno-float-equal
6339 Warn if floating-point values are used in equality comparisons.
6340
6341 The idea behind this is that sometimes it is convenient (for the
6342 programmer) to consider floating-point values as approximations to
6343 infinitely precise real numbers. If you are doing this, then you need
6344 to compute (by analyzing the code, or in some other way) the maximum or
6345 likely maximum error that the computation introduces, and allow for it
6346 when performing comparisons (and when producing output, but that's a
6347 different problem). In particular, instead of testing for equality, you
6348 should check to see whether the two values have ranges that overlap; and
6349 this is done with the relational operators, so equality comparisons are
6350 probably mistaken.
6351
6352 @item -Wtraditional @r{(C and Objective-C only)}
6353 @opindex Wtraditional
6354 @opindex Wno-traditional
6355 Warn about certain constructs that behave differently in traditional and
6356 ISO C@. Also warn about ISO C constructs that have no traditional C
6357 equivalent, and/or problematic constructs that should be avoided.
6358
6359 @itemize @bullet
6360 @item
6361 Macro parameters that appear within string literals in the macro body.
6362 In traditional C macro replacement takes place within string literals,
6363 but in ISO C it does not.
6364
6365 @item
6366 In traditional C, some preprocessor directives did not exist.
6367 Traditional preprocessors only considered a line to be a directive
6368 if the @samp{#} appeared in column 1 on the line. Therefore
6369 @option{-Wtraditional} warns about directives that traditional C
6370 understands but ignores because the @samp{#} does not appear as the
6371 first character on the line. It also suggests you hide directives like
6372 @code{#pragma} not understood by traditional C by indenting them. Some
6373 traditional implementations do not recognize @code{#elif}, so this option
6374 suggests avoiding it altogether.
6375
6376 @item
6377 A function-like macro that appears without arguments.
6378
6379 @item
6380 The unary plus operator.
6381
6382 @item
6383 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6384 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6385 constants.) Note, these suffixes appear in macros defined in the system
6386 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6387 Use of these macros in user code might normally lead to spurious
6388 warnings, however GCC's integrated preprocessor has enough context to
6389 avoid warning in these cases.
6390
6391 @item
6392 A function declared external in one block and then used after the end of
6393 the block.
6394
6395 @item
6396 A @code{switch} statement has an operand of type @code{long}.
6397
6398 @item
6399 A non-@code{static} function declaration follows a @code{static} one.
6400 This construct is not accepted by some traditional C compilers.
6401
6402 @item
6403 The ISO type of an integer constant has a different width or
6404 signedness from its traditional type. This warning is only issued if
6405 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6406 typically represent bit patterns, are not warned about.
6407
6408 @item
6409 Usage of ISO string concatenation is detected.
6410
6411 @item
6412 Initialization of automatic aggregates.
6413
6414 @item
6415 Identifier conflicts with labels. Traditional C lacks a separate
6416 namespace for labels.
6417
6418 @item
6419 Initialization of unions. If the initializer is zero, the warning is
6420 omitted. This is done under the assumption that the zero initializer in
6421 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6422 initializer warnings and relies on default initialization to zero in the
6423 traditional C case.
6424
6425 @item
6426 Conversions by prototypes between fixed/floating-point values and vice
6427 versa. The absence of these prototypes when compiling with traditional
6428 C causes serious problems. This is a subset of the possible
6429 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6430
6431 @item
6432 Use of ISO C style function definitions. This warning intentionally is
6433 @emph{not} issued for prototype declarations or variadic functions
6434 because these ISO C features appear in your code when using
6435 libiberty's traditional C compatibility macros, @code{PARAMS} and
6436 @code{VPARAMS}. This warning is also bypassed for nested functions
6437 because that feature is already a GCC extension and thus not relevant to
6438 traditional C compatibility.
6439 @end itemize
6440
6441 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6442 @opindex Wtraditional-conversion
6443 @opindex Wno-traditional-conversion
6444 Warn if a prototype causes a type conversion that is different from what
6445 would happen to the same argument in the absence of a prototype. This
6446 includes conversions of fixed point to floating and vice versa, and
6447 conversions changing the width or signedness of a fixed-point argument
6448 except when the same as the default promotion.
6449
6450 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6451 @opindex Wdeclaration-after-statement
6452 @opindex Wno-declaration-after-statement
6453 Warn when a declaration is found after a statement in a block. This
6454 construct, known from C++, was introduced with ISO C99 and is by default
6455 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6456
6457 @item -Wshadow
6458 @opindex Wshadow
6459 @opindex Wno-shadow
6460 Warn whenever a local variable or type declaration shadows another
6461 variable, parameter, type, class member (in C++), or instance variable
6462 (in Objective-C) or whenever a built-in function is shadowed. Note
6463 that in C++, the compiler warns if a local variable shadows an
6464 explicit typedef, but not if it shadows a struct/class/enum.
6465 Same as @option{-Wshadow=global}.
6466
6467 @item -Wno-shadow-ivar @r{(Objective-C only)}
6468 @opindex Wno-shadow-ivar
6469 @opindex Wshadow-ivar
6470 Do not warn whenever a local variable shadows an instance variable in an
6471 Objective-C method.
6472
6473 @item -Wshadow=global
6474 @opindex Wshadow=local
6475 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6476
6477 @item -Wshadow=local
6478 @opindex Wshadow=local
6479 Warn when a local variable shadows another local variable or parameter.
6480 This warning is enabled by @option{-Wshadow=global}.
6481
6482 @item -Wshadow=compatible-local
6483 @opindex Wshadow=compatible-local
6484 Warn when a local variable shadows another local variable or parameter
6485 whose type is compatible with that of the shadowing variable. In C++,
6486 type compatibility here means the type of the shadowing variable can be
6487 converted to that of the shadowed variable. The creation of this flag
6488 (in addition to @option{-Wshadow=local}) is based on the idea that when
6489 a local variable shadows another one of incompatible type, it is most
6490 likely intentional, not a bug or typo, as shown in the following example:
6491
6492 @smallexample
6493 @group
6494 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6495 @{
6496 for (int i = 0; i < N; ++i)
6497 @{
6498 ...
6499 @}
6500 ...
6501 @}
6502 @end group
6503 @end smallexample
6504
6505 Since the two variable @code{i} in the example above have incompatible types,
6506 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6507 Because their types are incompatible, if a programmer accidentally uses one
6508 in place of the other, type checking will catch that and emit an error or
6509 warning. So not warning (about shadowing) in this case will not lead to
6510 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6511 possibly reduce the number of warnings triggered by intentional shadowing.
6512
6513 This warning is enabled by @option{-Wshadow=local}.
6514
6515 @item -Wlarger-than=@var{byte-size}
6516 @opindex Wlarger-than=
6517 @opindex Wlarger-than-@var{byte-size}
6518 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6519 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6520 Warnings controlled by the option can be disabled either by specifying
6521 @var{byte-size} of @samp{SIZE_MAX} or more or by
6522 @option{-Wno-larger-than}.
6523
6524 @item -Wno-larger-than
6525 @opindex Wno-larger-than
6526 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6527 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6528
6529 @item -Wframe-larger-than=@var{byte-size}
6530 @opindex Wframe-larger-than=
6531 @opindex Wno-frame-larger-than
6532 Warn if the size of a function frame exceeds @var{byte-size}.
6533 The computation done to determine the stack frame size is approximate
6534 and not conservative.
6535 The actual requirements may be somewhat greater than @var{byte-size}
6536 even if you do not get a warning. In addition, any space allocated
6537 via @code{alloca}, variable-length arrays, or related constructs
6538 is not included by the compiler when determining
6539 whether or not to issue a warning.
6540 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6541 Warnings controlled by the option can be disabled either by specifying
6542 @var{byte-size} of @samp{SIZE_MAX} or more or by
6543 @option{-Wno-frame-larger-than}.
6544
6545 @item -Wno-frame-larger-than
6546 @opindex Wno-frame-larger-than
6547 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6548 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6549
6550 @item -Wno-free-nonheap-object
6551 @opindex Wno-free-nonheap-object
6552 @opindex Wfree-nonheap-object
6553 Do not warn when attempting to free an object that was not allocated
6554 on the heap.
6555
6556 @item -Wstack-usage=@var{byte-size}
6557 @opindex Wstack-usage
6558 @opindex Wno-stack-usage
6559 Warn if the stack usage of a function might exceed @var{byte-size}.
6560 The computation done to determine the stack usage is conservative.
6561 Any space allocated via @code{alloca}, variable-length arrays, or related
6562 constructs is included by the compiler when determining whether or not to
6563 issue a warning.
6564
6565 The message is in keeping with the output of @option{-fstack-usage}.
6566
6567 @itemize
6568 @item
6569 If the stack usage is fully static but exceeds the specified amount, it's:
6570
6571 @smallexample
6572 warning: stack usage is 1120 bytes
6573 @end smallexample
6574 @item
6575 If the stack usage is (partly) dynamic but bounded, it's:
6576
6577 @smallexample
6578 warning: stack usage might be 1648 bytes
6579 @end smallexample
6580 @item
6581 If the stack usage is (partly) dynamic and not bounded, it's:
6582
6583 @smallexample
6584 warning: stack usage might be unbounded
6585 @end smallexample
6586 @end itemize
6587
6588 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6589 Warnings controlled by the option can be disabled either by specifying
6590 @var{byte-size} of @samp{SIZE_MAX} or more or by
6591 @option{-Wno-stack-usage}.
6592
6593 @item -Wno-stack-usage
6594 @opindex Wno-stack-usage
6595 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6596 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6597
6598 @item -Wunsafe-loop-optimizations
6599 @opindex Wunsafe-loop-optimizations
6600 @opindex Wno-unsafe-loop-optimizations
6601 Warn if the loop cannot be optimized because the compiler cannot
6602 assume anything on the bounds of the loop indices. With
6603 @option{-funsafe-loop-optimizations} warn if the compiler makes
6604 such assumptions.
6605
6606 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6607 @opindex Wno-pedantic-ms-format
6608 @opindex Wpedantic-ms-format
6609 When used in combination with @option{-Wformat}
6610 and @option{-pedantic} without GNU extensions, this option
6611 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6612 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6613 which depend on the MS runtime.
6614
6615 @item -Waligned-new
6616 @opindex Waligned-new
6617 @opindex Wno-aligned-new
6618 Warn about a new-expression of a type that requires greater alignment
6619 than the @code{alignof(std::max_align_t)} but uses an allocation
6620 function without an explicit alignment parameter. This option is
6621 enabled by @option{-Wall}.
6622
6623 Normally this only warns about global allocation functions, but
6624 @option{-Waligned-new=all} also warns about class member allocation
6625 functions.
6626
6627 @item -Wplacement-new
6628 @itemx -Wplacement-new=@var{n}
6629 @opindex Wplacement-new
6630 @opindex Wno-placement-new
6631 Warn about placement new expressions with undefined behavior, such as
6632 constructing an object in a buffer that is smaller than the type of
6633 the object. For example, the placement new expression below is diagnosed
6634 because it attempts to construct an array of 64 integers in a buffer only
6635 64 bytes large.
6636 @smallexample
6637 char buf [64];
6638 new (buf) int[64];
6639 @end smallexample
6640 This warning is enabled by default.
6641
6642 @table @gcctabopt
6643 @item -Wplacement-new=1
6644 This is the default warning level of @option{-Wplacement-new}. At this
6645 level the warning is not issued for some strictly undefined constructs that
6646 GCC allows as extensions for compatibility with legacy code. For example,
6647 the following @code{new} expression is not diagnosed at this level even
6648 though it has undefined behavior according to the C++ standard because
6649 it writes past the end of the one-element array.
6650 @smallexample
6651 struct S @{ int n, a[1]; @};
6652 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6653 new (s->a)int [32]();
6654 @end smallexample
6655
6656 @item -Wplacement-new=2
6657 At this level, in addition to diagnosing all the same constructs as at level
6658 1, a diagnostic is also issued for placement new expressions that construct
6659 an object in the last member of structure whose type is an array of a single
6660 element and whose size is less than the size of the object being constructed.
6661 While the previous example would be diagnosed, the following construct makes
6662 use of the flexible member array extension to avoid the warning at level 2.
6663 @smallexample
6664 struct S @{ int n, a[]; @};
6665 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6666 new (s->a)int [32]();
6667 @end smallexample
6668
6669 @end table
6670
6671 @item -Wpointer-arith
6672 @opindex Wpointer-arith
6673 @opindex Wno-pointer-arith
6674 Warn about anything that depends on the ``size of'' a function type or
6675 of @code{void}. GNU C assigns these types a size of 1, for
6676 convenience in calculations with @code{void *} pointers and pointers
6677 to functions. In C++, warn also when an arithmetic operation involves
6678 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6679
6680 @item -Wpointer-compare
6681 @opindex Wpointer-compare
6682 @opindex Wno-pointer-compare
6683 Warn if a pointer is compared with a zero character constant. This usually
6684 means that the pointer was meant to be dereferenced. For example:
6685
6686 @smallexample
6687 const char *p = foo ();
6688 if (p == '\0')
6689 return 42;
6690 @end smallexample
6691
6692 Note that the code above is invalid in C++11.
6693
6694 This warning is enabled by default.
6695
6696 @item -Wtype-limits
6697 @opindex Wtype-limits
6698 @opindex Wno-type-limits
6699 Warn if a comparison is always true or always false due to the limited
6700 range of the data type, but do not warn for constant expressions. For
6701 example, warn if an unsigned variable is compared against zero with
6702 @code{<} or @code{>=}. This warning is also enabled by
6703 @option{-Wextra}.
6704
6705 @item -Wabsolute-value @r{(C and Objective-C only)}
6706 @opindex Wabsolute-value
6707 @opindex Wno-absolute-value
6708 Warn for calls to standard functions that compute the absolute value
6709 of an argument when a more appropriate standard function is available.
6710 For example, calling @code{abs(3.14)} triggers the warning because the
6711 appropriate function to call to compute the absolute value of a double
6712 argument is @code{fabs}. The option also triggers warnings when the
6713 argument in a call to such a function has an unsigned type. This
6714 warning can be suppressed with an explicit type cast and it is also
6715 enabled by @option{-Wextra}.
6716
6717 @include cppwarnopts.texi
6718
6719 @item -Wbad-function-cast @r{(C and Objective-C only)}
6720 @opindex Wbad-function-cast
6721 @opindex Wno-bad-function-cast
6722 Warn when a function call is cast to a non-matching type.
6723 For example, warn if a call to a function returning an integer type
6724 is cast to a pointer type.
6725
6726 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6727 @opindex Wc90-c99-compat
6728 @opindex Wno-c90-c99-compat
6729 Warn about features not present in ISO C90, but present in ISO C99.
6730 For instance, warn about use of variable length arrays, @code{long long}
6731 type, @code{bool} type, compound literals, designated initializers, and so
6732 on. This option is independent of the standards mode. Warnings are disabled
6733 in the expression that follows @code{__extension__}.
6734
6735 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6736 @opindex Wc99-c11-compat
6737 @opindex Wno-c99-c11-compat
6738 Warn about features not present in ISO C99, but present in ISO C11.
6739 For instance, warn about use of anonymous structures and unions,
6740 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6741 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6742 and so on. This option is independent of the standards mode. Warnings are
6743 disabled in the expression that follows @code{__extension__}.
6744
6745 @item -Wc++-compat @r{(C and Objective-C only)}
6746 @opindex Wc++-compat
6747 @opindex Wno-c++-compat
6748 Warn about ISO C constructs that are outside of the common subset of
6749 ISO C and ISO C++, e.g.@: request for implicit conversion from
6750 @code{void *} to a pointer to non-@code{void} type.
6751
6752 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6753 @opindex Wc++11-compat
6754 @opindex Wno-c++11-compat
6755 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6756 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6757 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6758 enabled by @option{-Wall}.
6759
6760 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6761 @opindex Wc++14-compat
6762 @opindex Wno-c++14-compat
6763 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6764 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6765
6766 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6767 @opindex Wc++17-compat
6768 @opindex Wno-c++17-compat
6769 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6770 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6771
6772 @item -Wcast-qual
6773 @opindex Wcast-qual
6774 @opindex Wno-cast-qual
6775 Warn whenever a pointer is cast so as to remove a type qualifier from
6776 the target type. For example, warn if a @code{const char *} is cast
6777 to an ordinary @code{char *}.
6778
6779 Also warn when making a cast that introduces a type qualifier in an
6780 unsafe way. For example, casting @code{char **} to @code{const char **}
6781 is unsafe, as in this example:
6782
6783 @smallexample
6784 /* p is char ** value. */
6785 const char **q = (const char **) p;
6786 /* Assignment of readonly string to const char * is OK. */
6787 *q = "string";
6788 /* Now char** pointer points to read-only memory. */
6789 **p = 'b';
6790 @end smallexample
6791
6792 @item -Wcast-align
6793 @opindex Wcast-align
6794 @opindex Wno-cast-align
6795 Warn whenever a pointer is cast such that the required alignment of the
6796 target is increased. For example, warn if a @code{char *} is cast to
6797 an @code{int *} on machines where integers can only be accessed at
6798 two- or four-byte boundaries.
6799
6800 @item -Wcast-align=strict
6801 @opindex Wcast-align=strict
6802 Warn whenever a pointer is cast such that the required alignment of the
6803 target is increased. For example, warn if a @code{char *} is cast to
6804 an @code{int *} regardless of the target machine.
6805
6806 @item -Wcast-function-type
6807 @opindex Wcast-function-type
6808 @opindex Wno-cast-function-type
6809 Warn when a function pointer is cast to an incompatible function pointer.
6810 In a cast involving function types with a variable argument list only
6811 the types of initial arguments that are provided are considered.
6812 Any parameter of pointer-type matches any other pointer-type. Any benign
6813 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6814 on ILP32 targets. Likewise type qualifiers are ignored. The function
6815 type @code{void (*) (void)} is special and matches everything, which can
6816 be used to suppress this warning.
6817 In a cast involving pointer to member types this warning warns whenever
6818 the type cast is changing the pointer to member type.
6819 This warning is enabled by @option{-Wextra}.
6820
6821 @item -Wwrite-strings
6822 @opindex Wwrite-strings
6823 @opindex Wno-write-strings
6824 When compiling C, give string constants the type @code{const
6825 char[@var{length}]} so that copying the address of one into a
6826 non-@code{const} @code{char *} pointer produces a warning. These
6827 warnings help you find at compile time code that can try to write
6828 into a string constant, but only if you have been very careful about
6829 using @code{const} in declarations and prototypes. Otherwise, it is
6830 just a nuisance. This is why we did not make @option{-Wall} request
6831 these warnings.
6832
6833 When compiling C++, warn about the deprecated conversion from string
6834 literals to @code{char *}. This warning is enabled by default for C++
6835 programs.
6836
6837 @item -Wcatch-value
6838 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6839 @opindex Wcatch-value
6840 @opindex Wno-catch-value
6841 Warn about catch handlers that do not catch via reference.
6842 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6843 warn about polymorphic class types that are caught by value.
6844 With @option{-Wcatch-value=2} warn about all class types that are caught
6845 by value. With @option{-Wcatch-value=3} warn about all types that are
6846 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6847
6848 @item -Wclobbered
6849 @opindex Wclobbered
6850 @opindex Wno-clobbered
6851 Warn for variables that might be changed by @code{longjmp} or
6852 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6853
6854 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6855 @opindex Wconditionally-supported
6856 @opindex Wno-conditionally-supported
6857 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6858
6859 @item -Wconversion
6860 @opindex Wconversion
6861 @opindex Wno-conversion
6862 Warn for implicit conversions that may alter a value. This includes
6863 conversions between real and integer, like @code{abs (x)} when
6864 @code{x} is @code{double}; conversions between signed and unsigned,
6865 like @code{unsigned ui = -1}; and conversions to smaller types, like
6866 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6867 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6868 changed by the conversion like in @code{abs (2.0)}. Warnings about
6869 conversions between signed and unsigned integers can be disabled by
6870 using @option{-Wno-sign-conversion}.
6871
6872 For C++, also warn for confusing overload resolution for user-defined
6873 conversions; and conversions that never use a type conversion
6874 operator: conversions to @code{void}, the same type, a base class or a
6875 reference to them. Warnings about conversions between signed and
6876 unsigned integers are disabled by default in C++ unless
6877 @option{-Wsign-conversion} is explicitly enabled.
6878
6879 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6880 @opindex Wconversion-null
6881 @opindex Wno-conversion-null
6882 Do not warn for conversions between @code{NULL} and non-pointer
6883 types. @option{-Wconversion-null} is enabled by default.
6884
6885 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6886 @opindex Wzero-as-null-pointer-constant
6887 @opindex Wno-zero-as-null-pointer-constant
6888 Warn when a literal @samp{0} is used as null pointer constant. This can
6889 be useful to facilitate the conversion to @code{nullptr} in C++11.
6890
6891 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6892 @opindex Wsubobject-linkage
6893 @opindex Wno-subobject-linkage
6894 Warn if a class type has a base or a field whose type uses the anonymous
6895 namespace or depends on a type with no linkage. If a type A depends on
6896 a type B with no or internal linkage, defining it in multiple
6897 translation units would be an ODR violation because the meaning of B
6898 is different in each translation unit. If A only appears in a single
6899 translation unit, the best way to silence the warning is to give it
6900 internal linkage by putting it in an anonymous namespace as well. The
6901 compiler doesn't give this warning for types defined in the main .C
6902 file, as those are unlikely to have multiple definitions.
6903 @option{-Wsubobject-linkage} is enabled by default.
6904
6905 @item -Wdangling-else
6906 @opindex Wdangling-else
6907 @opindex Wno-dangling-else
6908 Warn about constructions where there may be confusion to which
6909 @code{if} statement an @code{else} branch belongs. Here is an example of
6910 such a case:
6911
6912 @smallexample
6913 @group
6914 @{
6915 if (a)
6916 if (b)
6917 foo ();
6918 else
6919 bar ();
6920 @}
6921 @end group
6922 @end smallexample
6923
6924 In C/C++, every @code{else} branch belongs to the innermost possible
6925 @code{if} statement, which in this example is @code{if (b)}. This is
6926 often not what the programmer expected, as illustrated in the above
6927 example by indentation the programmer chose. When there is the
6928 potential for this confusion, GCC issues a warning when this flag
6929 is specified. To eliminate the warning, add explicit braces around
6930 the innermost @code{if} statement so there is no way the @code{else}
6931 can belong to the enclosing @code{if}. The resulting code
6932 looks like this:
6933
6934 @smallexample
6935 @group
6936 @{
6937 if (a)
6938 @{
6939 if (b)
6940 foo ();
6941 else
6942 bar ();
6943 @}
6944 @}
6945 @end group
6946 @end smallexample
6947
6948 This warning is enabled by @option{-Wparentheses}.
6949
6950 @item -Wdate-time
6951 @opindex Wdate-time
6952 @opindex Wno-date-time
6953 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6954 are encountered as they might prevent bit-wise-identical reproducible
6955 compilations.
6956
6957 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6958 @opindex Wdelete-incomplete
6959 @opindex Wno-delete-incomplete
6960 Warn when deleting a pointer to incomplete type, which may cause
6961 undefined behavior at runtime. This warning is enabled by default.
6962
6963 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6964 @opindex Wuseless-cast
6965 @opindex Wno-useless-cast
6966 Warn when an expression is casted to its own type.
6967
6968 @item -Wempty-body
6969 @opindex Wempty-body
6970 @opindex Wno-empty-body
6971 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6972 while} statement. This warning is also enabled by @option{-Wextra}.
6973
6974 @item -Wenum-compare
6975 @opindex Wenum-compare
6976 @opindex Wno-enum-compare
6977 Warn about a comparison between values of different enumerated types.
6978 In C++ enumerated type mismatches in conditional expressions are also
6979 diagnosed and the warning is enabled by default. In C this warning is
6980 enabled by @option{-Wall}.
6981
6982 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6983 @opindex Wextra-semi
6984 @opindex Wno-extra-semi
6985 Warn about redundant semicolon after in-class function definition.
6986
6987 @item -Wjump-misses-init @r{(C, Objective-C only)}
6988 @opindex Wjump-misses-init
6989 @opindex Wno-jump-misses-init
6990 Warn if a @code{goto} statement or a @code{switch} statement jumps
6991 forward across the initialization of a variable, or jumps backward to a
6992 label after the variable has been initialized. This only warns about
6993 variables that are initialized when they are declared. This warning is
6994 only supported for C and Objective-C; in C++ this sort of branch is an
6995 error in any case.
6996
6997 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6998 can be disabled with the @option{-Wno-jump-misses-init} option.
6999
7000 @item -Wsign-compare
7001 @opindex Wsign-compare
7002 @opindex Wno-sign-compare
7003 @cindex warning for comparison of signed and unsigned values
7004 @cindex comparison of signed and unsigned values, warning
7005 @cindex signed and unsigned values, comparison warning
7006 Warn when a comparison between signed and unsigned values could produce
7007 an incorrect result when the signed value is converted to unsigned.
7008 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7009 also enabled by @option{-Wextra}.
7010
7011 @item -Wsign-conversion
7012 @opindex Wsign-conversion
7013 @opindex Wno-sign-conversion
7014 Warn for implicit conversions that may change the sign of an integer
7015 value, like assigning a signed integer expression to an unsigned
7016 integer variable. An explicit cast silences the warning. In C, this
7017 option is enabled also by @option{-Wconversion}.
7018
7019 @item -Wfloat-conversion
7020 @opindex Wfloat-conversion
7021 @opindex Wno-float-conversion
7022 Warn for implicit conversions that reduce the precision of a real value.
7023 This includes conversions from real to integer, and from higher precision
7024 real to lower precision real values. This option is also enabled by
7025 @option{-Wconversion}.
7026
7027 @item -Wno-scalar-storage-order
7028 @opindex Wno-scalar-storage-order
7029 @opindex Wscalar-storage-order
7030 Do not warn on suspicious constructs involving reverse scalar storage order.
7031
7032 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7033 @opindex Wsized-deallocation
7034 @opindex Wno-sized-deallocation
7035 Warn about a definition of an unsized deallocation function
7036 @smallexample
7037 void operator delete (void *) noexcept;
7038 void operator delete[] (void *) noexcept;
7039 @end smallexample
7040 without a definition of the corresponding sized deallocation function
7041 @smallexample
7042 void operator delete (void *, std::size_t) noexcept;
7043 void operator delete[] (void *, std::size_t) noexcept;
7044 @end smallexample
7045 or vice versa. Enabled by @option{-Wextra} along with
7046 @option{-fsized-deallocation}.
7047
7048 @item -Wsizeof-pointer-div
7049 @opindex Wsizeof-pointer-div
7050 @opindex Wno-sizeof-pointer-div
7051 Warn for suspicious divisions of two sizeof expressions that divide
7052 the pointer size by the element size, which is the usual way to compute
7053 the array size but won't work out correctly with pointers. This warning
7054 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7055 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7056
7057 @item -Wsizeof-pointer-memaccess
7058 @opindex Wsizeof-pointer-memaccess
7059 @opindex Wno-sizeof-pointer-memaccess
7060 Warn for suspicious length parameters to certain string and memory built-in
7061 functions if the argument uses @code{sizeof}. This warning triggers for
7062 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7063 an array, but a pointer, and suggests a possible fix, or about
7064 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7065 also warns about calls to bounded string copy functions like @code{strncat}
7066 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7067 the source array. For example, in the following function the call to
7068 @code{strncat} specifies the size of the source string as the bound. That
7069 is almost certainly a mistake and so the call is diagnosed.
7070 @smallexample
7071 void make_file (const char *name)
7072 @{
7073 char path[PATH_MAX];
7074 strncpy (path, name, sizeof path - 1);
7075 strncat (path, ".text", sizeof ".text");
7076 @dots{}
7077 @}
7078 @end smallexample
7079
7080 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7081
7082 @item -Wsizeof-array-argument
7083 @opindex Wsizeof-array-argument
7084 @opindex Wno-sizeof-array-argument
7085 Warn when the @code{sizeof} operator is applied to a parameter that is
7086 declared as an array in a function definition. This warning is enabled by
7087 default for C and C++ programs.
7088
7089 @item -Wmemset-elt-size
7090 @opindex Wmemset-elt-size
7091 @opindex Wno-memset-elt-size
7092 Warn for suspicious calls to the @code{memset} built-in function, if the
7093 first argument references an array, and the third argument is a number
7094 equal to the number of elements, but not equal to the size of the array
7095 in memory. This indicates that the user has omitted a multiplication by
7096 the element size. This warning is enabled by @option{-Wall}.
7097
7098 @item -Wmemset-transposed-args
7099 @opindex Wmemset-transposed-args
7100 @opindex Wno-memset-transposed-args
7101 Warn for suspicious calls to the @code{memset} built-in function where
7102 the second argument is not zero and the third argument is zero. For
7103 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7104 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7105 is only emitted if the third argument is a literal zero. Otherwise, if
7106 it is an expression that is folded to zero, or a cast of zero to some
7107 type, it is far less likely that the arguments have been mistakenly
7108 transposed and no warning is emitted. This warning is enabled
7109 by @option{-Wall}.
7110
7111 @item -Waddress
7112 @opindex Waddress
7113 @opindex Wno-address
7114 Warn about suspicious uses of memory addresses. These include using
7115 the address of a function in a conditional expression, such as
7116 @code{void func(void); if (func)}, and comparisons against the memory
7117 address of a string literal, such as @code{if (x == "abc")}. Such
7118 uses typically indicate a programmer error: the address of a function
7119 always evaluates to true, so their use in a conditional usually
7120 indicate that the programmer forgot the parentheses in a function
7121 call; and comparisons against string literals result in unspecified
7122 behavior and are not portable in C, so they usually indicate that the
7123 programmer intended to use @code{strcmp}. This warning is enabled by
7124 @option{-Wall}.
7125
7126 @item -Waddress-of-packed-member
7127 @opindex Waddress-of-packed-member
7128 @opindex Wno-address-of-packed-member
7129 Warn when the address of packed member of struct or union is taken,
7130 which usually results in an unaligned pointer value. This is
7131 enabled by default.
7132
7133 @item -Wlogical-op
7134 @opindex Wlogical-op
7135 @opindex Wno-logical-op
7136 Warn about suspicious uses of logical operators in expressions.
7137 This includes using logical operators in contexts where a
7138 bit-wise operator is likely to be expected. Also warns when
7139 the operands of a logical operator are the same:
7140 @smallexample
7141 extern int a;
7142 if (a < 0 && a < 0) @{ @dots{} @}
7143 @end smallexample
7144
7145 @item -Wlogical-not-parentheses
7146 @opindex Wlogical-not-parentheses
7147 @opindex Wno-logical-not-parentheses
7148 Warn about logical not used on the left hand side operand of a comparison.
7149 This option does not warn if the right operand is considered to be a boolean
7150 expression. Its purpose is to detect suspicious code like the following:
7151 @smallexample
7152 int a;
7153 @dots{}
7154 if (!a > 1) @{ @dots{} @}
7155 @end smallexample
7156
7157 It is possible to suppress the warning by wrapping the LHS into
7158 parentheses:
7159 @smallexample
7160 if ((!a) > 1) @{ @dots{} @}
7161 @end smallexample
7162
7163 This warning is enabled by @option{-Wall}.
7164
7165 @item -Waggregate-return
7166 @opindex Waggregate-return
7167 @opindex Wno-aggregate-return
7168 Warn if any functions that return structures or unions are defined or
7169 called. (In languages where you can return an array, this also elicits
7170 a warning.)
7171
7172 @item -Wno-aggressive-loop-optimizations
7173 @opindex Wno-aggressive-loop-optimizations
7174 @opindex Waggressive-loop-optimizations
7175 Warn if in a loop with constant number of iterations the compiler detects
7176 undefined behavior in some statement during one or more of the iterations.
7177
7178 @item -Wno-attributes
7179 @opindex Wno-attributes
7180 @opindex Wattributes
7181 Do not warn if an unexpected @code{__attribute__} is used, such as
7182 unrecognized attributes, function attributes applied to variables,
7183 etc. This does not stop errors for incorrect use of supported
7184 attributes.
7185
7186 @item -Wno-builtin-declaration-mismatch
7187 @opindex Wno-builtin-declaration-mismatch
7188 @opindex Wbuiltin-declaration-mismatch
7189 Warn if a built-in function is declared with an incompatible signature
7190 or as a non-function, or when a built-in function declared with a type
7191 that does not include a prototype is called with arguments whose promoted
7192 types do not match those expected by the function. When @option{-Wextra}
7193 is specified, also warn when a built-in function that takes arguments is
7194 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7195 warning is enabled by default. To avoid the warning include the appropriate
7196 header to bring the prototypes of built-in functions into scope.
7197
7198 For example, the call to @code{memset} below is diagnosed by the warning
7199 because the function expects a value of type @code{size_t} as its argument
7200 but the type of @code{32} is @code{int}. With @option{-Wextra},
7201 the declaration of the function is diagnosed as well.
7202 @smallexample
7203 extern void* memset ();
7204 void f (void *d)
7205 @{
7206 memset (d, '\0', 32);
7207 @}
7208 @end smallexample
7209
7210 @item -Wno-builtin-macro-redefined
7211 @opindex Wno-builtin-macro-redefined
7212 @opindex Wbuiltin-macro-redefined
7213 Do not warn if certain built-in macros are redefined. This suppresses
7214 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7215 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7216
7217 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7218 @opindex Wstrict-prototypes
7219 @opindex Wno-strict-prototypes
7220 Warn if a function is declared or defined without specifying the
7221 argument types. (An old-style function definition is permitted without
7222 a warning if preceded by a declaration that specifies the argument
7223 types.)
7224
7225 @item -Wold-style-declaration @r{(C and Objective-C only)}
7226 @opindex Wold-style-declaration
7227 @opindex Wno-old-style-declaration
7228 Warn for obsolescent usages, according to the C Standard, in a
7229 declaration. For example, warn if storage-class specifiers like
7230 @code{static} are not the first things in a declaration. This warning
7231 is also enabled by @option{-Wextra}.
7232
7233 @item -Wold-style-definition @r{(C and Objective-C only)}
7234 @opindex Wold-style-definition
7235 @opindex Wno-old-style-definition
7236 Warn if an old-style function definition is used. A warning is given
7237 even if there is a previous prototype.
7238
7239 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7240 @opindex Wmissing-parameter-type
7241 @opindex Wno-missing-parameter-type
7242 A function parameter is declared without a type specifier in K&R-style
7243 functions:
7244
7245 @smallexample
7246 void foo(bar) @{ @}
7247 @end smallexample
7248
7249 This warning is also enabled by @option{-Wextra}.
7250
7251 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7252 @opindex Wmissing-prototypes
7253 @opindex Wno-missing-prototypes
7254 Warn if a global function is defined without a previous prototype
7255 declaration. This warning is issued even if the definition itself
7256 provides a prototype. Use this option to detect global functions
7257 that do not have a matching prototype declaration in a header file.
7258 This option is not valid for C++ because all function declarations
7259 provide prototypes and a non-matching declaration declares an
7260 overload rather than conflict with an earlier declaration.
7261 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7262
7263 @item -Wmissing-declarations
7264 @opindex Wmissing-declarations
7265 @opindex Wno-missing-declarations
7266 Warn if a global function is defined without a previous declaration.
7267 Do so even if the definition itself provides a prototype.
7268 Use this option to detect global functions that are not declared in
7269 header files. In C, no warnings are issued for functions with previous
7270 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7271 missing prototypes. In C++, no warnings are issued for function templates,
7272 or for inline functions, or for functions in anonymous namespaces.
7273
7274 @item -Wmissing-field-initializers
7275 @opindex Wmissing-field-initializers
7276 @opindex Wno-missing-field-initializers
7277 @opindex W
7278 @opindex Wextra
7279 @opindex Wno-extra
7280 Warn if a structure's initializer has some fields missing. For
7281 example, the following code causes such a warning, because
7282 @code{x.h} is implicitly zero:
7283
7284 @smallexample
7285 struct s @{ int f, g, h; @};
7286 struct s x = @{ 3, 4 @};
7287 @end smallexample
7288
7289 This option does not warn about designated initializers, so the following
7290 modification does not trigger a warning:
7291
7292 @smallexample
7293 struct s @{ int f, g, h; @};
7294 struct s x = @{ .f = 3, .g = 4 @};
7295 @end smallexample
7296
7297 In C this option does not warn about the universal zero initializer
7298 @samp{@{ 0 @}}:
7299
7300 @smallexample
7301 struct s @{ int f, g, h; @};
7302 struct s x = @{ 0 @};
7303 @end smallexample
7304
7305 Likewise, in C++ this option does not warn about the empty @{ @}
7306 initializer, for example:
7307
7308 @smallexample
7309 struct s @{ int f, g, h; @};
7310 s x = @{ @};
7311 @end smallexample
7312
7313 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7314 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7315
7316 @item -Wno-multichar
7317 @opindex Wno-multichar
7318 @opindex Wmultichar
7319 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7320 Usually they indicate a typo in the user's code, as they have
7321 implementation-defined values, and should not be used in portable code.
7322
7323 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7324 @opindex Wnormalized=
7325 @opindex Wnormalized
7326 @opindex Wno-normalized
7327 @cindex NFC
7328 @cindex NFKC
7329 @cindex character set, input normalization
7330 In ISO C and ISO C++, two identifiers are different if they are
7331 different sequences of characters. However, sometimes when characters
7332 outside the basic ASCII character set are used, you can have two
7333 different character sequences that look the same. To avoid confusion,
7334 the ISO 10646 standard sets out some @dfn{normalization rules} which
7335 when applied ensure that two sequences that look the same are turned into
7336 the same sequence. GCC can warn you if you are using identifiers that
7337 have not been normalized; this option controls that warning.
7338
7339 There are four levels of warning supported by GCC@. The default is
7340 @option{-Wnormalized=nfc}, which warns about any identifier that is
7341 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7342 recommended form for most uses. It is equivalent to
7343 @option{-Wnormalized}.
7344
7345 Unfortunately, there are some characters allowed in identifiers by
7346 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7347 identifiers. That is, there's no way to use these symbols in portable
7348 ISO C or C++ and have all your identifiers in NFC@.
7349 @option{-Wnormalized=id} suppresses the warning for these characters.
7350 It is hoped that future versions of the standards involved will correct
7351 this, which is why this option is not the default.
7352
7353 You can switch the warning off for all characters by writing
7354 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7355 only do this if you are using some other normalization scheme (like
7356 ``D''), because otherwise you can easily create bugs that are
7357 literally impossible to see.
7358
7359 Some characters in ISO 10646 have distinct meanings but look identical
7360 in some fonts or display methodologies, especially once formatting has
7361 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7362 LETTER N'', displays just like a regular @code{n} that has been
7363 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7364 normalization scheme to convert all these into a standard form as
7365 well, and GCC warns if your code is not in NFKC if you use
7366 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7367 about every identifier that contains the letter O because it might be
7368 confused with the digit 0, and so is not the default, but may be
7369 useful as a local coding convention if the programming environment
7370 cannot be fixed to display these characters distinctly.
7371
7372 @item -Wno-attribute-warning
7373 @opindex Wno-attribute-warning
7374 @opindex Wattribute-warning
7375 Do not warn about usage of functions (@pxref{Function Attributes})
7376 declared with @code{warning} attribute. By default, this warning is
7377 enabled. @option{-Wno-attribute-warning} can be used to disable the
7378 warning or @option{-Wno-error=attribute-warning} can be used to
7379 disable the error when compiled with @option{-Werror} flag.
7380
7381 @item -Wno-deprecated
7382 @opindex Wno-deprecated
7383 @opindex Wdeprecated
7384 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7385
7386 @item -Wno-deprecated-declarations
7387 @opindex Wno-deprecated-declarations
7388 @opindex Wdeprecated-declarations
7389 Do not warn about uses of functions (@pxref{Function Attributes}),
7390 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7391 Attributes}) marked as deprecated by using the @code{deprecated}
7392 attribute.
7393
7394 @item -Wno-overflow
7395 @opindex Wno-overflow
7396 @opindex Woverflow
7397 Do not warn about compile-time overflow in constant expressions.
7398
7399 @item -Wno-odr
7400 @opindex Wno-odr
7401 @opindex Wodr
7402 Warn about One Definition Rule violations during link-time optimization.
7403 Enabled by default.
7404
7405 @item -Wopenmp-simd
7406 @opindex Wopenmp-simd
7407 @opindex Wno-openmp-simd
7408 Warn if the vectorizer cost model overrides the OpenMP
7409 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7410 option can be used to relax the cost model.
7411
7412 @item -Woverride-init @r{(C and Objective-C only)}
7413 @opindex Woverride-init
7414 @opindex Wno-override-init
7415 @opindex W
7416 @opindex Wextra
7417 @opindex Wno-extra
7418 Warn if an initialized field without side effects is overridden when
7419 using designated initializers (@pxref{Designated Inits, , Designated
7420 Initializers}).
7421
7422 This warning is included in @option{-Wextra}. To get other
7423 @option{-Wextra} warnings without this one, use @option{-Wextra
7424 -Wno-override-init}.
7425
7426 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7427 @opindex Woverride-init-side-effects
7428 @opindex Wno-override-init-side-effects
7429 Warn if an initialized field with side effects is overridden when
7430 using designated initializers (@pxref{Designated Inits, , Designated
7431 Initializers}). This warning is enabled by default.
7432
7433 @item -Wpacked
7434 @opindex Wpacked
7435 @opindex Wno-packed
7436 Warn if a structure is given the packed attribute, but the packed
7437 attribute has no effect on the layout or size of the structure.
7438 Such structures may be mis-aligned for little benefit. For
7439 instance, in this code, the variable @code{f.x} in @code{struct bar}
7440 is misaligned even though @code{struct bar} does not itself
7441 have the packed attribute:
7442
7443 @smallexample
7444 @group
7445 struct foo @{
7446 int x;
7447 char a, b, c, d;
7448 @} __attribute__((packed));
7449 struct bar @{
7450 char z;
7451 struct foo f;
7452 @};
7453 @end group
7454 @end smallexample
7455
7456 @item -Wpacked-bitfield-compat
7457 @opindex Wpacked-bitfield-compat
7458 @opindex Wno-packed-bitfield-compat
7459 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7460 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7461 the change can lead to differences in the structure layout. GCC
7462 informs you when the offset of such a field has changed in GCC 4.4.
7463 For example there is no longer a 4-bit padding between field @code{a}
7464 and @code{b} in this structure:
7465
7466 @smallexample
7467 struct foo
7468 @{
7469 char a:4;
7470 char b:8;
7471 @} __attribute__ ((packed));
7472 @end smallexample
7473
7474 This warning is enabled by default. Use
7475 @option{-Wno-packed-bitfield-compat} to disable this warning.
7476
7477 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7478 @opindex Wpacked-not-aligned
7479 @opindex Wno-packed-not-aligned
7480 Warn if a structure field with explicitly specified alignment in a
7481 packed struct or union is misaligned. For example, a warning will
7482 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7483 'struct S' is less than 8}, in this code:
7484
7485 @smallexample
7486 @group
7487 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7488 struct __attribute__ ((packed)) S @{
7489 struct S8 s8;
7490 @};
7491 @end group
7492 @end smallexample
7493
7494 This warning is enabled by @option{-Wall}.
7495
7496 @item -Wpadded
7497 @opindex Wpadded
7498 @opindex Wno-padded
7499 Warn if padding is included in a structure, either to align an element
7500 of the structure or to align the whole structure. Sometimes when this
7501 happens it is possible to rearrange the fields of the structure to
7502 reduce the padding and so make the structure smaller.
7503
7504 @item -Wredundant-decls
7505 @opindex Wredundant-decls
7506 @opindex Wno-redundant-decls
7507 Warn if anything is declared more than once in the same scope, even in
7508 cases where multiple declaration is valid and changes nothing.
7509
7510 @item -Wno-restrict
7511 @opindex Wrestrict
7512 @opindex Wno-restrict
7513 Warn when an object referenced by a @code{restrict}-qualified parameter
7514 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7515 argument, or when copies between such objects overlap. For example,
7516 the call to the @code{strcpy} function below attempts to truncate the string
7517 by replacing its initial characters with the last four. However, because
7518 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7519 the call is diagnosed.
7520
7521 @smallexample
7522 void foo (void)
7523 @{
7524 char a[] = "abcd1234";
7525 strcpy (a, a + 4);
7526 @dots{}
7527 @}
7528 @end smallexample
7529 The @option{-Wrestrict} option detects some instances of simple overlap
7530 even without optimization but works best at @option{-O2} and above. It
7531 is included in @option{-Wall}.
7532
7533 @item -Wnested-externs @r{(C and Objective-C only)}
7534 @opindex Wnested-externs
7535 @opindex Wno-nested-externs
7536 Warn if an @code{extern} declaration is encountered within a function.
7537
7538 @item -Wno-inherited-variadic-ctor
7539 @opindex Winherited-variadic-ctor
7540 @opindex Wno-inherited-variadic-ctor
7541 Suppress warnings about use of C++11 inheriting constructors when the
7542 base class inherited from has a C variadic constructor; the warning is
7543 on by default because the ellipsis is not inherited.
7544
7545 @item -Winline
7546 @opindex Winline
7547 @opindex Wno-inline
7548 Warn if a function that is declared as inline cannot be inlined.
7549 Even with this option, the compiler does not warn about failures to
7550 inline functions declared in system headers.
7551
7552 The compiler uses a variety of heuristics to determine whether or not
7553 to inline a function. For example, the compiler takes into account
7554 the size of the function being inlined and the amount of inlining
7555 that has already been done in the current function. Therefore,
7556 seemingly insignificant changes in the source program can cause the
7557 warnings produced by @option{-Winline} to appear or disappear.
7558
7559 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7560 @opindex Wno-invalid-offsetof
7561 @opindex Winvalid-offsetof
7562 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7563 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7564 to a non-standard-layout type is undefined. In existing C++ implementations,
7565 however, @code{offsetof} typically gives meaningful results.
7566 This flag is for users who are aware that they are
7567 writing nonportable code and who have deliberately chosen to ignore the
7568 warning about it.
7569
7570 The restrictions on @code{offsetof} may be relaxed in a future version
7571 of the C++ standard.
7572
7573 @item -Wint-in-bool-context
7574 @opindex Wint-in-bool-context
7575 @opindex Wno-int-in-bool-context
7576 Warn for suspicious use of integer values where boolean values are expected,
7577 such as conditional expressions (?:) using non-boolean integer constants in
7578 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7579 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7580 for all kinds of multiplications regardless of the data type.
7581 This warning is enabled by @option{-Wall}.
7582
7583 @item -Wno-int-to-pointer-cast
7584 @opindex Wno-int-to-pointer-cast
7585 @opindex Wint-to-pointer-cast
7586 Suppress warnings from casts to pointer type of an integer of a
7587 different size. In C++, casting to a pointer type of smaller size is
7588 an error. @option{Wint-to-pointer-cast} is enabled by default.
7589
7590
7591 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7592 @opindex Wno-pointer-to-int-cast
7593 @opindex Wpointer-to-int-cast
7594 Suppress warnings from casts from a pointer to an integer type of a
7595 different size.
7596
7597 @item -Winvalid-pch
7598 @opindex Winvalid-pch
7599 @opindex Wno-invalid-pch
7600 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7601 the search path but cannot be used.
7602
7603 @item -Wlong-long
7604 @opindex Wlong-long
7605 @opindex Wno-long-long
7606 Warn if @code{long long} type is used. This is enabled by either
7607 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7608 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7609
7610 @item -Wvariadic-macros
7611 @opindex Wvariadic-macros
7612 @opindex Wno-variadic-macros
7613 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7614 alternate syntax is used in ISO C99 mode. This is enabled by either
7615 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7616 messages, use @option{-Wno-variadic-macros}.
7617
7618 @item -Wvarargs
7619 @opindex Wvarargs
7620 @opindex Wno-varargs
7621 Warn upon questionable usage of the macros used to handle variable
7622 arguments like @code{va_start}. This is default. To inhibit the
7623 warning messages, use @option{-Wno-varargs}.
7624
7625 @item -Wvector-operation-performance
7626 @opindex Wvector-operation-performance
7627 @opindex Wno-vector-operation-performance
7628 Warn if vector operation is not implemented via SIMD capabilities of the
7629 architecture. Mainly useful for the performance tuning.
7630 Vector operation can be implemented @code{piecewise}, which means that the
7631 scalar operation is performed on every vector element;
7632 @code{in parallel}, which means that the vector operation is implemented
7633 using scalars of wider type, which normally is more performance efficient;
7634 and @code{as a single scalar}, which means that vector fits into a
7635 scalar type.
7636
7637 @item -Wno-virtual-move-assign
7638 @opindex Wvirtual-move-assign
7639 @opindex Wno-virtual-move-assign
7640 Suppress warnings about inheriting from a virtual base with a
7641 non-trivial C++11 move assignment operator. This is dangerous because
7642 if the virtual base is reachable along more than one path, it is
7643 moved multiple times, which can mean both objects end up in the
7644 moved-from state. If the move assignment operator is written to avoid
7645 moving from a moved-from object, this warning can be disabled.
7646
7647 @item -Wvla
7648 @opindex Wvla
7649 @opindex Wno-vla
7650 Warn if a variable-length array is used in the code.
7651 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7652 the variable-length array.
7653
7654 @item -Wvla-larger-than=@var{byte-size}
7655 @opindex Wvla-larger-than=
7656 @opindex Wno-vla-larger-than
7657 If this option is used, the compiler will warn for declarations of
7658 variable-length arrays whose size is either unbounded, or bounded
7659 by an argument that allows the array size to exceed @var{byte-size}
7660 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7661 works, but with variable-length arrays.
7662
7663 Note that GCC may optimize small variable-length arrays of a known
7664 value into plain arrays, so this warning may not get triggered for
7665 such arrays.
7666
7667 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7668 is typically only effective when @option{-ftree-vrp} is active (default
7669 for @option{-O2} and above).
7670
7671 See also @option{-Walloca-larger-than=@var{byte-size}}.
7672
7673 @item -Wno-vla-larger-than
7674 @opindex Wno-vla-larger-than
7675 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7676 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7677
7678 @item -Wvolatile-register-var
7679 @opindex Wvolatile-register-var
7680 @opindex Wno-volatile-register-var
7681 Warn if a register variable is declared volatile. The volatile
7682 modifier does not inhibit all optimizations that may eliminate reads
7683 and/or writes to register variables. This warning is enabled by
7684 @option{-Wall}.
7685
7686 @item -Wdisabled-optimization
7687 @opindex Wdisabled-optimization
7688 @opindex Wno-disabled-optimization
7689 Warn if a requested optimization pass is disabled. This warning does
7690 not generally indicate that there is anything wrong with your code; it
7691 merely indicates that GCC's optimizers are unable to handle the code
7692 effectively. Often, the problem is that your code is too big or too
7693 complex; GCC refuses to optimize programs when the optimization
7694 itself is likely to take inordinate amounts of time.
7695
7696 @item -Wpointer-sign @r{(C and Objective-C only)}
7697 @opindex Wpointer-sign
7698 @opindex Wno-pointer-sign
7699 Warn for pointer argument passing or assignment with different signedness.
7700 This option is only supported for C and Objective-C@. It is implied by
7701 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7702 @option{-Wno-pointer-sign}.
7703
7704 @item -Wstack-protector
7705 @opindex Wstack-protector
7706 @opindex Wno-stack-protector
7707 This option is only active when @option{-fstack-protector} is active. It
7708 warns about functions that are not protected against stack smashing.
7709
7710 @item -Woverlength-strings
7711 @opindex Woverlength-strings
7712 @opindex Wno-overlength-strings
7713 Warn about string constants that are longer than the ``minimum
7714 maximum'' length specified in the C standard. Modern compilers
7715 generally allow string constants that are much longer than the
7716 standard's minimum limit, but very portable programs should avoid
7717 using longer strings.
7718
7719 The limit applies @emph{after} string constant concatenation, and does
7720 not count the trailing NUL@. In C90, the limit was 509 characters; in
7721 C99, it was raised to 4095. C++98 does not specify a normative
7722 minimum maximum, so we do not diagnose overlength strings in C++@.
7723
7724 This option is implied by @option{-Wpedantic}, and can be disabled with
7725 @option{-Wno-overlength-strings}.
7726
7727 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7728 @opindex Wunsuffixed-float-constants
7729 @opindex Wno-unsuffixed-float-constants
7730
7731 Issue a warning for any floating constant that does not have
7732 a suffix. When used together with @option{-Wsystem-headers} it
7733 warns about such constants in system header files. This can be useful
7734 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7735 from the decimal floating-point extension to C99.
7736
7737 @item -Wno-designated-init @r{(C and Objective-C only)}
7738 Suppress warnings when a positional initializer is used to initialize
7739 a structure that has been marked with the @code{designated_init}
7740 attribute.
7741
7742 @item -Whsa
7743 Issue a warning when HSAIL cannot be emitted for the compiled function or
7744 OpenMP construct.
7745
7746 @end table
7747
7748 @node Debugging Options
7749 @section Options for Debugging Your Program
7750 @cindex options, debugging
7751 @cindex debugging information options
7752
7753 To tell GCC to emit extra information for use by a debugger, in almost
7754 all cases you need only to add @option{-g} to your other options.
7755
7756 GCC allows you to use @option{-g} with
7757 @option{-O}. The shortcuts taken by optimized code may occasionally
7758 be surprising: some variables you declared may not exist
7759 at all; flow of control may briefly move where you did not expect it;
7760 some statements may not be executed because they compute constant
7761 results or their values are already at hand; some statements may
7762 execute in different places because they have been moved out of loops.
7763 Nevertheless it is possible to debug optimized output. This makes
7764 it reasonable to use the optimizer for programs that might have bugs.
7765
7766 If you are not using some other optimization option, consider
7767 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7768 With no @option{-O} option at all, some compiler passes that collect
7769 information useful for debugging do not run at all, so that
7770 @option{-Og} may result in a better debugging experience.
7771
7772 @table @gcctabopt
7773 @item -g
7774 @opindex g
7775 Produce debugging information in the operating system's native format
7776 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7777 information.
7778
7779 On most systems that use stabs format, @option{-g} enables use of extra
7780 debugging information that only GDB can use; this extra information
7781 makes debugging work better in GDB but probably makes other debuggers
7782 crash or
7783 refuse to read the program. If you want to control for certain whether
7784 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7785 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7786
7787 @item -ggdb
7788 @opindex ggdb
7789 Produce debugging information for use by GDB@. This means to use the
7790 most expressive format available (DWARF, stabs, or the native format
7791 if neither of those are supported), including GDB extensions if at all
7792 possible.
7793
7794 @item -gdwarf
7795 @itemx -gdwarf-@var{version}
7796 @opindex gdwarf
7797 Produce debugging information in DWARF format (if that is supported).
7798 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7799 for most targets is 4. DWARF Version 5 is only experimental.
7800
7801 Note that with DWARF Version 2, some ports require and always
7802 use some non-conflicting DWARF 3 extensions in the unwind tables.
7803
7804 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7805 for maximum benefit.
7806
7807 GCC no longer supports DWARF Version 1, which is substantially
7808 different than Version 2 and later. For historical reasons, some
7809 other DWARF-related options such as
7810 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7811 in their names, but apply to all currently-supported versions of DWARF.
7812
7813 @item -gstabs
7814 @opindex gstabs
7815 Produce debugging information in stabs format (if that is supported),
7816 without GDB extensions. This is the format used by DBX on most BSD
7817 systems. On MIPS, Alpha and System V Release 4 systems this option
7818 produces stabs debugging output that is not understood by DBX@.
7819 On System V Release 4 systems this option requires the GNU assembler.
7820
7821 @item -gstabs+
7822 @opindex gstabs+
7823 Produce debugging information in stabs format (if that is supported),
7824 using GNU extensions understood only by the GNU debugger (GDB)@. The
7825 use of these extensions is likely to make other debuggers crash or
7826 refuse to read the program.
7827
7828 @item -gxcoff
7829 @opindex gxcoff
7830 Produce debugging information in XCOFF format (if that is supported).
7831 This is the format used by the DBX debugger on IBM RS/6000 systems.
7832
7833 @item -gxcoff+
7834 @opindex gxcoff+
7835 Produce debugging information in XCOFF format (if that is supported),
7836 using GNU extensions understood only by the GNU debugger (GDB)@. The
7837 use of these extensions is likely to make other debuggers crash or
7838 refuse to read the program, and may cause assemblers other than the GNU
7839 assembler (GAS) to fail with an error.
7840
7841 @item -gvms
7842 @opindex gvms
7843 Produce debugging information in Alpha/VMS debug format (if that is
7844 supported). This is the format used by DEBUG on Alpha/VMS systems.
7845
7846 @item -g@var{level}
7847 @itemx -ggdb@var{level}
7848 @itemx -gstabs@var{level}
7849 @itemx -gxcoff@var{level}
7850 @itemx -gvms@var{level}
7851 Request debugging information and also use @var{level} to specify how
7852 much information. The default level is 2.
7853
7854 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7855 @option{-g}.
7856
7857 Level 1 produces minimal information, enough for making backtraces in
7858 parts of the program that you don't plan to debug. This includes
7859 descriptions of functions and external variables, and line number
7860 tables, but no information about local variables.
7861
7862 Level 3 includes extra information, such as all the macro definitions
7863 present in the program. Some debuggers support macro expansion when
7864 you use @option{-g3}.
7865
7866 If you use multiple @option{-g} options, with or without level numbers,
7867 the last such option is the one that is effective.
7868
7869 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7870 confusion with @option{-gdwarf-@var{level}}.
7871 Instead use an additional @option{-g@var{level}} option to change the
7872 debug level for DWARF.
7873
7874 @item -fno-eliminate-unused-debug-symbols
7875 @opindex feliminate-unused-debug-symbols
7876 @opindex fno-eliminate-unused-debug-symbols
7877 By default, no debug information is produced for symbols that are not actually
7878 used. Use this option if you want debug information for all symbols.
7879
7880 @item -femit-class-debug-always
7881 @opindex femit-class-debug-always
7882 Instead of emitting debugging information for a C++ class in only one
7883 object file, emit it in all object files using the class. This option
7884 should be used only with debuggers that are unable to handle the way GCC
7885 normally emits debugging information for classes because using this
7886 option increases the size of debugging information by as much as a
7887 factor of two.
7888
7889 @item -fno-merge-debug-strings
7890 @opindex fmerge-debug-strings
7891 @opindex fno-merge-debug-strings
7892 Direct the linker to not merge together strings in the debugging
7893 information that are identical in different object files. Merging is
7894 not supported by all assemblers or linkers. Merging decreases the size
7895 of the debug information in the output file at the cost of increasing
7896 link processing time. Merging is enabled by default.
7897
7898 @item -fdebug-prefix-map=@var{old}=@var{new}
7899 @opindex fdebug-prefix-map
7900 When compiling files residing in directory @file{@var{old}}, record
7901 debugging information describing them as if the files resided in
7902 directory @file{@var{new}} instead. This can be used to replace a
7903 build-time path with an install-time path in the debug info. It can
7904 also be used to change an absolute path to a relative path by using
7905 @file{.} for @var{new}. This can give more reproducible builds, which
7906 are location independent, but may require an extra command to tell GDB
7907 where to find the source files. See also @option{-ffile-prefix-map}.
7908
7909 @item -fvar-tracking
7910 @opindex fvar-tracking
7911 Run variable tracking pass. It computes where variables are stored at each
7912 position in code. Better debugging information is then generated
7913 (if the debugging information format supports this information).
7914
7915 It is enabled by default when compiling with optimization (@option{-Os},
7916 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7917 the debug info format supports it.
7918
7919 @item -fvar-tracking-assignments
7920 @opindex fvar-tracking-assignments
7921 @opindex fno-var-tracking-assignments
7922 Annotate assignments to user variables early in the compilation and
7923 attempt to carry the annotations over throughout the compilation all the
7924 way to the end, in an attempt to improve debug information while
7925 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7926
7927 It can be enabled even if var-tracking is disabled, in which case
7928 annotations are created and maintained, but discarded at the end.
7929 By default, this flag is enabled together with @option{-fvar-tracking},
7930 except when selective scheduling is enabled.
7931
7932 @item -gsplit-dwarf
7933 @opindex gsplit-dwarf
7934 Separate as much DWARF debugging information as possible into a
7935 separate output file with the extension @file{.dwo}. This option allows
7936 the build system to avoid linking files with debug information. To
7937 be useful, this option requires a debugger capable of reading @file{.dwo}
7938 files.
7939
7940 @item -gdescribe-dies
7941 @opindex gdescribe-dies
7942 Add description attributes to some DWARF DIEs that have no name attribute,
7943 such as artificial variables, external references and call site
7944 parameter DIEs.
7945
7946 @item -gpubnames
7947 @opindex gpubnames
7948 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7949
7950 @item -ggnu-pubnames
7951 @opindex ggnu-pubnames
7952 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7953 suitable for conversion into a GDB@ index. This option is only useful
7954 with a linker that can produce GDB@ index version 7.
7955
7956 @item -fdebug-types-section
7957 @opindex fdebug-types-section
7958 @opindex fno-debug-types-section
7959 When using DWARF Version 4 or higher, type DIEs can be put into
7960 their own @code{.debug_types} section instead of making them part of the
7961 @code{.debug_info} section. It is more efficient to put them in a separate
7962 comdat section since the linker can then remove duplicates.
7963 But not all DWARF consumers support @code{.debug_types} sections yet
7964 and on some objects @code{.debug_types} produces larger instead of smaller
7965 debugging information.
7966
7967 @item -grecord-gcc-switches
7968 @itemx -gno-record-gcc-switches
7969 @opindex grecord-gcc-switches
7970 @opindex gno-record-gcc-switches
7971 This switch causes the command-line options used to invoke the
7972 compiler that may affect code generation to be appended to the
7973 DW_AT_producer attribute in DWARF debugging information. The options
7974 are concatenated with spaces separating them from each other and from
7975 the compiler version.
7976 It is enabled by default.
7977 See also @option{-frecord-gcc-switches} for another
7978 way of storing compiler options into the object file.
7979
7980 @item -gstrict-dwarf
7981 @opindex gstrict-dwarf
7982 Disallow using extensions of later DWARF standard version than selected
7983 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7984 DWARF extensions from later standard versions is allowed.
7985
7986 @item -gno-strict-dwarf
7987 @opindex gno-strict-dwarf
7988 Allow using extensions of later DWARF standard version than selected with
7989 @option{-gdwarf-@var{version}}.
7990
7991 @item -gas-loc-support
7992 @opindex gas-loc-support
7993 Inform the compiler that the assembler supports @code{.loc} directives.
7994 It may then use them for the assembler to generate DWARF2+ line number
7995 tables.
7996
7997 This is generally desirable, because assembler-generated line-number
7998 tables are a lot more compact than those the compiler can generate
7999 itself.
8000
8001 This option will be enabled by default if, at GCC configure time, the
8002 assembler was found to support such directives.
8003
8004 @item -gno-as-loc-support
8005 @opindex gno-as-loc-support
8006 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8007 line number tables are to be generated.
8008
8009 @item -gas-locview-support
8010 @opindex gas-locview-support
8011 Inform the compiler that the assembler supports @code{view} assignment
8012 and reset assertion checking in @code{.loc} directives.
8013
8014 This option will be enabled by default if, at GCC configure time, the
8015 assembler was found to support them.
8016
8017 @item -gno-as-locview-support
8018 Force GCC to assign view numbers internally, if
8019 @option{-gvariable-location-views} are explicitly requested.
8020
8021 @item -gcolumn-info
8022 @itemx -gno-column-info
8023 @opindex gcolumn-info
8024 @opindex gno-column-info
8025 Emit location column information into DWARF debugging information, rather
8026 than just file and line.
8027 This option is enabled by default.
8028
8029 @item -gstatement-frontiers
8030 @itemx -gno-statement-frontiers
8031 @opindex gstatement-frontiers
8032 @opindex gno-statement-frontiers
8033 This option causes GCC to create markers in the internal representation
8034 at the beginning of statements, and to keep them roughly in place
8035 throughout compilation, using them to guide the output of @code{is_stmt}
8036 markers in the line number table. This is enabled by default when
8037 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8038 @dots{}), and outputting DWARF 2 debug information at the normal level.
8039
8040 @item -gvariable-location-views
8041 @itemx -gvariable-location-views=incompat5
8042 @itemx -gno-variable-location-views
8043 @opindex gvariable-location-views
8044 @opindex gvariable-location-views=incompat5
8045 @opindex gno-variable-location-views
8046 Augment variable location lists with progressive view numbers implied
8047 from the line number table. This enables debug information consumers to
8048 inspect state at certain points of the program, even if no instructions
8049 associated with the corresponding source locations are present at that
8050 point. If the assembler lacks support for view numbers in line number
8051 tables, this will cause the compiler to emit the line number table,
8052 which generally makes them somewhat less compact. The augmented line
8053 number tables and location lists are fully backward-compatible, so they
8054 can be consumed by debug information consumers that are not aware of
8055 these augmentations, but they won't derive any benefit from them either.
8056
8057 This is enabled by default when outputting DWARF 2 debug information at
8058 the normal level, as long as there is assembler support,
8059 @option{-fvar-tracking-assignments} is enabled and
8060 @option{-gstrict-dwarf} is not. When assembler support is not
8061 available, this may still be enabled, but it will force GCC to output
8062 internal line number tables, and if
8063 @option{-ginternal-reset-location-views} is not enabled, that will most
8064 certainly lead to silently mismatching location views.
8065
8066 There is a proposed representation for view numbers that is not backward
8067 compatible with the location list format introduced in DWARF 5, that can
8068 be enabled with @option{-gvariable-location-views=incompat5}. This
8069 option may be removed in the future, is only provided as a reference
8070 implementation of the proposed representation. Debug information
8071 consumers are not expected to support this extended format, and they
8072 would be rendered unable to decode location lists using it.
8073
8074 @item -ginternal-reset-location-views
8075 @itemx -gnointernal-reset-location-views
8076 @opindex ginternal-reset-location-views
8077 @opindex gno-internal-reset-location-views
8078 Attempt to determine location views that can be omitted from location
8079 view lists. This requires the compiler to have very accurate insn
8080 length estimates, which isn't always the case, and it may cause
8081 incorrect view lists to be generated silently when using an assembler
8082 that does not support location view lists. The GNU assembler will flag
8083 any such error as a @code{view number mismatch}. This is only enabled
8084 on ports that define a reliable estimation function.
8085
8086 @item -ginline-points
8087 @itemx -gno-inline-points
8088 @opindex ginline-points
8089 @opindex gno-inline-points
8090 Generate extended debug information for inlined functions. Location
8091 view tracking markers are inserted at inlined entry points, so that
8092 address and view numbers can be computed and output in debug
8093 information. This can be enabled independently of location views, in
8094 which case the view numbers won't be output, but it can only be enabled
8095 along with statement frontiers, and it is only enabled by default if
8096 location views are enabled.
8097
8098 @item -gz@r{[}=@var{type}@r{]}
8099 @opindex gz
8100 Produce compressed debug sections in DWARF format, if that is supported.
8101 If @var{type} is not given, the default type depends on the capabilities
8102 of the assembler and linker used. @var{type} may be one of
8103 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8104 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8105 compression in traditional GNU format). If the linker doesn't support
8106 writing compressed debug sections, the option is rejected. Otherwise,
8107 if the assembler does not support them, @option{-gz} is silently ignored
8108 when producing object files.
8109
8110 @item -femit-struct-debug-baseonly
8111 @opindex femit-struct-debug-baseonly
8112 Emit debug information for struct-like types
8113 only when the base name of the compilation source file
8114 matches the base name of file in which the struct is defined.
8115
8116 This option substantially reduces the size of debugging information,
8117 but at significant potential loss in type information to the debugger.
8118 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8119 See @option{-femit-struct-debug-detailed} for more detailed control.
8120
8121 This option works only with DWARF debug output.
8122
8123 @item -femit-struct-debug-reduced
8124 @opindex femit-struct-debug-reduced
8125 Emit debug information for struct-like types
8126 only when the base name of the compilation source file
8127 matches the base name of file in which the type is defined,
8128 unless the struct is a template or defined in a system header.
8129
8130 This option significantly reduces the size of debugging information,
8131 with some potential loss in type information to the debugger.
8132 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8133 See @option{-femit-struct-debug-detailed} for more detailed control.
8134
8135 This option works only with DWARF debug output.
8136
8137 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8138 @opindex femit-struct-debug-detailed
8139 Specify the struct-like types
8140 for which the compiler generates debug information.
8141 The intent is to reduce duplicate struct debug information
8142 between different object files within the same program.
8143
8144 This option is a detailed version of
8145 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8146 which serves for most needs.
8147
8148 A specification has the syntax@*
8149 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8150
8151 The optional first word limits the specification to
8152 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8153 A struct type is used directly when it is the type of a variable, member.
8154 Indirect uses arise through pointers to structs.
8155 That is, when use of an incomplete struct is valid, the use is indirect.
8156 An example is
8157 @samp{struct one direct; struct two * indirect;}.
8158
8159 The optional second word limits the specification to
8160 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8161 Generic structs are a bit complicated to explain.
8162 For C++, these are non-explicit specializations of template classes,
8163 or non-template classes within the above.
8164 Other programming languages have generics,
8165 but @option{-femit-struct-debug-detailed} does not yet implement them.
8166
8167 The third word specifies the source files for those
8168 structs for which the compiler should emit debug information.
8169 The values @samp{none} and @samp{any} have the normal meaning.
8170 The value @samp{base} means that
8171 the base of name of the file in which the type declaration appears
8172 must match the base of the name of the main compilation file.
8173 In practice, this means that when compiling @file{foo.c}, debug information
8174 is generated for types declared in that file and @file{foo.h},
8175 but not other header files.
8176 The value @samp{sys} means those types satisfying @samp{base}
8177 or declared in system or compiler headers.
8178
8179 You may need to experiment to determine the best settings for your application.
8180
8181 The default is @option{-femit-struct-debug-detailed=all}.
8182
8183 This option works only with DWARF debug output.
8184
8185 @item -fno-dwarf2-cfi-asm
8186 @opindex fdwarf2-cfi-asm
8187 @opindex fno-dwarf2-cfi-asm
8188 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8189 instead of using GAS @code{.cfi_*} directives.
8190
8191 @item -fno-eliminate-unused-debug-types
8192 @opindex feliminate-unused-debug-types
8193 @opindex fno-eliminate-unused-debug-types
8194 Normally, when producing DWARF output, GCC avoids producing debug symbol
8195 output for types that are nowhere used in the source file being compiled.
8196 Sometimes it is useful to have GCC emit debugging
8197 information for all types declared in a compilation
8198 unit, regardless of whether or not they are actually used
8199 in that compilation unit, for example
8200 if, in the debugger, you want to cast a value to a type that is
8201 not actually used in your program (but is declared). More often,
8202 however, this results in a significant amount of wasted space.
8203 @end table
8204
8205 @node Optimize Options
8206 @section Options That Control Optimization
8207 @cindex optimize options
8208 @cindex options, optimization
8209
8210 These options control various sorts of optimizations.
8211
8212 Without any optimization option, the compiler's goal is to reduce the
8213 cost of compilation and to make debugging produce the expected
8214 results. Statements are independent: if you stop the program with a
8215 breakpoint between statements, you can then assign a new value to any
8216 variable or change the program counter to any other statement in the
8217 function and get exactly the results you expect from the source
8218 code.
8219
8220 Turning on optimization flags makes the compiler attempt to improve
8221 the performance and/or code size at the expense of compilation time
8222 and possibly the ability to debug the program.
8223
8224 The compiler performs optimization based on the knowledge it has of the
8225 program. Compiling multiple files at once to a single output file mode allows
8226 the compiler to use information gained from all of the files when compiling
8227 each of them.
8228
8229 Not all optimizations are controlled directly by a flag. Only
8230 optimizations that have a flag are listed in this section.
8231
8232 Most optimizations are completely disabled at @option{-O0} or if an
8233 @option{-O} level is not set on the command line, even if individual
8234 optimization flags are specified. Similarly, @option{-Og} suppresses
8235 many optimization passes.
8236
8237 Depending on the target and how GCC was configured, a slightly different
8238 set of optimizations may be enabled at each @option{-O} level than
8239 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8240 to find out the exact set of optimizations that are enabled at each level.
8241 @xref{Overall Options}, for examples.
8242
8243 @table @gcctabopt
8244 @item -O
8245 @itemx -O1
8246 @opindex O
8247 @opindex O1
8248 Optimize. Optimizing compilation takes somewhat more time, and a lot
8249 more memory for a large function.
8250
8251 With @option{-O}, the compiler tries to reduce code size and execution
8252 time, without performing any optimizations that take a great deal of
8253 compilation time.
8254
8255 @c Note that in addition to the default_options_table list in opts.c,
8256 @c several optimization flags default to true but control optimization
8257 @c passes that are explicitly disabled at -O0.
8258
8259 @option{-O} turns on the following optimization flags:
8260
8261 @c Please keep the following list alphabetized.
8262 @gccoptlist{-fauto-inc-dec @gol
8263 -fbranch-count-reg @gol
8264 -fcombine-stack-adjustments @gol
8265 -fcompare-elim @gol
8266 -fcprop-registers @gol
8267 -fdce @gol
8268 -fdefer-pop @gol
8269 -fdelayed-branch @gol
8270 -fdse @gol
8271 -fforward-propagate @gol
8272 -fguess-branch-probability @gol
8273 -fif-conversion @gol
8274 -fif-conversion2 @gol
8275 -finline-functions-called-once @gol
8276 -fipa-profile @gol
8277 -fipa-pure-const @gol
8278 -fipa-reference @gol
8279 -fipa-reference-addressable @gol
8280 -fmerge-constants @gol
8281 -fmove-loop-invariants @gol
8282 -fomit-frame-pointer @gol
8283 -freorder-blocks @gol
8284 -fshrink-wrap @gol
8285 -fshrink-wrap-separate @gol
8286 -fsplit-wide-types @gol
8287 -fssa-backprop @gol
8288 -fssa-phiopt @gol
8289 -ftree-bit-ccp @gol
8290 -ftree-ccp @gol
8291 -ftree-ch @gol
8292 -ftree-coalesce-vars @gol
8293 -ftree-copy-prop @gol
8294 -ftree-dce @gol
8295 -ftree-dominator-opts @gol
8296 -ftree-dse @gol
8297 -ftree-forwprop @gol
8298 -ftree-fre @gol
8299 -ftree-phiprop @gol
8300 -ftree-pta @gol
8301 -ftree-scev-cprop @gol
8302 -ftree-sink @gol
8303 -ftree-slsr @gol
8304 -ftree-sra @gol
8305 -ftree-ter @gol
8306 -funit-at-a-time}
8307
8308 @item -O2
8309 @opindex O2
8310 Optimize even more. GCC performs nearly all supported optimizations
8311 that do not involve a space-speed tradeoff.
8312 As compared to @option{-O}, this option increases both compilation time
8313 and the performance of the generated code.
8314
8315 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8316 also turns on the following optimization flags:
8317
8318 @c Please keep the following list alphabetized!
8319 @gccoptlist{-falign-functions -falign-jumps @gol
8320 -falign-labels -falign-loops @gol
8321 -fcaller-saves @gol
8322 -fcode-hoisting @gol
8323 -fcrossjumping @gol
8324 -fcse-follow-jumps -fcse-skip-blocks @gol
8325 -fdelete-null-pointer-checks @gol
8326 -fdevirtualize -fdevirtualize-speculatively @gol
8327 -fexpensive-optimizations @gol
8328 -ffinite-loops @gol
8329 -fgcse -fgcse-lm @gol
8330 -fhoist-adjacent-loads @gol
8331 -finline-small-functions @gol
8332 -findirect-inlining @gol
8333 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8334 -fipa-ra -fipa-sra -fipa-vrp @gol
8335 -fisolate-erroneous-paths-dereference @gol
8336 -flra-remat @gol
8337 -foptimize-sibling-calls @gol
8338 -foptimize-strlen @gol
8339 -fpartial-inlining @gol
8340 -fpeephole2 @gol
8341 -freorder-blocks-algorithm=stc @gol
8342 -freorder-blocks-and-partition -freorder-functions @gol
8343 -frerun-cse-after-loop @gol
8344 -fschedule-insns -fschedule-insns2 @gol
8345 -fsched-interblock -fsched-spec @gol
8346 -fstore-merging @gol
8347 -fstrict-aliasing @gol
8348 -fthread-jumps @gol
8349 -ftree-builtin-call-dce @gol
8350 -ftree-pre @gol
8351 -ftree-switch-conversion -ftree-tail-merge @gol
8352 -ftree-vrp}
8353
8354 Please note the warning under @option{-fgcse} about
8355 invoking @option{-O2} on programs that use computed gotos.
8356
8357 @item -O3
8358 @opindex O3
8359 Optimize yet more. @option{-O3} turns on all optimizations specified
8360 by @option{-O2} and also turns on the following optimization flags:
8361
8362 @c Please keep the following list alphabetized!
8363 @gccoptlist{-fgcse-after-reload @gol
8364 -finline-functions @gol
8365 -fipa-cp-clone
8366 -floop-interchange @gol
8367 -floop-unroll-and-jam @gol
8368 -fpeel-loops @gol
8369 -fpredictive-commoning @gol
8370 -fsplit-paths @gol
8371 -ftree-loop-distribute-patterns @gol
8372 -ftree-loop-distribution @gol
8373 -ftree-loop-vectorize @gol
8374 -ftree-partial-pre @gol
8375 -ftree-slp-vectorize @gol
8376 -funswitch-loops @gol
8377 -fvect-cost-model @gol
8378 -fversion-loops-for-strides}
8379
8380 @item -O0
8381 @opindex O0
8382 Reduce compilation time and make debugging produce the expected
8383 results. This is the default.
8384
8385 @item -Os
8386 @opindex Os
8387 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8388 except those that often increase code size:
8389
8390 @gccoptlist{-falign-functions -falign-jumps @gol
8391 -falign-labels -falign-loops @gol
8392 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8393
8394 It also enables @option{-finline-functions}, causes the compiler to tune for
8395 code size rather than execution speed, and performs further optimizations
8396 designed to reduce code size.
8397
8398 @item -Ofast
8399 @opindex Ofast
8400 Disregard strict standards compliance. @option{-Ofast} enables all
8401 @option{-O3} optimizations. It also enables optimizations that are not
8402 valid for all standard-compliant programs.
8403 It turns on @option{-ffast-math} and the Fortran-specific
8404 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8405 specified, and @option{-fno-protect-parens}.
8406
8407 @item -Og
8408 @opindex Og
8409 Optimize debugging experience. @option{-Og} should be the optimization
8410 level of choice for the standard edit-compile-debug cycle, offering
8411 a reasonable level of optimization while maintaining fast compilation
8412 and a good debugging experience. It is a better choice than @option{-O0}
8413 for producing debuggable code because some compiler passes
8414 that collect debug information are disabled at @option{-O0}.
8415
8416 Like @option{-O0}, @option{-Og} completely disables a number of
8417 optimization passes so that individual options controlling them have
8418 no effect. Otherwise @option{-Og} enables all @option{-O1}
8419 optimization flags except for those that may interfere with debugging:
8420
8421 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8422 -fif-conversion -fif-conversion2 @gol
8423 -finline-functions-called-once @gol
8424 -fmove-loop-invariants -fssa-phiopt @gol
8425 -ftree-bit-ccp -ftree-pta -ftree-sra}
8426
8427 @end table
8428
8429 If you use multiple @option{-O} options, with or without level numbers,
8430 the last such option is the one that is effective.
8431
8432 Options of the form @option{-f@var{flag}} specify machine-independent
8433 flags. Most flags have both positive and negative forms; the negative
8434 form of @option{-ffoo} is @option{-fno-foo}. In the table
8435 below, only one of the forms is listed---the one you typically
8436 use. You can figure out the other form by either removing @samp{no-}
8437 or adding it.
8438
8439 The following options control specific optimizations. They are either
8440 activated by @option{-O} options or are related to ones that are. You
8441 can use the following flags in the rare cases when ``fine-tuning'' of
8442 optimizations to be performed is desired.
8443
8444 @table @gcctabopt
8445 @item -fno-defer-pop
8446 @opindex fno-defer-pop
8447 @opindex fdefer-pop
8448 For machines that must pop arguments after a function call, always pop
8449 the arguments as soon as each function returns.
8450 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8451 this allows the compiler to let arguments accumulate on the stack for several
8452 function calls and pop them all at once.
8453
8454 @item -fforward-propagate
8455 @opindex fforward-propagate
8456 Perform a forward propagation pass on RTL@. The pass tries to combine two
8457 instructions and checks if the result can be simplified. If loop unrolling
8458 is active, two passes are performed and the second is scheduled after
8459 loop unrolling.
8460
8461 This option is enabled by default at optimization levels @option{-O},
8462 @option{-O2}, @option{-O3}, @option{-Os}.
8463
8464 @item -ffp-contract=@var{style}
8465 @opindex ffp-contract
8466 @option{-ffp-contract=off} disables floating-point expression contraction.
8467 @option{-ffp-contract=fast} enables floating-point expression contraction
8468 such as forming of fused multiply-add operations if the target has
8469 native support for them.
8470 @option{-ffp-contract=on} enables floating-point expression contraction
8471 if allowed by the language standard. This is currently not implemented
8472 and treated equal to @option{-ffp-contract=off}.
8473
8474 The default is @option{-ffp-contract=fast}.
8475
8476 @item -fomit-frame-pointer
8477 @opindex fomit-frame-pointer
8478 Omit the frame pointer in functions that don't need one. This avoids the
8479 instructions to save, set up and restore the frame pointer; on many targets
8480 it also makes an extra register available.
8481
8482 On some targets this flag has no effect because the standard calling sequence
8483 always uses a frame pointer, so it cannot be omitted.
8484
8485 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8486 is used in all functions. Several targets always omit the frame pointer in
8487 leaf functions.
8488
8489 Enabled by default at @option{-O} and higher.
8490
8491 @item -foptimize-sibling-calls
8492 @opindex foptimize-sibling-calls
8493 Optimize sibling and tail recursive calls.
8494
8495 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8496
8497 @item -foptimize-strlen
8498 @opindex foptimize-strlen
8499 Optimize various standard C string functions (e.g.@: @code{strlen},
8500 @code{strchr} or @code{strcpy}) and
8501 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8502
8503 Enabled at levels @option{-O2}, @option{-O3}.
8504
8505 @item -fno-inline
8506 @opindex fno-inline
8507 @opindex finline
8508 Do not expand any functions inline apart from those marked with
8509 the @code{always_inline} attribute. This is the default when not
8510 optimizing.
8511
8512 Single functions can be exempted from inlining by marking them
8513 with the @code{noinline} attribute.
8514
8515 @item -finline-small-functions
8516 @opindex finline-small-functions
8517 Integrate functions into their callers when their body is smaller than expected
8518 function call code (so overall size of program gets smaller). The compiler
8519 heuristically decides which functions are simple enough to be worth integrating
8520 in this way. This inlining applies to all functions, even those not declared
8521 inline.
8522
8523 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8524
8525 @item -findirect-inlining
8526 @opindex findirect-inlining
8527 Inline also indirect calls that are discovered to be known at compile
8528 time thanks to previous inlining. This option has any effect only
8529 when inlining itself is turned on by the @option{-finline-functions}
8530 or @option{-finline-small-functions} options.
8531
8532 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8533
8534 @item -finline-functions
8535 @opindex finline-functions
8536 Consider all functions for inlining, even if they are not declared inline.
8537 The compiler heuristically decides which functions are worth integrating
8538 in this way.
8539
8540 If all calls to a given function are integrated, and the function is
8541 declared @code{static}, then the function is normally not output as
8542 assembler code in its own right.
8543
8544 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8545 by @option{-fprofile-use} and @option{-fauto-profile}.
8546
8547 @item -finline-functions-called-once
8548 @opindex finline-functions-called-once
8549 Consider all @code{static} functions called once for inlining into their
8550 caller even if they are not marked @code{inline}. If a call to a given
8551 function is integrated, then the function is not output as assembler code
8552 in its own right.
8553
8554 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8555 but not @option{-Og}.
8556
8557 @item -fearly-inlining
8558 @opindex fearly-inlining
8559 Inline functions marked by @code{always_inline} and functions whose body seems
8560 smaller than the function call overhead early before doing
8561 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8562 makes profiling significantly cheaper and usually inlining faster on programs
8563 having large chains of nested wrapper functions.
8564
8565 Enabled by default.
8566
8567 @item -fipa-sra
8568 @opindex fipa-sra
8569 Perform interprocedural scalar replacement of aggregates, removal of
8570 unused parameters and replacement of parameters passed by reference
8571 by parameters passed by value.
8572
8573 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8574
8575 @item -finline-limit=@var{n}
8576 @opindex finline-limit
8577 By default, GCC limits the size of functions that can be inlined. This flag
8578 allows coarse control of this limit. @var{n} is the size of functions that
8579 can be inlined in number of pseudo instructions.
8580
8581 Inlining is actually controlled by a number of parameters, which may be
8582 specified individually by using @option{--param @var{name}=@var{value}}.
8583 The @option{-finline-limit=@var{n}} option sets some of these parameters
8584 as follows:
8585
8586 @table @gcctabopt
8587 @item max-inline-insns-single
8588 is set to @var{n}/2.
8589 @item max-inline-insns-auto
8590 is set to @var{n}/2.
8591 @end table
8592
8593 See below for a documentation of the individual
8594 parameters controlling inlining and for the defaults of these parameters.
8595
8596 @emph{Note:} there may be no value to @option{-finline-limit} that results
8597 in default behavior.
8598
8599 @emph{Note:} pseudo instruction represents, in this particular context, an
8600 abstract measurement of function's size. In no way does it represent a count
8601 of assembly instructions and as such its exact meaning might change from one
8602 release to an another.
8603
8604 @item -fno-keep-inline-dllexport
8605 @opindex fno-keep-inline-dllexport
8606 @opindex fkeep-inline-dllexport
8607 This is a more fine-grained version of @option{-fkeep-inline-functions},
8608 which applies only to functions that are declared using the @code{dllexport}
8609 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8610 Functions}.
8611
8612 @item -fkeep-inline-functions
8613 @opindex fkeep-inline-functions
8614 In C, emit @code{static} functions that are declared @code{inline}
8615 into the object file, even if the function has been inlined into all
8616 of its callers. This switch does not affect functions using the
8617 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8618 inline functions into the object file.
8619
8620 @item -fkeep-static-functions
8621 @opindex fkeep-static-functions
8622 Emit @code{static} functions into the object file, even if the function
8623 is never used.
8624
8625 @item -fkeep-static-consts
8626 @opindex fkeep-static-consts
8627 Emit variables declared @code{static const} when optimization isn't turned
8628 on, even if the variables aren't referenced.
8629
8630 GCC enables this option by default. If you want to force the compiler to
8631 check if a variable is referenced, regardless of whether or not
8632 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8633
8634 @item -fmerge-constants
8635 @opindex fmerge-constants
8636 Attempt to merge identical constants (string constants and floating-point
8637 constants) across compilation units.
8638
8639 This option is the default for optimized compilation if the assembler and
8640 linker support it. Use @option{-fno-merge-constants} to inhibit this
8641 behavior.
8642
8643 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8644
8645 @item -fmerge-all-constants
8646 @opindex fmerge-all-constants
8647 Attempt to merge identical constants and identical variables.
8648
8649 This option implies @option{-fmerge-constants}. In addition to
8650 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8651 arrays or initialized constant variables with integral or floating-point
8652 types. Languages like C or C++ require each variable, including multiple
8653 instances of the same variable in recursive calls, to have distinct locations,
8654 so using this option results in non-conforming
8655 behavior.
8656
8657 @item -fmodulo-sched
8658 @opindex fmodulo-sched
8659 Perform swing modulo scheduling immediately before the first scheduling
8660 pass. This pass looks at innermost loops and reorders their
8661 instructions by overlapping different iterations.
8662
8663 @item -fmodulo-sched-allow-regmoves
8664 @opindex fmodulo-sched-allow-regmoves
8665 Perform more aggressive SMS-based modulo scheduling with register moves
8666 allowed. By setting this flag certain anti-dependences edges are
8667 deleted, which triggers the generation of reg-moves based on the
8668 life-range analysis. This option is effective only with
8669 @option{-fmodulo-sched} enabled.
8670
8671 @item -fno-branch-count-reg
8672 @opindex fno-branch-count-reg
8673 @opindex fbranch-count-reg
8674 Disable the optimization pass that scans for opportunities to use
8675 ``decrement and branch'' instructions on a count register instead of
8676 instruction sequences that decrement a register, compare it against zero, and
8677 then branch based upon the result. This option is only meaningful on
8678 architectures that support such instructions, which include x86, PowerPC,
8679 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8680 doesn't remove the decrement and branch instructions from the generated
8681 instruction stream introduced by other optimization passes.
8682
8683 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8684 except for @option{-Og}.
8685
8686 @item -fno-function-cse
8687 @opindex fno-function-cse
8688 @opindex ffunction-cse
8689 Do not put function addresses in registers; make each instruction that
8690 calls a constant function contain the function's address explicitly.
8691
8692 This option results in less efficient code, but some strange hacks
8693 that alter the assembler output may be confused by the optimizations
8694 performed when this option is not used.
8695
8696 The default is @option{-ffunction-cse}
8697
8698 @item -fno-zero-initialized-in-bss
8699 @opindex fno-zero-initialized-in-bss
8700 @opindex fzero-initialized-in-bss
8701 If the target supports a BSS section, GCC by default puts variables that
8702 are initialized to zero into BSS@. This can save space in the resulting
8703 code.
8704
8705 This option turns off this behavior because some programs explicitly
8706 rely on variables going to the data section---e.g., so that the
8707 resulting executable can find the beginning of that section and/or make
8708 assumptions based on that.
8709
8710 The default is @option{-fzero-initialized-in-bss}.
8711
8712 @item -fthread-jumps
8713 @opindex fthread-jumps
8714 Perform optimizations that check to see if a jump branches to a
8715 location where another comparison subsumed by the first is found. If
8716 so, the first branch is redirected to either the destination of the
8717 second branch or a point immediately following it, depending on whether
8718 the condition is known to be true or false.
8719
8720 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8721
8722 @item -fsplit-wide-types
8723 @opindex fsplit-wide-types
8724 When using a type that occupies multiple registers, such as @code{long
8725 long} on a 32-bit system, split the registers apart and allocate them
8726 independently. This normally generates better code for those types,
8727 but may make debugging more difficult.
8728
8729 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8730 @option{-Os}.
8731
8732 @item -fcse-follow-jumps
8733 @opindex fcse-follow-jumps
8734 In common subexpression elimination (CSE), scan through jump instructions
8735 when the target of the jump is not reached by any other path. For
8736 example, when CSE encounters an @code{if} statement with an
8737 @code{else} clause, CSE follows the jump when the condition
8738 tested is false.
8739
8740 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8741
8742 @item -fcse-skip-blocks
8743 @opindex fcse-skip-blocks
8744 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8745 follow jumps that conditionally skip over blocks. When CSE
8746 encounters a simple @code{if} statement with no else clause,
8747 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8748 body of the @code{if}.
8749
8750 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8751
8752 @item -frerun-cse-after-loop
8753 @opindex frerun-cse-after-loop
8754 Re-run common subexpression elimination after loop optimizations are
8755 performed.
8756
8757 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8758
8759 @item -fgcse
8760 @opindex fgcse
8761 Perform a global common subexpression elimination pass.
8762 This pass also performs global constant and copy propagation.
8763
8764 @emph{Note:} When compiling a program using computed gotos, a GCC
8765 extension, you may get better run-time performance if you disable
8766 the global common subexpression elimination pass by adding
8767 @option{-fno-gcse} to the command line.
8768
8769 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8770
8771 @item -fgcse-lm
8772 @opindex fgcse-lm
8773 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8774 attempts to move loads that are only killed by stores into themselves. This
8775 allows a loop containing a load/store sequence to be changed to a load outside
8776 the loop, and a copy/store within the loop.
8777
8778 Enabled by default when @option{-fgcse} is enabled.
8779
8780 @item -fgcse-sm
8781 @opindex fgcse-sm
8782 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8783 global common subexpression elimination. This pass attempts to move
8784 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8785 loops containing a load/store sequence can be changed to a load before
8786 the loop and a store after the loop.
8787
8788 Not enabled at any optimization level.
8789
8790 @item -fgcse-las
8791 @opindex fgcse-las
8792 When @option{-fgcse-las} is enabled, the global common subexpression
8793 elimination pass eliminates redundant loads that come after stores to the
8794 same memory location (both partial and full redundancies).
8795
8796 Not enabled at any optimization level.
8797
8798 @item -fgcse-after-reload
8799 @opindex fgcse-after-reload
8800 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8801 pass is performed after reload. The purpose of this pass is to clean up
8802 redundant spilling.
8803
8804 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8805
8806 @item -faggressive-loop-optimizations
8807 @opindex faggressive-loop-optimizations
8808 This option tells the loop optimizer to use language constraints to
8809 derive bounds for the number of iterations of a loop. This assumes that
8810 loop code does not invoke undefined behavior by for example causing signed
8811 integer overflows or out-of-bound array accesses. The bounds for the
8812 number of iterations of a loop are used to guide loop unrolling and peeling
8813 and loop exit test optimizations.
8814 This option is enabled by default.
8815
8816 @item -funconstrained-commons
8817 @opindex funconstrained-commons
8818 This option tells the compiler that variables declared in common blocks
8819 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8820 prevents certain optimizations that depend on knowing the array bounds.
8821
8822 @item -fcrossjumping
8823 @opindex fcrossjumping
8824 Perform cross-jumping transformation.
8825 This transformation unifies equivalent code and saves code size. The
8826 resulting code may or may not perform better than without cross-jumping.
8827
8828 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8829
8830 @item -fauto-inc-dec
8831 @opindex fauto-inc-dec
8832 Combine increments or decrements of addresses with memory accesses.
8833 This pass is always skipped on architectures that do not have
8834 instructions to support this. Enabled by default at @option{-O} and
8835 higher on architectures that support this.
8836
8837 @item -fdce
8838 @opindex fdce
8839 Perform dead code elimination (DCE) on RTL@.
8840 Enabled by default at @option{-O} and higher.
8841
8842 @item -fdse
8843 @opindex fdse
8844 Perform dead store elimination (DSE) on RTL@.
8845 Enabled by default at @option{-O} and higher.
8846
8847 @item -fif-conversion
8848 @opindex fif-conversion
8849 Attempt to transform conditional jumps into branch-less equivalents. This
8850 includes use of conditional moves, min, max, set flags and abs instructions, and
8851 some tricks doable by standard arithmetics. The use of conditional execution
8852 on chips where it is available is controlled by @option{-fif-conversion2}.
8853
8854 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8855 not with @option{-Og}.
8856
8857 @item -fif-conversion2
8858 @opindex fif-conversion2
8859 Use conditional execution (where available) to transform conditional jumps into
8860 branch-less equivalents.
8861
8862 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8863 not with @option{-Og}.
8864
8865 @item -fdeclone-ctor-dtor
8866 @opindex fdeclone-ctor-dtor
8867 The C++ ABI requires multiple entry points for constructors and
8868 destructors: one for a base subobject, one for a complete object, and
8869 one for a virtual destructor that calls operator delete afterwards.
8870 For a hierarchy with virtual bases, the base and complete variants are
8871 clones, which means two copies of the function. With this option, the
8872 base and complete variants are changed to be thunks that call a common
8873 implementation.
8874
8875 Enabled by @option{-Os}.
8876
8877 @item -fdelete-null-pointer-checks
8878 @opindex fdelete-null-pointer-checks
8879 Assume that programs cannot safely dereference null pointers, and that
8880 no code or data element resides at address zero.
8881 This option enables simple constant
8882 folding optimizations at all optimization levels. In addition, other
8883 optimization passes in GCC use this flag to control global dataflow
8884 analyses that eliminate useless checks for null pointers; these assume
8885 that a memory access to address zero always results in a trap, so
8886 that if a pointer is checked after it has already been dereferenced,
8887 it cannot be null.
8888
8889 Note however that in some environments this assumption is not true.
8890 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8891 for programs that depend on that behavior.
8892
8893 This option is enabled by default on most targets. On Nios II ELF, it
8894 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8895
8896 Passes that use the dataflow information
8897 are enabled independently at different optimization levels.
8898
8899 @item -fdevirtualize
8900 @opindex fdevirtualize
8901 Attempt to convert calls to virtual functions to direct calls. This
8902 is done both within a procedure and interprocedurally as part of
8903 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8904 propagation (@option{-fipa-cp}).
8905 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8906
8907 @item -fdevirtualize-speculatively
8908 @opindex fdevirtualize-speculatively
8909 Attempt to convert calls to virtual functions to speculative direct calls.
8910 Based on the analysis of the type inheritance graph, determine for a given call
8911 the set of likely targets. If the set is small, preferably of size 1, change
8912 the call into a conditional deciding between direct and indirect calls. The
8913 speculative calls enable more optimizations, such as inlining. When they seem
8914 useless after further optimization, they are converted back into original form.
8915
8916 @item -fdevirtualize-at-ltrans
8917 @opindex fdevirtualize-at-ltrans
8918 Stream extra information needed for aggressive devirtualization when running
8919 the link-time optimizer in local transformation mode.
8920 This option enables more devirtualization but
8921 significantly increases the size of streamed data. For this reason it is
8922 disabled by default.
8923
8924 @item -fexpensive-optimizations
8925 @opindex fexpensive-optimizations
8926 Perform a number of minor optimizations that are relatively expensive.
8927
8928 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8929
8930 @item -free
8931 @opindex free
8932 Attempt to remove redundant extension instructions. This is especially
8933 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8934 registers after writing to their lower 32-bit half.
8935
8936 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8937 @option{-O3}, @option{-Os}.
8938
8939 @item -fno-lifetime-dse
8940 @opindex fno-lifetime-dse
8941 @opindex flifetime-dse
8942 In C++ the value of an object is only affected by changes within its
8943 lifetime: when the constructor begins, the object has an indeterminate
8944 value, and any changes during the lifetime of the object are dead when
8945 the object is destroyed. Normally dead store elimination will take
8946 advantage of this; if your code relies on the value of the object
8947 storage persisting beyond the lifetime of the object, you can use this
8948 flag to disable this optimization. To preserve stores before the
8949 constructor starts (e.g.@: because your operator new clears the object
8950 storage) but still treat the object as dead after the destructor you,
8951 can use @option{-flifetime-dse=1}. The default behavior can be
8952 explicitly selected with @option{-flifetime-dse=2}.
8953 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8954
8955 @item -flive-range-shrinkage
8956 @opindex flive-range-shrinkage
8957 Attempt to decrease register pressure through register live range
8958 shrinkage. This is helpful for fast processors with small or moderate
8959 size register sets.
8960
8961 @item -fira-algorithm=@var{algorithm}
8962 @opindex fira-algorithm
8963 Use the specified coloring algorithm for the integrated register
8964 allocator. The @var{algorithm} argument can be @samp{priority}, which
8965 specifies Chow's priority coloring, or @samp{CB}, which specifies
8966 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8967 for all architectures, but for those targets that do support it, it is
8968 the default because it generates better code.
8969
8970 @item -fira-region=@var{region}
8971 @opindex fira-region
8972 Use specified regions for the integrated register allocator. The
8973 @var{region} argument should be one of the following:
8974
8975 @table @samp
8976
8977 @item all
8978 Use all loops as register allocation regions.
8979 This can give the best results for machines with a small and/or
8980 irregular register set.
8981
8982 @item mixed
8983 Use all loops except for loops with small register pressure
8984 as the regions. This value usually gives
8985 the best results in most cases and for most architectures,
8986 and is enabled by default when compiling with optimization for speed
8987 (@option{-O}, @option{-O2}, @dots{}).
8988
8989 @item one
8990 Use all functions as a single region.
8991 This typically results in the smallest code size, and is enabled by default for
8992 @option{-Os} or @option{-O0}.
8993
8994 @end table
8995
8996 @item -fira-hoist-pressure
8997 @opindex fira-hoist-pressure
8998 Use IRA to evaluate register pressure in the code hoisting pass for
8999 decisions to hoist expressions. This option usually results in smaller
9000 code, but it can slow the compiler down.
9001
9002 This option is enabled at level @option{-Os} for all targets.
9003
9004 @item -fira-loop-pressure
9005 @opindex fira-loop-pressure
9006 Use IRA to evaluate register pressure in loops for decisions to move
9007 loop invariants. This option usually results in generation
9008 of faster and smaller code on machines with large register files (>= 32
9009 registers), but it can slow the compiler down.
9010
9011 This option is enabled at level @option{-O3} for some targets.
9012
9013 @item -fno-ira-share-save-slots
9014 @opindex fno-ira-share-save-slots
9015 @opindex fira-share-save-slots
9016 Disable sharing of stack slots used for saving call-used hard
9017 registers living through a call. Each hard register gets a
9018 separate stack slot, and as a result function stack frames are
9019 larger.
9020
9021 @item -fno-ira-share-spill-slots
9022 @opindex fno-ira-share-spill-slots
9023 @opindex fira-share-spill-slots
9024 Disable sharing of stack slots allocated for pseudo-registers. Each
9025 pseudo-register that does not get a hard register gets a separate
9026 stack slot, and as a result function stack frames are larger.
9027
9028 @item -flra-remat
9029 @opindex flra-remat
9030 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9031 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9032 values if it is profitable.
9033
9034 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9035
9036 @item -fdelayed-branch
9037 @opindex fdelayed-branch
9038 If supported for the target machine, attempt to reorder instructions
9039 to exploit instruction slots available after delayed branch
9040 instructions.
9041
9042 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9043 but not at @option{-Og}.
9044
9045 @item -fschedule-insns
9046 @opindex fschedule-insns
9047 If supported for the target machine, attempt to reorder instructions to
9048 eliminate execution stalls due to required data being unavailable. This
9049 helps machines that have slow floating point or memory load instructions
9050 by allowing other instructions to be issued until the result of the load
9051 or floating-point instruction is required.
9052
9053 Enabled at levels @option{-O2}, @option{-O3}.
9054
9055 @item -fschedule-insns2
9056 @opindex fschedule-insns2
9057 Similar to @option{-fschedule-insns}, but requests an additional pass of
9058 instruction scheduling after register allocation has been done. This is
9059 especially useful on machines with a relatively small number of
9060 registers and where memory load instructions take more than one cycle.
9061
9062 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9063
9064 @item -fno-sched-interblock
9065 @opindex fno-sched-interblock
9066 @opindex fsched-interblock
9067 Disable instruction scheduling across basic blocks, which
9068 is normally enabled when scheduling before register allocation, i.e.@:
9069 with @option{-fschedule-insns} or at @option{-O2} or higher.
9070
9071 @item -fno-sched-spec
9072 @opindex fno-sched-spec
9073 @opindex fsched-spec
9074 Disable speculative motion of non-load instructions, which
9075 is normally enabled when scheduling before register allocation, i.e.@:
9076 with @option{-fschedule-insns} or at @option{-O2} or higher.
9077
9078 @item -fsched-pressure
9079 @opindex fsched-pressure
9080 Enable register pressure sensitive insn scheduling before register
9081 allocation. This only makes sense when scheduling before register
9082 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9083 @option{-O2} or higher. Usage of this option can improve the
9084 generated code and decrease its size by preventing register pressure
9085 increase above the number of available hard registers and subsequent
9086 spills in register allocation.
9087
9088 @item -fsched-spec-load
9089 @opindex fsched-spec-load
9090 Allow speculative motion of some load instructions. This only makes
9091 sense when scheduling before register allocation, i.e.@: with
9092 @option{-fschedule-insns} or at @option{-O2} or higher.
9093
9094 @item -fsched-spec-load-dangerous
9095 @opindex fsched-spec-load-dangerous
9096 Allow speculative motion of more load instructions. This only makes
9097 sense when scheduling before register allocation, i.e.@: with
9098 @option{-fschedule-insns} or at @option{-O2} or higher.
9099
9100 @item -fsched-stalled-insns
9101 @itemx -fsched-stalled-insns=@var{n}
9102 @opindex fsched-stalled-insns
9103 Define how many insns (if any) can be moved prematurely from the queue
9104 of stalled insns into the ready list during the second scheduling pass.
9105 @option{-fno-sched-stalled-insns} means that no insns are moved
9106 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9107 on how many queued insns can be moved prematurely.
9108 @option{-fsched-stalled-insns} without a value is equivalent to
9109 @option{-fsched-stalled-insns=1}.
9110
9111 @item -fsched-stalled-insns-dep
9112 @itemx -fsched-stalled-insns-dep=@var{n}
9113 @opindex fsched-stalled-insns-dep
9114 Define how many insn groups (cycles) are examined for a dependency
9115 on a stalled insn that is a candidate for premature removal from the queue
9116 of stalled insns. This has an effect only during the second scheduling pass,
9117 and only if @option{-fsched-stalled-insns} is used.
9118 @option{-fno-sched-stalled-insns-dep} is equivalent to
9119 @option{-fsched-stalled-insns-dep=0}.
9120 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9121 @option{-fsched-stalled-insns-dep=1}.
9122
9123 @item -fsched2-use-superblocks
9124 @opindex fsched2-use-superblocks
9125 When scheduling after register allocation, use superblock scheduling.
9126 This allows motion across basic block boundaries,
9127 resulting in faster schedules. This option is experimental, as not all machine
9128 descriptions used by GCC model the CPU closely enough to avoid unreliable
9129 results from the algorithm.
9130
9131 This only makes sense when scheduling after register allocation, i.e.@: with
9132 @option{-fschedule-insns2} or at @option{-O2} or higher.
9133
9134 @item -fsched-group-heuristic
9135 @opindex fsched-group-heuristic
9136 Enable the group heuristic in the scheduler. This heuristic favors
9137 the instruction that belongs to a schedule group. This is enabled
9138 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9139 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9140
9141 @item -fsched-critical-path-heuristic
9142 @opindex fsched-critical-path-heuristic
9143 Enable the critical-path heuristic in the scheduler. This heuristic favors
9144 instructions on the critical path. This is enabled by default when
9145 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9146 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9147
9148 @item -fsched-spec-insn-heuristic
9149 @opindex fsched-spec-insn-heuristic
9150 Enable the speculative instruction heuristic in the scheduler. This
9151 heuristic favors speculative instructions with greater dependency weakness.
9152 This is enabled by default when scheduling is enabled, i.e.@:
9153 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9154 or at @option{-O2} or higher.
9155
9156 @item -fsched-rank-heuristic
9157 @opindex fsched-rank-heuristic
9158 Enable the rank heuristic in the scheduler. This heuristic favors
9159 the instruction belonging to a basic block with greater size or frequency.
9160 This is enabled by default when scheduling is enabled, i.e.@:
9161 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9162 at @option{-O2} or higher.
9163
9164 @item -fsched-last-insn-heuristic
9165 @opindex fsched-last-insn-heuristic
9166 Enable the last-instruction heuristic in the scheduler. This heuristic
9167 favors the instruction that is less dependent on the last instruction
9168 scheduled. This is enabled by default when scheduling is enabled,
9169 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9170 at @option{-O2} or higher.
9171
9172 @item -fsched-dep-count-heuristic
9173 @opindex fsched-dep-count-heuristic
9174 Enable the dependent-count heuristic in the scheduler. This heuristic
9175 favors the instruction that has more instructions depending on it.
9176 This is enabled by default when scheduling is enabled, i.e.@:
9177 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9178 at @option{-O2} or higher.
9179
9180 @item -freschedule-modulo-scheduled-loops
9181 @opindex freschedule-modulo-scheduled-loops
9182 Modulo scheduling is performed before traditional scheduling. If a loop
9183 is modulo scheduled, later scheduling passes may change its schedule.
9184 Use this option to control that behavior.
9185
9186 @item -fselective-scheduling
9187 @opindex fselective-scheduling
9188 Schedule instructions using selective scheduling algorithm. Selective
9189 scheduling runs instead of the first scheduler pass.
9190
9191 @item -fselective-scheduling2
9192 @opindex fselective-scheduling2
9193 Schedule instructions using selective scheduling algorithm. Selective
9194 scheduling runs instead of the second scheduler pass.
9195
9196 @item -fsel-sched-pipelining
9197 @opindex fsel-sched-pipelining
9198 Enable software pipelining of innermost loops during selective scheduling.
9199 This option has no effect unless one of @option{-fselective-scheduling} or
9200 @option{-fselective-scheduling2} is turned on.
9201
9202 @item -fsel-sched-pipelining-outer-loops
9203 @opindex fsel-sched-pipelining-outer-loops
9204 When pipelining loops during selective scheduling, also pipeline outer loops.
9205 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9206
9207 @item -fsemantic-interposition
9208 @opindex fsemantic-interposition
9209 Some object formats, like ELF, allow interposing of symbols by the
9210 dynamic linker.
9211 This means that for symbols exported from the DSO, the compiler cannot perform
9212 interprocedural propagation, inlining and other optimizations in anticipation
9213 that the function or variable in question may change. While this feature is
9214 useful, for example, to rewrite memory allocation functions by a debugging
9215 implementation, it is expensive in the terms of code quality.
9216 With @option{-fno-semantic-interposition} the compiler assumes that
9217 if interposition happens for functions the overwriting function will have
9218 precisely the same semantics (and side effects).
9219 Similarly if interposition happens
9220 for variables, the constructor of the variable will be the same. The flag
9221 has no effect for functions explicitly declared inline
9222 (where it is never allowed for interposition to change semantics)
9223 and for symbols explicitly declared weak.
9224
9225 @item -fshrink-wrap
9226 @opindex fshrink-wrap
9227 Emit function prologues only before parts of the function that need it,
9228 rather than at the top of the function. This flag is enabled by default at
9229 @option{-O} and higher.
9230
9231 @item -fshrink-wrap-separate
9232 @opindex fshrink-wrap-separate
9233 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9234 those parts are only executed when needed.
9235 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9236 is also turned on and the target supports this.
9237
9238 @item -fcaller-saves
9239 @opindex fcaller-saves
9240 Enable allocation of values to registers that are clobbered by
9241 function calls, by emitting extra instructions to save and restore the
9242 registers around such calls. Such allocation is done only when it
9243 seems to result in better code.
9244
9245 This option is always enabled by default on certain machines, usually
9246 those which have no call-preserved registers to use instead.
9247
9248 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9249
9250 @item -fcombine-stack-adjustments
9251 @opindex fcombine-stack-adjustments
9252 Tracks stack adjustments (pushes and pops) and stack memory references
9253 and then tries to find ways to combine them.
9254
9255 Enabled by default at @option{-O1} and higher.
9256
9257 @item -fipa-ra
9258 @opindex fipa-ra
9259 Use caller save registers for allocation if those registers are not used by
9260 any called function. In that case it is not necessary to save and restore
9261 them around calls. This is only possible if called functions are part of
9262 same compilation unit as current function and they are compiled before it.
9263
9264 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9265 is disabled if generated code will be instrumented for profiling
9266 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9267 exactly (this happens on targets that do not expose prologues
9268 and epilogues in RTL).
9269
9270 @item -fconserve-stack
9271 @opindex fconserve-stack
9272 Attempt to minimize stack usage. The compiler attempts to use less
9273 stack space, even if that makes the program slower. This option
9274 implies setting the @option{large-stack-frame} parameter to 100
9275 and the @option{large-stack-frame-growth} parameter to 400.
9276
9277 @item -ftree-reassoc
9278 @opindex ftree-reassoc
9279 Perform reassociation on trees. This flag is enabled by default
9280 at @option{-O} and higher.
9281
9282 @item -fcode-hoisting
9283 @opindex fcode-hoisting
9284 Perform code hoisting. Code hoisting tries to move the
9285 evaluation of expressions executed on all paths to the function exit
9286 as early as possible. This is especially useful as a code size
9287 optimization, but it often helps for code speed as well.
9288 This flag is enabled by default at @option{-O2} and higher.
9289
9290 @item -ftree-pre
9291 @opindex ftree-pre
9292 Perform partial redundancy elimination (PRE) on trees. This flag is
9293 enabled by default at @option{-O2} and @option{-O3}.
9294
9295 @item -ftree-partial-pre
9296 @opindex ftree-partial-pre
9297 Make partial redundancy elimination (PRE) more aggressive. This flag is
9298 enabled by default at @option{-O3}.
9299
9300 @item -ftree-forwprop
9301 @opindex ftree-forwprop
9302 Perform forward propagation on trees. This flag is enabled by default
9303 at @option{-O} and higher.
9304
9305 @item -ftree-fre
9306 @opindex ftree-fre
9307 Perform full redundancy elimination (FRE) on trees. The difference
9308 between FRE and PRE is that FRE only considers expressions
9309 that are computed on all paths leading to the redundant computation.
9310 This analysis is faster than PRE, though it exposes fewer redundancies.
9311 This flag is enabled by default at @option{-O} and higher.
9312
9313 @item -ftree-phiprop
9314 @opindex ftree-phiprop
9315 Perform hoisting of loads from conditional pointers on trees. This
9316 pass is enabled by default at @option{-O} and higher.
9317
9318 @item -fhoist-adjacent-loads
9319 @opindex fhoist-adjacent-loads
9320 Speculatively hoist loads from both branches of an if-then-else if the
9321 loads are from adjacent locations in the same structure and the target
9322 architecture has a conditional move instruction. This flag is enabled
9323 by default at @option{-O2} and higher.
9324
9325 @item -ftree-copy-prop
9326 @opindex ftree-copy-prop
9327 Perform copy propagation on trees. This pass eliminates unnecessary
9328 copy operations. This flag is enabled by default at @option{-O} and
9329 higher.
9330
9331 @item -fipa-pure-const
9332 @opindex fipa-pure-const
9333 Discover which functions are pure or constant.
9334 Enabled by default at @option{-O} and higher.
9335
9336 @item -fipa-reference
9337 @opindex fipa-reference
9338 Discover which static variables do not escape the
9339 compilation unit.
9340 Enabled by default at @option{-O} and higher.
9341
9342 @item -fipa-reference-addressable
9343 @opindex fipa-reference-addressable
9344 Discover read-only, write-only and non-addressable static variables.
9345 Enabled by default at @option{-O} and higher.
9346
9347 @item -fipa-stack-alignment
9348 @opindex fipa-stack-alignment
9349 Reduce stack alignment on call sites if possible.
9350 Enabled by default.
9351
9352 @item -fipa-pta
9353 @opindex fipa-pta
9354 Perform interprocedural pointer analysis and interprocedural modification
9355 and reference analysis. This option can cause excessive memory and
9356 compile-time usage on large compilation units. It is not enabled by
9357 default at any optimization level.
9358
9359 @item -fipa-profile
9360 @opindex fipa-profile
9361 Perform interprocedural profile propagation. The functions called only from
9362 cold functions are marked as cold. Also functions executed once (such as
9363 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9364 functions and loop less parts of functions executed once are then optimized for
9365 size.
9366 Enabled by default at @option{-O} and higher.
9367
9368 @item -fipa-cp
9369 @opindex fipa-cp
9370 Perform interprocedural constant propagation.
9371 This optimization analyzes the program to determine when values passed
9372 to functions are constants and then optimizes accordingly.
9373 This optimization can substantially increase performance
9374 if the application has constants passed to functions.
9375 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9376 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9377
9378 @item -fipa-cp-clone
9379 @opindex fipa-cp-clone
9380 Perform function cloning to make interprocedural constant propagation stronger.
9381 When enabled, interprocedural constant propagation performs function cloning
9382 when externally visible function can be called with constant arguments.
9383 Because this optimization can create multiple copies of functions,
9384 it may significantly increase code size
9385 (see @option{--param ipcp-unit-growth=@var{value}}).
9386 This flag is enabled by default at @option{-O3}.
9387 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9388
9389 @item -fipa-bit-cp
9390 @opindex fipa-bit-cp
9391 When enabled, perform interprocedural bitwise constant
9392 propagation. This flag is enabled by default at @option{-O2} and
9393 by @option{-fprofile-use} and @option{-fauto-profile}.
9394 It requires that @option{-fipa-cp} is enabled.
9395
9396 @item -fipa-vrp
9397 @opindex fipa-vrp
9398 When enabled, perform interprocedural propagation of value
9399 ranges. This flag is enabled by default at @option{-O2}. It requires
9400 that @option{-fipa-cp} is enabled.
9401
9402 @item -fipa-icf
9403 @opindex fipa-icf
9404 Perform Identical Code Folding for functions and read-only variables.
9405 The optimization reduces code size and may disturb unwind stacks by replacing
9406 a function by equivalent one with a different name. The optimization works
9407 more effectively with link-time optimization enabled.
9408
9409 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9410 works on different levels and thus the optimizations are not same - there are
9411 equivalences that are found only by GCC and equivalences found only by Gold.
9412
9413 This flag is enabled by default at @option{-O2} and @option{-Os}.
9414
9415 @item -flive-patching=@var{level}
9416 @opindex flive-patching
9417 Control GCC's optimizations to produce output suitable for live-patching.
9418
9419 If the compiler's optimization uses a function's body or information extracted
9420 from its body to optimize/change another function, the latter is called an
9421 impacted function of the former. If a function is patched, its impacted
9422 functions should be patched too.
9423
9424 The impacted functions are determined by the compiler's interprocedural
9425 optimizations. For example, a caller is impacted when inlining a function
9426 into its caller,
9427 cloning a function and changing its caller to call this new clone,
9428 or extracting a function's pureness/constness information to optimize
9429 its direct or indirect callers, etc.
9430
9431 Usually, the more IPA optimizations enabled, the larger the number of
9432 impacted functions for each function. In order to control the number of
9433 impacted functions and more easily compute the list of impacted function,
9434 IPA optimizations can be partially enabled at two different levels.
9435
9436 The @var{level} argument should be one of the following:
9437
9438 @table @samp
9439
9440 @item inline-clone
9441
9442 Only enable inlining and cloning optimizations, which includes inlining,
9443 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9444 As a result, when patching a function, all its callers and its clones'
9445 callers are impacted, therefore need to be patched as well.
9446
9447 @option{-flive-patching=inline-clone} disables the following optimization flags:
9448 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9449 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9450 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9451 -fipa-stack-alignment}
9452
9453 @item inline-only-static
9454
9455 Only enable inlining of static functions.
9456 As a result, when patching a static function, all its callers are impacted
9457 and so need to be patched as well.
9458
9459 In addition to all the flags that @option{-flive-patching=inline-clone}
9460 disables,
9461 @option{-flive-patching=inline-only-static} disables the following additional
9462 optimization flags:
9463 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9464
9465 @end table
9466
9467 When @option{-flive-patching} is specified without any value, the default value
9468 is @var{inline-clone}.
9469
9470 This flag is disabled by default.
9471
9472 Note that @option{-flive-patching} is not supported with link-time optimization
9473 (@option{-flto}).
9474
9475 @item -fisolate-erroneous-paths-dereference
9476 @opindex fisolate-erroneous-paths-dereference
9477 Detect paths that trigger erroneous or undefined behavior due to
9478 dereferencing a null pointer. Isolate those paths from the main control
9479 flow and turn the statement with erroneous or undefined behavior into a trap.
9480 This flag is enabled by default at @option{-O2} and higher and depends on
9481 @option{-fdelete-null-pointer-checks} also being enabled.
9482
9483 @item -fisolate-erroneous-paths-attribute
9484 @opindex fisolate-erroneous-paths-attribute
9485 Detect paths that trigger erroneous or undefined behavior due to a null value
9486 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9487 attribute. Isolate those paths from the main control flow and turn the
9488 statement with erroneous or undefined behavior into a trap. This is not
9489 currently enabled, but may be enabled by @option{-O2} in the future.
9490
9491 @item -ftree-sink
9492 @opindex ftree-sink
9493 Perform forward store motion on trees. This flag is
9494 enabled by default at @option{-O} and higher.
9495
9496 @item -ftree-bit-ccp
9497 @opindex ftree-bit-ccp
9498 Perform sparse conditional bit constant propagation on trees and propagate
9499 pointer alignment information.
9500 This pass only operates on local scalar variables and is enabled by default
9501 at @option{-O1} and higher, except for @option{-Og}.
9502 It requires that @option{-ftree-ccp} is enabled.
9503
9504 @item -ftree-ccp
9505 @opindex ftree-ccp
9506 Perform sparse conditional constant propagation (CCP) on trees. This
9507 pass only operates on local scalar variables and is enabled by default
9508 at @option{-O} and higher.
9509
9510 @item -fssa-backprop
9511 @opindex fssa-backprop
9512 Propagate information about uses of a value up the definition chain
9513 in order to simplify the definitions. For example, this pass strips
9514 sign operations if the sign of a value never matters. The flag is
9515 enabled by default at @option{-O} and higher.
9516
9517 @item -fssa-phiopt
9518 @opindex fssa-phiopt
9519 Perform pattern matching on SSA PHI nodes to optimize conditional
9520 code. This pass is enabled by default at @option{-O1} and higher,
9521 except for @option{-Og}.
9522
9523 @item -ftree-switch-conversion
9524 @opindex ftree-switch-conversion
9525 Perform conversion of simple initializations in a switch to
9526 initializations from a scalar array. This flag is enabled by default
9527 at @option{-O2} and higher.
9528
9529 @item -ftree-tail-merge
9530 @opindex ftree-tail-merge
9531 Look for identical code sequences. When found, replace one with a jump to the
9532 other. This optimization is known as tail merging or cross jumping. This flag
9533 is enabled by default at @option{-O2} and higher. The compilation time
9534 in this pass can
9535 be limited using @option{max-tail-merge-comparisons} parameter and
9536 @option{max-tail-merge-iterations} parameter.
9537
9538 @item -ftree-dce
9539 @opindex ftree-dce
9540 Perform dead code elimination (DCE) on trees. This flag is enabled by
9541 default at @option{-O} and higher.
9542
9543 @item -ftree-builtin-call-dce
9544 @opindex ftree-builtin-call-dce
9545 Perform conditional dead code elimination (DCE) for calls to built-in functions
9546 that may set @code{errno} but are otherwise free of side effects. This flag is
9547 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9548 specified.
9549
9550 @item -ffinite-loops
9551 @opindex ffinite-loops
9552 @opindex fno-finite-loops
9553 Assume that a loop with an exit will eventually take the exit and not loop
9554 indefinitely. This allows the compiler to remove loops that otherwise have
9555 no side-effects, not considering eventual endless looping as such.
9556
9557 This option is enabled by default at @option{-O2}.
9558
9559 @item -ftree-dominator-opts
9560 @opindex ftree-dominator-opts
9561 Perform a variety of simple scalar cleanups (constant/copy
9562 propagation, redundancy elimination, range propagation and expression
9563 simplification) based on a dominator tree traversal. This also
9564 performs jump threading (to reduce jumps to jumps). This flag is
9565 enabled by default at @option{-O} and higher.
9566
9567 @item -ftree-dse
9568 @opindex ftree-dse
9569 Perform dead store elimination (DSE) on trees. A dead store is a store into
9570 a memory location that is later overwritten by another store without
9571 any intervening loads. In this case the earlier store can be deleted. This
9572 flag is enabled by default at @option{-O} and higher.
9573
9574 @item -ftree-ch
9575 @opindex ftree-ch
9576 Perform loop header copying on trees. This is beneficial since it increases
9577 effectiveness of code motion optimizations. It also saves one jump. This flag
9578 is enabled by default at @option{-O} and higher. It is not enabled
9579 for @option{-Os}, since it usually increases code size.
9580
9581 @item -ftree-loop-optimize
9582 @opindex ftree-loop-optimize
9583 Perform loop optimizations on trees. This flag is enabled by default
9584 at @option{-O} and higher.
9585
9586 @item -ftree-loop-linear
9587 @itemx -floop-strip-mine
9588 @itemx -floop-block
9589 @opindex ftree-loop-linear
9590 @opindex floop-strip-mine
9591 @opindex floop-block
9592 Perform loop nest optimizations. Same as
9593 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9594 to be configured with @option{--with-isl} to enable the Graphite loop
9595 transformation infrastructure.
9596
9597 @item -fgraphite-identity
9598 @opindex fgraphite-identity
9599 Enable the identity transformation for graphite. For every SCoP we generate
9600 the polyhedral representation and transform it back to gimple. Using
9601 @option{-fgraphite-identity} we can check the costs or benefits of the
9602 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9603 are also performed by the code generator isl, like index splitting and
9604 dead code elimination in loops.
9605
9606 @item -floop-nest-optimize
9607 @opindex floop-nest-optimize
9608 Enable the isl based loop nest optimizer. This is a generic loop nest
9609 optimizer based on the Pluto optimization algorithms. It calculates a loop
9610 structure optimized for data-locality and parallelism. This option
9611 is experimental.
9612
9613 @item -floop-parallelize-all
9614 @opindex floop-parallelize-all
9615 Use the Graphite data dependence analysis to identify loops that can
9616 be parallelized. Parallelize all the loops that can be analyzed to
9617 not contain loop carried dependences without checking that it is
9618 profitable to parallelize the loops.
9619
9620 @item -ftree-coalesce-vars
9621 @opindex ftree-coalesce-vars
9622 While transforming the program out of the SSA representation, attempt to
9623 reduce copying by coalescing versions of different user-defined
9624 variables, instead of just compiler temporaries. This may severely
9625 limit the ability to debug an optimized program compiled with
9626 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9627 prevents SSA coalescing of user variables. This option is enabled by
9628 default if optimization is enabled, and it does very little otherwise.
9629
9630 @item -ftree-loop-if-convert
9631 @opindex ftree-loop-if-convert
9632 Attempt to transform conditional jumps in the innermost loops to
9633 branch-less equivalents. The intent is to remove control-flow from
9634 the innermost loops in order to improve the ability of the
9635 vectorization pass to handle these loops. This is enabled by default
9636 if vectorization is enabled.
9637
9638 @item -ftree-loop-distribution
9639 @opindex ftree-loop-distribution
9640 Perform loop distribution. This flag can improve cache performance on
9641 big loop bodies and allow further loop optimizations, like
9642 parallelization or vectorization, to take place. For example, the loop
9643 @smallexample
9644 DO I = 1, N
9645 A(I) = B(I) + C
9646 D(I) = E(I) * F
9647 ENDDO
9648 @end smallexample
9649 is transformed to
9650 @smallexample
9651 DO I = 1, N
9652 A(I) = B(I) + C
9653 ENDDO
9654 DO I = 1, N
9655 D(I) = E(I) * F
9656 ENDDO
9657 @end smallexample
9658 This flag is enabled by default at @option{-O3}.
9659 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9660
9661 @item -ftree-loop-distribute-patterns
9662 @opindex ftree-loop-distribute-patterns
9663 Perform loop distribution of patterns that can be code generated with
9664 calls to a library. This flag is enabled by default at @option{-O3}, and
9665 by @option{-fprofile-use} and @option{-fauto-profile}.
9666
9667 This pass distributes the initialization loops and generates a call to
9668 memset zero. For example, the loop
9669 @smallexample
9670 DO I = 1, N
9671 A(I) = 0
9672 B(I) = A(I) + I
9673 ENDDO
9674 @end smallexample
9675 is transformed to
9676 @smallexample
9677 DO I = 1, N
9678 A(I) = 0
9679 ENDDO
9680 DO I = 1, N
9681 B(I) = A(I) + I
9682 ENDDO
9683 @end smallexample
9684 and the initialization loop is transformed into a call to memset zero.
9685 This flag is enabled by default at @option{-O3}.
9686 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9687
9688 @item -floop-interchange
9689 @opindex floop-interchange
9690 Perform loop interchange outside of graphite. This flag can improve cache
9691 performance on loop nest and allow further loop optimizations, like
9692 vectorization, to take place. For example, the loop
9693 @smallexample
9694 for (int i = 0; i < N; i++)
9695 for (int j = 0; j < N; j++)
9696 for (int k = 0; k < N; k++)
9697 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9698 @end smallexample
9699 is transformed to
9700 @smallexample
9701 for (int i = 0; i < N; i++)
9702 for (int k = 0; k < N; k++)
9703 for (int j = 0; j < N; j++)
9704 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9705 @end smallexample
9706 This flag is enabled by default at @option{-O3}.
9707 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9708
9709 @item -floop-unroll-and-jam
9710 @opindex floop-unroll-and-jam
9711 Apply unroll and jam transformations on feasible loops. In a loop
9712 nest this unrolls the outer loop by some factor and fuses the resulting
9713 multiple inner loops. This flag is enabled by default at @option{-O3}.
9714 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9715
9716 @item -ftree-loop-im
9717 @opindex ftree-loop-im
9718 Perform loop invariant motion on trees. This pass moves only invariants that
9719 are hard to handle at RTL level (function calls, operations that expand to
9720 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9721 operands of conditions that are invariant out of the loop, so that we can use
9722 just trivial invariantness analysis in loop unswitching. The pass also includes
9723 store motion.
9724
9725 @item -ftree-loop-ivcanon
9726 @opindex ftree-loop-ivcanon
9727 Create a canonical counter for number of iterations in loops for which
9728 determining number of iterations requires complicated analysis. Later
9729 optimizations then may determine the number easily. Useful especially
9730 in connection with unrolling.
9731
9732 @item -ftree-scev-cprop
9733 @opindex ftree-scev-cprop
9734 Perform final value replacement. If a variable is modified in a loop
9735 in such a way that its value when exiting the loop can be determined using
9736 only its initial value and the number of loop iterations, replace uses of
9737 the final value by such a computation, provided it is sufficiently cheap.
9738 This reduces data dependencies and may allow further simplifications.
9739 Enabled by default at @option{-O} and higher.
9740
9741 @item -fivopts
9742 @opindex fivopts
9743 Perform induction variable optimizations (strength reduction, induction
9744 variable merging and induction variable elimination) on trees.
9745
9746 @item -ftree-parallelize-loops=n
9747 @opindex ftree-parallelize-loops
9748 Parallelize loops, i.e., split their iteration space to run in n threads.
9749 This is only possible for loops whose iterations are independent
9750 and can be arbitrarily reordered. The optimization is only
9751 profitable on multiprocessor machines, for loops that are CPU-intensive,
9752 rather than constrained e.g.@: by memory bandwidth. This option
9753 implies @option{-pthread}, and thus is only supported on targets
9754 that have support for @option{-pthread}.
9755
9756 @item -ftree-pta
9757 @opindex ftree-pta
9758 Perform function-local points-to analysis on trees. This flag is
9759 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9760
9761 @item -ftree-sra
9762 @opindex ftree-sra
9763 Perform scalar replacement of aggregates. This pass replaces structure
9764 references with scalars to prevent committing structures to memory too
9765 early. This flag is enabled by default at @option{-O1} and higher,
9766 except for @option{-Og}.
9767
9768 @item -fstore-merging
9769 @opindex fstore-merging
9770 Perform merging of narrow stores to consecutive memory addresses. This pass
9771 merges contiguous stores of immediate values narrower than a word into fewer
9772 wider stores to reduce the number of instructions. This is enabled by default
9773 at @option{-O2} and higher as well as @option{-Os}.
9774
9775 @item -ftree-ter
9776 @opindex ftree-ter
9777 Perform temporary expression replacement during the SSA->normal phase. Single
9778 use/single def temporaries are replaced at their use location with their
9779 defining expression. This results in non-GIMPLE code, but gives the expanders
9780 much more complex trees to work on resulting in better RTL generation. This is
9781 enabled by default at @option{-O} and higher.
9782
9783 @item -ftree-slsr
9784 @opindex ftree-slsr
9785 Perform straight-line strength reduction on trees. This recognizes related
9786 expressions involving multiplications and replaces them by less expensive
9787 calculations when possible. This is enabled by default at @option{-O} and
9788 higher.
9789
9790 @item -ftree-vectorize
9791 @opindex ftree-vectorize
9792 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9793 and @option{-ftree-slp-vectorize} if not explicitly specified.
9794
9795 @item -ftree-loop-vectorize
9796 @opindex ftree-loop-vectorize
9797 Perform loop vectorization on trees. This flag is enabled by default at
9798 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9799 and @option{-fauto-profile}.
9800
9801 @item -ftree-slp-vectorize
9802 @opindex ftree-slp-vectorize
9803 Perform basic block vectorization on trees. This flag is enabled by default at
9804 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9805 and @option{-fauto-profile}.
9806
9807 @item -fvect-cost-model=@var{model}
9808 @opindex fvect-cost-model
9809 Alter the cost model used for vectorization. The @var{model} argument
9810 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9811 With the @samp{unlimited} model the vectorized code-path is assumed
9812 to be profitable while with the @samp{dynamic} model a runtime check
9813 guards the vectorized code-path to enable it only for iteration
9814 counts that will likely execute faster than when executing the original
9815 scalar loop. The @samp{cheap} model disables vectorization of
9816 loops where doing so would be cost prohibitive for example due to
9817 required runtime checks for data dependence or alignment but otherwise
9818 is equal to the @samp{dynamic} model.
9819 The default cost model depends on other optimization flags and is
9820 either @samp{dynamic} or @samp{cheap}.
9821
9822 @item -fsimd-cost-model=@var{model}
9823 @opindex fsimd-cost-model
9824 Alter the cost model used for vectorization of loops marked with the OpenMP
9825 simd directive. The @var{model} argument should be one of
9826 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9827 have the same meaning as described in @option{-fvect-cost-model} and by
9828 default a cost model defined with @option{-fvect-cost-model} is used.
9829
9830 @item -ftree-vrp
9831 @opindex ftree-vrp
9832 Perform Value Range Propagation on trees. This is similar to the
9833 constant propagation pass, but instead of values, ranges of values are
9834 propagated. This allows the optimizers to remove unnecessary range
9835 checks like array bound checks and null pointer checks. This is
9836 enabled by default at @option{-O2} and higher. Null pointer check
9837 elimination is only done if @option{-fdelete-null-pointer-checks} is
9838 enabled.
9839
9840 @item -fsplit-paths
9841 @opindex fsplit-paths
9842 Split paths leading to loop backedges. This can improve dead code
9843 elimination and common subexpression elimination. This is enabled by
9844 default at @option{-O3} and above.
9845
9846 @item -fsplit-ivs-in-unroller
9847 @opindex fsplit-ivs-in-unroller
9848 Enables expression of values of induction variables in later iterations
9849 of the unrolled loop using the value in the first iteration. This breaks
9850 long dependency chains, thus improving efficiency of the scheduling passes.
9851
9852 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9853 same effect. However, that is not reliable in cases where the loop body
9854 is more complicated than a single basic block. It also does not work at all
9855 on some architectures due to restrictions in the CSE pass.
9856
9857 This optimization is enabled by default.
9858
9859 @item -fvariable-expansion-in-unroller
9860 @opindex fvariable-expansion-in-unroller
9861 With this option, the compiler creates multiple copies of some
9862 local variables when unrolling a loop, which can result in superior code.
9863
9864 This optimization is enabled by default for PowerPC targets, but disabled
9865 by default otherwise.
9866
9867 @item -fpartial-inlining
9868 @opindex fpartial-inlining
9869 Inline parts of functions. This option has any effect only
9870 when inlining itself is turned on by the @option{-finline-functions}
9871 or @option{-finline-small-functions} options.
9872
9873 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9874
9875 @item -fpredictive-commoning
9876 @opindex fpredictive-commoning
9877 Perform predictive commoning optimization, i.e., reusing computations
9878 (especially memory loads and stores) performed in previous
9879 iterations of loops.
9880
9881 This option is enabled at level @option{-O3}.
9882 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9883
9884 @item -fprefetch-loop-arrays
9885 @opindex fprefetch-loop-arrays
9886 If supported by the target machine, generate instructions to prefetch
9887 memory to improve the performance of loops that access large arrays.
9888
9889 This option may generate better or worse code; results are highly
9890 dependent on the structure of loops within the source code.
9891
9892 Disabled at level @option{-Os}.
9893
9894 @item -fno-printf-return-value
9895 @opindex fno-printf-return-value
9896 @opindex fprintf-return-value
9897 Do not substitute constants for known return value of formatted output
9898 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9899 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9900 transformation allows GCC to optimize or even eliminate branches based
9901 on the known return value of these functions called with arguments that
9902 are either constant, or whose values are known to be in a range that
9903 makes determining the exact return value possible. For example, when
9904 @option{-fprintf-return-value} is in effect, both the branch and the
9905 body of the @code{if} statement (but not the call to @code{snprint})
9906 can be optimized away when @code{i} is a 32-bit or smaller integer
9907 because the return value is guaranteed to be at most 8.
9908
9909 @smallexample
9910 char buf[9];
9911 if (snprintf (buf, "%08x", i) >= sizeof buf)
9912 @dots{}
9913 @end smallexample
9914
9915 The @option{-fprintf-return-value} option relies on other optimizations
9916 and yields best results with @option{-O2} and above. It works in tandem
9917 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9918 options. The @option{-fprintf-return-value} option is enabled by default.
9919
9920 @item -fno-peephole
9921 @itemx -fno-peephole2
9922 @opindex fno-peephole
9923 @opindex fpeephole
9924 @opindex fno-peephole2
9925 @opindex fpeephole2
9926 Disable any machine-specific peephole optimizations. The difference
9927 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9928 are implemented in the compiler; some targets use one, some use the
9929 other, a few use both.
9930
9931 @option{-fpeephole} is enabled by default.
9932 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9933
9934 @item -fno-guess-branch-probability
9935 @opindex fno-guess-branch-probability
9936 @opindex fguess-branch-probability
9937 Do not guess branch probabilities using heuristics.
9938
9939 GCC uses heuristics to guess branch probabilities if they are
9940 not provided by profiling feedback (@option{-fprofile-arcs}). These
9941 heuristics are based on the control flow graph. If some branch probabilities
9942 are specified by @code{__builtin_expect}, then the heuristics are
9943 used to guess branch probabilities for the rest of the control flow graph,
9944 taking the @code{__builtin_expect} info into account. The interactions
9945 between the heuristics and @code{__builtin_expect} can be complex, and in
9946 some cases, it may be useful to disable the heuristics so that the effects
9947 of @code{__builtin_expect} are easier to understand.
9948
9949 It is also possible to specify expected probability of the expression
9950 with @code{__builtin_expect_with_probability} built-in function.
9951
9952 The default is @option{-fguess-branch-probability} at levels
9953 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9954
9955 @item -freorder-blocks
9956 @opindex freorder-blocks
9957 Reorder basic blocks in the compiled function in order to reduce number of
9958 taken branches and improve code locality.
9959
9960 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9961
9962 @item -freorder-blocks-algorithm=@var{algorithm}
9963 @opindex freorder-blocks-algorithm
9964 Use the specified algorithm for basic block reordering. The
9965 @var{algorithm} argument can be @samp{simple}, which does not increase
9966 code size (except sometimes due to secondary effects like alignment),
9967 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9968 put all often executed code together, minimizing the number of branches
9969 executed by making extra copies of code.
9970
9971 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9972 @samp{stc} at levels @option{-O2}, @option{-O3}.
9973
9974 @item -freorder-blocks-and-partition
9975 @opindex freorder-blocks-and-partition
9976 In addition to reordering basic blocks in the compiled function, in order
9977 to reduce number of taken branches, partitions hot and cold basic blocks
9978 into separate sections of the assembly and @file{.o} files, to improve
9979 paging and cache locality performance.
9980
9981 This optimization is automatically turned off in the presence of
9982 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9983 section attribute and on any architecture that does not support named
9984 sections. When @option{-fsplit-stack} is used this option is not
9985 enabled by default (to avoid linker errors), but may be enabled
9986 explicitly (if using a working linker).
9987
9988 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9989
9990 @item -freorder-functions
9991 @opindex freorder-functions
9992 Reorder functions in the object file in order to
9993 improve code locality. This is implemented by using special
9994 subsections @code{.text.hot} for most frequently executed functions and
9995 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9996 the linker so object file format must support named sections and linker must
9997 place them in a reasonable way.
9998
9999 This option isn't effective unless you either provide profile feedback
10000 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10001 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10002
10003 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10004
10005 @item -fstrict-aliasing
10006 @opindex fstrict-aliasing
10007 Allow the compiler to assume the strictest aliasing rules applicable to
10008 the language being compiled. For C (and C++), this activates
10009 optimizations based on the type of expressions. In particular, an
10010 object of one type is assumed never to reside at the same address as an
10011 object of a different type, unless the types are almost the same. For
10012 example, an @code{unsigned int} can alias an @code{int}, but not a
10013 @code{void*} or a @code{double}. A character type may alias any other
10014 type.
10015
10016 @anchor{Type-punning}Pay special attention to code like this:
10017 @smallexample
10018 union a_union @{
10019 int i;
10020 double d;
10021 @};
10022
10023 int f() @{
10024 union a_union t;
10025 t.d = 3.0;
10026 return t.i;
10027 @}
10028 @end smallexample
10029 The practice of reading from a different union member than the one most
10030 recently written to (called ``type-punning'') is common. Even with
10031 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10032 is accessed through the union type. So, the code above works as
10033 expected. @xref{Structures unions enumerations and bit-fields
10034 implementation}. However, this code might not:
10035 @smallexample
10036 int f() @{
10037 union a_union t;
10038 int* ip;
10039 t.d = 3.0;
10040 ip = &t.i;
10041 return *ip;
10042 @}
10043 @end smallexample
10044
10045 Similarly, access by taking the address, casting the resulting pointer
10046 and dereferencing the result has undefined behavior, even if the cast
10047 uses a union type, e.g.:
10048 @smallexample
10049 int f() @{
10050 double d = 3.0;
10051 return ((union a_union *) &d)->i;
10052 @}
10053 @end smallexample
10054
10055 The @option{-fstrict-aliasing} option is enabled at levels
10056 @option{-O2}, @option{-O3}, @option{-Os}.
10057
10058 @item -falign-functions
10059 @itemx -falign-functions=@var{n}
10060 @itemx -falign-functions=@var{n}:@var{m}
10061 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10062 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10063 @opindex falign-functions
10064 Align the start of functions to the next power-of-two greater than
10065 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10066 the first @var{m} bytes of the function can be fetched by the CPU
10067 without crossing an @var{n}-byte alignment boundary.
10068
10069 If @var{m} is not specified, it defaults to @var{n}.
10070
10071 Examples: @option{-falign-functions=32} aligns functions to the next
10072 32-byte boundary, @option{-falign-functions=24} aligns to the next
10073 32-byte boundary only if this can be done by skipping 23 bytes or less,
10074 @option{-falign-functions=32:7} aligns to the next
10075 32-byte boundary only if this can be done by skipping 6 bytes or less.
10076
10077 The second pair of @var{n2}:@var{m2} values allows you to specify
10078 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10079 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10080 otherwise aligns to the next 32-byte boundary if this can be done
10081 by skipping 2 bytes or less.
10082 If @var{m2} is not specified, it defaults to @var{n2}.
10083
10084 Some assemblers only support this flag when @var{n} is a power of two;
10085 in that case, it is rounded up.
10086
10087 @option{-fno-align-functions} and @option{-falign-functions=1} are
10088 equivalent and mean that functions are not aligned.
10089
10090 If @var{n} is not specified or is zero, use a machine-dependent default.
10091 The maximum allowed @var{n} option value is 65536.
10092
10093 Enabled at levels @option{-O2}, @option{-O3}.
10094
10095 @item -flimit-function-alignment
10096 If this option is enabled, the compiler tries to avoid unnecessarily
10097 overaligning functions. It attempts to instruct the assembler to align
10098 by the amount specified by @option{-falign-functions}, but not to
10099 skip more bytes than the size of the function.
10100
10101 @item -falign-labels
10102 @itemx -falign-labels=@var{n}
10103 @itemx -falign-labels=@var{n}:@var{m}
10104 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10105 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10106 @opindex falign-labels
10107 Align all branch targets to a power-of-two boundary.
10108
10109 Parameters of this option are analogous to the @option{-falign-functions} option.
10110 @option{-fno-align-labels} and @option{-falign-labels=1} are
10111 equivalent and mean that labels are not aligned.
10112
10113 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10114 are greater than this value, then their values are used instead.
10115
10116 If @var{n} is not specified or is zero, use a machine-dependent default
10117 which is very likely to be @samp{1}, meaning no alignment.
10118 The maximum allowed @var{n} option value is 65536.
10119
10120 Enabled at levels @option{-O2}, @option{-O3}.
10121
10122 @item -falign-loops
10123 @itemx -falign-loops=@var{n}
10124 @itemx -falign-loops=@var{n}:@var{m}
10125 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10126 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10127 @opindex falign-loops
10128 Align loops to a power-of-two boundary. If the loops are executed
10129 many times, this makes up for any execution of the dummy padding
10130 instructions.
10131
10132 Parameters of this option are analogous to the @option{-falign-functions} option.
10133 @option{-fno-align-loops} and @option{-falign-loops=1} are
10134 equivalent and mean that loops are not aligned.
10135 The maximum allowed @var{n} option value is 65536.
10136
10137 If @var{n} is not specified or is zero, use a machine-dependent default.
10138
10139 Enabled at levels @option{-O2}, @option{-O3}.
10140
10141 @item -falign-jumps
10142 @itemx -falign-jumps=@var{n}
10143 @itemx -falign-jumps=@var{n}:@var{m}
10144 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10145 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10146 @opindex falign-jumps
10147 Align branch targets to a power-of-two boundary, for branch targets
10148 where the targets can only be reached by jumping. In this case,
10149 no dummy operations need be executed.
10150
10151 Parameters of this option are analogous to the @option{-falign-functions} option.
10152 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10153 equivalent and mean that loops are not aligned.
10154
10155 If @var{n} is not specified or is zero, use a machine-dependent default.
10156 The maximum allowed @var{n} option value is 65536.
10157
10158 Enabled at levels @option{-O2}, @option{-O3}.
10159
10160 @item -funit-at-a-time
10161 @opindex funit-at-a-time
10162 This option is left for compatibility reasons. @option{-funit-at-a-time}
10163 has no effect, while @option{-fno-unit-at-a-time} implies
10164 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10165
10166 Enabled by default.
10167
10168 @item -fno-toplevel-reorder
10169 @opindex fno-toplevel-reorder
10170 @opindex ftoplevel-reorder
10171 Do not reorder top-level functions, variables, and @code{asm}
10172 statements. Output them in the same order that they appear in the
10173 input file. When this option is used, unreferenced static variables
10174 are not removed. This option is intended to support existing code
10175 that relies on a particular ordering. For new code, it is better to
10176 use attributes when possible.
10177
10178 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10179 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10180 Additionally @option{-fno-toplevel-reorder} implies
10181 @option{-fno-section-anchors}.
10182
10183 @item -fweb
10184 @opindex fweb
10185 Constructs webs as commonly used for register allocation purposes and assign
10186 each web individual pseudo register. This allows the register allocation pass
10187 to operate on pseudos directly, but also strengthens several other optimization
10188 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10189 however, make debugging impossible, since variables no longer stay in a
10190 ``home register''.
10191
10192 Enabled by default with @option{-funroll-loops}.
10193
10194 @item -fwhole-program
10195 @opindex fwhole-program
10196 Assume that the current compilation unit represents the whole program being
10197 compiled. All public functions and variables with the exception of @code{main}
10198 and those merged by attribute @code{externally_visible} become static functions
10199 and in effect are optimized more aggressively by interprocedural optimizers.
10200
10201 This option should not be used in combination with @option{-flto}.
10202 Instead relying on a linker plugin should provide safer and more precise
10203 information.
10204
10205 @item -flto[=@var{n}]
10206 @opindex flto
10207 This option runs the standard link-time optimizer. When invoked
10208 with source code, it generates GIMPLE (one of GCC's internal
10209 representations) and writes it to special ELF sections in the object
10210 file. When the object files are linked together, all the function
10211 bodies are read from these ELF sections and instantiated as if they
10212 had been part of the same translation unit.
10213
10214 To use the link-time optimizer, @option{-flto} and optimization
10215 options should be specified at compile time and during the final link.
10216 It is recommended that you compile all the files participating in the
10217 same link with the same options and also specify those options at
10218 link time.
10219 For example:
10220
10221 @smallexample
10222 gcc -c -O2 -flto foo.c
10223 gcc -c -O2 -flto bar.c
10224 gcc -o myprog -flto -O2 foo.o bar.o
10225 @end smallexample
10226
10227 The first two invocations to GCC save a bytecode representation
10228 of GIMPLE into special ELF sections inside @file{foo.o} and
10229 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10230 @file{foo.o} and @file{bar.o}, merges the two files into a single
10231 internal image, and compiles the result as usual. Since both
10232 @file{foo.o} and @file{bar.o} are merged into a single image, this
10233 causes all the interprocedural analyses and optimizations in GCC to
10234 work across the two files as if they were a single one. This means,
10235 for example, that the inliner is able to inline functions in
10236 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10237
10238 Another (simpler) way to enable link-time optimization is:
10239
10240 @smallexample
10241 gcc -o myprog -flto -O2 foo.c bar.c
10242 @end smallexample
10243
10244 The above generates bytecode for @file{foo.c} and @file{bar.c},
10245 merges them together into a single GIMPLE representation and optimizes
10246 them as usual to produce @file{myprog}.
10247
10248 The important thing to keep in mind is that to enable link-time
10249 optimizations you need to use the GCC driver to perform the link step.
10250 GCC automatically performs link-time optimization if any of the
10251 objects involved were compiled with the @option{-flto} command-line option.
10252 You can always override
10253 the automatic decision to do link-time optimization
10254 by passing @option{-fno-lto} to the link command.
10255
10256 To make whole program optimization effective, it is necessary to make
10257 certain whole program assumptions. The compiler needs to know
10258 what functions and variables can be accessed by libraries and runtime
10259 outside of the link-time optimized unit. When supported by the linker,
10260 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10261 to the compiler about used and externally visible symbols. When
10262 the linker plugin is not available, @option{-fwhole-program} should be
10263 used to allow the compiler to make these assumptions, which leads
10264 to more aggressive optimization decisions.
10265
10266 When a file is compiled with @option{-flto} without
10267 @option{-fuse-linker-plugin}, the generated object file is larger than
10268 a regular object file because it contains GIMPLE bytecodes and the usual
10269 final code (see @option{-ffat-lto-objects}. This means that
10270 object files with LTO information can be linked as normal object
10271 files; if @option{-fno-lto} is passed to the linker, no
10272 interprocedural optimizations are applied. Note that when
10273 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10274 but you cannot perform a regular, non-LTO link on them.
10275
10276 When producing the final binary, GCC only
10277 applies link-time optimizations to those files that contain bytecode.
10278 Therefore, you can mix and match object files and libraries with
10279 GIMPLE bytecodes and final object code. GCC automatically selects
10280 which files to optimize in LTO mode and which files to link without
10281 further processing.
10282
10283 Generally, options specified at link time override those
10284 specified at compile time, although in some cases GCC attempts to infer
10285 link-time options from the settings used to compile the input files.
10286
10287 If you do not specify an optimization level option @option{-O} at
10288 link time, then GCC uses the highest optimization level
10289 used when compiling the object files. Note that it is generally
10290 ineffective to specify an optimization level option only at link time and
10291 not at compile time, for two reasons. First, compiling without
10292 optimization suppresses compiler passes that gather information
10293 needed for effective optimization at link time. Second, some early
10294 optimization passes can be performed only at compile time and
10295 not at link time.
10296
10297 There are some code generation flags preserved by GCC when
10298 generating bytecodes, as they need to be used during the final link.
10299 Currently, the following options and their settings are taken from
10300 the first object file that explicitly specifies them:
10301 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10302 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10303 and all the @option{-m} target flags.
10304
10305 Certain ABI-changing flags are required to match in all compilation units,
10306 and trying to override this at link time with a conflicting value
10307 is ignored. This includes options such as @option{-freg-struct-return}
10308 and @option{-fpcc-struct-return}.
10309
10310 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10311 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10312 are passed through to the link stage and merged conservatively for
10313 conflicting translation units. Specifically
10314 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10315 precedence; and for example @option{-ffp-contract=off} takes precedence
10316 over @option{-ffp-contract=fast}. You can override them at link time.
10317
10318 If LTO encounters objects with C linkage declared with incompatible
10319 types in separate translation units to be linked together (undefined
10320 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10321 issued. The behavior is still undefined at run time. Similar
10322 diagnostics may be raised for other languages.
10323
10324 Another feature of LTO is that it is possible to apply interprocedural
10325 optimizations on files written in different languages:
10326
10327 @smallexample
10328 gcc -c -flto foo.c
10329 g++ -c -flto bar.cc
10330 gfortran -c -flto baz.f90
10331 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10332 @end smallexample
10333
10334 Notice that the final link is done with @command{g++} to get the C++
10335 runtime libraries and @option{-lgfortran} is added to get the Fortran
10336 runtime libraries. In general, when mixing languages in LTO mode, you
10337 should use the same link command options as when mixing languages in a
10338 regular (non-LTO) compilation.
10339
10340 If object files containing GIMPLE bytecode are stored in a library archive, say
10341 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10342 are using a linker with plugin support. To create static libraries suitable
10343 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10344 and @command{ranlib};
10345 to show the symbols of object files with GIMPLE bytecode, use
10346 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10347 and @command{nm} have been compiled with plugin support. At link time, use the
10348 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10349 the LTO optimization process:
10350
10351 @smallexample
10352 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10353 @end smallexample
10354
10355 With the linker plugin enabled, the linker extracts the needed
10356 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10357 to make them part of the aggregated GIMPLE image to be optimized.
10358
10359 If you are not using a linker with plugin support and/or do not
10360 enable the linker plugin, then the objects inside @file{libfoo.a}
10361 are extracted and linked as usual, but they do not participate
10362 in the LTO optimization process. In order to make a static library suitable
10363 for both LTO optimization and usual linkage, compile its object files with
10364 @option{-flto} @option{-ffat-lto-objects}.
10365
10366 Link-time optimizations do not require the presence of the whole program to
10367 operate. If the program does not require any symbols to be exported, it is
10368 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10369 the interprocedural optimizers to use more aggressive assumptions which may
10370 lead to improved optimization opportunities.
10371 Use of @option{-fwhole-program} is not needed when linker plugin is
10372 active (see @option{-fuse-linker-plugin}).
10373
10374 The current implementation of LTO makes no
10375 attempt to generate bytecode that is portable between different
10376 types of hosts. The bytecode files are versioned and there is a
10377 strict version check, so bytecode files generated in one version of
10378 GCC do not work with an older or newer version of GCC.
10379
10380 Link-time optimization does not work well with generation of debugging
10381 information on systems other than those using a combination of ELF and
10382 DWARF.
10383
10384 If you specify the optional @var{n}, the optimization and code
10385 generation done at link time is executed in parallel using @var{n}
10386 parallel jobs by utilizing an installed @command{make} program. The
10387 environment variable @env{MAKE} may be used to override the program
10388 used. The default value for @var{n} is 1.
10389
10390 You can also specify @option{-flto=jobserver} to use GNU make's
10391 job server mode to determine the number of parallel jobs. This
10392 is useful when the Makefile calling GCC is already executing in parallel.
10393 You must prepend a @samp{+} to the command recipe in the parent Makefile
10394 for this to work. This option likely only works if @env{MAKE} is
10395 GNU make.
10396
10397 @item -flto-partition=@var{alg}
10398 @opindex flto-partition
10399 Specify the partitioning algorithm used by the link-time optimizer.
10400 The value is either @samp{1to1} to specify a partitioning mirroring
10401 the original source files or @samp{balanced} to specify partitioning
10402 into equally sized chunks (whenever possible) or @samp{max} to create
10403 new partition for every symbol where possible. Specifying @samp{none}
10404 as an algorithm disables partitioning and streaming completely.
10405 The default value is @samp{balanced}. While @samp{1to1} can be used
10406 as an workaround for various code ordering issues, the @samp{max}
10407 partitioning is intended for internal testing only.
10408 The value @samp{one} specifies that exactly one partition should be
10409 used while the value @samp{none} bypasses partitioning and executes
10410 the link-time optimization step directly from the WPA phase.
10411
10412 @item -flto-compression-level=@var{n}
10413 @opindex flto-compression-level
10414 This option specifies the level of compression used for intermediate
10415 language written to LTO object files, and is only meaningful in
10416 conjunction with LTO mode (@option{-flto}). Valid
10417 values are 0 (no compression) to 9 (maximum compression). Values
10418 outside this range are clamped to either 0 or 9. If the option is not
10419 given, a default balanced compression setting is used.
10420
10421 @item -fuse-linker-plugin
10422 @opindex fuse-linker-plugin
10423 Enables the use of a linker plugin during link-time optimization. This
10424 option relies on plugin support in the linker, which is available in gold
10425 or in GNU ld 2.21 or newer.
10426
10427 This option enables the extraction of object files with GIMPLE bytecode out
10428 of library archives. This improves the quality of optimization by exposing
10429 more code to the link-time optimizer. This information specifies what
10430 symbols can be accessed externally (by non-LTO object or during dynamic
10431 linking). Resulting code quality improvements on binaries (and shared
10432 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10433 See @option{-flto} for a description of the effect of this flag and how to
10434 use it.
10435
10436 This option is enabled by default when LTO support in GCC is enabled
10437 and GCC was configured for use with
10438 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10439
10440 @item -ffat-lto-objects
10441 @opindex ffat-lto-objects
10442 Fat LTO objects are object files that contain both the intermediate language
10443 and the object code. This makes them usable for both LTO linking and normal
10444 linking. This option is effective only when compiling with @option{-flto}
10445 and is ignored at link time.
10446
10447 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10448 requires the complete toolchain to be aware of LTO. It requires a linker with
10449 linker plugin support for basic functionality. Additionally,
10450 @command{nm}, @command{ar} and @command{ranlib}
10451 need to support linker plugins to allow a full-featured build environment
10452 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10453 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10454 to these tools. With non fat LTO makefiles need to be modified to use them.
10455
10456 Note that modern binutils provide plugin auto-load mechanism.
10457 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10458 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10459 @command{gcc-ranlib}).
10460
10461 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10462 support.
10463
10464 @item -fcompare-elim
10465 @opindex fcompare-elim
10466 After register allocation and post-register allocation instruction splitting,
10467 identify arithmetic instructions that compute processor flags similar to a
10468 comparison operation based on that arithmetic. If possible, eliminate the
10469 explicit comparison operation.
10470
10471 This pass only applies to certain targets that cannot explicitly represent
10472 the comparison operation before register allocation is complete.
10473
10474 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10475
10476 @item -fcprop-registers
10477 @opindex fcprop-registers
10478 After register allocation and post-register allocation instruction splitting,
10479 perform a copy-propagation pass to try to reduce scheduling dependencies
10480 and occasionally eliminate the copy.
10481
10482 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10483
10484 @item -fprofile-correction
10485 @opindex fprofile-correction
10486 Profiles collected using an instrumented binary for multi-threaded programs may
10487 be inconsistent due to missed counter updates. When this option is specified,
10488 GCC uses heuristics to correct or smooth out such inconsistencies. By
10489 default, GCC emits an error message when an inconsistent profile is detected.
10490
10491 This option is enabled by @option{-fauto-profile}.
10492
10493 @item -fprofile-use
10494 @itemx -fprofile-use=@var{path}
10495 @opindex fprofile-use
10496 Enable profile feedback-directed optimizations,
10497 and the following optimizations, many of which
10498 are generally profitable only with profile feedback available:
10499
10500 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10501 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10502 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10503 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10504 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10505 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10506 -fprofile-reorder-functions}
10507
10508 Before you can use this option, you must first generate profiling information.
10509 @xref{Instrumentation Options}, for information about the
10510 @option{-fprofile-generate} option.
10511
10512 By default, GCC emits an error message if the feedback profiles do not
10513 match the source code. This error can be turned into a warning by using
10514 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10515 optimized code. Additionally, by default, GCC also emits a warning message if
10516 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10517
10518 If @var{path} is specified, GCC looks at the @var{path} to find
10519 the profile feedback data files. See @option{-fprofile-dir}.
10520
10521 @item -fauto-profile
10522 @itemx -fauto-profile=@var{path}
10523 @opindex fauto-profile
10524 Enable sampling-based feedback-directed optimizations,
10525 and the following optimizations,
10526 many of which are generally profitable only with profile feedback available:
10527
10528 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10529 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10530 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10531 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10532 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10533 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10534 -fprofile-correction}
10535
10536 @var{path} is the name of a file containing AutoFDO profile information.
10537 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10538
10539 Producing an AutoFDO profile data file requires running your program
10540 with the @command{perf} utility on a supported GNU/Linux target system.
10541 For more information, see @uref{https://perf.wiki.kernel.org/}.
10542
10543 E.g.
10544 @smallexample
10545 perf record -e br_inst_retired:near_taken -b -o perf.data \
10546 -- your_program
10547 @end smallexample
10548
10549 Then use the @command{create_gcov} tool to convert the raw profile data
10550 to a format that can be used by GCC.@ You must also supply the
10551 unstripped binary for your program to this tool.
10552 See @uref{https://github.com/google/autofdo}.
10553
10554 E.g.
10555 @smallexample
10556 create_gcov --binary=your_program.unstripped --profile=perf.data \
10557 --gcov=profile.afdo
10558 @end smallexample
10559 @end table
10560
10561 The following options control compiler behavior regarding floating-point
10562 arithmetic. These options trade off between speed and
10563 correctness. All must be specifically enabled.
10564
10565 @table @gcctabopt
10566 @item -ffloat-store
10567 @opindex ffloat-store
10568 Do not store floating-point variables in registers, and inhibit other
10569 options that might change whether a floating-point value is taken from a
10570 register or memory.
10571
10572 @cindex floating-point precision
10573 This option prevents undesirable excess precision on machines such as
10574 the 68000 where the floating registers (of the 68881) keep more
10575 precision than a @code{double} is supposed to have. Similarly for the
10576 x86 architecture. For most programs, the excess precision does only
10577 good, but a few programs rely on the precise definition of IEEE floating
10578 point. Use @option{-ffloat-store} for such programs, after modifying
10579 them to store all pertinent intermediate computations into variables.
10580
10581 @item -fexcess-precision=@var{style}
10582 @opindex fexcess-precision
10583 This option allows further control over excess precision on machines
10584 where floating-point operations occur in a format with more precision or
10585 range than the IEEE standard and interchange floating-point types. By
10586 default, @option{-fexcess-precision=fast} is in effect; this means that
10587 operations may be carried out in a wider precision than the types specified
10588 in the source if that would result in faster code, and it is unpredictable
10589 when rounding to the types specified in the source code takes place.
10590 When compiling C, if @option{-fexcess-precision=standard} is specified then
10591 excess precision follows the rules specified in ISO C99; in particular,
10592 both casts and assignments cause values to be rounded to their
10593 semantic types (whereas @option{-ffloat-store} only affects
10594 assignments). This option is enabled by default for C if a strict
10595 conformance option such as @option{-std=c99} is used.
10596 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10597 regardless of whether a strict conformance option is used.
10598
10599 @opindex mfpmath
10600 @option{-fexcess-precision=standard} is not implemented for languages
10601 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10602 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10603 semantics apply without excess precision, and in the latter, rounding
10604 is unpredictable.
10605
10606 @item -ffast-math
10607 @opindex ffast-math
10608 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10609 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10610 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10611 @option{-fexcess-precision=fast}.
10612
10613 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10614
10615 This option is not turned on by any @option{-O} option besides
10616 @option{-Ofast} since it can result in incorrect output for programs
10617 that depend on an exact implementation of IEEE or ISO rules/specifications
10618 for math functions. It may, however, yield faster code for programs
10619 that do not require the guarantees of these specifications.
10620
10621 @item -fno-math-errno
10622 @opindex fno-math-errno
10623 @opindex fmath-errno
10624 Do not set @code{errno} after calling math functions that are executed
10625 with a single instruction, e.g., @code{sqrt}. A program that relies on
10626 IEEE exceptions for math error handling may want to use this flag
10627 for speed while maintaining IEEE arithmetic compatibility.
10628
10629 This option is not turned on by any @option{-O} option since
10630 it can result in incorrect output for programs that depend on
10631 an exact implementation of IEEE or ISO rules/specifications for
10632 math functions. It may, however, yield faster code for programs
10633 that do not require the guarantees of these specifications.
10634
10635 The default is @option{-fmath-errno}.
10636
10637 On Darwin systems, the math library never sets @code{errno}. There is
10638 therefore no reason for the compiler to consider the possibility that
10639 it might, and @option{-fno-math-errno} is the default.
10640
10641 @item -funsafe-math-optimizations
10642 @opindex funsafe-math-optimizations
10643
10644 Allow optimizations for floating-point arithmetic that (a) assume
10645 that arguments and results are valid and (b) may violate IEEE or
10646 ANSI standards. When used at link time, it may include libraries
10647 or startup files that change the default FPU control word or other
10648 similar optimizations.
10649
10650 This option is not turned on by any @option{-O} option since
10651 it can result in incorrect output for programs that depend on
10652 an exact implementation of IEEE or ISO rules/specifications for
10653 math functions. It may, however, yield faster code for programs
10654 that do not require the guarantees of these specifications.
10655 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10656 @option{-fassociative-math} and @option{-freciprocal-math}.
10657
10658 The default is @option{-fno-unsafe-math-optimizations}.
10659
10660 @item -fassociative-math
10661 @opindex fassociative-math
10662
10663 Allow re-association of operands in series of floating-point operations.
10664 This violates the ISO C and C++ language standard by possibly changing
10665 computation result. NOTE: re-ordering may change the sign of zero as
10666 well as ignore NaNs and inhibit or create underflow or overflow (and
10667 thus cannot be used on code that relies on rounding behavior like
10668 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10669 and thus may not be used when ordered comparisons are required.
10670 This option requires that both @option{-fno-signed-zeros} and
10671 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10672 much sense with @option{-frounding-math}. For Fortran the option
10673 is automatically enabled when both @option{-fno-signed-zeros} and
10674 @option{-fno-trapping-math} are in effect.
10675
10676 The default is @option{-fno-associative-math}.
10677
10678 @item -freciprocal-math
10679 @opindex freciprocal-math
10680
10681 Allow the reciprocal of a value to be used instead of dividing by
10682 the value if this enables optimizations. For example @code{x / y}
10683 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10684 is subject to common subexpression elimination. Note that this loses
10685 precision and increases the number of flops operating on the value.
10686
10687 The default is @option{-fno-reciprocal-math}.
10688
10689 @item -ffinite-math-only
10690 @opindex ffinite-math-only
10691 Allow optimizations for floating-point arithmetic that assume
10692 that arguments and results are not NaNs or +-Infs.
10693
10694 This option is not turned on by any @option{-O} option since
10695 it can result in incorrect output for programs that depend on
10696 an exact implementation of IEEE or ISO rules/specifications for
10697 math functions. It may, however, yield faster code for programs
10698 that do not require the guarantees of these specifications.
10699
10700 The default is @option{-fno-finite-math-only}.
10701
10702 @item -fno-signed-zeros
10703 @opindex fno-signed-zeros
10704 @opindex fsigned-zeros
10705 Allow optimizations for floating-point arithmetic that ignore the
10706 signedness of zero. IEEE arithmetic specifies the behavior of
10707 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10708 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10709 This option implies that the sign of a zero result isn't significant.
10710
10711 The default is @option{-fsigned-zeros}.
10712
10713 @item -fno-trapping-math
10714 @opindex fno-trapping-math
10715 @opindex ftrapping-math
10716 Compile code assuming that floating-point operations cannot generate
10717 user-visible traps. These traps include division by zero, overflow,
10718 underflow, inexact result and invalid operation. This option requires
10719 that @option{-fno-signaling-nans} be in effect. Setting this option may
10720 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10721
10722 This option should never be turned on by any @option{-O} option since
10723 it can result in incorrect output for programs that depend on
10724 an exact implementation of IEEE or ISO rules/specifications for
10725 math functions.
10726
10727 The default is @option{-ftrapping-math}.
10728
10729 @item -frounding-math
10730 @opindex frounding-math
10731 Disable transformations and optimizations that assume default floating-point
10732 rounding behavior. This is round-to-zero for all floating point
10733 to integer conversions, and round-to-nearest for all other arithmetic
10734 truncations. This option should be specified for programs that change
10735 the FP rounding mode dynamically, or that may be executed with a
10736 non-default rounding mode. This option disables constant folding of
10737 floating-point expressions at compile time (which may be affected by
10738 rounding mode) and arithmetic transformations that are unsafe in the
10739 presence of sign-dependent rounding modes.
10740
10741 The default is @option{-fno-rounding-math}.
10742
10743 This option is experimental and does not currently guarantee to
10744 disable all GCC optimizations that are affected by rounding mode.
10745 Future versions of GCC may provide finer control of this setting
10746 using C99's @code{FENV_ACCESS} pragma. This command-line option
10747 will be used to specify the default state for @code{FENV_ACCESS}.
10748
10749 @item -fsignaling-nans
10750 @opindex fsignaling-nans
10751 Compile code assuming that IEEE signaling NaNs may generate user-visible
10752 traps during floating-point operations. Setting this option disables
10753 optimizations that may change the number of exceptions visible with
10754 signaling NaNs. This option implies @option{-ftrapping-math}.
10755
10756 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10757 be defined.
10758
10759 The default is @option{-fno-signaling-nans}.
10760
10761 This option is experimental and does not currently guarantee to
10762 disable all GCC optimizations that affect signaling NaN behavior.
10763
10764 @item -fno-fp-int-builtin-inexact
10765 @opindex fno-fp-int-builtin-inexact
10766 @opindex ffp-int-builtin-inexact
10767 Do not allow the built-in functions @code{ceil}, @code{floor},
10768 @code{round} and @code{trunc}, and their @code{float} and @code{long
10769 double} variants, to generate code that raises the ``inexact''
10770 floating-point exception for noninteger arguments. ISO C99 and C11
10771 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10772 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10773 functions to do so.
10774
10775 The default is @option{-ffp-int-builtin-inexact}, allowing the
10776 exception to be raised. This option does nothing unless
10777 @option{-ftrapping-math} is in effect.
10778
10779 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10780 generate a call to a library function then the ``inexact'' exception
10781 may be raised if the library implementation does not follow TS 18661.
10782
10783 @item -fsingle-precision-constant
10784 @opindex fsingle-precision-constant
10785 Treat floating-point constants as single precision instead of
10786 implicitly converting them to double-precision constants.
10787
10788 @item -fcx-limited-range
10789 @opindex fcx-limited-range
10790 When enabled, this option states that a range reduction step is not
10791 needed when performing complex division. Also, there is no checking
10792 whether the result of a complex multiplication or division is @code{NaN
10793 + I*NaN}, with an attempt to rescue the situation in that case. The
10794 default is @option{-fno-cx-limited-range}, but is enabled by
10795 @option{-ffast-math}.
10796
10797 This option controls the default setting of the ISO C99
10798 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10799 all languages.
10800
10801 @item -fcx-fortran-rules
10802 @opindex fcx-fortran-rules
10803 Complex multiplication and division follow Fortran rules. Range
10804 reduction is done as part of complex division, but there is no checking
10805 whether the result of a complex multiplication or division is @code{NaN
10806 + I*NaN}, with an attempt to rescue the situation in that case.
10807
10808 The default is @option{-fno-cx-fortran-rules}.
10809
10810 @end table
10811
10812 The following options control optimizations that may improve
10813 performance, but are not enabled by any @option{-O} options. This
10814 section includes experimental options that may produce broken code.
10815
10816 @table @gcctabopt
10817 @item -fbranch-probabilities
10818 @opindex fbranch-probabilities
10819 After running a program compiled with @option{-fprofile-arcs}
10820 (@pxref{Instrumentation Options}),
10821 you can compile it a second time using
10822 @option{-fbranch-probabilities}, to improve optimizations based on
10823 the number of times each branch was taken. When a program
10824 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10825 counts to a file called @file{@var{sourcename}.gcda} for each source
10826 file. The information in this data file is very dependent on the
10827 structure of the generated code, so you must use the same source code
10828 and the same optimization options for both compilations.
10829
10830 With @option{-fbranch-probabilities}, GCC puts a
10831 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10832 These can be used to improve optimization. Currently, they are only
10833 used in one place: in @file{reorg.c}, instead of guessing which path a
10834 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10835 exactly determine which path is taken more often.
10836
10837 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10838
10839 @item -fprofile-values
10840 @opindex fprofile-values
10841 If combined with @option{-fprofile-arcs}, it adds code so that some
10842 data about values of expressions in the program is gathered.
10843
10844 With @option{-fbranch-probabilities}, it reads back the data gathered
10845 from profiling values of expressions for usage in optimizations.
10846
10847 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10848 @option{-fauto-profile}.
10849
10850 @item -fprofile-reorder-functions
10851 @opindex fprofile-reorder-functions
10852 Function reordering based on profile instrumentation collects
10853 first time of execution of a function and orders these functions
10854 in ascending order.
10855
10856 Enabled with @option{-fprofile-use}.
10857
10858 @item -fvpt
10859 @opindex fvpt
10860 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10861 to add code to gather information about values of expressions.
10862
10863 With @option{-fbranch-probabilities}, it reads back the data gathered
10864 and actually performs the optimizations based on them.
10865 Currently the optimizations include specialization of division operations
10866 using the knowledge about the value of the denominator.
10867
10868 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10869
10870 @item -frename-registers
10871 @opindex frename-registers
10872 Attempt to avoid false dependencies in scheduled code by making use
10873 of registers left over after register allocation. This optimization
10874 most benefits processors with lots of registers. Depending on the
10875 debug information format adopted by the target, however, it can
10876 make debugging impossible, since variables no longer stay in
10877 a ``home register''.
10878
10879 Enabled by default with @option{-funroll-loops}.
10880
10881 @item -fschedule-fusion
10882 @opindex fschedule-fusion
10883 Performs a target dependent pass over the instruction stream to schedule
10884 instructions of same type together because target machine can execute them
10885 more efficiently if they are adjacent to each other in the instruction flow.
10886
10887 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10888
10889 @item -ftracer
10890 @opindex ftracer
10891 Perform tail duplication to enlarge superblock size. This transformation
10892 simplifies the control flow of the function allowing other optimizations to do
10893 a better job.
10894
10895 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10896
10897 @item -funroll-loops
10898 @opindex funroll-loops
10899 Unroll loops whose number of iterations can be determined at compile time or
10900 upon entry to the loop. @option{-funroll-loops} implies
10901 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10902 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10903 a small constant number of iterations). This option makes code larger, and may
10904 or may not make it run faster.
10905
10906 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10907
10908 @item -funroll-all-loops
10909 @opindex funroll-all-loops
10910 Unroll all loops, even if their number of iterations is uncertain when
10911 the loop is entered. This usually makes programs run more slowly.
10912 @option{-funroll-all-loops} implies the same options as
10913 @option{-funroll-loops}.
10914
10915 @item -fpeel-loops
10916 @opindex fpeel-loops
10917 Peels loops for which there is enough information that they do not
10918 roll much (from profile feedback or static analysis). It also turns on
10919 complete loop peeling (i.e.@: complete removal of loops with small constant
10920 number of iterations).
10921
10922 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10923
10924 @item -fmove-loop-invariants
10925 @opindex fmove-loop-invariants
10926 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10927 at level @option{-O1} and higher, except for @option{-Og}.
10928
10929 @item -fsplit-loops
10930 @opindex fsplit-loops
10931 Split a loop into two if it contains a condition that's always true
10932 for one side of the iteration space and false for the other.
10933
10934 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10935
10936 @item -funswitch-loops
10937 @opindex funswitch-loops
10938 Move branches with loop invariant conditions out of the loop, with duplicates
10939 of the loop on both branches (modified according to result of the condition).
10940
10941 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10942
10943 @item -fversion-loops-for-strides
10944 @opindex fversion-loops-for-strides
10945 If a loop iterates over an array with a variable stride, create another
10946 version of the loop that assumes the stride is always one. For example:
10947
10948 @smallexample
10949 for (int i = 0; i < n; ++i)
10950 x[i * stride] = @dots{};
10951 @end smallexample
10952
10953 becomes:
10954
10955 @smallexample
10956 if (stride == 1)
10957 for (int i = 0; i < n; ++i)
10958 x[i] = @dots{};
10959 else
10960 for (int i = 0; i < n; ++i)
10961 x[i * stride] = @dots{};
10962 @end smallexample
10963
10964 This is particularly useful for assumed-shape arrays in Fortran where
10965 (for example) it allows better vectorization assuming contiguous accesses.
10966 This flag is enabled by default at @option{-O3}.
10967 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10968
10969 @item -ffunction-sections
10970 @itemx -fdata-sections
10971 @opindex ffunction-sections
10972 @opindex fdata-sections
10973 Place each function or data item into its own section in the output
10974 file if the target supports arbitrary sections. The name of the
10975 function or the name of the data item determines the section's name
10976 in the output file.
10977
10978 Use these options on systems where the linker can perform optimizations to
10979 improve locality of reference in the instruction space. Most systems using the
10980 ELF object format have linkers with such optimizations. On AIX, the linker
10981 rearranges sections (CSECTs) based on the call graph. The performance impact
10982 varies.
10983
10984 Together with a linker garbage collection (linker @option{--gc-sections}
10985 option) these options may lead to smaller statically-linked executables (after
10986 stripping).
10987
10988 On ELF/DWARF systems these options do not degenerate the quality of the debug
10989 information. There could be issues with other object files/debug info formats.
10990
10991 Only use these options when there are significant benefits from doing so. When
10992 you specify these options, the assembler and linker create larger object and
10993 executable files and are also slower. These options affect code generation.
10994 They prevent optimizations by the compiler and assembler using relative
10995 locations inside a translation unit since the locations are unknown until
10996 link time. An example of such an optimization is relaxing calls to short call
10997 instructions.
10998
10999 @item -fbranch-target-load-optimize
11000 @opindex fbranch-target-load-optimize
11001 Perform branch target register load optimization before prologue / epilogue
11002 threading.
11003 The use of target registers can typically be exposed only during reload,
11004 thus hoisting loads out of loops and doing inter-block scheduling needs
11005 a separate optimization pass.
11006
11007 @item -fbranch-target-load-optimize2
11008 @opindex fbranch-target-load-optimize2
11009 Perform branch target register load optimization after prologue / epilogue
11010 threading.
11011
11012 @item -fbtr-bb-exclusive
11013 @opindex fbtr-bb-exclusive
11014 When performing branch target register load optimization, don't reuse
11015 branch target registers within any basic block.
11016
11017 @item -fstdarg-opt
11018 @opindex fstdarg-opt
11019 Optimize the prologue of variadic argument functions with respect to usage of
11020 those arguments.
11021
11022 @item -fsection-anchors
11023 @opindex fsection-anchors
11024 Try to reduce the number of symbolic address calculations by using
11025 shared ``anchor'' symbols to address nearby objects. This transformation
11026 can help to reduce the number of GOT entries and GOT accesses on some
11027 targets.
11028
11029 For example, the implementation of the following function @code{foo}:
11030
11031 @smallexample
11032 static int a, b, c;
11033 int foo (void) @{ return a + b + c; @}
11034 @end smallexample
11035
11036 @noindent
11037 usually calculates the addresses of all three variables, but if you
11038 compile it with @option{-fsection-anchors}, it accesses the variables
11039 from a common anchor point instead. The effect is similar to the
11040 following pseudocode (which isn't valid C):
11041
11042 @smallexample
11043 int foo (void)
11044 @{
11045 register int *xr = &x;
11046 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11047 @}
11048 @end smallexample
11049
11050 Not all targets support this option.
11051
11052 @item --param @var{name}=@var{value}
11053 @opindex param
11054 In some places, GCC uses various constants to control the amount of
11055 optimization that is done. For example, GCC does not inline functions
11056 that contain more than a certain number of instructions. You can
11057 control some of these constants on the command line using the
11058 @option{--param} option.
11059
11060 The names of specific parameters, and the meaning of the values, are
11061 tied to the internals of the compiler, and are subject to change
11062 without notice in future releases.
11063
11064 In order to get minimal, maximal and default value of a parameter,
11065 one can use @option{--help=param -Q} options.
11066
11067 In each case, the @var{value} is an integer. The allowable choices for
11068 @var{name} are:
11069
11070 @table @gcctabopt
11071 @item predictable-branch-outcome
11072 When branch is predicted to be taken with probability lower than this threshold
11073 (in percent), then it is considered well predictable.
11074
11075 @item max-rtl-if-conversion-insns
11076 RTL if-conversion tries to remove conditional branches around a block and
11077 replace them with conditionally executed instructions. This parameter
11078 gives the maximum number of instructions in a block which should be
11079 considered for if-conversion. The compiler will
11080 also use other heuristics to decide whether if-conversion is likely to be
11081 profitable.
11082
11083 @item max-rtl-if-conversion-predictable-cost
11084 @itemx max-rtl-if-conversion-unpredictable-cost
11085 RTL if-conversion will try to remove conditional branches around a block
11086 and replace them with conditionally executed instructions. These parameters
11087 give the maximum permissible cost for the sequence that would be generated
11088 by if-conversion depending on whether the branch is statically determined
11089 to be predictable or not. The units for this parameter are the same as
11090 those for the GCC internal seq_cost metric. The compiler will try to
11091 provide a reasonable default for this parameter using the BRANCH_COST
11092 target macro.
11093
11094 @item max-crossjump-edges
11095 The maximum number of incoming edges to consider for cross-jumping.
11096 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11097 the number of edges incoming to each block. Increasing values mean
11098 more aggressive optimization, making the compilation time increase with
11099 probably small improvement in executable size.
11100
11101 @item min-crossjump-insns
11102 The minimum number of instructions that must be matched at the end
11103 of two blocks before cross-jumping is performed on them. This
11104 value is ignored in the case where all instructions in the block being
11105 cross-jumped from are matched.
11106
11107 @item max-grow-copy-bb-insns
11108 The maximum code size expansion factor when copying basic blocks
11109 instead of jumping. The expansion is relative to a jump instruction.
11110
11111 @item max-goto-duplication-insns
11112 The maximum number of instructions to duplicate to a block that jumps
11113 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11114 passes, GCC factors computed gotos early in the compilation process,
11115 and unfactors them as late as possible. Only computed jumps at the
11116 end of a basic blocks with no more than max-goto-duplication-insns are
11117 unfactored.
11118
11119 @item max-delay-slot-insn-search
11120 The maximum number of instructions to consider when looking for an
11121 instruction to fill a delay slot. If more than this arbitrary number of
11122 instructions are searched, the time savings from filling the delay slot
11123 are minimal, so stop searching. Increasing values mean more
11124 aggressive optimization, making the compilation time increase with probably
11125 small improvement in execution time.
11126
11127 @item max-delay-slot-live-search
11128 When trying to fill delay slots, the maximum number of instructions to
11129 consider when searching for a block with valid live register
11130 information. Increasing this arbitrarily chosen value means more
11131 aggressive optimization, increasing the compilation time. This parameter
11132 should be removed when the delay slot code is rewritten to maintain the
11133 control-flow graph.
11134
11135 @item max-gcse-memory
11136 The approximate maximum amount of memory that can be allocated in
11137 order to perform the global common subexpression elimination
11138 optimization. If more memory than specified is required, the
11139 optimization is not done.
11140
11141 @item max-gcse-insertion-ratio
11142 If the ratio of expression insertions to deletions is larger than this value
11143 for any expression, then RTL PRE inserts or removes the expression and thus
11144 leaves partially redundant computations in the instruction stream.
11145
11146 @item max-pending-list-length
11147 The maximum number of pending dependencies scheduling allows
11148 before flushing the current state and starting over. Large functions
11149 with few branches or calls can create excessively large lists which
11150 needlessly consume memory and resources.
11151
11152 @item max-modulo-backtrack-attempts
11153 The maximum number of backtrack attempts the scheduler should make
11154 when modulo scheduling a loop. Larger values can exponentially increase
11155 compilation time.
11156
11157 @item max-inline-insns-single
11158 Several parameters control the tree inliner used in GCC@.
11159 This number sets the maximum number of instructions (counted in GCC's
11160 internal representation) in a single function that the tree inliner
11161 considers for inlining. This only affects functions declared
11162 inline and methods implemented in a class declaration (C++).
11163
11164 @item max-inline-insns-auto
11165 When you use @option{-finline-functions} (included in @option{-O3}),
11166 a lot of functions that would otherwise not be considered for inlining
11167 by the compiler are investigated. To those functions, a different
11168 (more restrictive) limit compared to functions declared inline can
11169 be applied.
11170
11171 @item max-inline-insns-small
11172 This is bound applied to calls which are considered relevant with
11173 @option{-finline-small-functions}.
11174
11175 @item max-inline-insns-size
11176 This is bound applied to calls which are optimized for size. Small growth
11177 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11178
11179 @item uninlined-function-insns
11180 Number of instructions accounted by inliner for function overhead such as
11181 function prologue and epilogue.
11182
11183 @item uninlined-function-time
11184 Extra time accounted by inliner for function overhead such as time needed to
11185 execute function prologue and epilogue
11186
11187 @item uninlined-thunk-insns
11188 @item uninlined-thunk-time
11189 Same as @option{--param uninlined-function-insns} and
11190 @option{--param uninlined-function-time} but applied to function thunks
11191
11192 @item inline-min-speedup
11193 When estimated performance improvement of caller + callee runtime exceeds this
11194 threshold (in percent), the function can be inlined regardless of the limit on
11195 @option{--param max-inline-insns-single} and @option{--param
11196 max-inline-insns-auto}.
11197
11198 @item large-function-insns
11199 The limit specifying really large functions. For functions larger than this
11200 limit after inlining, inlining is constrained by
11201 @option{--param large-function-growth}. This parameter is useful primarily
11202 to avoid extreme compilation time caused by non-linear algorithms used by the
11203 back end.
11204
11205 @item large-function-growth
11206 Specifies maximal growth of large function caused by inlining in percents.
11207 For example, parameter value 100 limits large function growth to 2.0 times
11208 the original size.
11209
11210 @item large-unit-insns
11211 The limit specifying large translation unit. Growth caused by inlining of
11212 units larger than this limit is limited by @option{--param inline-unit-growth}.
11213 For small units this might be too tight.
11214 For example, consider a unit consisting of function A
11215 that is inline and B that just calls A three times. If B is small relative to
11216 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11217 large units consisting of small inlineable functions, however, the overall unit
11218 growth limit is needed to avoid exponential explosion of code size. Thus for
11219 smaller units, the size is increased to @option{--param large-unit-insns}
11220 before applying @option{--param inline-unit-growth}.
11221
11222 @item inline-unit-growth
11223 Specifies maximal overall growth of the compilation unit caused by inlining.
11224 For example, parameter value 20 limits unit growth to 1.2 times the original
11225 size. Cold functions (either marked cold via an attribute or by profile
11226 feedback) are not accounted into the unit size.
11227
11228 @item ipcp-unit-growth
11229 Specifies maximal overall growth of the compilation unit caused by
11230 interprocedural constant propagation. For example, parameter value 10 limits
11231 unit growth to 1.1 times the original size.
11232
11233 @item large-stack-frame
11234 The limit specifying large stack frames. While inlining the algorithm is trying
11235 to not grow past this limit too much.
11236
11237 @item large-stack-frame-growth
11238 Specifies maximal growth of large stack frames caused by inlining in percents.
11239 For example, parameter value 1000 limits large stack frame growth to 11 times
11240 the original size.
11241
11242 @item max-inline-insns-recursive
11243 @itemx max-inline-insns-recursive-auto
11244 Specifies the maximum number of instructions an out-of-line copy of a
11245 self-recursive inline
11246 function can grow into by performing recursive inlining.
11247
11248 @option{--param max-inline-insns-recursive} applies to functions
11249 declared inline.
11250 For functions not declared inline, recursive inlining
11251 happens only when @option{-finline-functions} (included in @option{-O3}) is
11252 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11253
11254 @item max-inline-recursive-depth
11255 @itemx max-inline-recursive-depth-auto
11256 Specifies the maximum recursion depth used for recursive inlining.
11257
11258 @option{--param max-inline-recursive-depth} applies to functions
11259 declared inline. For functions not declared inline, recursive inlining
11260 happens only when @option{-finline-functions} (included in @option{-O3}) is
11261 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11262
11263 @item min-inline-recursive-probability
11264 Recursive inlining is profitable only for function having deep recursion
11265 in average and can hurt for function having little recursion depth by
11266 increasing the prologue size or complexity of function body to other
11267 optimizers.
11268
11269 When profile feedback is available (see @option{-fprofile-generate}) the actual
11270 recursion depth can be guessed from the probability that function recurses
11271 via a given call expression. This parameter limits inlining only to call
11272 expressions whose probability exceeds the given threshold (in percents).
11273
11274 @item early-inlining-insns
11275 Specify growth that the early inliner can make. In effect it increases
11276 the amount of inlining for code having a large abstraction penalty.
11277
11278 @item max-early-inliner-iterations
11279 Limit of iterations of the early inliner. This basically bounds
11280 the number of nested indirect calls the early inliner can resolve.
11281 Deeper chains are still handled by late inlining.
11282
11283 @item comdat-sharing-probability
11284 Probability (in percent) that C++ inline function with comdat visibility
11285 are shared across multiple compilation units.
11286
11287 @item profile-func-internal-id
11288 A parameter to control whether to use function internal id in profile
11289 database lookup. If the value is 0, the compiler uses an id that
11290 is based on function assembler name and filename, which makes old profile
11291 data more tolerant to source changes such as function reordering etc.
11292
11293 @item min-vect-loop-bound
11294 The minimum number of iterations under which loops are not vectorized
11295 when @option{-ftree-vectorize} is used. The number of iterations after
11296 vectorization needs to be greater than the value specified by this option
11297 to allow vectorization.
11298
11299 @item gcse-cost-distance-ratio
11300 Scaling factor in calculation of maximum distance an expression
11301 can be moved by GCSE optimizations. This is currently supported only in the
11302 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11303 is with simple expressions, i.e., the expressions that have cost
11304 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11305 hoisting of simple expressions.
11306
11307 @item gcse-unrestricted-cost
11308 Cost, roughly measured as the cost of a single typical machine
11309 instruction, at which GCSE optimizations do not constrain
11310 the distance an expression can travel. This is currently
11311 supported only in the code hoisting pass. The lesser the cost,
11312 the more aggressive code hoisting is. Specifying 0
11313 allows all expressions to travel unrestricted distances.
11314
11315 @item max-hoist-depth
11316 The depth of search in the dominator tree for expressions to hoist.
11317 This is used to avoid quadratic behavior in hoisting algorithm.
11318 The value of 0 does not limit on the search, but may slow down compilation
11319 of huge functions.
11320
11321 @item max-tail-merge-comparisons
11322 The maximum amount of similar bbs to compare a bb with. This is used to
11323 avoid quadratic behavior in tree tail merging.
11324
11325 @item max-tail-merge-iterations
11326 The maximum amount of iterations of the pass over the function. This is used to
11327 limit compilation time in tree tail merging.
11328
11329 @item store-merging-allow-unaligned
11330 Allow the store merging pass to introduce unaligned stores if it is legal to
11331 do so.
11332
11333 @item max-stores-to-merge
11334 The maximum number of stores to attempt to merge into wider stores in the store
11335 merging pass.
11336
11337 @item max-unrolled-insns
11338 The maximum number of instructions that a loop may have to be unrolled.
11339 If a loop is unrolled, this parameter also determines how many times
11340 the loop code is unrolled.
11341
11342 @item max-average-unrolled-insns
11343 The maximum number of instructions biased by probabilities of their execution
11344 that a loop may have to be unrolled. If a loop is unrolled,
11345 this parameter also determines how many times the loop code is unrolled.
11346
11347 @item max-unroll-times
11348 The maximum number of unrollings of a single loop.
11349
11350 @item max-peeled-insns
11351 The maximum number of instructions that a loop may have to be peeled.
11352 If a loop is peeled, this parameter also determines how many times
11353 the loop code is peeled.
11354
11355 @item max-peel-times
11356 The maximum number of peelings of a single loop.
11357
11358 @item max-peel-branches
11359 The maximum number of branches on the hot path through the peeled sequence.
11360
11361 @item max-completely-peeled-insns
11362 The maximum number of insns of a completely peeled loop.
11363
11364 @item max-completely-peel-times
11365 The maximum number of iterations of a loop to be suitable for complete peeling.
11366
11367 @item max-completely-peel-loop-nest-depth
11368 The maximum depth of a loop nest suitable for complete peeling.
11369
11370 @item max-unswitch-insns
11371 The maximum number of insns of an unswitched loop.
11372
11373 @item max-unswitch-level
11374 The maximum number of branches unswitched in a single loop.
11375
11376 @item lim-expensive
11377 The minimum cost of an expensive expression in the loop invariant motion.
11378
11379 @item iv-consider-all-candidates-bound
11380 Bound on number of candidates for induction variables, below which
11381 all candidates are considered for each use in induction variable
11382 optimizations. If there are more candidates than this,
11383 only the most relevant ones are considered to avoid quadratic time complexity.
11384
11385 @item iv-max-considered-uses
11386 The induction variable optimizations give up on loops that contain more
11387 induction variable uses.
11388
11389 @item iv-always-prune-cand-set-bound
11390 If the number of candidates in the set is smaller than this value,
11391 always try to remove unnecessary ivs from the set
11392 when adding a new one.
11393
11394 @item avg-loop-niter
11395 Average number of iterations of a loop.
11396
11397 @item dse-max-object-size
11398 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11399 Larger values may result in larger compilation times.
11400
11401 @item dse-max-alias-queries-per-store
11402 Maximum number of queries into the alias oracle per store.
11403 Larger values result in larger compilation times and may result in more
11404 removed dead stores.
11405
11406 @item scev-max-expr-size
11407 Bound on size of expressions used in the scalar evolutions analyzer.
11408 Large expressions slow the analyzer.
11409
11410 @item scev-max-expr-complexity
11411 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11412 Complex expressions slow the analyzer.
11413
11414 @item max-tree-if-conversion-phi-args
11415 Maximum number of arguments in a PHI supported by TREE if conversion
11416 unless the loop is marked with simd pragma.
11417
11418 @item vect-max-version-for-alignment-checks
11419 The maximum number of run-time checks that can be performed when
11420 doing loop versioning for alignment in the vectorizer.
11421
11422 @item vect-max-version-for-alias-checks
11423 The maximum number of run-time checks that can be performed when
11424 doing loop versioning for alias in the vectorizer.
11425
11426 @item vect-max-peeling-for-alignment
11427 The maximum number of loop peels to enhance access alignment
11428 for vectorizer. Value -1 means no limit.
11429
11430 @item max-iterations-to-track
11431 The maximum number of iterations of a loop the brute-force algorithm
11432 for analysis of the number of iterations of the loop tries to evaluate.
11433
11434 @item hot-bb-count-ws-permille
11435 A basic block profile count is considered hot if it contributes to
11436 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11437
11438 @item hot-bb-frequency-fraction
11439 Select fraction of the entry block frequency of executions of basic block in
11440 function given basic block needs to have to be considered hot.
11441
11442 @item max-predicted-iterations
11443 The maximum number of loop iterations we predict statically. This is useful
11444 in cases where a function contains a single loop with known bound and
11445 another loop with unknown bound.
11446 The known number of iterations is predicted correctly, while
11447 the unknown number of iterations average to roughly 10. This means that the
11448 loop without bounds appears artificially cold relative to the other one.
11449
11450 @item builtin-expect-probability
11451 Control the probability of the expression having the specified value. This
11452 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11453
11454 @item builtin-string-cmp-inline-length
11455 The maximum length of a constant string for a builtin string cmp call
11456 eligible for inlining.
11457
11458 @item align-threshold
11459
11460 Select fraction of the maximal frequency of executions of a basic block in
11461 a function to align the basic block.
11462
11463 @item align-loop-iterations
11464
11465 A loop expected to iterate at least the selected number of iterations is
11466 aligned.
11467
11468 @item tracer-dynamic-coverage
11469 @itemx tracer-dynamic-coverage-feedback
11470
11471 This value is used to limit superblock formation once the given percentage of
11472 executed instructions is covered. This limits unnecessary code size
11473 expansion.
11474
11475 The @option{tracer-dynamic-coverage-feedback} parameter
11476 is used only when profile
11477 feedback is available. The real profiles (as opposed to statically estimated
11478 ones) are much less balanced allowing the threshold to be larger value.
11479
11480 @item tracer-max-code-growth
11481 Stop tail duplication once code growth has reached given percentage. This is
11482 a rather artificial limit, as most of the duplicates are eliminated later in
11483 cross jumping, so it may be set to much higher values than is the desired code
11484 growth.
11485
11486 @item tracer-min-branch-ratio
11487
11488 Stop reverse growth when the reverse probability of best edge is less than this
11489 threshold (in percent).
11490
11491 @item tracer-min-branch-probability
11492 @itemx tracer-min-branch-probability-feedback
11493
11494 Stop forward growth if the best edge has probability lower than this
11495 threshold.
11496
11497 Similarly to @option{tracer-dynamic-coverage} two parameters are
11498 provided. @option{tracer-min-branch-probability-feedback} is used for
11499 compilation with profile feedback and @option{tracer-min-branch-probability}
11500 compilation without. The value for compilation with profile feedback
11501 needs to be more conservative (higher) in order to make tracer
11502 effective.
11503
11504 @item stack-clash-protection-guard-size
11505 Specify the size of the operating system provided stack guard as
11506 2 raised to @var{num} bytes. Higher values may reduce the
11507 number of explicit probes, but a value larger than the operating system
11508 provided guard will leave code vulnerable to stack clash style attacks.
11509
11510 @item stack-clash-protection-probe-interval
11511 Stack clash protection involves probing stack space as it is allocated. This
11512 param controls the maximum distance between probes into the stack as 2 raised
11513 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11514 larger than the operating system provided guard will leave code vulnerable to
11515 stack clash style attacks.
11516
11517 @item max-cse-path-length
11518
11519 The maximum number of basic blocks on path that CSE considers.
11520
11521 @item max-cse-insns
11522 The maximum number of instructions CSE processes before flushing.
11523
11524 @item ggc-min-expand
11525
11526 GCC uses a garbage collector to manage its own memory allocation. This
11527 parameter specifies the minimum percentage by which the garbage
11528 collector's heap should be allowed to expand between collections.
11529 Tuning this may improve compilation speed; it has no effect on code
11530 generation.
11531
11532 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11533 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11534 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11535 GCC is not able to calculate RAM on a particular platform, the lower
11536 bound of 30% is used. Setting this parameter and
11537 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11538 every opportunity. This is extremely slow, but can be useful for
11539 debugging.
11540
11541 @item ggc-min-heapsize
11542
11543 Minimum size of the garbage collector's heap before it begins bothering
11544 to collect garbage. The first collection occurs after the heap expands
11545 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11546 tuning this may improve compilation speed, and has no effect on code
11547 generation.
11548
11549 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11550 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11551 with a lower bound of 4096 (four megabytes) and an upper bound of
11552 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11553 particular platform, the lower bound is used. Setting this parameter
11554 very large effectively disables garbage collection. Setting this
11555 parameter and @option{ggc-min-expand} to zero causes a full collection
11556 to occur at every opportunity.
11557
11558 @item max-reload-search-insns
11559 The maximum number of instruction reload should look backward for equivalent
11560 register. Increasing values mean more aggressive optimization, making the
11561 compilation time increase with probably slightly better performance.
11562
11563 @item max-cselib-memory-locations
11564 The maximum number of memory locations cselib should take into account.
11565 Increasing values mean more aggressive optimization, making the compilation time
11566 increase with probably slightly better performance.
11567
11568 @item max-sched-ready-insns
11569 The maximum number of instructions ready to be issued the scheduler should
11570 consider at any given time during the first scheduling pass. Increasing
11571 values mean more thorough searches, making the compilation time increase
11572 with probably little benefit.
11573
11574 @item max-sched-region-blocks
11575 The maximum number of blocks in a region to be considered for
11576 interblock scheduling.
11577
11578 @item max-pipeline-region-blocks
11579 The maximum number of blocks in a region to be considered for
11580 pipelining in the selective scheduler.
11581
11582 @item max-sched-region-insns
11583 The maximum number of insns in a region to be considered for
11584 interblock scheduling.
11585
11586 @item max-pipeline-region-insns
11587 The maximum number of insns in a region to be considered for
11588 pipelining in the selective scheduler.
11589
11590 @item min-spec-prob
11591 The minimum probability (in percents) of reaching a source block
11592 for interblock speculative scheduling.
11593
11594 @item max-sched-extend-regions-iters
11595 The maximum number of iterations through CFG to extend regions.
11596 A value of 0 disables region extensions.
11597
11598 @item max-sched-insn-conflict-delay
11599 The maximum conflict delay for an insn to be considered for speculative motion.
11600
11601 @item sched-spec-prob-cutoff
11602 The minimal probability of speculation success (in percents), so that
11603 speculative insns are scheduled.
11604
11605 @item sched-state-edge-prob-cutoff
11606 The minimum probability an edge must have for the scheduler to save its
11607 state across it.
11608
11609 @item sched-mem-true-dep-cost
11610 Minimal distance (in CPU cycles) between store and load targeting same
11611 memory locations.
11612
11613 @item selsched-max-lookahead
11614 The maximum size of the lookahead window of selective scheduling. It is a
11615 depth of search for available instructions.
11616
11617 @item selsched-max-sched-times
11618 The maximum number of times that an instruction is scheduled during
11619 selective scheduling. This is the limit on the number of iterations
11620 through which the instruction may be pipelined.
11621
11622 @item selsched-insns-to-rename
11623 The maximum number of best instructions in the ready list that are considered
11624 for renaming in the selective scheduler.
11625
11626 @item sms-min-sc
11627 The minimum value of stage count that swing modulo scheduler
11628 generates.
11629
11630 @item max-last-value-rtl
11631 The maximum size measured as number of RTLs that can be recorded in an expression
11632 in combiner for a pseudo register as last known value of that register.
11633
11634 @item max-combine-insns
11635 The maximum number of instructions the RTL combiner tries to combine.
11636
11637 @item integer-share-limit
11638 Small integer constants can use a shared data structure, reducing the
11639 compiler's memory usage and increasing its speed. This sets the maximum
11640 value of a shared integer constant.
11641
11642 @item ssp-buffer-size
11643 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11644 protection when @option{-fstack-protection} is used.
11645
11646 @item min-size-for-stack-sharing
11647 The minimum size of variables taking part in stack slot sharing when not
11648 optimizing.
11649
11650 @item max-jump-thread-duplication-stmts
11651 Maximum number of statements allowed in a block that needs to be
11652 duplicated when threading jumps.
11653
11654 @item max-fields-for-field-sensitive
11655 Maximum number of fields in a structure treated in
11656 a field sensitive manner during pointer analysis.
11657
11658 @item prefetch-latency
11659 Estimate on average number of instructions that are executed before
11660 prefetch finishes. The distance prefetched ahead is proportional
11661 to this constant. Increasing this number may also lead to less
11662 streams being prefetched (see @option{simultaneous-prefetches}).
11663
11664 @item simultaneous-prefetches
11665 Maximum number of prefetches that can run at the same time.
11666
11667 @item l1-cache-line-size
11668 The size of cache line in L1 data cache, in bytes.
11669
11670 @item l1-cache-size
11671 The size of L1 data cache, in kilobytes.
11672
11673 @item l2-cache-size
11674 The size of L2 data cache, in kilobytes.
11675
11676 @item prefetch-dynamic-strides
11677 Whether the loop array prefetch pass should issue software prefetch hints
11678 for strides that are non-constant. In some cases this may be
11679 beneficial, though the fact the stride is non-constant may make it
11680 hard to predict when there is clear benefit to issuing these hints.
11681
11682 Set to 1 if the prefetch hints should be issued for non-constant
11683 strides. Set to 0 if prefetch hints should be issued only for strides that
11684 are known to be constant and below @option{prefetch-minimum-stride}.
11685
11686 @item prefetch-minimum-stride
11687 Minimum constant stride, in bytes, to start using prefetch hints for. If
11688 the stride is less than this threshold, prefetch hints will not be issued.
11689
11690 This setting is useful for processors that have hardware prefetchers, in
11691 which case there may be conflicts between the hardware prefetchers and
11692 the software prefetchers. If the hardware prefetchers have a maximum
11693 stride they can handle, it should be used here to improve the use of
11694 software prefetchers.
11695
11696 A value of -1 means we don't have a threshold and therefore
11697 prefetch hints can be issued for any constant stride.
11698
11699 This setting is only useful for strides that are known and constant.
11700
11701 @item loop-interchange-max-num-stmts
11702 The maximum number of stmts in a loop to be interchanged.
11703
11704 @item loop-interchange-stride-ratio
11705 The minimum ratio between stride of two loops for interchange to be profitable.
11706
11707 @item min-insn-to-prefetch-ratio
11708 The minimum ratio between the number of instructions and the
11709 number of prefetches to enable prefetching in a loop.
11710
11711 @item prefetch-min-insn-to-mem-ratio
11712 The minimum ratio between the number of instructions and the
11713 number of memory references to enable prefetching in a loop.
11714
11715 @item use-canonical-types
11716 Whether the compiler should use the ``canonical'' type system.
11717 Should always be 1, which uses a more efficient internal
11718 mechanism for comparing types in C++ and Objective-C++. However, if
11719 bugs in the canonical type system are causing compilation failures,
11720 set this value to 0 to disable canonical types.
11721
11722 @item switch-conversion-max-branch-ratio
11723 Switch initialization conversion refuses to create arrays that are
11724 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11725 branches in the switch.
11726
11727 @item max-partial-antic-length
11728 Maximum length of the partial antic set computed during the tree
11729 partial redundancy elimination optimization (@option{-ftree-pre}) when
11730 optimizing at @option{-O3} and above. For some sorts of source code
11731 the enhanced partial redundancy elimination optimization can run away,
11732 consuming all of the memory available on the host machine. This
11733 parameter sets a limit on the length of the sets that are computed,
11734 which prevents the runaway behavior. Setting a value of 0 for
11735 this parameter allows an unlimited set length.
11736
11737 @item rpo-vn-max-loop-depth
11738 Maximum loop depth that is value-numbered optimistically.
11739 When the limit hits the innermost
11740 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11741 loop nest are value-numbered optimistically and the remaining ones not.
11742
11743 @item sccvn-max-alias-queries-per-access
11744 Maximum number of alias-oracle queries we perform when looking for
11745 redundancies for loads and stores. If this limit is hit the search
11746 is aborted and the load or store is not considered redundant. The
11747 number of queries is algorithmically limited to the number of
11748 stores on all paths from the load to the function entry.
11749
11750 @item ira-max-loops-num
11751 IRA uses regional register allocation by default. If a function
11752 contains more loops than the number given by this parameter, only at most
11753 the given number of the most frequently-executed loops form regions
11754 for regional register allocation.
11755
11756 @item ira-max-conflict-table-size
11757 Although IRA uses a sophisticated algorithm to compress the conflict
11758 table, the table can still require excessive amounts of memory for
11759 huge functions. If the conflict table for a function could be more
11760 than the size in MB given by this parameter, the register allocator
11761 instead uses a faster, simpler, and lower-quality
11762 algorithm that does not require building a pseudo-register conflict table.
11763
11764 @item ira-loop-reserved-regs
11765 IRA can be used to evaluate more accurate register pressure in loops
11766 for decisions to move loop invariants (see @option{-O3}). The number
11767 of available registers reserved for some other purposes is given
11768 by this parameter. Default of the parameter
11769 is the best found from numerous experiments.
11770
11771 @item lra-inheritance-ebb-probability-cutoff
11772 LRA tries to reuse values reloaded in registers in subsequent insns.
11773 This optimization is called inheritance. EBB is used as a region to
11774 do this optimization. The parameter defines a minimal fall-through
11775 edge probability in percentage used to add BB to inheritance EBB in
11776 LRA. The default value was chosen
11777 from numerous runs of SPEC2000 on x86-64.
11778
11779 @item loop-invariant-max-bbs-in-loop
11780 Loop invariant motion can be very expensive, both in compilation time and
11781 in amount of needed compile-time memory, with very large loops. Loops
11782 with more basic blocks than this parameter won't have loop invariant
11783 motion optimization performed on them.
11784
11785 @item loop-max-datarefs-for-datadeps
11786 Building data dependencies is expensive for very large loops. This
11787 parameter limits the number of data references in loops that are
11788 considered for data dependence analysis. These large loops are no
11789 handled by the optimizations using loop data dependencies.
11790
11791 @item max-vartrack-size
11792 Sets a maximum number of hash table slots to use during variable
11793 tracking dataflow analysis of any function. If this limit is exceeded
11794 with variable tracking at assignments enabled, analysis for that
11795 function is retried without it, after removing all debug insns from
11796 the function. If the limit is exceeded even without debug insns, var
11797 tracking analysis is completely disabled for the function. Setting
11798 the parameter to zero makes it unlimited.
11799
11800 @item max-vartrack-expr-depth
11801 Sets a maximum number of recursion levels when attempting to map
11802 variable names or debug temporaries to value expressions. This trades
11803 compilation time for more complete debug information. If this is set too
11804 low, value expressions that are available and could be represented in
11805 debug information may end up not being used; setting this higher may
11806 enable the compiler to find more complex debug expressions, but compile
11807 time and memory use may grow.
11808
11809 @item max-debug-marker-count
11810 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11811 markers) to avoid complexity explosion at inlining or expanding to RTL.
11812 If a function has more such gimple stmts than the set limit, such stmts
11813 will be dropped from the inlined copy of a function, and from its RTL
11814 expansion.
11815
11816 @item min-nondebug-insn-uid
11817 Use uids starting at this parameter for nondebug insns. The range below
11818 the parameter is reserved exclusively for debug insns created by
11819 @option{-fvar-tracking-assignments}, but debug insns may get
11820 (non-overlapping) uids above it if the reserved range is exhausted.
11821
11822 @item ipa-sra-ptr-growth-factor
11823 IPA-SRA replaces a pointer to an aggregate with one or more new
11824 parameters only when their cumulative size is less or equal to
11825 @option{ipa-sra-ptr-growth-factor} times the size of the original
11826 pointer parameter.
11827
11828 @item sra-max-scalarization-size-Ospeed
11829 @itemx sra-max-scalarization-size-Osize
11830 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11831 replace scalar parts of aggregates with uses of independent scalar
11832 variables. These parameters control the maximum size, in storage units,
11833 of aggregate which is considered for replacement when compiling for
11834 speed
11835 (@option{sra-max-scalarization-size-Ospeed}) or size
11836 (@option{sra-max-scalarization-size-Osize}) respectively.
11837
11838 @item tm-max-aggregate-size
11839 When making copies of thread-local variables in a transaction, this
11840 parameter specifies the size in bytes after which variables are
11841 saved with the logging functions as opposed to save/restore code
11842 sequence pairs. This option only applies when using
11843 @option{-fgnu-tm}.
11844
11845 @item graphite-max-nb-scop-params
11846 To avoid exponential effects in the Graphite loop transforms, the
11847 number of parameters in a Static Control Part (SCoP) is bounded.
11848 A value of zero can be used to lift
11849 the bound. A variable whose value is unknown at compilation time and
11850 defined outside a SCoP is a parameter of the SCoP.
11851
11852 @item loop-block-tile-size
11853 Loop blocking or strip mining transforms, enabled with
11854 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11855 loop in the loop nest by a given number of iterations. The strip
11856 length can be changed using the @option{loop-block-tile-size}
11857 parameter.
11858
11859 @item ipa-cp-value-list-size
11860 IPA-CP attempts to track all possible values and types passed to a function's
11861 parameter in order to propagate them and perform devirtualization.
11862 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11863 stores per one formal parameter of a function.
11864
11865 @item ipa-cp-eval-threshold
11866 IPA-CP calculates its own score of cloning profitability heuristics
11867 and performs those cloning opportunities with scores that exceed
11868 @option{ipa-cp-eval-threshold}.
11869
11870 @item ipa-cp-recursion-penalty
11871 Percentage penalty the recursive functions will receive when they
11872 are evaluated for cloning.
11873
11874 @item ipa-cp-single-call-penalty
11875 Percentage penalty functions containing a single call to another
11876 function will receive when they are evaluated for cloning.
11877
11878 @item ipa-max-agg-items
11879 IPA-CP is also capable to propagate a number of scalar values passed
11880 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11881 number of such values per one parameter.
11882
11883 @item ipa-cp-loop-hint-bonus
11884 When IPA-CP determines that a cloning candidate would make the number
11885 of iterations of a loop known, it adds a bonus of
11886 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11887 the candidate.
11888
11889 @item ipa-cp-array-index-hint-bonus
11890 When IPA-CP determines that a cloning candidate would make the index of
11891 an array access known, it adds a bonus of
11892 @option{ipa-cp-array-index-hint-bonus} to the profitability
11893 score of the candidate.
11894
11895 @item ipa-max-aa-steps
11896 During its analysis of function bodies, IPA-CP employs alias analysis
11897 in order to track values pointed to by function parameters. In order
11898 not spend too much time analyzing huge functions, it gives up and
11899 consider all memory clobbered after examining
11900 @option{ipa-max-aa-steps} statements modifying memory.
11901
11902 @item lto-partitions
11903 Specify desired number of partitions produced during WHOPR compilation.
11904 The number of partitions should exceed the number of CPUs used for compilation.
11905
11906 @item lto-min-partition
11907 Size of minimal partition for WHOPR (in estimated instructions).
11908 This prevents expenses of splitting very small programs into too many
11909 partitions.
11910
11911 @item lto-max-partition
11912 Size of max partition for WHOPR (in estimated instructions).
11913 to provide an upper bound for individual size of partition.
11914 Meant to be used only with balanced partitioning.
11915
11916 @item lto-max-streaming-parallelism
11917 Maximal number of parallel processes used for LTO streaming.
11918
11919 @item cxx-max-namespaces-for-diagnostic-help
11920 The maximum number of namespaces to consult for suggestions when C++
11921 name lookup fails for an identifier.
11922
11923 @item sink-frequency-threshold
11924 The maximum relative execution frequency (in percents) of the target block
11925 relative to a statement's original block to allow statement sinking of a
11926 statement. Larger numbers result in more aggressive statement sinking.
11927 A small positive adjustment is applied for
11928 statements with memory operands as those are even more profitable so sink.
11929
11930 @item max-stores-to-sink
11931 The maximum number of conditional store pairs that can be sunk. Set to 0
11932 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11933 (@option{-ftree-loop-if-convert}) is disabled.
11934
11935 @item allow-store-data-races
11936 Allow optimizers to introduce new data races on stores.
11937 Set to 1 to allow, otherwise to 0.
11938
11939 @item case-values-threshold
11940 The smallest number of different values for which it is best to use a
11941 jump-table instead of a tree of conditional branches. If the value is
11942 0, use the default for the machine.
11943
11944 @item jump-table-max-growth-ratio-for-size
11945 The maximum code size growth ratio when expanding
11946 into a jump table (in percent). The parameter is used when
11947 optimizing for size.
11948
11949 @item jump-table-max-growth-ratio-for-speed
11950 The maximum code size growth ratio when expanding
11951 into a jump table (in percent). The parameter is used when
11952 optimizing for speed.
11953
11954 @item tree-reassoc-width
11955 Set the maximum number of instructions executed in parallel in
11956 reassociated tree. This parameter overrides target dependent
11957 heuristics used by default if has non zero value.
11958
11959 @item sched-pressure-algorithm
11960 Choose between the two available implementations of
11961 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11962 and is the more likely to prevent instructions from being reordered.
11963 Algorithm 2 was designed to be a compromise between the relatively
11964 conservative approach taken by algorithm 1 and the rather aggressive
11965 approach taken by the default scheduler. It relies more heavily on
11966 having a regular register file and accurate register pressure classes.
11967 See @file{haifa-sched.c} in the GCC sources for more details.
11968
11969 The default choice depends on the target.
11970
11971 @item max-slsr-cand-scan
11972 Set the maximum number of existing candidates that are considered when
11973 seeking a basis for a new straight-line strength reduction candidate.
11974
11975 @item asan-globals
11976 Enable buffer overflow detection for global objects. This kind
11977 of protection is enabled by default if you are using
11978 @option{-fsanitize=address} option.
11979 To disable global objects protection use @option{--param asan-globals=0}.
11980
11981 @item asan-stack
11982 Enable buffer overflow detection for stack objects. This kind of
11983 protection is enabled by default when using @option{-fsanitize=address}.
11984 To disable stack protection use @option{--param asan-stack=0} option.
11985
11986 @item asan-instrument-reads
11987 Enable buffer overflow detection for memory reads. This kind of
11988 protection is enabled by default when using @option{-fsanitize=address}.
11989 To disable memory reads protection use
11990 @option{--param asan-instrument-reads=0}.
11991
11992 @item asan-instrument-writes
11993 Enable buffer overflow detection for memory writes. This kind of
11994 protection is enabled by default when using @option{-fsanitize=address}.
11995 To disable memory writes protection use
11996 @option{--param asan-instrument-writes=0} option.
11997
11998 @item asan-memintrin
11999 Enable detection for built-in functions. This kind of protection
12000 is enabled by default when using @option{-fsanitize=address}.
12001 To disable built-in functions protection use
12002 @option{--param asan-memintrin=0}.
12003
12004 @item asan-use-after-return
12005 Enable detection of use-after-return. This kind of protection
12006 is enabled by default when using the @option{-fsanitize=address} option.
12007 To disable it use @option{--param asan-use-after-return=0}.
12008
12009 Note: By default the check is disabled at run time. To enable it,
12010 add @code{detect_stack_use_after_return=1} to the environment variable
12011 @env{ASAN_OPTIONS}.
12012
12013 @item asan-instrumentation-with-call-threshold
12014 If number of memory accesses in function being instrumented
12015 is greater or equal to this number, use callbacks instead of inline checks.
12016 E.g. to disable inline code use
12017 @option{--param asan-instrumentation-with-call-threshold=0}.
12018
12019 @item use-after-scope-direct-emission-threshold
12020 If the size of a local variable in bytes is smaller or equal to this
12021 number, directly poison (or unpoison) shadow memory instead of using
12022 run-time callbacks.
12023
12024 @item max-fsm-thread-path-insns
12025 Maximum number of instructions to copy when duplicating blocks on a
12026 finite state automaton jump thread path.
12027
12028 @item max-fsm-thread-length
12029 Maximum number of basic blocks on a finite state automaton jump thread
12030 path.
12031
12032 @item max-fsm-thread-paths
12033 Maximum number of new jump thread paths to create for a finite state
12034 automaton.
12035
12036 @item parloops-chunk-size
12037 Chunk size of omp schedule for loops parallelized by parloops.
12038
12039 @item parloops-schedule
12040 Schedule type of omp schedule for loops parallelized by parloops (static,
12041 dynamic, guided, auto, runtime).
12042
12043 @item parloops-min-per-thread
12044 The minimum number of iterations per thread of an innermost parallelized
12045 loop for which the parallelized variant is preferred over the single threaded
12046 one. Note that for a parallelized loop nest the
12047 minimum number of iterations of the outermost loop per thread is two.
12048
12049 @item max-ssa-name-query-depth
12050 Maximum depth of recursion when querying properties of SSA names in things
12051 like fold routines. One level of recursion corresponds to following a
12052 use-def chain.
12053
12054 @item hsa-gen-debug-stores
12055 Enable emission of special debug stores within HSA kernels which are
12056 then read and reported by libgomp plugin. Generation of these stores
12057 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12058 enable it.
12059
12060 @item max-speculative-devirt-maydefs
12061 The maximum number of may-defs we analyze when looking for a must-def
12062 specifying the dynamic type of an object that invokes a virtual call
12063 we may be able to devirtualize speculatively.
12064
12065 @item max-vrp-switch-assertions
12066 The maximum number of assertions to add along the default edge of a switch
12067 statement during VRP.
12068
12069 @item unroll-jam-min-percent
12070 The minimum percentage of memory references that must be optimized
12071 away for the unroll-and-jam transformation to be considered profitable.
12072
12073 @item unroll-jam-max-unroll
12074 The maximum number of times the outer loop should be unrolled by
12075 the unroll-and-jam transformation.
12076
12077 @item max-rtl-if-conversion-unpredictable-cost
12078 Maximum permissible cost for the sequence that would be generated
12079 by the RTL if-conversion pass for a branch that is considered unpredictable.
12080
12081 @item max-variable-expansions-in-unroller
12082 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12083 of times that an individual variable will be expanded during loop unrolling.
12084
12085 @item tracer-min-branch-probability-feedback
12086 Stop forward growth if the probability of best edge is less than
12087 this threshold (in percent). Used when profile feedback is available.
12088
12089 @item partial-inlining-entry-probability
12090 Maximum probability of the entry BB of split region
12091 (in percent relative to entry BB of the function)
12092 to make partial inlining happen.
12093
12094 @item max-tracked-strlens
12095 Maximum number of strings for which strlen optimization pass will
12096 track string lengths.
12097
12098 @item gcse-after-reload-partial-fraction
12099 The threshold ratio for performing partial redundancy
12100 elimination after reload.
12101
12102 @item gcse-after-reload-critical-fraction
12103 The threshold ratio of critical edges execution count that
12104 permit performing redundancy elimination after reload.
12105
12106 @item max-loop-header-insns
12107 The maximum number of insns in loop header duplicated
12108 by the copy loop headers pass.
12109
12110 @item vect-epilogues-nomask
12111 Enable loop epilogue vectorization using smaller vector size.
12112
12113 @item slp-max-insns-in-bb
12114 Maximum number of instructions in basic block to be
12115 considered for SLP vectorization.
12116
12117 @item avoid-fma-max-bits
12118 Maximum number of bits for which we avoid creating FMAs.
12119
12120 @item sms-loop-average-count-threshold
12121 A threshold on the average loop count considered by the swing modulo scheduler.
12122
12123 @item sms-dfa-history
12124 The number of cycles the swing modulo scheduler considers when checking
12125 conflicts using DFA.
12126
12127 @item hot-bb-count-fraction
12128 Select fraction of the maximal count of repetitions of basic block
12129 in program given basic block needs
12130 to have to be considered hot (used in non-LTO mode)
12131
12132 @item max-inline-insns-recursive-auto
12133 The maximum number of instructions non-inline function
12134 can grow to via recursive inlining.
12135
12136 @item graphite-allow-codegen-errors
12137 Whether codegen errors should be ICEs when @option{-fchecking}.
12138
12139 @item sms-max-ii-factor
12140 A factor for tuning the upper bound that swing modulo scheduler
12141 uses for scheduling a loop.
12142
12143 @item lra-max-considered-reload-pseudos
12144 The max number of reload pseudos which are considered during
12145 spilling a non-reload pseudo.
12146
12147 @item max-pow-sqrt-depth
12148 Maximum depth of sqrt chains to use when synthesizing exponentiation
12149 by a real constant.
12150
12151 @item max-dse-active-local-stores
12152 Maximum number of active local stores in RTL dead store elimination.
12153
12154 @item asan-instrument-allocas
12155 Enable asan allocas/VLAs protection.
12156
12157 @item max-iterations-computation-cost
12158 Bound on the cost of an expression to compute the number of iterations.
12159
12160 @item max-isl-operations
12161 Maximum number of isl operations, 0 means unlimited.
12162
12163 @item graphite-max-arrays-per-scop
12164 Maximum number of arrays per scop.
12165
12166 @item max-vartrack-reverse-op-size
12167 Max. size of loc list for which reverse ops should be added.
12168
12169 @item unlikely-bb-count-fraction
12170 The minimum fraction of profile runs a given basic block execution count
12171 must be not to be considered unlikely.
12172
12173 @item tracer-dynamic-coverage-feedback
12174 The percentage of function, weighted by execution frequency,
12175 that must be covered by trace formation.
12176 Used when profile feedback is available.
12177
12178 @item max-inline-recursive-depth-auto
12179 The maximum depth of recursive inlining for non-inline functions.
12180
12181 @item fsm-scale-path-stmts
12182 Scale factor to apply to the number of statements in a threading path
12183 when comparing to the number of (scaled) blocks.
12184
12185 @item fsm-maximum-phi-arguments
12186 Maximum number of arguments a PHI may have before the FSM threader
12187 will not try to thread through its block.
12188
12189 @item uninit-control-dep-attempts
12190 Maximum number of nested calls to search for control dependencies
12191 during uninitialized variable analysis.
12192
12193 @item max-once-peeled-insns
12194 The maximum number of insns of a peeled loop that rolls only once.
12195
12196 @item sra-max-scalarization-size-Osize
12197 Maximum size, in storage units, of an aggregate
12198 which should be considered for scalarization when compiling for size.
12199
12200 @item fsm-scale-path-blocks
12201 Scale factor to apply to the number of blocks in a threading path
12202 when comparing to the number of (scaled) statements.
12203
12204 @item sched-autopref-queue-depth
12205 Hardware autoprefetcher scheduler model control flag.
12206 Number of lookahead cycles the model looks into; at '
12207 ' only enable instruction sorting heuristic.
12208
12209 @item loop-versioning-max-inner-insns
12210 The maximum number of instructions that an inner loop can have
12211 before the loop versioning pass considers it too big to copy.
12212
12213 @item loop-versioning-max-outer-insns
12214 The maximum number of instructions that an outer loop can have
12215 before the loop versioning pass considers it too big to copy,
12216 discounting any instructions in inner loops that directly benefit
12217 from versioning.
12218
12219 @end table
12220 @end table
12221
12222 @node Instrumentation Options
12223 @section Program Instrumentation Options
12224 @cindex instrumentation options
12225 @cindex program instrumentation options
12226 @cindex run-time error checking options
12227 @cindex profiling options
12228 @cindex options, program instrumentation
12229 @cindex options, run-time error checking
12230 @cindex options, profiling
12231
12232 GCC supports a number of command-line options that control adding
12233 run-time instrumentation to the code it normally generates.
12234 For example, one purpose of instrumentation is collect profiling
12235 statistics for use in finding program hot spots, code coverage
12236 analysis, or profile-guided optimizations.
12237 Another class of program instrumentation is adding run-time checking
12238 to detect programming errors like invalid pointer
12239 dereferences or out-of-bounds array accesses, as well as deliberately
12240 hostile attacks such as stack smashing or C++ vtable hijacking.
12241 There is also a general hook which can be used to implement other
12242 forms of tracing or function-level instrumentation for debug or
12243 program analysis purposes.
12244
12245 @table @gcctabopt
12246 @cindex @command{prof}
12247 @cindex @command{gprof}
12248 @item -p
12249 @itemx -pg
12250 @opindex p
12251 @opindex pg
12252 Generate extra code to write profile information suitable for the
12253 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12254 (for @option{-pg}). You must use this option when compiling
12255 the source files you want data about, and you must also use it when
12256 linking.
12257
12258 You can use the function attribute @code{no_instrument_function} to
12259 suppress profiling of individual functions when compiling with these options.
12260 @xref{Common Function Attributes}.
12261
12262 @item -fprofile-arcs
12263 @opindex fprofile-arcs
12264 Add code so that program flow @dfn{arcs} are instrumented. During
12265 execution the program records how many times each branch and call is
12266 executed and how many times it is taken or returns. On targets that support
12267 constructors with priority support, profiling properly handles constructors,
12268 destructors and C++ constructors (and destructors) of classes which are used
12269 as a type of a global variable.
12270
12271 When the compiled
12272 program exits it saves this data to a file called
12273 @file{@var{auxname}.gcda} for each source file. The data may be used for
12274 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12275 test coverage analysis (@option{-ftest-coverage}). Each object file's
12276 @var{auxname} is generated from the name of the output file, if
12277 explicitly specified and it is not the final executable, otherwise it is
12278 the basename of the source file. In both cases any suffix is removed
12279 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12280 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12281 @xref{Cross-profiling}.
12282
12283 @cindex @command{gcov}
12284 @item --coverage
12285 @opindex coverage
12286
12287 This option is used to compile and link code instrumented for coverage
12288 analysis. The option is a synonym for @option{-fprofile-arcs}
12289 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12290 linking). See the documentation for those options for more details.
12291
12292 @itemize
12293
12294 @item
12295 Compile the source files with @option{-fprofile-arcs} plus optimization
12296 and code generation options. For test coverage analysis, use the
12297 additional @option{-ftest-coverage} option. You do not need to profile
12298 every source file in a program.
12299
12300 @item
12301 Compile the source files additionally with @option{-fprofile-abs-path}
12302 to create absolute path names in the @file{.gcno} files. This allows
12303 @command{gcov} to find the correct sources in projects where compilations
12304 occur with different working directories.
12305
12306 @item
12307 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12308 (the latter implies the former).
12309
12310 @item
12311 Run the program on a representative workload to generate the arc profile
12312 information. This may be repeated any number of times. You can run
12313 concurrent instances of your program, and provided that the file system
12314 supports locking, the data files will be correctly updated. Unless
12315 a strict ISO C dialect option is in effect, @code{fork} calls are
12316 detected and correctly handled without double counting.
12317
12318 @item
12319 For profile-directed optimizations, compile the source files again with
12320 the same optimization and code generation options plus
12321 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12322 Control Optimization}).
12323
12324 @item
12325 For test coverage analysis, use @command{gcov} to produce human readable
12326 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12327 @command{gcov} documentation for further information.
12328
12329 @end itemize
12330
12331 With @option{-fprofile-arcs}, for each function of your program GCC
12332 creates a program flow graph, then finds a spanning tree for the graph.
12333 Only arcs that are not on the spanning tree have to be instrumented: the
12334 compiler adds code to count the number of times that these arcs are
12335 executed. When an arc is the only exit or only entrance to a block, the
12336 instrumentation code can be added to the block; otherwise, a new basic
12337 block must be created to hold the instrumentation code.
12338
12339 @need 2000
12340 @item -ftest-coverage
12341 @opindex ftest-coverage
12342 Produce a notes file that the @command{gcov} code-coverage utility
12343 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12344 show program coverage. Each source file's note file is called
12345 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12346 above for a description of @var{auxname} and instructions on how to
12347 generate test coverage data. Coverage data matches the source files
12348 more closely if you do not optimize.
12349
12350 @item -fprofile-abs-path
12351 @opindex fprofile-abs-path
12352 Automatically convert relative source file names to absolute path names
12353 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12354 sources in projects where compilations occur with different working
12355 directories.
12356
12357 @item -fprofile-dir=@var{path}
12358 @opindex fprofile-dir
12359
12360 Set the directory to search for the profile data files in to @var{path}.
12361 This option affects only the profile data generated by
12362 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12363 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12364 and its related options. Both absolute and relative paths can be used.
12365 By default, GCC uses the current directory as @var{path}, thus the
12366 profile data file appears in the same directory as the object file.
12367 In order to prevent the file name clashing, if the object file name is
12368 not an absolute path, we mangle the absolute path of the
12369 @file{@var{sourcename}.gcda} file and use it as the file name of a
12370 @file{.gcda} file.
12371
12372 When an executable is run in a massive parallel environment, it is recommended
12373 to save profile to different folders. That can be done with variables
12374 in @var{path} that are exported during run-time:
12375
12376 @table @gcctabopt
12377
12378 @item %p
12379 process ID.
12380
12381 @item %q@{VAR@}
12382 value of environment variable @var{VAR}
12383
12384 @end table
12385
12386 @item -fprofile-generate
12387 @itemx -fprofile-generate=@var{path}
12388 @opindex fprofile-generate
12389
12390 Enable options usually used for instrumenting application to produce
12391 profile useful for later recompilation with profile feedback based
12392 optimization. You must use @option{-fprofile-generate} both when
12393 compiling and when linking your program.
12394
12395 The following options are enabled:
12396 @option{-fprofile-arcs}, @option{-fprofile-values},
12397 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12398
12399 If @var{path} is specified, GCC looks at the @var{path} to find
12400 the profile feedback data files. See @option{-fprofile-dir}.
12401
12402 To optimize the program based on the collected profile information, use
12403 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12404
12405 @item -fprofile-update=@var{method}
12406 @opindex fprofile-update
12407
12408 Alter the update method for an application instrumented for profile
12409 feedback based optimization. The @var{method} argument should be one of
12410 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12411 The first one is useful for single-threaded applications,
12412 while the second one prevents profile corruption by emitting thread-safe code.
12413
12414 @strong{Warning:} When an application does not properly join all threads
12415 (or creates an detached thread), a profile file can be still corrupted.
12416
12417 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12418 when supported by a target, or to @samp{single} otherwise. The GCC driver
12419 automatically selects @samp{prefer-atomic} when @option{-pthread}
12420 is present in the command line.
12421
12422 @item -fprofile-filter-files=@var{regex}
12423 @opindex fprofile-filter-files
12424
12425 Instrument only functions from files where names match
12426 any regular expression (separated by a semi-colon).
12427
12428 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12429 only @file{main.c} and all C files starting with 'module'.
12430
12431 @item -fprofile-exclude-files=@var{regex}
12432 @opindex fprofile-exclude-files
12433
12434 Instrument only functions from files where names do not match
12435 all the regular expressions (separated by a semi-colon).
12436
12437 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12438 of all files that are located in @file{/usr/} folder.
12439
12440 @item -fsanitize=address
12441 @opindex fsanitize=address
12442 Enable AddressSanitizer, a fast memory error detector.
12443 Memory access instructions are instrumented to detect
12444 out-of-bounds and use-after-free bugs.
12445 The option enables @option{-fsanitize-address-use-after-scope}.
12446 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12447 more details. The run-time behavior can be influenced using the
12448 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12449 the available options are shown at startup of the instrumented program. See
12450 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12451 for a list of supported options.
12452 The option cannot be combined with @option{-fsanitize=thread}.
12453
12454 @item -fsanitize=kernel-address
12455 @opindex fsanitize=kernel-address
12456 Enable AddressSanitizer for Linux kernel.
12457 See @uref{https://github.com/google/kasan/wiki} for more details.
12458
12459 @item -fsanitize=pointer-compare
12460 @opindex fsanitize=pointer-compare
12461 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12462 The option must be combined with either @option{-fsanitize=kernel-address} or
12463 @option{-fsanitize=address}
12464 The option cannot be combined with @option{-fsanitize=thread}.
12465 Note: By default the check is disabled at run time. To enable it,
12466 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12467 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12468 invalid operation only when both pointers are non-null.
12469
12470 @item -fsanitize=pointer-subtract
12471 @opindex fsanitize=pointer-subtract
12472 Instrument subtraction with pointer operands.
12473 The option must be combined with either @option{-fsanitize=kernel-address} or
12474 @option{-fsanitize=address}
12475 The option cannot be combined with @option{-fsanitize=thread}.
12476 Note: By default the check is disabled at run time. To enable it,
12477 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12478 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12479 invalid operation only when both pointers are non-null.
12480
12481 @item -fsanitize=thread
12482 @opindex fsanitize=thread
12483 Enable ThreadSanitizer, a fast data race detector.
12484 Memory access instructions are instrumented to detect
12485 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12486 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12487 environment variable; see
12488 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12489 supported options.
12490 The option cannot be combined with @option{-fsanitize=address},
12491 @option{-fsanitize=leak}.
12492
12493 Note that sanitized atomic builtins cannot throw exceptions when
12494 operating on invalid memory addresses with non-call exceptions
12495 (@option{-fnon-call-exceptions}).
12496
12497 @item -fsanitize=leak
12498 @opindex fsanitize=leak
12499 Enable LeakSanitizer, a memory leak detector.
12500 This option only matters for linking of executables and
12501 the executable is linked against a library that overrides @code{malloc}
12502 and other allocator functions. See
12503 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12504 details. The run-time behavior can be influenced using the
12505 @env{LSAN_OPTIONS} environment variable.
12506 The option cannot be combined with @option{-fsanitize=thread}.
12507
12508 @item -fsanitize=undefined
12509 @opindex fsanitize=undefined
12510 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12511 Various computations are instrumented to detect undefined behavior
12512 at runtime. Current suboptions are:
12513
12514 @table @gcctabopt
12515
12516 @item -fsanitize=shift
12517 @opindex fsanitize=shift
12518 This option enables checking that the result of a shift operation is
12519 not undefined. Note that what exactly is considered undefined differs
12520 slightly between C and C++, as well as between ISO C90 and C99, etc.
12521 This option has two suboptions, @option{-fsanitize=shift-base} and
12522 @option{-fsanitize=shift-exponent}.
12523
12524 @item -fsanitize=shift-exponent
12525 @opindex fsanitize=shift-exponent
12526 This option enables checking that the second argument of a shift operation
12527 is not negative and is smaller than the precision of the promoted first
12528 argument.
12529
12530 @item -fsanitize=shift-base
12531 @opindex fsanitize=shift-base
12532 If the second argument of a shift operation is within range, check that the
12533 result of a shift operation is not undefined. Note that what exactly is
12534 considered undefined differs slightly between C and C++, as well as between
12535 ISO C90 and C99, etc.
12536
12537 @item -fsanitize=integer-divide-by-zero
12538 @opindex fsanitize=integer-divide-by-zero
12539 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12540
12541 @item -fsanitize=unreachable
12542 @opindex fsanitize=unreachable
12543 With this option, the compiler turns the @code{__builtin_unreachable}
12544 call into a diagnostics message call instead. When reaching the
12545 @code{__builtin_unreachable} call, the behavior is undefined.
12546
12547 @item -fsanitize=vla-bound
12548 @opindex fsanitize=vla-bound
12549 This option instructs the compiler to check that the size of a variable
12550 length array is positive.
12551
12552 @item -fsanitize=null
12553 @opindex fsanitize=null
12554 This option enables pointer checking. Particularly, the application
12555 built with this option turned on will issue an error message when it
12556 tries to dereference a NULL pointer, or if a reference (possibly an
12557 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12558 on an object pointed by a NULL pointer.
12559
12560 @item -fsanitize=return
12561 @opindex fsanitize=return
12562 This option enables return statement checking. Programs
12563 built with this option turned on will issue an error message
12564 when the end of a non-void function is reached without actually
12565 returning a value. This option works in C++ only.
12566
12567 @item -fsanitize=signed-integer-overflow
12568 @opindex fsanitize=signed-integer-overflow
12569 This option enables signed integer overflow checking. We check that
12570 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12571 does not overflow in the signed arithmetics. Note, integer promotion
12572 rules must be taken into account. That is, the following is not an
12573 overflow:
12574 @smallexample
12575 signed char a = SCHAR_MAX;
12576 a++;
12577 @end smallexample
12578
12579 @item -fsanitize=bounds
12580 @opindex fsanitize=bounds
12581 This option enables instrumentation of array bounds. Various out of bounds
12582 accesses are detected. Flexible array members, flexible array member-like
12583 arrays, and initializers of variables with static storage are not instrumented.
12584
12585 @item -fsanitize=bounds-strict
12586 @opindex fsanitize=bounds-strict
12587 This option enables strict instrumentation of array bounds. Most out of bounds
12588 accesses are detected, including flexible array members and flexible array
12589 member-like arrays. Initializers of variables with static storage are not
12590 instrumented.
12591
12592 @item -fsanitize=alignment
12593 @opindex fsanitize=alignment
12594
12595 This option enables checking of alignment of pointers when they are
12596 dereferenced, or when a reference is bound to insufficiently aligned target,
12597 or when a method or constructor is invoked on insufficiently aligned object.
12598
12599 @item -fsanitize=object-size
12600 @opindex fsanitize=object-size
12601 This option enables instrumentation of memory references using the
12602 @code{__builtin_object_size} function. Various out of bounds pointer
12603 accesses are detected.
12604
12605 @item -fsanitize=float-divide-by-zero
12606 @opindex fsanitize=float-divide-by-zero
12607 Detect floating-point division by zero. Unlike other similar options,
12608 @option{-fsanitize=float-divide-by-zero} is not enabled by
12609 @option{-fsanitize=undefined}, since floating-point division by zero can
12610 be a legitimate way of obtaining infinities and NaNs.
12611
12612 @item -fsanitize=float-cast-overflow
12613 @opindex fsanitize=float-cast-overflow
12614 This option enables floating-point type to integer conversion checking.
12615 We check that the result of the conversion does not overflow.
12616 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12617 not enabled by @option{-fsanitize=undefined}.
12618 This option does not work well with @code{FE_INVALID} exceptions enabled.
12619
12620 @item -fsanitize=nonnull-attribute
12621 @opindex fsanitize=nonnull-attribute
12622
12623 This option enables instrumentation of calls, checking whether null values
12624 are not passed to arguments marked as requiring a non-null value by the
12625 @code{nonnull} function attribute.
12626
12627 @item -fsanitize=returns-nonnull-attribute
12628 @opindex fsanitize=returns-nonnull-attribute
12629
12630 This option enables instrumentation of return statements in functions
12631 marked with @code{returns_nonnull} function attribute, to detect returning
12632 of null values from such functions.
12633
12634 @item -fsanitize=bool
12635 @opindex fsanitize=bool
12636
12637 This option enables instrumentation of loads from bool. If a value other
12638 than 0/1 is loaded, a run-time error is issued.
12639
12640 @item -fsanitize=enum
12641 @opindex fsanitize=enum
12642
12643 This option enables instrumentation of loads from an enum type. If
12644 a value outside the range of values for the enum type is loaded,
12645 a run-time error is issued.
12646
12647 @item -fsanitize=vptr
12648 @opindex fsanitize=vptr
12649
12650 This option enables instrumentation of C++ member function calls, member
12651 accesses and some conversions between pointers to base and derived classes,
12652 to verify the referenced object has the correct dynamic type.
12653
12654 @item -fsanitize=pointer-overflow
12655 @opindex fsanitize=pointer-overflow
12656
12657 This option enables instrumentation of pointer arithmetics. If the pointer
12658 arithmetics overflows, a run-time error is issued.
12659
12660 @item -fsanitize=builtin
12661 @opindex fsanitize=builtin
12662
12663 This option enables instrumentation of arguments to selected builtin
12664 functions. If an invalid value is passed to such arguments, a run-time
12665 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12666 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12667 by this option.
12668
12669 @end table
12670
12671 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12672 @option{-fsanitize=undefined} gives a diagnostic message.
12673 This currently works only for the C family of languages.
12674
12675 @item -fno-sanitize=all
12676 @opindex fno-sanitize=all
12677
12678 This option disables all previously enabled sanitizers.
12679 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12680 together.
12681
12682 @item -fasan-shadow-offset=@var{number}
12683 @opindex fasan-shadow-offset
12684 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12685 It is useful for experimenting with different shadow memory layouts in
12686 Kernel AddressSanitizer.
12687
12688 @item -fsanitize-sections=@var{s1},@var{s2},...
12689 @opindex fsanitize-sections
12690 Sanitize global variables in selected user-defined sections. @var{si} may
12691 contain wildcards.
12692
12693 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12694 @opindex fsanitize-recover
12695 @opindex fno-sanitize-recover
12696 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12697 mentioned in comma-separated list of @var{opts}. Enabling this option
12698 for a sanitizer component causes it to attempt to continue
12699 running the program as if no error happened. This means multiple
12700 runtime errors can be reported in a single program run, and the exit
12701 code of the program may indicate success even when errors
12702 have been reported. The @option{-fno-sanitize-recover=} option
12703 can be used to alter
12704 this behavior: only the first detected error is reported
12705 and program then exits with a non-zero exit code.
12706
12707 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12708 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12709 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12710 @option{-fsanitize=bounds-strict},
12711 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12712 For these sanitizers error recovery is turned on by default,
12713 except @option{-fsanitize=address}, for which this feature is experimental.
12714 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12715 accepted, the former enables recovery for all sanitizers that support it,
12716 the latter disables recovery for all sanitizers that support it.
12717
12718 Even if a recovery mode is turned on the compiler side, it needs to be also
12719 enabled on the runtime library side, otherwise the failures are still fatal.
12720 The runtime library defaults to @code{halt_on_error=0} for
12721 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12722 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12723 setting the @code{halt_on_error} flag in the corresponding environment variable.
12724
12725 Syntax without an explicit @var{opts} parameter is deprecated. It is
12726 equivalent to specifying an @var{opts} list of:
12727
12728 @smallexample
12729 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12730 @end smallexample
12731
12732 @item -fsanitize-address-use-after-scope
12733 @opindex fsanitize-address-use-after-scope
12734 Enable sanitization of local variables to detect use-after-scope bugs.
12735 The option sets @option{-fstack-reuse} to @samp{none}.
12736
12737 @item -fsanitize-undefined-trap-on-error
12738 @opindex fsanitize-undefined-trap-on-error
12739 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12740 report undefined behavior using @code{__builtin_trap} rather than
12741 a @code{libubsan} library routine. The advantage of this is that the
12742 @code{libubsan} library is not needed and is not linked in, so this
12743 is usable even in freestanding environments.
12744
12745 @item -fsanitize-coverage=trace-pc
12746 @opindex fsanitize-coverage=trace-pc
12747 Enable coverage-guided fuzzing code instrumentation.
12748 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12749
12750 @item -fsanitize-coverage=trace-cmp
12751 @opindex fsanitize-coverage=trace-cmp
12752 Enable dataflow guided fuzzing code instrumentation.
12753 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12754 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12755 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12756 variable or @code{__sanitizer_cov_trace_const_cmp1},
12757 @code{__sanitizer_cov_trace_const_cmp2},
12758 @code{__sanitizer_cov_trace_const_cmp4} or
12759 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12760 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12761 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12762 @code{__sanitizer_cov_trace_switch} for switch statements.
12763
12764 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12765 @opindex fcf-protection
12766 Enable code instrumentation of control-flow transfers to increase
12767 program security by checking that target addresses of control-flow
12768 transfer instructions (such as indirect function call, function return,
12769 indirect jump) are valid. This prevents diverting the flow of control
12770 to an unexpected target. This is intended to protect against such
12771 threats as Return-oriented Programming (ROP), and similarly
12772 call/jmp-oriented programming (COP/JOP).
12773
12774 The value @code{branch} tells the compiler to implement checking of
12775 validity of control-flow transfer at the point of indirect branch
12776 instructions, i.e.@: call/jmp instructions. The value @code{return}
12777 implements checking of validity at the point of returning from a
12778 function. The value @code{full} is an alias for specifying both
12779 @code{branch} and @code{return}. The value @code{none} turns off
12780 instrumentation.
12781
12782 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12783 used. The first bit of @code{__CET__} is set to 1 for the value
12784 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12785 the @code{return}.
12786
12787 You can also use the @code{nocf_check} attribute to identify
12788 which functions and calls should be skipped from instrumentation
12789 (@pxref{Function Attributes}).
12790
12791 Currently the x86 GNU/Linux target provides an implementation based
12792 on Intel Control-flow Enforcement Technology (CET).
12793
12794 @item -fstack-protector
12795 @opindex fstack-protector
12796 Emit extra code to check for buffer overflows, such as stack smashing
12797 attacks. This is done by adding a guard variable to functions with
12798 vulnerable objects. This includes functions that call @code{alloca}, and
12799 functions with buffers larger than 8 bytes. The guards are initialized
12800 when a function is entered and then checked when the function exits.
12801 If a guard check fails, an error message is printed and the program exits.
12802
12803 @item -fstack-protector-all
12804 @opindex fstack-protector-all
12805 Like @option{-fstack-protector} except that all functions are protected.
12806
12807 @item -fstack-protector-strong
12808 @opindex fstack-protector-strong
12809 Like @option{-fstack-protector} but includes additional functions to
12810 be protected --- those that have local array definitions, or have
12811 references to local frame addresses.
12812
12813 @item -fstack-protector-explicit
12814 @opindex fstack-protector-explicit
12815 Like @option{-fstack-protector} but only protects those functions which
12816 have the @code{stack_protect} attribute.
12817
12818 @item -fstack-check
12819 @opindex fstack-check
12820 Generate code to verify that you do not go beyond the boundary of the
12821 stack. You should specify this flag if you are running in an
12822 environment with multiple threads, but you only rarely need to specify it in
12823 a single-threaded environment since stack overflow is automatically
12824 detected on nearly all systems if there is only one stack.
12825
12826 Note that this switch does not actually cause checking to be done; the
12827 operating system or the language runtime must do that. The switch causes
12828 generation of code to ensure that they see the stack being extended.
12829
12830 You can additionally specify a string parameter: @samp{no} means no
12831 checking, @samp{generic} means force the use of old-style checking,
12832 @samp{specific} means use the best checking method and is equivalent
12833 to bare @option{-fstack-check}.
12834
12835 Old-style checking is a generic mechanism that requires no specific
12836 target support in the compiler but comes with the following drawbacks:
12837
12838 @enumerate
12839 @item
12840 Modified allocation strategy for large objects: they are always
12841 allocated dynamically if their size exceeds a fixed threshold. Note this
12842 may change the semantics of some code.
12843
12844 @item
12845 Fixed limit on the size of the static frame of functions: when it is
12846 topped by a particular function, stack checking is not reliable and
12847 a warning is issued by the compiler.
12848
12849 @item
12850 Inefficiency: because of both the modified allocation strategy and the
12851 generic implementation, code performance is hampered.
12852 @end enumerate
12853
12854 Note that old-style stack checking is also the fallback method for
12855 @samp{specific} if no target support has been added in the compiler.
12856
12857 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12858 and stack overflows. @samp{specific} is an excellent choice when compiling
12859 Ada code. It is not generally sufficient to protect against stack-clash
12860 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12861
12862 @item -fstack-clash-protection
12863 @opindex fstack-clash-protection
12864 Generate code to prevent stack clash style attacks. When this option is
12865 enabled, the compiler will only allocate one page of stack space at a time
12866 and each page is accessed immediately after allocation. Thus, it prevents
12867 allocations from jumping over any stack guard page provided by the
12868 operating system.
12869
12870 Most targets do not fully support stack clash protection. However, on
12871 those targets @option{-fstack-clash-protection} will protect dynamic stack
12872 allocations. @option{-fstack-clash-protection} may also provide limited
12873 protection for static stack allocations if the target supports
12874 @option{-fstack-check=specific}.
12875
12876 @item -fstack-limit-register=@var{reg}
12877 @itemx -fstack-limit-symbol=@var{sym}
12878 @itemx -fno-stack-limit
12879 @opindex fstack-limit-register
12880 @opindex fstack-limit-symbol
12881 @opindex fno-stack-limit
12882 Generate code to ensure that the stack does not grow beyond a certain value,
12883 either the value of a register or the address of a symbol. If a larger
12884 stack is required, a signal is raised at run time. For most targets,
12885 the signal is raised before the stack overruns the boundary, so
12886 it is possible to catch the signal without taking special precautions.
12887
12888 For instance, if the stack starts at absolute address @samp{0x80000000}
12889 and grows downwards, you can use the flags
12890 @option{-fstack-limit-symbol=__stack_limit} and
12891 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12892 of 128KB@. Note that this may only work with the GNU linker.
12893
12894 You can locally override stack limit checking by using the
12895 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12896
12897 @item -fsplit-stack
12898 @opindex fsplit-stack
12899 Generate code to automatically split the stack before it overflows.
12900 The resulting program has a discontiguous stack which can only
12901 overflow if the program is unable to allocate any more memory. This
12902 is most useful when running threaded programs, as it is no longer
12903 necessary to calculate a good stack size to use for each thread. This
12904 is currently only implemented for the x86 targets running
12905 GNU/Linux.
12906
12907 When code compiled with @option{-fsplit-stack} calls code compiled
12908 without @option{-fsplit-stack}, there may not be much stack space
12909 available for the latter code to run. If compiling all code,
12910 including library code, with @option{-fsplit-stack} is not an option,
12911 then the linker can fix up these calls so that the code compiled
12912 without @option{-fsplit-stack} always has a large stack. Support for
12913 this is implemented in the gold linker in GNU binutils release 2.21
12914 and later.
12915
12916 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12917 @opindex fvtable-verify
12918 This option is only available when compiling C++ code.
12919 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12920 feature that verifies at run time, for every virtual call, that
12921 the vtable pointer through which the call is made is valid for the type of
12922 the object, and has not been corrupted or overwritten. If an invalid vtable
12923 pointer is detected at run time, an error is reported and execution of the
12924 program is immediately halted.
12925
12926 This option causes run-time data structures to be built at program startup,
12927 which are used for verifying the vtable pointers.
12928 The options @samp{std} and @samp{preinit}
12929 control the timing of when these data structures are built. In both cases the
12930 data structures are built before execution reaches @code{main}. Using
12931 @option{-fvtable-verify=std} causes the data structures to be built after
12932 shared libraries have been loaded and initialized.
12933 @option{-fvtable-verify=preinit} causes them to be built before shared
12934 libraries have been loaded and initialized.
12935
12936 If this option appears multiple times in the command line with different
12937 values specified, @samp{none} takes highest priority over both @samp{std} and
12938 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12939
12940 @item -fvtv-debug
12941 @opindex fvtv-debug
12942 When used in conjunction with @option{-fvtable-verify=std} or
12943 @option{-fvtable-verify=preinit}, causes debug versions of the
12944 runtime functions for the vtable verification feature to be called.
12945 This flag also causes the compiler to log information about which
12946 vtable pointers it finds for each class.
12947 This information is written to a file named @file{vtv_set_ptr_data.log}
12948 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12949 if that is defined or the current working directory otherwise.
12950
12951 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12952 file, be sure to delete any existing one.
12953
12954 @item -fvtv-counts
12955 @opindex fvtv-counts
12956 This is a debugging flag. When used in conjunction with
12957 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12958 causes the compiler to keep track of the total number of virtual calls
12959 it encounters and the number of verifications it inserts. It also
12960 counts the number of calls to certain run-time library functions
12961 that it inserts and logs this information for each compilation unit.
12962 The compiler writes this information to a file named
12963 @file{vtv_count_data.log} in the directory named by the environment
12964 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12965 directory otherwise. It also counts the size of the vtable pointer sets
12966 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12967 in the same directory.
12968
12969 Note: This feature @emph{appends} data to the log files. To get fresh log
12970 files, be sure to delete any existing ones.
12971
12972 @item -finstrument-functions
12973 @opindex finstrument-functions
12974 Generate instrumentation calls for entry and exit to functions. Just
12975 after function entry and just before function exit, the following
12976 profiling functions are called with the address of the current
12977 function and its call site. (On some platforms,
12978 @code{__builtin_return_address} does not work beyond the current
12979 function, so the call site information may not be available to the
12980 profiling functions otherwise.)
12981
12982 @smallexample
12983 void __cyg_profile_func_enter (void *this_fn,
12984 void *call_site);
12985 void __cyg_profile_func_exit (void *this_fn,
12986 void *call_site);
12987 @end smallexample
12988
12989 The first argument is the address of the start of the current function,
12990 which may be looked up exactly in the symbol table.
12991
12992 This instrumentation is also done for functions expanded inline in other
12993 functions. The profiling calls indicate where, conceptually, the
12994 inline function is entered and exited. This means that addressable
12995 versions of such functions must be available. If all your uses of a
12996 function are expanded inline, this may mean an additional expansion of
12997 code size. If you use @code{extern inline} in your C code, an
12998 addressable version of such functions must be provided. (This is
12999 normally the case anyway, but if you get lucky and the optimizer always
13000 expands the functions inline, you might have gotten away without
13001 providing static copies.)
13002
13003 A function may be given the attribute @code{no_instrument_function}, in
13004 which case this instrumentation is not done. This can be used, for
13005 example, for the profiling functions listed above, high-priority
13006 interrupt routines, and any functions from which the profiling functions
13007 cannot safely be called (perhaps signal handlers, if the profiling
13008 routines generate output or allocate memory).
13009 @xref{Common Function Attributes}.
13010
13011 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13012 @opindex finstrument-functions-exclude-file-list
13013
13014 Set the list of functions that are excluded from instrumentation (see
13015 the description of @option{-finstrument-functions}). If the file that
13016 contains a function definition matches with one of @var{file}, then
13017 that function is not instrumented. The match is done on substrings:
13018 if the @var{file} parameter is a substring of the file name, it is
13019 considered to be a match.
13020
13021 For example:
13022
13023 @smallexample
13024 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13025 @end smallexample
13026
13027 @noindent
13028 excludes any inline function defined in files whose pathnames
13029 contain @file{/bits/stl} or @file{include/sys}.
13030
13031 If, for some reason, you want to include letter @samp{,} in one of
13032 @var{sym}, write @samp{\,}. For example,
13033 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13034 (note the single quote surrounding the option).
13035
13036 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13037 @opindex finstrument-functions-exclude-function-list
13038
13039 This is similar to @option{-finstrument-functions-exclude-file-list},
13040 but this option sets the list of function names to be excluded from
13041 instrumentation. The function name to be matched is its user-visible
13042 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13043 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13044 match is done on substrings: if the @var{sym} parameter is a substring
13045 of the function name, it is considered to be a match. For C99 and C++
13046 extended identifiers, the function name must be given in UTF-8, not
13047 using universal character names.
13048
13049 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13050 @opindex fpatchable-function-entry
13051 Generate @var{N} NOPs right at the beginning
13052 of each function, with the function entry point before the @var{M}th NOP.
13053 If @var{M} is omitted, it defaults to @code{0} so the
13054 function entry points to the address just at the first NOP.
13055 The NOP instructions reserve extra space which can be used to patch in
13056 any desired instrumentation at run time, provided that the code segment
13057 is writable. The amount of space is controllable indirectly via
13058 the number of NOPs; the NOP instruction used corresponds to the instruction
13059 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13060 is target-specific and may also depend on the architecture variant and/or
13061 other compilation options.
13062
13063 For run-time identification, the starting addresses of these areas,
13064 which correspond to their respective function entries minus @var{M},
13065 are additionally collected in the @code{__patchable_function_entries}
13066 section of the resulting binary.
13067
13068 Note that the value of @code{__attribute__ ((patchable_function_entry
13069 (N,M)))} takes precedence over command-line option
13070 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13071 the area size or to remove it completely on a single function.
13072 If @code{N=0}, no pad location is recorded.
13073
13074 The NOP instructions are inserted at---and maybe before, depending on
13075 @var{M}---the function entry address, even before the prologue.
13076
13077 @end table
13078
13079
13080 @node Preprocessor Options
13081 @section Options Controlling the Preprocessor
13082 @cindex preprocessor options
13083 @cindex options, preprocessor
13084
13085 These options control the C preprocessor, which is run on each C source
13086 file before actual compilation.
13087
13088 If you use the @option{-E} option, nothing is done except preprocessing.
13089 Some of these options make sense only together with @option{-E} because
13090 they cause the preprocessor output to be unsuitable for actual
13091 compilation.
13092
13093 In addition to the options listed here, there are a number of options
13094 to control search paths for include files documented in
13095 @ref{Directory Options}.
13096 Options to control preprocessor diagnostics are listed in
13097 @ref{Warning Options}.
13098
13099 @table @gcctabopt
13100 @include cppopts.texi
13101
13102 @item -Wp,@var{option}
13103 @opindex Wp
13104 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13105 and pass @var{option} directly through to the preprocessor. If
13106 @var{option} contains commas, it is split into multiple options at the
13107 commas. However, many options are modified, translated or interpreted
13108 by the compiler driver before being passed to the preprocessor, and
13109 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13110 interface is undocumented and subject to change, so whenever possible
13111 you should avoid using @option{-Wp} and let the driver handle the
13112 options instead.
13113
13114 @item -Xpreprocessor @var{option}
13115 @opindex Xpreprocessor
13116 Pass @var{option} as an option to the preprocessor. You can use this to
13117 supply system-specific preprocessor options that GCC does not
13118 recognize.
13119
13120 If you want to pass an option that takes an argument, you must use
13121 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13122
13123 @item -no-integrated-cpp
13124 @opindex no-integrated-cpp
13125 Perform preprocessing as a separate pass before compilation.
13126 By default, GCC performs preprocessing as an integrated part of
13127 input tokenization and parsing.
13128 If this option is provided, the appropriate language front end
13129 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13130 and Objective-C, respectively) is instead invoked twice,
13131 once for preprocessing only and once for actual compilation
13132 of the preprocessed input.
13133 This option may be useful in conjunction with the @option{-B} or
13134 @option{-wrapper} options to specify an alternate preprocessor or
13135 perform additional processing of the program source between
13136 normal preprocessing and compilation.
13137
13138 @end table
13139
13140 @node Assembler Options
13141 @section Passing Options to the Assembler
13142
13143 @c prevent bad page break with this line
13144 You can pass options to the assembler.
13145
13146 @table @gcctabopt
13147 @item -Wa,@var{option}
13148 @opindex Wa
13149 Pass @var{option} as an option to the assembler. If @var{option}
13150 contains commas, it is split into multiple options at the commas.
13151
13152 @item -Xassembler @var{option}
13153 @opindex Xassembler
13154 Pass @var{option} as an option to the assembler. You can use this to
13155 supply system-specific assembler options that GCC does not
13156 recognize.
13157
13158 If you want to pass an option that takes an argument, you must use
13159 @option{-Xassembler} twice, once for the option and once for the argument.
13160
13161 @end table
13162
13163 @node Link Options
13164 @section Options for Linking
13165 @cindex link options
13166 @cindex options, linking
13167
13168 These options come into play when the compiler links object files into
13169 an executable output file. They are meaningless if the compiler is
13170 not doing a link step.
13171
13172 @table @gcctabopt
13173 @cindex file names
13174 @item @var{object-file-name}
13175 A file name that does not end in a special recognized suffix is
13176 considered to name an object file or library. (Object files are
13177 distinguished from libraries by the linker according to the file
13178 contents.) If linking is done, these object files are used as input
13179 to the linker.
13180
13181 @item -c
13182 @itemx -S
13183 @itemx -E
13184 @opindex c
13185 @opindex S
13186 @opindex E
13187 If any of these options is used, then the linker is not run, and
13188 object file names should not be used as arguments. @xref{Overall
13189 Options}.
13190
13191 @item -flinker-output=@var{type}
13192 @opindex flinker-output
13193 This option controls code generation of the link time optimizer. By
13194 default the linker output is automatically determined by the linker
13195 plugin. For debugging the compiler and if incremental linking with a
13196 non-LTO object file is desired, it may be useful to control the type
13197 manually.
13198
13199 If @var{type} is @samp{exec} code generation produces a static
13200 binary. In this case @option{-fpic} and @option{-fpie} are both
13201 disabled.
13202
13203 If @var{type} is @samp{dyn} code generation produces a shared
13204 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13205 but not enabled automatically. This allows to build shared libraries
13206 without position independent code on architectures where this is
13207 possible, i.e.@: on x86.
13208
13209 If @var{type} is @samp{pie} code generation produces an @option{-fpie}
13210 executable. This results in similar optimizations as @samp{exec}
13211 except that @option{-fpie} is not disabled if specified at compilation
13212 time.
13213
13214 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13215 done. The sections containing intermediate code for link-time optimization are
13216 merged, pre-optimized, and output to the resulting object file. In addition, if
13217 @option{-ffat-lto-objects} is specified the binary code is produced for future
13218 non-LTO linking. The object file produced by incremental linking will be smaller
13219 than a static library produced from the same object files. At link time the
13220 result of incremental linking will also load faster to compiler than a static
13221 library assuming that the majority of objects in the library are used.
13222
13223 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13224 code generation is forced, a final binary is produced and the intermediate
13225 code for later link-time optimization is stripped. When multiple object files
13226 are linked together the resulting code will be optimized better than with
13227 link-time optimizations disabled (for example, cross-module inlining will
13228 happen), most of benefits of whole program optimizations are however lost.
13229
13230 During the incremental link (by @option{-r}) the linker plugin will default to
13231 @option{rel}. With current interfaces to GNU Binutils it is however not
13232 possible to incrementally link LTO objects and non-LTO objects into a single
13233 mixed object file. In the case any of object files in incremental link cannot
13234 be used for link-time optimization the linker plugin will issue a warning and
13235 use @samp{nolto-rel}. To maintain the whole program optimization it is
13236 recommended to link such objects into static library instead. Alternatively it
13237 is possible to use H.J. Lu's binutils with support for mixed objects.
13238
13239 @item -fuse-ld=bfd
13240 @opindex fuse-ld=bfd
13241 Use the @command{bfd} linker instead of the default linker.
13242
13243 @item -fuse-ld=gold
13244 @opindex fuse-ld=gold
13245 Use the @command{gold} linker instead of the default linker.
13246
13247 @item -fuse-ld=lld
13248 @opindex fuse-ld=lld
13249 Use the LLVM @command{lld} linker instead of the default linker.
13250
13251 @cindex Libraries
13252 @item -l@var{library}
13253 @itemx -l @var{library}
13254 @opindex l
13255 Search the library named @var{library} when linking. (The second
13256 alternative with the library as a separate argument is only for
13257 POSIX compliance and is not recommended.)
13258
13259 The @option{-l} option is passed directly to the linker by GCC. Refer
13260 to your linker documentation for exact details. The general
13261 description below applies to the GNU linker.
13262
13263 The linker searches a standard list of directories for the library.
13264 The directories searched include several standard system directories
13265 plus any that you specify with @option{-L}.
13266
13267 Static libraries are archives of object files, and have file names
13268 like @file{lib@var{library}.a}. Some targets also support shared
13269 libraries, which typically have names like @file{lib@var{library}.so}.
13270 If both static and shared libraries are found, the linker gives
13271 preference to linking with the shared library unless the
13272 @option{-static} option is used.
13273
13274 It makes a difference where in the command you write this option; the
13275 linker searches and processes libraries and object files in the order they
13276 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13277 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13278 to functions in @samp{z}, those functions may not be loaded.
13279
13280 @item -lobjc
13281 @opindex lobjc
13282 You need this special case of the @option{-l} option in order to
13283 link an Objective-C or Objective-C++ program.
13284
13285 @item -nostartfiles
13286 @opindex nostartfiles
13287 Do not use the standard system startup files when linking.
13288 The standard system libraries are used normally, unless @option{-nostdlib},
13289 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13290
13291 @item -nodefaultlibs
13292 @opindex nodefaultlibs
13293 Do not use the standard system libraries when linking.
13294 Only the libraries you specify are passed to the linker, and options
13295 specifying linkage of the system libraries, such as @option{-static-libgcc}
13296 or @option{-shared-libgcc}, are ignored.
13297 The standard startup files are used normally, unless @option{-nostartfiles}
13298 is used.
13299
13300 The compiler may generate calls to @code{memcmp},
13301 @code{memset}, @code{memcpy} and @code{memmove}.
13302 These entries are usually resolved by entries in
13303 libc. These entry points should be supplied through some other
13304 mechanism when this option is specified.
13305
13306 @item -nolibc
13307 @opindex nolibc
13308 Do not use the C library or system libraries tightly coupled with it when
13309 linking. Still link with the startup files, @file{libgcc} or toolchain
13310 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13311 or @file{libstdc++} unless options preventing their inclusion are used as
13312 well. This typically removes @option{-lc} from the link command line, as well
13313 as system libraries that normally go with it and become meaningless when
13314 absence of a C library is assumed, for example @option{-lpthread} or
13315 @option{-lm} in some configurations. This is intended for bare-board
13316 targets when there is indeed no C library available.
13317
13318 @item -nostdlib
13319 @opindex nostdlib
13320 Do not use the standard system startup files or libraries when linking.
13321 No startup files and only the libraries you specify are passed to
13322 the linker, and options specifying linkage of the system libraries, such as
13323 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13324
13325 The compiler may generate calls to @code{memcmp}, @code{memset},
13326 @code{memcpy} and @code{memmove}.
13327 These entries are usually resolved by entries in
13328 libc. These entry points should be supplied through some other
13329 mechanism when this option is specified.
13330
13331 @cindex @option{-lgcc}, use with @option{-nostdlib}
13332 @cindex @option{-nostdlib} and unresolved references
13333 @cindex unresolved references and @option{-nostdlib}
13334 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13335 @cindex @option{-nodefaultlibs} and unresolved references
13336 @cindex unresolved references and @option{-nodefaultlibs}
13337 One of the standard libraries bypassed by @option{-nostdlib} and
13338 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13339 which GCC uses to overcome shortcomings of particular machines, or special
13340 needs for some languages.
13341 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13342 Collection (GCC) Internals},
13343 for more discussion of @file{libgcc.a}.)
13344 In most cases, you need @file{libgcc.a} even when you want to avoid
13345 other standard libraries. In other words, when you specify @option{-nostdlib}
13346 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13347 This ensures that you have no unresolved references to internal GCC
13348 library subroutines.
13349 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13350 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13351 GNU Compiler Collection (GCC) Internals}.)
13352
13353 @item -e @var{entry}
13354 @itemx --entry=@var{entry}
13355 @opindex e
13356 @opindex entry
13357
13358 Specify that the program entry point is @var{entry}. The argument is
13359 interpreted by the linker; the GNU linker accepts either a symbol name
13360 or an address.
13361
13362 @item -pie
13363 @opindex pie
13364 Produce a dynamically linked position independent executable on targets
13365 that support it. For predictable results, you must also specify the same
13366 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13367 or model suboptions) when you specify this linker option.
13368
13369 @item -no-pie
13370 @opindex no-pie
13371 Don't produce a dynamically linked position independent executable.
13372
13373 @item -static-pie
13374 @opindex static-pie
13375 Produce a static position independent executable on targets that support
13376 it. A static position independent executable is similar to a static
13377 executable, but can be loaded at any address without a dynamic linker.
13378 For predictable results, you must also specify the same set of options
13379 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13380 suboptions) when you specify this linker option.
13381
13382 @item -pthread
13383 @opindex pthread
13384 Link with the POSIX threads library. This option is supported on
13385 GNU/Linux targets, most other Unix derivatives, and also on
13386 x86 Cygwin and MinGW targets. On some targets this option also sets
13387 flags for the preprocessor, so it should be used consistently for both
13388 compilation and linking.
13389
13390 @item -r
13391 @opindex r
13392 Produce a relocatable object as output. This is also known as partial
13393 linking.
13394
13395 @item -rdynamic
13396 @opindex rdynamic
13397 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13398 that support it. This instructs the linker to add all symbols, not
13399 only used ones, to the dynamic symbol table. This option is needed
13400 for some uses of @code{dlopen} or to allow obtaining backtraces
13401 from within a program.
13402
13403 @item -s
13404 @opindex s
13405 Remove all symbol table and relocation information from the executable.
13406
13407 @item -static
13408 @opindex static
13409 On systems that support dynamic linking, this overrides @option{-pie}
13410 and prevents linking with the shared libraries. On other systems, this
13411 option has no effect.
13412
13413 @item -shared
13414 @opindex shared
13415 Produce a shared object which can then be linked with other objects to
13416 form an executable. Not all systems support this option. For predictable
13417 results, you must also specify the same set of options used for compilation
13418 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13419 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13420 needs to build supplementary stub code for constructors to work. On
13421 multi-libbed systems, @samp{gcc -shared} must select the correct support
13422 libraries to link against. Failing to supply the correct flags may lead
13423 to subtle defects. Supplying them in cases where they are not necessary
13424 is innocuous.}
13425
13426 @item -shared-libgcc
13427 @itemx -static-libgcc
13428 @opindex shared-libgcc
13429 @opindex static-libgcc
13430 On systems that provide @file{libgcc} as a shared library, these options
13431 force the use of either the shared or static version, respectively.
13432 If no shared version of @file{libgcc} was built when the compiler was
13433 configured, these options have no effect.
13434
13435 There are several situations in which an application should use the
13436 shared @file{libgcc} instead of the static version. The most common
13437 of these is when the application wishes to throw and catch exceptions
13438 across different shared libraries. In that case, each of the libraries
13439 as well as the application itself should use the shared @file{libgcc}.
13440
13441 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13442 whenever you build a shared library or a main executable, because C++
13443 programs typically use exceptions, so this is the right thing to do.
13444
13445 If, instead, you use the GCC driver to create shared libraries, you may
13446 find that they are not always linked with the shared @file{libgcc}.
13447 If GCC finds, at its configuration time, that you have a non-GNU linker
13448 or a GNU linker that does not support option @option{--eh-frame-hdr},
13449 it links the shared version of @file{libgcc} into shared libraries
13450 by default. Otherwise, it takes advantage of the linker and optimizes
13451 away the linking with the shared version of @file{libgcc}, linking with
13452 the static version of libgcc by default. This allows exceptions to
13453 propagate through such shared libraries, without incurring relocation
13454 costs at library load time.
13455
13456 However, if a library or main executable is supposed to throw or catch
13457 exceptions, you must link it using the G++ driver, or using the option
13458 @option{-shared-libgcc}, such that it is linked with the shared
13459 @file{libgcc}.
13460
13461 @item -static-libasan
13462 @opindex static-libasan
13463 When the @option{-fsanitize=address} option is used to link a program,
13464 the GCC driver automatically links against @option{libasan}. If
13465 @file{libasan} is available as a shared library, and the @option{-static}
13466 option is not used, then this links against the shared version of
13467 @file{libasan}. The @option{-static-libasan} option directs the GCC
13468 driver to link @file{libasan} statically, without necessarily linking
13469 other libraries statically.
13470
13471 @item -static-libtsan
13472 @opindex static-libtsan
13473 When the @option{-fsanitize=thread} option is used to link a program,
13474 the GCC driver automatically links against @option{libtsan}. If
13475 @file{libtsan} is available as a shared library, and the @option{-static}
13476 option is not used, then this links against the shared version of
13477 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13478 driver to link @file{libtsan} statically, without necessarily linking
13479 other libraries statically.
13480
13481 @item -static-liblsan
13482 @opindex static-liblsan
13483 When the @option{-fsanitize=leak} option is used to link a program,
13484 the GCC driver automatically links against @option{liblsan}. If
13485 @file{liblsan} is available as a shared library, and the @option{-static}
13486 option is not used, then this links against the shared version of
13487 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13488 driver to link @file{liblsan} statically, without necessarily linking
13489 other libraries statically.
13490
13491 @item -static-libubsan
13492 @opindex static-libubsan
13493 When the @option{-fsanitize=undefined} option is used to link a program,
13494 the GCC driver automatically links against @option{libubsan}. If
13495 @file{libubsan} is available as a shared library, and the @option{-static}
13496 option is not used, then this links against the shared version of
13497 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13498 driver to link @file{libubsan} statically, without necessarily linking
13499 other libraries statically.
13500
13501 @item -static-libstdc++
13502 @opindex static-libstdc++
13503 When the @command{g++} program is used to link a C++ program, it
13504 normally automatically links against @option{libstdc++}. If
13505 @file{libstdc++} is available as a shared library, and the
13506 @option{-static} option is not used, then this links against the
13507 shared version of @file{libstdc++}. That is normally fine. However, it
13508 is sometimes useful to freeze the version of @file{libstdc++} used by
13509 the program without going all the way to a fully static link. The
13510 @option{-static-libstdc++} option directs the @command{g++} driver to
13511 link @file{libstdc++} statically, without necessarily linking other
13512 libraries statically.
13513
13514 @item -symbolic
13515 @opindex symbolic
13516 Bind references to global symbols when building a shared object. Warn
13517 about any unresolved references (unless overridden by the link editor
13518 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13519 this option.
13520
13521 @item -T @var{script}
13522 @opindex T
13523 @cindex linker script
13524 Use @var{script} as the linker script. This option is supported by most
13525 systems using the GNU linker. On some targets, such as bare-board
13526 targets without an operating system, the @option{-T} option may be required
13527 when linking to avoid references to undefined symbols.
13528
13529 @item -Xlinker @var{option}
13530 @opindex Xlinker
13531 Pass @var{option} as an option to the linker. You can use this to
13532 supply system-specific linker options that GCC does not recognize.
13533
13534 If you want to pass an option that takes a separate argument, you must use
13535 @option{-Xlinker} twice, once for the option and once for the argument.
13536 For example, to pass @option{-assert definitions}, you must write
13537 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13538 @option{-Xlinker "-assert definitions"}, because this passes the entire
13539 string as a single argument, which is not what the linker expects.
13540
13541 When using the GNU linker, it is usually more convenient to pass
13542 arguments to linker options using the @option{@var{option}=@var{value}}
13543 syntax than as separate arguments. For example, you can specify
13544 @option{-Xlinker -Map=output.map} rather than
13545 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13546 this syntax for command-line options.
13547
13548 @item -Wl,@var{option}
13549 @opindex Wl
13550 Pass @var{option} as an option to the linker. If @var{option} contains
13551 commas, it is split into multiple options at the commas. You can use this
13552 syntax to pass an argument to the option.
13553 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13554 linker. When using the GNU linker, you can also get the same effect with
13555 @option{-Wl,-Map=output.map}.
13556
13557 @item -u @var{symbol}
13558 @opindex u
13559 Pretend the symbol @var{symbol} is undefined, to force linking of
13560 library modules to define it. You can use @option{-u} multiple times with
13561 different symbols to force loading of additional library modules.
13562
13563 @item -z @var{keyword}
13564 @opindex z
13565 @option{-z} is passed directly on to the linker along with the keyword
13566 @var{keyword}. See the section in the documentation of your linker for
13567 permitted values and their meanings.
13568 @end table
13569
13570 @node Directory Options
13571 @section Options for Directory Search
13572 @cindex directory options
13573 @cindex options, directory search
13574 @cindex search path
13575
13576 These options specify directories to search for header files, for
13577 libraries and for parts of the compiler:
13578
13579 @table @gcctabopt
13580 @include cppdiropts.texi
13581
13582 @item -iplugindir=@var{dir}
13583 @opindex iplugindir=
13584 Set the directory to search for plugins that are passed
13585 by @option{-fplugin=@var{name}} instead of
13586 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13587 to be used by the user, but only passed by the driver.
13588
13589 @item -L@var{dir}
13590 @opindex L
13591 Add directory @var{dir} to the list of directories to be searched
13592 for @option{-l}.
13593
13594 @item -B@var{prefix}
13595 @opindex B
13596 This option specifies where to find the executables, libraries,
13597 include files, and data files of the compiler itself.
13598
13599 The compiler driver program runs one or more of the subprograms
13600 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13601 @var{prefix} as a prefix for each program it tries to run, both with and
13602 without @samp{@var{machine}/@var{version}/} for the corresponding target
13603 machine and compiler version.
13604
13605 For each subprogram to be run, the compiler driver first tries the
13606 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13607 is not specified, the driver tries two standard prefixes,
13608 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13609 those results in a file name that is found, the unmodified program
13610 name is searched for using the directories specified in your
13611 @env{PATH} environment variable.
13612
13613 The compiler checks to see if the path provided by @option{-B}
13614 refers to a directory, and if necessary it adds a directory
13615 separator character at the end of the path.
13616
13617 @option{-B} prefixes that effectively specify directory names also apply
13618 to libraries in the linker, because the compiler translates these
13619 options into @option{-L} options for the linker. They also apply to
13620 include files in the preprocessor, because the compiler translates these
13621 options into @option{-isystem} options for the preprocessor. In this case,
13622 the compiler appends @samp{include} to the prefix.
13623
13624 The runtime support file @file{libgcc.a} can also be searched for using
13625 the @option{-B} prefix, if needed. If it is not found there, the two
13626 standard prefixes above are tried, and that is all. The file is left
13627 out of the link if it is not found by those means.
13628
13629 Another way to specify a prefix much like the @option{-B} prefix is to use
13630 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13631 Variables}.
13632
13633 As a special kludge, if the path provided by @option{-B} is
13634 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13635 9, then it is replaced by @file{[dir/]include}. This is to help
13636 with boot-strapping the compiler.
13637
13638 @item -no-canonical-prefixes
13639 @opindex no-canonical-prefixes
13640 Do not expand any symbolic links, resolve references to @samp{/../}
13641 or @samp{/./}, or make the path absolute when generating a relative
13642 prefix.
13643
13644 @item --sysroot=@var{dir}
13645 @opindex sysroot
13646 Use @var{dir} as the logical root directory for headers and libraries.
13647 For example, if the compiler normally searches for headers in
13648 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13649 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13650
13651 If you use both this option and the @option{-isysroot} option, then
13652 the @option{--sysroot} option applies to libraries, but the
13653 @option{-isysroot} option applies to header files.
13654
13655 The GNU linker (beginning with version 2.16) has the necessary support
13656 for this option. If your linker does not support this option, the
13657 header file aspect of @option{--sysroot} still works, but the
13658 library aspect does not.
13659
13660 @item --no-sysroot-suffix
13661 @opindex no-sysroot-suffix
13662 For some targets, a suffix is added to the root directory specified
13663 with @option{--sysroot}, depending on the other options used, so that
13664 headers may for example be found in
13665 @file{@var{dir}/@var{suffix}/usr/include} instead of
13666 @file{@var{dir}/usr/include}. This option disables the addition of
13667 such a suffix.
13668
13669 @end table
13670
13671 @node Code Gen Options
13672 @section Options for Code Generation Conventions
13673 @cindex code generation conventions
13674 @cindex options, code generation
13675 @cindex run-time options
13676
13677 These machine-independent options control the interface conventions
13678 used in code generation.
13679
13680 Most of them have both positive and negative forms; the negative form
13681 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13682 one of the forms is listed---the one that is not the default. You
13683 can figure out the other form by either removing @samp{no-} or adding
13684 it.
13685
13686 @table @gcctabopt
13687 @item -fstack-reuse=@var{reuse-level}
13688 @opindex fstack_reuse
13689 This option controls stack space reuse for user declared local/auto variables
13690 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13691 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13692 local variables and temporaries, @samp{named_vars} enables the reuse only for
13693 user defined local variables with names, and @samp{none} disables stack reuse
13694 completely. The default value is @samp{all}. The option is needed when the
13695 program extends the lifetime of a scoped local variable or a compiler generated
13696 temporary beyond the end point defined by the language. When a lifetime of
13697 a variable ends, and if the variable lives in memory, the optimizing compiler
13698 has the freedom to reuse its stack space with other temporaries or scoped
13699 local variables whose live range does not overlap with it. Legacy code extending
13700 local lifetime is likely to break with the stack reuse optimization.
13701
13702 For example,
13703
13704 @smallexample
13705 int *p;
13706 @{
13707 int local1;
13708
13709 p = &local1;
13710 local1 = 10;
13711 ....
13712 @}
13713 @{
13714 int local2;
13715 local2 = 20;
13716 ...
13717 @}
13718
13719 if (*p == 10) // out of scope use of local1
13720 @{
13721
13722 @}
13723 @end smallexample
13724
13725 Another example:
13726 @smallexample
13727
13728 struct A
13729 @{
13730 A(int k) : i(k), j(k) @{ @}
13731 int i;
13732 int j;
13733 @};
13734
13735 A *ap;
13736
13737 void foo(const A& ar)
13738 @{
13739 ap = &ar;
13740 @}
13741
13742 void bar()
13743 @{
13744 foo(A(10)); // temp object's lifetime ends when foo returns
13745
13746 @{
13747 A a(20);
13748 ....
13749 @}
13750 ap->i+= 10; // ap references out of scope temp whose space
13751 // is reused with a. What is the value of ap->i?
13752 @}
13753
13754 @end smallexample
13755
13756 The lifetime of a compiler generated temporary is well defined by the C++
13757 standard. When a lifetime of a temporary ends, and if the temporary lives
13758 in memory, the optimizing compiler has the freedom to reuse its stack
13759 space with other temporaries or scoped local variables whose live range
13760 does not overlap with it. However some of the legacy code relies on
13761 the behavior of older compilers in which temporaries' stack space is
13762 not reused, the aggressive stack reuse can lead to runtime errors. This
13763 option is used to control the temporary stack reuse optimization.
13764
13765 @item -ftrapv
13766 @opindex ftrapv
13767 This option generates traps for signed overflow on addition, subtraction,
13768 multiplication operations.
13769 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13770 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13771 @option{-fwrapv} being effective. Note that only active options override, so
13772 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13773 results in @option{-ftrapv} being effective.
13774
13775 @item -fwrapv
13776 @opindex fwrapv
13777 This option instructs the compiler to assume that signed arithmetic
13778 overflow of addition, subtraction and multiplication wraps around
13779 using twos-complement representation. This flag enables some optimizations
13780 and disables others.
13781 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13782 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13783 @option{-fwrapv} being effective. Note that only active options override, so
13784 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13785 results in @option{-ftrapv} being effective.
13786
13787 @item -fwrapv-pointer
13788 @opindex fwrapv-pointer
13789 This option instructs the compiler to assume that pointer arithmetic
13790 overflow on addition and subtraction wraps around using twos-complement
13791 representation. This flag disables some optimizations which assume
13792 pointer overflow is invalid.
13793
13794 @item -fstrict-overflow
13795 @opindex fstrict-overflow
13796 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13797 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13798
13799 @item -fexceptions
13800 @opindex fexceptions
13801 Enable exception handling. Generates extra code needed to propagate
13802 exceptions. For some targets, this implies GCC generates frame
13803 unwind information for all functions, which can produce significant data
13804 size overhead, although it does not affect execution. If you do not
13805 specify this option, GCC enables it by default for languages like
13806 C++ that normally require exception handling, and disables it for
13807 languages like C that do not normally require it. However, you may need
13808 to enable this option when compiling C code that needs to interoperate
13809 properly with exception handlers written in C++. You may also wish to
13810 disable this option if you are compiling older C++ programs that don't
13811 use exception handling.
13812
13813 @item -fnon-call-exceptions
13814 @opindex fnon-call-exceptions
13815 Generate code that allows trapping instructions to throw exceptions.
13816 Note that this requires platform-specific runtime support that does
13817 not exist everywhere. Moreover, it only allows @emph{trapping}
13818 instructions to throw exceptions, i.e.@: memory references or floating-point
13819 instructions. It does not allow exceptions to be thrown from
13820 arbitrary signal handlers such as @code{SIGALRM}.
13821
13822 @item -fdelete-dead-exceptions
13823 @opindex fdelete-dead-exceptions
13824 Consider that instructions that may throw exceptions but don't otherwise
13825 contribute to the execution of the program can be optimized away.
13826 This option is enabled by default for the Ada front end, as permitted by
13827 the Ada language specification.
13828 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13829
13830 @item -funwind-tables
13831 @opindex funwind-tables
13832 Similar to @option{-fexceptions}, except that it just generates any needed
13833 static data, but does not affect the generated code in any other way.
13834 You normally do not need to enable this option; instead, a language processor
13835 that needs this handling enables it on your behalf.
13836
13837 @item -fasynchronous-unwind-tables
13838 @opindex fasynchronous-unwind-tables
13839 Generate unwind table in DWARF format, if supported by target machine. The
13840 table is exact at each instruction boundary, so it can be used for stack
13841 unwinding from asynchronous events (such as debugger or garbage collector).
13842
13843 @item -fno-gnu-unique
13844 @opindex fno-gnu-unique
13845 @opindex fgnu-unique
13846 On systems with recent GNU assembler and C library, the C++ compiler
13847 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13848 of template static data members and static local variables in inline
13849 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13850 is necessary to avoid problems with a library used by two different
13851 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13852 therefore disagreeing with the other one about the binding of the
13853 symbol. But this causes @code{dlclose} to be ignored for affected
13854 DSOs; if your program relies on reinitialization of a DSO via
13855 @code{dlclose} and @code{dlopen}, you can use
13856 @option{-fno-gnu-unique}.
13857
13858 @item -fpcc-struct-return
13859 @opindex fpcc-struct-return
13860 Return ``short'' @code{struct} and @code{union} values in memory like
13861 longer ones, rather than in registers. This convention is less
13862 efficient, but it has the advantage of allowing intercallability between
13863 GCC-compiled files and files compiled with other compilers, particularly
13864 the Portable C Compiler (pcc).
13865
13866 The precise convention for returning structures in memory depends
13867 on the target configuration macros.
13868
13869 Short structures and unions are those whose size and alignment match
13870 that of some integer type.
13871
13872 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13873 switch is not binary compatible with code compiled with the
13874 @option{-freg-struct-return} switch.
13875 Use it to conform to a non-default application binary interface.
13876
13877 @item -freg-struct-return
13878 @opindex freg-struct-return
13879 Return @code{struct} and @code{union} values in registers when possible.
13880 This is more efficient for small structures than
13881 @option{-fpcc-struct-return}.
13882
13883 If you specify neither @option{-fpcc-struct-return} nor
13884 @option{-freg-struct-return}, GCC defaults to whichever convention is
13885 standard for the target. If there is no standard convention, GCC
13886 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13887 the principal compiler. In those cases, we can choose the standard, and
13888 we chose the more efficient register return alternative.
13889
13890 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13891 switch is not binary compatible with code compiled with the
13892 @option{-fpcc-struct-return} switch.
13893 Use it to conform to a non-default application binary interface.
13894
13895 @item -fshort-enums
13896 @opindex fshort-enums
13897 Allocate to an @code{enum} type only as many bytes as it needs for the
13898 declared range of possible values. Specifically, the @code{enum} type
13899 is equivalent to the smallest integer type that has enough room.
13900
13901 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13902 code that is not binary compatible with code generated without that switch.
13903 Use it to conform to a non-default application binary interface.
13904
13905 @item -fshort-wchar
13906 @opindex fshort-wchar
13907 Override the underlying type for @code{wchar_t} to be @code{short
13908 unsigned int} instead of the default for the target. This option is
13909 useful for building programs to run under WINE@.
13910
13911 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13912 code that is not binary compatible with code generated without that switch.
13913 Use it to conform to a non-default application binary interface.
13914
13915 @item -fno-common
13916 @opindex fno-common
13917 @opindex fcommon
13918 @cindex tentative definitions
13919 In C code, this option controls the placement of global variables
13920 defined without an initializer, known as @dfn{tentative definitions}
13921 in the C standard. Tentative definitions are distinct from declarations
13922 of a variable with the @code{extern} keyword, which do not allocate storage.
13923
13924 Unix C compilers have traditionally allocated storage for
13925 uninitialized global variables in a common block. This allows the
13926 linker to resolve all tentative definitions of the same variable
13927 in different compilation units to the same object, or to a non-tentative
13928 definition.
13929 This is the behavior specified by @option{-fcommon}, and is the default for
13930 GCC on most targets.
13931 On the other hand, this behavior is not required by ISO
13932 C, and on some targets may carry a speed or code size penalty on
13933 variable references.
13934
13935 The @option{-fno-common} option specifies that the compiler should instead
13936 place uninitialized global variables in the BSS section of the object file.
13937 This inhibits the merging of tentative definitions by the linker so
13938 you get a multiple-definition error if the same
13939 variable is defined in more than one compilation unit.
13940 Compiling with @option{-fno-common} is useful on targets for which
13941 it provides better performance, or if you wish to verify that the
13942 program will work on other systems that always treat uninitialized
13943 variable definitions this way.
13944
13945 @item -fno-ident
13946 @opindex fno-ident
13947 @opindex fident
13948 Ignore the @code{#ident} directive.
13949
13950 @item -finhibit-size-directive
13951 @opindex finhibit-size-directive
13952 Don't output a @code{.size} assembler directive, or anything else that
13953 would cause trouble if the function is split in the middle, and the
13954 two halves are placed at locations far apart in memory. This option is
13955 used when compiling @file{crtstuff.c}; you should not need to use it
13956 for anything else.
13957
13958 @item -fverbose-asm
13959 @opindex fverbose-asm
13960 Put extra commentary information in the generated assembly code to
13961 make it more readable. This option is generally only of use to those
13962 who actually need to read the generated assembly code (perhaps while
13963 debugging the compiler itself).
13964
13965 @option{-fno-verbose-asm}, the default, causes the
13966 extra information to be omitted and is useful when comparing two assembler
13967 files.
13968
13969 The added comments include:
13970
13971 @itemize @bullet
13972
13973 @item
13974 information on the compiler version and command-line options,
13975
13976 @item
13977 the source code lines associated with the assembly instructions,
13978 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13979
13980 @item
13981 hints on which high-level expressions correspond to
13982 the various assembly instruction operands.
13983
13984 @end itemize
13985
13986 For example, given this C source file:
13987
13988 @smallexample
13989 int test (int n)
13990 @{
13991 int i;
13992 int total = 0;
13993
13994 for (i = 0; i < n; i++)
13995 total += i * i;
13996
13997 return total;
13998 @}
13999 @end smallexample
14000
14001 compiling to (x86_64) assembly via @option{-S} and emitting the result
14002 direct to stdout via @option{-o} @option{-}
14003
14004 @smallexample
14005 gcc -S test.c -fverbose-asm -Os -o -
14006 @end smallexample
14007
14008 gives output similar to this:
14009
14010 @smallexample
14011 .file "test.c"
14012 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14013 [...snip...]
14014 # options passed:
14015 [...snip...]
14016
14017 .text
14018 .globl test
14019 .type test, @@function
14020 test:
14021 .LFB0:
14022 .cfi_startproc
14023 # test.c:4: int total = 0;
14024 xorl %eax, %eax # <retval>
14025 # test.c:6: for (i = 0; i < n; i++)
14026 xorl %edx, %edx # i
14027 .L2:
14028 # test.c:6: for (i = 0; i < n; i++)
14029 cmpl %edi, %edx # n, i
14030 jge .L5 #,
14031 # test.c:7: total += i * i;
14032 movl %edx, %ecx # i, tmp92
14033 imull %edx, %ecx # i, tmp92
14034 # test.c:6: for (i = 0; i < n; i++)
14035 incl %edx # i
14036 # test.c:7: total += i * i;
14037 addl %ecx, %eax # tmp92, <retval>
14038 jmp .L2 #
14039 .L5:
14040 # test.c:10: @}
14041 ret
14042 .cfi_endproc
14043 .LFE0:
14044 .size test, .-test
14045 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14046 .section .note.GNU-stack,"",@@progbits
14047 @end smallexample
14048
14049 The comments are intended for humans rather than machines and hence the
14050 precise format of the comments is subject to change.
14051
14052 @item -frecord-gcc-switches
14053 @opindex frecord-gcc-switches
14054 This switch causes the command line used to invoke the
14055 compiler to be recorded into the object file that is being created.
14056 This switch is only implemented on some targets and the exact format
14057 of the recording is target and binary file format dependent, but it
14058 usually takes the form of a section containing ASCII text. This
14059 switch is related to the @option{-fverbose-asm} switch, but that
14060 switch only records information in the assembler output file as
14061 comments, so it never reaches the object file.
14062 See also @option{-grecord-gcc-switches} for another
14063 way of storing compiler options into the object file.
14064
14065 @item -fpic
14066 @opindex fpic
14067 @cindex global offset table
14068 @cindex PIC
14069 Generate position-independent code (PIC) suitable for use in a shared
14070 library, if supported for the target machine. Such code accesses all
14071 constant addresses through a global offset table (GOT)@. The dynamic
14072 loader resolves the GOT entries when the program starts (the dynamic
14073 loader is not part of GCC; it is part of the operating system). If
14074 the GOT size for the linked executable exceeds a machine-specific
14075 maximum size, you get an error message from the linker indicating that
14076 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14077 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14078 on the m68k and RS/6000. The x86 has no such limit.)
14079
14080 Position-independent code requires special support, and therefore works
14081 only on certain machines. For the x86, GCC supports PIC for System V
14082 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14083 position-independent.
14084
14085 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14086 are defined to 1.
14087
14088 @item -fPIC
14089 @opindex fPIC
14090 If supported for the target machine, emit position-independent code,
14091 suitable for dynamic linking and avoiding any limit on the size of the
14092 global offset table. This option makes a difference on AArch64, m68k,
14093 PowerPC and SPARC@.
14094
14095 Position-independent code requires special support, and therefore works
14096 only on certain machines.
14097
14098 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14099 are defined to 2.
14100
14101 @item -fpie
14102 @itemx -fPIE
14103 @opindex fpie
14104 @opindex fPIE
14105 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14106 generated position-independent code can be only linked into executables.
14107 Usually these options are used to compile code that will be linked using
14108 the @option{-pie} GCC option.
14109
14110 @option{-fpie} and @option{-fPIE} both define the macros
14111 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14112 for @option{-fpie} and 2 for @option{-fPIE}.
14113
14114 @item -fno-plt
14115 @opindex fno-plt
14116 @opindex fplt
14117 Do not use the PLT for external function calls in position-independent code.
14118 Instead, load the callee address at call sites from the GOT and branch to it.
14119 This leads to more efficient code by eliminating PLT stubs and exposing
14120 GOT loads to optimizations. On architectures such as 32-bit x86 where
14121 PLT stubs expect the GOT pointer in a specific register, this gives more
14122 register allocation freedom to the compiler.
14123 Lazy binding requires use of the PLT;
14124 with @option{-fno-plt} all external symbols are resolved at load time.
14125
14126 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14127 through the PLT for specific external functions.
14128
14129 In position-dependent code, a few targets also convert calls to
14130 functions that are marked to not use the PLT to use the GOT instead.
14131
14132 @item -fno-jump-tables
14133 @opindex fno-jump-tables
14134 @opindex fjump-tables
14135 Do not use jump tables for switch statements even where it would be
14136 more efficient than other code generation strategies. This option is
14137 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14138 building code that forms part of a dynamic linker and cannot
14139 reference the address of a jump table. On some targets, jump tables
14140 do not require a GOT and this option is not needed.
14141
14142 @item -ffixed-@var{reg}
14143 @opindex ffixed
14144 Treat the register named @var{reg} as a fixed register; generated code
14145 should never refer to it (except perhaps as a stack pointer, frame
14146 pointer or in some other fixed role).
14147
14148 @var{reg} must be the name of a register. The register names accepted
14149 are machine-specific and are defined in the @code{REGISTER_NAMES}
14150 macro in the machine description macro file.
14151
14152 This flag does not have a negative form, because it specifies a
14153 three-way choice.
14154
14155 @item -fcall-used-@var{reg}
14156 @opindex fcall-used
14157 Treat the register named @var{reg} as an allocable register that is
14158 clobbered by function calls. It may be allocated for temporaries or
14159 variables that do not live across a call. Functions compiled this way
14160 do not save and restore the register @var{reg}.
14161
14162 It is an error to use this flag with the frame pointer or stack pointer.
14163 Use of this flag for other registers that have fixed pervasive roles in
14164 the machine's execution model produces disastrous results.
14165
14166 This flag does not have a negative form, because it specifies a
14167 three-way choice.
14168
14169 @item -fcall-saved-@var{reg}
14170 @opindex fcall-saved
14171 Treat the register named @var{reg} as an allocable register saved by
14172 functions. It may be allocated even for temporaries or variables that
14173 live across a call. Functions compiled this way save and restore
14174 the register @var{reg} if they use it.
14175
14176 It is an error to use this flag with the frame pointer or stack pointer.
14177 Use of this flag for other registers that have fixed pervasive roles in
14178 the machine's execution model produces disastrous results.
14179
14180 A different sort of disaster results from the use of this flag for
14181 a register in which function values may be returned.
14182
14183 This flag does not have a negative form, because it specifies a
14184 three-way choice.
14185
14186 @item -fpack-struct[=@var{n}]
14187 @opindex fpack-struct
14188 Without a value specified, pack all structure members together without
14189 holes. When a value is specified (which must be a small power of two), pack
14190 structure members according to this value, representing the maximum
14191 alignment (that is, objects with default alignment requirements larger than
14192 this are output potentially unaligned at the next fitting location.
14193
14194 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14195 code that is not binary compatible with code generated without that switch.
14196 Additionally, it makes the code suboptimal.
14197 Use it to conform to a non-default application binary interface.
14198
14199 @item -fleading-underscore
14200 @opindex fleading-underscore
14201 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14202 change the way C symbols are represented in the object file. One use
14203 is to help link with legacy assembly code.
14204
14205 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14206 generate code that is not binary compatible with code generated without that
14207 switch. Use it to conform to a non-default application binary interface.
14208 Not all targets provide complete support for this switch.
14209
14210 @item -ftls-model=@var{model}
14211 @opindex ftls-model
14212 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14213 The @var{model} argument should be one of @samp{global-dynamic},
14214 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14215 Note that the choice is subject to optimization: the compiler may use
14216 a more efficient model for symbols not visible outside of the translation
14217 unit, or if @option{-fpic} is not given on the command line.
14218
14219 The default without @option{-fpic} is @samp{initial-exec}; with
14220 @option{-fpic} the default is @samp{global-dynamic}.
14221
14222 @item -ftrampolines
14223 @opindex ftrampolines
14224 For targets that normally need trampolines for nested functions, always
14225 generate them instead of using descriptors. Otherwise, for targets that
14226 do not need them, like for example HP-PA or IA-64, do nothing.
14227
14228 A trampoline is a small piece of code that is created at run time on the
14229 stack when the address of a nested function is taken, and is used to call
14230 the nested function indirectly. Therefore, it requires the stack to be
14231 made executable in order for the program to work properly.
14232
14233 @option{-fno-trampolines} is enabled by default on a language by language
14234 basis to let the compiler avoid generating them, if it computes that this
14235 is safe, and replace them with descriptors. Descriptors are made up of data
14236 only, but the generated code must be prepared to deal with them. As of this
14237 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14238
14239 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14240 @option{-fno-trampolines} are not binary compatible if nested functions are
14241 present. This option must therefore be used on a program-wide basis and be
14242 manipulated with extreme care.
14243
14244 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14245 @opindex fvisibility
14246 Set the default ELF image symbol visibility to the specified option---all
14247 symbols are marked with this unless overridden within the code.
14248 Using this feature can very substantially improve linking and
14249 load times of shared object libraries, produce more optimized
14250 code, provide near-perfect API export and prevent symbol clashes.
14251 It is @strong{strongly} recommended that you use this in any shared objects
14252 you distribute.
14253
14254 Despite the nomenclature, @samp{default} always means public; i.e.,
14255 available to be linked against from outside the shared object.
14256 @samp{protected} and @samp{internal} are pretty useless in real-world
14257 usage so the only other commonly used option is @samp{hidden}.
14258 The default if @option{-fvisibility} isn't specified is
14259 @samp{default}, i.e., make every symbol public.
14260
14261 A good explanation of the benefits offered by ensuring ELF
14262 symbols have the correct visibility is given by ``How To Write
14263 Shared Libraries'' by Ulrich Drepper (which can be found at
14264 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14265 solution made possible by this option to marking things hidden when
14266 the default is public is to make the default hidden and mark things
14267 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14268 and @code{__attribute__ ((visibility("default")))} instead of
14269 @code{__declspec(dllexport)} you get almost identical semantics with
14270 identical syntax. This is a great boon to those working with
14271 cross-platform projects.
14272
14273 For those adding visibility support to existing code, you may find
14274 @code{#pragma GCC visibility} of use. This works by you enclosing
14275 the declarations you wish to set visibility for with (for example)
14276 @code{#pragma GCC visibility push(hidden)} and
14277 @code{#pragma GCC visibility pop}.
14278 Bear in mind that symbol visibility should be viewed @strong{as
14279 part of the API interface contract} and thus all new code should
14280 always specify visibility when it is not the default; i.e., declarations
14281 only for use within the local DSO should @strong{always} be marked explicitly
14282 as hidden as so to avoid PLT indirection overheads---making this
14283 abundantly clear also aids readability and self-documentation of the code.
14284 Note that due to ISO C++ specification requirements, @code{operator new} and
14285 @code{operator delete} must always be of default visibility.
14286
14287 Be aware that headers from outside your project, in particular system
14288 headers and headers from any other library you use, may not be
14289 expecting to be compiled with visibility other than the default. You
14290 may need to explicitly say @code{#pragma GCC visibility push(default)}
14291 before including any such headers.
14292
14293 @code{extern} declarations are not affected by @option{-fvisibility}, so
14294 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14295 no modifications. However, this means that calls to @code{extern}
14296 functions with no explicit visibility use the PLT, so it is more
14297 effective to use @code{__attribute ((visibility))} and/or
14298 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14299 declarations should be treated as hidden.
14300
14301 Note that @option{-fvisibility} does affect C++ vague linkage
14302 entities. This means that, for instance, an exception class that is
14303 be thrown between DSOs must be explicitly marked with default
14304 visibility so that the @samp{type_info} nodes are unified between
14305 the DSOs.
14306
14307 An overview of these techniques, their benefits and how to use them
14308 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14309
14310 @item -fstrict-volatile-bitfields
14311 @opindex fstrict-volatile-bitfields
14312 This option should be used if accesses to volatile bit-fields (or other
14313 structure fields, although the compiler usually honors those types
14314 anyway) should use a single access of the width of the
14315 field's type, aligned to a natural alignment if possible. For
14316 example, targets with memory-mapped peripheral registers might require
14317 all such accesses to be 16 bits wide; with this flag you can
14318 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14319 is 16 bits on these targets) to force GCC to use 16-bit accesses
14320 instead of, perhaps, a more efficient 32-bit access.
14321
14322 If this option is disabled, the compiler uses the most efficient
14323 instruction. In the previous example, that might be a 32-bit load
14324 instruction, even though that accesses bytes that do not contain
14325 any portion of the bit-field, or memory-mapped registers unrelated to
14326 the one being updated.
14327
14328 In some cases, such as when the @code{packed} attribute is applied to a
14329 structure field, it may not be possible to access the field with a single
14330 read or write that is correctly aligned for the target machine. In this
14331 case GCC falls back to generating multiple accesses rather than code that
14332 will fault or truncate the result at run time.
14333
14334 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14335 not allowed to touch non bit-field members. It is therefore recommended
14336 to define all bits of the field's type as bit-field members.
14337
14338 The default value of this option is determined by the application binary
14339 interface for the target processor.
14340
14341 @item -fsync-libcalls
14342 @opindex fsync-libcalls
14343 This option controls whether any out-of-line instance of the @code{__sync}
14344 family of functions may be used to implement the C++11 @code{__atomic}
14345 family of functions.
14346
14347 The default value of this option is enabled, thus the only useful form
14348 of the option is @option{-fno-sync-libcalls}. This option is used in
14349 the implementation of the @file{libatomic} runtime library.
14350
14351 @end table
14352
14353 @node Developer Options
14354 @section GCC Developer Options
14355 @cindex developer options
14356 @cindex debugging GCC
14357 @cindex debug dump options
14358 @cindex dump options
14359 @cindex compilation statistics
14360
14361 This section describes command-line options that are primarily of
14362 interest to GCC developers, including options to support compiler
14363 testing and investigation of compiler bugs and compile-time
14364 performance problems. This includes options that produce debug dumps
14365 at various points in the compilation; that print statistics such as
14366 memory use and execution time; and that print information about GCC's
14367 configuration, such as where it searches for libraries. You should
14368 rarely need to use any of these options for ordinary compilation and
14369 linking tasks.
14370
14371 Many developer options that cause GCC to dump output to a file take an
14372 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14373 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14374 error.
14375
14376 If @samp{=@var{filename}} is omitted, a default dump file name is
14377 constructed by concatenating the base dump file name, a pass number,
14378 phase letter, and pass name. The base dump file name is the name of
14379 output file produced by the compiler if explicitly specified and not
14380 an executable; otherwise it is the source file name.
14381 The pass number is determined by the order passes are registered with
14382 the compiler's pass manager.
14383 This is generally the same as the order of execution, but passes
14384 registered by plugins, target-specific passes, or passes that are
14385 otherwise registered late are numbered higher than the pass named
14386 @samp{final}, even if they are executed earlier. The phase letter is
14387 one of @samp{i} (inter-procedural analysis), @samp{l}
14388 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14389 The files are created in the directory of the output file.
14390
14391 @table @gcctabopt
14392
14393 @item -d@var{letters}
14394 @itemx -fdump-rtl-@var{pass}
14395 @itemx -fdump-rtl-@var{pass}=@var{filename}
14396 @opindex d
14397 @opindex fdump-rtl-@var{pass}
14398 Says to make debugging dumps during compilation at times specified by
14399 @var{letters}. This is used for debugging the RTL-based passes of the
14400 compiler.
14401
14402 Some @option{-d@var{letters}} switches have different meaning when
14403 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14404 for information about preprocessor-specific dump options.
14405
14406 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14407 @option{-d} option @var{letters}. Here are the possible
14408 letters for use in @var{pass} and @var{letters}, and their meanings:
14409
14410 @table @gcctabopt
14411
14412 @item -fdump-rtl-alignments
14413 @opindex fdump-rtl-alignments
14414 Dump after branch alignments have been computed.
14415
14416 @item -fdump-rtl-asmcons
14417 @opindex fdump-rtl-asmcons
14418 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14419
14420 @item -fdump-rtl-auto_inc_dec
14421 @opindex fdump-rtl-auto_inc_dec
14422 Dump after auto-inc-dec discovery. This pass is only run on
14423 architectures that have auto inc or auto dec instructions.
14424
14425 @item -fdump-rtl-barriers
14426 @opindex fdump-rtl-barriers
14427 Dump after cleaning up the barrier instructions.
14428
14429 @item -fdump-rtl-bbpart
14430 @opindex fdump-rtl-bbpart
14431 Dump after partitioning hot and cold basic blocks.
14432
14433 @item -fdump-rtl-bbro
14434 @opindex fdump-rtl-bbro
14435 Dump after block reordering.
14436
14437 @item -fdump-rtl-btl1
14438 @itemx -fdump-rtl-btl2
14439 @opindex fdump-rtl-btl2
14440 @opindex fdump-rtl-btl2
14441 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14442 after the two branch
14443 target load optimization passes.
14444
14445 @item -fdump-rtl-bypass
14446 @opindex fdump-rtl-bypass
14447 Dump after jump bypassing and control flow optimizations.
14448
14449 @item -fdump-rtl-combine
14450 @opindex fdump-rtl-combine
14451 Dump after the RTL instruction combination pass.
14452
14453 @item -fdump-rtl-compgotos
14454 @opindex fdump-rtl-compgotos
14455 Dump after duplicating the computed gotos.
14456
14457 @item -fdump-rtl-ce1
14458 @itemx -fdump-rtl-ce2
14459 @itemx -fdump-rtl-ce3
14460 @opindex fdump-rtl-ce1
14461 @opindex fdump-rtl-ce2
14462 @opindex fdump-rtl-ce3
14463 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14464 @option{-fdump-rtl-ce3} enable dumping after the three
14465 if conversion passes.
14466
14467 @item -fdump-rtl-cprop_hardreg
14468 @opindex fdump-rtl-cprop_hardreg
14469 Dump after hard register copy propagation.
14470
14471 @item -fdump-rtl-csa
14472 @opindex fdump-rtl-csa
14473 Dump after combining stack adjustments.
14474
14475 @item -fdump-rtl-cse1
14476 @itemx -fdump-rtl-cse2
14477 @opindex fdump-rtl-cse1
14478 @opindex fdump-rtl-cse2
14479 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14480 the two common subexpression elimination passes.
14481
14482 @item -fdump-rtl-dce
14483 @opindex fdump-rtl-dce
14484 Dump after the standalone dead code elimination passes.
14485
14486 @item -fdump-rtl-dbr
14487 @opindex fdump-rtl-dbr
14488 Dump after delayed branch scheduling.
14489
14490 @item -fdump-rtl-dce1
14491 @itemx -fdump-rtl-dce2
14492 @opindex fdump-rtl-dce1
14493 @opindex fdump-rtl-dce2
14494 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14495 the two dead store elimination passes.
14496
14497 @item -fdump-rtl-eh
14498 @opindex fdump-rtl-eh
14499 Dump after finalization of EH handling code.
14500
14501 @item -fdump-rtl-eh_ranges
14502 @opindex fdump-rtl-eh_ranges
14503 Dump after conversion of EH handling range regions.
14504
14505 @item -fdump-rtl-expand
14506 @opindex fdump-rtl-expand
14507 Dump after RTL generation.
14508
14509 @item -fdump-rtl-fwprop1
14510 @itemx -fdump-rtl-fwprop2
14511 @opindex fdump-rtl-fwprop1
14512 @opindex fdump-rtl-fwprop2
14513 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14514 dumping after the two forward propagation passes.
14515
14516 @item -fdump-rtl-gcse1
14517 @itemx -fdump-rtl-gcse2
14518 @opindex fdump-rtl-gcse1
14519 @opindex fdump-rtl-gcse2
14520 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14521 after global common subexpression elimination.
14522
14523 @item -fdump-rtl-init-regs
14524 @opindex fdump-rtl-init-regs
14525 Dump after the initialization of the registers.
14526
14527 @item -fdump-rtl-initvals
14528 @opindex fdump-rtl-initvals
14529 Dump after the computation of the initial value sets.
14530
14531 @item -fdump-rtl-into_cfglayout
14532 @opindex fdump-rtl-into_cfglayout
14533 Dump after converting to cfglayout mode.
14534
14535 @item -fdump-rtl-ira
14536 @opindex fdump-rtl-ira
14537 Dump after iterated register allocation.
14538
14539 @item -fdump-rtl-jump
14540 @opindex fdump-rtl-jump
14541 Dump after the second jump optimization.
14542
14543 @item -fdump-rtl-loop2
14544 @opindex fdump-rtl-loop2
14545 @option{-fdump-rtl-loop2} enables dumping after the rtl
14546 loop optimization passes.
14547
14548 @item -fdump-rtl-mach
14549 @opindex fdump-rtl-mach
14550 Dump after performing the machine dependent reorganization pass, if that
14551 pass exists.
14552
14553 @item -fdump-rtl-mode_sw
14554 @opindex fdump-rtl-mode_sw
14555 Dump after removing redundant mode switches.
14556
14557 @item -fdump-rtl-rnreg
14558 @opindex fdump-rtl-rnreg
14559 Dump after register renumbering.
14560
14561 @item -fdump-rtl-outof_cfglayout
14562 @opindex fdump-rtl-outof_cfglayout
14563 Dump after converting from cfglayout mode.
14564
14565 @item -fdump-rtl-peephole2
14566 @opindex fdump-rtl-peephole2
14567 Dump after the peephole pass.
14568
14569 @item -fdump-rtl-postreload
14570 @opindex fdump-rtl-postreload
14571 Dump after post-reload optimizations.
14572
14573 @item -fdump-rtl-pro_and_epilogue
14574 @opindex fdump-rtl-pro_and_epilogue
14575 Dump after generating the function prologues and epilogues.
14576
14577 @item -fdump-rtl-sched1
14578 @itemx -fdump-rtl-sched2
14579 @opindex fdump-rtl-sched1
14580 @opindex fdump-rtl-sched2
14581 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14582 after the basic block scheduling passes.
14583
14584 @item -fdump-rtl-ree
14585 @opindex fdump-rtl-ree
14586 Dump after sign/zero extension elimination.
14587
14588 @item -fdump-rtl-seqabstr
14589 @opindex fdump-rtl-seqabstr
14590 Dump after common sequence discovery.
14591
14592 @item -fdump-rtl-shorten
14593 @opindex fdump-rtl-shorten
14594 Dump after shortening branches.
14595
14596 @item -fdump-rtl-sibling
14597 @opindex fdump-rtl-sibling
14598 Dump after sibling call optimizations.
14599
14600 @item -fdump-rtl-split1
14601 @itemx -fdump-rtl-split2
14602 @itemx -fdump-rtl-split3
14603 @itemx -fdump-rtl-split4
14604 @itemx -fdump-rtl-split5
14605 @opindex fdump-rtl-split1
14606 @opindex fdump-rtl-split2
14607 @opindex fdump-rtl-split3
14608 @opindex fdump-rtl-split4
14609 @opindex fdump-rtl-split5
14610 These options enable dumping after five rounds of
14611 instruction splitting.
14612
14613 @item -fdump-rtl-sms
14614 @opindex fdump-rtl-sms
14615 Dump after modulo scheduling. This pass is only run on some
14616 architectures.
14617
14618 @item -fdump-rtl-stack
14619 @opindex fdump-rtl-stack
14620 Dump after conversion from GCC's ``flat register file'' registers to the
14621 x87's stack-like registers. This pass is only run on x86 variants.
14622
14623 @item -fdump-rtl-subreg1
14624 @itemx -fdump-rtl-subreg2
14625 @opindex fdump-rtl-subreg1
14626 @opindex fdump-rtl-subreg2
14627 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14628 the two subreg expansion passes.
14629
14630 @item -fdump-rtl-unshare
14631 @opindex fdump-rtl-unshare
14632 Dump after all rtl has been unshared.
14633
14634 @item -fdump-rtl-vartrack
14635 @opindex fdump-rtl-vartrack
14636 Dump after variable tracking.
14637
14638 @item -fdump-rtl-vregs
14639 @opindex fdump-rtl-vregs
14640 Dump after converting virtual registers to hard registers.
14641
14642 @item -fdump-rtl-web
14643 @opindex fdump-rtl-web
14644 Dump after live range splitting.
14645
14646 @item -fdump-rtl-regclass
14647 @itemx -fdump-rtl-subregs_of_mode_init
14648 @itemx -fdump-rtl-subregs_of_mode_finish
14649 @itemx -fdump-rtl-dfinit
14650 @itemx -fdump-rtl-dfinish
14651 @opindex fdump-rtl-regclass
14652 @opindex fdump-rtl-subregs_of_mode_init
14653 @opindex fdump-rtl-subregs_of_mode_finish
14654 @opindex fdump-rtl-dfinit
14655 @opindex fdump-rtl-dfinish
14656 These dumps are defined but always produce empty files.
14657
14658 @item -da
14659 @itemx -fdump-rtl-all
14660 @opindex da
14661 @opindex fdump-rtl-all
14662 Produce all the dumps listed above.
14663
14664 @item -dA
14665 @opindex dA
14666 Annotate the assembler output with miscellaneous debugging information.
14667
14668 @item -dD
14669 @opindex dD
14670 Dump all macro definitions, at the end of preprocessing, in addition to
14671 normal output.
14672
14673 @item -dH
14674 @opindex dH
14675 Produce a core dump whenever an error occurs.
14676
14677 @item -dp
14678 @opindex dp
14679 Annotate the assembler output with a comment indicating which
14680 pattern and alternative is used. The length and cost of each instruction are
14681 also printed.
14682
14683 @item -dP
14684 @opindex dP
14685 Dump the RTL in the assembler output as a comment before each instruction.
14686 Also turns on @option{-dp} annotation.
14687
14688 @item -dx
14689 @opindex dx
14690 Just generate RTL for a function instead of compiling it. Usually used
14691 with @option{-fdump-rtl-expand}.
14692 @end table
14693
14694 @item -fdump-debug
14695 @opindex fdump-debug
14696 Dump debugging information generated during the debug
14697 generation phase.
14698
14699 @item -fdump-earlydebug
14700 @opindex fdump-earlydebug
14701 Dump debugging information generated during the early debug
14702 generation phase.
14703
14704 @item -fdump-noaddr
14705 @opindex fdump-noaddr
14706 When doing debugging dumps, suppress address output. This makes it more
14707 feasible to use diff on debugging dumps for compiler invocations with
14708 different compiler binaries and/or different
14709 text / bss / data / heap / stack / dso start locations.
14710
14711 @item -freport-bug
14712 @opindex freport-bug
14713 Collect and dump debug information into a temporary file if an
14714 internal compiler error (ICE) occurs.
14715
14716 @item -fdump-unnumbered
14717 @opindex fdump-unnumbered
14718 When doing debugging dumps, suppress instruction numbers and address output.
14719 This makes it more feasible to use diff on debugging dumps for compiler
14720 invocations with different options, in particular with and without
14721 @option{-g}.
14722
14723 @item -fdump-unnumbered-links
14724 @opindex fdump-unnumbered-links
14725 When doing debugging dumps (see @option{-d} option above), suppress
14726 instruction numbers for the links to the previous and next instructions
14727 in a sequence.
14728
14729 @item -fdump-ipa-@var{switch}
14730 @itemx -fdump-ipa-@var{switch}-@var{options}
14731 @opindex fdump-ipa
14732 Control the dumping at various stages of inter-procedural analysis
14733 language tree to a file. The file name is generated by appending a
14734 switch specific suffix to the source file name, and the file is created
14735 in the same directory as the output file. The following dumps are
14736 possible:
14737
14738 @table @samp
14739 @item all
14740 Enables all inter-procedural analysis dumps.
14741
14742 @item cgraph
14743 Dumps information about call-graph optimization, unused function removal,
14744 and inlining decisions.
14745
14746 @item inline
14747 Dump after function inlining.
14748
14749 @end table
14750
14751 Additionally, the options @option{-optimized}, @option{-missed},
14752 @option{-note}, and @option{-all} can be provided, with the same meaning
14753 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14754
14755 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14756 information on callsites that were inlined, along with callsites
14757 that were not inlined.
14758
14759 By default, the dump will contain messages about successful
14760 optimizations (equivalent to @option{-optimized}) together with
14761 low-level details about the analysis.
14762
14763 @item -fdump-lang-all
14764 @itemx -fdump-lang-@var{switch}
14765 @itemx -fdump-lang-@var{switch}-@var{options}
14766 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14767 @opindex fdump-lang-all
14768 @opindex fdump-lang
14769 Control the dumping of language-specific information. The @var{options}
14770 and @var{filename} portions behave as described in the
14771 @option{-fdump-tree} option. The following @var{switch} values are
14772 accepted:
14773
14774 @table @samp
14775 @item all
14776
14777 Enable all language-specific dumps.
14778
14779 @item class
14780 Dump class hierarchy information. Virtual table information is emitted
14781 unless '@option{slim}' is specified. This option is applicable to C++ only.
14782
14783 @item raw
14784 Dump the raw internal tree data. This option is applicable to C++ only.
14785
14786 @end table
14787
14788 @item -fdump-passes
14789 @opindex fdump-passes
14790 Print on @file{stderr} the list of optimization passes that are turned
14791 on and off by the current command-line options.
14792
14793 @item -fdump-statistics-@var{option}
14794 @opindex fdump-statistics
14795 Enable and control dumping of pass statistics in a separate file. The
14796 file name is generated by appending a suffix ending in
14797 @samp{.statistics} to the source file name, and the file is created in
14798 the same directory as the output file. If the @samp{-@var{option}}
14799 form is used, @samp{-stats} causes counters to be summed over the
14800 whole compilation unit while @samp{-details} dumps every event as
14801 the passes generate them. The default with no option is to sum
14802 counters for each function compiled.
14803
14804 @item -fdump-tree-all
14805 @itemx -fdump-tree-@var{switch}
14806 @itemx -fdump-tree-@var{switch}-@var{options}
14807 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14808 @opindex fdump-tree-all
14809 @opindex fdump-tree
14810 Control the dumping at various stages of processing the intermediate
14811 language tree to a file. If the @samp{-@var{options}}
14812 form is used, @var{options} is a list of @samp{-} separated options
14813 which control the details of the dump. Not all options are applicable
14814 to all dumps; those that are not meaningful are ignored. The
14815 following options are available
14816
14817 @table @samp
14818 @item address
14819 Print the address of each node. Usually this is not meaningful as it
14820 changes according to the environment and source file. Its primary use
14821 is for tying up a dump file with a debug environment.
14822 @item asmname
14823 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14824 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14825 use working backward from mangled names in the assembly file.
14826 @item slim
14827 When dumping front-end intermediate representations, inhibit dumping
14828 of members of a scope or body of a function merely because that scope
14829 has been reached. Only dump such items when they are directly reachable
14830 by some other path.
14831
14832 When dumping pretty-printed trees, this option inhibits dumping the
14833 bodies of control structures.
14834
14835 When dumping RTL, print the RTL in slim (condensed) form instead of
14836 the default LISP-like representation.
14837 @item raw
14838 Print a raw representation of the tree. By default, trees are
14839 pretty-printed into a C-like representation.
14840 @item details
14841 Enable more detailed dumps (not honored by every dump option). Also
14842 include information from the optimization passes.
14843 @item stats
14844 Enable dumping various statistics about the pass (not honored by every dump
14845 option).
14846 @item blocks
14847 Enable showing basic block boundaries (disabled in raw dumps).
14848 @item graph
14849 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14850 dump a representation of the control flow graph suitable for viewing with
14851 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14852 the file is pretty-printed as a subgraph, so that GraphViz can render them
14853 all in a single plot.
14854
14855 This option currently only works for RTL dumps, and the RTL is always
14856 dumped in slim form.
14857 @item vops
14858 Enable showing virtual operands for every statement.
14859 @item lineno
14860 Enable showing line numbers for statements.
14861 @item uid
14862 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14863 @item verbose
14864 Enable showing the tree dump for each statement.
14865 @item eh
14866 Enable showing the EH region number holding each statement.
14867 @item scev
14868 Enable showing scalar evolution analysis details.
14869 @item optimized
14870 Enable showing optimization information (only available in certain
14871 passes).
14872 @item missed
14873 Enable showing missed optimization information (only available in certain
14874 passes).
14875 @item note
14876 Enable other detailed optimization information (only available in
14877 certain passes).
14878 @item all
14879 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14880 and @option{lineno}.
14881 @item optall
14882 Turn on all optimization options, i.e., @option{optimized},
14883 @option{missed}, and @option{note}.
14884 @end table
14885
14886 To determine what tree dumps are available or find the dump for a pass
14887 of interest follow the steps below.
14888
14889 @enumerate
14890 @item
14891 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14892 look for a code that corresponds to the pass you are interested in.
14893 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14894 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14895 The number at the end distinguishes distinct invocations of the same pass.
14896 @item
14897 To enable the creation of the dump file, append the pass code to
14898 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14899 to enable the dump from the Early Value Range Propagation pass, invoke
14900 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14901 specify the name of the dump file. If you don't specify one, GCC
14902 creates as described below.
14903 @item
14904 Find the pass dump in a file whose name is composed of three components
14905 separated by a period: the name of the source file GCC was invoked to
14906 compile, a numeric suffix indicating the pass number followed by the
14907 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14908 and finally the pass code. For example, the Early VRP pass dump might
14909 be in a file named @file{myfile.c.038t.evrp} in the current working
14910 directory. Note that the numeric codes are not stable and may change
14911 from one version of GCC to another.
14912 @end enumerate
14913
14914 @item -fopt-info
14915 @itemx -fopt-info-@var{options}
14916 @itemx -fopt-info-@var{options}=@var{filename}
14917 @opindex fopt-info
14918 Controls optimization dumps from various optimization passes. If the
14919 @samp{-@var{options}} form is used, @var{options} is a list of
14920 @samp{-} separated option keywords to select the dump details and
14921 optimizations.
14922
14923 The @var{options} can be divided into three groups:
14924 @enumerate
14925 @item
14926 options describing what kinds of messages should be emitted,
14927 @item
14928 options describing the verbosity of the dump, and
14929 @item
14930 options describing which optimizations should be included.
14931 @end enumerate
14932 The options from each group can be freely mixed as they are
14933 non-overlapping. However, in case of any conflicts,
14934 the later options override the earlier options on the command
14935 line.
14936
14937 The following options control which kinds of messages should be emitted:
14938
14939 @table @samp
14940 @item optimized
14941 Print information when an optimization is successfully applied. It is
14942 up to a pass to decide which information is relevant. For example, the
14943 vectorizer passes print the source location of loops which are
14944 successfully vectorized.
14945 @item missed
14946 Print information about missed optimizations. Individual passes
14947 control which information to include in the output.
14948 @item note
14949 Print verbose information about optimizations, such as certain
14950 transformations, more detailed messages about decisions etc.
14951 @item all
14952 Print detailed optimization information. This includes
14953 @samp{optimized}, @samp{missed}, and @samp{note}.
14954 @end table
14955
14956 The following option controls the dump verbosity:
14957
14958 @table @samp
14959 @item internals
14960 By default, only ``high-level'' messages are emitted. This option enables
14961 additional, more detailed, messages, which are likely to only be of interest
14962 to GCC developers.
14963 @end table
14964
14965 One or more of the following option keywords can be used to describe a
14966 group of optimizations:
14967
14968 @table @samp
14969 @item ipa
14970 Enable dumps from all interprocedural optimizations.
14971 @item loop
14972 Enable dumps from all loop optimizations.
14973 @item inline
14974 Enable dumps from all inlining optimizations.
14975 @item omp
14976 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14977 @item vec
14978 Enable dumps from all vectorization optimizations.
14979 @item optall
14980 Enable dumps from all optimizations. This is a superset of
14981 the optimization groups listed above.
14982 @end table
14983
14984 If @var{options} is
14985 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14986 about successful optimizations from all the passes, omitting messages
14987 that are treated as ``internals''.
14988
14989 If the @var{filename} is provided, then the dumps from all the
14990 applicable optimizations are concatenated into the @var{filename}.
14991 Otherwise the dump is output onto @file{stderr}. Though multiple
14992 @option{-fopt-info} options are accepted, only one of them can include
14993 a @var{filename}. If other filenames are provided then all but the
14994 first such option are ignored.
14995
14996 Note that the output @var{filename} is overwritten
14997 in case of multiple translation units. If a combined output from
14998 multiple translation units is desired, @file{stderr} should be used
14999 instead.
15000
15001 In the following example, the optimization info is output to
15002 @file{stderr}:
15003
15004 @smallexample
15005 gcc -O3 -fopt-info
15006 @end smallexample
15007
15008 This example:
15009 @smallexample
15010 gcc -O3 -fopt-info-missed=missed.all
15011 @end smallexample
15012
15013 @noindent
15014 outputs missed optimization report from all the passes into
15015 @file{missed.all}, and this one:
15016
15017 @smallexample
15018 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15019 @end smallexample
15020
15021 @noindent
15022 prints information about missed optimization opportunities from
15023 vectorization passes on @file{stderr}.
15024 Note that @option{-fopt-info-vec-missed} is equivalent to
15025 @option{-fopt-info-missed-vec}. The order of the optimization group
15026 names and message types listed after @option{-fopt-info} does not matter.
15027
15028 As another example,
15029 @smallexample
15030 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15031 @end smallexample
15032
15033 @noindent
15034 outputs information about missed optimizations as well as
15035 optimized locations from all the inlining passes into
15036 @file{inline.txt}.
15037
15038 Finally, consider:
15039
15040 @smallexample
15041 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15042 @end smallexample
15043
15044 @noindent
15045 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15046 in conflict since only one output file is allowed. In this case, only
15047 the first option takes effect and the subsequent options are
15048 ignored. Thus only @file{vec.miss} is produced which contains
15049 dumps from the vectorizer about missed opportunities.
15050
15051 @item -fsave-optimization-record
15052 @opindex fsave-optimization-record
15053 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15054 were performed, for those optimizations that support @option{-fopt-info}.
15055
15056 This option is experimental and the format of the data within the
15057 compressed JSON file is subject to change.
15058
15059 It is roughly equivalent to a machine-readable version of
15060 @option{-fopt-info-all}, as a collection of messages with source file,
15061 line number and column number, with the following additional data for
15062 each message:
15063
15064 @itemize @bullet
15065
15066 @item
15067 the execution count of the code being optimized, along with metadata about
15068 whether this was from actual profile data, or just an estimate, allowing
15069 consumers to prioritize messages by code hotness,
15070
15071 @item
15072 the function name of the code being optimized, where applicable,
15073
15074 @item
15075 the ``inlining chain'' for the code being optimized, so that when
15076 a function is inlined into several different places (which might
15077 themselves be inlined), the reader can distinguish between the copies,
15078
15079 @item
15080 objects identifying those parts of the message that refer to expressions,
15081 statements or symbol-table nodes, which of these categories they are, and,
15082 when available, their source code location,
15083
15084 @item
15085 the GCC pass that emitted the message, and
15086
15087 @item
15088 the location in GCC's own code from which the message was emitted
15089
15090 @end itemize
15091
15092 Additionally, some messages are logically nested within other
15093 messages, reflecting implementation details of the optimization
15094 passes.
15095
15096 @item -fsched-verbose=@var{n}
15097 @opindex fsched-verbose
15098 On targets that use instruction scheduling, this option controls the
15099 amount of debugging output the scheduler prints to the dump files.
15100
15101 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15102 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15103 For @var{n} greater than one, it also output basic block probabilities,
15104 detailed ready list information and unit/insn info. For @var{n} greater
15105 than two, it includes RTL at abort point, control-flow and regions info.
15106 And for @var{n} over four, @option{-fsched-verbose} also includes
15107 dependence info.
15108
15109
15110
15111 @item -fenable-@var{kind}-@var{pass}
15112 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15113 @opindex fdisable-
15114 @opindex fenable-
15115
15116 This is a set of options that are used to explicitly disable/enable
15117 optimization passes. These options are intended for use for debugging GCC.
15118 Compiler users should use regular options for enabling/disabling
15119 passes instead.
15120
15121 @table @gcctabopt
15122
15123 @item -fdisable-ipa-@var{pass}
15124 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15125 statically invoked in the compiler multiple times, the pass name should be
15126 appended with a sequential number starting from 1.
15127
15128 @item -fdisable-rtl-@var{pass}
15129 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15130 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15131 statically invoked in the compiler multiple times, the pass name should be
15132 appended with a sequential number starting from 1. @var{range-list} is a
15133 comma-separated list of function ranges or assembler names. Each range is a number
15134 pair separated by a colon. The range is inclusive in both ends. If the range
15135 is trivial, the number pair can be simplified as a single number. If the
15136 function's call graph node's @var{uid} falls within one of the specified ranges,
15137 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15138 function header of a dump file, and the pass names can be dumped by using
15139 option @option{-fdump-passes}.
15140
15141 @item -fdisable-tree-@var{pass}
15142 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15143 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15144 option arguments.
15145
15146 @item -fenable-ipa-@var{pass}
15147 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15148 statically invoked in the compiler multiple times, the pass name should be
15149 appended with a sequential number starting from 1.
15150
15151 @item -fenable-rtl-@var{pass}
15152 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15153 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15154 description and examples.
15155
15156 @item -fenable-tree-@var{pass}
15157 @itemx -fenable-tree-@var{pass}=@var{range-list}
15158 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15159 of option arguments.
15160
15161 @end table
15162
15163 Here are some examples showing uses of these options.
15164
15165 @smallexample
15166
15167 # disable ccp1 for all functions
15168 -fdisable-tree-ccp1
15169 # disable complete unroll for function whose cgraph node uid is 1
15170 -fenable-tree-cunroll=1
15171 # disable gcse2 for functions at the following ranges [1,1],
15172 # [300,400], and [400,1000]
15173 # disable gcse2 for functions foo and foo2
15174 -fdisable-rtl-gcse2=foo,foo2
15175 # disable early inlining
15176 -fdisable-tree-einline
15177 # disable ipa inlining
15178 -fdisable-ipa-inline
15179 # enable tree full unroll
15180 -fenable-tree-unroll
15181
15182 @end smallexample
15183
15184 @item -fchecking
15185 @itemx -fchecking=@var{n}
15186 @opindex fchecking
15187 @opindex fno-checking
15188 Enable internal consistency checking. The default depends on
15189 the compiler configuration. @option{-fchecking=2} enables further
15190 internal consistency checking that might affect code generation.
15191
15192 @item -frandom-seed=@var{string}
15193 @opindex frandom-seed
15194 This option provides a seed that GCC uses in place of
15195 random numbers in generating certain symbol names
15196 that have to be different in every compiled file. It is also used to
15197 place unique stamps in coverage data files and the object files that
15198 produce them. You can use the @option{-frandom-seed} option to produce
15199 reproducibly identical object files.
15200
15201 The @var{string} can either be a number (decimal, octal or hex) or an
15202 arbitrary string (in which case it's converted to a number by
15203 computing CRC32).
15204
15205 The @var{string} should be different for every file you compile.
15206
15207 @item -save-temps
15208 @itemx -save-temps=cwd
15209 @opindex save-temps
15210 Store the usual ``temporary'' intermediate files permanently; place them
15211 in the current directory and name them based on the source file. Thus,
15212 compiling @file{foo.c} with @option{-c -save-temps} produces files
15213 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15214 preprocessed @file{foo.i} output file even though the compiler now
15215 normally uses an integrated preprocessor.
15216
15217 When used in combination with the @option{-x} command-line option,
15218 @option{-save-temps} is sensible enough to avoid over writing an
15219 input source file with the same extension as an intermediate file.
15220 The corresponding intermediate file may be obtained by renaming the
15221 source file before using @option{-save-temps}.
15222
15223 If you invoke GCC in parallel, compiling several different source
15224 files that share a common base name in different subdirectories or the
15225 same source file compiled for multiple output destinations, it is
15226 likely that the different parallel compilers will interfere with each
15227 other, and overwrite the temporary files. For instance:
15228
15229 @smallexample
15230 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15231 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15232 @end smallexample
15233
15234 may result in @file{foo.i} and @file{foo.o} being written to
15235 simultaneously by both compilers.
15236
15237 @item -save-temps=obj
15238 @opindex save-temps=obj
15239 Store the usual ``temporary'' intermediate files permanently. If the
15240 @option{-o} option is used, the temporary files are based on the
15241 object file. If the @option{-o} option is not used, the
15242 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15243
15244 For example:
15245
15246 @smallexample
15247 gcc -save-temps=obj -c foo.c
15248 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15249 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15250 @end smallexample
15251
15252 @noindent
15253 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15254 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15255 @file{dir2/yfoobar.o}.
15256
15257 @item -time@r{[}=@var{file}@r{]}
15258 @opindex time
15259 Report the CPU time taken by each subprocess in the compilation
15260 sequence. For C source files, this is the compiler proper and assembler
15261 (plus the linker if linking is done).
15262
15263 Without the specification of an output file, the output looks like this:
15264
15265 @smallexample
15266 # cc1 0.12 0.01
15267 # as 0.00 0.01
15268 @end smallexample
15269
15270 The first number on each line is the ``user time'', that is time spent
15271 executing the program itself. The second number is ``system time'',
15272 time spent executing operating system routines on behalf of the program.
15273 Both numbers are in seconds.
15274
15275 With the specification of an output file, the output is appended to the
15276 named file, and it looks like this:
15277
15278 @smallexample
15279 0.12 0.01 cc1 @var{options}
15280 0.00 0.01 as @var{options}
15281 @end smallexample
15282
15283 The ``user time'' and the ``system time'' are moved before the program
15284 name, and the options passed to the program are displayed, so that one
15285 can later tell what file was being compiled, and with which options.
15286
15287 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15288 @opindex fdump-final-insns
15289 Dump the final internal representation (RTL) to @var{file}. If the
15290 optional argument is omitted (or if @var{file} is @code{.}), the name
15291 of the dump file is determined by appending @code{.gkd} to the
15292 compilation output file name.
15293
15294 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15295 @opindex fcompare-debug
15296 @opindex fno-compare-debug
15297 If no error occurs during compilation, run the compiler a second time,
15298 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15299 passed to the second compilation. Dump the final internal
15300 representation in both compilations, and print an error if they differ.
15301
15302 If the equal sign is omitted, the default @option{-gtoggle} is used.
15303
15304 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15305 and nonzero, implicitly enables @option{-fcompare-debug}. If
15306 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15307 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15308 is used.
15309
15310 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15311 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15312 of the final representation and the second compilation, preventing even
15313 @env{GCC_COMPARE_DEBUG} from taking effect.
15314
15315 To verify full coverage during @option{-fcompare-debug} testing, set
15316 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15317 which GCC rejects as an invalid option in any actual compilation
15318 (rather than preprocessing, assembly or linking). To get just a
15319 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15320 not overridden} will do.
15321
15322 @item -fcompare-debug-second
15323 @opindex fcompare-debug-second
15324 This option is implicitly passed to the compiler for the second
15325 compilation requested by @option{-fcompare-debug}, along with options to
15326 silence warnings, and omitting other options that would cause the compiler
15327 to produce output to files or to standard output as a side effect. Dump
15328 files and preserved temporary files are renamed so as to contain the
15329 @code{.gk} additional extension during the second compilation, to avoid
15330 overwriting those generated by the first.
15331
15332 When this option is passed to the compiler driver, it causes the
15333 @emph{first} compilation to be skipped, which makes it useful for little
15334 other than debugging the compiler proper.
15335
15336 @item -gtoggle
15337 @opindex gtoggle
15338 Turn off generation of debug info, if leaving out this option
15339 generates it, or turn it on at level 2 otherwise. The position of this
15340 argument in the command line does not matter; it takes effect after all
15341 other options are processed, and it does so only once, no matter how
15342 many times it is given. This is mainly intended to be used with
15343 @option{-fcompare-debug}.
15344
15345 @item -fvar-tracking-assignments-toggle
15346 @opindex fvar-tracking-assignments-toggle
15347 @opindex fno-var-tracking-assignments-toggle
15348 Toggle @option{-fvar-tracking-assignments}, in the same way that
15349 @option{-gtoggle} toggles @option{-g}.
15350
15351 @item -Q
15352 @opindex Q
15353 Makes the compiler print out each function name as it is compiled, and
15354 print some statistics about each pass when it finishes.
15355
15356 @item -ftime-report
15357 @opindex ftime-report
15358 Makes the compiler print some statistics about the time consumed by each
15359 pass when it finishes.
15360
15361 @item -ftime-report-details
15362 @opindex ftime-report-details
15363 Record the time consumed by infrastructure parts separately for each pass.
15364
15365 @item -fira-verbose=@var{n}
15366 @opindex fira-verbose
15367 Control the verbosity of the dump file for the integrated register allocator.
15368 The default value is 5. If the value @var{n} is greater or equal to 10,
15369 the dump output is sent to stderr using the same format as @var{n} minus 10.
15370
15371 @item -flto-report
15372 @opindex flto-report
15373 Prints a report with internal details on the workings of the link-time
15374 optimizer. The contents of this report vary from version to version.
15375 It is meant to be useful to GCC developers when processing object
15376 files in LTO mode (via @option{-flto}).
15377
15378 Disabled by default.
15379
15380 @item -flto-report-wpa
15381 @opindex flto-report-wpa
15382 Like @option{-flto-report}, but only print for the WPA phase of Link
15383 Time Optimization.
15384
15385 @item -fmem-report
15386 @opindex fmem-report
15387 Makes the compiler print some statistics about permanent memory
15388 allocation when it finishes.
15389
15390 @item -fmem-report-wpa
15391 @opindex fmem-report-wpa
15392 Makes the compiler print some statistics about permanent memory
15393 allocation for the WPA phase only.
15394
15395 @item -fpre-ipa-mem-report
15396 @opindex fpre-ipa-mem-report
15397 @item -fpost-ipa-mem-report
15398 @opindex fpost-ipa-mem-report
15399 Makes the compiler print some statistics about permanent memory
15400 allocation before or after interprocedural optimization.
15401
15402 @item -fprofile-report
15403 @opindex fprofile-report
15404 Makes the compiler print some statistics about consistency of the
15405 (estimated) profile and effect of individual passes.
15406
15407 @item -fstack-usage
15408 @opindex fstack-usage
15409 Makes the compiler output stack usage information for the program, on a
15410 per-function basis. The filename for the dump is made by appending
15411 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15412 the output file, if explicitly specified and it is not an executable,
15413 otherwise it is the basename of the source file. An entry is made up
15414 of three fields:
15415
15416 @itemize
15417 @item
15418 The name of the function.
15419 @item
15420 A number of bytes.
15421 @item
15422 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15423 @end itemize
15424
15425 The qualifier @code{static} means that the function manipulates the stack
15426 statically: a fixed number of bytes are allocated for the frame on function
15427 entry and released on function exit; no stack adjustments are otherwise made
15428 in the function. The second field is this fixed number of bytes.
15429
15430 The qualifier @code{dynamic} means that the function manipulates the stack
15431 dynamically: in addition to the static allocation described above, stack
15432 adjustments are made in the body of the function, for example to push/pop
15433 arguments around function calls. If the qualifier @code{bounded} is also
15434 present, the amount of these adjustments is bounded at compile time and
15435 the second field is an upper bound of the total amount of stack used by
15436 the function. If it is not present, the amount of these adjustments is
15437 not bounded at compile time and the second field only represents the
15438 bounded part.
15439
15440 @item -fstats
15441 @opindex fstats
15442 Emit statistics about front-end processing at the end of the compilation.
15443 This option is supported only by the C++ front end, and
15444 the information is generally only useful to the G++ development team.
15445
15446 @item -fdbg-cnt-list
15447 @opindex fdbg-cnt-list
15448 Print the name and the counter upper bound for all debug counters.
15449
15450
15451 @item -fdbg-cnt=@var{counter-value-list}
15452 @opindex fdbg-cnt
15453 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15454 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15455 tuples which sets the lower and the upper bound of each debug
15456 counter @var{name}. The @var{lower_bound} is optional and is zero
15457 initialized if not set.
15458 All debug counters have the initial upper bound of @code{UINT_MAX};
15459 thus @code{dbg_cnt} returns true always unless the upper bound
15460 is set by this option.
15461 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15462 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15463 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15464
15465 @item -print-file-name=@var{library}
15466 @opindex print-file-name
15467 Print the full absolute name of the library file @var{library} that
15468 would be used when linking---and don't do anything else. With this
15469 option, GCC does not compile or link anything; it just prints the
15470 file name.
15471
15472 @item -print-multi-directory
15473 @opindex print-multi-directory
15474 Print the directory name corresponding to the multilib selected by any
15475 other switches present in the command line. This directory is supposed
15476 to exist in @env{GCC_EXEC_PREFIX}.
15477
15478 @item -print-multi-lib
15479 @opindex print-multi-lib
15480 Print the mapping from multilib directory names to compiler switches
15481 that enable them. The directory name is separated from the switches by
15482 @samp{;}, and each switch starts with an @samp{@@} instead of the
15483 @samp{-}, without spaces between multiple switches. This is supposed to
15484 ease shell processing.
15485
15486 @item -print-multi-os-directory
15487 @opindex print-multi-os-directory
15488 Print the path to OS libraries for the selected
15489 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15490 present in the @file{lib} subdirectory and no multilibs are used, this is
15491 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15492 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15493 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15494 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15495
15496 @item -print-multiarch
15497 @opindex print-multiarch
15498 Print the path to OS libraries for the selected multiarch,
15499 relative to some @file{lib} subdirectory.
15500
15501 @item -print-prog-name=@var{program}
15502 @opindex print-prog-name
15503 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15504
15505 @item -print-libgcc-file-name
15506 @opindex print-libgcc-file-name
15507 Same as @option{-print-file-name=libgcc.a}.
15508
15509 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15510 but you do want to link with @file{libgcc.a}. You can do:
15511
15512 @smallexample
15513 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15514 @end smallexample
15515
15516 @item -print-search-dirs
15517 @opindex print-search-dirs
15518 Print the name of the configured installation directory and a list of
15519 program and library directories @command{gcc} searches---and don't do anything else.
15520
15521 This is useful when @command{gcc} prints the error message
15522 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15523 To resolve this you either need to put @file{cpp0} and the other compiler
15524 components where @command{gcc} expects to find them, or you can set the environment
15525 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15526 Don't forget the trailing @samp{/}.
15527 @xref{Environment Variables}.
15528
15529 @item -print-sysroot
15530 @opindex print-sysroot
15531 Print the target sysroot directory that is used during
15532 compilation. This is the target sysroot specified either at configure
15533 time or using the @option{--sysroot} option, possibly with an extra
15534 suffix that depends on compilation options. If no target sysroot is
15535 specified, the option prints nothing.
15536
15537 @item -print-sysroot-headers-suffix
15538 @opindex print-sysroot-headers-suffix
15539 Print the suffix added to the target sysroot when searching for
15540 headers, or give an error if the compiler is not configured with such
15541 a suffix---and don't do anything else.
15542
15543 @item -dumpmachine
15544 @opindex dumpmachine
15545 Print the compiler's target machine (for example,
15546 @samp{i686-pc-linux-gnu})---and don't do anything else.
15547
15548 @item -dumpversion
15549 @opindex dumpversion
15550 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15551 anything else. This is the compiler version used in filesystem paths and
15552 specs. Depending on how the compiler has been configured it can be just
15553 a single number (major version), two numbers separated by a dot (major and
15554 minor version) or three numbers separated by dots (major, minor and patchlevel
15555 version).
15556
15557 @item -dumpfullversion
15558 @opindex dumpfullversion
15559 Print the full compiler version---and don't do anything else. The output is
15560 always three numbers separated by dots, major, minor and patchlevel version.
15561
15562 @item -dumpspecs
15563 @opindex dumpspecs
15564 Print the compiler's built-in specs---and don't do anything else. (This
15565 is used when GCC itself is being built.) @xref{Spec Files}.
15566 @end table
15567
15568 @node Submodel Options
15569 @section Machine-Dependent Options
15570 @cindex submodel options
15571 @cindex specifying hardware config
15572 @cindex hardware models and configurations, specifying
15573 @cindex target-dependent options
15574 @cindex machine-dependent options
15575
15576 Each target machine supported by GCC can have its own options---for
15577 example, to allow you to compile for a particular processor variant or
15578 ABI, or to control optimizations specific to that machine. By
15579 convention, the names of machine-specific options start with
15580 @samp{-m}.
15581
15582 Some configurations of the compiler also support additional target-specific
15583 options, usually for compatibility with other compilers on the same
15584 platform.
15585
15586 @c This list is ordered alphanumerically by subsection name.
15587 @c It should be the same order and spelling as these options are listed
15588 @c in Machine Dependent Options
15589
15590 @menu
15591 * AArch64 Options::
15592 * Adapteva Epiphany Options::
15593 * AMD GCN Options::
15594 * ARC Options::
15595 * ARM Options::
15596 * AVR Options::
15597 * Blackfin Options::
15598 * C6X Options::
15599 * CRIS Options::
15600 * CR16 Options::
15601 * C-SKY Options::
15602 * Darwin Options::
15603 * DEC Alpha Options::
15604 * FR30 Options::
15605 * FT32 Options::
15606 * FRV Options::
15607 * GNU/Linux Options::
15608 * H8/300 Options::
15609 * HPPA Options::
15610 * IA-64 Options::
15611 * LM32 Options::
15612 * M32C Options::
15613 * M32R/D Options::
15614 * M680x0 Options::
15615 * MCore Options::
15616 * MeP Options::
15617 * MicroBlaze Options::
15618 * MIPS Options::
15619 * MMIX Options::
15620 * MN10300 Options::
15621 * Moxie Options::
15622 * MSP430 Options::
15623 * NDS32 Options::
15624 * Nios II Options::
15625 * Nvidia PTX Options::
15626 * OpenRISC Options::
15627 * PDP-11 Options::
15628 * picoChip Options::
15629 * PowerPC Options::
15630 * PRU Options::
15631 * RISC-V Options::
15632 * RL78 Options::
15633 * RS/6000 and PowerPC Options::
15634 * RX Options::
15635 * S/390 and zSeries Options::
15636 * Score Options::
15637 * SH Options::
15638 * Solaris 2 Options::
15639 * SPARC Options::
15640 * SPU Options::
15641 * System V Options::
15642 * TILE-Gx Options::
15643 * TILEPro Options::
15644 * V850 Options::
15645 * VAX Options::
15646 * Visium Options::
15647 * VMS Options::
15648 * VxWorks Options::
15649 * x86 Options::
15650 * x86 Windows Options::
15651 * Xstormy16 Options::
15652 * Xtensa Options::
15653 * zSeries Options::
15654 @end menu
15655
15656 @node AArch64 Options
15657 @subsection AArch64 Options
15658 @cindex AArch64 Options
15659
15660 These options are defined for AArch64 implementations:
15661
15662 @table @gcctabopt
15663
15664 @item -mabi=@var{name}
15665 @opindex mabi
15666 Generate code for the specified data model. Permissible values
15667 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15668 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15669 but long int and pointers are 64 bits.
15670
15671 The default depends on the specific target configuration. Note that
15672 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15673 entire program with the same ABI, and link with a compatible set of libraries.
15674
15675 @item -mbig-endian
15676 @opindex mbig-endian
15677 Generate big-endian code. This is the default when GCC is configured for an
15678 @samp{aarch64_be-*-*} target.
15679
15680 @item -mgeneral-regs-only
15681 @opindex mgeneral-regs-only
15682 Generate code which uses only the general-purpose registers. This will prevent
15683 the compiler from using floating-point and Advanced SIMD registers but will not
15684 impose any restrictions on the assembler.
15685
15686 @item -mlittle-endian
15687 @opindex mlittle-endian
15688 Generate little-endian code. This is the default when GCC is configured for an
15689 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15690
15691 @item -mcmodel=tiny
15692 @opindex mcmodel=tiny
15693 Generate code for the tiny code model. The program and its statically defined
15694 symbols must be within 1MB of each other. Programs can be statically or
15695 dynamically linked.
15696
15697 @item -mcmodel=small
15698 @opindex mcmodel=small
15699 Generate code for the small code model. The program and its statically defined
15700 symbols must be within 4GB of each other. Programs can be statically or
15701 dynamically linked. This is the default code model.
15702
15703 @item -mcmodel=large
15704 @opindex mcmodel=large
15705 Generate code for the large code model. This makes no assumptions about
15706 addresses and sizes of sections. Programs can be statically linked only.
15707
15708 @item -mstrict-align
15709 @itemx -mno-strict-align
15710 @opindex mstrict-align
15711 @opindex mno-strict-align
15712 Avoid or allow generating memory accesses that may not be aligned on a natural
15713 object boundary as described in the architecture specification.
15714
15715 @item -momit-leaf-frame-pointer
15716 @itemx -mno-omit-leaf-frame-pointer
15717 @opindex momit-leaf-frame-pointer
15718 @opindex mno-omit-leaf-frame-pointer
15719 Omit or keep the frame pointer in leaf functions. The former behavior is the
15720 default.
15721
15722 @item -mstack-protector-guard=@var{guard}
15723 @itemx -mstack-protector-guard-reg=@var{reg}
15724 @itemx -mstack-protector-guard-offset=@var{offset}
15725 @opindex mstack-protector-guard
15726 @opindex mstack-protector-guard-reg
15727 @opindex mstack-protector-guard-offset
15728 Generate stack protection code using canary at @var{guard}. Supported
15729 locations are @samp{global} for a global canary or @samp{sysreg} for a
15730 canary in an appropriate system register.
15731
15732 With the latter choice the options
15733 @option{-mstack-protector-guard-reg=@var{reg}} and
15734 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15735 which system register to use as base register for reading the canary,
15736 and from what offset from that base register. There is no default
15737 register or offset as this is entirely for use within the Linux
15738 kernel.
15739
15740 @item -mstack-protector-guard=@var{guard}
15741 @itemx -mstack-protector-guard-reg=@var{reg}
15742 @itemx -mstack-protector-guard-offset=@var{offset}
15743 @opindex mstack-protector-guard
15744 @opindex mstack-protector-guard-reg
15745 @opindex mstack-protector-guard-offset
15746 Generate stack protection code using canary at @var{guard}. Supported
15747 locations are @samp{global} for a global canary or @samp{sysreg} for a
15748 canary in an appropriate system register.
15749
15750 With the latter choice the options
15751 @option{-mstack-protector-guard-reg=@var{reg}} and
15752 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15753 which system register to use as base register for reading the canary,
15754 and from what offset from that base register. There is no default
15755 register or offset as this is entirely for use within the Linux
15756 kernel.
15757
15758 @item -mtls-dialect=desc
15759 @opindex mtls-dialect=desc
15760 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15761 of TLS variables. This is the default.
15762
15763 @item -mtls-dialect=traditional
15764 @opindex mtls-dialect=traditional
15765 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15766 of TLS variables.
15767
15768 @item -mtls-size=@var{size}
15769 @opindex mtls-size
15770 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15771 This option requires binutils 2.26 or newer.
15772
15773 @item -mfix-cortex-a53-835769
15774 @itemx -mno-fix-cortex-a53-835769
15775 @opindex mfix-cortex-a53-835769
15776 @opindex mno-fix-cortex-a53-835769
15777 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15778 This involves inserting a NOP instruction between memory instructions and
15779 64-bit integer multiply-accumulate instructions.
15780
15781 @item -mfix-cortex-a53-843419
15782 @itemx -mno-fix-cortex-a53-843419
15783 @opindex mfix-cortex-a53-843419
15784 @opindex mno-fix-cortex-a53-843419
15785 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15786 This erratum workaround is made at link time and this will only pass the
15787 corresponding flag to the linker.
15788
15789 @item -mlow-precision-recip-sqrt
15790 @itemx -mno-low-precision-recip-sqrt
15791 @opindex mlow-precision-recip-sqrt
15792 @opindex mno-low-precision-recip-sqrt
15793 Enable or disable the reciprocal square root approximation.
15794 This option only has an effect if @option{-ffast-math} or
15795 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15796 precision of reciprocal square root results to about 16 bits for
15797 single precision and to 32 bits for double precision.
15798
15799 @item -mlow-precision-sqrt
15800 @itemx -mno-low-precision-sqrt
15801 @opindex mlow-precision-sqrt
15802 @opindex mno-low-precision-sqrt
15803 Enable or disable the square root approximation.
15804 This option only has an effect if @option{-ffast-math} or
15805 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15806 precision of square root results to about 16 bits for
15807 single precision and to 32 bits for double precision.
15808 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15809
15810 @item -mlow-precision-div
15811 @itemx -mno-low-precision-div
15812 @opindex mlow-precision-div
15813 @opindex mno-low-precision-div
15814 Enable or disable the division approximation.
15815 This option only has an effect if @option{-ffast-math} or
15816 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15817 precision of division results to about 16 bits for
15818 single precision and to 32 bits for double precision.
15819
15820 @item -mtrack-speculation
15821 @itemx -mno-track-speculation
15822 Enable or disable generation of additional code to track speculative
15823 execution through conditional branches. The tracking state can then
15824 be used by the compiler when expanding calls to
15825 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15826 sequence to be generated.
15827
15828 @item -march=@var{name}
15829 @opindex march
15830 Specify the name of the target architecture and, optionally, one or
15831 more feature modifiers. This option has the form
15832 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15833
15834 The permissible values for @var{arch} are @samp{armv8-a},
15835 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15836 @samp{armv8.5-a} or @var{native}.
15837
15838 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15839 support for the ARMv8.5-A architecture extensions.
15840
15841 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15842 support for the ARMv8.4-A architecture extensions.
15843
15844 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15845 support for the ARMv8.3-A architecture extensions.
15846
15847 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15848 support for the ARMv8.2-A architecture extensions.
15849
15850 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15851 support for the ARMv8.1-A architecture extension. In particular, it
15852 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15853
15854 The value @samp{native} is available on native AArch64 GNU/Linux and
15855 causes the compiler to pick the architecture of the host system. This
15856 option has no effect if the compiler is unable to recognize the
15857 architecture of the host system,
15858
15859 The permissible values for @var{feature} are listed in the sub-section
15860 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15861 Feature Modifiers}. Where conflicting feature modifiers are
15862 specified, the right-most feature is used.
15863
15864 GCC uses @var{name} to determine what kind of instructions it can emit
15865 when generating assembly code. If @option{-march} is specified
15866 without either of @option{-mtune} or @option{-mcpu} also being
15867 specified, the code is tuned to perform well across a range of target
15868 processors implementing the target architecture.
15869
15870 @item -mtune=@var{name}
15871 @opindex mtune
15872 Specify the name of the target processor for which GCC should tune the
15873 performance of the code. Permissible values for this option are:
15874 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15875 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15876 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15877 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15878 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15879 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15880 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15881 @samp{thunderxt83}, @samp{thunderx2t99},
15882 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15883 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15884 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15885 @samp{native}.
15886
15887 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15888 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15889 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15890 should tune for a big.LITTLE system.
15891
15892 Additionally on native AArch64 GNU/Linux systems the value
15893 @samp{native} tunes performance to the host system. This option has no effect
15894 if the compiler is unable to recognize the processor of the host system.
15895
15896 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15897 are specified, the code is tuned to perform well across a range
15898 of target processors.
15899
15900 This option cannot be suffixed by feature modifiers.
15901
15902 @item -mcpu=@var{name}
15903 @opindex mcpu
15904 Specify the name of the target processor, optionally suffixed by one
15905 or more feature modifiers. This option has the form
15906 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15907 the permissible values for @var{cpu} are the same as those available
15908 for @option{-mtune}. The permissible values for @var{feature} are
15909 documented in the sub-section on
15910 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15911 Feature Modifiers}. Where conflicting feature modifiers are
15912 specified, the right-most feature is used.
15913
15914 GCC uses @var{name} to determine what kind of instructions it can emit when
15915 generating assembly code (as if by @option{-march}) and to determine
15916 the target processor for which to tune for performance (as if
15917 by @option{-mtune}). Where this option is used in conjunction
15918 with @option{-march} or @option{-mtune}, those options take precedence
15919 over the appropriate part of this option.
15920
15921 @item -moverride=@var{string}
15922 @opindex moverride
15923 Override tuning decisions made by the back-end in response to a
15924 @option{-mtune=} switch. The syntax, semantics, and accepted values
15925 for @var{string} in this option are not guaranteed to be consistent
15926 across releases.
15927
15928 This option is only intended to be useful when developing GCC.
15929
15930 @item -mverbose-cost-dump
15931 @opindex mverbose-cost-dump
15932 Enable verbose cost model dumping in the debug dump files. This option is
15933 provided for use in debugging the compiler.
15934
15935 @item -mpc-relative-literal-loads
15936 @itemx -mno-pc-relative-literal-loads
15937 @opindex mpc-relative-literal-loads
15938 @opindex mno-pc-relative-literal-loads
15939 Enable or disable PC-relative literal loads. With this option literal pools are
15940 accessed using a single instruction and emitted after each function. This
15941 limits the maximum size of functions to 1MB. This is enabled by default for
15942 @option{-mcmodel=tiny}.
15943
15944 @item -msign-return-address=@var{scope}
15945 @opindex msign-return-address
15946 Select the function scope on which return address signing will be applied.
15947 Permissible values are @samp{none}, which disables return address signing,
15948 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15949 functions, and @samp{all}, which enables pointer signing for all functions. The
15950 default value is @samp{none}. This option has been deprecated by
15951 -mbranch-protection.
15952
15953 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15954 @opindex mbranch-protection
15955 Select the branch protection features to use.
15956 @samp{none} is the default and turns off all types of branch protection.
15957 @samp{standard} turns on all types of branch protection features. If a feature
15958 has additional tuning options, then @samp{standard} sets it to its standard
15959 level.
15960 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15961 level: signing functions that save the return address to memory (non-leaf
15962 functions will practically always do this) using the a-key. The optional
15963 argument @samp{leaf} can be used to extend the signing to include leaf
15964 functions. The optional argument @samp{b-key} can be used to sign the functions
15965 with the B-key instead of the A-key.
15966 @samp{bti} turns on branch target identification mechanism.
15967
15968 @item -msve-vector-bits=@var{bits}
15969 @opindex msve-vector-bits
15970 Specify the number of bits in an SVE vector register. This option only has
15971 an effect when SVE is enabled.
15972
15973 GCC supports two forms of SVE code generation: ``vector-length
15974 agnostic'' output that works with any size of vector register and
15975 ``vector-length specific'' output that allows GCC to make assumptions
15976 about the vector length when it is useful for optimization reasons.
15977 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15978 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15979 Specifying @samp{scalable} selects vector-length agnostic
15980 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15981 agnostic output. All other values generate vector-length specific code.
15982 The behavior of these values may change in future releases and no value except
15983 @samp{scalable} should be relied on for producing code that is portable across
15984 different hardware SVE vector lengths.
15985
15986 The default is @samp{-msve-vector-bits=scalable}, which produces
15987 vector-length agnostic code.
15988 @end table
15989
15990 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15991 @anchor{aarch64-feature-modifiers}
15992 @cindex @option{-march} feature modifiers
15993 @cindex @option{-mcpu} feature modifiers
15994 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15995 the following and their inverses @option{no@var{feature}}:
15996
15997 @table @samp
15998 @item crc
15999 Enable CRC extension. This is on by default for
16000 @option{-march=armv8.1-a}.
16001 @item crypto
16002 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16003 instructions.
16004 @item fp
16005 Enable floating-point instructions. This is on by default for all possible
16006 values for options @option{-march} and @option{-mcpu}.
16007 @item simd
16008 Enable Advanced SIMD instructions. This also enables floating-point
16009 instructions. This is on by default for all possible values for options
16010 @option{-march} and @option{-mcpu}.
16011 @item sve
16012 Enable Scalable Vector Extension instructions. This also enables Advanced
16013 SIMD and floating-point instructions.
16014 @item lse
16015 Enable Large System Extension instructions. This is on by default for
16016 @option{-march=armv8.1-a}.
16017 @item rdma
16018 Enable Round Double Multiply Accumulate instructions. This is on by default
16019 for @option{-march=armv8.1-a}.
16020 @item fp16
16021 Enable FP16 extension. This also enables floating-point instructions.
16022 @item fp16fml
16023 Enable FP16 fmla extension. This also enables FP16 extensions and
16024 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.
16025
16026 @item rcpc
16027 Enable the RcPc extension. This does not change code generation from GCC,
16028 but is passed on to the assembler, enabling inline asm statements to use
16029 instructions from the RcPc extension.
16030 @item dotprod
16031 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16032 @item aes
16033 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16034 SIMD instructions.
16035 @item sha2
16036 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16037 @item sha3
16038 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16039 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16040 @item sm4
16041 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16042 Use of this option with architectures prior to Armv8.2-A is not supported.
16043 @item profile
16044 Enable the Statistical Profiling extension. This option is only to enable the
16045 extension at the assembler level and does not affect code generation.
16046 @item rng
16047 Enable the Armv8.5-a Random Number instructions. This option is only to
16048 enable the extension at the assembler level and does not affect code
16049 generation.
16050 @item memtag
16051 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16052 enable the extension at the assembler level and does not affect code
16053 generation.
16054 @item sb
16055 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16056 enable the extension at the assembler level and does not affect code
16057 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16058 @item ssbs
16059 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16060 is only to enable the extension at the assembler level and does not affect code
16061 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16062 @item predres
16063 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16064 This option is only to enable the extension at the assembler level and does
16065 not affect code generation. This option is enabled by default for
16066 @item sve2
16067 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16068 instructions.
16069 @item bitperm
16070 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16071 @item sve2-sm4
16072 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16073 @item sve2-aes
16074 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16075 @item sve2-sha3
16076 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16077 @option{-march=armv8.5-a}.
16078
16079 @end table
16080
16081 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16082 which implies @option{fp}.
16083 Conversely, @option{nofp} implies @option{nosimd}, which implies
16084 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16085
16086 @node Adapteva Epiphany Options
16087 @subsection Adapteva Epiphany Options
16088
16089 These @samp{-m} options are defined for Adapteva Epiphany:
16090
16091 @table @gcctabopt
16092 @item -mhalf-reg-file
16093 @opindex mhalf-reg-file
16094 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16095 That allows code to run on hardware variants that lack these registers.
16096
16097 @item -mprefer-short-insn-regs
16098 @opindex mprefer-short-insn-regs
16099 Preferentially allocate registers that allow short instruction generation.
16100 This can result in increased instruction count, so this may either reduce or
16101 increase overall code size.
16102
16103 @item -mbranch-cost=@var{num}
16104 @opindex mbranch-cost
16105 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16106 This cost is only a heuristic and is not guaranteed to produce
16107 consistent results across releases.
16108
16109 @item -mcmove
16110 @opindex mcmove
16111 Enable the generation of conditional moves.
16112
16113 @item -mnops=@var{num}
16114 @opindex mnops
16115 Emit @var{num} NOPs before every other generated instruction.
16116
16117 @item -mno-soft-cmpsf
16118 @opindex mno-soft-cmpsf
16119 @opindex msoft-cmpsf
16120 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16121 and test the flags. This is faster than a software comparison, but can
16122 get incorrect results in the presence of NaNs, or when two different small
16123 numbers are compared such that their difference is calculated as zero.
16124 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16125 software comparisons.
16126
16127 @item -mstack-offset=@var{num}
16128 @opindex mstack-offset
16129 Set the offset between the top of the stack and the stack pointer.
16130 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16131 can be used by leaf functions without stack allocation.
16132 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16133 Note also that this option changes the ABI; compiling a program with a
16134 different stack offset than the libraries have been compiled with
16135 generally does not work.
16136 This option can be useful if you want to evaluate if a different stack
16137 offset would give you better code, but to actually use a different stack
16138 offset to build working programs, it is recommended to configure the
16139 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16140
16141 @item -mno-round-nearest
16142 @opindex mno-round-nearest
16143 @opindex mround-nearest
16144 Make the scheduler assume that the rounding mode has been set to
16145 truncating. The default is @option{-mround-nearest}.
16146
16147 @item -mlong-calls
16148 @opindex mlong-calls
16149 If not otherwise specified by an attribute, assume all calls might be beyond
16150 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16151 function address into a register before performing a (otherwise direct) call.
16152 This is the default.
16153
16154 @item -mshort-calls
16155 @opindex short-calls
16156 If not otherwise specified by an attribute, assume all direct calls are
16157 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16158 for direct calls. The default is @option{-mlong-calls}.
16159
16160 @item -msmall16
16161 @opindex msmall16
16162 Assume addresses can be loaded as 16-bit unsigned values. This does not
16163 apply to function addresses for which @option{-mlong-calls} semantics
16164 are in effect.
16165
16166 @item -mfp-mode=@var{mode}
16167 @opindex mfp-mode
16168 Set the prevailing mode of the floating-point unit.
16169 This determines the floating-point mode that is provided and expected
16170 at function call and return time. Making this mode match the mode you
16171 predominantly need at function start can make your programs smaller and
16172 faster by avoiding unnecessary mode switches.
16173
16174 @var{mode} can be set to one the following values:
16175
16176 @table @samp
16177 @item caller
16178 Any mode at function entry is valid, and retained or restored when
16179 the function returns, and when it calls other functions.
16180 This mode is useful for compiling libraries or other compilation units
16181 you might want to incorporate into different programs with different
16182 prevailing FPU modes, and the convenience of being able to use a single
16183 object file outweighs the size and speed overhead for any extra
16184 mode switching that might be needed, compared with what would be needed
16185 with a more specific choice of prevailing FPU mode.
16186
16187 @item truncate
16188 This is the mode used for floating-point calculations with
16189 truncating (i.e.@: round towards zero) rounding mode. That includes
16190 conversion from floating point to integer.
16191
16192 @item round-nearest
16193 This is the mode used for floating-point calculations with
16194 round-to-nearest-or-even rounding mode.
16195
16196 @item int
16197 This is the mode used to perform integer calculations in the FPU, e.g.@:
16198 integer multiply, or integer multiply-and-accumulate.
16199 @end table
16200
16201 The default is @option{-mfp-mode=caller}
16202
16203 @item -mno-split-lohi
16204 @itemx -mno-postinc
16205 @itemx -mno-postmodify
16206 @opindex mno-split-lohi
16207 @opindex msplit-lohi
16208 @opindex mno-postinc
16209 @opindex mpostinc
16210 @opindex mno-postmodify
16211 @opindex mpostmodify
16212 Code generation tweaks that disable, respectively, splitting of 32-bit
16213 loads, generation of post-increment addresses, and generation of
16214 post-modify addresses. The defaults are @option{msplit-lohi},
16215 @option{-mpost-inc}, and @option{-mpost-modify}.
16216
16217 @item -mnovect-double
16218 @opindex mno-vect-double
16219 @opindex mvect-double
16220 Change the preferred SIMD mode to SImode. The default is
16221 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16222
16223 @item -max-vect-align=@var{num}
16224 @opindex max-vect-align
16225 The maximum alignment for SIMD vector mode types.
16226 @var{num} may be 4 or 8. The default is 8.
16227 Note that this is an ABI change, even though many library function
16228 interfaces are unaffected if they don't use SIMD vector modes
16229 in places that affect size and/or alignment of relevant types.
16230
16231 @item -msplit-vecmove-early
16232 @opindex msplit-vecmove-early
16233 Split vector moves into single word moves before reload. In theory this
16234 can give better register allocation, but so far the reverse seems to be
16235 generally the case.
16236
16237 @item -m1reg-@var{reg}
16238 @opindex m1reg-
16239 Specify a register to hold the constant @minus{}1, which makes loading small negative
16240 constants and certain bitmasks faster.
16241 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16242 which specify use of that register as a fixed register,
16243 and @samp{none}, which means that no register is used for this
16244 purpose. The default is @option{-m1reg-none}.
16245
16246 @end table
16247
16248 @node AMD GCN Options
16249 @subsection AMD GCN Options
16250 @cindex AMD GCN Options
16251
16252 These options are defined specifically for the AMD GCN port.
16253
16254 @table @gcctabopt
16255
16256 @item -march=@var{gpu}
16257 @opindex march
16258 @itemx -mtune=@var{gpu}
16259 @opindex mtune
16260 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16261 are
16262
16263 @table @samp
16264 @opindex fiji
16265 @item fiji
16266 Compile for GCN3 Fiji devices (gfx803).
16267
16268 @item gfx900
16269 Compile for GCN5 Vega 10 devices (gfx900).
16270
16271 @item gfx906
16272 Compile for GCN5 Vega 20 devices (gfx906).
16273
16274 @end table
16275
16276 @item -mstack-size=@var{bytes}
16277 @opindex mstack-size
16278 Specify how many @var{bytes} of stack space will be requested for each GPU
16279 thread (wave-front). Beware that there may be many threads and limited memory
16280 available. The size of the stack allocation may also have an impact on
16281 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16282 1MB otherwise.
16283
16284 @end table
16285
16286 @node ARC Options
16287 @subsection ARC Options
16288 @cindex ARC options
16289
16290 The following options control the architecture variant for which code
16291 is being compiled:
16292
16293 @c architecture variants
16294 @table @gcctabopt
16295
16296 @item -mbarrel-shifter
16297 @opindex mbarrel-shifter
16298 Generate instructions supported by barrel shifter. This is the default
16299 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16300
16301 @item -mjli-always
16302 @opindex mjli-alawys
16303 Force to call a function using jli_s instruction. This option is
16304 valid only for ARCv2 architecture.
16305
16306 @item -mcpu=@var{cpu}
16307 @opindex mcpu
16308 Set architecture type, register usage, and instruction scheduling
16309 parameters for @var{cpu}. There are also shortcut alias options
16310 available for backward compatibility and convenience. Supported
16311 values for @var{cpu} are
16312
16313 @table @samp
16314 @opindex mA6
16315 @opindex mARC600
16316 @item arc600
16317 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16318
16319 @item arc601
16320 @opindex mARC601
16321 Compile for ARC601. Alias: @option{-mARC601}.
16322
16323 @item arc700
16324 @opindex mA7
16325 @opindex mARC700
16326 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16327 This is the default when configured with @option{--with-cpu=arc700}@.
16328
16329 @item arcem
16330 Compile for ARC EM.
16331
16332 @item archs
16333 Compile for ARC HS.
16334
16335 @item em
16336 Compile for ARC EM CPU with no hardware extensions.
16337
16338 @item em4
16339 Compile for ARC EM4 CPU.
16340
16341 @item em4_dmips
16342 Compile for ARC EM4 DMIPS CPU.
16343
16344 @item em4_fpus
16345 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16346 extension.
16347
16348 @item em4_fpuda
16349 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16350 double assist instructions.
16351
16352 @item hs
16353 Compile for ARC HS CPU with no hardware extensions except the atomic
16354 instructions.
16355
16356 @item hs34
16357 Compile for ARC HS34 CPU.
16358
16359 @item hs38
16360 Compile for ARC HS38 CPU.
16361
16362 @item hs38_linux
16363 Compile for ARC HS38 CPU with all hardware extensions on.
16364
16365 @item arc600_norm
16366 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16367
16368 @item arc600_mul32x16
16369 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16370 instructions enabled.
16371
16372 @item arc600_mul64
16373 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16374 instructions enabled.
16375
16376 @item arc601_norm
16377 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16378
16379 @item arc601_mul32x16
16380 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16381 instructions enabled.
16382
16383 @item arc601_mul64
16384 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16385 instructions enabled.
16386
16387 @item nps400
16388 Compile for ARC 700 on NPS400 chip.
16389
16390 @item em_mini
16391 Compile for ARC EM minimalist configuration featuring reduced register
16392 set.
16393
16394 @end table
16395
16396 @item -mdpfp
16397 @opindex mdpfp
16398 @itemx -mdpfp-compact
16399 @opindex mdpfp-compact
16400 Generate double-precision FPX instructions, tuned for the compact
16401 implementation.
16402
16403 @item -mdpfp-fast
16404 @opindex mdpfp-fast
16405 Generate double-precision FPX instructions, tuned for the fast
16406 implementation.
16407
16408 @item -mno-dpfp-lrsr
16409 @opindex mno-dpfp-lrsr
16410 Disable @code{lr} and @code{sr} instructions from using FPX extension
16411 aux registers.
16412
16413 @item -mea
16414 @opindex mea
16415 Generate extended arithmetic instructions. Currently only
16416 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16417 supported. This is always enabled for @option{-mcpu=ARC700}.
16418
16419 @item -mno-mpy
16420 @opindex mno-mpy
16421 @opindex mmpy
16422 Do not generate @code{mpy}-family instructions for ARC700. This option is
16423 deprecated.
16424
16425 @item -mmul32x16
16426 @opindex mmul32x16
16427 Generate 32x16-bit multiply and multiply-accumulate instructions.
16428
16429 @item -mmul64
16430 @opindex mmul64
16431 Generate @code{mul64} and @code{mulu64} instructions.
16432 Only valid for @option{-mcpu=ARC600}.
16433
16434 @item -mnorm
16435 @opindex mnorm
16436 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16437 is in effect.
16438
16439 @item -mspfp
16440 @opindex mspfp
16441 @itemx -mspfp-compact
16442 @opindex mspfp-compact
16443 Generate single-precision FPX instructions, tuned for the compact
16444 implementation.
16445
16446 @item -mspfp-fast
16447 @opindex mspfp-fast
16448 Generate single-precision FPX instructions, tuned for the fast
16449 implementation.
16450
16451 @item -msimd
16452 @opindex msimd
16453 Enable generation of ARC SIMD instructions via target-specific
16454 builtins. Only valid for @option{-mcpu=ARC700}.
16455
16456 @item -msoft-float
16457 @opindex msoft-float
16458 This option ignored; it is provided for compatibility purposes only.
16459 Software floating-point code is emitted by default, and this default
16460 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16461 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16462 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16463
16464 @item -mswap
16465 @opindex mswap
16466 Generate @code{swap} instructions.
16467
16468 @item -matomic
16469 @opindex matomic
16470 This enables use of the locked load/store conditional extension to implement
16471 atomic memory built-in functions. Not available for ARC 6xx or ARC
16472 EM cores.
16473
16474 @item -mdiv-rem
16475 @opindex mdiv-rem
16476 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16477
16478 @item -mcode-density
16479 @opindex mcode-density
16480 Enable code density instructions for ARC EM.
16481 This option is on by default for ARC HS.
16482
16483 @item -mll64
16484 @opindex mll64
16485 Enable double load/store operations for ARC HS cores.
16486
16487 @item -mtp-regno=@var{regno}
16488 @opindex mtp-regno
16489 Specify thread pointer register number.
16490
16491 @item -mmpy-option=@var{multo}
16492 @opindex mmpy-option
16493 Compile ARCv2 code with a multiplier design option. You can specify
16494 the option using either a string or numeric value for @var{multo}.
16495 @samp{wlh1} is the default value. The recognized values are:
16496
16497 @table @samp
16498 @item 0
16499 @itemx none
16500 No multiplier available.
16501
16502 @item 1
16503 @itemx w
16504 16x16 multiplier, fully pipelined.
16505 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16506
16507 @item 2
16508 @itemx wlh1
16509 32x32 multiplier, fully
16510 pipelined (1 stage). The following instructions are additionally
16511 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16512
16513 @item 3
16514 @itemx wlh2
16515 32x32 multiplier, fully pipelined
16516 (2 stages). The following instructions are additionally enabled: @code{mpy},
16517 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16518
16519 @item 4
16520 @itemx wlh3
16521 Two 16x16 multipliers, blocking,
16522 sequential. The following instructions are additionally enabled: @code{mpy},
16523 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16524
16525 @item 5
16526 @itemx wlh4
16527 One 16x16 multiplier, blocking,
16528 sequential. The following instructions are additionally enabled: @code{mpy},
16529 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16530
16531 @item 6
16532 @itemx wlh5
16533 One 32x4 multiplier, blocking,
16534 sequential. The following instructions are additionally enabled: @code{mpy},
16535 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16536
16537 @item 7
16538 @itemx plus_dmpy
16539 ARC HS SIMD support.
16540
16541 @item 8
16542 @itemx plus_macd
16543 ARC HS SIMD support.
16544
16545 @item 9
16546 @itemx plus_qmacw
16547 ARC HS SIMD support.
16548
16549 @end table
16550
16551 This option is only available for ARCv2 cores@.
16552
16553 @item -mfpu=@var{fpu}
16554 @opindex mfpu
16555 Enables support for specific floating-point hardware extensions for ARCv2
16556 cores. Supported values for @var{fpu} are:
16557
16558 @table @samp
16559
16560 @item fpus
16561 Enables support for single-precision floating-point hardware
16562 extensions@.
16563
16564 @item fpud
16565 Enables support for double-precision floating-point hardware
16566 extensions. The single-precision floating-point extension is also
16567 enabled. Not available for ARC EM@.
16568
16569 @item fpuda
16570 Enables support for double-precision floating-point hardware
16571 extensions using double-precision assist instructions. The single-precision
16572 floating-point extension is also enabled. This option is
16573 only available for ARC EM@.
16574
16575 @item fpuda_div
16576 Enables support for double-precision floating-point hardware
16577 extensions using double-precision assist instructions.
16578 The single-precision floating-point, square-root, and divide
16579 extensions are also enabled. This option is
16580 only available for ARC EM@.
16581
16582 @item fpuda_fma
16583 Enables support for double-precision floating-point hardware
16584 extensions using double-precision assist instructions.
16585 The single-precision floating-point and fused multiply and add
16586 hardware extensions are also enabled. This option is
16587 only available for ARC EM@.
16588
16589 @item fpuda_all
16590 Enables support for double-precision floating-point hardware
16591 extensions using double-precision assist instructions.
16592 All single-precision floating-point hardware extensions are also
16593 enabled. This option is only available for ARC EM@.
16594
16595 @item fpus_div
16596 Enables support for single-precision floating-point, square-root and divide
16597 hardware extensions@.
16598
16599 @item fpud_div
16600 Enables support for double-precision floating-point, square-root and divide
16601 hardware extensions. This option
16602 includes option @samp{fpus_div}. Not available for ARC EM@.
16603
16604 @item fpus_fma
16605 Enables support for single-precision floating-point and
16606 fused multiply and add hardware extensions@.
16607
16608 @item fpud_fma
16609 Enables support for double-precision floating-point and
16610 fused multiply and add hardware extensions. This option
16611 includes option @samp{fpus_fma}. Not available for ARC EM@.
16612
16613 @item fpus_all
16614 Enables support for all single-precision floating-point hardware
16615 extensions@.
16616
16617 @item fpud_all
16618 Enables support for all single- and double-precision floating-point
16619 hardware extensions. Not available for ARC EM@.
16620
16621 @end table
16622
16623 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16624 @opindex mirq-ctrl-saved
16625 Specifies general-purposes registers that the processor automatically
16626 saves/restores on interrupt entry and exit. @var{register-range} is
16627 specified as two registers separated by a dash. The register range
16628 always starts with @code{r0}, the upper limit is @code{fp} register.
16629 @var{blink} and @var{lp_count} are optional. This option is only
16630 valid for ARC EM and ARC HS cores.
16631
16632 @item -mrgf-banked-regs=@var{number}
16633 @opindex mrgf-banked-regs
16634 Specifies the number of registers replicated in second register bank
16635 on entry to fast interrupt. Fast interrupts are interrupts with the
16636 highest priority level P0. These interrupts save only PC and STATUS32
16637 registers to avoid memory transactions during interrupt entry and exit
16638 sequences. Use this option when you are using fast interrupts in an
16639 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16640
16641 @item -mlpc-width=@var{width}
16642 @opindex mlpc-width
16643 Specify the width of the @code{lp_count} register. Valid values for
16644 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16645 fixed to 32 bits. If the width is less than 32, the compiler does not
16646 attempt to transform loops in your program to use the zero-delay loop
16647 mechanism unless it is known that the @code{lp_count} register can
16648 hold the required loop-counter value. Depending on the width
16649 specified, the compiler and run-time library might continue to use the
16650 loop mechanism for various needs. This option defines macro
16651 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16652
16653 @item -mrf16
16654 @opindex mrf16
16655 This option instructs the compiler to generate code for a 16-entry
16656 register file. This option defines the @code{__ARC_RF16__}
16657 preprocessor macro.
16658
16659 @item -mbranch-index
16660 @opindex mbranch-index
16661 Enable use of @code{bi} or @code{bih} instructions to implement jump
16662 tables.
16663
16664 @end table
16665
16666 The following options are passed through to the assembler, and also
16667 define preprocessor macro symbols.
16668
16669 @c Flags used by the assembler, but for which we define preprocessor
16670 @c macro symbols as well.
16671 @table @gcctabopt
16672 @item -mdsp-packa
16673 @opindex mdsp-packa
16674 Passed down to the assembler to enable the DSP Pack A extensions.
16675 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16676 deprecated.
16677
16678 @item -mdvbf
16679 @opindex mdvbf
16680 Passed down to the assembler to enable the dual Viterbi butterfly
16681 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16682 option is deprecated.
16683
16684 @c ARC700 4.10 extension instruction
16685 @item -mlock
16686 @opindex mlock
16687 Passed down to the assembler to enable the locked load/store
16688 conditional extension. Also sets the preprocessor symbol
16689 @code{__Xlock}.
16690
16691 @item -mmac-d16
16692 @opindex mmac-d16
16693 Passed down to the assembler. Also sets the preprocessor symbol
16694 @code{__Xxmac_d16}. This option is deprecated.
16695
16696 @item -mmac-24
16697 @opindex mmac-24
16698 Passed down to the assembler. Also sets the preprocessor symbol
16699 @code{__Xxmac_24}. This option is deprecated.
16700
16701 @c ARC700 4.10 extension instruction
16702 @item -mrtsc
16703 @opindex mrtsc
16704 Passed down to the assembler to enable the 64-bit time-stamp counter
16705 extension instruction. Also sets the preprocessor symbol
16706 @code{__Xrtsc}. This option is deprecated.
16707
16708 @c ARC700 4.10 extension instruction
16709 @item -mswape
16710 @opindex mswape
16711 Passed down to the assembler to enable the swap byte ordering
16712 extension instruction. Also sets the preprocessor symbol
16713 @code{__Xswape}.
16714
16715 @item -mtelephony
16716 @opindex mtelephony
16717 Passed down to the assembler to enable dual- and single-operand
16718 instructions for telephony. Also sets the preprocessor symbol
16719 @code{__Xtelephony}. This option is deprecated.
16720
16721 @item -mxy
16722 @opindex mxy
16723 Passed down to the assembler to enable the XY memory extension. Also
16724 sets the preprocessor symbol @code{__Xxy}.
16725
16726 @end table
16727
16728 The following options control how the assembly code is annotated:
16729
16730 @c Assembly annotation options
16731 @table @gcctabopt
16732 @item -misize
16733 @opindex misize
16734 Annotate assembler instructions with estimated addresses.
16735
16736 @item -mannotate-align
16737 @opindex mannotate-align
16738 Explain what alignment considerations lead to the decision to make an
16739 instruction short or long.
16740
16741 @end table
16742
16743 The following options are passed through to the linker:
16744
16745 @c options passed through to the linker
16746 @table @gcctabopt
16747 @item -marclinux
16748 @opindex marclinux
16749 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16750 This option is enabled by default in tool chains built for
16751 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16752 when profiling is not requested.
16753
16754 @item -marclinux_prof
16755 @opindex marclinux_prof
16756 Passed through to the linker, to specify use of the
16757 @code{arclinux_prof} emulation. This option is enabled by default in
16758 tool chains built for @w{@code{arc-linux-uclibc}} and
16759 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16760
16761 @end table
16762
16763 The following options control the semantics of generated code:
16764
16765 @c semantically relevant code generation options
16766 @table @gcctabopt
16767 @item -mlong-calls
16768 @opindex mlong-calls
16769 Generate calls as register indirect calls, thus providing access
16770 to the full 32-bit address range.
16771
16772 @item -mmedium-calls
16773 @opindex mmedium-calls
16774 Don't use less than 25-bit addressing range for calls, which is the
16775 offset available for an unconditional branch-and-link
16776 instruction. Conditional execution of function calls is suppressed, to
16777 allow use of the 25-bit range, rather than the 21-bit range with
16778 conditional branch-and-link. This is the default for tool chains built
16779 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16780
16781 @item -G @var{num}
16782 @opindex G
16783 Put definitions of externally-visible data in a small data section if
16784 that data is no bigger than @var{num} bytes. The default value of
16785 @var{num} is 4 for any ARC configuration, or 8 when we have double
16786 load/store operations.
16787
16788 @item -mno-sdata
16789 @opindex mno-sdata
16790 @opindex msdata
16791 Do not generate sdata references. This is the default for tool chains
16792 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16793 targets.
16794
16795 @item -mvolatile-cache
16796 @opindex mvolatile-cache
16797 Use ordinarily cached memory accesses for volatile references. This is the
16798 default.
16799
16800 @item -mno-volatile-cache
16801 @opindex mno-volatile-cache
16802 @opindex mvolatile-cache
16803 Enable cache bypass for volatile references.
16804
16805 @end table
16806
16807 The following options fine tune code generation:
16808 @c code generation tuning options
16809 @table @gcctabopt
16810 @item -malign-call
16811 @opindex malign-call
16812 Do alignment optimizations for call instructions.
16813
16814 @item -mauto-modify-reg
16815 @opindex mauto-modify-reg
16816 Enable the use of pre/post modify with register displacement.
16817
16818 @item -mbbit-peephole
16819 @opindex mbbit-peephole
16820 Enable bbit peephole2.
16821
16822 @item -mno-brcc
16823 @opindex mno-brcc
16824 This option disables a target-specific pass in @file{arc_reorg} to
16825 generate compare-and-branch (@code{br@var{cc}}) instructions.
16826 It has no effect on
16827 generation of these instructions driven by the combiner pass.
16828
16829 @item -mcase-vector-pcrel
16830 @opindex mcase-vector-pcrel
16831 Use PC-relative switch case tables to enable case table shortening.
16832 This is the default for @option{-Os}.
16833
16834 @item -mcompact-casesi
16835 @opindex mcompact-casesi
16836 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16837 and only available for ARCv1 cores. This option is deprecated.
16838
16839 @item -mno-cond-exec
16840 @opindex mno-cond-exec
16841 Disable the ARCompact-specific pass to generate conditional
16842 execution instructions.
16843
16844 Due to delay slot scheduling and interactions between operand numbers,
16845 literal sizes, instruction lengths, and the support for conditional execution,
16846 the target-independent pass to generate conditional execution is often lacking,
16847 so the ARC port has kept a special pass around that tries to find more
16848 conditional execution generation opportunities after register allocation,
16849 branch shortening, and delay slot scheduling have been done. This pass
16850 generally, but not always, improves performance and code size, at the cost of
16851 extra compilation time, which is why there is an option to switch it off.
16852 If you have a problem with call instructions exceeding their allowable
16853 offset range because they are conditionalized, you should consider using
16854 @option{-mmedium-calls} instead.
16855
16856 @item -mearly-cbranchsi
16857 @opindex mearly-cbranchsi
16858 Enable pre-reload use of the @code{cbranchsi} pattern.
16859
16860 @item -mexpand-adddi
16861 @opindex mexpand-adddi
16862 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16863 @code{add.f}, @code{adc} etc. This option is deprecated.
16864
16865 @item -mindexed-loads
16866 @opindex mindexed-loads
16867 Enable the use of indexed loads. This can be problematic because some
16868 optimizers then assume that indexed stores exist, which is not
16869 the case.
16870
16871 @item -mlra
16872 @opindex mlra
16873 Enable Local Register Allocation. This is still experimental for ARC,
16874 so by default the compiler uses standard reload
16875 (i.e.@: @option{-mno-lra}).
16876
16877 @item -mlra-priority-none
16878 @opindex mlra-priority-none
16879 Don't indicate any priority for target registers.
16880
16881 @item -mlra-priority-compact
16882 @opindex mlra-priority-compact
16883 Indicate target register priority for r0..r3 / r12..r15.
16884
16885 @item -mlra-priority-noncompact
16886 @opindex mlra-priority-noncompact
16887 Reduce target register priority for r0..r3 / r12..r15.
16888
16889 @item -mmillicode
16890 @opindex mmillicode
16891 When optimizing for size (using @option{-Os}), prologues and epilogues
16892 that have to save or restore a large number of registers are often
16893 shortened by using call to a special function in libgcc; this is
16894 referred to as a @emph{millicode} call. As these calls can pose
16895 performance issues, and/or cause linking issues when linking in a
16896 nonstandard way, this option is provided to turn on or off millicode
16897 call generation.
16898
16899 @item -mcode-density-frame
16900 @opindex mcode-density-frame
16901 This option enable the compiler to emit @code{enter} and @code{leave}
16902 instructions. These instructions are only valid for CPUs with
16903 code-density feature.
16904
16905 @item -mmixed-code
16906 @opindex mmixed-code
16907 Tweak register allocation to help 16-bit instruction generation.
16908 This generally has the effect of decreasing the average instruction size
16909 while increasing the instruction count.
16910
16911 @item -mq-class
16912 @opindex mq-class
16913 Enable @samp{q} instruction alternatives.
16914 This is the default for @option{-Os}.
16915
16916 @item -mRcq
16917 @opindex mRcq
16918 Enable @samp{Rcq} constraint handling.
16919 Most short code generation depends on this.
16920 This is the default.
16921
16922 @item -mRcw
16923 @opindex mRcw
16924 Enable @samp{Rcw} constraint handling.
16925 Most ccfsm condexec mostly depends on this.
16926 This is the default.
16927
16928 @item -msize-level=@var{level}
16929 @opindex msize-level
16930 Fine-tune size optimization with regards to instruction lengths and alignment.
16931 The recognized values for @var{level} are:
16932 @table @samp
16933 @item 0
16934 No size optimization. This level is deprecated and treated like @samp{1}.
16935
16936 @item 1
16937 Short instructions are used opportunistically.
16938
16939 @item 2
16940 In addition, alignment of loops and of code after barriers are dropped.
16941
16942 @item 3
16943 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16944
16945 @end table
16946
16947 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16948 the behavior when this is not set is equivalent to level @samp{1}.
16949
16950 @item -mtune=@var{cpu}
16951 @opindex mtune
16952 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16953 by @option{-mcpu=}.
16954
16955 Supported values for @var{cpu} are
16956
16957 @table @samp
16958 @item ARC600
16959 Tune for ARC600 CPU.
16960
16961 @item ARC601
16962 Tune for ARC601 CPU.
16963
16964 @item ARC700
16965 Tune for ARC700 CPU with standard multiplier block.
16966
16967 @item ARC700-xmac
16968 Tune for ARC700 CPU with XMAC block.
16969
16970 @item ARC725D
16971 Tune for ARC725D CPU.
16972
16973 @item ARC750D
16974 Tune for ARC750D CPU.
16975
16976 @end table
16977
16978 @item -mmultcost=@var{num}
16979 @opindex mmultcost
16980 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16981 normal instruction.
16982
16983 @item -munalign-prob-threshold=@var{probability}
16984 @opindex munalign-prob-threshold
16985 Set probability threshold for unaligning branches.
16986 When tuning for @samp{ARC700} and optimizing for speed, branches without
16987 filled delay slot are preferably emitted unaligned and long, unless
16988 profiling indicates that the probability for the branch to be taken
16989 is below @var{probability}. @xref{Cross-profiling}.
16990 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16991
16992 @end table
16993
16994 The following options are maintained for backward compatibility, but
16995 are now deprecated and will be removed in a future release:
16996
16997 @c Deprecated options
16998 @table @gcctabopt
16999
17000 @item -margonaut
17001 @opindex margonaut
17002 Obsolete FPX.
17003
17004 @item -mbig-endian
17005 @opindex mbig-endian
17006 @itemx -EB
17007 @opindex EB
17008 Compile code for big-endian targets. Use of these options is now
17009 deprecated. Big-endian code is supported by configuring GCC to build
17010 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17011 for which big endian is the default.
17012
17013 @item -mlittle-endian
17014 @opindex mlittle-endian
17015 @itemx -EL
17016 @opindex EL
17017 Compile code for little-endian targets. Use of these options is now
17018 deprecated. Little-endian code is supported by configuring GCC to build
17019 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17020 for which little endian is the default.
17021
17022 @item -mbarrel_shifter
17023 @opindex mbarrel_shifter
17024 Replaced by @option{-mbarrel-shifter}.
17025
17026 @item -mdpfp_compact
17027 @opindex mdpfp_compact
17028 Replaced by @option{-mdpfp-compact}.
17029
17030 @item -mdpfp_fast
17031 @opindex mdpfp_fast
17032 Replaced by @option{-mdpfp-fast}.
17033
17034 @item -mdsp_packa
17035 @opindex mdsp_packa
17036 Replaced by @option{-mdsp-packa}.
17037
17038 @item -mEA
17039 @opindex mEA
17040 Replaced by @option{-mea}.
17041
17042 @item -mmac_24
17043 @opindex mmac_24
17044 Replaced by @option{-mmac-24}.
17045
17046 @item -mmac_d16
17047 @opindex mmac_d16
17048 Replaced by @option{-mmac-d16}.
17049
17050 @item -mspfp_compact
17051 @opindex mspfp_compact
17052 Replaced by @option{-mspfp-compact}.
17053
17054 @item -mspfp_fast
17055 @opindex mspfp_fast
17056 Replaced by @option{-mspfp-fast}.
17057
17058 @item -mtune=@var{cpu}
17059 @opindex mtune
17060 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17061 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17062 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17063
17064 @item -multcost=@var{num}
17065 @opindex multcost
17066 Replaced by @option{-mmultcost}.
17067
17068 @end table
17069
17070 @node ARM Options
17071 @subsection ARM Options
17072 @cindex ARM options
17073
17074 These @samp{-m} options are defined for the ARM port:
17075
17076 @table @gcctabopt
17077 @item -mabi=@var{name}
17078 @opindex mabi
17079 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17080 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17081
17082 @item -mapcs-frame
17083 @opindex mapcs-frame
17084 Generate a stack frame that is compliant with the ARM Procedure Call
17085 Standard for all functions, even if this is not strictly necessary for
17086 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17087 with this option causes the stack frames not to be generated for
17088 leaf functions. The default is @option{-mno-apcs-frame}.
17089 This option is deprecated.
17090
17091 @item -mapcs
17092 @opindex mapcs
17093 This is a synonym for @option{-mapcs-frame} and is deprecated.
17094
17095 @ignore
17096 @c not currently implemented
17097 @item -mapcs-stack-check
17098 @opindex mapcs-stack-check
17099 Generate code to check the amount of stack space available upon entry to
17100 every function (that actually uses some stack space). If there is
17101 insufficient space available then either the function
17102 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17103 called, depending upon the amount of stack space required. The runtime
17104 system is required to provide these functions. The default is
17105 @option{-mno-apcs-stack-check}, since this produces smaller code.
17106
17107 @c not currently implemented
17108 @item -mapcs-reentrant
17109 @opindex mapcs-reentrant
17110 Generate reentrant, position-independent code. The default is
17111 @option{-mno-apcs-reentrant}.
17112 @end ignore
17113
17114 @item -mthumb-interwork
17115 @opindex mthumb-interwork
17116 Generate code that supports calling between the ARM and Thumb
17117 instruction sets. Without this option, on pre-v5 architectures, the
17118 two instruction sets cannot be reliably used inside one program. The
17119 default is @option{-mno-thumb-interwork}, since slightly larger code
17120 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17121 configurations this option is meaningless.
17122
17123 @item -mno-sched-prolog
17124 @opindex mno-sched-prolog
17125 @opindex msched-prolog
17126 Prevent the reordering of instructions in the function prologue, or the
17127 merging of those instruction with the instructions in the function's
17128 body. This means that all functions start with a recognizable set
17129 of instructions (or in fact one of a choice from a small set of
17130 different function prologues), and this information can be used to
17131 locate the start of functions inside an executable piece of code. The
17132 default is @option{-msched-prolog}.
17133
17134 @item -mfloat-abi=@var{name}
17135 @opindex mfloat-abi
17136 Specifies which floating-point ABI to use. Permissible values
17137 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17138
17139 Specifying @samp{soft} causes GCC to generate output containing
17140 library calls for floating-point operations.
17141 @samp{softfp} allows the generation of code using hardware floating-point
17142 instructions, but still uses the soft-float calling conventions.
17143 @samp{hard} allows generation of floating-point instructions
17144 and uses FPU-specific calling conventions.
17145
17146 The default depends on the specific target configuration. Note that
17147 the hard-float and soft-float ABIs are not link-compatible; you must
17148 compile your entire program with the same ABI, and link with a
17149 compatible set of libraries.
17150
17151 @item -mgeneral-regs-only
17152 @opindex mgeneral-regs-only
17153 Generate code which uses only the general-purpose registers. This will prevent
17154 the compiler from using floating-point and Advanced SIMD registers but will not
17155 impose any restrictions on the assembler.
17156
17157 @item -mlittle-endian
17158 @opindex mlittle-endian
17159 Generate code for a processor running in little-endian mode. This is
17160 the default for all standard configurations.
17161
17162 @item -mbig-endian
17163 @opindex mbig-endian
17164 Generate code for a processor running in big-endian mode; the default is
17165 to compile code for a little-endian processor.
17166
17167 @item -mbe8
17168 @itemx -mbe32
17169 @opindex mbe8
17170 When linking a big-endian image select between BE8 and BE32 formats.
17171 The option has no effect for little-endian images and is ignored. The
17172 default is dependent on the selected target architecture. For ARMv6
17173 and later architectures the default is BE8, for older architectures
17174 the default is BE32. BE32 format has been deprecated by ARM.
17175
17176 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17177 @opindex march
17178 This specifies the name of the target ARM architecture. GCC uses this
17179 name to determine what kind of instructions it can emit when generating
17180 assembly code. This option can be used in conjunction with or instead
17181 of the @option{-mcpu=} option.
17182
17183 Permissible names are:
17184 @samp{armv4t},
17185 @samp{armv5t}, @samp{armv5te},
17186 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17187 @samp{armv6z}, @samp{armv6zk},
17188 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17189 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17190 @samp{armv8.4-a},
17191 @samp{armv8.5-a},
17192 @samp{armv7-r},
17193 @samp{armv8-r},
17194 @samp{armv6-m}, @samp{armv6s-m},
17195 @samp{armv7-m}, @samp{armv7e-m},
17196 @samp{armv8-m.base}, @samp{armv8-m.main},
17197 @samp{iwmmxt} and @samp{iwmmxt2}.
17198
17199 Additionally, the following architectures, which lack support for the
17200 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17201
17202 Many of the architectures support extensions. These can be added by
17203 appending @samp{+@var{extension}} to the architecture name. Extension
17204 options are processed in order and capabilities accumulate. An extension
17205 will also enable any necessary base extensions
17206 upon which it depends. For example, the @samp{+crypto} extension
17207 will always enable the @samp{+simd} extension. The exception to the
17208 additive construction is for extensions that are prefixed with
17209 @samp{+no@dots{}}: these extensions disable the specified option and
17210 any other extensions that may depend on the presence of that
17211 extension.
17212
17213 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17214 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17215 entirely disabled by the @samp{+nofp} option that follows it.
17216
17217 Most extension names are generically named, but have an effect that is
17218 dependent upon the architecture to which it is applied. For example,
17219 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17220 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17221 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17222 variant for @samp{armv8-a}.
17223
17224 The table below lists the supported extensions for each architecture.
17225 Architectures not mentioned do not support any extensions.
17226
17227 @table @samp
17228 @item armv5te
17229 @itemx armv6
17230 @itemx armv6j
17231 @itemx armv6k
17232 @itemx armv6kz
17233 @itemx armv6t2
17234 @itemx armv6z
17235 @itemx armv6zk
17236 @table @samp
17237 @item +fp
17238 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17239 used as an alias for this extension.
17240
17241 @item +nofp
17242 Disable the floating-point instructions.
17243 @end table
17244
17245 @item armv7
17246 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17247 @table @samp
17248 @item +fp
17249 The VFPv3 floating-point instructions, with 16 double-precision
17250 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17251 for this extension. Note that floating-point is not supported by the
17252 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17253 ARMv7-R architectures.
17254
17255 @item +nofp
17256 Disable the floating-point instructions.
17257 @end table
17258
17259 @item armv7-a
17260 @table @samp
17261 @item +mp
17262 The multiprocessing extension.
17263
17264 @item +sec
17265 The security extension.
17266
17267 @item +fp
17268 The VFPv3 floating-point instructions, with 16 double-precision
17269 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17270 for this extension.
17271
17272 @item +simd
17273 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17274 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17275 for this extension.
17276
17277 @item +vfpv3
17278 The VFPv3 floating-point instructions, with 32 double-precision
17279 registers.
17280
17281 @item +vfpv3-d16-fp16
17282 The VFPv3 floating-point instructions, with 16 double-precision
17283 registers and the half-precision floating-point conversion operations.
17284
17285 @item +vfpv3-fp16
17286 The VFPv3 floating-point instructions, with 32 double-precision
17287 registers and the half-precision floating-point conversion operations.
17288
17289 @item +vfpv4-d16
17290 The VFPv4 floating-point instructions, with 16 double-precision
17291 registers.
17292
17293 @item +vfpv4
17294 The VFPv4 floating-point instructions, with 32 double-precision
17295 registers.
17296
17297 @item +neon-fp16
17298 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17299 the half-precision floating-point conversion operations.
17300
17301 @item +neon-vfpv4
17302 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17303
17304 @item +nosimd
17305 Disable the Advanced SIMD instructions (does not disable floating point).
17306
17307 @item +nofp
17308 Disable the floating-point and Advanced SIMD instructions.
17309 @end table
17310
17311 @item armv7ve
17312 The extended version of the ARMv7-A architecture with support for
17313 virtualization.
17314 @table @samp
17315 @item +fp
17316 The VFPv4 floating-point instructions, with 16 double-precision registers.
17317 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17318
17319 @item +simd
17320 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17321 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17322
17323 @item +vfpv3-d16
17324 The VFPv3 floating-point instructions, with 16 double-precision
17325 registers.
17326
17327 @item +vfpv3
17328 The VFPv3 floating-point instructions, with 32 double-precision
17329 registers.
17330
17331 @item +vfpv3-d16-fp16
17332 The VFPv3 floating-point instructions, with 16 double-precision
17333 registers and the half-precision floating-point conversion operations.
17334
17335 @item +vfpv3-fp16
17336 The VFPv3 floating-point instructions, with 32 double-precision
17337 registers and the half-precision floating-point conversion operations.
17338
17339 @item +vfpv4-d16
17340 The VFPv4 floating-point instructions, with 16 double-precision
17341 registers.
17342
17343 @item +vfpv4
17344 The VFPv4 floating-point instructions, with 32 double-precision
17345 registers.
17346
17347 @item +neon
17348 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17349 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17350
17351 @item +neon-fp16
17352 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17353 the half-precision floating-point conversion operations.
17354
17355 @item +nosimd
17356 Disable the Advanced SIMD instructions (does not disable floating point).
17357
17358 @item +nofp
17359 Disable the floating-point and Advanced SIMD instructions.
17360 @end table
17361
17362 @item armv8-a
17363 @table @samp
17364 @item +crc
17365 The Cyclic Redundancy Check (CRC) instructions.
17366 @item +simd
17367 The ARMv8-A Advanced SIMD and floating-point instructions.
17368 @item +crypto
17369 The cryptographic instructions.
17370 @item +nocrypto
17371 Disable the cryptographic instructions.
17372 @item +nofp
17373 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17374 @item +sb
17375 Speculation Barrier Instruction.
17376 @item +predres
17377 Execution and Data Prediction Restriction Instructions.
17378 @end table
17379
17380 @item armv8.1-a
17381 @table @samp
17382 @item +simd
17383 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17384
17385 @item +crypto
17386 The cryptographic instructions. This also enables the Advanced SIMD and
17387 floating-point instructions.
17388
17389 @item +nocrypto
17390 Disable the cryptographic instructions.
17391
17392 @item +nofp
17393 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17394
17395 @item +sb
17396 Speculation Barrier Instruction.
17397
17398 @item +predres
17399 Execution and Data Prediction Restriction Instructions.
17400 @end table
17401
17402 @item armv8.2-a
17403 @itemx armv8.3-a
17404 @table @samp
17405 @item +fp16
17406 The half-precision floating-point data processing instructions.
17407 This also enables the Advanced SIMD and floating-point instructions.
17408
17409 @item +fp16fml
17410 The half-precision floating-point fmla extension. This also enables
17411 the half-precision floating-point extension and Advanced SIMD and
17412 floating-point instructions.
17413
17414 @item +simd
17415 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17416
17417 @item +crypto
17418 The cryptographic instructions. This also enables the Advanced SIMD and
17419 floating-point instructions.
17420
17421 @item +dotprod
17422 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17423
17424 @item +nocrypto
17425 Disable the cryptographic extension.
17426
17427 @item +nofp
17428 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17429
17430 @item +sb
17431 Speculation Barrier Instruction.
17432
17433 @item +predres
17434 Execution and Data Prediction Restriction Instructions.
17435 @end table
17436
17437 @item armv8.4-a
17438 @table @samp
17439 @item +fp16
17440 The half-precision floating-point data processing instructions.
17441 This also enables the Advanced SIMD and floating-point instructions as well
17442 as the Dot Product extension and the half-precision floating-point fmla
17443 extension.
17444
17445 @item +simd
17446 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17447 Dot Product extension.
17448
17449 @item +crypto
17450 The cryptographic instructions. This also enables the Advanced SIMD and
17451 floating-point instructions as well as the Dot Product extension.
17452
17453 @item +nocrypto
17454 Disable the cryptographic extension.
17455
17456 @item +nofp
17457 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17458
17459 @item +sb
17460 Speculation Barrier Instruction.
17461
17462 @item +predres
17463 Execution and Data Prediction Restriction Instructions.
17464 @end table
17465
17466 @item armv8.5-a
17467 @table @samp
17468 @item +fp16
17469 The half-precision floating-point data processing instructions.
17470 This also enables the Advanced SIMD and floating-point instructions as well
17471 as the Dot Product extension and the half-precision floating-point fmla
17472 extension.
17473
17474 @item +simd
17475 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17476 Dot Product extension.
17477
17478 @item +crypto
17479 The cryptographic instructions. This also enables the Advanced SIMD and
17480 floating-point instructions as well as the Dot Product extension.
17481
17482 @item +nocrypto
17483 Disable the cryptographic extension.
17484
17485 @item +nofp
17486 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17487 @end table
17488
17489 @item armv7-r
17490 @table @samp
17491 @item +fp.sp
17492 The single-precision VFPv3 floating-point instructions. The extension
17493 @samp{+vfpv3xd} can be used as an alias for this extension.
17494
17495 @item +fp
17496 The VFPv3 floating-point instructions with 16 double-precision registers.
17497 The extension +vfpv3-d16 can be used as an alias for this extension.
17498
17499 @item +vfpv3xd-d16-fp16
17500 The single-precision VFPv3 floating-point instructions with 16 double-precision
17501 registers and the half-precision floating-point conversion operations.
17502
17503 @item +vfpv3-d16-fp16
17504 The VFPv3 floating-point instructions with 16 double-precision
17505 registers and the half-precision floating-point conversion operations.
17506
17507 @item +nofp
17508 Disable the floating-point extension.
17509
17510 @item +idiv
17511 The ARM-state integer division instructions.
17512
17513 @item +noidiv
17514 Disable the ARM-state integer division extension.
17515 @end table
17516
17517 @item armv7e-m
17518 @table @samp
17519 @item +fp
17520 The single-precision VFPv4 floating-point instructions.
17521
17522 @item +fpv5
17523 The single-precision FPv5 floating-point instructions.
17524
17525 @item +fp.dp
17526 The single- and double-precision FPv5 floating-point instructions.
17527
17528 @item +nofp
17529 Disable the floating-point extensions.
17530 @end table
17531
17532 @item armv8-m.main
17533 @table @samp
17534 @item +dsp
17535 The DSP instructions.
17536
17537 @item +nodsp
17538 Disable the DSP extension.
17539
17540 @item +fp
17541 The single-precision floating-point instructions.
17542
17543 @item +fp.dp
17544 The single- and double-precision floating-point instructions.
17545
17546 @item +nofp
17547 Disable the floating-point extension.
17548 @end table
17549
17550 @item armv8-r
17551 @table @samp
17552 @item +crc
17553 The Cyclic Redundancy Check (CRC) instructions.
17554 @item +fp.sp
17555 The single-precision FPv5 floating-point instructions.
17556 @item +simd
17557 The ARMv8-A Advanced SIMD and floating-point instructions.
17558 @item +crypto
17559 The cryptographic instructions.
17560 @item +nocrypto
17561 Disable the cryptographic instructions.
17562 @item +nofp
17563 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17564 @end table
17565
17566 @end table
17567
17568 @option{-march=native} causes the compiler to auto-detect the architecture
17569 of the build computer. At present, this feature is only supported on
17570 GNU/Linux, and not all architectures are recognized. If the auto-detect
17571 is unsuccessful the option has no effect.
17572
17573 @item -mtune=@var{name}
17574 @opindex mtune
17575 This option specifies the name of the target ARM processor for
17576 which GCC should tune the performance of the code.
17577 For some ARM implementations better performance can be obtained by using
17578 this option.
17579 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17580 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17581 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17582 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17583 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17584 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17585 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17586 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17587 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17588 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17589 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17590 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17591 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17592 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17593 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17594 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17595 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17596 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17597 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17598 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17599 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17600 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17601
17602 Additionally, this option can specify that GCC should tune the performance
17603 of the code for a big.LITTLE system. Permissible names are:
17604 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17605 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17606 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17607 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17608
17609 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17610 performance for a blend of processors within architecture @var{arch}.
17611 The aim is to generate code that run well on the current most popular
17612 processors, balancing between optimizations that benefit some CPUs in the
17613 range, and avoiding performance pitfalls of other CPUs. The effects of
17614 this option may change in future GCC versions as CPU models come and go.
17615
17616 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17617 the extension options do not affect the tuning of the generated code.
17618
17619 @option{-mtune=native} causes the compiler to auto-detect the CPU
17620 of the build computer. At present, this feature is only supported on
17621 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17622 unsuccessful the option has no effect.
17623
17624 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17625 @opindex mcpu
17626 This specifies the name of the target ARM processor. GCC uses this name
17627 to derive the name of the target ARM architecture (as if specified
17628 by @option{-march}) and the ARM processor type for which to tune for
17629 performance (as if specified by @option{-mtune}). Where this option
17630 is used in conjunction with @option{-march} or @option{-mtune},
17631 those options take precedence over the appropriate part of this option.
17632
17633 Many of the supported CPUs implement optional architectural
17634 extensions. Where this is so the architectural extensions are
17635 normally enabled by default. If implementations that lack the
17636 extension exist, then the extension syntax can be used to disable
17637 those extensions that have been omitted. For floating-point and
17638 Advanced SIMD (Neon) instructions, the settings of the options
17639 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17640 floating-point and Advanced SIMD instructions will only be used if
17641 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17642 @option{-mfpu} other than @samp{auto} will override the available
17643 floating-point and SIMD extension instructions.
17644
17645 For example, @samp{cortex-a9} can be found in three major
17646 configurations: integer only, with just a floating-point unit or with
17647 floating-point and Advanced SIMD. The default is to enable all the
17648 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17649 be used to disable just the SIMD or both the SIMD and floating-point
17650 instructions respectively.
17651
17652 Permissible names for this option are the same as those for
17653 @option{-mtune}.
17654
17655 The following extension options are common to the listed CPUs:
17656
17657 @table @samp
17658 @item +nodsp
17659 Disable the DSP instructions on @samp{cortex-m33}.
17660
17661 @item +nofp
17662 Disables the floating-point instructions on @samp{arm9e},
17663 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17664 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17665 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17666 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17667 Disables the floating-point and SIMD instructions on
17668 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17669 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17670 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17671 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17672 @samp{cortex-a53} and @samp{cortex-a55}.
17673
17674 @item +nofp.dp
17675 Disables the double-precision component of the floating-point instructions
17676 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17677 @samp{cortex-m7}.
17678
17679 @item +nosimd
17680 Disables the SIMD (but not floating-point) instructions on
17681 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17682 and @samp{cortex-a9}.
17683
17684 @item +crypto
17685 Enables the cryptographic instructions on @samp{cortex-a32},
17686 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17687 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17688 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17689 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17690 @samp{cortex-a75.cortex-a55}.
17691 @end table
17692
17693 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17694 VFPv3 with 16 double-precision registers. It supports the following
17695 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17696 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17697 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17698 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17699 the extensions to @option{-march=armv7-a}.
17700
17701 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17702 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17703 See @option{-mtune} for more information.
17704
17705 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17706 of the build computer. At present, this feature is only supported on
17707 GNU/Linux, and not all architectures are recognized. If the auto-detect
17708 is unsuccessful the option has no effect.
17709
17710 @item -mfpu=@var{name}
17711 @opindex mfpu
17712 This specifies what floating-point hardware (or hardware emulation) is
17713 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17714 @samp{vfpv3},
17715 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17716 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17717 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17718 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17719 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17720 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17721 is an alias for @samp{vfpv2}.
17722
17723 The setting @samp{auto} is the default and is special. It causes the
17724 compiler to select the floating-point and Advanced SIMD instructions
17725 based on the settings of @option{-mcpu} and @option{-march}.
17726
17727 If the selected floating-point hardware includes the NEON extension
17728 (e.g.@: @option{-mfpu=neon}), note that floating-point
17729 operations are not generated by GCC's auto-vectorization pass unless
17730 @option{-funsafe-math-optimizations} is also specified. This is
17731 because NEON hardware does not fully implement the IEEE 754 standard for
17732 floating-point arithmetic (in particular denormal values are treated as
17733 zero), so the use of NEON instructions may lead to a loss of precision.
17734
17735 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}).
17736
17737 @item -mfp16-format=@var{name}
17738 @opindex mfp16-format
17739 Specify the format of the @code{__fp16} half-precision floating-point type.
17740 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17741 the default is @samp{none}, in which case the @code{__fp16} type is not
17742 defined. @xref{Half-Precision}, for more information.
17743
17744 @item -mstructure-size-boundary=@var{n}
17745 @opindex mstructure-size-boundary
17746 The sizes of all structures and unions are rounded up to a multiple
17747 of the number of bits set by this option. Permissible values are 8, 32
17748 and 64. The default value varies for different toolchains. For the COFF
17749 targeted toolchain the default value is 8. A value of 64 is only allowed
17750 if the underlying ABI supports it.
17751
17752 Specifying a larger number can produce faster, more efficient code, but
17753 can also increase the size of the program. Different values are potentially
17754 incompatible. Code compiled with one value cannot necessarily expect to
17755 work with code or libraries compiled with another value, if they exchange
17756 information using structures or unions.
17757
17758 This option is deprecated.
17759
17760 @item -mabort-on-noreturn
17761 @opindex mabort-on-noreturn
17762 Generate a call to the function @code{abort} at the end of a
17763 @code{noreturn} function. It is executed if the function tries to
17764 return.
17765
17766 @item -mlong-calls
17767 @itemx -mno-long-calls
17768 @opindex mlong-calls
17769 @opindex mno-long-calls
17770 Tells the compiler to perform function calls by first loading the
17771 address of the function into a register and then performing a subroutine
17772 call on this register. This switch is needed if the target function
17773 lies outside of the 64-megabyte addressing range of the offset-based
17774 version of subroutine call instruction.
17775
17776 Even if this switch is enabled, not all function calls are turned
17777 into long calls. The heuristic is that static functions, functions
17778 that have the @code{short_call} attribute, functions that are inside
17779 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17780 definitions have already been compiled within the current compilation
17781 unit are not turned into long calls. The exceptions to this rule are
17782 that weak function definitions, functions with the @code{long_call}
17783 attribute or the @code{section} attribute, and functions that are within
17784 the scope of a @code{#pragma long_calls} directive are always
17785 turned into long calls.
17786
17787 This feature is not enabled by default. Specifying
17788 @option{-mno-long-calls} restores the default behavior, as does
17789 placing the function calls within the scope of a @code{#pragma
17790 long_calls_off} directive. Note these switches have no effect on how
17791 the compiler generates code to handle function calls via function
17792 pointers.
17793
17794 @item -msingle-pic-base
17795 @opindex msingle-pic-base
17796 Treat the register used for PIC addressing as read-only, rather than
17797 loading it in the prologue for each function. The runtime system is
17798 responsible for initializing this register with an appropriate value
17799 before execution begins.
17800
17801 @item -mpic-register=@var{reg}
17802 @opindex mpic-register
17803 Specify the register to be used for PIC addressing.
17804 For standard PIC base case, the default is any suitable register
17805 determined by compiler. For single PIC base case, the default is
17806 @samp{R9} if target is EABI based or stack-checking is enabled,
17807 otherwise the default is @samp{R10}.
17808
17809 @item -mpic-data-is-text-relative
17810 @opindex mpic-data-is-text-relative
17811 Assume that the displacement between the text and data segments is fixed
17812 at static link time. This permits using PC-relative addressing
17813 operations to access data known to be in the data segment. For
17814 non-VxWorks RTP targets, this option is enabled by default. When
17815 disabled on such targets, it will enable @option{-msingle-pic-base} by
17816 default.
17817
17818 @item -mpoke-function-name
17819 @opindex mpoke-function-name
17820 Write the name of each function into the text section, directly
17821 preceding the function prologue. The generated code is similar to this:
17822
17823 @smallexample
17824 t0
17825 .ascii "arm_poke_function_name", 0
17826 .align
17827 t1
17828 .word 0xff000000 + (t1 - t0)
17829 arm_poke_function_name
17830 mov ip, sp
17831 stmfd sp!, @{fp, ip, lr, pc@}
17832 sub fp, ip, #4
17833 @end smallexample
17834
17835 When performing a stack backtrace, code can inspect the value of
17836 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17837 location @code{pc - 12} and the top 8 bits are set, then we know that
17838 there is a function name embedded immediately preceding this location
17839 and has length @code{((pc[-3]) & 0xff000000)}.
17840
17841 @item -mthumb
17842 @itemx -marm
17843 @opindex marm
17844 @opindex mthumb
17845
17846 Select between generating code that executes in ARM and Thumb
17847 states. The default for most configurations is to generate code
17848 that executes in ARM state, but the default can be changed by
17849 configuring GCC with the @option{--with-mode=}@var{state}
17850 configure option.
17851
17852 You can also override the ARM and Thumb mode for each function
17853 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17854 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17855
17856 @item -mflip-thumb
17857 @opindex mflip-thumb
17858 Switch ARM/Thumb modes on alternating functions.
17859 This option is provided for regression testing of mixed Thumb/ARM code
17860 generation, and is not intended for ordinary use in compiling code.
17861
17862 @item -mtpcs-frame
17863 @opindex mtpcs-frame
17864 Generate a stack frame that is compliant with the Thumb Procedure Call
17865 Standard for all non-leaf functions. (A leaf function is one that does
17866 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17867
17868 @item -mtpcs-leaf-frame
17869 @opindex mtpcs-leaf-frame
17870 Generate a stack frame that is compliant with the Thumb Procedure Call
17871 Standard for all leaf functions. (A leaf function is one that does
17872 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17873
17874 @item -mcallee-super-interworking
17875 @opindex mcallee-super-interworking
17876 Gives all externally visible functions in the file being compiled an ARM
17877 instruction set header which switches to Thumb mode before executing the
17878 rest of the function. This allows these functions to be called from
17879 non-interworking code. This option is not valid in AAPCS configurations
17880 because interworking is enabled by default.
17881
17882 @item -mcaller-super-interworking
17883 @opindex mcaller-super-interworking
17884 Allows calls via function pointers (including virtual functions) to
17885 execute correctly regardless of whether the target code has been
17886 compiled for interworking or not. There is a small overhead in the cost
17887 of executing a function pointer if this option is enabled. This option
17888 is not valid in AAPCS configurations because interworking is enabled
17889 by default.
17890
17891 @item -mtp=@var{name}
17892 @opindex mtp
17893 Specify the access model for the thread local storage pointer. The valid
17894 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17895 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17896 (supported in the arm6k architecture), and @samp{auto}, which uses the
17897 best available method for the selected processor. The default setting is
17898 @samp{auto}.
17899
17900 @item -mtls-dialect=@var{dialect}
17901 @opindex mtls-dialect
17902 Specify the dialect to use for accessing thread local storage. Two
17903 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17904 @samp{gnu} dialect selects the original GNU scheme for supporting
17905 local and global dynamic TLS models. The @samp{gnu2} dialect
17906 selects the GNU descriptor scheme, which provides better performance
17907 for shared libraries. The GNU descriptor scheme is compatible with
17908 the original scheme, but does require new assembler, linker and
17909 library support. Initial and local exec TLS models are unaffected by
17910 this option and always use the original scheme.
17911
17912 @item -mword-relocations
17913 @opindex mword-relocations
17914 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17915 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17916 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17917 is specified. This option conflicts with @option{-mslow-flash-data}.
17918
17919 @item -mfix-cortex-m3-ldrd
17920 @opindex mfix-cortex-m3-ldrd
17921 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17922 with overlapping destination and base registers are used. This option avoids
17923 generating these instructions. This option is enabled by default when
17924 @option{-mcpu=cortex-m3} is specified.
17925
17926 @item -munaligned-access
17927 @itemx -mno-unaligned-access
17928 @opindex munaligned-access
17929 @opindex mno-unaligned-access
17930 Enables (or disables) reading and writing of 16- and 32- bit values
17931 from addresses that are not 16- or 32- bit aligned. By default
17932 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17933 ARMv8-M Baseline architectures, and enabled for all other
17934 architectures. If unaligned access is not enabled then words in packed
17935 data structures are accessed a byte at a time.
17936
17937 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17938 generated object file to either true or false, depending upon the
17939 setting of this option. If unaligned access is enabled then the
17940 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17941 defined.
17942
17943 @item -mneon-for-64bits
17944 @opindex mneon-for-64bits
17945 Enables using Neon to handle scalar 64-bits operations. This is
17946 disabled by default since the cost of moving data from core registers
17947 to Neon is high.
17948
17949 @item -mslow-flash-data
17950 @opindex mslow-flash-data
17951 Assume loading data from flash is slower than fetching instruction.
17952 Therefore literal load is minimized for better performance.
17953 This option is only supported when compiling for ARMv7 M-profile and
17954 off by default. It conflicts with @option{-mword-relocations}.
17955
17956 @item -masm-syntax-unified
17957 @opindex masm-syntax-unified
17958 Assume inline assembler is using unified asm syntax. The default is
17959 currently off which implies divided syntax. This option has no impact
17960 on Thumb2. However, this may change in future releases of GCC.
17961 Divided syntax should be considered deprecated.
17962
17963 @item -mrestrict-it
17964 @opindex mrestrict-it
17965 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17966 IT blocks can only contain a single 16-bit instruction from a select
17967 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17968
17969 @item -mprint-tune-info
17970 @opindex mprint-tune-info
17971 Print CPU tuning information as comment in assembler file. This is
17972 an option used only for regression testing of the compiler and not
17973 intended for ordinary use in compiling code. This option is disabled
17974 by default.
17975
17976 @item -mverbose-cost-dump
17977 @opindex mverbose-cost-dump
17978 Enable verbose cost model dumping in the debug dump files. This option is
17979 provided for use in debugging the compiler.
17980
17981 @item -mpure-code
17982 @opindex mpure-code
17983 Do not allow constant data to be placed in code sections.
17984 Additionally, when compiling for ELF object format give all text sections the
17985 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17986 is only available when generating non-pic code for M-profile targets with the
17987 MOVT instruction.
17988
17989 @item -mcmse
17990 @opindex mcmse
17991 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17992 Development Tools Engineering Specification", which can be found on
17993 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17994 @end table
17995
17996 @node AVR Options
17997 @subsection AVR Options
17998 @cindex AVR Options
17999
18000 These options are defined for AVR implementations:
18001
18002 @table @gcctabopt
18003 @item -mmcu=@var{mcu}
18004 @opindex mmcu
18005 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18006
18007 The default for this option is@tie{}@samp{avr2}.
18008
18009 GCC supports the following AVR devices and ISAs:
18010
18011 @include avr-mmcu.texi
18012
18013 @item -mabsdata
18014 @opindex mabsdata
18015
18016 Assume that all data in static storage can be accessed by LDS / STS
18017 instructions. This option has only an effect on reduced Tiny devices like
18018 ATtiny40. See also the @code{absdata}
18019 @ref{AVR Variable Attributes,variable attribute}.
18020
18021 @item -maccumulate-args
18022 @opindex maccumulate-args
18023 Accumulate outgoing function arguments and acquire/release the needed
18024 stack space for outgoing function arguments once in function
18025 prologue/epilogue. Without this option, outgoing arguments are pushed
18026 before calling a function and popped afterwards.
18027
18028 Popping the arguments after the function call can be expensive on
18029 AVR so that accumulating the stack space might lead to smaller
18030 executables because arguments need not be removed from the
18031 stack after such a function call.
18032
18033 This option can lead to reduced code size for functions that perform
18034 several calls to functions that get their arguments on the stack like
18035 calls to printf-like functions.
18036
18037 @item -mbranch-cost=@var{cost}
18038 @opindex mbranch-cost
18039 Set the branch costs for conditional branch instructions to
18040 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18041 integers. The default branch cost is 0.
18042
18043 @item -mcall-prologues
18044 @opindex mcall-prologues
18045 Functions prologues/epilogues are expanded as calls to appropriate
18046 subroutines. Code size is smaller.
18047
18048 @item -mgas-isr-prologues
18049 @opindex mgas-isr-prologues
18050 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18051 instruction supported by GNU Binutils.
18052 If this option is on, the feature can still be disabled for individual
18053 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18054 function attribute. This feature is activated per default
18055 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18056 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18057
18058 @item -mint8
18059 @opindex mint8
18060 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18061 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18062 and @code{long long} is 4 bytes. Please note that this option does not
18063 conform to the C standards, but it results in smaller code
18064 size.
18065
18066 @item -mmain-is-OS_task
18067 @opindex mmain-is-OS_task
18068 Do not save registers in @code{main}. The effect is the same like
18069 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18070 to @code{main}. It is activated per default if optimization is on.
18071
18072 @item -mn-flash=@var{num}
18073 @opindex mn-flash
18074 Assume that the flash memory has a size of
18075 @var{num} times 64@tie{}KiB.
18076
18077 @item -mno-interrupts
18078 @opindex mno-interrupts
18079 Generated code is not compatible with hardware interrupts.
18080 Code size is smaller.
18081
18082 @item -mrelax
18083 @opindex mrelax
18084 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18085 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18086 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18087 the assembler's command line and the @option{--relax} option to the
18088 linker's command line.
18089
18090 Jump relaxing is performed by the linker because jump offsets are not
18091 known before code is located. Therefore, the assembler code generated by the
18092 compiler is the same, but the instructions in the executable may
18093 differ from instructions in the assembler code.
18094
18095 Relaxing must be turned on if linker stubs are needed, see the
18096 section on @code{EIND} and linker stubs below.
18097
18098 @item -mrmw
18099 @opindex mrmw
18100 Assume that the device supports the Read-Modify-Write
18101 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18102
18103 @item -mshort-calls
18104 @opindex mshort-calls
18105
18106 Assume that @code{RJMP} and @code{RCALL} can target the whole
18107 program memory.
18108
18109 This option is used internally for multilib selection. It is
18110 not an optimization option, and you don't need to set it by hand.
18111
18112 @item -msp8
18113 @opindex msp8
18114 Treat the stack pointer register as an 8-bit register,
18115 i.e.@: assume the high byte of the stack pointer is zero.
18116 In general, you don't need to set this option by hand.
18117
18118 This option is used internally by the compiler to select and
18119 build multilibs for architectures @code{avr2} and @code{avr25}.
18120 These architectures mix devices with and without @code{SPH}.
18121 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18122 the compiler driver adds or removes this option from the compiler
18123 proper's command line, because the compiler then knows if the device
18124 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18125 register or not.
18126
18127 @item -mstrict-X
18128 @opindex mstrict-X
18129 Use address register @code{X} in a way proposed by the hardware. This means
18130 that @code{X} is only used in indirect, post-increment or
18131 pre-decrement addressing.
18132
18133 Without this option, the @code{X} register may be used in the same way
18134 as @code{Y} or @code{Z} which then is emulated by additional
18135 instructions.
18136 For example, loading a value with @code{X+const} addressing with a
18137 small non-negative @code{const < 64} to a register @var{Rn} is
18138 performed as
18139
18140 @example
18141 adiw r26, const ; X += const
18142 ld @var{Rn}, X ; @var{Rn} = *X
18143 sbiw r26, const ; X -= const
18144 @end example
18145
18146 @item -mtiny-stack
18147 @opindex mtiny-stack
18148 Only change the lower 8@tie{}bits of the stack pointer.
18149
18150 @item -mfract-convert-truncate
18151 @opindex mfract-convert-truncate
18152 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18153
18154 @item -nodevicelib
18155 @opindex nodevicelib
18156 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18157
18158 @item -Waddr-space-convert
18159 @opindex Waddr-space-convert
18160 @opindex Wno-addr-space-convert
18161 Warn about conversions between address spaces in the case where the
18162 resulting address space is not contained in the incoming address space.
18163
18164 @item -Wmisspelled-isr
18165 @opindex Wmisspelled-isr
18166 @opindex Wno-misspelled-isr
18167 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18168 Enabled by default.
18169 @end table
18170
18171 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18172 @cindex @code{EIND}
18173 Pointers in the implementation are 16@tie{}bits wide.
18174 The address of a function or label is represented as word address so
18175 that indirect jumps and calls can target any code address in the
18176 range of 64@tie{}Ki words.
18177
18178 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18179 bytes of program memory space, there is a special function register called
18180 @code{EIND} that serves as most significant part of the target address
18181 when @code{EICALL} or @code{EIJMP} instructions are used.
18182
18183 Indirect jumps and calls on these devices are handled as follows by
18184 the compiler and are subject to some limitations:
18185
18186 @itemize @bullet
18187
18188 @item
18189 The compiler never sets @code{EIND}.
18190
18191 @item
18192 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18193 instructions or might read @code{EIND} directly in order to emulate an
18194 indirect call/jump by means of a @code{RET} instruction.
18195
18196 @item
18197 The compiler assumes that @code{EIND} never changes during the startup
18198 code or during the application. In particular, @code{EIND} is not
18199 saved/restored in function or interrupt service routine
18200 prologue/epilogue.
18201
18202 @item
18203 For indirect calls to functions and computed goto, the linker
18204 generates @emph{stubs}. Stubs are jump pads sometimes also called
18205 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18206 The stub contains a direct jump to the desired address.
18207
18208 @item
18209 Linker relaxation must be turned on so that the linker generates
18210 the stubs correctly in all situations. See the compiler option
18211 @option{-mrelax} and the linker option @option{--relax}.
18212 There are corner cases where the linker is supposed to generate stubs
18213 but aborts without relaxation and without a helpful error message.
18214
18215 @item
18216 The default linker script is arranged for code with @code{EIND = 0}.
18217 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18218 linker script has to be used in order to place the sections whose
18219 name start with @code{.trampolines} into the segment where @code{EIND}
18220 points to.
18221
18222 @item
18223 The startup code from libgcc never sets @code{EIND}.
18224 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18225 For the impact of AVR-LibC on @code{EIND}, see the
18226 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18227
18228 @item
18229 It is legitimate for user-specific startup code to set up @code{EIND}
18230 early, for example by means of initialization code located in
18231 section @code{.init3}. Such code runs prior to general startup code
18232 that initializes RAM and calls constructors, but after the bit
18233 of startup code from AVR-LibC that sets @code{EIND} to the segment
18234 where the vector table is located.
18235 @example
18236 #include <avr/io.h>
18237
18238 static void
18239 __attribute__((section(".init3"),naked,used,no_instrument_function))
18240 init3_set_eind (void)
18241 @{
18242 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18243 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18244 @}
18245 @end example
18246
18247 @noindent
18248 The @code{__trampolines_start} symbol is defined in the linker script.
18249
18250 @item
18251 Stubs are generated automatically by the linker if
18252 the following two conditions are met:
18253 @itemize @minus
18254
18255 @item The address of a label is taken by means of the @code{gs} modifier
18256 (short for @emph{generate stubs}) like so:
18257 @example
18258 LDI r24, lo8(gs(@var{func}))
18259 LDI r25, hi8(gs(@var{func}))
18260 @end example
18261 @item The final location of that label is in a code segment
18262 @emph{outside} the segment where the stubs are located.
18263 @end itemize
18264
18265 @item
18266 The compiler emits such @code{gs} modifiers for code labels in the
18267 following situations:
18268 @itemize @minus
18269 @item Taking address of a function or code label.
18270 @item Computed goto.
18271 @item If prologue-save function is used, see @option{-mcall-prologues}
18272 command-line option.
18273 @item Switch/case dispatch tables. If you do not want such dispatch
18274 tables you can specify the @option{-fno-jump-tables} command-line option.
18275 @item C and C++ constructors/destructors called during startup/shutdown.
18276 @item If the tools hit a @code{gs()} modifier explained above.
18277 @end itemize
18278
18279 @item
18280 Jumping to non-symbolic addresses like so is @emph{not} supported:
18281
18282 @example
18283 int main (void)
18284 @{
18285 /* Call function at word address 0x2 */
18286 return ((int(*)(void)) 0x2)();
18287 @}
18288 @end example
18289
18290 Instead, a stub has to be set up, i.e.@: the function has to be called
18291 through a symbol (@code{func_4} in the example):
18292
18293 @example
18294 int main (void)
18295 @{
18296 extern int func_4 (void);
18297
18298 /* Call function at byte address 0x4 */
18299 return func_4();
18300 @}
18301 @end example
18302
18303 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18304 Alternatively, @code{func_4} can be defined in the linker script.
18305 @end itemize
18306
18307 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18308 @cindex @code{RAMPD}
18309 @cindex @code{RAMPX}
18310 @cindex @code{RAMPY}
18311 @cindex @code{RAMPZ}
18312 Some AVR devices support memories larger than the 64@tie{}KiB range
18313 that can be accessed with 16-bit pointers. To access memory locations
18314 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18315 register is used as high part of the address:
18316 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18317 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18318 register, respectively, to get a wide address. Similarly,
18319 @code{RAMPD} is used together with direct addressing.
18320
18321 @itemize
18322 @item
18323 The startup code initializes the @code{RAMP} special function
18324 registers with zero.
18325
18326 @item
18327 If a @ref{AVR Named Address Spaces,named address space} other than
18328 generic or @code{__flash} is used, then @code{RAMPZ} is set
18329 as needed before the operation.
18330
18331 @item
18332 If the device supports RAM larger than 64@tie{}KiB and the compiler
18333 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18334 is reset to zero after the operation.
18335
18336 @item
18337 If the device comes with a specific @code{RAMP} register, the ISR
18338 prologue/epilogue saves/restores that SFR and initializes it with
18339 zero in case the ISR code might (implicitly) use it.
18340
18341 @item
18342 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18343 If you use inline assembler to read from locations outside the
18344 16-bit address range and change one of the @code{RAMP} registers,
18345 you must reset it to zero after the access.
18346
18347 @end itemize
18348
18349 @subsubsection AVR Built-in Macros
18350
18351 GCC defines several built-in macros so that the user code can test
18352 for the presence or absence of features. Almost any of the following
18353 built-in macros are deduced from device capabilities and thus
18354 triggered by the @option{-mmcu=} command-line option.
18355
18356 For even more AVR-specific built-in macros see
18357 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18358
18359 @table @code
18360
18361 @item __AVR_ARCH__
18362 Build-in macro that resolves to a decimal number that identifies the
18363 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18364 Possible values are:
18365
18366 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18367 @code{4}, @code{5}, @code{51}, @code{6}
18368
18369 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18370 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18371
18372 respectively and
18373
18374 @code{100},
18375 @code{102}, @code{103}, @code{104},
18376 @code{105}, @code{106}, @code{107}
18377
18378 for @var{mcu}=@code{avrtiny},
18379 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18380 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18381 If @var{mcu} specifies a device, this built-in macro is set
18382 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18383 defined to @code{4}.
18384
18385 @item __AVR_@var{Device}__
18386 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18387 the device's name. For example, @option{-mmcu=atmega8} defines the
18388 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18389 @code{__AVR_ATtiny261A__}, etc.
18390
18391 The built-in macros' names follow
18392 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18393 the device name as from the AVR user manual. The difference between
18394 @var{Device} in the built-in macro and @var{device} in
18395 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18396
18397 If @var{device} is not a device but only a core architecture like
18398 @samp{avr51}, this macro is not defined.
18399
18400 @item __AVR_DEVICE_NAME__
18401 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18402 the device's name. For example, with @option{-mmcu=atmega8} the macro
18403 is defined to @code{atmega8}.
18404
18405 If @var{device} is not a device but only a core architecture like
18406 @samp{avr51}, this macro is not defined.
18407
18408 @item __AVR_XMEGA__
18409 The device / architecture belongs to the XMEGA family of devices.
18410
18411 @item __AVR_HAVE_ELPM__
18412 The device has the @code{ELPM} instruction.
18413
18414 @item __AVR_HAVE_ELPMX__
18415 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18416 R@var{n},Z+} instructions.
18417
18418 @item __AVR_HAVE_MOVW__
18419 The device has the @code{MOVW} instruction to perform 16-bit
18420 register-register moves.
18421
18422 @item __AVR_HAVE_LPMX__
18423 The device has the @code{LPM R@var{n},Z} and
18424 @code{LPM R@var{n},Z+} instructions.
18425
18426 @item __AVR_HAVE_MUL__
18427 The device has a hardware multiplier.
18428
18429 @item __AVR_HAVE_JMP_CALL__
18430 The device has the @code{JMP} and @code{CALL} instructions.
18431 This is the case for devices with more than 8@tie{}KiB of program
18432 memory.
18433
18434 @item __AVR_HAVE_EIJMP_EICALL__
18435 @itemx __AVR_3_BYTE_PC__
18436 The device has the @code{EIJMP} and @code{EICALL} instructions.
18437 This is the case for devices with more than 128@tie{}KiB of program memory.
18438 This also means that the program counter
18439 (PC) is 3@tie{}bytes wide.
18440
18441 @item __AVR_2_BYTE_PC__
18442 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18443 with up to 128@tie{}KiB of program memory.
18444
18445 @item __AVR_HAVE_8BIT_SP__
18446 @itemx __AVR_HAVE_16BIT_SP__
18447 The stack pointer (SP) register is treated as 8-bit respectively
18448 16-bit register by the compiler.
18449 The definition of these macros is affected by @option{-mtiny-stack}.
18450
18451 @item __AVR_HAVE_SPH__
18452 @itemx __AVR_SP8__
18453 The device has the SPH (high part of stack pointer) special function
18454 register or has an 8-bit stack pointer, respectively.
18455 The definition of these macros is affected by @option{-mmcu=} and
18456 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18457 by @option{-msp8}.
18458
18459 @item __AVR_HAVE_RAMPD__
18460 @itemx __AVR_HAVE_RAMPX__
18461 @itemx __AVR_HAVE_RAMPY__
18462 @itemx __AVR_HAVE_RAMPZ__
18463 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18464 @code{RAMPZ} special function register, respectively.
18465
18466 @item __NO_INTERRUPTS__
18467 This macro reflects the @option{-mno-interrupts} command-line option.
18468
18469 @item __AVR_ERRATA_SKIP__
18470 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18471 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18472 instructions because of a hardware erratum. Skip instructions are
18473 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18474 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18475 set.
18476
18477 @item __AVR_ISA_RMW__
18478 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18479
18480 @item __AVR_SFR_OFFSET__=@var{offset}
18481 Instructions that can address I/O special function registers directly
18482 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18483 address as if addressed by an instruction to access RAM like @code{LD}
18484 or @code{STS}. This offset depends on the device architecture and has
18485 to be subtracted from the RAM address in order to get the
18486 respective I/O@tie{}address.
18487
18488 @item __AVR_SHORT_CALLS__
18489 The @option{-mshort-calls} command line option is set.
18490
18491 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18492 Some devices support reading from flash memory by means of @code{LD*}
18493 instructions. The flash memory is seen in the data address space
18494 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18495 is not defined, this feature is not available. If defined,
18496 the address space is linear and there is no need to put
18497 @code{.rodata} into RAM. This is handled by the default linker
18498 description file, and is currently available for
18499 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18500 there is no need to use address spaces like @code{__flash} or
18501 features like attribute @code{progmem} and @code{pgm_read_*}.
18502
18503 @item __WITH_AVRLIBC__
18504 The compiler is configured to be used together with AVR-Libc.
18505 See the @option{--with-avrlibc} configure option.
18506
18507 @end table
18508
18509 @node Blackfin Options
18510 @subsection Blackfin Options
18511 @cindex Blackfin Options
18512
18513 @table @gcctabopt
18514 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18515 @opindex mcpu=
18516 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18517 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18518 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18519 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18520 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18521 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18522 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18523 @samp{bf561}, @samp{bf592}.
18524
18525 The optional @var{sirevision} specifies the silicon revision of the target
18526 Blackfin processor. Any workarounds available for the targeted silicon revision
18527 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18528 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18529 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18530 hexadecimal digits representing the major and minor numbers in the silicon
18531 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18532 is not defined. If @var{sirevision} is @samp{any}, the
18533 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18534 If this optional @var{sirevision} is not used, GCC assumes the latest known
18535 silicon revision of the targeted Blackfin processor.
18536
18537 GCC defines a preprocessor macro for the specified @var{cpu}.
18538 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18539 provided by libgloss to be linked in if @option{-msim} is not given.
18540
18541 Without this option, @samp{bf532} is used as the processor by default.
18542
18543 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18544 only the preprocessor macro is defined.
18545
18546 @item -msim
18547 @opindex msim
18548 Specifies that the program will be run on the simulator. This causes
18549 the simulator BSP provided by libgloss to be linked in. This option
18550 has effect only for @samp{bfin-elf} toolchain.
18551 Certain other options, such as @option{-mid-shared-library} and
18552 @option{-mfdpic}, imply @option{-msim}.
18553
18554 @item -momit-leaf-frame-pointer
18555 @opindex momit-leaf-frame-pointer
18556 Don't keep the frame pointer in a register for leaf functions. This
18557 avoids the instructions to save, set up and restore frame pointers and
18558 makes an extra register available in leaf functions.
18559
18560 @item -mspecld-anomaly
18561 @opindex mspecld-anomaly
18562 When enabled, the compiler ensures that the generated code does not
18563 contain speculative loads after jump instructions. If this option is used,
18564 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18565
18566 @item -mno-specld-anomaly
18567 @opindex mno-specld-anomaly
18568 @opindex mspecld-anomaly
18569 Don't generate extra code to prevent speculative loads from occurring.
18570
18571 @item -mcsync-anomaly
18572 @opindex mcsync-anomaly
18573 When enabled, the compiler ensures that the generated code does not
18574 contain CSYNC or SSYNC instructions too soon after conditional branches.
18575 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18576
18577 @item -mno-csync-anomaly
18578 @opindex mno-csync-anomaly
18579 @opindex mcsync-anomaly
18580 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18581 occurring too soon after a conditional branch.
18582
18583 @item -mlow64k
18584 @opindex mlow64k
18585 When enabled, the compiler is free to take advantage of the knowledge that
18586 the entire program fits into the low 64k of memory.
18587
18588 @item -mno-low64k
18589 @opindex mno-low64k
18590 Assume that the program is arbitrarily large. This is the default.
18591
18592 @item -mstack-check-l1
18593 @opindex mstack-check-l1
18594 Do stack checking using information placed into L1 scratchpad memory by the
18595 uClinux kernel.
18596
18597 @item -mid-shared-library
18598 @opindex mid-shared-library
18599 Generate code that supports shared libraries via the library ID method.
18600 This allows for execute in place and shared libraries in an environment
18601 without virtual memory management. This option implies @option{-fPIC}.
18602 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18603
18604 @item -mno-id-shared-library
18605 @opindex mno-id-shared-library
18606 @opindex mid-shared-library
18607 Generate code that doesn't assume ID-based shared libraries are being used.
18608 This is the default.
18609
18610 @item -mleaf-id-shared-library
18611 @opindex mleaf-id-shared-library
18612 Generate code that supports shared libraries via the library ID method,
18613 but assumes that this library or executable won't link against any other
18614 ID shared libraries. That allows the compiler to use faster code for jumps
18615 and calls.
18616
18617 @item -mno-leaf-id-shared-library
18618 @opindex mno-leaf-id-shared-library
18619 @opindex mleaf-id-shared-library
18620 Do not assume that the code being compiled won't link against any ID shared
18621 libraries. Slower code is generated for jump and call insns.
18622
18623 @item -mshared-library-id=n
18624 @opindex mshared-library-id
18625 Specifies the identification number of the ID-based shared library being
18626 compiled. Specifying a value of 0 generates more compact code; specifying
18627 other values forces the allocation of that number to the current
18628 library but is no more space- or time-efficient than omitting this option.
18629
18630 @item -msep-data
18631 @opindex msep-data
18632 Generate code that allows the data segment to be located in a different
18633 area of memory from the text segment. This allows for execute in place in
18634 an environment without virtual memory management by eliminating relocations
18635 against the text section.
18636
18637 @item -mno-sep-data
18638 @opindex mno-sep-data
18639 @opindex msep-data
18640 Generate code that assumes that the data segment follows the text segment.
18641 This is the default.
18642
18643 @item -mlong-calls
18644 @itemx -mno-long-calls
18645 @opindex mlong-calls
18646 @opindex mno-long-calls
18647 Tells the compiler to perform function calls by first loading the
18648 address of the function into a register and then performing a subroutine
18649 call on this register. This switch is needed if the target function
18650 lies outside of the 24-bit addressing range of the offset-based
18651 version of subroutine call instruction.
18652
18653 This feature is not enabled by default. Specifying
18654 @option{-mno-long-calls} restores the default behavior. Note these
18655 switches have no effect on how the compiler generates code to handle
18656 function calls via function pointers.
18657
18658 @item -mfast-fp
18659 @opindex mfast-fp
18660 Link with the fast floating-point library. This library relaxes some of
18661 the IEEE floating-point standard's rules for checking inputs against
18662 Not-a-Number (NAN), in the interest of performance.
18663
18664 @item -minline-plt
18665 @opindex minline-plt
18666 Enable inlining of PLT entries in function calls to functions that are
18667 not known to bind locally. It has no effect without @option{-mfdpic}.
18668
18669 @item -mmulticore
18670 @opindex mmulticore
18671 Build a standalone application for multicore Blackfin processors.
18672 This option causes proper start files and link scripts supporting
18673 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18674 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18675
18676 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18677 selects the one-application-per-core programming model. Without
18678 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18679 programming model is used. In this model, the main function of Core B
18680 should be named as @code{coreb_main}.
18681
18682 If this option is not used, the single-core application programming
18683 model is used.
18684
18685 @item -mcorea
18686 @opindex mcorea
18687 Build a standalone application for Core A of BF561 when using
18688 the one-application-per-core programming model. Proper start files
18689 and link scripts are used to support Core A, and the macro
18690 @code{__BFIN_COREA} is defined.
18691 This option can only be used in conjunction with @option{-mmulticore}.
18692
18693 @item -mcoreb
18694 @opindex mcoreb
18695 Build a standalone application for Core B of BF561 when using
18696 the one-application-per-core programming model. Proper start files
18697 and link scripts are used to support Core B, and the macro
18698 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18699 should be used instead of @code{main}.
18700 This option can only be used in conjunction with @option{-mmulticore}.
18701
18702 @item -msdram
18703 @opindex msdram
18704 Build a standalone application for SDRAM. Proper start files and
18705 link scripts are used to put the application into SDRAM, and the macro
18706 @code{__BFIN_SDRAM} is defined.
18707 The loader should initialize SDRAM before loading the application.
18708
18709 @item -micplb
18710 @opindex micplb
18711 Assume that ICPLBs are enabled at run time. This has an effect on certain
18712 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18713 are enabled; for standalone applications the default is off.
18714 @end table
18715
18716 @node C6X Options
18717 @subsection C6X Options
18718 @cindex C6X Options
18719
18720 @table @gcctabopt
18721 @item -march=@var{name}
18722 @opindex march
18723 This specifies the name of the target architecture. GCC uses this
18724 name to determine what kind of instructions it can emit when generating
18725 assembly code. Permissible names are: @samp{c62x},
18726 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18727
18728 @item -mbig-endian
18729 @opindex mbig-endian
18730 Generate code for a big-endian target.
18731
18732 @item -mlittle-endian
18733 @opindex mlittle-endian
18734 Generate code for a little-endian target. This is the default.
18735
18736 @item -msim
18737 @opindex msim
18738 Choose startup files and linker script suitable for the simulator.
18739
18740 @item -msdata=default
18741 @opindex msdata=default
18742 Put small global and static data in the @code{.neardata} section,
18743 which is pointed to by register @code{B14}. Put small uninitialized
18744 global and static data in the @code{.bss} section, which is adjacent
18745 to the @code{.neardata} section. Put small read-only data into the
18746 @code{.rodata} section. The corresponding sections used for large
18747 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18748
18749 @item -msdata=all
18750 @opindex msdata=all
18751 Put all data, not just small objects, into the sections reserved for
18752 small data, and use addressing relative to the @code{B14} register to
18753 access them.
18754
18755 @item -msdata=none
18756 @opindex msdata=none
18757 Make no use of the sections reserved for small data, and use absolute
18758 addresses to access all data. Put all initialized global and static
18759 data in the @code{.fardata} section, and all uninitialized data in the
18760 @code{.far} section. Put all constant data into the @code{.const}
18761 section.
18762 @end table
18763
18764 @node CRIS Options
18765 @subsection CRIS Options
18766 @cindex CRIS Options
18767
18768 These options are defined specifically for the CRIS ports.
18769
18770 @table @gcctabopt
18771 @item -march=@var{architecture-type}
18772 @itemx -mcpu=@var{architecture-type}
18773 @opindex march
18774 @opindex mcpu
18775 Generate code for the specified architecture. The choices for
18776 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18777 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18778 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18779 @samp{v10}.
18780
18781 @item -mtune=@var{architecture-type}
18782 @opindex mtune
18783 Tune to @var{architecture-type} everything applicable about the generated
18784 code, except for the ABI and the set of available instructions. The
18785 choices for @var{architecture-type} are the same as for
18786 @option{-march=@var{architecture-type}}.
18787
18788 @item -mmax-stack-frame=@var{n}
18789 @opindex mmax-stack-frame
18790 Warn when the stack frame of a function exceeds @var{n} bytes.
18791
18792 @item -metrax4
18793 @itemx -metrax100
18794 @opindex metrax4
18795 @opindex metrax100
18796 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18797 @option{-march=v3} and @option{-march=v8} respectively.
18798
18799 @item -mmul-bug-workaround
18800 @itemx -mno-mul-bug-workaround
18801 @opindex mmul-bug-workaround
18802 @opindex mno-mul-bug-workaround
18803 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18804 models where it applies. This option is active by default.
18805
18806 @item -mpdebug
18807 @opindex mpdebug
18808 Enable CRIS-specific verbose debug-related information in the assembly
18809 code. This option also has the effect of turning off the @samp{#NO_APP}
18810 formatted-code indicator to the assembler at the beginning of the
18811 assembly file.
18812
18813 @item -mcc-init
18814 @opindex mcc-init
18815 Do not use condition-code results from previous instruction; always emit
18816 compare and test instructions before use of condition codes.
18817
18818 @item -mno-side-effects
18819 @opindex mno-side-effects
18820 @opindex mside-effects
18821 Do not emit instructions with side effects in addressing modes other than
18822 post-increment.
18823
18824 @item -mstack-align
18825 @itemx -mno-stack-align
18826 @itemx -mdata-align
18827 @itemx -mno-data-align
18828 @itemx -mconst-align
18829 @itemx -mno-const-align
18830 @opindex mstack-align
18831 @opindex mno-stack-align
18832 @opindex mdata-align
18833 @opindex mno-data-align
18834 @opindex mconst-align
18835 @opindex mno-const-align
18836 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18837 stack frame, individual data and constants to be aligned for the maximum
18838 single data access size for the chosen CPU model. The default is to
18839 arrange for 32-bit alignment. ABI details such as structure layout are
18840 not affected by these options.
18841
18842 @item -m32-bit
18843 @itemx -m16-bit
18844 @itemx -m8-bit
18845 @opindex m32-bit
18846 @opindex m16-bit
18847 @opindex m8-bit
18848 Similar to the stack- data- and const-align options above, these options
18849 arrange for stack frame, writable data and constants to all be 32-bit,
18850 16-bit or 8-bit aligned. The default is 32-bit alignment.
18851
18852 @item -mno-prologue-epilogue
18853 @itemx -mprologue-epilogue
18854 @opindex mno-prologue-epilogue
18855 @opindex mprologue-epilogue
18856 With @option{-mno-prologue-epilogue}, the normal function prologue and
18857 epilogue which set up the stack frame are omitted and no return
18858 instructions or return sequences are generated in the code. Use this
18859 option only together with visual inspection of the compiled code: no
18860 warnings or errors are generated when call-saved registers must be saved,
18861 or storage for local variables needs to be allocated.
18862
18863 @item -mno-gotplt
18864 @itemx -mgotplt
18865 @opindex mno-gotplt
18866 @opindex mgotplt
18867 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18868 instruction sequences that load addresses for functions from the PLT part
18869 of the GOT rather than (traditional on other architectures) calls to the
18870 PLT@. The default is @option{-mgotplt}.
18871
18872 @item -melf
18873 @opindex melf
18874 Legacy no-op option only recognized with the cris-axis-elf and
18875 cris-axis-linux-gnu targets.
18876
18877 @item -mlinux
18878 @opindex mlinux
18879 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18880
18881 @item -sim
18882 @opindex sim
18883 This option, recognized for the cris-axis-elf, arranges
18884 to link with input-output functions from a simulator library. Code,
18885 initialized data and zero-initialized data are allocated consecutively.
18886
18887 @item -sim2
18888 @opindex sim2
18889 Like @option{-sim}, but pass linker options to locate initialized data at
18890 0x40000000 and zero-initialized data at 0x80000000.
18891 @end table
18892
18893 @node CR16 Options
18894 @subsection CR16 Options
18895 @cindex CR16 Options
18896
18897 These options are defined specifically for the CR16 ports.
18898
18899 @table @gcctabopt
18900
18901 @item -mmac
18902 @opindex mmac
18903 Enable the use of multiply-accumulate instructions. Disabled by default.
18904
18905 @item -mcr16cplus
18906 @itemx -mcr16c
18907 @opindex mcr16cplus
18908 @opindex mcr16c
18909 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18910 is default.
18911
18912 @item -msim
18913 @opindex msim
18914 Links the library libsim.a which is in compatible with simulator. Applicable
18915 to ELF compiler only.
18916
18917 @item -mint32
18918 @opindex mint32
18919 Choose integer type as 32-bit wide.
18920
18921 @item -mbit-ops
18922 @opindex mbit-ops
18923 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18924
18925 @item -mdata-model=@var{model}
18926 @opindex mdata-model
18927 Choose a data model. The choices for @var{model} are @samp{near},
18928 @samp{far} or @samp{medium}. @samp{medium} is default.
18929 However, @samp{far} is not valid with @option{-mcr16c}, as the
18930 CR16C architecture does not support the far data model.
18931 @end table
18932
18933 @node C-SKY Options
18934 @subsection C-SKY Options
18935 @cindex C-SKY Options
18936
18937 GCC supports these options when compiling for C-SKY V2 processors.
18938
18939 @table @gcctabopt
18940
18941 @item -march=@var{arch}
18942 @opindex march=
18943 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18944 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18945 The default is @samp{ck810}.
18946
18947 @item -mcpu=@var{cpu}
18948 @opindex mcpu=
18949 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18950 @samp{ck801}, @samp{ck801t},
18951 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18952 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18953 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18954 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18955 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18956 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18957 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18958 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18959 @samp{ck803eftr1}, @samp{ck803efhtr1},
18960 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18961 @samp{ck803sef}, @samp{ck803seft},
18962 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18963 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18964 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18965 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18966
18967 @item -mbig-endian
18968 @opindex mbig-endian
18969 @itemx -EB
18970 @opindex EB
18971 @itemx -mlittle-endian
18972 @opindex mlittle-endian
18973 @itemx -EL
18974 @opindex EL
18975
18976 Select big- or little-endian code. The default is little-endian.
18977
18978 @item -mhard-float
18979 @opindex mhard-float
18980 @itemx -msoft-float
18981 @opindex msoft-float
18982
18983 Select hardware or software floating-point implementations.
18984 The default is soft float.
18985
18986 @item -mdouble-float
18987 @itemx -mno-double-float
18988 @opindex mdouble-float
18989 When @option{-mhard-float} is in effect, enable generation of
18990 double-precision float instructions. This is the default except
18991 when compiling for CK803.
18992
18993 @item -mfdivdu
18994 @itemx -mno-fdivdu
18995 @opindex mfdivdu
18996 When @option{-mhard-float} is in effect, enable generation of
18997 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18998 This is the default except when compiling for CK803.
18999
19000 @item -mfpu=@var{fpu}
19001 @opindex mfpu=
19002 Select the floating-point processor. This option can only be used with
19003 @option{-mhard-float}.
19004 Values for @var{fpu} are
19005 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19006 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19007 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19008
19009 @item -melrw
19010 @itemx -mno-elrw
19011 @opindex melrw
19012 Enable the extended @code{lrw} instruction. This option defaults to on
19013 for CK801 and off otherwise.
19014
19015 @item -mistack
19016 @itemx -mno-istack
19017 @opindex mistack
19018 Enable interrupt stack instructions; the default is off.
19019
19020 The @option{-mistack} option is required to handle the
19021 @code{interrupt} and @code{isr} function attributes
19022 (@pxref{C-SKY Function Attributes}).
19023
19024 @item -mmp
19025 @opindex mmp
19026 Enable multiprocessor instructions; the default is off.
19027
19028 @item -mcp
19029 @opindex mcp
19030 Enable coprocessor instructions; the default is off.
19031
19032 @item -mcache
19033 @opindex mcache
19034 Enable coprocessor instructions; the default is off.
19035
19036 @item -msecurity
19037 @opindex msecurity
19038 Enable C-SKY security instructions; the default is off.
19039
19040 @item -mtrust
19041 @opindex mtrust
19042 Enable C-SKY trust instructions; the default is off.
19043
19044 @item -mdsp
19045 @opindex mdsp
19046 @itemx -medsp
19047 @opindex medsp
19048 @itemx -mvdsp
19049 @opindex mvdsp
19050 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19051 All of these options default to off.
19052
19053 @item -mdiv
19054 @itemx -mno-div
19055 @opindex mdiv
19056 Generate divide instructions. Default is off.
19057
19058 @item -msmart
19059 @itemx -mno-smart
19060 @opindex msmart
19061 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19062 use of 16-bit instructions. This option is ignored for CK801 where this
19063 is the required behavior, and it defaults to on for CK802.
19064 For other targets, the default is off.
19065
19066 @item -mhigh-registers
19067 @itemx -mno-high-registers
19068 @opindex mhigh-registers
19069 Generate code using the high registers numbered 16-31. This option
19070 is not supported on CK801, CK802, or CK803, and is enabled by default
19071 for other processors.
19072
19073 @item -manchor
19074 @itemx -mno-anchor
19075 @opindex manchor
19076 Generate code using global anchor symbol addresses.
19077
19078 @item -mpushpop
19079 @itemx -mno-pushpop
19080 @opindex mpushpop
19081 Generate code using @code{push} and @code{pop} instructions. This option
19082 defaults to on.
19083
19084 @item -mmultiple-stld
19085 @itemx -mstm
19086 @itemx -mno-multiple-stld
19087 @itemx -mno-stm
19088 @opindex mmultiple-stld
19089 Generate code using @code{stm} and @code{ldm} instructions. This option
19090 isn't supported on CK801 but is enabled by default on other processors.
19091
19092 @item -mconstpool
19093 @itemx -mno-constpool
19094 @opindex mconstpool
19095 Create constant pools in the compiler instead of deferring it to the
19096 assembler. This option is the default and required for correct code
19097 generation on CK801 and CK802, and is optional on other processors.
19098
19099 @item -mstack-size
19100 @item -mno-stack-size
19101 @opindex mstack-size
19102 Emit @code{.stack_size} directives for each function in the assembly
19103 output. This option defaults to off.
19104
19105 @item -mccrt
19106 @itemx -mno-ccrt
19107 @opindex mccrt
19108 Generate code for the C-SKY compiler runtime instead of libgcc. This
19109 option defaults to off.
19110
19111 @item -mbranch-cost=@var{n}
19112 @opindex mbranch-cost=
19113 Set the branch costs to roughly @code{n} instructions. The default is 1.
19114
19115 @item -msched-prolog
19116 @itemx -mno-sched-prolog
19117 @opindex msched-prolog
19118 Permit scheduling of function prologue and epilogue sequences. Using
19119 this option can result in code that is not compliant with the C-SKY V2 ABI
19120 prologue requirements and that cannot be debugged or backtraced.
19121 It is disabled by default.
19122
19123 @end table
19124
19125 @node Darwin Options
19126 @subsection Darwin Options
19127 @cindex Darwin options
19128
19129 These options are defined for all architectures running the Darwin operating
19130 system.
19131
19132 FSF GCC on Darwin does not create ``fat'' object files; it creates
19133 an object file for the single architecture that GCC was built to
19134 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19135 @option{-arch} options are used; it does so by running the compiler or
19136 linker multiple times and joining the results together with
19137 @file{lipo}.
19138
19139 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19140 @samp{i686}) is determined by the flags that specify the ISA
19141 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19142 @option{-force_cpusubtype_ALL} option can be used to override this.
19143
19144 The Darwin tools vary in their behavior when presented with an ISA
19145 mismatch. The assembler, @file{as}, only permits instructions to
19146 be used that are valid for the subtype of the file it is generating,
19147 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19148 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19149 and prints an error if asked to create a shared library with a less
19150 restrictive subtype than its input files (for instance, trying to put
19151 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19152 for executables, @command{ld}, quietly gives the executable the most
19153 restrictive subtype of any of its input files.
19154
19155 @table @gcctabopt
19156 @item -F@var{dir}
19157 @opindex F
19158 Add the framework directory @var{dir} to the head of the list of
19159 directories to be searched for header files. These directories are
19160 interleaved with those specified by @option{-I} options and are
19161 scanned in a left-to-right order.
19162
19163 A framework directory is a directory with frameworks in it. A
19164 framework is a directory with a @file{Headers} and/or
19165 @file{PrivateHeaders} directory contained directly in it that ends
19166 in @file{.framework}. The name of a framework is the name of this
19167 directory excluding the @file{.framework}. Headers associated with
19168 the framework are found in one of those two directories, with
19169 @file{Headers} being searched first. A subframework is a framework
19170 directory that is in a framework's @file{Frameworks} directory.
19171 Includes of subframework headers can only appear in a header of a
19172 framework that contains the subframework, or in a sibling subframework
19173 header. Two subframeworks are siblings if they occur in the same
19174 framework. A subframework should not have the same name as a
19175 framework; a warning is issued if this is violated. Currently a
19176 subframework cannot have subframeworks; in the future, the mechanism
19177 may be extended to support this. The standard frameworks can be found
19178 in @file{/System/Library/Frameworks} and
19179 @file{/Library/Frameworks}. An example include looks like
19180 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19181 the name of the framework and @file{header.h} is found in the
19182 @file{PrivateHeaders} or @file{Headers} directory.
19183
19184 @item -iframework@var{dir}
19185 @opindex iframework
19186 Like @option{-F} except the directory is a treated as a system
19187 directory. The main difference between this @option{-iframework} and
19188 @option{-F} is that with @option{-iframework} the compiler does not
19189 warn about constructs contained within header files found via
19190 @var{dir}. This option is valid only for the C family of languages.
19191
19192 @item -gused
19193 @opindex gused
19194 Emit debugging information for symbols that are used. For stabs
19195 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19196 This is by default ON@.
19197
19198 @item -gfull
19199 @opindex gfull
19200 Emit debugging information for all symbols and types.
19201
19202 @item -mmacosx-version-min=@var{version}
19203 The earliest version of MacOS X that this executable will run on
19204 is @var{version}. Typical values of @var{version} include @code{10.1},
19205 @code{10.2}, and @code{10.3.9}.
19206
19207 If the compiler was built to use the system's headers by default,
19208 then the default for this option is the system version on which the
19209 compiler is running, otherwise the default is to make choices that
19210 are compatible with as many systems and code bases as possible.
19211
19212 @item -mkernel
19213 @opindex mkernel
19214 Enable kernel development mode. The @option{-mkernel} option sets
19215 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19216 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19217 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19218 applicable. This mode also sets @option{-mno-altivec},
19219 @option{-msoft-float}, @option{-fno-builtin} and
19220 @option{-mlong-branch} for PowerPC targets.
19221
19222 @item -mone-byte-bool
19223 @opindex mone-byte-bool
19224 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19225 By default @code{sizeof(bool)} is @code{4} when compiling for
19226 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19227 option has no effect on x86.
19228
19229 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19230 to generate code that is not binary compatible with code generated
19231 without that switch. Using this switch may require recompiling all
19232 other modules in a program, including system libraries. Use this
19233 switch to conform to a non-default data model.
19234
19235 @item -mfix-and-continue
19236 @itemx -ffix-and-continue
19237 @itemx -findirect-data
19238 @opindex mfix-and-continue
19239 @opindex ffix-and-continue
19240 @opindex findirect-data
19241 Generate code suitable for fast turnaround development, such as to
19242 allow GDB to dynamically load @file{.o} files into already-running
19243 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19244 are provided for backwards compatibility.
19245
19246 @item -all_load
19247 @opindex all_load
19248 Loads all members of static archive libraries.
19249 See man ld(1) for more information.
19250
19251 @item -arch_errors_fatal
19252 @opindex arch_errors_fatal
19253 Cause the errors having to do with files that have the wrong architecture
19254 to be fatal.
19255
19256 @item -bind_at_load
19257 @opindex bind_at_load
19258 Causes the output file to be marked such that the dynamic linker will
19259 bind all undefined references when the file is loaded or launched.
19260
19261 @item -bundle
19262 @opindex bundle
19263 Produce a Mach-o bundle format file.
19264 See man ld(1) for more information.
19265
19266 @item -bundle_loader @var{executable}
19267 @opindex bundle_loader
19268 This option specifies the @var{executable} that will load the build
19269 output file being linked. See man ld(1) for more information.
19270
19271 @item -dynamiclib
19272 @opindex dynamiclib
19273 When passed this option, GCC produces a dynamic library instead of
19274 an executable when linking, using the Darwin @file{libtool} command.
19275
19276 @item -force_cpusubtype_ALL
19277 @opindex force_cpusubtype_ALL
19278 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19279 one controlled by the @option{-mcpu} or @option{-march} option.
19280
19281 @item -allowable_client @var{client_name}
19282 @itemx -client_name
19283 @itemx -compatibility_version
19284 @itemx -current_version
19285 @itemx -dead_strip
19286 @itemx -dependency-file
19287 @itemx -dylib_file
19288 @itemx -dylinker_install_name
19289 @itemx -dynamic
19290 @itemx -exported_symbols_list
19291 @itemx -filelist
19292 @need 800
19293 @itemx -flat_namespace
19294 @itemx -force_flat_namespace
19295 @itemx -headerpad_max_install_names
19296 @itemx -image_base
19297 @itemx -init
19298 @itemx -install_name
19299 @itemx -keep_private_externs
19300 @itemx -multi_module
19301 @itemx -multiply_defined
19302 @itemx -multiply_defined_unused
19303 @need 800
19304 @itemx -noall_load
19305 @itemx -no_dead_strip_inits_and_terms
19306 @itemx -nofixprebinding
19307 @itemx -nomultidefs
19308 @itemx -noprebind
19309 @itemx -noseglinkedit
19310 @itemx -pagezero_size
19311 @itemx -prebind
19312 @itemx -prebind_all_twolevel_modules
19313 @itemx -private_bundle
19314 @need 800
19315 @itemx -read_only_relocs
19316 @itemx -sectalign
19317 @itemx -sectobjectsymbols
19318 @itemx -whyload
19319 @itemx -seg1addr
19320 @itemx -sectcreate
19321 @itemx -sectobjectsymbols
19322 @itemx -sectorder
19323 @itemx -segaddr
19324 @itemx -segs_read_only_addr
19325 @need 800
19326 @itemx -segs_read_write_addr
19327 @itemx -seg_addr_table
19328 @itemx -seg_addr_table_filename
19329 @itemx -seglinkedit
19330 @itemx -segprot
19331 @itemx -segs_read_only_addr
19332 @itemx -segs_read_write_addr
19333 @itemx -single_module
19334 @itemx -static
19335 @itemx -sub_library
19336 @need 800
19337 @itemx -sub_umbrella
19338 @itemx -twolevel_namespace
19339 @itemx -umbrella
19340 @itemx -undefined
19341 @itemx -unexported_symbols_list
19342 @itemx -weak_reference_mismatches
19343 @itemx -whatsloaded
19344 @opindex allowable_client
19345 @opindex client_name
19346 @opindex compatibility_version
19347 @opindex current_version
19348 @opindex dead_strip
19349 @opindex dependency-file
19350 @opindex dylib_file
19351 @opindex dylinker_install_name
19352 @opindex dynamic
19353 @opindex exported_symbols_list
19354 @opindex filelist
19355 @opindex flat_namespace
19356 @opindex force_flat_namespace
19357 @opindex headerpad_max_install_names
19358 @opindex image_base
19359 @opindex init
19360 @opindex install_name
19361 @opindex keep_private_externs
19362 @opindex multi_module
19363 @opindex multiply_defined
19364 @opindex multiply_defined_unused
19365 @opindex noall_load
19366 @opindex no_dead_strip_inits_and_terms
19367 @opindex nofixprebinding
19368 @opindex nomultidefs
19369 @opindex noprebind
19370 @opindex noseglinkedit
19371 @opindex pagezero_size
19372 @opindex prebind
19373 @opindex prebind_all_twolevel_modules
19374 @opindex private_bundle
19375 @opindex read_only_relocs
19376 @opindex sectalign
19377 @opindex sectobjectsymbols
19378 @opindex whyload
19379 @opindex seg1addr
19380 @opindex sectcreate
19381 @opindex sectobjectsymbols
19382 @opindex sectorder
19383 @opindex segaddr
19384 @opindex segs_read_only_addr
19385 @opindex segs_read_write_addr
19386 @opindex seg_addr_table
19387 @opindex seg_addr_table_filename
19388 @opindex seglinkedit
19389 @opindex segprot
19390 @opindex segs_read_only_addr
19391 @opindex segs_read_write_addr
19392 @opindex single_module
19393 @opindex static
19394 @opindex sub_library
19395 @opindex sub_umbrella
19396 @opindex twolevel_namespace
19397 @opindex umbrella
19398 @opindex undefined
19399 @opindex unexported_symbols_list
19400 @opindex weak_reference_mismatches
19401 @opindex whatsloaded
19402 These options are passed to the Darwin linker. The Darwin linker man page
19403 describes them in detail.
19404 @end table
19405
19406 @node DEC Alpha Options
19407 @subsection DEC Alpha Options
19408
19409 These @samp{-m} options are defined for the DEC Alpha implementations:
19410
19411 @table @gcctabopt
19412 @item -mno-soft-float
19413 @itemx -msoft-float
19414 @opindex mno-soft-float
19415 @opindex msoft-float
19416 Use (do not use) the hardware floating-point instructions for
19417 floating-point operations. When @option{-msoft-float} is specified,
19418 functions in @file{libgcc.a} are used to perform floating-point
19419 operations. Unless they are replaced by routines that emulate the
19420 floating-point operations, or compiled in such a way as to call such
19421 emulations routines, these routines issue floating-point
19422 operations. If you are compiling for an Alpha without floating-point
19423 operations, you must ensure that the library is built so as not to call
19424 them.
19425
19426 Note that Alpha implementations without floating-point operations are
19427 required to have floating-point registers.
19428
19429 @item -mfp-reg
19430 @itemx -mno-fp-regs
19431 @opindex mfp-reg
19432 @opindex mno-fp-regs
19433 Generate code that uses (does not use) the floating-point register set.
19434 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19435 register set is not used, floating-point operands are passed in integer
19436 registers as if they were integers and floating-point results are passed
19437 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19438 so any function with a floating-point argument or return value called by code
19439 compiled with @option{-mno-fp-regs} must also be compiled with that
19440 option.
19441
19442 A typical use of this option is building a kernel that does not use,
19443 and hence need not save and restore, any floating-point registers.
19444
19445 @item -mieee
19446 @opindex mieee
19447 The Alpha architecture implements floating-point hardware optimized for
19448 maximum performance. It is mostly compliant with the IEEE floating-point
19449 standard. However, for full compliance, software assistance is
19450 required. This option generates code fully IEEE-compliant code
19451 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19452 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19453 defined during compilation. The resulting code is less efficient but is
19454 able to correctly support denormalized numbers and exceptional IEEE
19455 values such as not-a-number and plus/minus infinity. Other Alpha
19456 compilers call this option @option{-ieee_with_no_inexact}.
19457
19458 @item -mieee-with-inexact
19459 @opindex mieee-with-inexact
19460 This is like @option{-mieee} except the generated code also maintains
19461 the IEEE @var{inexact-flag}. Turning on this option causes the
19462 generated code to implement fully-compliant IEEE math. In addition to
19463 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19464 macro. On some Alpha implementations the resulting code may execute
19465 significantly slower than the code generated by default. Since there is
19466 very little code that depends on the @var{inexact-flag}, you should
19467 normally not specify this option. Other Alpha compilers call this
19468 option @option{-ieee_with_inexact}.
19469
19470 @item -mfp-trap-mode=@var{trap-mode}
19471 @opindex mfp-trap-mode
19472 This option controls what floating-point related traps are enabled.
19473 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19474 The trap mode can be set to one of four values:
19475
19476 @table @samp
19477 @item n
19478 This is the default (normal) setting. The only traps that are enabled
19479 are the ones that cannot be disabled in software (e.g., division by zero
19480 trap).
19481
19482 @item u
19483 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19484 as well.
19485
19486 @item su
19487 Like @samp{u}, but the instructions are marked to be safe for software
19488 completion (see Alpha architecture manual for details).
19489
19490 @item sui
19491 Like @samp{su}, but inexact traps are enabled as well.
19492 @end table
19493
19494 @item -mfp-rounding-mode=@var{rounding-mode}
19495 @opindex mfp-rounding-mode
19496 Selects the IEEE rounding mode. Other Alpha compilers call this option
19497 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19498 of:
19499
19500 @table @samp
19501 @item n
19502 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19503 the nearest machine number or towards the even machine number in case
19504 of a tie.
19505
19506 @item m
19507 Round towards minus infinity.
19508
19509 @item c
19510 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19511
19512 @item d
19513 Dynamic rounding mode. A field in the floating-point control register
19514 (@var{fpcr}, see Alpha architecture reference manual) controls the
19515 rounding mode in effect. The C library initializes this register for
19516 rounding towards plus infinity. Thus, unless your program modifies the
19517 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19518 @end table
19519
19520 @item -mtrap-precision=@var{trap-precision}
19521 @opindex mtrap-precision
19522 In the Alpha architecture, floating-point traps are imprecise. This
19523 means without software assistance it is impossible to recover from a
19524 floating trap and program execution normally needs to be terminated.
19525 GCC can generate code that can assist operating system trap handlers
19526 in determining the exact location that caused a floating-point trap.
19527 Depending on the requirements of an application, different levels of
19528 precisions can be selected:
19529
19530 @table @samp
19531 @item p
19532 Program precision. This option is the default and means a trap handler
19533 can only identify which program caused a floating-point exception.
19534
19535 @item f
19536 Function precision. The trap handler can determine the function that
19537 caused a floating-point exception.
19538
19539 @item i
19540 Instruction precision. The trap handler can determine the exact
19541 instruction that caused a floating-point exception.
19542 @end table
19543
19544 Other Alpha compilers provide the equivalent options called
19545 @option{-scope_safe} and @option{-resumption_safe}.
19546
19547 @item -mieee-conformant
19548 @opindex mieee-conformant
19549 This option marks the generated code as IEEE conformant. You must not
19550 use this option unless you also specify @option{-mtrap-precision=i} and either
19551 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19552 is to emit the line @samp{.eflag 48} in the function prologue of the
19553 generated assembly file.
19554
19555 @item -mbuild-constants
19556 @opindex mbuild-constants
19557 Normally GCC examines a 32- or 64-bit integer constant to
19558 see if it can construct it from smaller constants in two or three
19559 instructions. If it cannot, it outputs the constant as a literal and
19560 generates code to load it from the data segment at run time.
19561
19562 Use this option to require GCC to construct @emph{all} integer constants
19563 using code, even if it takes more instructions (the maximum is six).
19564
19565 You typically use this option to build a shared library dynamic
19566 loader. Itself a shared library, it must relocate itself in memory
19567 before it can find the variables and constants in its own data segment.
19568
19569 @item -mbwx
19570 @itemx -mno-bwx
19571 @itemx -mcix
19572 @itemx -mno-cix
19573 @itemx -mfix
19574 @itemx -mno-fix
19575 @itemx -mmax
19576 @itemx -mno-max
19577 @opindex mbwx
19578 @opindex mno-bwx
19579 @opindex mcix
19580 @opindex mno-cix
19581 @opindex mfix
19582 @opindex mno-fix
19583 @opindex mmax
19584 @opindex mno-max
19585 Indicate whether GCC should generate code to use the optional BWX,
19586 CIX, FIX and MAX instruction sets. The default is to use the instruction
19587 sets supported by the CPU type specified via @option{-mcpu=} option or that
19588 of the CPU on which GCC was built if none is specified.
19589
19590 @item -mfloat-vax
19591 @itemx -mfloat-ieee
19592 @opindex mfloat-vax
19593 @opindex mfloat-ieee
19594 Generate code that uses (does not use) VAX F and G floating-point
19595 arithmetic instead of IEEE single and double precision.
19596
19597 @item -mexplicit-relocs
19598 @itemx -mno-explicit-relocs
19599 @opindex mexplicit-relocs
19600 @opindex mno-explicit-relocs
19601 Older Alpha assemblers provided no way to generate symbol relocations
19602 except via assembler macros. Use of these macros does not allow
19603 optimal instruction scheduling. GNU binutils as of version 2.12
19604 supports a new syntax that allows the compiler to explicitly mark
19605 which relocations should apply to which instructions. This option
19606 is mostly useful for debugging, as GCC detects the capabilities of
19607 the assembler when it is built and sets the default accordingly.
19608
19609 @item -msmall-data
19610 @itemx -mlarge-data
19611 @opindex msmall-data
19612 @opindex mlarge-data
19613 When @option{-mexplicit-relocs} is in effect, static data is
19614 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19615 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19616 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19617 16-bit relocations off of the @code{$gp} register. This limits the
19618 size of the small data area to 64KB, but allows the variables to be
19619 directly accessed via a single instruction.
19620
19621 The default is @option{-mlarge-data}. With this option the data area
19622 is limited to just below 2GB@. Programs that require more than 2GB of
19623 data must use @code{malloc} or @code{mmap} to allocate the data in the
19624 heap instead of in the program's data segment.
19625
19626 When generating code for shared libraries, @option{-fpic} implies
19627 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19628
19629 @item -msmall-text
19630 @itemx -mlarge-text
19631 @opindex msmall-text
19632 @opindex mlarge-text
19633 When @option{-msmall-text} is used, the compiler assumes that the
19634 code of the entire program (or shared library) fits in 4MB, and is
19635 thus reachable with a branch instruction. When @option{-msmall-data}
19636 is used, the compiler can assume that all local symbols share the
19637 same @code{$gp} value, and thus reduce the number of instructions
19638 required for a function call from 4 to 1.
19639
19640 The default is @option{-mlarge-text}.
19641
19642 @item -mcpu=@var{cpu_type}
19643 @opindex mcpu
19644 Set the instruction set and instruction scheduling parameters for
19645 machine type @var{cpu_type}. You can specify either the @samp{EV}
19646 style name or the corresponding chip number. GCC supports scheduling
19647 parameters for the EV4, EV5 and EV6 family of processors and
19648 chooses the default values for the instruction set from the processor
19649 you specify. If you do not specify a processor type, GCC defaults
19650 to the processor on which the compiler was built.
19651
19652 Supported values for @var{cpu_type} are
19653
19654 @table @samp
19655 @item ev4
19656 @itemx ev45
19657 @itemx 21064
19658 Schedules as an EV4 and has no instruction set extensions.
19659
19660 @item ev5
19661 @itemx 21164
19662 Schedules as an EV5 and has no instruction set extensions.
19663
19664 @item ev56
19665 @itemx 21164a
19666 Schedules as an EV5 and supports the BWX extension.
19667
19668 @item pca56
19669 @itemx 21164pc
19670 @itemx 21164PC
19671 Schedules as an EV5 and supports the BWX and MAX extensions.
19672
19673 @item ev6
19674 @itemx 21264
19675 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19676
19677 @item ev67
19678 @itemx 21264a
19679 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19680 @end table
19681
19682 Native toolchains also support the value @samp{native},
19683 which selects the best architecture option for the host processor.
19684 @option{-mcpu=native} has no effect if GCC does not recognize
19685 the processor.
19686
19687 @item -mtune=@var{cpu_type}
19688 @opindex mtune
19689 Set only the instruction scheduling parameters for machine type
19690 @var{cpu_type}. The instruction set is not changed.
19691
19692 Native toolchains also support the value @samp{native},
19693 which selects the best architecture option for the host processor.
19694 @option{-mtune=native} has no effect if GCC does not recognize
19695 the processor.
19696
19697 @item -mmemory-latency=@var{time}
19698 @opindex mmemory-latency
19699 Sets the latency the scheduler should assume for typical memory
19700 references as seen by the application. This number is highly
19701 dependent on the memory access patterns used by the application
19702 and the size of the external cache on the machine.
19703
19704 Valid options for @var{time} are
19705
19706 @table @samp
19707 @item @var{number}
19708 A decimal number representing clock cycles.
19709
19710 @item L1
19711 @itemx L2
19712 @itemx L3
19713 @itemx main
19714 The compiler contains estimates of the number of clock cycles for
19715 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19716 (also called Dcache, Scache, and Bcache), as well as to main memory.
19717 Note that L3 is only valid for EV5.
19718
19719 @end table
19720 @end table
19721
19722 @node FR30 Options
19723 @subsection FR30 Options
19724 @cindex FR30 Options
19725
19726 These options are defined specifically for the FR30 port.
19727
19728 @table @gcctabopt
19729
19730 @item -msmall-model
19731 @opindex msmall-model
19732 Use the small address space model. This can produce smaller code, but
19733 it does assume that all symbolic values and addresses fit into a
19734 20-bit range.
19735
19736 @item -mno-lsim
19737 @opindex mno-lsim
19738 Assume that runtime support has been provided and so there is no need
19739 to include the simulator library (@file{libsim.a}) on the linker
19740 command line.
19741
19742 @end table
19743
19744 @node FT32 Options
19745 @subsection FT32 Options
19746 @cindex FT32 Options
19747
19748 These options are defined specifically for the FT32 port.
19749
19750 @table @gcctabopt
19751
19752 @item -msim
19753 @opindex msim
19754 Specifies that the program will be run on the simulator. This causes
19755 an alternate runtime startup and library to be linked.
19756 You must not use this option when generating programs that will run on
19757 real hardware; you must provide your own runtime library for whatever
19758 I/O functions are needed.
19759
19760 @item -mlra
19761 @opindex mlra
19762 Enable Local Register Allocation. This is still experimental for FT32,
19763 so by default the compiler uses standard reload.
19764
19765 @item -mnodiv
19766 @opindex mnodiv
19767 Do not use div and mod instructions.
19768
19769 @item -mft32b
19770 @opindex mft32b
19771 Enable use of the extended instructions of the FT32B processor.
19772
19773 @item -mcompress
19774 @opindex mcompress
19775 Compress all code using the Ft32B code compression scheme.
19776
19777 @item -mnopm
19778 @opindex mnopm
19779 Do not generate code that reads program memory.
19780
19781 @end table
19782
19783 @node FRV Options
19784 @subsection FRV Options
19785 @cindex FRV Options
19786
19787 @table @gcctabopt
19788 @item -mgpr-32
19789 @opindex mgpr-32
19790
19791 Only use the first 32 general-purpose registers.
19792
19793 @item -mgpr-64
19794 @opindex mgpr-64
19795
19796 Use all 64 general-purpose registers.
19797
19798 @item -mfpr-32
19799 @opindex mfpr-32
19800
19801 Use only the first 32 floating-point registers.
19802
19803 @item -mfpr-64
19804 @opindex mfpr-64
19805
19806 Use all 64 floating-point registers.
19807
19808 @item -mhard-float
19809 @opindex mhard-float
19810
19811 Use hardware instructions for floating-point operations.
19812
19813 @item -msoft-float
19814 @opindex msoft-float
19815
19816 Use library routines for floating-point operations.
19817
19818 @item -malloc-cc
19819 @opindex malloc-cc
19820
19821 Dynamically allocate condition code registers.
19822
19823 @item -mfixed-cc
19824 @opindex mfixed-cc
19825
19826 Do not try to dynamically allocate condition code registers, only
19827 use @code{icc0} and @code{fcc0}.
19828
19829 @item -mdword
19830 @opindex mdword
19831
19832 Change ABI to use double word insns.
19833
19834 @item -mno-dword
19835 @opindex mno-dword
19836 @opindex mdword
19837
19838 Do not use double word instructions.
19839
19840 @item -mdouble
19841 @opindex mdouble
19842
19843 Use floating-point double instructions.
19844
19845 @item -mno-double
19846 @opindex mno-double
19847
19848 Do not use floating-point double instructions.
19849
19850 @item -mmedia
19851 @opindex mmedia
19852
19853 Use media instructions.
19854
19855 @item -mno-media
19856 @opindex mno-media
19857
19858 Do not use media instructions.
19859
19860 @item -mmuladd
19861 @opindex mmuladd
19862
19863 Use multiply and add/subtract instructions.
19864
19865 @item -mno-muladd
19866 @opindex mno-muladd
19867
19868 Do not use multiply and add/subtract instructions.
19869
19870 @item -mfdpic
19871 @opindex mfdpic
19872
19873 Select the FDPIC ABI, which uses function descriptors to represent
19874 pointers to functions. Without any PIC/PIE-related options, it
19875 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19876 assumes GOT entries and small data are within a 12-bit range from the
19877 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19878 are computed with 32 bits.
19879 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19880
19881 @item -minline-plt
19882 @opindex minline-plt
19883
19884 Enable inlining of PLT entries in function calls to functions that are
19885 not known to bind locally. It has no effect without @option{-mfdpic}.
19886 It's enabled by default if optimizing for speed and compiling for
19887 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19888 optimization option such as @option{-O3} or above is present in the
19889 command line.
19890
19891 @item -mTLS
19892 @opindex mTLS
19893
19894 Assume a large TLS segment when generating thread-local code.
19895
19896 @item -mtls
19897 @opindex mtls
19898
19899 Do not assume a large TLS segment when generating thread-local code.
19900
19901 @item -mgprel-ro
19902 @opindex mgprel-ro
19903
19904 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19905 that is known to be in read-only sections. It's enabled by default,
19906 except for @option{-fpic} or @option{-fpie}: even though it may help
19907 make the global offset table smaller, it trades 1 instruction for 4.
19908 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19909 one of which may be shared by multiple symbols, and it avoids the need
19910 for a GOT entry for the referenced symbol, so it's more likely to be a
19911 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19912
19913 @item -multilib-library-pic
19914 @opindex multilib-library-pic
19915
19916 Link with the (library, not FD) pic libraries. It's implied by
19917 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19918 @option{-fpic} without @option{-mfdpic}. You should never have to use
19919 it explicitly.
19920
19921 @item -mlinked-fp
19922 @opindex mlinked-fp
19923
19924 Follow the EABI requirement of always creating a frame pointer whenever
19925 a stack frame is allocated. This option is enabled by default and can
19926 be disabled with @option{-mno-linked-fp}.
19927
19928 @item -mlong-calls
19929 @opindex mlong-calls
19930
19931 Use indirect addressing to call functions outside the current
19932 compilation unit. This allows the functions to be placed anywhere
19933 within the 32-bit address space.
19934
19935 @item -malign-labels
19936 @opindex malign-labels
19937
19938 Try to align labels to an 8-byte boundary by inserting NOPs into the
19939 previous packet. This option only has an effect when VLIW packing
19940 is enabled. It doesn't create new packets; it merely adds NOPs to
19941 existing ones.
19942
19943 @item -mlibrary-pic
19944 @opindex mlibrary-pic
19945
19946 Generate position-independent EABI code.
19947
19948 @item -macc-4
19949 @opindex macc-4
19950
19951 Use only the first four media accumulator registers.
19952
19953 @item -macc-8
19954 @opindex macc-8
19955
19956 Use all eight media accumulator registers.
19957
19958 @item -mpack
19959 @opindex mpack
19960
19961 Pack VLIW instructions.
19962
19963 @item -mno-pack
19964 @opindex mno-pack
19965
19966 Do not pack VLIW instructions.
19967
19968 @item -mno-eflags
19969 @opindex mno-eflags
19970
19971 Do not mark ABI switches in e_flags.
19972
19973 @item -mcond-move
19974 @opindex mcond-move
19975
19976 Enable the use of conditional-move instructions (default).
19977
19978 This switch is mainly for debugging the compiler and will likely be removed
19979 in a future version.
19980
19981 @item -mno-cond-move
19982 @opindex mno-cond-move
19983
19984 Disable the use of conditional-move instructions.
19985
19986 This switch is mainly for debugging the compiler and will likely be removed
19987 in a future version.
19988
19989 @item -mscc
19990 @opindex mscc
19991
19992 Enable the use of conditional set instructions (default).
19993
19994 This switch is mainly for debugging the compiler and will likely be removed
19995 in a future version.
19996
19997 @item -mno-scc
19998 @opindex mno-scc
19999
20000 Disable the use of conditional set instructions.
20001
20002 This switch is mainly for debugging the compiler and will likely be removed
20003 in a future version.
20004
20005 @item -mcond-exec
20006 @opindex mcond-exec
20007
20008 Enable the use of conditional execution (default).
20009
20010 This switch is mainly for debugging the compiler and will likely be removed
20011 in a future version.
20012
20013 @item -mno-cond-exec
20014 @opindex mno-cond-exec
20015
20016 Disable the use of conditional execution.
20017
20018 This switch is mainly for debugging the compiler and will likely be removed
20019 in a future version.
20020
20021 @item -mvliw-branch
20022 @opindex mvliw-branch
20023
20024 Run a pass to pack branches into VLIW instructions (default).
20025
20026 This switch is mainly for debugging the compiler and will likely be removed
20027 in a future version.
20028
20029 @item -mno-vliw-branch
20030 @opindex mno-vliw-branch
20031
20032 Do not run a pass to pack branches into VLIW instructions.
20033
20034 This switch is mainly for debugging the compiler and will likely be removed
20035 in a future version.
20036
20037 @item -mmulti-cond-exec
20038 @opindex mmulti-cond-exec
20039
20040 Enable optimization of @code{&&} and @code{||} in conditional execution
20041 (default).
20042
20043 This switch is mainly for debugging the compiler and will likely be removed
20044 in a future version.
20045
20046 @item -mno-multi-cond-exec
20047 @opindex mno-multi-cond-exec
20048
20049 Disable optimization of @code{&&} and @code{||} in conditional execution.
20050
20051 This switch is mainly for debugging the compiler and will likely be removed
20052 in a future version.
20053
20054 @item -mnested-cond-exec
20055 @opindex mnested-cond-exec
20056
20057 Enable nested conditional execution optimizations (default).
20058
20059 This switch is mainly for debugging the compiler and will likely be removed
20060 in a future version.
20061
20062 @item -mno-nested-cond-exec
20063 @opindex mno-nested-cond-exec
20064
20065 Disable nested conditional execution optimizations.
20066
20067 This switch is mainly for debugging the compiler and will likely be removed
20068 in a future version.
20069
20070 @item -moptimize-membar
20071 @opindex moptimize-membar
20072
20073 This switch removes redundant @code{membar} instructions from the
20074 compiler-generated code. It is enabled by default.
20075
20076 @item -mno-optimize-membar
20077 @opindex mno-optimize-membar
20078 @opindex moptimize-membar
20079
20080 This switch disables the automatic removal of redundant @code{membar}
20081 instructions from the generated code.
20082
20083 @item -mtomcat-stats
20084 @opindex mtomcat-stats
20085
20086 Cause gas to print out tomcat statistics.
20087
20088 @item -mcpu=@var{cpu}
20089 @opindex mcpu
20090
20091 Select the processor type for which to generate code. Possible values are
20092 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20093 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20094
20095 @end table
20096
20097 @node GNU/Linux Options
20098 @subsection GNU/Linux Options
20099
20100 These @samp{-m} options are defined for GNU/Linux targets:
20101
20102 @table @gcctabopt
20103 @item -mglibc
20104 @opindex mglibc
20105 Use the GNU C library. This is the default except
20106 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20107 @samp{*-*-linux-*android*} targets.
20108
20109 @item -muclibc
20110 @opindex muclibc
20111 Use uClibc C library. This is the default on
20112 @samp{*-*-linux-*uclibc*} targets.
20113
20114 @item -mmusl
20115 @opindex mmusl
20116 Use the musl C library. This is the default on
20117 @samp{*-*-linux-*musl*} targets.
20118
20119 @item -mbionic
20120 @opindex mbionic
20121 Use Bionic C library. This is the default on
20122 @samp{*-*-linux-*android*} targets.
20123
20124 @item -mandroid
20125 @opindex mandroid
20126 Compile code compatible with Android platform. This is the default on
20127 @samp{*-*-linux-*android*} targets.
20128
20129 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20130 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20131 this option makes the GCC driver pass Android-specific options to the linker.
20132 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20133 to be defined.
20134
20135 @item -tno-android-cc
20136 @opindex tno-android-cc
20137 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20138 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20139 @option{-fno-rtti} by default.
20140
20141 @item -tno-android-ld
20142 @opindex tno-android-ld
20143 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20144 linking options to the linker.
20145
20146 @end table
20147
20148 @node H8/300 Options
20149 @subsection H8/300 Options
20150
20151 These @samp{-m} options are defined for the H8/300 implementations:
20152
20153 @table @gcctabopt
20154 @item -mrelax
20155 @opindex mrelax
20156 Shorten some address references at link time, when possible; uses the
20157 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20158 ld, Using ld}, for a fuller description.
20159
20160 @item -mh
20161 @opindex mh
20162 Generate code for the H8/300H@.
20163
20164 @item -ms
20165 @opindex ms
20166 Generate code for the H8S@.
20167
20168 @item -mn
20169 @opindex mn
20170 Generate code for the H8S and H8/300H in the normal mode. This switch
20171 must be used either with @option{-mh} or @option{-ms}.
20172
20173 @item -ms2600
20174 @opindex ms2600
20175 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20176
20177 @item -mexr
20178 @opindex mexr
20179 Extended registers are stored on stack before execution of function
20180 with monitor attribute. Default option is @option{-mexr}.
20181 This option is valid only for H8S targets.
20182
20183 @item -mno-exr
20184 @opindex mno-exr
20185 @opindex mexr
20186 Extended registers are not stored on stack before execution of function
20187 with monitor attribute. Default option is @option{-mno-exr}.
20188 This option is valid only for H8S targets.
20189
20190 @item -mint32
20191 @opindex mint32
20192 Make @code{int} data 32 bits by default.
20193
20194 @item -malign-300
20195 @opindex malign-300
20196 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20197 The default for the H8/300H and H8S is to align longs and floats on
20198 4-byte boundaries.
20199 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20200 This option has no effect on the H8/300.
20201 @end table
20202
20203 @node HPPA Options
20204 @subsection HPPA Options
20205 @cindex HPPA Options
20206
20207 These @samp{-m} options are defined for the HPPA family of computers:
20208
20209 @table @gcctabopt
20210 @item -march=@var{architecture-type}
20211 @opindex march
20212 Generate code for the specified architecture. The choices for
20213 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20214 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20215 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20216 architecture option for your machine. Code compiled for lower numbered
20217 architectures runs on higher numbered architectures, but not the
20218 other way around.
20219
20220 @item -mpa-risc-1-0
20221 @itemx -mpa-risc-1-1
20222 @itemx -mpa-risc-2-0
20223 @opindex mpa-risc-1-0
20224 @opindex mpa-risc-1-1
20225 @opindex mpa-risc-2-0
20226 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20227
20228 @item -mcaller-copies
20229 @opindex mcaller-copies
20230 The caller copies function arguments passed by hidden reference. This
20231 option should be used with care as it is not compatible with the default
20232 32-bit runtime. However, only aggregates larger than eight bytes are
20233 passed by hidden reference and the option provides better compatibility
20234 with OpenMP.
20235
20236 @item -mjump-in-delay
20237 @opindex mjump-in-delay
20238 This option is ignored and provided for compatibility purposes only.
20239
20240 @item -mdisable-fpregs
20241 @opindex mdisable-fpregs
20242 Prevent floating-point registers from being used in any manner. This is
20243 necessary for compiling kernels that perform lazy context switching of
20244 floating-point registers. If you use this option and attempt to perform
20245 floating-point operations, the compiler aborts.
20246
20247 @item -mdisable-indexing
20248 @opindex mdisable-indexing
20249 Prevent the compiler from using indexing address modes. This avoids some
20250 rather obscure problems when compiling MIG generated code under MACH@.
20251
20252 @item -mno-space-regs
20253 @opindex mno-space-regs
20254 @opindex mspace-regs
20255 Generate code that assumes the target has no space registers. This allows
20256 GCC to generate faster indirect calls and use unscaled index address modes.
20257
20258 Such code is suitable for level 0 PA systems and kernels.
20259
20260 @item -mfast-indirect-calls
20261 @opindex mfast-indirect-calls
20262 Generate code that assumes calls never cross space boundaries. This
20263 allows GCC to emit code that performs faster indirect calls.
20264
20265 This option does not work in the presence of shared libraries or nested
20266 functions.
20267
20268 @item -mfixed-range=@var{register-range}
20269 @opindex mfixed-range
20270 Generate code treating the given register range as fixed registers.
20271 A fixed register is one that the register allocator cannot use. This is
20272 useful when compiling kernel code. A register range is specified as
20273 two registers separated by a dash. Multiple register ranges can be
20274 specified separated by a comma.
20275
20276 @item -mlong-load-store
20277 @opindex mlong-load-store
20278 Generate 3-instruction load and store sequences as sometimes required by
20279 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20280 the HP compilers.
20281
20282 @item -mportable-runtime
20283 @opindex mportable-runtime
20284 Use the portable calling conventions proposed by HP for ELF systems.
20285
20286 @item -mgas
20287 @opindex mgas
20288 Enable the use of assembler directives only GAS understands.
20289
20290 @item -mschedule=@var{cpu-type}
20291 @opindex mschedule
20292 Schedule code according to the constraints for the machine type
20293 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20294 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20295 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20296 proper scheduling option for your machine. The default scheduling is
20297 @samp{8000}.
20298
20299 @item -mlinker-opt
20300 @opindex mlinker-opt
20301 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20302 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20303 linkers in which they give bogus error messages when linking some programs.
20304
20305 @item -msoft-float
20306 @opindex msoft-float
20307 Generate output containing library calls for floating point.
20308 @strong{Warning:} the requisite libraries are not available for all HPPA
20309 targets. Normally the facilities of the machine's usual C compiler are
20310 used, but this cannot be done directly in cross-compilation. You must make
20311 your own arrangements to provide suitable library functions for
20312 cross-compilation.
20313
20314 @option{-msoft-float} changes the calling convention in the output file;
20315 therefore, it is only useful if you compile @emph{all} of a program with
20316 this option. In particular, you need to compile @file{libgcc.a}, the
20317 library that comes with GCC, with @option{-msoft-float} in order for
20318 this to work.
20319
20320 @item -msio
20321 @opindex msio
20322 Generate the predefine, @code{_SIO}, for server IO@. The default is
20323 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20324 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20325 options are available under HP-UX and HI-UX@.
20326
20327 @item -mgnu-ld
20328 @opindex mgnu-ld
20329 Use options specific to GNU @command{ld}.
20330 This passes @option{-shared} to @command{ld} when
20331 building a shared library. It is the default when GCC is configured,
20332 explicitly or implicitly, with the GNU linker. This option does not
20333 affect which @command{ld} is called; it only changes what parameters
20334 are passed to that @command{ld}.
20335 The @command{ld} that is called is determined by the
20336 @option{--with-ld} configure option, GCC's program search path, and
20337 finally by the user's @env{PATH}. The linker used by GCC can be printed
20338 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20339 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20340
20341 @item -mhp-ld
20342 @opindex mhp-ld
20343 Use options specific to HP @command{ld}.
20344 This passes @option{-b} to @command{ld} when building
20345 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20346 links. It is the default when GCC is configured, explicitly or
20347 implicitly, with the HP linker. This option does not affect
20348 which @command{ld} is called; it only changes what parameters are passed to that
20349 @command{ld}.
20350 The @command{ld} that is called is determined by the @option{--with-ld}
20351 configure option, GCC's program search path, and finally by the user's
20352 @env{PATH}. The linker used by GCC can be printed using @samp{which
20353 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20354 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20355
20356 @item -mlong-calls
20357 @opindex mno-long-calls
20358 @opindex mlong-calls
20359 Generate code that uses long call sequences. This ensures that a call
20360 is always able to reach linker generated stubs. The default is to generate
20361 long calls only when the distance from the call site to the beginning
20362 of the function or translation unit, as the case may be, exceeds a
20363 predefined limit set by the branch type being used. The limits for
20364 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20365 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20366 240,000 bytes.
20367
20368 Distances are measured from the beginning of functions when using the
20369 @option{-ffunction-sections} option, or when using the @option{-mgas}
20370 and @option{-mno-portable-runtime} options together under HP-UX with
20371 the SOM linker.
20372
20373 It is normally not desirable to use this option as it degrades
20374 performance. However, it may be useful in large applications,
20375 particularly when partial linking is used to build the application.
20376
20377 The types of long calls used depends on the capabilities of the
20378 assembler and linker, and the type of code being generated. The
20379 impact on systems that support long absolute calls, and long pic
20380 symbol-difference or pc-relative calls should be relatively small.
20381 However, an indirect call is used on 32-bit ELF systems in pic code
20382 and it is quite long.
20383
20384 @item -munix=@var{unix-std}
20385 @opindex march
20386 Generate compiler predefines and select a startfile for the specified
20387 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20388 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20389 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20390 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20391 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20392 and later.
20393
20394 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20395 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20396 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20397 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20398 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20399 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20400
20401 It is @emph{important} to note that this option changes the interfaces
20402 for various library routines. It also affects the operational behavior
20403 of the C library. Thus, @emph{extreme} care is needed in using this
20404 option.
20405
20406 Library code that is intended to operate with more than one UNIX
20407 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20408 as appropriate. Most GNU software doesn't provide this capability.
20409
20410 @item -nolibdld
20411 @opindex nolibdld
20412 Suppress the generation of link options to search libdld.sl when the
20413 @option{-static} option is specified on HP-UX 10 and later.
20414
20415 @item -static
20416 @opindex static
20417 The HP-UX implementation of setlocale in libc has a dependency on
20418 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20419 when the @option{-static} option is specified, special link options
20420 are needed to resolve this dependency.
20421
20422 On HP-UX 10 and later, the GCC driver adds the necessary options to
20423 link with libdld.sl when the @option{-static} option is specified.
20424 This causes the resulting binary to be dynamic. On the 64-bit port,
20425 the linkers generate dynamic binaries by default in any case. The
20426 @option{-nolibdld} option can be used to prevent the GCC driver from
20427 adding these link options.
20428
20429 @item -threads
20430 @opindex threads
20431 Add support for multithreading with the @dfn{dce thread} library
20432 under HP-UX@. This option sets flags for both the preprocessor and
20433 linker.
20434 @end table
20435
20436 @node IA-64 Options
20437 @subsection IA-64 Options
20438 @cindex IA-64 Options
20439
20440 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20441
20442 @table @gcctabopt
20443 @item -mbig-endian
20444 @opindex mbig-endian
20445 Generate code for a big-endian target. This is the default for HP-UX@.
20446
20447 @item -mlittle-endian
20448 @opindex mlittle-endian
20449 Generate code for a little-endian target. This is the default for AIX5
20450 and GNU/Linux.
20451
20452 @item -mgnu-as
20453 @itemx -mno-gnu-as
20454 @opindex mgnu-as
20455 @opindex mno-gnu-as
20456 Generate (or don't) code for the GNU assembler. This is the default.
20457 @c Also, this is the default if the configure option @option{--with-gnu-as}
20458 @c is used.
20459
20460 @item -mgnu-ld
20461 @itemx -mno-gnu-ld
20462 @opindex mgnu-ld
20463 @opindex mno-gnu-ld
20464 Generate (or don't) code for the GNU linker. This is the default.
20465 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20466 @c is used.
20467
20468 @item -mno-pic
20469 @opindex mno-pic
20470 Generate code that does not use a global pointer register. The result
20471 is not position independent code, and violates the IA-64 ABI@.
20472
20473 @item -mvolatile-asm-stop
20474 @itemx -mno-volatile-asm-stop
20475 @opindex mvolatile-asm-stop
20476 @opindex mno-volatile-asm-stop
20477 Generate (or don't) a stop bit immediately before and after volatile asm
20478 statements.
20479
20480 @item -mregister-names
20481 @itemx -mno-register-names
20482 @opindex mregister-names
20483 @opindex mno-register-names
20484 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20485 the stacked registers. This may make assembler output more readable.
20486
20487 @item -mno-sdata
20488 @itemx -msdata
20489 @opindex mno-sdata
20490 @opindex msdata
20491 Disable (or enable) optimizations that use the small data section. This may
20492 be useful for working around optimizer bugs.
20493
20494 @item -mconstant-gp
20495 @opindex mconstant-gp
20496 Generate code that uses a single constant global pointer value. This is
20497 useful when compiling kernel code.
20498
20499 @item -mauto-pic
20500 @opindex mauto-pic
20501 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20502 This is useful when compiling firmware code.
20503
20504 @item -minline-float-divide-min-latency
20505 @opindex minline-float-divide-min-latency
20506 Generate code for inline divides of floating-point values
20507 using the minimum latency algorithm.
20508
20509 @item -minline-float-divide-max-throughput
20510 @opindex minline-float-divide-max-throughput
20511 Generate code for inline divides of floating-point values
20512 using the maximum throughput algorithm.
20513
20514 @item -mno-inline-float-divide
20515 @opindex mno-inline-float-divide
20516 Do not generate inline code for divides of floating-point values.
20517
20518 @item -minline-int-divide-min-latency
20519 @opindex minline-int-divide-min-latency
20520 Generate code for inline divides of integer values
20521 using the minimum latency algorithm.
20522
20523 @item -minline-int-divide-max-throughput
20524 @opindex minline-int-divide-max-throughput
20525 Generate code for inline divides of integer values
20526 using the maximum throughput algorithm.
20527
20528 @item -mno-inline-int-divide
20529 @opindex mno-inline-int-divide
20530 @opindex minline-int-divide
20531 Do not generate inline code for divides of integer values.
20532
20533 @item -minline-sqrt-min-latency
20534 @opindex minline-sqrt-min-latency
20535 Generate code for inline square roots
20536 using the minimum latency algorithm.
20537
20538 @item -minline-sqrt-max-throughput
20539 @opindex minline-sqrt-max-throughput
20540 Generate code for inline square roots
20541 using the maximum throughput algorithm.
20542
20543 @item -mno-inline-sqrt
20544 @opindex mno-inline-sqrt
20545 Do not generate inline code for @code{sqrt}.
20546
20547 @item -mfused-madd
20548 @itemx -mno-fused-madd
20549 @opindex mfused-madd
20550 @opindex mno-fused-madd
20551 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20552 instructions. The default is to use these instructions.
20553
20554 @item -mno-dwarf2-asm
20555 @itemx -mdwarf2-asm
20556 @opindex mno-dwarf2-asm
20557 @opindex mdwarf2-asm
20558 Don't (or do) generate assembler code for the DWARF line number debugging
20559 info. This may be useful when not using the GNU assembler.
20560
20561 @item -mearly-stop-bits
20562 @itemx -mno-early-stop-bits
20563 @opindex mearly-stop-bits
20564 @opindex mno-early-stop-bits
20565 Allow stop bits to be placed earlier than immediately preceding the
20566 instruction that triggered the stop bit. This can improve instruction
20567 scheduling, but does not always do so.
20568
20569 @item -mfixed-range=@var{register-range}
20570 @opindex mfixed-range
20571 Generate code treating the given register range as fixed registers.
20572 A fixed register is one that the register allocator cannot use. This is
20573 useful when compiling kernel code. A register range is specified as
20574 two registers separated by a dash. Multiple register ranges can be
20575 specified separated by a comma.
20576
20577 @item -mtls-size=@var{tls-size}
20578 @opindex mtls-size
20579 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20580 64.
20581
20582 @item -mtune=@var{cpu-type}
20583 @opindex mtune
20584 Tune the instruction scheduling for a particular CPU, Valid values are
20585 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20586 and @samp{mckinley}.
20587
20588 @item -milp32
20589 @itemx -mlp64
20590 @opindex milp32
20591 @opindex mlp64
20592 Generate code for a 32-bit or 64-bit environment.
20593 The 32-bit environment sets int, long and pointer to 32 bits.
20594 The 64-bit environment sets int to 32 bits and long and pointer
20595 to 64 bits. These are HP-UX specific flags.
20596
20597 @item -mno-sched-br-data-spec
20598 @itemx -msched-br-data-spec
20599 @opindex mno-sched-br-data-spec
20600 @opindex msched-br-data-spec
20601 (Dis/En)able data speculative scheduling before reload.
20602 This results in generation of @code{ld.a} instructions and
20603 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20604 The default setting is disabled.
20605
20606 @item -msched-ar-data-spec
20607 @itemx -mno-sched-ar-data-spec
20608 @opindex msched-ar-data-spec
20609 @opindex mno-sched-ar-data-spec
20610 (En/Dis)able data speculative scheduling after reload.
20611 This results in generation of @code{ld.a} instructions and
20612 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20613 The default setting is enabled.
20614
20615 @item -mno-sched-control-spec
20616 @itemx -msched-control-spec
20617 @opindex mno-sched-control-spec
20618 @opindex msched-control-spec
20619 (Dis/En)able control speculative scheduling. This feature is
20620 available only during region scheduling (i.e.@: before reload).
20621 This results in generation of the @code{ld.s} instructions and
20622 the corresponding check instructions @code{chk.s}.
20623 The default setting is disabled.
20624
20625 @item -msched-br-in-data-spec
20626 @itemx -mno-sched-br-in-data-spec
20627 @opindex msched-br-in-data-spec
20628 @opindex mno-sched-br-in-data-spec
20629 (En/Dis)able speculative scheduling of the instructions that
20630 are dependent on the data speculative loads before reload.
20631 This is effective only with @option{-msched-br-data-spec} enabled.
20632 The default setting is enabled.
20633
20634 @item -msched-ar-in-data-spec
20635 @itemx -mno-sched-ar-in-data-spec
20636 @opindex msched-ar-in-data-spec
20637 @opindex mno-sched-ar-in-data-spec
20638 (En/Dis)able speculative scheduling of the instructions that
20639 are dependent on the data speculative loads after reload.
20640 This is effective only with @option{-msched-ar-data-spec} enabled.
20641 The default setting is enabled.
20642
20643 @item -msched-in-control-spec
20644 @itemx -mno-sched-in-control-spec
20645 @opindex msched-in-control-spec
20646 @opindex mno-sched-in-control-spec
20647 (En/Dis)able speculative scheduling of the instructions that
20648 are dependent on the control speculative loads.
20649 This is effective only with @option{-msched-control-spec} enabled.
20650 The default setting is enabled.
20651
20652 @item -mno-sched-prefer-non-data-spec-insns
20653 @itemx -msched-prefer-non-data-spec-insns
20654 @opindex mno-sched-prefer-non-data-spec-insns
20655 @opindex msched-prefer-non-data-spec-insns
20656 If enabled, data-speculative instructions are chosen for schedule
20657 only if there are no other choices at the moment. This makes
20658 the use of the data speculation much more conservative.
20659 The default setting is disabled.
20660
20661 @item -mno-sched-prefer-non-control-spec-insns
20662 @itemx -msched-prefer-non-control-spec-insns
20663 @opindex mno-sched-prefer-non-control-spec-insns
20664 @opindex msched-prefer-non-control-spec-insns
20665 If enabled, control-speculative instructions are chosen for schedule
20666 only if there are no other choices at the moment. This makes
20667 the use of the control speculation much more conservative.
20668 The default setting is disabled.
20669
20670 @item -mno-sched-count-spec-in-critical-path
20671 @itemx -msched-count-spec-in-critical-path
20672 @opindex mno-sched-count-spec-in-critical-path
20673 @opindex msched-count-spec-in-critical-path
20674 If enabled, speculative dependencies are considered during
20675 computation of the instructions priorities. This makes the use of the
20676 speculation a bit more conservative.
20677 The default setting is disabled.
20678
20679 @item -msched-spec-ldc
20680 @opindex msched-spec-ldc
20681 Use a simple data speculation check. This option is on by default.
20682
20683 @item -msched-control-spec-ldc
20684 @opindex msched-spec-ldc
20685 Use a simple check for control speculation. This option is on by default.
20686
20687 @item -msched-stop-bits-after-every-cycle
20688 @opindex msched-stop-bits-after-every-cycle
20689 Place a stop bit after every cycle when scheduling. This option is on
20690 by default.
20691
20692 @item -msched-fp-mem-deps-zero-cost
20693 @opindex msched-fp-mem-deps-zero-cost
20694 Assume that floating-point stores and loads are not likely to cause a conflict
20695 when placed into the same instruction group. This option is disabled by
20696 default.
20697
20698 @item -msel-sched-dont-check-control-spec
20699 @opindex msel-sched-dont-check-control-spec
20700 Generate checks for control speculation in selective scheduling.
20701 This flag is disabled by default.
20702
20703 @item -msched-max-memory-insns=@var{max-insns}
20704 @opindex msched-max-memory-insns
20705 Limit on the number of memory insns per instruction group, giving lower
20706 priority to subsequent memory insns attempting to schedule in the same
20707 instruction group. Frequently useful to prevent cache bank conflicts.
20708 The default value is 1.
20709
20710 @item -msched-max-memory-insns-hard-limit
20711 @opindex msched-max-memory-insns-hard-limit
20712 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20713 disallowing more than that number in an instruction group.
20714 Otherwise, the limit is ``soft'', meaning that non-memory operations
20715 are preferred when the limit is reached, but memory operations may still
20716 be scheduled.
20717
20718 @end table
20719
20720 @node LM32 Options
20721 @subsection LM32 Options
20722 @cindex LM32 options
20723
20724 These @option{-m} options are defined for the LatticeMico32 architecture:
20725
20726 @table @gcctabopt
20727 @item -mbarrel-shift-enabled
20728 @opindex mbarrel-shift-enabled
20729 Enable barrel-shift instructions.
20730
20731 @item -mdivide-enabled
20732 @opindex mdivide-enabled
20733 Enable divide and modulus instructions.
20734
20735 @item -mmultiply-enabled
20736 @opindex multiply-enabled
20737 Enable multiply instructions.
20738
20739 @item -msign-extend-enabled
20740 @opindex msign-extend-enabled
20741 Enable sign extend instructions.
20742
20743 @item -muser-enabled
20744 @opindex muser-enabled
20745 Enable user-defined instructions.
20746
20747 @end table
20748
20749 @node M32C Options
20750 @subsection M32C Options
20751 @cindex M32C options
20752
20753 @table @gcctabopt
20754 @item -mcpu=@var{name}
20755 @opindex mcpu=
20756 Select the CPU for which code is generated. @var{name} may be one of
20757 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20758 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20759 the M32C/80 series.
20760
20761 @item -msim
20762 @opindex msim
20763 Specifies that the program will be run on the simulator. This causes
20764 an alternate runtime library to be linked in which supports, for
20765 example, file I/O@. You must not use this option when generating
20766 programs that will run on real hardware; you must provide your own
20767 runtime library for whatever I/O functions are needed.
20768
20769 @item -memregs=@var{number}
20770 @opindex memregs=
20771 Specifies the number of memory-based pseudo-registers GCC uses
20772 during code generation. These pseudo-registers are used like real
20773 registers, so there is a tradeoff between GCC's ability to fit the
20774 code into available registers, and the performance penalty of using
20775 memory instead of registers. Note that all modules in a program must
20776 be compiled with the same value for this option. Because of that, you
20777 must not use this option with GCC's default runtime libraries.
20778
20779 @end table
20780
20781 @node M32R/D Options
20782 @subsection M32R/D Options
20783 @cindex M32R/D options
20784
20785 These @option{-m} options are defined for Renesas M32R/D architectures:
20786
20787 @table @gcctabopt
20788 @item -m32r2
20789 @opindex m32r2
20790 Generate code for the M32R/2@.
20791
20792 @item -m32rx
20793 @opindex m32rx
20794 Generate code for the M32R/X@.
20795
20796 @item -m32r
20797 @opindex m32r
20798 Generate code for the M32R@. This is the default.
20799
20800 @item -mmodel=small
20801 @opindex mmodel=small
20802 Assume all objects live in the lower 16MB of memory (so that their addresses
20803 can be loaded with the @code{ld24} instruction), and assume all subroutines
20804 are reachable with the @code{bl} instruction.
20805 This is the default.
20806
20807 The addressability of a particular object can be set with the
20808 @code{model} attribute.
20809
20810 @item -mmodel=medium
20811 @opindex mmodel=medium
20812 Assume objects may be anywhere in the 32-bit address space (the compiler
20813 generates @code{seth/add3} instructions to load their addresses), and
20814 assume all subroutines are reachable with the @code{bl} instruction.
20815
20816 @item -mmodel=large
20817 @opindex mmodel=large
20818 Assume objects may be anywhere in the 32-bit address space (the compiler
20819 generates @code{seth/add3} instructions to load their addresses), and
20820 assume subroutines may not be reachable with the @code{bl} instruction
20821 (the compiler generates the much slower @code{seth/add3/jl}
20822 instruction sequence).
20823
20824 @item -msdata=none
20825 @opindex msdata=none
20826 Disable use of the small data area. Variables are put into
20827 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20828 @code{section} attribute has been specified).
20829 This is the default.
20830
20831 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20832 Objects may be explicitly put in the small data area with the
20833 @code{section} attribute using one of these sections.
20834
20835 @item -msdata=sdata
20836 @opindex msdata=sdata
20837 Put small global and static data in the small data area, but do not
20838 generate special code to reference them.
20839
20840 @item -msdata=use
20841 @opindex msdata=use
20842 Put small global and static data in the small data area, and generate
20843 special instructions to reference them.
20844
20845 @item -G @var{num}
20846 @opindex G
20847 @cindex smaller data references
20848 Put global and static objects less than or equal to @var{num} bytes
20849 into the small data or BSS sections instead of the normal data or BSS
20850 sections. The default value of @var{num} is 8.
20851 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20852 for this option to have any effect.
20853
20854 All modules should be compiled with the same @option{-G @var{num}} value.
20855 Compiling with different values of @var{num} may or may not work; if it
20856 doesn't the linker gives an error message---incorrect code is not
20857 generated.
20858
20859 @item -mdebug
20860 @opindex mdebug
20861 Makes the M32R-specific code in the compiler display some statistics
20862 that might help in debugging programs.
20863
20864 @item -malign-loops
20865 @opindex malign-loops
20866 Align all loops to a 32-byte boundary.
20867
20868 @item -mno-align-loops
20869 @opindex mno-align-loops
20870 Do not enforce a 32-byte alignment for loops. This is the default.
20871
20872 @item -missue-rate=@var{number}
20873 @opindex missue-rate=@var{number}
20874 Issue @var{number} instructions per cycle. @var{number} can only be 1
20875 or 2.
20876
20877 @item -mbranch-cost=@var{number}
20878 @opindex mbranch-cost=@var{number}
20879 @var{number} can only be 1 or 2. If it is 1 then branches are
20880 preferred over conditional code, if it is 2, then the opposite applies.
20881
20882 @item -mflush-trap=@var{number}
20883 @opindex mflush-trap=@var{number}
20884 Specifies the trap number to use to flush the cache. The default is
20885 12. Valid numbers are between 0 and 15 inclusive.
20886
20887 @item -mno-flush-trap
20888 @opindex mno-flush-trap
20889 Specifies that the cache cannot be flushed by using a trap.
20890
20891 @item -mflush-func=@var{name}
20892 @opindex mflush-func=@var{name}
20893 Specifies the name of the operating system function to call to flush
20894 the cache. The default is @samp{_flush_cache}, but a function call
20895 is only used if a trap is not available.
20896
20897 @item -mno-flush-func
20898 @opindex mno-flush-func
20899 Indicates that there is no OS function for flushing the cache.
20900
20901 @end table
20902
20903 @node M680x0 Options
20904 @subsection M680x0 Options
20905 @cindex M680x0 options
20906
20907 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20908 The default settings depend on which architecture was selected when
20909 the compiler was configured; the defaults for the most common choices
20910 are given below.
20911
20912 @table @gcctabopt
20913 @item -march=@var{arch}
20914 @opindex march
20915 Generate code for a specific M680x0 or ColdFire instruction set
20916 architecture. Permissible values of @var{arch} for M680x0
20917 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20918 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20919 architectures are selected according to Freescale's ISA classification
20920 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20921 @samp{isab} and @samp{isac}.
20922
20923 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20924 code for a ColdFire target. The @var{arch} in this macro is one of the
20925 @option{-march} arguments given above.
20926
20927 When used together, @option{-march} and @option{-mtune} select code
20928 that runs on a family of similar processors but that is optimized
20929 for a particular microarchitecture.
20930
20931 @item -mcpu=@var{cpu}
20932 @opindex mcpu
20933 Generate code for a specific M680x0 or ColdFire processor.
20934 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20935 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20936 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20937 below, which also classifies the CPUs into families:
20938
20939 @multitable @columnfractions 0.20 0.80
20940 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20941 @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}
20942 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20943 @item @samp{5206e} @tab @samp{5206e}
20944 @item @samp{5208} @tab @samp{5207} @samp{5208}
20945 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20946 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20947 @item @samp{5216} @tab @samp{5214} @samp{5216}
20948 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20949 @item @samp{5225} @tab @samp{5224} @samp{5225}
20950 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20951 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20952 @item @samp{5249} @tab @samp{5249}
20953 @item @samp{5250} @tab @samp{5250}
20954 @item @samp{5271} @tab @samp{5270} @samp{5271}
20955 @item @samp{5272} @tab @samp{5272}
20956 @item @samp{5275} @tab @samp{5274} @samp{5275}
20957 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20958 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20959 @item @samp{5307} @tab @samp{5307}
20960 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20961 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20962 @item @samp{5407} @tab @samp{5407}
20963 @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}
20964 @end multitable
20965
20966 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20967 @var{arch} is compatible with @var{cpu}. Other combinations of
20968 @option{-mcpu} and @option{-march} are rejected.
20969
20970 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20971 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20972 where the value of @var{family} is given by the table above.
20973
20974 @item -mtune=@var{tune}
20975 @opindex mtune
20976 Tune the code for a particular microarchitecture within the
20977 constraints set by @option{-march} and @option{-mcpu}.
20978 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20979 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20980 and @samp{cpu32}. The ColdFire microarchitectures
20981 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20982
20983 You can also use @option{-mtune=68020-40} for code that needs
20984 to run relatively well on 68020, 68030 and 68040 targets.
20985 @option{-mtune=68020-60} is similar but includes 68060 targets
20986 as well. These two options select the same tuning decisions as
20987 @option{-m68020-40} and @option{-m68020-60} respectively.
20988
20989 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20990 when tuning for 680x0 architecture @var{arch}. It also defines
20991 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20992 option is used. If GCC is tuning for a range of architectures,
20993 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20994 it defines the macros for every architecture in the range.
20995
20996 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20997 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20998 of the arguments given above.
20999
21000 @item -m68000
21001 @itemx -mc68000
21002 @opindex m68000
21003 @opindex mc68000
21004 Generate output for a 68000. This is the default
21005 when the compiler is configured for 68000-based systems.
21006 It is equivalent to @option{-march=68000}.
21007
21008 Use this option for microcontrollers with a 68000 or EC000 core,
21009 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21010
21011 @item -m68010
21012 @opindex m68010
21013 Generate output for a 68010. This is the default
21014 when the compiler is configured for 68010-based systems.
21015 It is equivalent to @option{-march=68010}.
21016
21017 @item -m68020
21018 @itemx -mc68020
21019 @opindex m68020
21020 @opindex mc68020
21021 Generate output for a 68020. This is the default
21022 when the compiler is configured for 68020-based systems.
21023 It is equivalent to @option{-march=68020}.
21024
21025 @item -m68030
21026 @opindex m68030
21027 Generate output for a 68030. This is the default when the compiler is
21028 configured for 68030-based systems. It is equivalent to
21029 @option{-march=68030}.
21030
21031 @item -m68040
21032 @opindex m68040
21033 Generate output for a 68040. This is the default when the compiler is
21034 configured for 68040-based systems. It is equivalent to
21035 @option{-march=68040}.
21036
21037 This option inhibits the use of 68881/68882 instructions that have to be
21038 emulated by software on the 68040. Use this option if your 68040 does not
21039 have code to emulate those instructions.
21040
21041 @item -m68060
21042 @opindex m68060
21043 Generate output for a 68060. This is the default when the compiler is
21044 configured for 68060-based systems. It is equivalent to
21045 @option{-march=68060}.
21046
21047 This option inhibits the use of 68020 and 68881/68882 instructions that
21048 have to be emulated by software on the 68060. Use this option if your 68060
21049 does not have code to emulate those instructions.
21050
21051 @item -mcpu32
21052 @opindex mcpu32
21053 Generate output for a CPU32. This is the default
21054 when the compiler is configured for CPU32-based systems.
21055 It is equivalent to @option{-march=cpu32}.
21056
21057 Use this option for microcontrollers with a
21058 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21059 68336, 68340, 68341, 68349 and 68360.
21060
21061 @item -m5200
21062 @opindex m5200
21063 Generate output for a 520X ColdFire CPU@. This is the default
21064 when the compiler is configured for 520X-based systems.
21065 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21066 in favor of that option.
21067
21068 Use this option for microcontroller with a 5200 core, including
21069 the MCF5202, MCF5203, MCF5204 and MCF5206.
21070
21071 @item -m5206e
21072 @opindex m5206e
21073 Generate output for a 5206e ColdFire CPU@. The option is now
21074 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21075
21076 @item -m528x
21077 @opindex m528x
21078 Generate output for a member of the ColdFire 528X family.
21079 The option is now deprecated in favor of the equivalent
21080 @option{-mcpu=528x}.
21081
21082 @item -m5307
21083 @opindex m5307
21084 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21085 in favor of the equivalent @option{-mcpu=5307}.
21086
21087 @item -m5407
21088 @opindex m5407
21089 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21090 in favor of the equivalent @option{-mcpu=5407}.
21091
21092 @item -mcfv4e
21093 @opindex mcfv4e
21094 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21095 This includes use of hardware floating-point instructions.
21096 The option is equivalent to @option{-mcpu=547x}, and is now
21097 deprecated in favor of that option.
21098
21099 @item -m68020-40
21100 @opindex m68020-40
21101 Generate output for a 68040, without using any of the new instructions.
21102 This results in code that can run relatively efficiently on either a
21103 68020/68881 or a 68030 or a 68040. The generated code does use the
21104 68881 instructions that are emulated on the 68040.
21105
21106 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21107
21108 @item -m68020-60
21109 @opindex m68020-60
21110 Generate output for a 68060, without using any of the new instructions.
21111 This results in code that can run relatively efficiently on either a
21112 68020/68881 or a 68030 or a 68040. The generated code does use the
21113 68881 instructions that are emulated on the 68060.
21114
21115 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21116
21117 @item -mhard-float
21118 @itemx -m68881
21119 @opindex mhard-float
21120 @opindex m68881
21121 Generate floating-point instructions. This is the default for 68020
21122 and above, and for ColdFire devices that have an FPU@. It defines the
21123 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21124 on ColdFire targets.
21125
21126 @item -msoft-float
21127 @opindex msoft-float
21128 Do not generate floating-point instructions; use library calls instead.
21129 This is the default for 68000, 68010, and 68832 targets. It is also
21130 the default for ColdFire devices that have no FPU.
21131
21132 @item -mdiv
21133 @itemx -mno-div
21134 @opindex mdiv
21135 @opindex mno-div
21136 Generate (do not generate) ColdFire hardware divide and remainder
21137 instructions. If @option{-march} is used without @option{-mcpu},
21138 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21139 architectures. Otherwise, the default is taken from the target CPU
21140 (either the default CPU, or the one specified by @option{-mcpu}). For
21141 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21142 @option{-mcpu=5206e}.
21143
21144 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21145
21146 @item -mshort
21147 @opindex mshort
21148 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21149 Additionally, parameters passed on the stack are also aligned to a
21150 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21151
21152 @item -mno-short
21153 @opindex mno-short
21154 Do not consider type @code{int} to be 16 bits wide. This is the default.
21155
21156 @item -mnobitfield
21157 @itemx -mno-bitfield
21158 @opindex mnobitfield
21159 @opindex mno-bitfield
21160 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21161 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21162
21163 @item -mbitfield
21164 @opindex mbitfield
21165 Do use the bit-field instructions. The @option{-m68020} option implies
21166 @option{-mbitfield}. This is the default if you use a configuration
21167 designed for a 68020.
21168
21169 @item -mrtd
21170 @opindex mrtd
21171 Use a different function-calling convention, in which functions
21172 that take a fixed number of arguments return with the @code{rtd}
21173 instruction, which pops their arguments while returning. This
21174 saves one instruction in the caller since there is no need to pop
21175 the arguments there.
21176
21177 This calling convention is incompatible with the one normally
21178 used on Unix, so you cannot use it if you need to call libraries
21179 compiled with the Unix compiler.
21180
21181 Also, you must provide function prototypes for all functions that
21182 take variable numbers of arguments (including @code{printf});
21183 otherwise incorrect code is generated for calls to those
21184 functions.
21185
21186 In addition, seriously incorrect code results if you call a
21187 function with too many arguments. (Normally, extra arguments are
21188 harmlessly ignored.)
21189
21190 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21191 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21192
21193 The default is @option{-mno-rtd}.
21194
21195 @item -malign-int
21196 @itemx -mno-align-int
21197 @opindex malign-int
21198 @opindex mno-align-int
21199 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21200 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21201 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21202 Aligning variables on 32-bit boundaries produces code that runs somewhat
21203 faster on processors with 32-bit busses at the expense of more memory.
21204
21205 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21206 aligns structures containing the above types differently than
21207 most published application binary interface specifications for the m68k.
21208
21209 @item -mpcrel
21210 @opindex mpcrel
21211 Use the pc-relative addressing mode of the 68000 directly, instead of
21212 using a global offset table. At present, this option implies @option{-fpic},
21213 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21214 not presently supported with @option{-mpcrel}, though this could be supported for
21215 68020 and higher processors.
21216
21217 @item -mno-strict-align
21218 @itemx -mstrict-align
21219 @opindex mno-strict-align
21220 @opindex mstrict-align
21221 Do not (do) assume that unaligned memory references are handled by
21222 the system.
21223
21224 @item -msep-data
21225 Generate code that allows the data segment to be located in a different
21226 area of memory from the text segment. This allows for execute-in-place in
21227 an environment without virtual memory management. This option implies
21228 @option{-fPIC}.
21229
21230 @item -mno-sep-data
21231 Generate code that assumes that the data segment follows the text segment.
21232 This is the default.
21233
21234 @item -mid-shared-library
21235 Generate code that supports shared libraries via the library ID method.
21236 This allows for execute-in-place and shared libraries in an environment
21237 without virtual memory management. This option implies @option{-fPIC}.
21238
21239 @item -mno-id-shared-library
21240 Generate code that doesn't assume ID-based shared libraries are being used.
21241 This is the default.
21242
21243 @item -mshared-library-id=n
21244 Specifies the identification number of the ID-based shared library being
21245 compiled. Specifying a value of 0 generates more compact code; specifying
21246 other values forces the allocation of that number to the current
21247 library, but is no more space- or time-efficient than omitting this option.
21248
21249 @item -mxgot
21250 @itemx -mno-xgot
21251 @opindex mxgot
21252 @opindex mno-xgot
21253 When generating position-independent code for ColdFire, generate code
21254 that works if the GOT has more than 8192 entries. This code is
21255 larger and slower than code generated without this option. On M680x0
21256 processors, this option is not needed; @option{-fPIC} suffices.
21257
21258 GCC normally uses a single instruction to load values from the GOT@.
21259 While this is relatively efficient, it only works if the GOT
21260 is smaller than about 64k. Anything larger causes the linker
21261 to report an error such as:
21262
21263 @cindex relocation truncated to fit (ColdFire)
21264 @smallexample
21265 relocation truncated to fit: R_68K_GOT16O foobar
21266 @end smallexample
21267
21268 If this happens, you should recompile your code with @option{-mxgot}.
21269 It should then work with very large GOTs. However, code generated with
21270 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21271 the value of a global symbol.
21272
21273 Note that some linkers, including newer versions of the GNU linker,
21274 can create multiple GOTs and sort GOT entries. If you have such a linker,
21275 you should only need to use @option{-mxgot} when compiling a single
21276 object file that accesses more than 8192 GOT entries. Very few do.
21277
21278 These options have no effect unless GCC is generating
21279 position-independent code.
21280
21281 @item -mlong-jump-table-offsets
21282 @opindex mlong-jump-table-offsets
21283 Use 32-bit offsets in @code{switch} tables. The default is to use
21284 16-bit offsets.
21285
21286 @end table
21287
21288 @node MCore Options
21289 @subsection MCore Options
21290 @cindex MCore options
21291
21292 These are the @samp{-m} options defined for the Motorola M*Core
21293 processors.
21294
21295 @table @gcctabopt
21296
21297 @item -mhardlit
21298 @itemx -mno-hardlit
21299 @opindex mhardlit
21300 @opindex mno-hardlit
21301 Inline constants into the code stream if it can be done in two
21302 instructions or less.
21303
21304 @item -mdiv
21305 @itemx -mno-div
21306 @opindex mdiv
21307 @opindex mno-div
21308 Use the divide instruction. (Enabled by default).
21309
21310 @item -mrelax-immediate
21311 @itemx -mno-relax-immediate
21312 @opindex mrelax-immediate
21313 @opindex mno-relax-immediate
21314 Allow arbitrary-sized immediates in bit operations.
21315
21316 @item -mwide-bitfields
21317 @itemx -mno-wide-bitfields
21318 @opindex mwide-bitfields
21319 @opindex mno-wide-bitfields
21320 Always treat bit-fields as @code{int}-sized.
21321
21322 @item -m4byte-functions
21323 @itemx -mno-4byte-functions
21324 @opindex m4byte-functions
21325 @opindex mno-4byte-functions
21326 Force all functions to be aligned to a 4-byte boundary.
21327
21328 @item -mcallgraph-data
21329 @itemx -mno-callgraph-data
21330 @opindex mcallgraph-data
21331 @opindex mno-callgraph-data
21332 Emit callgraph information.
21333
21334 @item -mslow-bytes
21335 @itemx -mno-slow-bytes
21336 @opindex mslow-bytes
21337 @opindex mno-slow-bytes
21338 Prefer word access when reading byte quantities.
21339
21340 @item -mlittle-endian
21341 @itemx -mbig-endian
21342 @opindex mlittle-endian
21343 @opindex mbig-endian
21344 Generate code for a little-endian target.
21345
21346 @item -m210
21347 @itemx -m340
21348 @opindex m210
21349 @opindex m340
21350 Generate code for the 210 processor.
21351
21352 @item -mno-lsim
21353 @opindex mno-lsim
21354 Assume that runtime support has been provided and so omit the
21355 simulator library (@file{libsim.a)} from the linker command line.
21356
21357 @item -mstack-increment=@var{size}
21358 @opindex mstack-increment
21359 Set the maximum amount for a single stack increment operation. Large
21360 values can increase the speed of programs that contain functions
21361 that need a large amount of stack space, but they can also trigger a
21362 segmentation fault if the stack is extended too much. The default
21363 value is 0x1000.
21364
21365 @end table
21366
21367 @node MeP Options
21368 @subsection MeP Options
21369 @cindex MeP options
21370
21371 @table @gcctabopt
21372
21373 @item -mabsdiff
21374 @opindex mabsdiff
21375 Enables the @code{abs} instruction, which is the absolute difference
21376 between two registers.
21377
21378 @item -mall-opts
21379 @opindex mall-opts
21380 Enables all the optional instructions---average, multiply, divide, bit
21381 operations, leading zero, absolute difference, min/max, clip, and
21382 saturation.
21383
21384
21385 @item -maverage
21386 @opindex maverage
21387 Enables the @code{ave} instruction, which computes the average of two
21388 registers.
21389
21390 @item -mbased=@var{n}
21391 @opindex mbased=
21392 Variables of size @var{n} bytes or smaller are placed in the
21393 @code{.based} section by default. Based variables use the @code{$tp}
21394 register as a base register, and there is a 128-byte limit to the
21395 @code{.based} section.
21396
21397 @item -mbitops
21398 @opindex mbitops
21399 Enables the bit operation instructions---bit test (@code{btstm}), set
21400 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21401 test-and-set (@code{tas}).
21402
21403 @item -mc=@var{name}
21404 @opindex mc=
21405 Selects which section constant data is placed in. @var{name} may
21406 be @samp{tiny}, @samp{near}, or @samp{far}.
21407
21408 @item -mclip
21409 @opindex mclip
21410 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21411 useful unless you also provide @option{-mminmax}.
21412
21413 @item -mconfig=@var{name}
21414 @opindex mconfig=
21415 Selects one of the built-in core configurations. Each MeP chip has
21416 one or more modules in it; each module has a core CPU and a variety of
21417 coprocessors, optional instructions, and peripherals. The
21418 @code{MeP-Integrator} tool, not part of GCC, provides these
21419 configurations through this option; using this option is the same as
21420 using all the corresponding command-line options. The default
21421 configuration is @samp{default}.
21422
21423 @item -mcop
21424 @opindex mcop
21425 Enables the coprocessor instructions. By default, this is a 32-bit
21426 coprocessor. Note that the coprocessor is normally enabled via the
21427 @option{-mconfig=} option.
21428
21429 @item -mcop32
21430 @opindex mcop32
21431 Enables the 32-bit coprocessor's instructions.
21432
21433 @item -mcop64
21434 @opindex mcop64
21435 Enables the 64-bit coprocessor's instructions.
21436
21437 @item -mivc2
21438 @opindex mivc2
21439 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21440
21441 @item -mdc
21442 @opindex mdc
21443 Causes constant variables to be placed in the @code{.near} section.
21444
21445 @item -mdiv
21446 @opindex mdiv
21447 Enables the @code{div} and @code{divu} instructions.
21448
21449 @item -meb
21450 @opindex meb
21451 Generate big-endian code.
21452
21453 @item -mel
21454 @opindex mel
21455 Generate little-endian code.
21456
21457 @item -mio-volatile
21458 @opindex mio-volatile
21459 Tells the compiler that any variable marked with the @code{io}
21460 attribute is to be considered volatile.
21461
21462 @item -ml
21463 @opindex ml
21464 Causes variables to be assigned to the @code{.far} section by default.
21465
21466 @item -mleadz
21467 @opindex mleadz
21468 Enables the @code{leadz} (leading zero) instruction.
21469
21470 @item -mm
21471 @opindex mm
21472 Causes variables to be assigned to the @code{.near} section by default.
21473
21474 @item -mminmax
21475 @opindex mminmax
21476 Enables the @code{min} and @code{max} instructions.
21477
21478 @item -mmult
21479 @opindex mmult
21480 Enables the multiplication and multiply-accumulate instructions.
21481
21482 @item -mno-opts
21483 @opindex mno-opts
21484 Disables all the optional instructions enabled by @option{-mall-opts}.
21485
21486 @item -mrepeat
21487 @opindex mrepeat
21488 Enables the @code{repeat} and @code{erepeat} instructions, used for
21489 low-overhead looping.
21490
21491 @item -ms
21492 @opindex ms
21493 Causes all variables to default to the @code{.tiny} section. Note
21494 that there is a 65536-byte limit to this section. Accesses to these
21495 variables use the @code{%gp} base register.
21496
21497 @item -msatur
21498 @opindex msatur
21499 Enables the saturation instructions. Note that the compiler does not
21500 currently generate these itself, but this option is included for
21501 compatibility with other tools, like @code{as}.
21502
21503 @item -msdram
21504 @opindex msdram
21505 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21506
21507 @item -msim
21508 @opindex msim
21509 Link the simulator run-time libraries.
21510
21511 @item -msimnovec
21512 @opindex msimnovec
21513 Link the simulator runtime libraries, excluding built-in support
21514 for reset and exception vectors and tables.
21515
21516 @item -mtf
21517 @opindex mtf
21518 Causes all functions to default to the @code{.far} section. Without
21519 this option, functions default to the @code{.near} section.
21520
21521 @item -mtiny=@var{n}
21522 @opindex mtiny=
21523 Variables that are @var{n} bytes or smaller are allocated to the
21524 @code{.tiny} section. These variables use the @code{$gp} base
21525 register. The default for this option is 4, but note that there's a
21526 65536-byte limit to the @code{.tiny} section.
21527
21528 @end table
21529
21530 @node MicroBlaze Options
21531 @subsection MicroBlaze Options
21532 @cindex MicroBlaze Options
21533
21534 @table @gcctabopt
21535
21536 @item -msoft-float
21537 @opindex msoft-float
21538 Use software emulation for floating point (default).
21539
21540 @item -mhard-float
21541 @opindex mhard-float
21542 Use hardware floating-point instructions.
21543
21544 @item -mmemcpy
21545 @opindex mmemcpy
21546 Do not optimize block moves, use @code{memcpy}.
21547
21548 @item -mno-clearbss
21549 @opindex mno-clearbss
21550 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21551
21552 @item -mcpu=@var{cpu-type}
21553 @opindex mcpu=
21554 Use features of, and schedule code for, the given CPU.
21555 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21556 where @var{X} is a major version, @var{YY} is the minor version, and
21557 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21558 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21559
21560 @item -mxl-soft-mul
21561 @opindex mxl-soft-mul
21562 Use software multiply emulation (default).
21563
21564 @item -mxl-soft-div
21565 @opindex mxl-soft-div
21566 Use software emulation for divides (default).
21567
21568 @item -mxl-barrel-shift
21569 @opindex mxl-barrel-shift
21570 Use the hardware barrel shifter.
21571
21572 @item -mxl-pattern-compare
21573 @opindex mxl-pattern-compare
21574 Use pattern compare instructions.
21575
21576 @item -msmall-divides
21577 @opindex msmall-divides
21578 Use table lookup optimization for small signed integer divisions.
21579
21580 @item -mxl-stack-check
21581 @opindex mxl-stack-check
21582 This option is deprecated. Use @option{-fstack-check} instead.
21583
21584 @item -mxl-gp-opt
21585 @opindex mxl-gp-opt
21586 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21587
21588 @item -mxl-multiply-high
21589 @opindex mxl-multiply-high
21590 Use multiply high instructions for high part of 32x32 multiply.
21591
21592 @item -mxl-float-convert
21593 @opindex mxl-float-convert
21594 Use hardware floating-point conversion instructions.
21595
21596 @item -mxl-float-sqrt
21597 @opindex mxl-float-sqrt
21598 Use hardware floating-point square root instruction.
21599
21600 @item -mbig-endian
21601 @opindex mbig-endian
21602 Generate code for a big-endian target.
21603
21604 @item -mlittle-endian
21605 @opindex mlittle-endian
21606 Generate code for a little-endian target.
21607
21608 @item -mxl-reorder
21609 @opindex mxl-reorder
21610 Use reorder instructions (swap and byte reversed load/store).
21611
21612 @item -mxl-mode-@var{app-model}
21613 Select application model @var{app-model}. Valid models are
21614 @table @samp
21615 @item executable
21616 normal executable (default), uses startup code @file{crt0.o}.
21617
21618 @item -mpic-data-is-text-relative
21619 @opindex mpic-data-is-text-relative
21620 Assume that the displacement between the text and data segments is fixed
21621 at static link time. This allows data to be referenced by offset from start of
21622 text address instead of GOT since PC-relative addressing is not supported.
21623
21624 @item xmdstub
21625 for use with Xilinx Microprocessor Debugger (XMD) based
21626 software intrusive debug agent called xmdstub. This uses startup file
21627 @file{crt1.o} and sets the start address of the program to 0x800.
21628
21629 @item bootstrap
21630 for applications that are loaded using a bootloader.
21631 This model uses startup file @file{crt2.o} which does not contain a processor
21632 reset vector handler. This is suitable for transferring control on a
21633 processor reset to the bootloader rather than the application.
21634
21635 @item novectors
21636 for applications that do not require any of the
21637 MicroBlaze vectors. This option may be useful for applications running
21638 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21639 @end table
21640
21641 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21642 @option{-mxl-mode-@var{app-model}}.
21643
21644 @end table
21645
21646 @node MIPS Options
21647 @subsection MIPS Options
21648 @cindex MIPS options
21649
21650 @table @gcctabopt
21651
21652 @item -EB
21653 @opindex EB
21654 Generate big-endian code.
21655
21656 @item -EL
21657 @opindex EL
21658 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21659 configurations.
21660
21661 @item -march=@var{arch}
21662 @opindex march
21663 Generate code that runs on @var{arch}, which can be the name of a
21664 generic MIPS ISA, or the name of a particular processor.
21665 The ISA names are:
21666 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21667 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21668 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21669 @samp{mips64r5} and @samp{mips64r6}.
21670 The processor names are:
21671 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21672 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21673 @samp{5kc}, @samp{5kf},
21674 @samp{20kc},
21675 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21676 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21677 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21678 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21679 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21680 @samp{i6400}, @samp{i6500},
21681 @samp{interaptiv},
21682 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21683 @samp{gs464e}, @samp{gs264e},
21684 @samp{m4k},
21685 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21686 @samp{m5100}, @samp{m5101},
21687 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21688 @samp{orion},
21689 @samp{p5600}, @samp{p6600},
21690 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21691 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21692 @samp{r6000}, @samp{r8000},
21693 @samp{rm7000}, @samp{rm9000},
21694 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21695 @samp{sb1},
21696 @samp{sr71000},
21697 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21698 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21699 @samp{xlr} and @samp{xlp}.
21700 The special value @samp{from-abi} selects the
21701 most compatible architecture for the selected ABI (that is,
21702 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21703
21704 The native Linux/GNU toolchain also supports the value @samp{native},
21705 which selects the best architecture option for the host processor.
21706 @option{-march=native} has no effect if GCC does not recognize
21707 the processor.
21708
21709 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21710 (for example, @option{-march=r2k}). Prefixes are optional, and
21711 @samp{vr} may be written @samp{r}.
21712
21713 Names of the form @samp{@var{n}f2_1} refer to processors with
21714 FPUs clocked at half the rate of the core, names of the form
21715 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21716 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21717 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21718 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21719 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21720 accepted as synonyms for @samp{@var{n}f1_1}.
21721
21722 GCC defines two macros based on the value of this option. The first
21723 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21724 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21725 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21726 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21727 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21728
21729 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21730 above. In other words, it has the full prefix and does not
21731 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21732 the macro names the resolved architecture (either @code{"mips1"} or
21733 @code{"mips3"}). It names the default architecture when no
21734 @option{-march} option is given.
21735
21736 @item -mtune=@var{arch}
21737 @opindex mtune
21738 Optimize for @var{arch}. Among other things, this option controls
21739 the way instructions are scheduled, and the perceived cost of arithmetic
21740 operations. The list of @var{arch} values is the same as for
21741 @option{-march}.
21742
21743 When this option is not used, GCC optimizes for the processor
21744 specified by @option{-march}. By using @option{-march} and
21745 @option{-mtune} together, it is possible to generate code that
21746 runs on a family of processors, but optimize the code for one
21747 particular member of that family.
21748
21749 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21750 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21751 @option{-march} ones described above.
21752
21753 @item -mips1
21754 @opindex mips1
21755 Equivalent to @option{-march=mips1}.
21756
21757 @item -mips2
21758 @opindex mips2
21759 Equivalent to @option{-march=mips2}.
21760
21761 @item -mips3
21762 @opindex mips3
21763 Equivalent to @option{-march=mips3}.
21764
21765 @item -mips4
21766 @opindex mips4
21767 Equivalent to @option{-march=mips4}.
21768
21769 @item -mips32
21770 @opindex mips32
21771 Equivalent to @option{-march=mips32}.
21772
21773 @item -mips32r3
21774 @opindex mips32r3
21775 Equivalent to @option{-march=mips32r3}.
21776
21777 @item -mips32r5
21778 @opindex mips32r5
21779 Equivalent to @option{-march=mips32r5}.
21780
21781 @item -mips32r6
21782 @opindex mips32r6
21783 Equivalent to @option{-march=mips32r6}.
21784
21785 @item -mips64
21786 @opindex mips64
21787 Equivalent to @option{-march=mips64}.
21788
21789 @item -mips64r2
21790 @opindex mips64r2
21791 Equivalent to @option{-march=mips64r2}.
21792
21793 @item -mips64r3
21794 @opindex mips64r3
21795 Equivalent to @option{-march=mips64r3}.
21796
21797 @item -mips64r5
21798 @opindex mips64r5
21799 Equivalent to @option{-march=mips64r5}.
21800
21801 @item -mips64r6
21802 @opindex mips64r6
21803 Equivalent to @option{-march=mips64r6}.
21804
21805 @item -mips16
21806 @itemx -mno-mips16
21807 @opindex mips16
21808 @opindex mno-mips16
21809 Generate (do not generate) MIPS16 code. If GCC is targeting a
21810 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21811
21812 MIPS16 code generation can also be controlled on a per-function basis
21813 by means of @code{mips16} and @code{nomips16} attributes.
21814 @xref{Function Attributes}, for more information.
21815
21816 @item -mflip-mips16
21817 @opindex mflip-mips16
21818 Generate MIPS16 code on alternating functions. This option is provided
21819 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21820 not intended for ordinary use in compiling user code.
21821
21822 @item -minterlink-compressed
21823 @itemx -mno-interlink-compressed
21824 @opindex minterlink-compressed
21825 @opindex mno-interlink-compressed
21826 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21827 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21828
21829 For example, code using the standard ISA encoding cannot jump directly
21830 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21831 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21832 knows that the target of the jump is not compressed.
21833
21834 @item -minterlink-mips16
21835 @itemx -mno-interlink-mips16
21836 @opindex minterlink-mips16
21837 @opindex mno-interlink-mips16
21838 Aliases of @option{-minterlink-compressed} and
21839 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21840 and are retained for backwards compatibility.
21841
21842 @item -mabi=32
21843 @itemx -mabi=o64
21844 @itemx -mabi=n32
21845 @itemx -mabi=64
21846 @itemx -mabi=eabi
21847 @opindex mabi=32
21848 @opindex mabi=o64
21849 @opindex mabi=n32
21850 @opindex mabi=64
21851 @opindex mabi=eabi
21852 Generate code for the given ABI@.
21853
21854 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21855 generates 64-bit code when you select a 64-bit architecture, but you
21856 can use @option{-mgp32} to get 32-bit code instead.
21857
21858 For information about the O64 ABI, see
21859 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21860
21861 GCC supports a variant of the o32 ABI in which floating-point registers
21862 are 64 rather than 32 bits wide. You can select this combination with
21863 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21864 and @code{mfhc1} instructions and is therefore only supported for
21865 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21866
21867 The register assignments for arguments and return values remain the
21868 same, but each scalar value is passed in a single 64-bit register
21869 rather than a pair of 32-bit registers. For example, scalar
21870 floating-point values are returned in @samp{$f0} only, not a
21871 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21872 remains the same in that the even-numbered double-precision registers
21873 are saved.
21874
21875 Two additional variants of the o32 ABI are supported to enable
21876 a transition from 32-bit to 64-bit registers. These are FPXX
21877 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21878 The FPXX extension mandates that all code must execute correctly
21879 when run using 32-bit or 64-bit registers. The code can be interlinked
21880 with either FP32 or FP64, but not both.
21881 The FP64A extension is similar to the FP64 extension but forbids the
21882 use of odd-numbered single-precision registers. This can be used
21883 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21884 processors and allows both FP32 and FP64A code to interlink and
21885 run in the same process without changing FPU modes.
21886
21887 @item -mabicalls
21888 @itemx -mno-abicalls
21889 @opindex mabicalls
21890 @opindex mno-abicalls
21891 Generate (do not generate) code that is suitable for SVR4-style
21892 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21893 systems.
21894
21895 @item -mshared
21896 @itemx -mno-shared
21897 Generate (do not generate) code that is fully position-independent,
21898 and that can therefore be linked into shared libraries. This option
21899 only affects @option{-mabicalls}.
21900
21901 All @option{-mabicalls} code has traditionally been position-independent,
21902 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21903 as an extension, the GNU toolchain allows executables to use absolute
21904 accesses for locally-binding symbols. It can also use shorter GP
21905 initialization sequences and generate direct calls to locally-defined
21906 functions. This mode is selected by @option{-mno-shared}.
21907
21908 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21909 objects that can only be linked by the GNU linker. However, the option
21910 does not affect the ABI of the final executable; it only affects the ABI
21911 of relocatable objects. Using @option{-mno-shared} generally makes
21912 executables both smaller and quicker.
21913
21914 @option{-mshared} is the default.
21915
21916 @item -mplt
21917 @itemx -mno-plt
21918 @opindex mplt
21919 @opindex mno-plt
21920 Assume (do not assume) that the static and dynamic linkers
21921 support PLTs and copy relocations. This option only affects
21922 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21923 has no effect without @option{-msym32}.
21924
21925 You can make @option{-mplt} the default by configuring
21926 GCC with @option{--with-mips-plt}. The default is
21927 @option{-mno-plt} otherwise.
21928
21929 @item -mxgot
21930 @itemx -mno-xgot
21931 @opindex mxgot
21932 @opindex mno-xgot
21933 Lift (do not lift) the usual restrictions on the size of the global
21934 offset table.
21935
21936 GCC normally uses a single instruction to load values from the GOT@.
21937 While this is relatively efficient, it only works if the GOT
21938 is smaller than about 64k. Anything larger causes the linker
21939 to report an error such as:
21940
21941 @cindex relocation truncated to fit (MIPS)
21942 @smallexample
21943 relocation truncated to fit: R_MIPS_GOT16 foobar
21944 @end smallexample
21945
21946 If this happens, you should recompile your code with @option{-mxgot}.
21947 This works with very large GOTs, although the code is also
21948 less efficient, since it takes three instructions to fetch the
21949 value of a global symbol.
21950
21951 Note that some linkers can create multiple GOTs. If you have such a
21952 linker, you should only need to use @option{-mxgot} when a single object
21953 file accesses more than 64k's worth of GOT entries. Very few do.
21954
21955 These options have no effect unless GCC is generating position
21956 independent code.
21957
21958 @item -mgp32
21959 @opindex mgp32
21960 Assume that general-purpose registers are 32 bits wide.
21961
21962 @item -mgp64
21963 @opindex mgp64
21964 Assume that general-purpose registers are 64 bits wide.
21965
21966 @item -mfp32
21967 @opindex mfp32
21968 Assume that floating-point registers are 32 bits wide.
21969
21970 @item -mfp64
21971 @opindex mfp64
21972 Assume that floating-point registers are 64 bits wide.
21973
21974 @item -mfpxx
21975 @opindex mfpxx
21976 Do not assume the width of floating-point registers.
21977
21978 @item -mhard-float
21979 @opindex mhard-float
21980 Use floating-point coprocessor instructions.
21981
21982 @item -msoft-float
21983 @opindex msoft-float
21984 Do not use floating-point coprocessor instructions. Implement
21985 floating-point calculations using library calls instead.
21986
21987 @item -mno-float
21988 @opindex mno-float
21989 Equivalent to @option{-msoft-float}, but additionally asserts that the
21990 program being compiled does not perform any floating-point operations.
21991 This option is presently supported only by some bare-metal MIPS
21992 configurations, where it may select a special set of libraries
21993 that lack all floating-point support (including, for example, the
21994 floating-point @code{printf} formats).
21995 If code compiled with @option{-mno-float} accidentally contains
21996 floating-point operations, it is likely to suffer a link-time
21997 or run-time failure.
21998
21999 @item -msingle-float
22000 @opindex msingle-float
22001 Assume that the floating-point coprocessor only supports single-precision
22002 operations.
22003
22004 @item -mdouble-float
22005 @opindex mdouble-float
22006 Assume that the floating-point coprocessor supports double-precision
22007 operations. This is the default.
22008
22009 @item -modd-spreg
22010 @itemx -mno-odd-spreg
22011 @opindex modd-spreg
22012 @opindex mno-odd-spreg
22013 Enable the use of odd-numbered single-precision floating-point registers
22014 for the o32 ABI. This is the default for processors that are known to
22015 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22016 is set by default.
22017
22018 @item -mabs=2008
22019 @itemx -mabs=legacy
22020 @opindex mabs=2008
22021 @opindex mabs=legacy
22022 These options control the treatment of the special not-a-number (NaN)
22023 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22024 @code{neg.@i{fmt}} machine instructions.
22025
22026 By default or when @option{-mabs=legacy} is used the legacy
22027 treatment is selected. In this case these instructions are considered
22028 arithmetic and avoided where correct operation is required and the
22029 input operand might be a NaN. A longer sequence of instructions that
22030 manipulate the sign bit of floating-point datum manually is used
22031 instead unless the @option{-ffinite-math-only} option has also been
22032 specified.
22033
22034 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22035 this case these instructions are considered non-arithmetic and therefore
22036 operating correctly in all cases, including in particular where the
22037 input operand is a NaN. These instructions are therefore always used
22038 for the respective operations.
22039
22040 @item -mnan=2008
22041 @itemx -mnan=legacy
22042 @opindex mnan=2008
22043 @opindex mnan=legacy
22044 These options control the encoding of the special not-a-number (NaN)
22045 IEEE 754 floating-point data.
22046
22047 The @option{-mnan=legacy} option selects the legacy encoding. In this
22048 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22049 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22050 by the first bit of their trailing significand field being 1.
22051
22052 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22053 this case qNaNs are denoted by the first bit of their trailing
22054 significand field being 1, whereas sNaNs are denoted by the first bit of
22055 their trailing significand field being 0.
22056
22057 The default is @option{-mnan=legacy} unless GCC has been configured with
22058 @option{--with-nan=2008}.
22059
22060 @item -mllsc
22061 @itemx -mno-llsc
22062 @opindex mllsc
22063 @opindex mno-llsc
22064 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22065 implement atomic memory built-in functions. When neither option is
22066 specified, GCC uses the instructions if the target architecture
22067 supports them.
22068
22069 @option{-mllsc} is useful if the runtime environment can emulate the
22070 instructions and @option{-mno-llsc} can be useful when compiling for
22071 nonstandard ISAs. You can make either option the default by
22072 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22073 respectively. @option{--with-llsc} is the default for some
22074 configurations; see the installation documentation for details.
22075
22076 @item -mdsp
22077 @itemx -mno-dsp
22078 @opindex mdsp
22079 @opindex mno-dsp
22080 Use (do not use) revision 1 of the MIPS DSP ASE@.
22081 @xref{MIPS DSP Built-in Functions}. This option defines the
22082 preprocessor macro @code{__mips_dsp}. It also defines
22083 @code{__mips_dsp_rev} to 1.
22084
22085 @item -mdspr2
22086 @itemx -mno-dspr2
22087 @opindex mdspr2
22088 @opindex mno-dspr2
22089 Use (do not use) revision 2 of the MIPS DSP ASE@.
22090 @xref{MIPS DSP Built-in Functions}. This option defines the
22091 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22092 It also defines @code{__mips_dsp_rev} to 2.
22093
22094 @item -msmartmips
22095 @itemx -mno-smartmips
22096 @opindex msmartmips
22097 @opindex mno-smartmips
22098 Use (do not use) the MIPS SmartMIPS ASE.
22099
22100 @item -mpaired-single
22101 @itemx -mno-paired-single
22102 @opindex mpaired-single
22103 @opindex mno-paired-single
22104 Use (do not use) paired-single floating-point instructions.
22105 @xref{MIPS Paired-Single Support}. This option requires
22106 hardware floating-point support to be enabled.
22107
22108 @item -mdmx
22109 @itemx -mno-mdmx
22110 @opindex mdmx
22111 @opindex mno-mdmx
22112 Use (do not use) MIPS Digital Media Extension instructions.
22113 This option can only be used when generating 64-bit code and requires
22114 hardware floating-point support to be enabled.
22115
22116 @item -mips3d
22117 @itemx -mno-mips3d
22118 @opindex mips3d
22119 @opindex mno-mips3d
22120 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22121 The option @option{-mips3d} implies @option{-mpaired-single}.
22122
22123 @item -mmicromips
22124 @itemx -mno-micromips
22125 @opindex mmicromips
22126 @opindex mno-mmicromips
22127 Generate (do not generate) microMIPS code.
22128
22129 MicroMIPS code generation can also be controlled on a per-function basis
22130 by means of @code{micromips} and @code{nomicromips} attributes.
22131 @xref{Function Attributes}, for more information.
22132
22133 @item -mmt
22134 @itemx -mno-mt
22135 @opindex mmt
22136 @opindex mno-mt
22137 Use (do not use) MT Multithreading instructions.
22138
22139 @item -mmcu
22140 @itemx -mno-mcu
22141 @opindex mmcu
22142 @opindex mno-mcu
22143 Use (do not use) the MIPS MCU ASE instructions.
22144
22145 @item -meva
22146 @itemx -mno-eva
22147 @opindex meva
22148 @opindex mno-eva
22149 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22150
22151 @item -mvirt
22152 @itemx -mno-virt
22153 @opindex mvirt
22154 @opindex mno-virt
22155 Use (do not use) the MIPS Virtualization (VZ) instructions.
22156
22157 @item -mxpa
22158 @itemx -mno-xpa
22159 @opindex mxpa
22160 @opindex mno-xpa
22161 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22162
22163 @item -mcrc
22164 @itemx -mno-crc
22165 @opindex mcrc
22166 @opindex mno-crc
22167 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22168
22169 @item -mginv
22170 @itemx -mno-ginv
22171 @opindex mginv
22172 @opindex mno-ginv
22173 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22174
22175 @item -mloongson-mmi
22176 @itemx -mno-loongson-mmi
22177 @opindex mloongson-mmi
22178 @opindex mno-loongson-mmi
22179 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22180
22181 @item -mloongson-ext
22182 @itemx -mno-loongson-ext
22183 @opindex mloongson-ext
22184 @opindex mno-loongson-ext
22185 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22186
22187 @item -mloongson-ext2
22188 @itemx -mno-loongson-ext2
22189 @opindex mloongson-ext2
22190 @opindex mno-loongson-ext2
22191 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22192
22193 @item -mlong64
22194 @opindex mlong64
22195 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22196 an explanation of the default and the way that the pointer size is
22197 determined.
22198
22199 @item -mlong32
22200 @opindex mlong32
22201 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22202
22203 The default size of @code{int}s, @code{long}s and pointers depends on
22204 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22205 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22206 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22207 or the same size as integer registers, whichever is smaller.
22208
22209 @item -msym32
22210 @itemx -mno-sym32
22211 @opindex msym32
22212 @opindex mno-sym32
22213 Assume (do not assume) that all symbols have 32-bit values, regardless
22214 of the selected ABI@. This option is useful in combination with
22215 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22216 to generate shorter and faster references to symbolic addresses.
22217
22218 @item -G @var{num}
22219 @opindex G
22220 Put definitions of externally-visible data in a small data section
22221 if that data is no bigger than @var{num} bytes. GCC can then generate
22222 more efficient accesses to the data; see @option{-mgpopt} for details.
22223
22224 The default @option{-G} option depends on the configuration.
22225
22226 @item -mlocal-sdata
22227 @itemx -mno-local-sdata
22228 @opindex mlocal-sdata
22229 @opindex mno-local-sdata
22230 Extend (do not extend) the @option{-G} behavior to local data too,
22231 such as to static variables in C@. @option{-mlocal-sdata} is the
22232 default for all configurations.
22233
22234 If the linker complains that an application is using too much small data,
22235 you might want to try rebuilding the less performance-critical parts with
22236 @option{-mno-local-sdata}. You might also want to build large
22237 libraries with @option{-mno-local-sdata}, so that the libraries leave
22238 more room for the main program.
22239
22240 @item -mextern-sdata
22241 @itemx -mno-extern-sdata
22242 @opindex mextern-sdata
22243 @opindex mno-extern-sdata
22244 Assume (do not assume) that externally-defined data is in
22245 a small data section if the size of that data is within the @option{-G} limit.
22246 @option{-mextern-sdata} is the default for all configurations.
22247
22248 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22249 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22250 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22251 is placed in a small data section. If @var{Var} is defined by another
22252 module, you must either compile that module with a high-enough
22253 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22254 definition. If @var{Var} is common, you must link the application
22255 with a high-enough @option{-G} setting.
22256
22257 The easiest way of satisfying these restrictions is to compile
22258 and link every module with the same @option{-G} option. However,
22259 you may wish to build a library that supports several different
22260 small data limits. You can do this by compiling the library with
22261 the highest supported @option{-G} setting and additionally using
22262 @option{-mno-extern-sdata} to stop the library from making assumptions
22263 about externally-defined data.
22264
22265 @item -mgpopt
22266 @itemx -mno-gpopt
22267 @opindex mgpopt
22268 @opindex mno-gpopt
22269 Use (do not use) GP-relative accesses for symbols that are known to be
22270 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22271 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22272 configurations.
22273
22274 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22275 might not hold the value of @code{_gp}. For example, if the code is
22276 part of a library that might be used in a boot monitor, programs that
22277 call boot monitor routines pass an unknown value in @code{$gp}.
22278 (In such situations, the boot monitor itself is usually compiled
22279 with @option{-G0}.)
22280
22281 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22282 @option{-mno-extern-sdata}.
22283
22284 @item -membedded-data
22285 @itemx -mno-embedded-data
22286 @opindex membedded-data
22287 @opindex mno-embedded-data
22288 Allocate variables to the read-only data section first if possible, then
22289 next in the small data section if possible, otherwise in data. This gives
22290 slightly slower code than the default, but reduces the amount of RAM required
22291 when executing, and thus may be preferred for some embedded systems.
22292
22293 @item -muninit-const-in-rodata
22294 @itemx -mno-uninit-const-in-rodata
22295 @opindex muninit-const-in-rodata
22296 @opindex mno-uninit-const-in-rodata
22297 Put uninitialized @code{const} variables in the read-only data section.
22298 This option is only meaningful in conjunction with @option{-membedded-data}.
22299
22300 @item -mcode-readable=@var{setting}
22301 @opindex mcode-readable
22302 Specify whether GCC may generate code that reads from executable sections.
22303 There are three possible settings:
22304
22305 @table @gcctabopt
22306 @item -mcode-readable=yes
22307 Instructions may freely access executable sections. This is the
22308 default setting.
22309
22310 @item -mcode-readable=pcrel
22311 MIPS16 PC-relative load instructions can access executable sections,
22312 but other instructions must not do so. This option is useful on 4KSc
22313 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22314 It is also useful on processors that can be configured to have a dual
22315 instruction/data SRAM interface and that, like the M4K, automatically
22316 redirect PC-relative loads to the instruction RAM.
22317
22318 @item -mcode-readable=no
22319 Instructions must not access executable sections. This option can be
22320 useful on targets that are configured to have a dual instruction/data
22321 SRAM interface but that (unlike the M4K) do not automatically redirect
22322 PC-relative loads to the instruction RAM.
22323 @end table
22324
22325 @item -msplit-addresses
22326 @itemx -mno-split-addresses
22327 @opindex msplit-addresses
22328 @opindex mno-split-addresses
22329 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22330 relocation operators. This option has been superseded by
22331 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22332
22333 @item -mexplicit-relocs
22334 @itemx -mno-explicit-relocs
22335 @opindex mexplicit-relocs
22336 @opindex mno-explicit-relocs
22337 Use (do not use) assembler relocation operators when dealing with symbolic
22338 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22339 is to use assembler macros instead.
22340
22341 @option{-mexplicit-relocs} is the default if GCC was configured
22342 to use an assembler that supports relocation operators.
22343
22344 @item -mcheck-zero-division
22345 @itemx -mno-check-zero-division
22346 @opindex mcheck-zero-division
22347 @opindex mno-check-zero-division
22348 Trap (do not trap) on integer division by zero.
22349
22350 The default is @option{-mcheck-zero-division}.
22351
22352 @item -mdivide-traps
22353 @itemx -mdivide-breaks
22354 @opindex mdivide-traps
22355 @opindex mdivide-breaks
22356 MIPS systems check for division by zero by generating either a
22357 conditional trap or a break instruction. Using traps results in
22358 smaller code, but is only supported on MIPS II and later. Also, some
22359 versions of the Linux kernel have a bug that prevents trap from
22360 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22361 allow conditional traps on architectures that support them and
22362 @option{-mdivide-breaks} to force the use of breaks.
22363
22364 The default is usually @option{-mdivide-traps}, but this can be
22365 overridden at configure time using @option{--with-divide=breaks}.
22366 Divide-by-zero checks can be completely disabled using
22367 @option{-mno-check-zero-division}.
22368
22369 @item -mload-store-pairs
22370 @itemx -mno-load-store-pairs
22371 @opindex mload-store-pairs
22372 @opindex mno-load-store-pairs
22373 Enable (disable) an optimization that pairs consecutive load or store
22374 instructions to enable load/store bonding. This option is enabled by
22375 default but only takes effect when the selected architecture is known
22376 to support bonding.
22377
22378 @item -mmemcpy
22379 @itemx -mno-memcpy
22380 @opindex mmemcpy
22381 @opindex mno-memcpy
22382 Force (do not force) the use of @code{memcpy} for non-trivial block
22383 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22384 most constant-sized copies.
22385
22386 @item -mlong-calls
22387 @itemx -mno-long-calls
22388 @opindex mlong-calls
22389 @opindex mno-long-calls
22390 Disable (do not disable) use of the @code{jal} instruction. Calling
22391 functions using @code{jal} is more efficient but requires the caller
22392 and callee to be in the same 256 megabyte segment.
22393
22394 This option has no effect on abicalls code. The default is
22395 @option{-mno-long-calls}.
22396
22397 @item -mmad
22398 @itemx -mno-mad
22399 @opindex mmad
22400 @opindex mno-mad
22401 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22402 instructions, as provided by the R4650 ISA@.
22403
22404 @item -mimadd
22405 @itemx -mno-imadd
22406 @opindex mimadd
22407 @opindex mno-imadd
22408 Enable (disable) use of the @code{madd} and @code{msub} integer
22409 instructions. The default is @option{-mimadd} on architectures
22410 that support @code{madd} and @code{msub} except for the 74k
22411 architecture where it was found to generate slower code.
22412
22413 @item -mfused-madd
22414 @itemx -mno-fused-madd
22415 @opindex mfused-madd
22416 @opindex mno-fused-madd
22417 Enable (disable) use of the floating-point multiply-accumulate
22418 instructions, when they are available. The default is
22419 @option{-mfused-madd}.
22420
22421 On the R8000 CPU when multiply-accumulate instructions are used,
22422 the intermediate product is calculated to infinite precision
22423 and is not subject to the FCSR Flush to Zero bit. This may be
22424 undesirable in some circumstances. On other processors the result
22425 is numerically identical to the equivalent computation using
22426 separate multiply, add, subtract and negate instructions.
22427
22428 @item -nocpp
22429 @opindex nocpp
22430 Tell the MIPS assembler to not run its preprocessor over user
22431 assembler files (with a @samp{.s} suffix) when assembling them.
22432
22433 @item -mfix-24k
22434 @itemx -mno-fix-24k
22435 @opindex mfix-24k
22436 @opindex mno-fix-24k
22437 Work around the 24K E48 (lost data on stores during refill) errata.
22438 The workarounds are implemented by the assembler rather than by GCC@.
22439
22440 @item -mfix-r4000
22441 @itemx -mno-fix-r4000
22442 @opindex mfix-r4000
22443 @opindex mno-fix-r4000
22444 Work around certain R4000 CPU errata:
22445 @itemize @minus
22446 @item
22447 A double-word or a variable shift may give an incorrect result if executed
22448 immediately after starting an integer division.
22449 @item
22450 A double-word or a variable shift may give an incorrect result if executed
22451 while an integer multiplication is in progress.
22452 @item
22453 An integer division may give an incorrect result if started in a delay slot
22454 of a taken branch or a jump.
22455 @end itemize
22456
22457 @item -mfix-r4400
22458 @itemx -mno-fix-r4400
22459 @opindex mfix-r4400
22460 @opindex mno-fix-r4400
22461 Work around certain R4400 CPU errata:
22462 @itemize @minus
22463 @item
22464 A double-word or a variable shift may give an incorrect result if executed
22465 immediately after starting an integer division.
22466 @end itemize
22467
22468 @item -mfix-r10000
22469 @itemx -mno-fix-r10000
22470 @opindex mfix-r10000
22471 @opindex mno-fix-r10000
22472 Work around certain R10000 errata:
22473 @itemize @minus
22474 @item
22475 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22476 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22477 @end itemize
22478
22479 This option can only be used if the target architecture supports
22480 branch-likely instructions. @option{-mfix-r10000} is the default when
22481 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22482 otherwise.
22483
22484 @item -mfix-r5900
22485 @itemx -mno-fix-r5900
22486 @opindex mfix-r5900
22487 Do not attempt to schedule the preceding instruction into the delay slot
22488 of a branch instruction placed at the end of a short loop of six
22489 instructions or fewer and always schedule a @code{nop} instruction there
22490 instead. The short loop bug under certain conditions causes loops to
22491 execute only once or twice, due to a hardware bug in the R5900 chip. The
22492 workaround is implemented by the assembler rather than by GCC@.
22493
22494 @item -mfix-rm7000
22495 @itemx -mno-fix-rm7000
22496 @opindex mfix-rm7000
22497 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22498 workarounds are implemented by the assembler rather than by GCC@.
22499
22500 @item -mfix-vr4120
22501 @itemx -mno-fix-vr4120
22502 @opindex mfix-vr4120
22503 Work around certain VR4120 errata:
22504 @itemize @minus
22505 @item
22506 @code{dmultu} does not always produce the correct result.
22507 @item
22508 @code{div} and @code{ddiv} do not always produce the correct result if one
22509 of the operands is negative.
22510 @end itemize
22511 The workarounds for the division errata rely on special functions in
22512 @file{libgcc.a}. At present, these functions are only provided by
22513 the @code{mips64vr*-elf} configurations.
22514
22515 Other VR4120 errata require a NOP to be inserted between certain pairs of
22516 instructions. These errata are handled by the assembler, not by GCC itself.
22517
22518 @item -mfix-vr4130
22519 @opindex mfix-vr4130
22520 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22521 workarounds are implemented by the assembler rather than by GCC,
22522 although GCC avoids using @code{mflo} and @code{mfhi} if the
22523 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22524 instructions are available instead.
22525
22526 @item -mfix-sb1
22527 @itemx -mno-fix-sb1
22528 @opindex mfix-sb1
22529 Work around certain SB-1 CPU core errata.
22530 (This flag currently works around the SB-1 revision 2
22531 ``F1'' and ``F2'' floating-point errata.)
22532
22533 @item -mr10k-cache-barrier=@var{setting}
22534 @opindex mr10k-cache-barrier
22535 Specify whether GCC should insert cache barriers to avoid the
22536 side effects of speculation on R10K processors.
22537
22538 In common with many processors, the R10K tries to predict the outcome
22539 of a conditional branch and speculatively executes instructions from
22540 the ``taken'' branch. It later aborts these instructions if the
22541 predicted outcome is wrong. However, on the R10K, even aborted
22542 instructions can have side effects.
22543
22544 This problem only affects kernel stores and, depending on the system,
22545 kernel loads. As an example, a speculatively-executed store may load
22546 the target memory into cache and mark the cache line as dirty, even if
22547 the store itself is later aborted. If a DMA operation writes to the
22548 same area of memory before the ``dirty'' line is flushed, the cached
22549 data overwrites the DMA-ed data. See the R10K processor manual
22550 for a full description, including other potential problems.
22551
22552 One workaround is to insert cache barrier instructions before every memory
22553 access that might be speculatively executed and that might have side
22554 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22555 controls GCC's implementation of this workaround. It assumes that
22556 aborted accesses to any byte in the following regions does not have
22557 side effects:
22558
22559 @enumerate
22560 @item
22561 the memory occupied by the current function's stack frame;
22562
22563 @item
22564 the memory occupied by an incoming stack argument;
22565
22566 @item
22567 the memory occupied by an object with a link-time-constant address.
22568 @end enumerate
22569
22570 It is the kernel's responsibility to ensure that speculative
22571 accesses to these regions are indeed safe.
22572
22573 If the input program contains a function declaration such as:
22574
22575 @smallexample
22576 void foo (void);
22577 @end smallexample
22578
22579 then the implementation of @code{foo} must allow @code{j foo} and
22580 @code{jal foo} to be executed speculatively. GCC honors this
22581 restriction for functions it compiles itself. It expects non-GCC
22582 functions (such as hand-written assembly code) to do the same.
22583
22584 The option has three forms:
22585
22586 @table @gcctabopt
22587 @item -mr10k-cache-barrier=load-store
22588 Insert a cache barrier before a load or store that might be
22589 speculatively executed and that might have side effects even
22590 if aborted.
22591
22592 @item -mr10k-cache-barrier=store
22593 Insert a cache barrier before a store that might be speculatively
22594 executed and that might have side effects even if aborted.
22595
22596 @item -mr10k-cache-barrier=none
22597 Disable the insertion of cache barriers. This is the default setting.
22598 @end table
22599
22600 @item -mflush-func=@var{func}
22601 @itemx -mno-flush-func
22602 @opindex mflush-func
22603 Specifies the function to call to flush the I and D caches, or to not
22604 call any such function. If called, the function must take the same
22605 arguments as the common @code{_flush_func}, that is, the address of the
22606 memory range for which the cache is being flushed, the size of the
22607 memory range, and the number 3 (to flush both caches). The default
22608 depends on the target GCC was configured for, but commonly is either
22609 @code{_flush_func} or @code{__cpu_flush}.
22610
22611 @item mbranch-cost=@var{num}
22612 @opindex mbranch-cost
22613 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22614 This cost is only a heuristic and is not guaranteed to produce
22615 consistent results across releases. A zero cost redundantly selects
22616 the default, which is based on the @option{-mtune} setting.
22617
22618 @item -mbranch-likely
22619 @itemx -mno-branch-likely
22620 @opindex mbranch-likely
22621 @opindex mno-branch-likely
22622 Enable or disable use of Branch Likely instructions, regardless of the
22623 default for the selected architecture. By default, Branch Likely
22624 instructions may be generated if they are supported by the selected
22625 architecture. An exception is for the MIPS32 and MIPS64 architectures
22626 and processors that implement those architectures; for those, Branch
22627 Likely instructions are not be generated by default because the MIPS32
22628 and MIPS64 architectures specifically deprecate their use.
22629
22630 @item -mcompact-branches=never
22631 @itemx -mcompact-branches=optimal
22632 @itemx -mcompact-branches=always
22633 @opindex mcompact-branches=never
22634 @opindex mcompact-branches=optimal
22635 @opindex mcompact-branches=always
22636 These options control which form of branches will be generated. The
22637 default is @option{-mcompact-branches=optimal}.
22638
22639 The @option{-mcompact-branches=never} option ensures that compact branch
22640 instructions will never be generated.
22641
22642 The @option{-mcompact-branches=always} option ensures that a compact
22643 branch instruction will be generated if available. If a compact branch
22644 instruction is not available, a delay slot form of the branch will be
22645 used instead.
22646
22647 This option is supported from MIPS Release 6 onwards.
22648
22649 The @option{-mcompact-branches=optimal} option will cause a delay slot
22650 branch to be used if one is available in the current ISA and the delay
22651 slot is successfully filled. If the delay slot is not filled, a compact
22652 branch will be chosen if one is available.
22653
22654 @item -mfp-exceptions
22655 @itemx -mno-fp-exceptions
22656 @opindex mfp-exceptions
22657 Specifies whether FP exceptions are enabled. This affects how
22658 FP instructions are scheduled for some processors.
22659 The default is that FP exceptions are
22660 enabled.
22661
22662 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22663 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22664 FP pipe.
22665
22666 @item -mvr4130-align
22667 @itemx -mno-vr4130-align
22668 @opindex mvr4130-align
22669 The VR4130 pipeline is two-way superscalar, but can only issue two
22670 instructions together if the first one is 8-byte aligned. When this
22671 option is enabled, GCC aligns pairs of instructions that it
22672 thinks should execute in parallel.
22673
22674 This option only has an effect when optimizing for the VR4130.
22675 It normally makes code faster, but at the expense of making it bigger.
22676 It is enabled by default at optimization level @option{-O3}.
22677
22678 @item -msynci
22679 @itemx -mno-synci
22680 @opindex msynci
22681 Enable (disable) generation of @code{synci} instructions on
22682 architectures that support it. The @code{synci} instructions (if
22683 enabled) are generated when @code{__builtin___clear_cache} is
22684 compiled.
22685
22686 This option defaults to @option{-mno-synci}, but the default can be
22687 overridden by configuring GCC with @option{--with-synci}.
22688
22689 When compiling code for single processor systems, it is generally safe
22690 to use @code{synci}. However, on many multi-core (SMP) systems, it
22691 does not invalidate the instruction caches on all cores and may lead
22692 to undefined behavior.
22693
22694 @item -mrelax-pic-calls
22695 @itemx -mno-relax-pic-calls
22696 @opindex mrelax-pic-calls
22697 Try to turn PIC calls that are normally dispatched via register
22698 @code{$25} into direct calls. This is only possible if the linker can
22699 resolve the destination at link time and if the destination is within
22700 range for a direct call.
22701
22702 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22703 an assembler and a linker that support the @code{.reloc} assembly
22704 directive and @option{-mexplicit-relocs} is in effect. With
22705 @option{-mno-explicit-relocs}, this optimization can be performed by the
22706 assembler and the linker alone without help from the compiler.
22707
22708 @item -mmcount-ra-address
22709 @itemx -mno-mcount-ra-address
22710 @opindex mmcount-ra-address
22711 @opindex mno-mcount-ra-address
22712 Emit (do not emit) code that allows @code{_mcount} to modify the
22713 calling function's return address. When enabled, this option extends
22714 the usual @code{_mcount} interface with a new @var{ra-address}
22715 parameter, which has type @code{intptr_t *} and is passed in register
22716 @code{$12}. @code{_mcount} can then modify the return address by
22717 doing both of the following:
22718 @itemize
22719 @item
22720 Returning the new address in register @code{$31}.
22721 @item
22722 Storing the new address in @code{*@var{ra-address}},
22723 if @var{ra-address} is nonnull.
22724 @end itemize
22725
22726 The default is @option{-mno-mcount-ra-address}.
22727
22728 @item -mframe-header-opt
22729 @itemx -mno-frame-header-opt
22730 @opindex mframe-header-opt
22731 Enable (disable) frame header optimization in the o32 ABI. When using the
22732 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22733 function to write out register arguments. When enabled, this optimization
22734 will suppress the allocation of the frame header if it can be determined that
22735 it is unused.
22736
22737 This optimization is off by default at all optimization levels.
22738
22739 @item -mlxc1-sxc1
22740 @itemx -mno-lxc1-sxc1
22741 @opindex mlxc1-sxc1
22742 When applicable, enable (disable) the generation of @code{lwxc1},
22743 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22744
22745 @item -mmadd4
22746 @itemx -mno-madd4
22747 @opindex mmadd4
22748 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22749 @code{madd.d} and related instructions. Enabled by default.
22750
22751 @end table
22752
22753 @node MMIX Options
22754 @subsection MMIX Options
22755 @cindex MMIX Options
22756
22757 These options are defined for the MMIX:
22758
22759 @table @gcctabopt
22760 @item -mlibfuncs
22761 @itemx -mno-libfuncs
22762 @opindex mlibfuncs
22763 @opindex mno-libfuncs
22764 Specify that intrinsic library functions are being compiled, passing all
22765 values in registers, no matter the size.
22766
22767 @item -mepsilon
22768 @itemx -mno-epsilon
22769 @opindex mepsilon
22770 @opindex mno-epsilon
22771 Generate floating-point comparison instructions that compare with respect
22772 to the @code{rE} epsilon register.
22773
22774 @item -mabi=mmixware
22775 @itemx -mabi=gnu
22776 @opindex mabi=mmixware
22777 @opindex mabi=gnu
22778 Generate code that passes function parameters and return values that (in
22779 the called function) are seen as registers @code{$0} and up, as opposed to
22780 the GNU ABI which uses global registers @code{$231} and up.
22781
22782 @item -mzero-extend
22783 @itemx -mno-zero-extend
22784 @opindex mzero-extend
22785 @opindex mno-zero-extend
22786 When reading data from memory in sizes shorter than 64 bits, use (do not
22787 use) zero-extending load instructions by default, rather than
22788 sign-extending ones.
22789
22790 @item -mknuthdiv
22791 @itemx -mno-knuthdiv
22792 @opindex mknuthdiv
22793 @opindex mno-knuthdiv
22794 Make the result of a division yielding a remainder have the same sign as
22795 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22796 remainder follows the sign of the dividend. Both methods are
22797 arithmetically valid, the latter being almost exclusively used.
22798
22799 @item -mtoplevel-symbols
22800 @itemx -mno-toplevel-symbols
22801 @opindex mtoplevel-symbols
22802 @opindex mno-toplevel-symbols
22803 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22804 code can be used with the @code{PREFIX} assembly directive.
22805
22806 @item -melf
22807 @opindex melf
22808 Generate an executable in the ELF format, rather than the default
22809 @samp{mmo} format used by the @command{mmix} simulator.
22810
22811 @item -mbranch-predict
22812 @itemx -mno-branch-predict
22813 @opindex mbranch-predict
22814 @opindex mno-branch-predict
22815 Use (do not use) the probable-branch instructions, when static branch
22816 prediction indicates a probable branch.
22817
22818 @item -mbase-addresses
22819 @itemx -mno-base-addresses
22820 @opindex mbase-addresses
22821 @opindex mno-base-addresses
22822 Generate (do not generate) code that uses @emph{base addresses}. Using a
22823 base address automatically generates a request (handled by the assembler
22824 and the linker) for a constant to be set up in a global register. The
22825 register is used for one or more base address requests within the range 0
22826 to 255 from the value held in the register. The generally leads to short
22827 and fast code, but the number of different data items that can be
22828 addressed is limited. This means that a program that uses lots of static
22829 data may require @option{-mno-base-addresses}.
22830
22831 @item -msingle-exit
22832 @itemx -mno-single-exit
22833 @opindex msingle-exit
22834 @opindex mno-single-exit
22835 Force (do not force) generated code to have a single exit point in each
22836 function.
22837 @end table
22838
22839 @node MN10300 Options
22840 @subsection MN10300 Options
22841 @cindex MN10300 options
22842
22843 These @option{-m} options are defined for Matsushita MN10300 architectures:
22844
22845 @table @gcctabopt
22846 @item -mmult-bug
22847 @opindex mmult-bug
22848 Generate code to avoid bugs in the multiply instructions for the MN10300
22849 processors. This is the default.
22850
22851 @item -mno-mult-bug
22852 @opindex mno-mult-bug
22853 Do not generate code to avoid bugs in the multiply instructions for the
22854 MN10300 processors.
22855
22856 @item -mam33
22857 @opindex mam33
22858 Generate code using features specific to the AM33 processor.
22859
22860 @item -mno-am33
22861 @opindex mno-am33
22862 Do not generate code using features specific to the AM33 processor. This
22863 is the default.
22864
22865 @item -mam33-2
22866 @opindex mam33-2
22867 Generate code using features specific to the AM33/2.0 processor.
22868
22869 @item -mam34
22870 @opindex mam34
22871 Generate code using features specific to the AM34 processor.
22872
22873 @item -mtune=@var{cpu-type}
22874 @opindex mtune
22875 Use the timing characteristics of the indicated CPU type when
22876 scheduling instructions. This does not change the targeted processor
22877 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22878 @samp{am33-2} or @samp{am34}.
22879
22880 @item -mreturn-pointer-on-d0
22881 @opindex mreturn-pointer-on-d0
22882 When generating a function that returns a pointer, return the pointer
22883 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22884 only in @code{a0}, and attempts to call such functions without a prototype
22885 result in errors. Note that this option is on by default; use
22886 @option{-mno-return-pointer-on-d0} to disable it.
22887
22888 @item -mno-crt0
22889 @opindex mno-crt0
22890 Do not link in the C run-time initialization object file.
22891
22892 @item -mrelax
22893 @opindex mrelax
22894 Indicate to the linker that it should perform a relaxation optimization pass
22895 to shorten branches, calls and absolute memory addresses. This option only
22896 has an effect when used on the command line for the final link step.
22897
22898 This option makes symbolic debugging impossible.
22899
22900 @item -mliw
22901 @opindex mliw
22902 Allow the compiler to generate @emph{Long Instruction Word}
22903 instructions if the target is the @samp{AM33} or later. This is the
22904 default. This option defines the preprocessor macro @code{__LIW__}.
22905
22906 @item -mno-liw
22907 @opindex mno-liw
22908 Do not allow the compiler to generate @emph{Long Instruction Word}
22909 instructions. This option defines the preprocessor macro
22910 @code{__NO_LIW__}.
22911
22912 @item -msetlb
22913 @opindex msetlb
22914 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22915 instructions if the target is the @samp{AM33} or later. This is the
22916 default. This option defines the preprocessor macro @code{__SETLB__}.
22917
22918 @item -mno-setlb
22919 @opindex mno-setlb
22920 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22921 instructions. This option defines the preprocessor macro
22922 @code{__NO_SETLB__}.
22923
22924 @end table
22925
22926 @node Moxie Options
22927 @subsection Moxie Options
22928 @cindex Moxie Options
22929
22930 @table @gcctabopt
22931
22932 @item -meb
22933 @opindex meb
22934 Generate big-endian code. This is the default for @samp{moxie-*-*}
22935 configurations.
22936
22937 @item -mel
22938 @opindex mel
22939 Generate little-endian code.
22940
22941 @item -mmul.x
22942 @opindex mmul.x
22943 Generate mul.x and umul.x instructions. This is the default for
22944 @samp{moxiebox-*-*} configurations.
22945
22946 @item -mno-crt0
22947 @opindex mno-crt0
22948 Do not link in the C run-time initialization object file.
22949
22950 @end table
22951
22952 @node MSP430 Options
22953 @subsection MSP430 Options
22954 @cindex MSP430 Options
22955
22956 These options are defined for the MSP430:
22957
22958 @table @gcctabopt
22959
22960 @item -masm-hex
22961 @opindex masm-hex
22962 Force assembly output to always use hex constants. Normally such
22963 constants are signed decimals, but this option is available for
22964 testsuite and/or aesthetic purposes.
22965
22966 @item -mmcu=
22967 @opindex mmcu=
22968 Select the MCU to target. This is used to create a C preprocessor
22969 symbol based upon the MCU name, converted to upper case and pre- and
22970 post-fixed with @samp{__}. This in turn is used by the
22971 @file{msp430.h} header file to select an MCU-specific supplementary
22972 header file.
22973
22974 The option also sets the ISA to use. If the MCU name is one that is
22975 known to only support the 430 ISA then that is selected, otherwise the
22976 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22977 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22978 name selects the 430X ISA.
22979
22980 In addition an MCU-specific linker script is added to the linker
22981 command line. The script's name is the name of the MCU with
22982 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22983 command line defines the C preprocessor symbol @code{__XXX__} and
22984 cause the linker to search for a script called @file{xxx.ld}.
22985
22986 This option is also passed on to the assembler.
22987
22988 @item -mwarn-mcu
22989 @itemx -mno-warn-mcu
22990 @opindex mwarn-mcu
22991 @opindex mno-warn-mcu
22992 This option enables or disables warnings about conflicts between the
22993 MCU name specified by the @option{-mmcu} option and the ISA set by the
22994 @option{-mcpu} option and/or the hardware multiply support set by the
22995 @option{-mhwmult} option. It also toggles warnings about unrecognized
22996 MCU names. This option is on by default.
22997
22998 @item -mcpu=
22999 @opindex mcpu=
23000 Specifies the ISA to use. Accepted values are @samp{msp430},
23001 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23002 @option{-mmcu=} option should be used to select the ISA.
23003
23004 @item -msim
23005 @opindex msim
23006 Link to the simulator runtime libraries and linker script. Overrides
23007 any scripts that would be selected by the @option{-mmcu=} option.
23008
23009 @item -mlarge
23010 @opindex mlarge
23011 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23012
23013 @item -msmall
23014 @opindex msmall
23015 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23016
23017 @item -mrelax
23018 @opindex mrelax
23019 This option is passed to the assembler and linker, and allows the
23020 linker to perform certain optimizations that cannot be done until
23021 the final link.
23022
23023 @item mhwmult=
23024 @opindex mhwmult=
23025 Describes the type of hardware multiply supported by the target.
23026 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23027 for the original 16-bit-only multiply supported by early MCUs.
23028 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23029 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23030 A value of @samp{auto} can also be given. This tells GCC to deduce
23031 the hardware multiply support based upon the MCU name provided by the
23032 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23033 the MCU name is not recognized then no hardware multiply support is
23034 assumed. @code{auto} is the default setting.
23035
23036 Hardware multiplies are normally performed by calling a library
23037 routine. This saves space in the generated code. When compiling at
23038 @option{-O3} or higher however the hardware multiplier is invoked
23039 inline. This makes for bigger, but faster code.
23040
23041 The hardware multiply routines disable interrupts whilst running and
23042 restore the previous interrupt state when they finish. This makes
23043 them safe to use inside interrupt handlers as well as in normal code.
23044
23045 @item -minrt
23046 @opindex minrt
23047 Enable the use of a minimum runtime environment - no static
23048 initializers or constructors. This is intended for memory-constrained
23049 devices. The compiler includes special symbols in some objects
23050 that tell the linker and runtime which code fragments are required.
23051
23052 @item -mcode-region=
23053 @itemx -mdata-region=
23054 @opindex mcode-region
23055 @opindex mdata-region
23056 These options tell the compiler where to place functions and data that
23057 do not have one of the @code{lower}, @code{upper}, @code{either} or
23058 @code{section} attributes. Possible values are @code{lower},
23059 @code{upper}, @code{either} or @code{any}. The first three behave
23060 like the corresponding attribute. The fourth possible value -
23061 @code{any} - is the default. It leaves placement entirely up to the
23062 linker script and how it assigns the standard sections
23063 (@code{.text}, @code{.data}, etc) to the memory regions.
23064
23065 @item -msilicon-errata=
23066 @opindex msilicon-errata
23067 This option passes on a request to assembler to enable the fixes for
23068 the named silicon errata.
23069
23070 @item -msilicon-errata-warn=
23071 @opindex msilicon-errata-warn
23072 This option passes on a request to the assembler to enable warning
23073 messages when a silicon errata might need to be applied.
23074
23075 @end table
23076
23077 @node NDS32 Options
23078 @subsection NDS32 Options
23079 @cindex NDS32 Options
23080
23081 These options are defined for NDS32 implementations:
23082
23083 @table @gcctabopt
23084
23085 @item -mbig-endian
23086 @opindex mbig-endian
23087 Generate code in big-endian mode.
23088
23089 @item -mlittle-endian
23090 @opindex mlittle-endian
23091 Generate code in little-endian mode.
23092
23093 @item -mreduced-regs
23094 @opindex mreduced-regs
23095 Use reduced-set registers for register allocation.
23096
23097 @item -mfull-regs
23098 @opindex mfull-regs
23099 Use full-set registers for register allocation.
23100
23101 @item -mcmov
23102 @opindex mcmov
23103 Generate conditional move instructions.
23104
23105 @item -mno-cmov
23106 @opindex mno-cmov
23107 Do not generate conditional move instructions.
23108
23109 @item -mext-perf
23110 @opindex mext-perf
23111 Generate performance extension instructions.
23112
23113 @item -mno-ext-perf
23114 @opindex mno-ext-perf
23115 Do not generate performance extension instructions.
23116
23117 @item -mext-perf2
23118 @opindex mext-perf2
23119 Generate performance extension 2 instructions.
23120
23121 @item -mno-ext-perf2
23122 @opindex mno-ext-perf2
23123 Do not generate performance extension 2 instructions.
23124
23125 @item -mext-string
23126 @opindex mext-string
23127 Generate string extension instructions.
23128
23129 @item -mno-ext-string
23130 @opindex mno-ext-string
23131 Do not generate string extension instructions.
23132
23133 @item -mv3push
23134 @opindex mv3push
23135 Generate v3 push25/pop25 instructions.
23136
23137 @item -mno-v3push
23138 @opindex mno-v3push
23139 Do not generate v3 push25/pop25 instructions.
23140
23141 @item -m16-bit
23142 @opindex m16-bit
23143 Generate 16-bit instructions.
23144
23145 @item -mno-16-bit
23146 @opindex mno-16-bit
23147 Do not generate 16-bit instructions.
23148
23149 @item -misr-vector-size=@var{num}
23150 @opindex misr-vector-size
23151 Specify the size of each interrupt vector, which must be 4 or 16.
23152
23153 @item -mcache-block-size=@var{num}
23154 @opindex mcache-block-size
23155 Specify the size of each cache block,
23156 which must be a power of 2 between 4 and 512.
23157
23158 @item -march=@var{arch}
23159 @opindex march
23160 Specify the name of the target architecture.
23161
23162 @item -mcmodel=@var{code-model}
23163 @opindex mcmodel
23164 Set the code model to one of
23165 @table @asis
23166 @item @samp{small}
23167 All the data and read-only data segments must be within 512KB addressing space.
23168 The text segment must be within 16MB addressing space.
23169 @item @samp{medium}
23170 The data segment must be within 512KB while the read-only data segment can be
23171 within 4GB addressing space. The text segment should be still within 16MB
23172 addressing space.
23173 @item @samp{large}
23174 All the text and data segments can be within 4GB addressing space.
23175 @end table
23176
23177 @item -mctor-dtor
23178 @opindex mctor-dtor
23179 Enable constructor/destructor feature.
23180
23181 @item -mrelax
23182 @opindex mrelax
23183 Guide linker to relax instructions.
23184
23185 @end table
23186
23187 @node Nios II Options
23188 @subsection Nios II Options
23189 @cindex Nios II options
23190 @cindex Altera Nios II options
23191
23192 These are the options defined for the Altera Nios II processor.
23193
23194 @table @gcctabopt
23195
23196 @item -G @var{num}
23197 @opindex G
23198 @cindex smaller data references
23199 Put global and static objects less than or equal to @var{num} bytes
23200 into the small data or BSS sections instead of the normal data or BSS
23201 sections. The default value of @var{num} is 8.
23202
23203 @item -mgpopt=@var{option}
23204 @itemx -mgpopt
23205 @itemx -mno-gpopt
23206 @opindex mgpopt
23207 @opindex mno-gpopt
23208 Generate (do not generate) GP-relative accesses. The following
23209 @var{option} names are recognized:
23210
23211 @table @samp
23212
23213 @item none
23214 Do not generate GP-relative accesses.
23215
23216 @item local
23217 Generate GP-relative accesses for small data objects that are not
23218 external, weak, or uninitialized common symbols.
23219 Also use GP-relative addressing for objects that
23220 have been explicitly placed in a small data section via a @code{section}
23221 attribute.
23222
23223 @item global
23224 As for @samp{local}, but also generate GP-relative accesses for
23225 small data objects that are external, weak, or common. If you use this option,
23226 you must ensure that all parts of your program (including libraries) are
23227 compiled with the same @option{-G} setting.
23228
23229 @item data
23230 Generate GP-relative accesses for all data objects in the program. If you
23231 use this option, the entire data and BSS segments
23232 of your program must fit in 64K of memory and you must use an appropriate
23233 linker script to allocate them within the addressable range of the
23234 global pointer.
23235
23236 @item all
23237 Generate GP-relative addresses for function pointers as well as data
23238 pointers. If you use this option, the entire text, data, and BSS segments
23239 of your program must fit in 64K of memory and you must use an appropriate
23240 linker script to allocate them within the addressable range of the
23241 global pointer.
23242
23243 @end table
23244
23245 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23246 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23247
23248 The default is @option{-mgpopt} except when @option{-fpic} or
23249 @option{-fPIC} is specified to generate position-independent code.
23250 Note that the Nios II ABI does not permit GP-relative accesses from
23251 shared libraries.
23252
23253 You may need to specify @option{-mno-gpopt} explicitly when building
23254 programs that include large amounts of small data, including large
23255 GOT data sections. In this case, the 16-bit offset for GP-relative
23256 addressing may not be large enough to allow access to the entire
23257 small data section.
23258
23259 @item -mgprel-sec=@var{regexp}
23260 @opindex mgprel-sec
23261 This option specifies additional section names that can be accessed via
23262 GP-relative addressing. It is most useful in conjunction with
23263 @code{section} attributes on variable declarations
23264 (@pxref{Common Variable Attributes}) and a custom linker script.
23265 The @var{regexp} is a POSIX Extended Regular Expression.
23266
23267 This option does not affect the behavior of the @option{-G} option, and
23268 the specified sections are in addition to the standard @code{.sdata}
23269 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23270
23271 @item -mr0rel-sec=@var{regexp}
23272 @opindex mr0rel-sec
23273 This option specifies names of sections that can be accessed via a
23274 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23275 of the 32-bit address space. It is most useful in conjunction with
23276 @code{section} attributes on variable declarations
23277 (@pxref{Common Variable Attributes}) and a custom linker script.
23278 The @var{regexp} is a POSIX Extended Regular Expression.
23279
23280 In contrast to the use of GP-relative addressing for small data,
23281 zero-based addressing is never generated by default and there are no
23282 conventional section names used in standard linker scripts for sections
23283 in the low or high areas of memory.
23284
23285 @item -mel
23286 @itemx -meb
23287 @opindex mel
23288 @opindex meb
23289 Generate little-endian (default) or big-endian (experimental) code,
23290 respectively.
23291
23292 @item -march=@var{arch}
23293 @opindex march
23294 This specifies the name of the target Nios II architecture. GCC uses this
23295 name to determine what kind of instructions it can emit when generating
23296 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23297
23298 The preprocessor macro @code{__nios2_arch__} is available to programs,
23299 with value 1 or 2, indicating the targeted ISA level.
23300
23301 @item -mbypass-cache
23302 @itemx -mno-bypass-cache
23303 @opindex mno-bypass-cache
23304 @opindex mbypass-cache
23305 Force all load and store instructions to always bypass cache by
23306 using I/O variants of the instructions. The default is not to
23307 bypass the cache.
23308
23309 @item -mno-cache-volatile
23310 @itemx -mcache-volatile
23311 @opindex mcache-volatile
23312 @opindex mno-cache-volatile
23313 Volatile memory access bypass the cache using the I/O variants of
23314 the load and store instructions. The default is not to bypass the cache.
23315
23316 @item -mno-fast-sw-div
23317 @itemx -mfast-sw-div
23318 @opindex mno-fast-sw-div
23319 @opindex mfast-sw-div
23320 Do not use table-based fast divide for small numbers. The default
23321 is to use the fast divide at @option{-O3} and above.
23322
23323 @item -mno-hw-mul
23324 @itemx -mhw-mul
23325 @itemx -mno-hw-mulx
23326 @itemx -mhw-mulx
23327 @itemx -mno-hw-div
23328 @itemx -mhw-div
23329 @opindex mno-hw-mul
23330 @opindex mhw-mul
23331 @opindex mno-hw-mulx
23332 @opindex mhw-mulx
23333 @opindex mno-hw-div
23334 @opindex mhw-div
23335 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23336 instructions by the compiler. The default is to emit @code{mul}
23337 and not emit @code{div} and @code{mulx}.
23338
23339 @item -mbmx
23340 @itemx -mno-bmx
23341 @itemx -mcdx
23342 @itemx -mno-cdx
23343 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23344 CDX (code density) instructions. Enabling these instructions also
23345 requires @option{-march=r2}. Since these instructions are optional
23346 extensions to the R2 architecture, the default is not to emit them.
23347
23348 @item -mcustom-@var{insn}=@var{N}
23349 @itemx -mno-custom-@var{insn}
23350 @opindex mcustom-@var{insn}
23351 @opindex mno-custom-@var{insn}
23352 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23353 custom instruction with encoding @var{N} when generating code that uses
23354 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23355 instruction 253 for single-precision floating-point add operations instead
23356 of the default behavior of using a library call.
23357
23358 The following values of @var{insn} are supported. Except as otherwise
23359 noted, floating-point operations are expected to be implemented with
23360 normal IEEE 754 semantics and correspond directly to the C operators or the
23361 equivalent GCC built-in functions (@pxref{Other Builtins}).
23362
23363 Single-precision floating point:
23364 @table @asis
23365
23366 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23367 Binary arithmetic operations.
23368
23369 @item @samp{fnegs}
23370 Unary negation.
23371
23372 @item @samp{fabss}
23373 Unary absolute value.
23374
23375 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23376 Comparison operations.
23377
23378 @item @samp{fmins}, @samp{fmaxs}
23379 Floating-point minimum and maximum. These instructions are only
23380 generated if @option{-ffinite-math-only} is specified.
23381
23382 @item @samp{fsqrts}
23383 Unary square root operation.
23384
23385 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23386 Floating-point trigonometric and exponential functions. These instructions
23387 are only generated if @option{-funsafe-math-optimizations} is also specified.
23388
23389 @end table
23390
23391 Double-precision floating point:
23392 @table @asis
23393
23394 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23395 Binary arithmetic operations.
23396
23397 @item @samp{fnegd}
23398 Unary negation.
23399
23400 @item @samp{fabsd}
23401 Unary absolute value.
23402
23403 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23404 Comparison operations.
23405
23406 @item @samp{fmind}, @samp{fmaxd}
23407 Double-precision minimum and maximum. These instructions are only
23408 generated if @option{-ffinite-math-only} is specified.
23409
23410 @item @samp{fsqrtd}
23411 Unary square root operation.
23412
23413 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23414 Double-precision trigonometric and exponential functions. These instructions
23415 are only generated if @option{-funsafe-math-optimizations} is also specified.
23416
23417 @end table
23418
23419 Conversions:
23420 @table @asis
23421 @item @samp{fextsd}
23422 Conversion from single precision to double precision.
23423
23424 @item @samp{ftruncds}
23425 Conversion from double precision to single precision.
23426
23427 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23428 Conversion from floating point to signed or unsigned integer types, with
23429 truncation towards zero.
23430
23431 @item @samp{round}
23432 Conversion from single-precision floating point to signed integer,
23433 rounding to the nearest integer and ties away from zero.
23434 This corresponds to the @code{__builtin_lroundf} function when
23435 @option{-fno-math-errno} is used.
23436
23437 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23438 Conversion from signed or unsigned integer types to floating-point types.
23439
23440 @end table
23441
23442 In addition, all of the following transfer instructions for internal
23443 registers X and Y must be provided to use any of the double-precision
23444 floating-point instructions. Custom instructions taking two
23445 double-precision source operands expect the first operand in the
23446 64-bit register X. The other operand (or only operand of a unary
23447 operation) is given to the custom arithmetic instruction with the
23448 least significant half in source register @var{src1} and the most
23449 significant half in @var{src2}. A custom instruction that returns a
23450 double-precision result returns the most significant 32 bits in the
23451 destination register and the other half in 32-bit register Y.
23452 GCC automatically generates the necessary code sequences to write
23453 register X and/or read register Y when double-precision floating-point
23454 instructions are used.
23455
23456 @table @asis
23457
23458 @item @samp{fwrx}
23459 Write @var{src1} into the least significant half of X and @var{src2} into
23460 the most significant half of X.
23461
23462 @item @samp{fwry}
23463 Write @var{src1} into Y.
23464
23465 @item @samp{frdxhi}, @samp{frdxlo}
23466 Read the most or least (respectively) significant half of X and store it in
23467 @var{dest}.
23468
23469 @item @samp{frdy}
23470 Read the value of Y and store it into @var{dest}.
23471 @end table
23472
23473 Note that you can gain more local control over generation of Nios II custom
23474 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23475 and @code{target("no-custom-@var{insn}")} function attributes
23476 (@pxref{Function Attributes})
23477 or pragmas (@pxref{Function Specific Option Pragmas}).
23478
23479 @item -mcustom-fpu-cfg=@var{name}
23480 @opindex mcustom-fpu-cfg
23481
23482 This option enables a predefined, named set of custom instruction encodings
23483 (see @option{-mcustom-@var{insn}} above).
23484 Currently, the following sets are defined:
23485
23486 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23487 @gccoptlist{-mcustom-fmuls=252 @gol
23488 -mcustom-fadds=253 @gol
23489 -mcustom-fsubs=254 @gol
23490 -fsingle-precision-constant}
23491
23492 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23493 @gccoptlist{-mcustom-fmuls=252 @gol
23494 -mcustom-fadds=253 @gol
23495 -mcustom-fsubs=254 @gol
23496 -mcustom-fdivs=255 @gol
23497 -fsingle-precision-constant}
23498
23499 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23500 @gccoptlist{-mcustom-floatus=243 @gol
23501 -mcustom-fixsi=244 @gol
23502 -mcustom-floatis=245 @gol
23503 -mcustom-fcmpgts=246 @gol
23504 -mcustom-fcmples=249 @gol
23505 -mcustom-fcmpeqs=250 @gol
23506 -mcustom-fcmpnes=251 @gol
23507 -mcustom-fmuls=252 @gol
23508 -mcustom-fadds=253 @gol
23509 -mcustom-fsubs=254 @gol
23510 -mcustom-fdivs=255 @gol
23511 -fsingle-precision-constant}
23512
23513 Custom instruction assignments given by individual
23514 @option{-mcustom-@var{insn}=} options override those given by
23515 @option{-mcustom-fpu-cfg=}, regardless of the
23516 order of the options on the command line.
23517
23518 Note that you can gain more local control over selection of a FPU
23519 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23520 function attribute (@pxref{Function Attributes})
23521 or pragma (@pxref{Function Specific Option Pragmas}).
23522
23523 @end table
23524
23525 These additional @samp{-m} options are available for the Altera Nios II
23526 ELF (bare-metal) target:
23527
23528 @table @gcctabopt
23529
23530 @item -mhal
23531 @opindex mhal
23532 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23533 startup and termination code, and is typically used in conjunction with
23534 @option{-msys-crt0=} to specify the location of the alternate startup code
23535 provided by the HAL BSP.
23536
23537 @item -msmallc
23538 @opindex msmallc
23539 Link with a limited version of the C library, @option{-lsmallc}, rather than
23540 Newlib.
23541
23542 @item -msys-crt0=@var{startfile}
23543 @opindex msys-crt0
23544 @var{startfile} is the file name of the startfile (crt0) to use
23545 when linking. This option is only useful in conjunction with @option{-mhal}.
23546
23547 @item -msys-lib=@var{systemlib}
23548 @opindex msys-lib
23549 @var{systemlib} is the library name of the library that provides
23550 low-level system calls required by the C library,
23551 e.g.@: @code{read} and @code{write}.
23552 This option is typically used to link with a library provided by a HAL BSP.
23553
23554 @end table
23555
23556 @node Nvidia PTX Options
23557 @subsection Nvidia PTX Options
23558 @cindex Nvidia PTX options
23559 @cindex nvptx options
23560
23561 These options are defined for Nvidia PTX:
23562
23563 @table @gcctabopt
23564
23565 @item -m32
23566 @itemx -m64
23567 @opindex m32
23568 @opindex m64
23569 Generate code for 32-bit or 64-bit ABI.
23570
23571 @item -misa=@var{ISA-string}
23572 @opindex march
23573 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23574 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23575 @samp{sm_35}. The default ISA is sm_30.
23576
23577 @item -mmainkernel
23578 @opindex mmainkernel
23579 Link in code for a __main kernel. This is for stand-alone instead of
23580 offloading execution.
23581
23582 @item -moptimize
23583 @opindex moptimize
23584 Apply partitioned execution optimizations. This is the default when any
23585 level of optimization is selected.
23586
23587 @item -msoft-stack
23588 @opindex msoft-stack
23589 Generate code that does not use @code{.local} memory
23590 directly for stack storage. Instead, a per-warp stack pointer is
23591 maintained explicitly. This enables variable-length stack allocation (with
23592 variable-length arrays or @code{alloca}), and when global memory is used for
23593 underlying storage, makes it possible to access automatic variables from other
23594 threads, or with atomic instructions. This code generation variant is used
23595 for OpenMP offloading, but the option is exposed on its own for the purpose
23596 of testing the compiler; to generate code suitable for linking into programs
23597 using OpenMP offloading, use option @option{-mgomp}.
23598
23599 @item -muniform-simt
23600 @opindex muniform-simt
23601 Switch to code generation variant that allows to execute all threads in each
23602 warp, while maintaining memory state and side effects as if only one thread
23603 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23604 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23605 current lane index equals the master lane index), and the register being
23606 assigned is copied via a shuffle instruction from the master lane. Outside of
23607 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23608 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23609 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23610 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23611 with current lane index to compute the master lane index.
23612
23613 @item -mgomp
23614 @opindex mgomp
23615 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23616 @option{-muniform-simt} options, and selects corresponding multilib variant.
23617
23618 @end table
23619
23620 @node OpenRISC Options
23621 @subsection OpenRISC Options
23622 @cindex OpenRISC Options
23623
23624 These options are defined for OpenRISC:
23625
23626 @table @gcctabopt
23627
23628 @item -mboard=@var{name}
23629 @opindex mboard
23630 Configure a board specific runtime. This will be passed to the linker for
23631 newlib board library linking. The default is @code{or1ksim}.
23632
23633 @item -mnewlib
23634 @opindex mnewlib
23635 For compatibility, it's always newlib for elf now.
23636
23637 @item -mhard-div
23638 @opindex mhard-div
23639 Generate code for hardware which supports divide instructions. This is the
23640 default.
23641
23642 @item -mhard-mul
23643 @opindex mhard-mul
23644 Generate code for hardware which supports multiply instructions. This is the
23645 default.
23646
23647 @item -mcmov
23648 @opindex mcmov
23649 Generate code for hardware which supports the conditional move (@code{l.cmov})
23650 instruction.
23651
23652 @item -mror
23653 @opindex mror
23654 Generate code for hardware which supports rotate right instructions.
23655
23656 @item -msext
23657 @opindex msext
23658 Generate code for hardware which supports sign-extension instructions.
23659
23660 @item -msfimm
23661 @opindex msfimm
23662 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23663 instructions.
23664
23665 @item -mshftimm
23666 @opindex mshftimm
23667 Generate code for hardware which supports shift immediate related instructions
23668 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23669 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23670 also be specified.
23671
23672 @item -msoft-div
23673 @opindex msoft-div
23674 Generate code for hardware which requires divide instruction emulation.
23675
23676 @item -msoft-mul
23677 @opindex msoft-mul
23678 Generate code for hardware which requires multiply instruction emulation.
23679
23680 @end table
23681
23682 @node PDP-11 Options
23683 @subsection PDP-11 Options
23684 @cindex PDP-11 Options
23685
23686 These options are defined for the PDP-11:
23687
23688 @table @gcctabopt
23689 @item -mfpu
23690 @opindex mfpu
23691 Use hardware FPP floating point. This is the default. (FIS floating
23692 point on the PDP-11/40 is not supported.) Implies -m45.
23693
23694 @item -msoft-float
23695 @opindex msoft-float
23696 Do not use hardware floating point.
23697
23698 @item -mac0
23699 @opindex mac0
23700 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23701
23702 @item -mno-ac0
23703 @opindex mno-ac0
23704 Return floating-point results in memory. This is the default.
23705
23706 @item -m40
23707 @opindex m40
23708 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23709
23710 @item -m45
23711 @opindex m45
23712 Generate code for a PDP-11/45. This is the default.
23713
23714 @item -m10
23715 @opindex m10
23716 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23717
23718 @item -mint16
23719 @itemx -mno-int32
23720 @opindex mint16
23721 @opindex mno-int32
23722 Use 16-bit @code{int}. This is the default.
23723
23724 @item -mint32
23725 @itemx -mno-int16
23726 @opindex mint32
23727 @opindex mno-int16
23728 Use 32-bit @code{int}.
23729
23730 @item -msplit
23731 @opindex msplit
23732 Target has split instruction and data space. Implies -m45.
23733
23734 @item -munix-asm
23735 @opindex munix-asm
23736 Use Unix assembler syntax.
23737
23738 @item -mdec-asm
23739 @opindex mdec-asm
23740 Use DEC assembler syntax.
23741
23742 @item -mgnu-asm
23743 @opindex mgnu-asm
23744 Use GNU assembler syntax. This is the default.
23745
23746 @item -mlra
23747 @opindex mlra
23748 Use the new LRA register allocator. By default, the old ``reload''
23749 allocator is used.
23750 @end table
23751
23752 @node picoChip Options
23753 @subsection picoChip Options
23754 @cindex picoChip options
23755
23756 These @samp{-m} options are defined for picoChip implementations:
23757
23758 @table @gcctabopt
23759
23760 @item -mae=@var{ae_type}
23761 @opindex mcpu
23762 Set the instruction set, register set, and instruction scheduling
23763 parameters for array element type @var{ae_type}. Supported values
23764 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23765
23766 @option{-mae=ANY} selects a completely generic AE type. Code
23767 generated with this option runs on any of the other AE types. The
23768 code is not as efficient as it would be if compiled for a specific
23769 AE type, and some types of operation (e.g., multiplication) do not
23770 work properly on all types of AE.
23771
23772 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23773 for compiled code, and is the default.
23774
23775 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23776 option may suffer from poor performance of byte (char) manipulation,
23777 since the DSP AE does not provide hardware support for byte load/stores.
23778
23779 @item -msymbol-as-address
23780 Enable the compiler to directly use a symbol name as an address in a
23781 load/store instruction, without first loading it into a
23782 register. Typically, the use of this option generates larger
23783 programs, which run faster than when the option isn't used. However, the
23784 results vary from program to program, so it is left as a user option,
23785 rather than being permanently enabled.
23786
23787 @item -mno-inefficient-warnings
23788 Disables warnings about the generation of inefficient code. These
23789 warnings can be generated, for example, when compiling code that
23790 performs byte-level memory operations on the MAC AE type. The MAC AE has
23791 no hardware support for byte-level memory operations, so all byte
23792 load/stores must be synthesized from word load/store operations. This is
23793 inefficient and a warning is generated to indicate
23794 that you should rewrite the code to avoid byte operations, or to target
23795 an AE type that has the necessary hardware support. This option disables
23796 these warnings.
23797
23798 @end table
23799
23800 @node PowerPC Options
23801 @subsection PowerPC Options
23802 @cindex PowerPC options
23803
23804 These are listed under @xref{RS/6000 and PowerPC Options}.
23805
23806 @node PRU Options
23807 @subsection PRU Options
23808 @cindex PRU Options
23809
23810 These command-line options are defined for PRU target:
23811
23812 @table @gcctabopt
23813 @item -minrt
23814 @opindex minrt
23815 Link with a minimum runtime environment, with no support for static
23816 initializers and constructors. Using this option can significantly reduce
23817 the size of the final ELF binary. Beware that the compiler could still
23818 generate code with static initializers and constructors. It is up to the
23819 programmer to ensure that the source program will not use those features.
23820
23821 @item -mmcu=@var{mcu}
23822 @opindex mmcu
23823 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23824 supported MCUs.
23825
23826 @item -mno-relax
23827 @opindex mno-relax
23828 Make GCC pass the @option{--no-relax} command-line option to the linker
23829 instead of the @option{--relax} option.
23830
23831 @item -mloop
23832 @opindex mloop
23833 Allow (or do not allow) GCC to use the LOOP instruction.
23834
23835 @item -mabi=@var{variant}
23836 @opindex mabi
23837 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23838 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23839 more naturally with certain GCC assumptions. These are the differences:
23840
23841 @table @samp
23842 @item Function Pointer Size
23843 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23844 supports only 32-bit data and code pointers.
23845
23846 @item Optional Return Value Pointer
23847 Function return values larger than 64 bits are passed by using a hidden
23848 pointer as the first argument of the function. TI ABI, though, mandates that
23849 the pointer can be NULL in case the caller is not using the returned value.
23850 GNU always passes and expects a valid return value pointer.
23851
23852 @end table
23853
23854 The current @option{-mabi=ti} implementation simply raises a compile error
23855 when any of the above code constructs is detected. As a consequence
23856 the standard C library cannot be built and it is omitted when linking with
23857 @option{-mabi=ti}.
23858
23859 Relaxation is a GNU feature and for safety reasons is disabled when using
23860 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23861 instructions, so the GNU linker cannot adjust them when shortening adjacent
23862 LDI32 pseudo instructions.
23863
23864 @end table
23865
23866 @node RISC-V Options
23867 @subsection RISC-V Options
23868 @cindex RISC-V Options
23869
23870 These command-line options are defined for RISC-V targets:
23871
23872 @table @gcctabopt
23873 @item -mbranch-cost=@var{n}
23874 @opindex mbranch-cost
23875 Set the cost of branches to roughly @var{n} instructions.
23876
23877 @item -mplt
23878 @itemx -mno-plt
23879 @opindex plt
23880 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23881 non-PIC. The default is @option{-mplt}.
23882
23883 @item -mabi=@var{ABI-string}
23884 @opindex mabi
23885 Specify integer and floating-point calling convention. @var{ABI-string}
23886 contains two parts: the size of integer types and the registers used for
23887 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23888 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23889 32-bit), and that floating-point values up to 64 bits wide are passed in F
23890 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23891 allows the compiler to generate code that uses the F and D extensions but only
23892 allows floating-point values up to 32 bits long to be passed in registers; or
23893 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23894 passed in registers.
23895
23896 The default for this argument is system dependent, users who want a specific
23897 calling convention should specify one explicitly. The valid calling
23898 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23899 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23900 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23901 invalid because the ABI requires 64-bit values be passed in F registers, but F
23902 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23903 only be used with the @samp{rv32e} architecture. This ABI is not well
23904 specified at present, and is subject to change.
23905
23906 @item -mfdiv
23907 @itemx -mno-fdiv
23908 @opindex mfdiv
23909 Do or don't use hardware floating-point divide and square root instructions.
23910 This requires the F or D extensions for floating-point registers. The default
23911 is to use them if the specified architecture has these instructions.
23912
23913 @item -mdiv
23914 @itemx -mno-div
23915 @opindex mdiv
23916 Do or don't use hardware instructions for integer division. This requires the
23917 M extension. The default is to use them if the specified architecture has
23918 these instructions.
23919
23920 @item -march=@var{ISA-string}
23921 @opindex march
23922 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23923 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23924 @samp{rv32imaf}.
23925
23926 @item -mtune=@var{processor-string}
23927 @opindex mtune
23928 Optimize the output for the given processor, specified by microarchitecture
23929 name. Permissible values for this option are: @samp{rocket},
23930 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23931 and @samp{size}.
23932
23933 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23934
23935 The @samp{size} choice is not intended for use by end-users. This is used
23936 when @option{-Os} is specified. It overrides the instruction cost info
23937 provided by @option{-mtune=}, but does not override the pipeline info. This
23938 helps reduce code size while still giving good performance.
23939
23940 @item -mpreferred-stack-boundary=@var{num}
23941 @opindex mpreferred-stack-boundary
23942 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23943 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23944 the default is 4 (16 bytes or 128-bits).
23945
23946 @strong{Warning:} If you use this switch, then you must build all modules with
23947 the same value, including any libraries. This includes the system libraries
23948 and startup modules.
23949
23950 @item -msmall-data-limit=@var{n}
23951 @opindex msmall-data-limit
23952 Put global and static data smaller than @var{n} bytes into a special section
23953 (on some targets).
23954
23955 @item -msave-restore
23956 @itemx -mno-save-restore
23957 @opindex msave-restore
23958 Do or don't use smaller but slower prologue and epilogue code that uses
23959 library function calls. The default is to use fast inline prologues and
23960 epilogues.
23961
23962 @item -mstrict-align
23963 @itemx -mno-strict-align
23964 @opindex mstrict-align
23965 Do not or do generate unaligned memory accesses. The default is set depending
23966 on whether the processor we are optimizing for supports fast unaligned access
23967 or not.
23968
23969 @item -mcmodel=medlow
23970 @opindex mcmodel=medlow
23971 Generate code for the medium-low code model. The program and its statically
23972 defined symbols must lie within a single 2 GiB address range and must lie
23973 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23974 statically or dynamically linked. This is the default code model.
23975
23976 @item -mcmodel=medany
23977 @opindex mcmodel=medany
23978 Generate code for the medium-any code model. The program and its statically
23979 defined symbols must be within any single 2 GiB address range. Programs can be
23980 statically or dynamically linked.
23981
23982 @item -mexplicit-relocs
23983 @itemx -mno-exlicit-relocs
23984 Use or do not use assembler relocation operators when dealing with symbolic
23985 addresses. The alternative is to use assembler macros instead, which may
23986 limit optimization.
23987
23988 @item -mrelax
23989 @itemx -mno-relax
23990 Take advantage of linker relaxations to reduce the number of instructions
23991 required to materialize symbol addresses. The default is to take advantage of
23992 linker relaxations.
23993
23994 @item -memit-attribute
23995 @itemx -mno-emit-attribute
23996 Emit (do not emit) RISC-V attribute to record extra information into ELF
23997 objects. This feature requires at least binutils 2.32.
23998 @end table
23999
24000 @node RL78 Options
24001 @subsection RL78 Options
24002 @cindex RL78 Options
24003
24004 @table @gcctabopt
24005
24006 @item -msim
24007 @opindex msim
24008 Links in additional target libraries to support operation within a
24009 simulator.
24010
24011 @item -mmul=none
24012 @itemx -mmul=g10
24013 @itemx -mmul=g13
24014 @itemx -mmul=g14
24015 @itemx -mmul=rl78
24016 @opindex mmul
24017 Specifies the type of hardware multiplication and division support to
24018 be used. The simplest is @code{none}, which uses software for both
24019 multiplication and division. This is the default. The @code{g13}
24020 value is for the hardware multiply/divide peripheral found on the
24021 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24022 the multiplication and division instructions supported by the RL78/G14
24023 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24024 the value @code{mg10} is an alias for @code{none}.
24025
24026 In addition a C preprocessor macro is defined, based upon the setting
24027 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24028 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24029
24030 @item -mcpu=g10
24031 @itemx -mcpu=g13
24032 @itemx -mcpu=g14
24033 @itemx -mcpu=rl78
24034 @opindex mcpu
24035 Specifies the RL78 core to target. The default is the G14 core, also
24036 known as an S3 core or just RL78. The G13 or S2 core does not have
24037 multiply or divide instructions, instead it uses a hardware peripheral
24038 for these operations. The G10 or S1 core does not have register
24039 banks, so it uses a different calling convention.
24040
24041 If this option is set it also selects the type of hardware multiply
24042 support to use, unless this is overridden by an explicit
24043 @option{-mmul=none} option on the command line. Thus specifying
24044 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24045 peripheral and specifying @option{-mcpu=g10} disables the use of
24046 hardware multiplications altogether.
24047
24048 Note, although the RL78/G14 core is the default target, specifying
24049 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24050 change the behavior of the toolchain since it also enables G14
24051 hardware multiply support. If these options are not specified on the
24052 command line then software multiplication routines will be used even
24053 though the code targets the RL78 core. This is for backwards
24054 compatibility with older toolchains which did not have hardware
24055 multiply and divide support.
24056
24057 In addition a C preprocessor macro is defined, based upon the setting
24058 of this option. Possible values are: @code{__RL78_G10__},
24059 @code{__RL78_G13__} or @code{__RL78_G14__}.
24060
24061 @item -mg10
24062 @itemx -mg13
24063 @itemx -mg14
24064 @itemx -mrl78
24065 @opindex mg10
24066 @opindex mg13
24067 @opindex mg14
24068 @opindex mrl78
24069 These are aliases for the corresponding @option{-mcpu=} option. They
24070 are provided for backwards compatibility.
24071
24072 @item -mallregs
24073 @opindex mallregs
24074 Allow the compiler to use all of the available registers. By default
24075 registers @code{r24..r31} are reserved for use in interrupt handlers.
24076 With this option enabled these registers can be used in ordinary
24077 functions as well.
24078
24079 @item -m64bit-doubles
24080 @itemx -m32bit-doubles
24081 @opindex m64bit-doubles
24082 @opindex m32bit-doubles
24083 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24084 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24085 @option{-m32bit-doubles}.
24086
24087 @item -msave-mduc-in-interrupts
24088 @itemx -mno-save-mduc-in-interrupts
24089 @opindex msave-mduc-in-interrupts
24090 @opindex mno-save-mduc-in-interrupts
24091 Specifies that interrupt handler functions should preserve the
24092 MDUC registers. This is only necessary if normal code might use
24093 the MDUC registers, for example because it performs multiplication
24094 and division operations. The default is to ignore the MDUC registers
24095 as this makes the interrupt handlers faster. The target option -mg13
24096 needs to be passed for this to work as this feature is only available
24097 on the G13 target (S2 core). The MDUC registers will only be saved
24098 if the interrupt handler performs a multiplication or division
24099 operation or it calls another function.
24100
24101 @end table
24102
24103 @node RS/6000 and PowerPC Options
24104 @subsection IBM RS/6000 and PowerPC Options
24105 @cindex RS/6000 and PowerPC Options
24106 @cindex IBM RS/6000 and PowerPC Options
24107
24108 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24109 @table @gcctabopt
24110 @item -mpowerpc-gpopt
24111 @itemx -mno-powerpc-gpopt
24112 @itemx -mpowerpc-gfxopt
24113 @itemx -mno-powerpc-gfxopt
24114 @need 800
24115 @itemx -mpowerpc64
24116 @itemx -mno-powerpc64
24117 @itemx -mmfcrf
24118 @itemx -mno-mfcrf
24119 @itemx -mpopcntb
24120 @itemx -mno-popcntb
24121 @itemx -mpopcntd
24122 @itemx -mno-popcntd
24123 @itemx -mfprnd
24124 @itemx -mno-fprnd
24125 @need 800
24126 @itemx -mcmpb
24127 @itemx -mno-cmpb
24128 @itemx -mhard-dfp
24129 @itemx -mno-hard-dfp
24130 @opindex mpowerpc-gpopt
24131 @opindex mno-powerpc-gpopt
24132 @opindex mpowerpc-gfxopt
24133 @opindex mno-powerpc-gfxopt
24134 @opindex mpowerpc64
24135 @opindex mno-powerpc64
24136 @opindex mmfcrf
24137 @opindex mno-mfcrf
24138 @opindex mpopcntb
24139 @opindex mno-popcntb
24140 @opindex mpopcntd
24141 @opindex mno-popcntd
24142 @opindex mfprnd
24143 @opindex mno-fprnd
24144 @opindex mcmpb
24145 @opindex mno-cmpb
24146 @opindex mhard-dfp
24147 @opindex mno-hard-dfp
24148 You use these options to specify which instructions are available on the
24149 processor you are using. The default value of these options is
24150 determined when configuring GCC@. Specifying the
24151 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24152 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24153 rather than the options listed above.
24154
24155 Specifying @option{-mpowerpc-gpopt} allows
24156 GCC to use the optional PowerPC architecture instructions in the
24157 General Purpose group, including floating-point square root. Specifying
24158 @option{-mpowerpc-gfxopt} allows GCC to
24159 use the optional PowerPC architecture instructions in the Graphics
24160 group, including floating-point select.
24161
24162 The @option{-mmfcrf} option allows GCC to generate the move from
24163 condition register field instruction implemented on the POWER4
24164 processor and other processors that support the PowerPC V2.01
24165 architecture.
24166 The @option{-mpopcntb} option allows GCC to generate the popcount and
24167 double-precision FP reciprocal estimate instruction implemented on the
24168 POWER5 processor and other processors that support the PowerPC V2.02
24169 architecture.
24170 The @option{-mpopcntd} option allows GCC to generate the popcount
24171 instruction implemented on the POWER7 processor and other processors
24172 that support the PowerPC V2.06 architecture.
24173 The @option{-mfprnd} option allows GCC to generate the FP round to
24174 integer instructions implemented on the POWER5+ processor and other
24175 processors that support the PowerPC V2.03 architecture.
24176 The @option{-mcmpb} option allows GCC to generate the compare bytes
24177 instruction implemented on the POWER6 processor and other processors
24178 that support the PowerPC V2.05 architecture.
24179 The @option{-mhard-dfp} option allows GCC to generate the decimal
24180 floating-point instructions implemented on some POWER processors.
24181
24182 The @option{-mpowerpc64} option allows GCC to generate the additional
24183 64-bit instructions that are found in the full PowerPC64 architecture
24184 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24185 @option{-mno-powerpc64}.
24186
24187 @item -mcpu=@var{cpu_type}
24188 @opindex mcpu
24189 Set architecture type, register usage, and
24190 instruction scheduling parameters for machine type @var{cpu_type}.
24191 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24192 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24193 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24194 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24195 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24196 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24197 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24198 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24199 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24200 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24201 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24202 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24203
24204 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24205 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24206 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24207 architecture machine types, with an appropriate, generic processor
24208 model assumed for scheduling purposes.
24209
24210 Specifying @samp{native} as cpu type detects and selects the
24211 architecture option that corresponds to the host processor of the
24212 system performing the compilation.
24213 @option{-mcpu=native} has no effect if GCC does not recognize the
24214 processor.
24215
24216 The other options specify a specific processor. Code generated under
24217 those options runs best on that processor, and may not run at all on
24218 others.
24219
24220 The @option{-mcpu} options automatically enable or disable the
24221 following options:
24222
24223 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24224 -mpopcntb -mpopcntd -mpowerpc64 @gol
24225 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24226 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24227 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24228 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24229
24230 The particular options set for any particular CPU varies between
24231 compiler versions, depending on what setting seems to produce optimal
24232 code for that CPU; it doesn't necessarily reflect the actual hardware's
24233 capabilities. If you wish to set an individual option to a particular
24234 value, you may specify it after the @option{-mcpu} option, like
24235 @option{-mcpu=970 -mno-altivec}.
24236
24237 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24238 not enabled or disabled by the @option{-mcpu} option at present because
24239 AIX does not have full support for these options. You may still
24240 enable or disable them individually if you're sure it'll work in your
24241 environment.
24242
24243 @item -mtune=@var{cpu_type}
24244 @opindex mtune
24245 Set the instruction scheduling parameters for machine type
24246 @var{cpu_type}, but do not set the architecture type or register usage,
24247 as @option{-mcpu=@var{cpu_type}} does. The same
24248 values for @var{cpu_type} are used for @option{-mtune} as for
24249 @option{-mcpu}. If both are specified, the code generated uses the
24250 architecture and registers set by @option{-mcpu}, but the
24251 scheduling parameters set by @option{-mtune}.
24252
24253 @item -mcmodel=small
24254 @opindex mcmodel=small
24255 Generate PowerPC64 code for the small model: The TOC is limited to
24256 64k.
24257
24258 @item -mcmodel=medium
24259 @opindex mcmodel=medium
24260 Generate PowerPC64 code for the medium model: The TOC and other static
24261 data may be up to a total of 4G in size. This is the default for 64-bit
24262 Linux.
24263
24264 @item -mcmodel=large
24265 @opindex mcmodel=large
24266 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24267 in size. Other data and code is only limited by the 64-bit address
24268 space.
24269
24270 @item -maltivec
24271 @itemx -mno-altivec
24272 @opindex maltivec
24273 @opindex mno-altivec
24274 Generate code that uses (does not use) AltiVec instructions, and also
24275 enable the use of built-in functions that allow more direct access to
24276 the AltiVec instruction set. You may also need to set
24277 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24278 enhancements.
24279
24280 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24281 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24282 match array element order corresponding to the endianness of the
24283 target. That is, element zero identifies the leftmost element in a
24284 vector register when targeting a big-endian platform, and identifies
24285 the rightmost element in a vector register when targeting a
24286 little-endian platform.
24287
24288 @item -mvrsave
24289 @itemx -mno-vrsave
24290 @opindex mvrsave
24291 @opindex mno-vrsave
24292 Generate VRSAVE instructions when generating AltiVec code.
24293
24294 @item -msecure-plt
24295 @opindex msecure-plt
24296 Generate code that allows @command{ld} and @command{ld.so}
24297 to build executables and shared
24298 libraries with non-executable @code{.plt} and @code{.got} sections.
24299 This is a PowerPC
24300 32-bit SYSV ABI option.
24301
24302 @item -mbss-plt
24303 @opindex mbss-plt
24304 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24305 fills in, and
24306 requires @code{.plt} and @code{.got}
24307 sections that are both writable and executable.
24308 This is a PowerPC 32-bit SYSV ABI option.
24309
24310 @item -misel
24311 @itemx -mno-isel
24312 @opindex misel
24313 @opindex mno-isel
24314 This switch enables or disables the generation of ISEL instructions.
24315
24316 @item -mvsx
24317 @itemx -mno-vsx
24318 @opindex mvsx
24319 @opindex mno-vsx
24320 Generate code that uses (does not use) vector/scalar (VSX)
24321 instructions, and also enable the use of built-in functions that allow
24322 more direct access to the VSX instruction set.
24323
24324 @item -mcrypto
24325 @itemx -mno-crypto
24326 @opindex mcrypto
24327 @opindex mno-crypto
24328 Enable the use (disable) of the built-in functions that allow direct
24329 access to the cryptographic instructions that were added in version
24330 2.07 of the PowerPC ISA.
24331
24332 @item -mhtm
24333 @itemx -mno-htm
24334 @opindex mhtm
24335 @opindex mno-htm
24336 Enable (disable) the use of the built-in functions that allow direct
24337 access to the Hardware Transactional Memory (HTM) instructions that
24338 were added in version 2.07 of the PowerPC ISA.
24339
24340 @item -mpower8-fusion
24341 @itemx -mno-power8-fusion
24342 @opindex mpower8-fusion
24343 @opindex mno-power8-fusion
24344 Generate code that keeps (does not keeps) some integer operations
24345 adjacent so that the instructions can be fused together on power8 and
24346 later processors.
24347
24348 @item -mpower8-vector
24349 @itemx -mno-power8-vector
24350 @opindex mpower8-vector
24351 @opindex mno-power8-vector
24352 Generate code that uses (does not use) the vector and scalar
24353 instructions that were added in version 2.07 of the PowerPC ISA. Also
24354 enable the use of built-in functions that allow more direct access to
24355 the vector instructions.
24356
24357 @item -mquad-memory
24358 @itemx -mno-quad-memory
24359 @opindex mquad-memory
24360 @opindex mno-quad-memory
24361 Generate code that uses (does not use) the non-atomic quad word memory
24362 instructions. The @option{-mquad-memory} option requires use of
24363 64-bit mode.
24364
24365 @item -mquad-memory-atomic
24366 @itemx -mno-quad-memory-atomic
24367 @opindex mquad-memory-atomic
24368 @opindex mno-quad-memory-atomic
24369 Generate code that uses (does not use) the atomic quad word memory
24370 instructions. The @option{-mquad-memory-atomic} option requires use of
24371 64-bit mode.
24372
24373 @item -mfloat128
24374 @itemx -mno-float128
24375 @opindex mfloat128
24376 @opindex mno-float128
24377 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24378 and use either software emulation for IEEE 128-bit floating point or
24379 hardware instructions.
24380
24381 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24382 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24383 use the IEEE 128-bit floating point support. The IEEE 128-bit
24384 floating point support only works on PowerPC Linux systems.
24385
24386 The default for @option{-mfloat128} is enabled on PowerPC Linux
24387 systems using the VSX instruction set, and disabled on other systems.
24388
24389 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24390 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24391 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24392 floating point instructions. Otherwise, if you do not specify to
24393 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24394 system, IEEE 128-bit floating point will be done with software
24395 emulation.
24396
24397 @item -mfloat128-hardware
24398 @itemx -mno-float128-hardware
24399 @opindex mfloat128-hardware
24400 @opindex mno-float128-hardware
24401 Enable/disable using ISA 3.0 hardware instructions to support the
24402 @var{__float128} data type.
24403
24404 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24405 Linux systems using the ISA 3.0 instruction set, and disabled on other
24406 systems.
24407
24408 @item -m32
24409 @itemx -m64
24410 @opindex m32
24411 @opindex m64
24412 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24413 targets (including GNU/Linux). The 32-bit environment sets int, long
24414 and pointer to 32 bits and generates code that runs on any PowerPC
24415 variant. The 64-bit environment sets int to 32 bits and long and
24416 pointer to 64 bits, and generates code for PowerPC64, as for
24417 @option{-mpowerpc64}.
24418
24419 @item -mfull-toc
24420 @itemx -mno-fp-in-toc
24421 @itemx -mno-sum-in-toc
24422 @itemx -mminimal-toc
24423 @opindex mfull-toc
24424 @opindex mno-fp-in-toc
24425 @opindex mno-sum-in-toc
24426 @opindex mminimal-toc
24427 Modify generation of the TOC (Table Of Contents), which is created for
24428 every executable file. The @option{-mfull-toc} option is selected by
24429 default. In that case, GCC allocates at least one TOC entry for
24430 each unique non-automatic variable reference in your program. GCC
24431 also places floating-point constants in the TOC@. However, only
24432 16,384 entries are available in the TOC@.
24433
24434 If you receive a linker error message that saying you have overflowed
24435 the available TOC space, you can reduce the amount of TOC space used
24436 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24437 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24438 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24439 generate code to calculate the sum of an address and a constant at
24440 run time instead of putting that sum into the TOC@. You may specify one
24441 or both of these options. Each causes GCC to produce very slightly
24442 slower and larger code at the expense of conserving TOC space.
24443
24444 If you still run out of space in the TOC even when you specify both of
24445 these options, specify @option{-mminimal-toc} instead. This option causes
24446 GCC to make only one TOC entry for every file. When you specify this
24447 option, GCC produces code that is slower and larger but which
24448 uses extremely little TOC space. You may wish to use this option
24449 only on files that contain less frequently-executed code.
24450
24451 @item -maix64
24452 @itemx -maix32
24453 @opindex maix64
24454 @opindex maix32
24455 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24456 @code{long} type, and the infrastructure needed to support them.
24457 Specifying @option{-maix64} implies @option{-mpowerpc64},
24458 while @option{-maix32} disables the 64-bit ABI and
24459 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24460
24461 @item -mxl-compat
24462 @itemx -mno-xl-compat
24463 @opindex mxl-compat
24464 @opindex mno-xl-compat
24465 Produce code that conforms more closely to IBM XL compiler semantics
24466 when using AIX-compatible ABI@. Pass floating-point arguments to
24467 prototyped functions beyond the register save area (RSA) on the stack
24468 in addition to argument FPRs. Do not assume that most significant
24469 double in 128-bit long double value is properly rounded when comparing
24470 values and converting to double. Use XL symbol names for long double
24471 support routines.
24472
24473 The AIX calling convention was extended but not initially documented to
24474 handle an obscure K&R C case of calling a function that takes the
24475 address of its arguments with fewer arguments than declared. IBM XL
24476 compilers access floating-point arguments that do not fit in the
24477 RSA from the stack when a subroutine is compiled without
24478 optimization. Because always storing floating-point arguments on the
24479 stack is inefficient and rarely needed, this option is not enabled by
24480 default and only is necessary when calling subroutines compiled by IBM
24481 XL compilers without optimization.
24482
24483 @item -mpe
24484 @opindex mpe
24485 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24486 application written to use message passing with special startup code to
24487 enable the application to run. The system must have PE installed in the
24488 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24489 must be overridden with the @option{-specs=} option to specify the
24490 appropriate directory location. The Parallel Environment does not
24491 support threads, so the @option{-mpe} option and the @option{-pthread}
24492 option are incompatible.
24493
24494 @item -malign-natural
24495 @itemx -malign-power
24496 @opindex malign-natural
24497 @opindex malign-power
24498 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24499 @option{-malign-natural} overrides the ABI-defined alignment of larger
24500 types, such as floating-point doubles, on their natural size-based boundary.
24501 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24502 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24503
24504 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24505 is not supported.
24506
24507 @item -msoft-float
24508 @itemx -mhard-float
24509 @opindex msoft-float
24510 @opindex mhard-float
24511 Generate code that does not use (uses) the floating-point register set.
24512 Software floating-point emulation is provided if you use the
24513 @option{-msoft-float} option, and pass the option to GCC when linking.
24514
24515 @item -mmultiple
24516 @itemx -mno-multiple
24517 @opindex mmultiple
24518 @opindex mno-multiple
24519 Generate code that uses (does not use) the load multiple word
24520 instructions and the store multiple word instructions. These
24521 instructions are generated by default on POWER systems, and not
24522 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24523 PowerPC systems, since those instructions do not work when the
24524 processor is in little-endian mode. The exceptions are PPC740 and
24525 PPC750 which permit these instructions in little-endian mode.
24526
24527 @item -mupdate
24528 @itemx -mno-update
24529 @opindex mupdate
24530 @opindex mno-update
24531 Generate code that uses (does not use) the load or store instructions
24532 that update the base register to the address of the calculated memory
24533 location. These instructions are generated by default. If you use
24534 @option{-mno-update}, there is a small window between the time that the
24535 stack pointer is updated and the address of the previous frame is
24536 stored, which means code that walks the stack frame across interrupts or
24537 signals may get corrupted data.
24538
24539 @item -mavoid-indexed-addresses
24540 @itemx -mno-avoid-indexed-addresses
24541 @opindex mavoid-indexed-addresses
24542 @opindex mno-avoid-indexed-addresses
24543 Generate code that tries to avoid (not avoid) the use of indexed load
24544 or store instructions. These instructions can incur a performance
24545 penalty on Power6 processors in certain situations, such as when
24546 stepping through large arrays that cross a 16M boundary. This option
24547 is enabled by default when targeting Power6 and disabled otherwise.
24548
24549 @item -mfused-madd
24550 @itemx -mno-fused-madd
24551 @opindex mfused-madd
24552 @opindex mno-fused-madd
24553 Generate code that uses (does not use) the floating-point multiply and
24554 accumulate instructions. These instructions are generated by default
24555 if hardware floating point is used. The machine-dependent
24556 @option{-mfused-madd} option is now mapped to the machine-independent
24557 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24558 mapped to @option{-ffp-contract=off}.
24559
24560 @item -mmulhw
24561 @itemx -mno-mulhw
24562 @opindex mmulhw
24563 @opindex mno-mulhw
24564 Generate code that uses (does not use) the half-word multiply and
24565 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24566 These instructions are generated by default when targeting those
24567 processors.
24568
24569 @item -mdlmzb
24570 @itemx -mno-dlmzb
24571 @opindex mdlmzb
24572 @opindex mno-dlmzb
24573 Generate code that uses (does not use) the string-search @samp{dlmzb}
24574 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24575 generated by default when targeting those processors.
24576
24577 @item -mno-bit-align
24578 @itemx -mbit-align
24579 @opindex mno-bit-align
24580 @opindex mbit-align
24581 On System V.4 and embedded PowerPC systems do not (do) force structures
24582 and unions that contain bit-fields to be aligned to the base type of the
24583 bit-field.
24584
24585 For example, by default a structure containing nothing but 8
24586 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24587 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24588 the structure is aligned to a 1-byte boundary and is 1 byte in
24589 size.
24590
24591 @item -mno-strict-align
24592 @itemx -mstrict-align
24593 @opindex mno-strict-align
24594 @opindex mstrict-align
24595 On System V.4 and embedded PowerPC systems do not (do) assume that
24596 unaligned memory references are handled by the system.
24597
24598 @item -mrelocatable
24599 @itemx -mno-relocatable
24600 @opindex mrelocatable
24601 @opindex mno-relocatable
24602 Generate code that allows (does not allow) a static executable to be
24603 relocated to a different address at run time. A simple embedded
24604 PowerPC system loader should relocate the entire contents of
24605 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24606 a table of 32-bit addresses generated by this option. For this to
24607 work, all objects linked together must be compiled with
24608 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24609 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24610
24611 @item -mrelocatable-lib
24612 @itemx -mno-relocatable-lib
24613 @opindex mrelocatable-lib
24614 @opindex mno-relocatable-lib
24615 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24616 @code{.fixup} section to allow static executables to be relocated at
24617 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24618 alignment of @option{-mrelocatable}. Objects compiled with
24619 @option{-mrelocatable-lib} may be linked with objects compiled with
24620 any combination of the @option{-mrelocatable} options.
24621
24622 @item -mno-toc
24623 @itemx -mtoc
24624 @opindex mno-toc
24625 @opindex mtoc
24626 On System V.4 and embedded PowerPC systems do not (do) assume that
24627 register 2 contains a pointer to a global area pointing to the addresses
24628 used in the program.
24629
24630 @item -mlittle
24631 @itemx -mlittle-endian
24632 @opindex mlittle
24633 @opindex mlittle-endian
24634 On System V.4 and embedded PowerPC systems compile code for the
24635 processor in little-endian mode. The @option{-mlittle-endian} option is
24636 the same as @option{-mlittle}.
24637
24638 @item -mbig
24639 @itemx -mbig-endian
24640 @opindex mbig
24641 @opindex mbig-endian
24642 On System V.4 and embedded PowerPC systems compile code for the
24643 processor in big-endian mode. The @option{-mbig-endian} option is
24644 the same as @option{-mbig}.
24645
24646 @item -mdynamic-no-pic
24647 @opindex mdynamic-no-pic
24648 On Darwin and Mac OS X systems, compile code so that it is not
24649 relocatable, but that its external references are relocatable. The
24650 resulting code is suitable for applications, but not shared
24651 libraries.
24652
24653 @item -msingle-pic-base
24654 @opindex msingle-pic-base
24655 Treat the register used for PIC addressing as read-only, rather than
24656 loading it in the prologue for each function. The runtime system is
24657 responsible for initializing this register with an appropriate value
24658 before execution begins.
24659
24660 @item -mprioritize-restricted-insns=@var{priority}
24661 @opindex mprioritize-restricted-insns
24662 This option controls the priority that is assigned to
24663 dispatch-slot restricted instructions during the second scheduling
24664 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24665 or @samp{2} to assign no, highest, or second-highest (respectively)
24666 priority to dispatch-slot restricted
24667 instructions.
24668
24669 @item -msched-costly-dep=@var{dependence_type}
24670 @opindex msched-costly-dep
24671 This option controls which dependences are considered costly
24672 by the target during instruction scheduling. The argument
24673 @var{dependence_type} takes one of the following values:
24674
24675 @table @asis
24676 @item @samp{no}
24677 No dependence is costly.
24678
24679 @item @samp{all}
24680 All dependences are costly.
24681
24682 @item @samp{true_store_to_load}
24683 A true dependence from store to load is costly.
24684
24685 @item @samp{store_to_load}
24686 Any dependence from store to load is costly.
24687
24688 @item @var{number}
24689 Any dependence for which the latency is greater than or equal to
24690 @var{number} is costly.
24691 @end table
24692
24693 @item -minsert-sched-nops=@var{scheme}
24694 @opindex minsert-sched-nops
24695 This option controls which NOP insertion scheme is used during
24696 the second scheduling pass. The argument @var{scheme} takes one of the
24697 following values:
24698
24699 @table @asis
24700 @item @samp{no}
24701 Don't insert NOPs.
24702
24703 @item @samp{pad}
24704 Pad with NOPs any dispatch group that has vacant issue slots,
24705 according to the scheduler's grouping.
24706
24707 @item @samp{regroup_exact}
24708 Insert NOPs to force costly dependent insns into
24709 separate groups. Insert exactly as many NOPs as needed to force an insn
24710 to a new group, according to the estimated processor grouping.
24711
24712 @item @var{number}
24713 Insert NOPs to force costly dependent insns into
24714 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24715 @end table
24716
24717 @item -mcall-sysv
24718 @opindex mcall-sysv
24719 On System V.4 and embedded PowerPC systems compile code using calling
24720 conventions that adhere to the March 1995 draft of the System V
24721 Application Binary Interface, PowerPC processor supplement. This is the
24722 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24723
24724 @item -mcall-sysv-eabi
24725 @itemx -mcall-eabi
24726 @opindex mcall-sysv-eabi
24727 @opindex mcall-eabi
24728 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24729
24730 @item -mcall-sysv-noeabi
24731 @opindex mcall-sysv-noeabi
24732 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24733
24734 @item -mcall-aixdesc
24735 @opindex m
24736 On System V.4 and embedded PowerPC systems compile code for the AIX
24737 operating system.
24738
24739 @item -mcall-linux
24740 @opindex mcall-linux
24741 On System V.4 and embedded PowerPC systems compile code for the
24742 Linux-based GNU system.
24743
24744 @item -mcall-freebsd
24745 @opindex mcall-freebsd
24746 On System V.4 and embedded PowerPC systems compile code for the
24747 FreeBSD operating system.
24748
24749 @item -mcall-netbsd
24750 @opindex mcall-netbsd
24751 On System V.4 and embedded PowerPC systems compile code for the
24752 NetBSD operating system.
24753
24754 @item -mcall-openbsd
24755 @opindex mcall-netbsd
24756 On System V.4 and embedded PowerPC systems compile code for the
24757 OpenBSD operating system.
24758
24759 @item -mtraceback=@var{traceback_type}
24760 @opindex mtraceback
24761 Select the type of traceback table. Valid values for @var{traceback_type}
24762 are @samp{full}, @samp{part}, and @samp{no}.
24763
24764 @item -maix-struct-return
24765 @opindex maix-struct-return
24766 Return all structures in memory (as specified by the AIX ABI)@.
24767
24768 @item -msvr4-struct-return
24769 @opindex msvr4-struct-return
24770 Return structures smaller than 8 bytes in registers (as specified by the
24771 SVR4 ABI)@.
24772
24773 @item -mabi=@var{abi-type}
24774 @opindex mabi
24775 Extend the current ABI with a particular extension, or remove such extension.
24776 Valid values are @samp{altivec}, @samp{no-altivec},
24777 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24778 @samp{elfv1}, @samp{elfv2}@.
24779
24780 @item -mabi=ibmlongdouble
24781 @opindex mabi=ibmlongdouble
24782 Change the current ABI to use IBM extended-precision long double.
24783 This is not likely to work if your system defaults to using IEEE
24784 extended-precision long double. If you change the long double type
24785 from IEEE extended-precision, the compiler will issue a warning unless
24786 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24787 to be enabled.
24788
24789 @item -mabi=ieeelongdouble
24790 @opindex mabi=ieeelongdouble
24791 Change the current ABI to use IEEE extended-precision long double.
24792 This is not likely to work if your system defaults to using IBM
24793 extended-precision long double. If you change the long double type
24794 from IBM extended-precision, the compiler will issue a warning unless
24795 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24796 to be enabled.
24797
24798 @item -mabi=elfv1
24799 @opindex mabi=elfv1
24800 Change the current ABI to use the ELFv1 ABI.
24801 This is the default ABI for big-endian PowerPC 64-bit Linux.
24802 Overriding the default ABI requires special system support and is
24803 likely to fail in spectacular ways.
24804
24805 @item -mabi=elfv2
24806 @opindex mabi=elfv2
24807 Change the current ABI to use the ELFv2 ABI.
24808 This is the default ABI for little-endian PowerPC 64-bit Linux.
24809 Overriding the default ABI requires special system support and is
24810 likely to fail in spectacular ways.
24811
24812 @item -mgnu-attribute
24813 @itemx -mno-gnu-attribute
24814 @opindex mgnu-attribute
24815 @opindex mno-gnu-attribute
24816 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24817 .gnu.attributes section that specify ABI variations in function
24818 parameters or return values.
24819
24820 @item -mprototype
24821 @itemx -mno-prototype
24822 @opindex mprototype
24823 @opindex mno-prototype
24824 On System V.4 and embedded PowerPC systems assume that all calls to
24825 variable argument functions are properly prototyped. Otherwise, the
24826 compiler must insert an instruction before every non-prototyped call to
24827 set or clear bit 6 of the condition code register (@code{CR}) to
24828 indicate whether floating-point values are passed in the floating-point
24829 registers in case the function takes variable arguments. With
24830 @option{-mprototype}, only calls to prototyped variable argument functions
24831 set or clear the bit.
24832
24833 @item -msim
24834 @opindex msim
24835 On embedded PowerPC systems, assume that the startup module is called
24836 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24837 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24838 configurations.
24839
24840 @item -mmvme
24841 @opindex mmvme
24842 On embedded PowerPC systems, assume that the startup module is called
24843 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24844 @file{libc.a}.
24845
24846 @item -mads
24847 @opindex mads
24848 On embedded PowerPC systems, assume that the startup module is called
24849 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24850 @file{libc.a}.
24851
24852 @item -myellowknife
24853 @opindex myellowknife
24854 On embedded PowerPC systems, assume that the startup module is called
24855 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24856 @file{libc.a}.
24857
24858 @item -mvxworks
24859 @opindex mvxworks
24860 On System V.4 and embedded PowerPC systems, specify that you are
24861 compiling for a VxWorks system.
24862
24863 @item -memb
24864 @opindex memb
24865 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24866 header to indicate that @samp{eabi} extended relocations are used.
24867
24868 @item -meabi
24869 @itemx -mno-eabi
24870 @opindex meabi
24871 @opindex mno-eabi
24872 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24873 Embedded Applications Binary Interface (EABI), which is a set of
24874 modifications to the System V.4 specifications. Selecting @option{-meabi}
24875 means that the stack is aligned to an 8-byte boundary, a function
24876 @code{__eabi} is called from @code{main} to set up the EABI
24877 environment, and the @option{-msdata} option can use both @code{r2} and
24878 @code{r13} to point to two separate small data areas. Selecting
24879 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24880 no EABI initialization function is called from @code{main}, and the
24881 @option{-msdata} option only uses @code{r13} to point to a single
24882 small data area. The @option{-meabi} option is on by default if you
24883 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24884
24885 @item -msdata=eabi
24886 @opindex msdata=eabi
24887 On System V.4 and embedded PowerPC systems, put small initialized
24888 @code{const} global and static data in the @code{.sdata2} section, which
24889 is pointed to by register @code{r2}. Put small initialized
24890 non-@code{const} global and static data in the @code{.sdata} section,
24891 which is pointed to by register @code{r13}. Put small uninitialized
24892 global and static data in the @code{.sbss} section, which is adjacent to
24893 the @code{.sdata} section. The @option{-msdata=eabi} option is
24894 incompatible with the @option{-mrelocatable} option. The
24895 @option{-msdata=eabi} option also sets the @option{-memb} option.
24896
24897 @item -msdata=sysv
24898 @opindex msdata=sysv
24899 On System V.4 and embedded PowerPC systems, put small global and static
24900 data in the @code{.sdata} section, which is pointed to by register
24901 @code{r13}. Put small uninitialized global and static data in the
24902 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24903 The @option{-msdata=sysv} option is incompatible with the
24904 @option{-mrelocatable} option.
24905
24906 @item -msdata=default
24907 @itemx -msdata
24908 @opindex msdata=default
24909 @opindex msdata
24910 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24911 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24912 same as @option{-msdata=sysv}.
24913
24914 @item -msdata=data
24915 @opindex msdata=data
24916 On System V.4 and embedded PowerPC systems, put small global
24917 data in the @code{.sdata} section. Put small uninitialized global
24918 data in the @code{.sbss} section. Do not use register @code{r13}
24919 to address small data however. This is the default behavior unless
24920 other @option{-msdata} options are used.
24921
24922 @item -msdata=none
24923 @itemx -mno-sdata
24924 @opindex msdata=none
24925 @opindex mno-sdata
24926 On embedded PowerPC systems, put all initialized global and static data
24927 in the @code{.data} section, and all uninitialized data in the
24928 @code{.bss} section.
24929
24930 @item -mreadonly-in-sdata
24931 @opindex mreadonly-in-sdata
24932 @opindex mno-readonly-in-sdata
24933 Put read-only objects in the @code{.sdata} section as well. This is the
24934 default.
24935
24936 @item -mblock-move-inline-limit=@var{num}
24937 @opindex mblock-move-inline-limit
24938 Inline all block moves (such as calls to @code{memcpy} or structure
24939 copies) less than or equal to @var{num} bytes. The minimum value for
24940 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24941 targets. The default value is target-specific.
24942
24943 @item -mblock-compare-inline-limit=@var{num}
24944 @opindex mblock-compare-inline-limit
24945 Generate non-looping inline code for all block compares (such as calls
24946 to @code{memcmp} or structure compares) less than or equal to @var{num}
24947 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24948 block compare is disabled. The default value is target-specific.
24949
24950 @item -mblock-compare-inline-loop-limit=@var{num}
24951 @opindex mblock-compare-inline-loop-limit
24952 Generate an inline expansion using loop code for all block compares that
24953 are less than or equal to @var{num} bytes, but greater than the limit
24954 for non-loop inline block compare expansion. If the block length is not
24955 constant, at most @var{num} bytes will be compared before @code{memcmp}
24956 is called to compare the remainder of the block. The default value is
24957 target-specific.
24958
24959 @item -mstring-compare-inline-limit=@var{num}
24960 @opindex mstring-compare-inline-limit
24961 Compare at most @var{num} string bytes with inline code.
24962 If the difference or end of string is not found at the
24963 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24964 take care of the rest of the comparison. The default is 64 bytes.
24965
24966 @item -G @var{num}
24967 @opindex G
24968 @cindex smaller data references (PowerPC)
24969 @cindex .sdata/.sdata2 references (PowerPC)
24970 On embedded PowerPC systems, put global and static items less than or
24971 equal to @var{num} bytes into the small data or BSS sections instead of
24972 the normal data or BSS section. By default, @var{num} is 8. The
24973 @option{-G @var{num}} switch is also passed to the linker.
24974 All modules should be compiled with the same @option{-G @var{num}} value.
24975
24976 @item -mregnames
24977 @itemx -mno-regnames
24978 @opindex mregnames
24979 @opindex mno-regnames
24980 On System V.4 and embedded PowerPC systems do (do not) emit register
24981 names in the assembly language output using symbolic forms.
24982
24983 @item -mlongcall
24984 @itemx -mno-longcall
24985 @opindex mlongcall
24986 @opindex mno-longcall
24987 By default assume that all calls are far away so that a longer and more
24988 expensive calling sequence is required. This is required for calls
24989 farther than 32 megabytes (33,554,432 bytes) from the current location.
24990 A short call is generated if the compiler knows
24991 the call cannot be that far away. This setting can be overridden by
24992 the @code{shortcall} function attribute, or by @code{#pragma
24993 longcall(0)}.
24994
24995 Some linkers are capable of detecting out-of-range calls and generating
24996 glue code on the fly. On these systems, long calls are unnecessary and
24997 generate slower code. As of this writing, the AIX linker can do this,
24998 as can the GNU linker for PowerPC/64. It is planned to add this feature
24999 to the GNU linker for 32-bit PowerPC systems as well.
25000
25001 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25002 GCC can generate long calls using an inline PLT call sequence (see
25003 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25004 ELFv1 (big-endian) do not support inline PLT calls.
25005
25006 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25007 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25008 addresses represent the callee and the branch island. The
25009 Darwin/PPC linker prefers the first address and generates a @code{bl
25010 callee} if the PPC @code{bl} instruction reaches the callee directly;
25011 otherwise, the linker generates @code{bl L42} to call the branch
25012 island. The branch island is appended to the body of the
25013 calling function; it computes the full 32-bit address of the callee
25014 and jumps to it.
25015
25016 On Mach-O (Darwin) systems, this option directs the compiler emit to
25017 the glue for every direct call, and the Darwin linker decides whether
25018 to use or discard it.
25019
25020 In the future, GCC may ignore all longcall specifications
25021 when the linker is known to generate glue.
25022
25023 @item -mpltseq
25024 @itemx -mno-pltseq
25025 @opindex mpltseq
25026 @opindex mno-pltseq
25027 Implement (do not implement) -fno-plt and long calls using an inline
25028 PLT call sequence that supports lazy linking and long calls to
25029 functions in dlopen'd shared libraries. Inline PLT calls are only
25030 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25031 linkers, and are enabled by default if the support is detected when
25032 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25033 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25034 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25035 linked together.
25036
25037 @item -mtls-markers
25038 @itemx -mno-tls-markers
25039 @opindex mtls-markers
25040 @opindex mno-tls-markers
25041 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25042 specifying the function argument. The relocation allows the linker to
25043 reliably associate function call with argument setup instructions for
25044 TLS optimization, which in turn allows GCC to better schedule the
25045 sequence.
25046
25047 @item -mrecip
25048 @itemx -mno-recip
25049 @opindex mrecip
25050 This option enables use of the reciprocal estimate and
25051 reciprocal square root estimate instructions with additional
25052 Newton-Raphson steps to increase precision instead of doing a divide or
25053 square root and divide for floating-point arguments. You should use
25054 the @option{-ffast-math} option when using @option{-mrecip} (or at
25055 least @option{-funsafe-math-optimizations},
25056 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25057 @option{-fno-trapping-math}). Note that while the throughput of the
25058 sequence is generally higher than the throughput of the non-reciprocal
25059 instruction, the precision of the sequence can be decreased by up to 2
25060 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25061 roots.
25062
25063 @item -mrecip=@var{opt}
25064 @opindex mrecip=opt
25065 This option controls which reciprocal estimate instructions
25066 may be used. @var{opt} is a comma-separated list of options, which may
25067 be preceded by a @code{!} to invert the option:
25068
25069 @table @samp
25070
25071 @item all
25072 Enable all estimate instructions.
25073
25074 @item default
25075 Enable the default instructions, equivalent to @option{-mrecip}.
25076
25077 @item none
25078 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25079
25080 @item div
25081 Enable the reciprocal approximation instructions for both
25082 single and double precision.
25083
25084 @item divf
25085 Enable the single-precision reciprocal approximation instructions.
25086
25087 @item divd
25088 Enable the double-precision reciprocal approximation instructions.
25089
25090 @item rsqrt
25091 Enable the reciprocal square root approximation instructions for both
25092 single and double precision.
25093
25094 @item rsqrtf
25095 Enable the single-precision reciprocal square root approximation instructions.
25096
25097 @item rsqrtd
25098 Enable the double-precision reciprocal square root approximation instructions.
25099
25100 @end table
25101
25102 So, for example, @option{-mrecip=all,!rsqrtd} enables
25103 all of the reciprocal estimate instructions, except for the
25104 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25105 which handle the double-precision reciprocal square root calculations.
25106
25107 @item -mrecip-precision
25108 @itemx -mno-recip-precision
25109 @opindex mrecip-precision
25110 Assume (do not assume) that the reciprocal estimate instructions
25111 provide higher-precision estimates than is mandated by the PowerPC
25112 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25113 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25114 The double-precision square root estimate instructions are not generated by
25115 default on low-precision machines, since they do not provide an
25116 estimate that converges after three steps.
25117
25118 @item -mveclibabi=@var{type}
25119 @opindex mveclibabi
25120 Specifies the ABI type to use for vectorizing intrinsics using an
25121 external library. The only type supported at present is @samp{mass},
25122 which specifies to use IBM's Mathematical Acceleration Subsystem
25123 (MASS) libraries for vectorizing intrinsics using external libraries.
25124 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25125 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25126 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25127 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25128 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25129 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25130 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25131 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25132 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25133 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25134 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25135 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25136 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25137 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25138 for power7. Both @option{-ftree-vectorize} and
25139 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25140 libraries must be specified at link time.
25141
25142 @item -mfriz
25143 @itemx -mno-friz
25144 @opindex mfriz
25145 Generate (do not generate) the @code{friz} instruction when the
25146 @option{-funsafe-math-optimizations} option is used to optimize
25147 rounding of floating-point values to 64-bit integer and back to floating
25148 point. The @code{friz} instruction does not return the same value if
25149 the floating-point number is too large to fit in an integer.
25150
25151 @item -mpointers-to-nested-functions
25152 @itemx -mno-pointers-to-nested-functions
25153 @opindex mpointers-to-nested-functions
25154 Generate (do not generate) code to load up the static chain register
25155 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25156 systems where a function pointer points to a 3-word descriptor giving
25157 the function address, TOC value to be loaded in register @code{r2}, and
25158 static chain value to be loaded in register @code{r11}. The
25159 @option{-mpointers-to-nested-functions} is on by default. You cannot
25160 call through pointers to nested functions or pointers
25161 to functions compiled in other languages that use the static chain if
25162 you use @option{-mno-pointers-to-nested-functions}.
25163
25164 @item -msave-toc-indirect
25165 @itemx -mno-save-toc-indirect
25166 @opindex msave-toc-indirect
25167 Generate (do not generate) code to save the TOC value in the reserved
25168 stack location in the function prologue if the function calls through
25169 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25170 saved in the prologue, it is saved just before the call through the
25171 pointer. The @option{-mno-save-toc-indirect} option is the default.
25172
25173 @item -mcompat-align-parm
25174 @itemx -mno-compat-align-parm
25175 @opindex mcompat-align-parm
25176 Generate (do not generate) code to pass structure parameters with a
25177 maximum alignment of 64 bits, for compatibility with older versions
25178 of GCC.
25179
25180 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25181 structure parameter on a 128-bit boundary when that structure contained
25182 a member requiring 128-bit alignment. This is corrected in more
25183 recent versions of GCC. This option may be used to generate code
25184 that is compatible with functions compiled with older versions of
25185 GCC.
25186
25187 The @option{-mno-compat-align-parm} option is the default.
25188
25189 @item -mstack-protector-guard=@var{guard}
25190 @itemx -mstack-protector-guard-reg=@var{reg}
25191 @itemx -mstack-protector-guard-offset=@var{offset}
25192 @itemx -mstack-protector-guard-symbol=@var{symbol}
25193 @opindex mstack-protector-guard
25194 @opindex mstack-protector-guard-reg
25195 @opindex mstack-protector-guard-offset
25196 @opindex mstack-protector-guard-symbol
25197 Generate stack protection code using canary at @var{guard}. Supported
25198 locations are @samp{global} for global canary or @samp{tls} for per-thread
25199 canary in the TLS block (the default with GNU libc version 2.4 or later).
25200
25201 With the latter choice the options
25202 @option{-mstack-protector-guard-reg=@var{reg}} and
25203 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25204 which register to use as base register for reading the canary, and from what
25205 offset from that base register. The default for those is as specified in the
25206 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25207 the offset with a symbol reference to a canary in the TLS block.
25208
25209 @item -mpcrel
25210 @itemx -mno-pcrel
25211 @opindex mpcrel
25212 @opindex mno-pcrel
25213 Generate (do not generate) pc-relative addressing when the option
25214 @option{-mcpu=future} is used.
25215 @end table
25216
25217 @node RX Options
25218 @subsection RX Options
25219 @cindex RX Options
25220
25221 These command-line options are defined for RX targets:
25222
25223 @table @gcctabopt
25224 @item -m64bit-doubles
25225 @itemx -m32bit-doubles
25226 @opindex m64bit-doubles
25227 @opindex m32bit-doubles
25228 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25229 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25230 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25231 works on 32-bit values, which is why the default is
25232 @option{-m32bit-doubles}.
25233
25234 @item -fpu
25235 @itemx -nofpu
25236 @opindex fpu
25237 @opindex nofpu
25238 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25239 floating-point hardware. The default is enabled for the RX600
25240 series and disabled for the RX200 series.
25241
25242 Floating-point instructions are only generated for 32-bit floating-point
25243 values, however, so the FPU hardware is not used for doubles if the
25244 @option{-m64bit-doubles} option is used.
25245
25246 @emph{Note} If the @option{-fpu} option is enabled then
25247 @option{-funsafe-math-optimizations} is also enabled automatically.
25248 This is because the RX FPU instructions are themselves unsafe.
25249
25250 @item -mcpu=@var{name}
25251 @opindex mcpu
25252 Selects the type of RX CPU to be targeted. Currently three types are
25253 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25254 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25255
25256 The only difference between @samp{RX600} and @samp{RX610} is that the
25257 @samp{RX610} does not support the @code{MVTIPL} instruction.
25258
25259 The @samp{RX200} series does not have a hardware floating-point unit
25260 and so @option{-nofpu} is enabled by default when this type is
25261 selected.
25262
25263 @item -mbig-endian-data
25264 @itemx -mlittle-endian-data
25265 @opindex mbig-endian-data
25266 @opindex mlittle-endian-data
25267 Store data (but not code) in the big-endian format. The default is
25268 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25269 format.
25270
25271 @item -msmall-data-limit=@var{N}
25272 @opindex msmall-data-limit
25273 Specifies the maximum size in bytes of global and static variables
25274 which can be placed into the small data area. Using the small data
25275 area can lead to smaller and faster code, but the size of area is
25276 limited and it is up to the programmer to ensure that the area does
25277 not overflow. Also when the small data area is used one of the RX's
25278 registers (usually @code{r13}) is reserved for use pointing to this
25279 area, so it is no longer available for use by the compiler. This
25280 could result in slower and/or larger code if variables are pushed onto
25281 the stack instead of being held in this register.
25282
25283 Note, common variables (variables that have not been initialized) and
25284 constants are not placed into the small data area as they are assigned
25285 to other sections in the output executable.
25286
25287 The default value is zero, which disables this feature. Note, this
25288 feature is not enabled by default with higher optimization levels
25289 (@option{-O2} etc) because of the potentially detrimental effects of
25290 reserving a register. It is up to the programmer to experiment and
25291 discover whether this feature is of benefit to their program. See the
25292 description of the @option{-mpid} option for a description of how the
25293 actual register to hold the small data area pointer is chosen.
25294
25295 @item -msim
25296 @itemx -mno-sim
25297 @opindex msim
25298 @opindex mno-sim
25299 Use the simulator runtime. The default is to use the libgloss
25300 board-specific runtime.
25301
25302 @item -mas100-syntax
25303 @itemx -mno-as100-syntax
25304 @opindex mas100-syntax
25305 @opindex mno-as100-syntax
25306 When generating assembler output use a syntax that is compatible with
25307 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25308 assembler, but it has some restrictions so it is not generated by default.
25309
25310 @item -mmax-constant-size=@var{N}
25311 @opindex mmax-constant-size
25312 Specifies the maximum size, in bytes, of a constant that can be used as
25313 an operand in a RX instruction. Although the RX instruction set does
25314 allow constants of up to 4 bytes in length to be used in instructions,
25315 a longer value equates to a longer instruction. Thus in some
25316 circumstances it can be beneficial to restrict the size of constants
25317 that are used in instructions. Constants that are too big are instead
25318 placed into a constant pool and referenced via register indirection.
25319
25320 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25321 or 4 means that constants of any size are allowed.
25322
25323 @item -mrelax
25324 @opindex mrelax
25325 Enable linker relaxation. Linker relaxation is a process whereby the
25326 linker attempts to reduce the size of a program by finding shorter
25327 versions of various instructions. Disabled by default.
25328
25329 @item -mint-register=@var{N}
25330 @opindex mint-register
25331 Specify the number of registers to reserve for fast interrupt handler
25332 functions. The value @var{N} can be between 0 and 4. A value of 1
25333 means that register @code{r13} is reserved for the exclusive use
25334 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25335 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25336 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25337 A value of 0, the default, does not reserve any registers.
25338
25339 @item -msave-acc-in-interrupts
25340 @opindex msave-acc-in-interrupts
25341 Specifies that interrupt handler functions should preserve the
25342 accumulator register. This is only necessary if normal code might use
25343 the accumulator register, for example because it performs 64-bit
25344 multiplications. The default is to ignore the accumulator as this
25345 makes the interrupt handlers faster.
25346
25347 @item -mpid
25348 @itemx -mno-pid
25349 @opindex mpid
25350 @opindex mno-pid
25351 Enables the generation of position independent data. When enabled any
25352 access to constant data is done via an offset from a base address
25353 held in a register. This allows the location of constant data to be
25354 determined at run time without requiring the executable to be
25355 relocated, which is a benefit to embedded applications with tight
25356 memory constraints. Data that can be modified is not affected by this
25357 option.
25358
25359 Note, using this feature reserves a register, usually @code{r13}, for
25360 the constant data base address. This can result in slower and/or
25361 larger code, especially in complicated functions.
25362
25363 The actual register chosen to hold the constant data base address
25364 depends upon whether the @option{-msmall-data-limit} and/or the
25365 @option{-mint-register} command-line options are enabled. Starting
25366 with register @code{r13} and proceeding downwards, registers are
25367 allocated first to satisfy the requirements of @option{-mint-register},
25368 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25369 is possible for the small data area register to be @code{r8} if both
25370 @option{-mint-register=4} and @option{-mpid} are specified on the
25371 command line.
25372
25373 By default this feature is not enabled. The default can be restored
25374 via the @option{-mno-pid} command-line option.
25375
25376 @item -mno-warn-multiple-fast-interrupts
25377 @itemx -mwarn-multiple-fast-interrupts
25378 @opindex mno-warn-multiple-fast-interrupts
25379 @opindex mwarn-multiple-fast-interrupts
25380 Prevents GCC from issuing a warning message if it finds more than one
25381 fast interrupt handler when it is compiling a file. The default is to
25382 issue a warning for each extra fast interrupt handler found, as the RX
25383 only supports one such interrupt.
25384
25385 @item -mallow-string-insns
25386 @itemx -mno-allow-string-insns
25387 @opindex mallow-string-insns
25388 @opindex mno-allow-string-insns
25389 Enables or disables the use of the string manipulation instructions
25390 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25391 @code{SWHILE} and also the @code{RMPA} instruction. These
25392 instructions may prefetch data, which is not safe to do if accessing
25393 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25394 for more information).
25395
25396 The default is to allow these instructions, but it is not possible for
25397 GCC to reliably detect all circumstances where a string instruction
25398 might be used to access an I/O register, so their use cannot be
25399 disabled automatically. Instead it is reliant upon the programmer to
25400 use the @option{-mno-allow-string-insns} option if their program
25401 accesses I/O space.
25402
25403 When the instructions are enabled GCC defines the C preprocessor
25404 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25405 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25406
25407 @item -mjsr
25408 @itemx -mno-jsr
25409 @opindex mjsr
25410 @opindex mno-jsr
25411 Use only (or not only) @code{JSR} instructions to access functions.
25412 This option can be used when code size exceeds the range of @code{BSR}
25413 instructions. Note that @option{-mno-jsr} does not mean to not use
25414 @code{JSR} but instead means that any type of branch may be used.
25415 @end table
25416
25417 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25418 has special significance to the RX port when used with the
25419 @code{interrupt} function attribute. This attribute indicates a
25420 function intended to process fast interrupts. GCC ensures
25421 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25422 and/or @code{r13} and only provided that the normal use of the
25423 corresponding registers have been restricted via the
25424 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25425 options.
25426
25427 @node S/390 and zSeries Options
25428 @subsection S/390 and zSeries Options
25429 @cindex S/390 and zSeries Options
25430
25431 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25432
25433 @table @gcctabopt
25434 @item -mhard-float
25435 @itemx -msoft-float
25436 @opindex mhard-float
25437 @opindex msoft-float
25438 Use (do not use) the hardware floating-point instructions and registers
25439 for floating-point operations. When @option{-msoft-float} is specified,
25440 functions in @file{libgcc.a} are used to perform floating-point
25441 operations. When @option{-mhard-float} is specified, the compiler
25442 generates IEEE floating-point instructions. This is the default.
25443
25444 @item -mhard-dfp
25445 @itemx -mno-hard-dfp
25446 @opindex mhard-dfp
25447 @opindex mno-hard-dfp
25448 Use (do not use) the hardware decimal-floating-point instructions for
25449 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25450 specified, functions in @file{libgcc.a} are used to perform
25451 decimal-floating-point operations. When @option{-mhard-dfp} is
25452 specified, the compiler generates decimal-floating-point hardware
25453 instructions. This is the default for @option{-march=z9-ec} or higher.
25454
25455 @item -mlong-double-64
25456 @itemx -mlong-double-128
25457 @opindex mlong-double-64
25458 @opindex mlong-double-128
25459 These switches control the size of @code{long double} type. A size
25460 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25461 type. This is the default.
25462
25463 @item -mbackchain
25464 @itemx -mno-backchain
25465 @opindex mbackchain
25466 @opindex mno-backchain
25467 Store (do not store) the address of the caller's frame as backchain pointer
25468 into the callee's stack frame.
25469 A backchain may be needed to allow debugging using tools that do not understand
25470 DWARF call frame information.
25471 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25472 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25473 the backchain is placed into the topmost word of the 96/160 byte register
25474 save area.
25475
25476 In general, code compiled with @option{-mbackchain} is call-compatible with
25477 code compiled with @option{-mmo-backchain}; however, use of the backchain
25478 for debugging purposes usually requires that the whole binary is built with
25479 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25480 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25481 to build a linux kernel use @option{-msoft-float}.
25482
25483 The default is to not maintain the backchain.
25484
25485 @item -mpacked-stack
25486 @itemx -mno-packed-stack
25487 @opindex mpacked-stack
25488 @opindex mno-packed-stack
25489 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25490 specified, the compiler uses the all fields of the 96/160 byte register save
25491 area only for their default purpose; unused fields still take up stack space.
25492 When @option{-mpacked-stack} is specified, register save slots are densely
25493 packed at the top of the register save area; unused space is reused for other
25494 purposes, allowing for more efficient use of the available stack space.
25495 However, when @option{-mbackchain} is also in effect, the topmost word of
25496 the save area is always used to store the backchain, and the return address
25497 register is always saved two words below the backchain.
25498
25499 As long as the stack frame backchain is not used, code generated with
25500 @option{-mpacked-stack} is call-compatible with code generated with
25501 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25502 S/390 or zSeries generated code that uses the stack frame backchain at run
25503 time, not just for debugging purposes. Such code is not call-compatible
25504 with code compiled with @option{-mpacked-stack}. Also, note that the
25505 combination of @option{-mbackchain},
25506 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25507 to build a linux kernel use @option{-msoft-float}.
25508
25509 The default is to not use the packed stack layout.
25510
25511 @item -msmall-exec
25512 @itemx -mno-small-exec
25513 @opindex msmall-exec
25514 @opindex mno-small-exec
25515 Generate (or do not generate) code using the @code{bras} instruction
25516 to do subroutine calls.
25517 This only works reliably if the total executable size does not
25518 exceed 64k. The default is to use the @code{basr} instruction instead,
25519 which does not have this limitation.
25520
25521 @item -m64
25522 @itemx -m31
25523 @opindex m64
25524 @opindex m31
25525 When @option{-m31} is specified, generate code compliant to the
25526 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25527 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25528 particular to generate 64-bit instructions. For the @samp{s390}
25529 targets, the default is @option{-m31}, while the @samp{s390x}
25530 targets default to @option{-m64}.
25531
25532 @item -mzarch
25533 @itemx -mesa
25534 @opindex mzarch
25535 @opindex mesa
25536 When @option{-mzarch} is specified, generate code using the
25537 instructions available on z/Architecture.
25538 When @option{-mesa} is specified, generate code using the
25539 instructions available on ESA/390. Note that @option{-mesa} is
25540 not possible with @option{-m64}.
25541 When generating code compliant to the GNU/Linux for S/390 ABI,
25542 the default is @option{-mesa}. When generating code compliant
25543 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25544
25545 @item -mhtm
25546 @itemx -mno-htm
25547 @opindex mhtm
25548 @opindex mno-htm
25549 The @option{-mhtm} option enables a set of builtins making use of
25550 instructions available with the transactional execution facility
25551 introduced with the IBM zEnterprise EC12 machine generation
25552 @ref{S/390 System z Built-in Functions}.
25553 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25554
25555 @item -mvx
25556 @itemx -mno-vx
25557 @opindex mvx
25558 @opindex mno-vx
25559 When @option{-mvx} is specified, generate code using the instructions
25560 available with the vector extension facility introduced with the IBM
25561 z13 machine generation.
25562 This option changes the ABI for some vector type values with regard to
25563 alignment and calling conventions. In case vector type values are
25564 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25565 command will be added to mark the resulting binary with the ABI used.
25566 @option{-mvx} is enabled by default when using @option{-march=z13}.
25567
25568 @item -mzvector
25569 @itemx -mno-zvector
25570 @opindex mzvector
25571 @opindex mno-zvector
25572 The @option{-mzvector} option enables vector language extensions and
25573 builtins using instructions available with the vector extension
25574 facility introduced with the IBM z13 machine generation.
25575 This option adds support for @samp{vector} to be used as a keyword to
25576 define vector type variables and arguments. @samp{vector} is only
25577 available when GNU extensions are enabled. It will not be expanded
25578 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25579 In addition to the GCC low-level builtins @option{-mzvector} enables
25580 a set of builtins added for compatibility with AltiVec-style
25581 implementations like Power and Cell. In order to make use of these
25582 builtins the header file @file{vecintrin.h} needs to be included.
25583 @option{-mzvector} is disabled by default.
25584
25585 @item -mmvcle
25586 @itemx -mno-mvcle
25587 @opindex mmvcle
25588 @opindex mno-mvcle
25589 Generate (or do not generate) code using the @code{mvcle} instruction
25590 to perform block moves. When @option{-mno-mvcle} is specified,
25591 use a @code{mvc} loop instead. This is the default unless optimizing for
25592 size.
25593
25594 @item -mdebug
25595 @itemx -mno-debug
25596 @opindex mdebug
25597 @opindex mno-debug
25598 Print (or do not print) additional debug information when compiling.
25599 The default is to not print debug information.
25600
25601 @item -march=@var{cpu-type}
25602 @opindex march
25603 Generate code that runs on @var{cpu-type}, which is the name of a
25604 system representing a certain processor type. Possible values for
25605 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25606 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25607 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25608 @samp{z14}/@samp{arch12}, and @samp{native}.
25609
25610 The default is @option{-march=z900}.
25611
25612 Specifying @samp{native} as cpu type can be used to select the best
25613 architecture option for the host processor.
25614 @option{-march=native} has no effect if GCC does not recognize the
25615 processor.
25616
25617 @item -mtune=@var{cpu-type}
25618 @opindex mtune
25619 Tune to @var{cpu-type} everything applicable about the generated code,
25620 except for the ABI and the set of available instructions.
25621 The list of @var{cpu-type} values is the same as for @option{-march}.
25622 The default is the value used for @option{-march}.
25623
25624 @item -mtpf-trace
25625 @itemx -mno-tpf-trace
25626 @opindex mtpf-trace
25627 @opindex mno-tpf-trace
25628 Generate code that adds (does not add) in TPF OS specific branches to trace
25629 routines in the operating system. This option is off by default, even
25630 when compiling for the TPF OS@.
25631
25632 @item -mfused-madd
25633 @itemx -mno-fused-madd
25634 @opindex mfused-madd
25635 @opindex mno-fused-madd
25636 Generate code that uses (does not use) the floating-point multiply and
25637 accumulate instructions. These instructions are generated by default if
25638 hardware floating point is used.
25639
25640 @item -mwarn-framesize=@var{framesize}
25641 @opindex mwarn-framesize
25642 Emit a warning if the current function exceeds the given frame size. Because
25643 this is a compile-time check it doesn't need to be a real problem when the program
25644 runs. It is intended to identify functions that most probably cause
25645 a stack overflow. It is useful to be used in an environment with limited stack
25646 size e.g.@: the linux kernel.
25647
25648 @item -mwarn-dynamicstack
25649 @opindex mwarn-dynamicstack
25650 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25651 arrays. This is generally a bad idea with a limited stack size.
25652
25653 @item -mstack-guard=@var{stack-guard}
25654 @itemx -mstack-size=@var{stack-size}
25655 @opindex mstack-guard
25656 @opindex mstack-size
25657 If these options are provided the S/390 back end emits additional instructions in
25658 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25659 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25660 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25661 the frame size of the compiled function is chosen.
25662 These options are intended to be used to help debugging stack overflow problems.
25663 The additionally emitted code causes only little overhead and hence can also be
25664 used in production-like systems without greater performance degradation. The given
25665 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25666 @var{stack-guard} without exceeding 64k.
25667 In order to be efficient the extra code makes the assumption that the stack starts
25668 at an address aligned to the value given by @var{stack-size}.
25669 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25670
25671 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25672 @opindex mhotpatch
25673 If the hotpatch option is enabled, a ``hot-patching'' function
25674 prologue is generated for all functions in the compilation unit.
25675 The funtion label is prepended with the given number of two-byte
25676 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25677 the label, 2 * @var{post-halfwords} bytes are appended, using the
25678 largest NOP like instructions the architecture allows (maximum
25679 1000000).
25680
25681 If both arguments are zero, hotpatching is disabled.
25682
25683 This option can be overridden for individual functions with the
25684 @code{hotpatch} attribute.
25685 @end table
25686
25687 @node Score Options
25688 @subsection Score Options
25689 @cindex Score Options
25690
25691 These options are defined for Score implementations:
25692
25693 @table @gcctabopt
25694 @item -meb
25695 @opindex meb
25696 Compile code for big-endian mode. This is the default.
25697
25698 @item -mel
25699 @opindex mel
25700 Compile code for little-endian mode.
25701
25702 @item -mnhwloop
25703 @opindex mnhwloop
25704 Disable generation of @code{bcnz} instructions.
25705
25706 @item -muls
25707 @opindex muls
25708 Enable generation of unaligned load and store instructions.
25709
25710 @item -mmac
25711 @opindex mmac
25712 Enable the use of multiply-accumulate instructions. Disabled by default.
25713
25714 @item -mscore5
25715 @opindex mscore5
25716 Specify the SCORE5 as the target architecture.
25717
25718 @item -mscore5u
25719 @opindex mscore5u
25720 Specify the SCORE5U of the target architecture.
25721
25722 @item -mscore7
25723 @opindex mscore7
25724 Specify the SCORE7 as the target architecture. This is the default.
25725
25726 @item -mscore7d
25727 @opindex mscore7d
25728 Specify the SCORE7D as the target architecture.
25729 @end table
25730
25731 @node SH Options
25732 @subsection SH Options
25733
25734 These @samp{-m} options are defined for the SH implementations:
25735
25736 @table @gcctabopt
25737 @item -m1
25738 @opindex m1
25739 Generate code for the SH1.
25740
25741 @item -m2
25742 @opindex m2
25743 Generate code for the SH2.
25744
25745 @item -m2e
25746 Generate code for the SH2e.
25747
25748 @item -m2a-nofpu
25749 @opindex m2a-nofpu
25750 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25751 that the floating-point unit is not used.
25752
25753 @item -m2a-single-only
25754 @opindex m2a-single-only
25755 Generate code for the SH2a-FPU, in such a way that no double-precision
25756 floating-point operations are used.
25757
25758 @item -m2a-single
25759 @opindex m2a-single
25760 Generate code for the SH2a-FPU assuming the floating-point unit is in
25761 single-precision mode by default.
25762
25763 @item -m2a
25764 @opindex m2a
25765 Generate code for the SH2a-FPU assuming the floating-point unit is in
25766 double-precision mode by default.
25767
25768 @item -m3
25769 @opindex m3
25770 Generate code for the SH3.
25771
25772 @item -m3e
25773 @opindex m3e
25774 Generate code for the SH3e.
25775
25776 @item -m4-nofpu
25777 @opindex m4-nofpu
25778 Generate code for the SH4 without a floating-point unit.
25779
25780 @item -m4-single-only
25781 @opindex m4-single-only
25782 Generate code for the SH4 with a floating-point unit that only
25783 supports single-precision arithmetic.
25784
25785 @item -m4-single
25786 @opindex m4-single
25787 Generate code for the SH4 assuming the floating-point unit is in
25788 single-precision mode by default.
25789
25790 @item -m4
25791 @opindex m4
25792 Generate code for the SH4.
25793
25794 @item -m4-100
25795 @opindex m4-100
25796 Generate code for SH4-100.
25797
25798 @item -m4-100-nofpu
25799 @opindex m4-100-nofpu
25800 Generate code for SH4-100 in such a way that the
25801 floating-point unit is not used.
25802
25803 @item -m4-100-single
25804 @opindex m4-100-single
25805 Generate code for SH4-100 assuming the floating-point unit is in
25806 single-precision mode by default.
25807
25808 @item -m4-100-single-only
25809 @opindex m4-100-single-only
25810 Generate code for SH4-100 in such a way that no double-precision
25811 floating-point operations are used.
25812
25813 @item -m4-200
25814 @opindex m4-200
25815 Generate code for SH4-200.
25816
25817 @item -m4-200-nofpu
25818 @opindex m4-200-nofpu
25819 Generate code for SH4-200 without in such a way that the
25820 floating-point unit is not used.
25821
25822 @item -m4-200-single
25823 @opindex m4-200-single
25824 Generate code for SH4-200 assuming the floating-point unit is in
25825 single-precision mode by default.
25826
25827 @item -m4-200-single-only
25828 @opindex m4-200-single-only
25829 Generate code for SH4-200 in such a way that no double-precision
25830 floating-point operations are used.
25831
25832 @item -m4-300
25833 @opindex m4-300
25834 Generate code for SH4-300.
25835
25836 @item -m4-300-nofpu
25837 @opindex m4-300-nofpu
25838 Generate code for SH4-300 without in such a way that the
25839 floating-point unit is not used.
25840
25841 @item -m4-300-single
25842 @opindex m4-300-single
25843 Generate code for SH4-300 in such a way that no double-precision
25844 floating-point operations are used.
25845
25846 @item -m4-300-single-only
25847 @opindex m4-300-single-only
25848 Generate code for SH4-300 in such a way that no double-precision
25849 floating-point operations are used.
25850
25851 @item -m4-340
25852 @opindex m4-340
25853 Generate code for SH4-340 (no MMU, no FPU).
25854
25855 @item -m4-500
25856 @opindex m4-500
25857 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25858 assembler.
25859
25860 @item -m4a-nofpu
25861 @opindex m4a-nofpu
25862 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25863 floating-point unit is not used.
25864
25865 @item -m4a-single-only
25866 @opindex m4a-single-only
25867 Generate code for the SH4a, in such a way that no double-precision
25868 floating-point operations are used.
25869
25870 @item -m4a-single
25871 @opindex m4a-single
25872 Generate code for the SH4a assuming the floating-point unit is in
25873 single-precision mode by default.
25874
25875 @item -m4a
25876 @opindex m4a
25877 Generate code for the SH4a.
25878
25879 @item -m4al
25880 @opindex m4al
25881 Same as @option{-m4a-nofpu}, except that it implicitly passes
25882 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25883 instructions at the moment.
25884
25885 @item -mb
25886 @opindex mb
25887 Compile code for the processor in big-endian mode.
25888
25889 @item -ml
25890 @opindex ml
25891 Compile code for the processor in little-endian mode.
25892
25893 @item -mdalign
25894 @opindex mdalign
25895 Align doubles at 64-bit boundaries. Note that this changes the calling
25896 conventions, and thus some functions from the standard C library do
25897 not work unless you recompile it first with @option{-mdalign}.
25898
25899 @item -mrelax
25900 @opindex mrelax
25901 Shorten some address references at link time, when possible; uses the
25902 linker option @option{-relax}.
25903
25904 @item -mbigtable
25905 @opindex mbigtable
25906 Use 32-bit offsets in @code{switch} tables. The default is to use
25907 16-bit offsets.
25908
25909 @item -mbitops
25910 @opindex mbitops
25911 Enable the use of bit manipulation instructions on SH2A.
25912
25913 @item -mfmovd
25914 @opindex mfmovd
25915 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25916 alignment constraints.
25917
25918 @item -mrenesas
25919 @opindex mrenesas
25920 Comply with the calling conventions defined by Renesas.
25921
25922 @item -mno-renesas
25923 @opindex mno-renesas
25924 Comply with the calling conventions defined for GCC before the Renesas
25925 conventions were available. This option is the default for all
25926 targets of the SH toolchain.
25927
25928 @item -mnomacsave
25929 @opindex mnomacsave
25930 Mark the @code{MAC} register as call-clobbered, even if
25931 @option{-mrenesas} is given.
25932
25933 @item -mieee
25934 @itemx -mno-ieee
25935 @opindex mieee
25936 @opindex mno-ieee
25937 Control the IEEE compliance of floating-point comparisons, which affects the
25938 handling of cases where the result of a comparison is unordered. By default
25939 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25940 enabled @option{-mno-ieee} is implicitly set, which results in faster
25941 floating-point greater-equal and less-equal comparisons. The implicit settings
25942 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25943
25944 @item -minline-ic_invalidate
25945 @opindex minline-ic_invalidate
25946 Inline code to invalidate instruction cache entries after setting up
25947 nested function trampolines.
25948 This option has no effect if @option{-musermode} is in effect and the selected
25949 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25950 instruction.
25951 If the selected code generation option does not allow the use of the @code{icbi}
25952 instruction, and @option{-musermode} is not in effect, the inlined code
25953 manipulates the instruction cache address array directly with an associative
25954 write. This not only requires privileged mode at run time, but it also
25955 fails if the cache line had been mapped via the TLB and has become unmapped.
25956
25957 @item -misize
25958 @opindex misize
25959 Dump instruction size and location in the assembly code.
25960
25961 @item -mpadstruct
25962 @opindex mpadstruct
25963 This option is deprecated. It pads structures to multiple of 4 bytes,
25964 which is incompatible with the SH ABI@.
25965
25966 @item -matomic-model=@var{model}
25967 @opindex matomic-model=@var{model}
25968 Sets the model of atomic operations and additional parameters as a comma
25969 separated list. For details on the atomic built-in functions see
25970 @ref{__atomic Builtins}. The following models and parameters are supported:
25971
25972 @table @samp
25973
25974 @item none
25975 Disable compiler generated atomic sequences and emit library calls for atomic
25976 operations. This is the default if the target is not @code{sh*-*-linux*}.
25977
25978 @item soft-gusa
25979 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25980 built-in functions. The generated atomic sequences require additional support
25981 from the interrupt/exception handling code of the system and are only suitable
25982 for SH3* and SH4* single-core systems. This option is enabled by default when
25983 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25984 this option also partially utilizes the hardware atomic instructions
25985 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25986 @samp{strict} is specified.
25987
25988 @item soft-tcb
25989 Generate software atomic sequences that use a variable in the thread control
25990 block. This is a variation of the gUSA sequences which can also be used on
25991 SH1* and SH2* targets. The generated atomic sequences require additional
25992 support from the interrupt/exception handling code of the system and are only
25993 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25994 parameter has to be specified as well.
25995
25996 @item soft-imask
25997 Generate software atomic sequences that temporarily disable interrupts by
25998 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25999 in privileged mode and is only suitable for single-core systems. Additional
26000 support from the interrupt/exception handling code of the system is not
26001 required. This model is enabled by default when the target is
26002 @code{sh*-*-linux*} and SH1* or SH2*.
26003
26004 @item hard-llcs
26005 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26006 instructions only. This is only available on SH4A and is suitable for
26007 multi-core systems. Since the hardware instructions support only 32 bit atomic
26008 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26009 Code compiled with this option is also compatible with other software
26010 atomic model interrupt/exception handling systems if executed on an SH4A
26011 system. Additional support from the interrupt/exception handling code of the
26012 system is not required for this model.
26013
26014 @item gbr-offset=
26015 This parameter specifies the offset in bytes of the variable in the thread
26016 control block structure that should be used by the generated atomic sequences
26017 when the @samp{soft-tcb} model has been selected. For other models this
26018 parameter is ignored. The specified value must be an integer multiple of four
26019 and in the range 0-1020.
26020
26021 @item strict
26022 This parameter prevents mixed usage of multiple atomic models, even if they
26023 are compatible, and makes the compiler generate atomic sequences of the
26024 specified model only.
26025
26026 @end table
26027
26028 @item -mtas
26029 @opindex mtas
26030 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26031 Notice that depending on the particular hardware and software configuration
26032 this can degrade overall performance due to the operand cache line flushes
26033 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26034 processors the @code{tas.b} instruction must be used with caution since it
26035 can result in data corruption for certain cache configurations.
26036
26037 @item -mprefergot
26038 @opindex mprefergot
26039 When generating position-independent code, emit function calls using
26040 the Global Offset Table instead of the Procedure Linkage Table.
26041
26042 @item -musermode
26043 @itemx -mno-usermode
26044 @opindex musermode
26045 @opindex mno-usermode
26046 Don't allow (allow) the compiler generating privileged mode code. Specifying
26047 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26048 inlined code would not work in user mode. @option{-musermode} is the default
26049 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26050 @option{-musermode} has no effect, since there is no user mode.
26051
26052 @item -multcost=@var{number}
26053 @opindex multcost=@var{number}
26054 Set the cost to assume for a multiply insn.
26055
26056 @item -mdiv=@var{strategy}
26057 @opindex mdiv=@var{strategy}
26058 Set the division strategy to be used for integer division operations.
26059 @var{strategy} can be one of:
26060
26061 @table @samp
26062
26063 @item call-div1
26064 Calls a library function that uses the single-step division instruction
26065 @code{div1} to perform the operation. Division by zero calculates an
26066 unspecified result and does not trap. This is the default except for SH4,
26067 SH2A and SHcompact.
26068
26069 @item call-fp
26070 Calls a library function that performs the operation in double precision
26071 floating point. Division by zero causes a floating-point exception. This is
26072 the default for SHcompact with FPU. Specifying this for targets that do not
26073 have a double precision FPU defaults to @code{call-div1}.
26074
26075 @item call-table
26076 Calls a library function that uses a lookup table for small divisors and
26077 the @code{div1} instruction with case distinction for larger divisors. Division
26078 by zero calculates an unspecified result and does not trap. This is the default
26079 for SH4. Specifying this for targets that do not have dynamic shift
26080 instructions defaults to @code{call-div1}.
26081
26082 @end table
26083
26084 When a division strategy has not been specified the default strategy is
26085 selected based on the current target. For SH2A the default strategy is to
26086 use the @code{divs} and @code{divu} instructions instead of library function
26087 calls.
26088
26089 @item -maccumulate-outgoing-args
26090 @opindex maccumulate-outgoing-args
26091 Reserve space once for outgoing arguments in the function prologue rather
26092 than around each call. Generally beneficial for performance and size. Also
26093 needed for unwinding to avoid changing the stack frame around conditional code.
26094
26095 @item -mdivsi3_libfunc=@var{name}
26096 @opindex mdivsi3_libfunc=@var{name}
26097 Set the name of the library function used for 32-bit signed division to
26098 @var{name}.
26099 This only affects the name used in the @samp{call} division strategies, and
26100 the compiler still expects the same sets of input/output/clobbered registers as
26101 if this option were not present.
26102
26103 @item -mfixed-range=@var{register-range}
26104 @opindex mfixed-range
26105 Generate code treating the given register range as fixed registers.
26106 A fixed register is one that the register allocator cannot use. This is
26107 useful when compiling kernel code. A register range is specified as
26108 two registers separated by a dash. Multiple register ranges can be
26109 specified separated by a comma.
26110
26111 @item -mbranch-cost=@var{num}
26112 @opindex mbranch-cost=@var{num}
26113 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26114 make the compiler try to generate more branch-free code if possible.
26115 If not specified the value is selected depending on the processor type that
26116 is being compiled for.
26117
26118 @item -mzdcbranch
26119 @itemx -mno-zdcbranch
26120 @opindex mzdcbranch
26121 @opindex mno-zdcbranch
26122 Assume (do not assume) that zero displacement conditional branch instructions
26123 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26124 compiler prefers zero displacement branch code sequences. This is
26125 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26126 disabled by specifying @option{-mno-zdcbranch}.
26127
26128 @item -mcbranch-force-delay-slot
26129 @opindex mcbranch-force-delay-slot
26130 Force the usage of delay slots for conditional branches, which stuffs the delay
26131 slot with a @code{nop} if a suitable instruction cannot be found. By default
26132 this option is disabled. It can be enabled to work around hardware bugs as
26133 found in the original SH7055.
26134
26135 @item -mfused-madd
26136 @itemx -mno-fused-madd
26137 @opindex mfused-madd
26138 @opindex mno-fused-madd
26139 Generate code that uses (does not use) the floating-point multiply and
26140 accumulate instructions. These instructions are generated by default
26141 if hardware floating point is used. The machine-dependent
26142 @option{-mfused-madd} option is now mapped to the machine-independent
26143 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26144 mapped to @option{-ffp-contract=off}.
26145
26146 @item -mfsca
26147 @itemx -mno-fsca
26148 @opindex mfsca
26149 @opindex mno-fsca
26150 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26151 and cosine approximations. The option @option{-mfsca} must be used in
26152 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26153 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26154 approximations even if @option{-funsafe-math-optimizations} is in effect.
26155
26156 @item -mfsrra
26157 @itemx -mno-fsrra
26158 @opindex mfsrra
26159 @opindex mno-fsrra
26160 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26161 reciprocal square root approximations. The option @option{-mfsrra} must be used
26162 in combination with @option{-funsafe-math-optimizations} and
26163 @option{-ffinite-math-only}. It is enabled by default when generating code for
26164 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26165 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26166 in effect.
26167
26168 @item -mpretend-cmove
26169 @opindex mpretend-cmove
26170 Prefer zero-displacement conditional branches for conditional move instruction
26171 patterns. This can result in faster code on the SH4 processor.
26172
26173 @item -mfdpic
26174 @opindex fdpic
26175 Generate code using the FDPIC ABI.
26176
26177 @end table
26178
26179 @node Solaris 2 Options
26180 @subsection Solaris 2 Options
26181 @cindex Solaris 2 options
26182
26183 These @samp{-m} options are supported on Solaris 2:
26184
26185 @table @gcctabopt
26186 @item -mclear-hwcap
26187 @opindex mclear-hwcap
26188 @option{-mclear-hwcap} tells the compiler to remove the hardware
26189 capabilities generated by the Solaris assembler. This is only necessary
26190 when object files use ISA extensions not supported by the current
26191 machine, but check at runtime whether or not to use them.
26192
26193 @item -mimpure-text
26194 @opindex mimpure-text
26195 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26196 the compiler to not pass @option{-z text} to the linker when linking a
26197 shared object. Using this option, you can link position-dependent
26198 code into a shared object.
26199
26200 @option{-mimpure-text} suppresses the ``relocations remain against
26201 allocatable but non-writable sections'' linker error message.
26202 However, the necessary relocations trigger copy-on-write, and the
26203 shared object is not actually shared across processes. Instead of
26204 using @option{-mimpure-text}, you should compile all source code with
26205 @option{-fpic} or @option{-fPIC}.
26206
26207 @end table
26208
26209 These switches are supported in addition to the above on Solaris 2:
26210
26211 @table @gcctabopt
26212 @item -pthreads
26213 @opindex pthreads
26214 This is a synonym for @option{-pthread}.
26215 @end table
26216
26217 @node SPARC Options
26218 @subsection SPARC Options
26219 @cindex SPARC options
26220
26221 These @samp{-m} options are supported on the SPARC:
26222
26223 @table @gcctabopt
26224 @item -mno-app-regs
26225 @itemx -mapp-regs
26226 @opindex mno-app-regs
26227 @opindex mapp-regs
26228 Specify @option{-mapp-regs} to generate output using the global registers
26229 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26230 global register 1, each global register 2 through 4 is then treated as an
26231 allocable register that is clobbered by function calls. This is the default.
26232
26233 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26234 specify @option{-mno-app-regs}. You should compile libraries and system
26235 software with this option.
26236
26237 @item -mflat
26238 @itemx -mno-flat
26239 @opindex mflat
26240 @opindex mno-flat
26241 With @option{-mflat}, the compiler does not generate save/restore instructions
26242 and uses a ``flat'' or single register window model. This model is compatible
26243 with the regular register window model. The local registers and the input
26244 registers (0--5) are still treated as ``call-saved'' registers and are
26245 saved on the stack as needed.
26246
26247 With @option{-mno-flat} (the default), the compiler generates save/restore
26248 instructions (except for leaf functions). This is the normal operating mode.
26249
26250 @item -mfpu
26251 @itemx -mhard-float
26252 @opindex mfpu
26253 @opindex mhard-float
26254 Generate output containing floating-point instructions. This is the
26255 default.
26256
26257 @item -mno-fpu
26258 @itemx -msoft-float
26259 @opindex mno-fpu
26260 @opindex msoft-float
26261 Generate output containing library calls for floating point.
26262 @strong{Warning:} the requisite libraries are not available for all SPARC
26263 targets. Normally the facilities of the machine's usual C compiler are
26264 used, but this cannot be done directly in cross-compilation. You must make
26265 your own arrangements to provide suitable library functions for
26266 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26267 @samp{sparclite-*-*} do provide software floating-point support.
26268
26269 @option{-msoft-float} changes the calling convention in the output file;
26270 therefore, it is only useful if you compile @emph{all} of a program with
26271 this option. In particular, you need to compile @file{libgcc.a}, the
26272 library that comes with GCC, with @option{-msoft-float} in order for
26273 this to work.
26274
26275 @item -mhard-quad-float
26276 @opindex mhard-quad-float
26277 Generate output containing quad-word (long double) floating-point
26278 instructions.
26279
26280 @item -msoft-quad-float
26281 @opindex msoft-quad-float
26282 Generate output containing library calls for quad-word (long double)
26283 floating-point instructions. The functions called are those specified
26284 in the SPARC ABI@. This is the default.
26285
26286 As of this writing, there are no SPARC implementations that have hardware
26287 support for the quad-word floating-point instructions. They all invoke
26288 a trap handler for one of these instructions, and then the trap handler
26289 emulates the effect of the instruction. Because of the trap handler overhead,
26290 this is much slower than calling the ABI library routines. Thus the
26291 @option{-msoft-quad-float} option is the default.
26292
26293 @item -mno-unaligned-doubles
26294 @itemx -munaligned-doubles
26295 @opindex mno-unaligned-doubles
26296 @opindex munaligned-doubles
26297 Assume that doubles have 8-byte alignment. This is the default.
26298
26299 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26300 alignment only if they are contained in another type, or if they have an
26301 absolute address. Otherwise, it assumes they have 4-byte alignment.
26302 Specifying this option avoids some rare compatibility problems with code
26303 generated by other compilers. It is not the default because it results
26304 in a performance loss, especially for floating-point code.
26305
26306 @item -muser-mode
26307 @itemx -mno-user-mode
26308 @opindex muser-mode
26309 @opindex mno-user-mode
26310 Do not generate code that can only run in supervisor mode. This is relevant
26311 only for the @code{casa} instruction emitted for the LEON3 processor. This
26312 is the default.
26313
26314 @item -mfaster-structs
26315 @itemx -mno-faster-structs
26316 @opindex mfaster-structs
26317 @opindex mno-faster-structs
26318 With @option{-mfaster-structs}, the compiler assumes that structures
26319 should have 8-byte alignment. This enables the use of pairs of
26320 @code{ldd} and @code{std} instructions for copies in structure
26321 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26322 However, the use of this changed alignment directly violates the SPARC
26323 ABI@. Thus, it's intended only for use on targets where the developer
26324 acknowledges that their resulting code is not directly in line with
26325 the rules of the ABI@.
26326
26327 @item -mstd-struct-return
26328 @itemx -mno-std-struct-return
26329 @opindex mstd-struct-return
26330 @opindex mno-std-struct-return
26331 With @option{-mstd-struct-return}, the compiler generates checking code
26332 in functions returning structures or unions to detect size mismatches
26333 between the two sides of function calls, as per the 32-bit ABI@.
26334
26335 The default is @option{-mno-std-struct-return}. This option has no effect
26336 in 64-bit mode.
26337
26338 @item -mlra
26339 @itemx -mno-lra
26340 @opindex mlra
26341 @opindex mno-lra
26342 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26343 so @option{-mno-lra} needs to be passed to get old Reload.
26344
26345 @item -mcpu=@var{cpu_type}
26346 @opindex mcpu
26347 Set the instruction set, register set, and instruction scheduling parameters
26348 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26349 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26350 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26351 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26352 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26353 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26354
26355 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26356 which selects the best architecture option for the host processor.
26357 @option{-mcpu=native} has no effect if GCC does not recognize
26358 the processor.
26359
26360 Default instruction scheduling parameters are used for values that select
26361 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26362 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26363
26364 Here is a list of each supported architecture and their supported
26365 implementations.
26366
26367 @table @asis
26368 @item v7
26369 cypress, leon3v7
26370
26371 @item v8
26372 supersparc, hypersparc, leon, leon3
26373
26374 @item sparclite
26375 f930, f934, sparclite86x
26376
26377 @item sparclet
26378 tsc701
26379
26380 @item v9
26381 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26382 niagara7, m8
26383 @end table
26384
26385 By default (unless configured otherwise), GCC generates code for the V7
26386 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26387 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26388 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26389 SPARCStation 1, 2, IPX etc.
26390
26391 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26392 architecture. The only difference from V7 code is that the compiler emits
26393 the integer multiply and integer divide instructions which exist in SPARC-V8
26394 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26395 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26396 2000 series.
26397
26398 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26399 the SPARC architecture. This adds the integer multiply, integer divide step
26400 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26401 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26402 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26403 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26404 MB86934 chip, which is the more recent SPARClite with FPU@.
26405
26406 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26407 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26408 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26409 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26410 optimizes it for the TEMIC SPARClet chip.
26411
26412 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26413 architecture. This adds 64-bit integer and floating-point move instructions,
26414 3 additional floating-point condition code registers and conditional move
26415 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26416 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26417 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26418 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26419 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26420 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26421 additionally optimizes it for Sun UltraSPARC T2 chips. With
26422 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26423 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26424 additionally optimizes it for Sun UltraSPARC T4 chips. With
26425 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26426 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26427 additionally optimizes it for Oracle M8 chips.
26428
26429 @item -mtune=@var{cpu_type}
26430 @opindex mtune
26431 Set the instruction scheduling parameters for machine type
26432 @var{cpu_type}, but do not set the instruction set or register set that the
26433 option @option{-mcpu=@var{cpu_type}} does.
26434
26435 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26436 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26437 that select a particular CPU implementation. Those are
26438 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26439 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26440 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26441 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26442 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26443 and GNU/Linux toolchains, @samp{native} can also be used.
26444
26445 @item -mv8plus
26446 @itemx -mno-v8plus
26447 @opindex mv8plus
26448 @opindex mno-v8plus
26449 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26450 difference from the V8 ABI is that the global and out registers are
26451 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26452 mode for all SPARC-V9 processors.
26453
26454 @item -mvis
26455 @itemx -mno-vis
26456 @opindex mvis
26457 @opindex mno-vis
26458 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26459 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26460
26461 @item -mvis2
26462 @itemx -mno-vis2
26463 @opindex mvis2
26464 @opindex mno-vis2
26465 With @option{-mvis2}, GCC generates code that takes advantage of
26466 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26467 default is @option{-mvis2} when targeting a cpu that supports such
26468 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26469 also sets @option{-mvis}.
26470
26471 @item -mvis3
26472 @itemx -mno-vis3
26473 @opindex mvis3
26474 @opindex mno-vis3
26475 With @option{-mvis3}, GCC generates code that takes advantage of
26476 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26477 default is @option{-mvis3} when targeting a cpu that supports such
26478 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26479 also sets @option{-mvis2} and @option{-mvis}.
26480
26481 @item -mvis4
26482 @itemx -mno-vis4
26483 @opindex mvis4
26484 @opindex mno-vis4
26485 With @option{-mvis4}, GCC generates code that takes advantage of
26486 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26487 default is @option{-mvis4} when targeting a cpu that supports such
26488 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26489 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26490
26491 @item -mvis4b
26492 @itemx -mno-vis4b
26493 @opindex mvis4b
26494 @opindex mno-vis4b
26495 With @option{-mvis4b}, GCC generates code that takes advantage of
26496 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26497 the additional VIS instructions introduced in the Oracle SPARC
26498 Architecture 2017. The default is @option{-mvis4b} when targeting a
26499 cpu that supports such instructions, such as m8 and later. Setting
26500 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26501 @option{-mvis2} and @option{-mvis}.
26502
26503 @item -mcbcond
26504 @itemx -mno-cbcond
26505 @opindex mcbcond
26506 @opindex mno-cbcond
26507 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26508 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26509 when targeting a CPU that supports such instructions, such as Niagara-4 and
26510 later.
26511
26512 @item -mfmaf
26513 @itemx -mno-fmaf
26514 @opindex mfmaf
26515 @opindex mno-fmaf
26516 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26517 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26518 when targeting a CPU that supports such instructions, such as Niagara-3 and
26519 later.
26520
26521 @item -mfsmuld
26522 @itemx -mno-fsmuld
26523 @opindex mfsmuld
26524 @opindex mno-fsmuld
26525 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26526 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26527 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26528 or V9 with FPU except @option{-mcpu=leon}.
26529
26530 @item -mpopc
26531 @itemx -mno-popc
26532 @opindex mpopc
26533 @opindex mno-popc
26534 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26535 Population Count instruction. The default is @option{-mpopc}
26536 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26537 later.
26538
26539 @item -msubxc
26540 @itemx -mno-subxc
26541 @opindex msubxc
26542 @opindex mno-subxc
26543 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26544 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26545 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26546 later.
26547
26548 @item -mfix-at697f
26549 @opindex mfix-at697f
26550 Enable the documented workaround for the single erratum of the Atmel AT697F
26551 processor (which corresponds to erratum #13 of the AT697E processor).
26552
26553 @item -mfix-ut699
26554 @opindex mfix-ut699
26555 Enable the documented workarounds for the floating-point errata and the data
26556 cache nullify errata of the UT699 processor.
26557
26558 @item -mfix-ut700
26559 @opindex mfix-ut700
26560 Enable the documented workaround for the back-to-back store errata of
26561 the UT699E/UT700 processor.
26562
26563 @item -mfix-gr712rc
26564 @opindex mfix-gr712rc
26565 Enable the documented workaround for the back-to-back store errata of
26566 the GR712RC processor.
26567 @end table
26568
26569 These @samp{-m} options are supported in addition to the above
26570 on SPARC-V9 processors in 64-bit environments:
26571
26572 @table @gcctabopt
26573 @item -m32
26574 @itemx -m64
26575 @opindex m32
26576 @opindex m64
26577 Generate code for a 32-bit or 64-bit environment.
26578 The 32-bit environment sets int, long and pointer to 32 bits.
26579 The 64-bit environment sets int to 32 bits and long and pointer
26580 to 64 bits.
26581
26582 @item -mcmodel=@var{which}
26583 @opindex mcmodel
26584 Set the code model to one of
26585
26586 @table @samp
26587 @item medlow
26588 The Medium/Low code model: 64-bit addresses, programs
26589 must be linked in the low 32 bits of memory. Programs can be statically
26590 or dynamically linked.
26591
26592 @item medmid
26593 The Medium/Middle code model: 64-bit addresses, programs
26594 must be linked in the low 44 bits of memory, the text and data segments must
26595 be less than 2GB in size and the data segment must be located within 2GB of
26596 the text segment.
26597
26598 @item medany
26599 The Medium/Anywhere code model: 64-bit addresses, programs
26600 may be linked anywhere in memory, the text and data segments must be less
26601 than 2GB in size and the data segment must be located within 2GB of the
26602 text segment.
26603
26604 @item embmedany
26605 The Medium/Anywhere code model for embedded systems:
26606 64-bit addresses, the text and data segments must be less than 2GB in
26607 size, both starting anywhere in memory (determined at link time). The
26608 global register %g4 points to the base of the data segment. Programs
26609 are statically linked and PIC is not supported.
26610 @end table
26611
26612 @item -mmemory-model=@var{mem-model}
26613 @opindex mmemory-model
26614 Set the memory model in force on the processor to one of
26615
26616 @table @samp
26617 @item default
26618 The default memory model for the processor and operating system.
26619
26620 @item rmo
26621 Relaxed Memory Order
26622
26623 @item pso
26624 Partial Store Order
26625
26626 @item tso
26627 Total Store Order
26628
26629 @item sc
26630 Sequential Consistency
26631 @end table
26632
26633 These memory models are formally defined in Appendix D of the SPARC-V9
26634 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26635
26636 @item -mstack-bias
26637 @itemx -mno-stack-bias
26638 @opindex mstack-bias
26639 @opindex mno-stack-bias
26640 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26641 frame pointer if present, are offset by @minus{}2047 which must be added back
26642 when making stack frame references. This is the default in 64-bit mode.
26643 Otherwise, assume no such offset is present.
26644 @end table
26645
26646 @node SPU Options
26647 @subsection SPU Options
26648 @cindex SPU options
26649
26650 These @samp{-m} options are supported on the SPU:
26651
26652 @table @gcctabopt
26653 @item -mwarn-reloc
26654 @itemx -merror-reloc
26655 @opindex mwarn-reloc
26656 @opindex merror-reloc
26657
26658 The loader for SPU does not handle dynamic relocations. By default, GCC
26659 gives an error when it generates code that requires a dynamic
26660 relocation. @option{-mno-error-reloc} disables the error,
26661 @option{-mwarn-reloc} generates a warning instead.
26662
26663 @item -msafe-dma
26664 @itemx -munsafe-dma
26665 @opindex msafe-dma
26666 @opindex munsafe-dma
26667
26668 Instructions that initiate or test completion of DMA must not be
26669 reordered with respect to loads and stores of the memory that is being
26670 accessed.
26671 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26672 memory accesses, but that can lead to inefficient code in places where the
26673 memory is known to not change. Rather than mark the memory as volatile,
26674 you can use @option{-msafe-dma} to tell the compiler to treat
26675 the DMA instructions as potentially affecting all memory.
26676
26677 @item -mbranch-hints
26678 @opindex mbranch-hints
26679
26680 By default, GCC generates a branch hint instruction to avoid
26681 pipeline stalls for always-taken or probably-taken branches. A hint
26682 is not generated closer than 8 instructions away from its branch.
26683 There is little reason to disable them, except for debugging purposes,
26684 or to make an object a little bit smaller.
26685
26686 @item -msmall-mem
26687 @itemx -mlarge-mem
26688 @opindex msmall-mem
26689 @opindex mlarge-mem
26690
26691 By default, GCC generates code assuming that addresses are never larger
26692 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26693 a full 32-bit address.
26694
26695 @item -mstdmain
26696 @opindex mstdmain
26697
26698 By default, GCC links against startup code that assumes the SPU-style
26699 main function interface (which has an unconventional parameter list).
26700 With @option{-mstdmain}, GCC links your program against startup
26701 code that assumes a C99-style interface to @code{main}, including a
26702 local copy of @code{argv} strings.
26703
26704 @item -mfixed-range=@var{register-range}
26705 @opindex mfixed-range
26706 Generate code treating the given register range as fixed registers.
26707 A fixed register is one that the register allocator cannot use. This is
26708 useful when compiling kernel code. A register range is specified as
26709 two registers separated by a dash. Multiple register ranges can be
26710 specified separated by a comma.
26711
26712 @item -mea32
26713 @itemx -mea64
26714 @opindex mea32
26715 @opindex mea64
26716 Compile code assuming that pointers to the PPU address space accessed
26717 via the @code{__ea} named address space qualifier are either 32 or 64
26718 bits wide. The default is 32 bits. As this is an ABI-changing option,
26719 all object code in an executable must be compiled with the same setting.
26720
26721 @item -maddress-space-conversion
26722 @itemx -mno-address-space-conversion
26723 @opindex maddress-space-conversion
26724 @opindex mno-address-space-conversion
26725 Allow/disallow treating the @code{__ea} address space as superset
26726 of the generic address space. This enables explicit type casts
26727 between @code{__ea} and generic pointer as well as implicit
26728 conversions of generic pointers to @code{__ea} pointers. The
26729 default is to allow address space pointer conversions.
26730
26731 @item -mcache-size=@var{cache-size}
26732 @opindex mcache-size
26733 This option controls the version of libgcc that the compiler links to an
26734 executable and selects a software-managed cache for accessing variables
26735 in the @code{__ea} address space with a particular cache size. Possible
26736 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26737 and @samp{128}. The default cache size is 64KB.
26738
26739 @item -matomic-updates
26740 @itemx -mno-atomic-updates
26741 @opindex matomic-updates
26742 @opindex mno-atomic-updates
26743 This option controls the version of libgcc that the compiler links to an
26744 executable and selects whether atomic updates to the software-managed
26745 cache of PPU-side variables are used. If you use atomic updates, changes
26746 to a PPU variable from SPU code using the @code{__ea} named address space
26747 qualifier do not interfere with changes to other PPU variables residing
26748 in the same cache line from PPU code. If you do not use atomic updates,
26749 such interference may occur; however, writing back cache lines is
26750 more efficient. The default behavior is to use atomic updates.
26751
26752 @item -mdual-nops
26753 @itemx -mdual-nops=@var{n}
26754 @opindex mdual-nops
26755 By default, GCC inserts NOPs to increase dual issue when it expects
26756 it to increase performance. @var{n} can be a value from 0 to 10. A
26757 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26758 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26759
26760 @item -mhint-max-nops=@var{n}
26761 @opindex mhint-max-nops
26762 Maximum number of NOPs to insert for a branch hint. A branch hint must
26763 be at least 8 instructions away from the branch it is affecting. GCC
26764 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26765 generate the branch hint.
26766
26767 @item -mhint-max-distance=@var{n}
26768 @opindex mhint-max-distance
26769 The encoding of the branch hint instruction limits the hint to be within
26770 256 instructions of the branch it is affecting. By default, GCC makes
26771 sure it is within 125.
26772
26773 @item -msafe-hints
26774 @opindex msafe-hints
26775 Work around a hardware bug that causes the SPU to stall indefinitely.
26776 By default, GCC inserts the @code{hbrp} instruction to make sure
26777 this stall won't happen.
26778
26779 @end table
26780
26781 @node System V Options
26782 @subsection Options for System V
26783
26784 These additional options are available on System V Release 4 for
26785 compatibility with other compilers on those systems:
26786
26787 @table @gcctabopt
26788 @item -G
26789 @opindex G
26790 Create a shared object.
26791 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26792
26793 @item -Qy
26794 @opindex Qy
26795 Identify the versions of each tool used by the compiler, in a
26796 @code{.ident} assembler directive in the output.
26797
26798 @item -Qn
26799 @opindex Qn
26800 Refrain from adding @code{.ident} directives to the output file (this is
26801 the default).
26802
26803 @item -YP,@var{dirs}
26804 @opindex YP
26805 Search the directories @var{dirs}, and no others, for libraries
26806 specified with @option{-l}.
26807
26808 @item -Ym,@var{dir}
26809 @opindex Ym
26810 Look in the directory @var{dir} to find the M4 preprocessor.
26811 The assembler uses this option.
26812 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26813 @c the generic assembler that comes with Solaris takes just -Ym.
26814 @end table
26815
26816 @node TILE-Gx Options
26817 @subsection TILE-Gx Options
26818 @cindex TILE-Gx options
26819
26820 These @samp{-m} options are supported on the TILE-Gx:
26821
26822 @table @gcctabopt
26823 @item -mcmodel=small
26824 @opindex mcmodel=small
26825 Generate code for the small model. The distance for direct calls is
26826 limited to 500M in either direction. PC-relative addresses are 32
26827 bits. Absolute addresses support the full address range.
26828
26829 @item -mcmodel=large
26830 @opindex mcmodel=large
26831 Generate code for the large model. There is no limitation on call
26832 distance, pc-relative addresses, or absolute addresses.
26833
26834 @item -mcpu=@var{name}
26835 @opindex mcpu
26836 Selects the type of CPU to be targeted. Currently the only supported
26837 type is @samp{tilegx}.
26838
26839 @item -m32
26840 @itemx -m64
26841 @opindex m32
26842 @opindex m64
26843 Generate code for a 32-bit or 64-bit environment. The 32-bit
26844 environment sets int, long, and pointer to 32 bits. The 64-bit
26845 environment sets int to 32 bits and long and pointer to 64 bits.
26846
26847 @item -mbig-endian
26848 @itemx -mlittle-endian
26849 @opindex mbig-endian
26850 @opindex mlittle-endian
26851 Generate code in big/little endian mode, respectively.
26852 @end table
26853
26854 @node TILEPro Options
26855 @subsection TILEPro Options
26856 @cindex TILEPro options
26857
26858 These @samp{-m} options are supported on the TILEPro:
26859
26860 @table @gcctabopt
26861 @item -mcpu=@var{name}
26862 @opindex mcpu
26863 Selects the type of CPU to be targeted. Currently the only supported
26864 type is @samp{tilepro}.
26865
26866 @item -m32
26867 @opindex m32
26868 Generate code for a 32-bit environment, which sets int, long, and
26869 pointer to 32 bits. This is the only supported behavior so the flag
26870 is essentially ignored.
26871 @end table
26872
26873 @node V850 Options
26874 @subsection V850 Options
26875 @cindex V850 Options
26876
26877 These @samp{-m} options are defined for V850 implementations:
26878
26879 @table @gcctabopt
26880 @item -mlong-calls
26881 @itemx -mno-long-calls
26882 @opindex mlong-calls
26883 @opindex mno-long-calls
26884 Treat all calls as being far away (near). If calls are assumed to be
26885 far away, the compiler always loads the function's address into a
26886 register, and calls indirect through the pointer.
26887
26888 @item -mno-ep
26889 @itemx -mep
26890 @opindex mno-ep
26891 @opindex mep
26892 Do not optimize (do optimize) basic blocks that use the same index
26893 pointer 4 or more times to copy pointer into the @code{ep} register, and
26894 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26895 option is on by default if you optimize.
26896
26897 @item -mno-prolog-function
26898 @itemx -mprolog-function
26899 @opindex mno-prolog-function
26900 @opindex mprolog-function
26901 Do not use (do use) external functions to save and restore registers
26902 at the prologue and epilogue of a function. The external functions
26903 are slower, but use less code space if more than one function saves
26904 the same number of registers. The @option{-mprolog-function} option
26905 is on by default if you optimize.
26906
26907 @item -mspace
26908 @opindex mspace
26909 Try to make the code as small as possible. At present, this just turns
26910 on the @option{-mep} and @option{-mprolog-function} options.
26911
26912 @item -mtda=@var{n}
26913 @opindex mtda
26914 Put static or global variables whose size is @var{n} bytes or less into
26915 the tiny data area that register @code{ep} points to. The tiny data
26916 area can hold up to 256 bytes in total (128 bytes for byte references).
26917
26918 @item -msda=@var{n}
26919 @opindex msda
26920 Put static or global variables whose size is @var{n} bytes or less into
26921 the small data area that register @code{gp} points to. The small data
26922 area can hold up to 64 kilobytes.
26923
26924 @item -mzda=@var{n}
26925 @opindex mzda
26926 Put static or global variables whose size is @var{n} bytes or less into
26927 the first 32 kilobytes of memory.
26928
26929 @item -mv850
26930 @opindex mv850
26931 Specify that the target processor is the V850.
26932
26933 @item -mv850e3v5
26934 @opindex mv850e3v5
26935 Specify that the target processor is the V850E3V5. The preprocessor
26936 constant @code{__v850e3v5__} is defined if this option is used.
26937
26938 @item -mv850e2v4
26939 @opindex mv850e2v4
26940 Specify that the target processor is the V850E3V5. This is an alias for
26941 the @option{-mv850e3v5} option.
26942
26943 @item -mv850e2v3
26944 @opindex mv850e2v3
26945 Specify that the target processor is the V850E2V3. The preprocessor
26946 constant @code{__v850e2v3__} is defined if this option is used.
26947
26948 @item -mv850e2
26949 @opindex mv850e2
26950 Specify that the target processor is the V850E2. The preprocessor
26951 constant @code{__v850e2__} is defined if this option is used.
26952
26953 @item -mv850e1
26954 @opindex mv850e1
26955 Specify that the target processor is the V850E1. The preprocessor
26956 constants @code{__v850e1__} and @code{__v850e__} are defined if
26957 this option is used.
26958
26959 @item -mv850es
26960 @opindex mv850es
26961 Specify that the target processor is the V850ES. This is an alias for
26962 the @option{-mv850e1} option.
26963
26964 @item -mv850e
26965 @opindex mv850e
26966 Specify that the target processor is the V850E@. The preprocessor
26967 constant @code{__v850e__} is defined if this option is used.
26968
26969 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26970 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26971 are defined then a default target processor is chosen and the
26972 relevant @samp{__v850*__} preprocessor constant is defined.
26973
26974 The preprocessor constants @code{__v850} and @code{__v851__} are always
26975 defined, regardless of which processor variant is the target.
26976
26977 @item -mdisable-callt
26978 @itemx -mno-disable-callt
26979 @opindex mdisable-callt
26980 @opindex mno-disable-callt
26981 This option suppresses generation of the @code{CALLT} instruction for the
26982 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26983 architecture.
26984
26985 This option is enabled by default when the RH850 ABI is
26986 in use (see @option{-mrh850-abi}), and disabled by default when the
26987 GCC ABI is in use. If @code{CALLT} instructions are being generated
26988 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26989
26990 @item -mrelax
26991 @itemx -mno-relax
26992 @opindex mrelax
26993 @opindex mno-relax
26994 Pass on (or do not pass on) the @option{-mrelax} command-line option
26995 to the assembler.
26996
26997 @item -mlong-jumps
26998 @itemx -mno-long-jumps
26999 @opindex mlong-jumps
27000 @opindex mno-long-jumps
27001 Disable (or re-enable) the generation of PC-relative jump instructions.
27002
27003 @item -msoft-float
27004 @itemx -mhard-float
27005 @opindex msoft-float
27006 @opindex mhard-float
27007 Disable (or re-enable) the generation of hardware floating point
27008 instructions. This option is only significant when the target
27009 architecture is @samp{V850E2V3} or higher. If hardware floating point
27010 instructions are being generated then the C preprocessor symbol
27011 @code{__FPU_OK__} is defined, otherwise the symbol
27012 @code{__NO_FPU__} is defined.
27013
27014 @item -mloop
27015 @opindex mloop
27016 Enables the use of the e3v5 LOOP instruction. The use of this
27017 instruction is not enabled by default when the e3v5 architecture is
27018 selected because its use is still experimental.
27019
27020 @item -mrh850-abi
27021 @itemx -mghs
27022 @opindex mrh850-abi
27023 @opindex mghs
27024 Enables support for the RH850 version of the V850 ABI. This is the
27025 default. With this version of the ABI the following rules apply:
27026
27027 @itemize
27028 @item
27029 Integer sized structures and unions are returned via a memory pointer
27030 rather than a register.
27031
27032 @item
27033 Large structures and unions (more than 8 bytes in size) are passed by
27034 value.
27035
27036 @item
27037 Functions are aligned to 16-bit boundaries.
27038
27039 @item
27040 The @option{-m8byte-align} command-line option is supported.
27041
27042 @item
27043 The @option{-mdisable-callt} command-line option is enabled by
27044 default. The @option{-mno-disable-callt} command-line option is not
27045 supported.
27046 @end itemize
27047
27048 When this version of the ABI is enabled the C preprocessor symbol
27049 @code{__V850_RH850_ABI__} is defined.
27050
27051 @item -mgcc-abi
27052 @opindex mgcc-abi
27053 Enables support for the old GCC version of the V850 ABI. With this
27054 version of the ABI the following rules apply:
27055
27056 @itemize
27057 @item
27058 Integer sized structures and unions are returned in register @code{r10}.
27059
27060 @item
27061 Large structures and unions (more than 8 bytes in size) are passed by
27062 reference.
27063
27064 @item
27065 Functions are aligned to 32-bit boundaries, unless optimizing for
27066 size.
27067
27068 @item
27069 The @option{-m8byte-align} command-line option is not supported.
27070
27071 @item
27072 The @option{-mdisable-callt} command-line option is supported but not
27073 enabled by default.
27074 @end itemize
27075
27076 When this version of the ABI is enabled the C preprocessor symbol
27077 @code{__V850_GCC_ABI__} is defined.
27078
27079 @item -m8byte-align
27080 @itemx -mno-8byte-align
27081 @opindex m8byte-align
27082 @opindex mno-8byte-align
27083 Enables support for @code{double} and @code{long long} types to be
27084 aligned on 8-byte boundaries. The default is to restrict the
27085 alignment of all objects to at most 4-bytes. When
27086 @option{-m8byte-align} is in effect the C preprocessor symbol
27087 @code{__V850_8BYTE_ALIGN__} is defined.
27088
27089 @item -mbig-switch
27090 @opindex mbig-switch
27091 Generate code suitable for big switch tables. Use this option only if
27092 the assembler/linker complain about out of range branches within a switch
27093 table.
27094
27095 @item -mapp-regs
27096 @opindex mapp-regs
27097 This option causes r2 and r5 to be used in the code generated by
27098 the compiler. This setting is the default.
27099
27100 @item -mno-app-regs
27101 @opindex mno-app-regs
27102 This option causes r2 and r5 to be treated as fixed registers.
27103
27104 @end table
27105
27106 @node VAX Options
27107 @subsection VAX Options
27108 @cindex VAX options
27109
27110 These @samp{-m} options are defined for the VAX:
27111
27112 @table @gcctabopt
27113 @item -munix
27114 @opindex munix
27115 Do not output certain jump instructions (@code{aobleq} and so on)
27116 that the Unix assembler for the VAX cannot handle across long
27117 ranges.
27118
27119 @item -mgnu
27120 @opindex mgnu
27121 Do output those jump instructions, on the assumption that the
27122 GNU assembler is being used.
27123
27124 @item -mg
27125 @opindex mg
27126 Output code for G-format floating-point numbers instead of D-format.
27127 @end table
27128
27129 @node Visium Options
27130 @subsection Visium Options
27131 @cindex Visium options
27132
27133 @table @gcctabopt
27134
27135 @item -mdebug
27136 @opindex mdebug
27137 A program which performs file I/O and is destined to run on an MCM target
27138 should be linked with this option. It causes the libraries libc.a and
27139 libdebug.a to be linked. The program should be run on the target under
27140 the control of the GDB remote debugging stub.
27141
27142 @item -msim
27143 @opindex msim
27144 A program which performs file I/O and is destined to run on the simulator
27145 should be linked with option. This causes libraries libc.a and libsim.a to
27146 be linked.
27147
27148 @item -mfpu
27149 @itemx -mhard-float
27150 @opindex mfpu
27151 @opindex mhard-float
27152 Generate code containing floating-point instructions. This is the
27153 default.
27154
27155 @item -mno-fpu
27156 @itemx -msoft-float
27157 @opindex mno-fpu
27158 @opindex msoft-float
27159 Generate code containing library calls for floating-point.
27160
27161 @option{-msoft-float} changes the calling convention in the output file;
27162 therefore, it is only useful if you compile @emph{all} of a program with
27163 this option. In particular, you need to compile @file{libgcc.a}, the
27164 library that comes with GCC, with @option{-msoft-float} in order for
27165 this to work.
27166
27167 @item -mcpu=@var{cpu_type}
27168 @opindex mcpu
27169 Set the instruction set, register set, and instruction scheduling parameters
27170 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27171 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27172
27173 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27174
27175 By default (unless configured otherwise), GCC generates code for the GR5
27176 variant of the Visium architecture.
27177
27178 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27179 architecture. The only difference from GR5 code is that the compiler will
27180 generate block move instructions.
27181
27182 @item -mtune=@var{cpu_type}
27183 @opindex mtune
27184 Set the instruction scheduling parameters for machine type @var{cpu_type},
27185 but do not set the instruction set or register set that the option
27186 @option{-mcpu=@var{cpu_type}} would.
27187
27188 @item -msv-mode
27189 @opindex msv-mode
27190 Generate code for the supervisor mode, where there are no restrictions on
27191 the access to general registers. This is the default.
27192
27193 @item -muser-mode
27194 @opindex muser-mode
27195 Generate code for the user mode, where the access to some general registers
27196 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27197 mode; on the GR6, only registers r29 to r31 are affected.
27198 @end table
27199
27200 @node VMS Options
27201 @subsection VMS Options
27202
27203 These @samp{-m} options are defined for the VMS implementations:
27204
27205 @table @gcctabopt
27206 @item -mvms-return-codes
27207 @opindex mvms-return-codes
27208 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27209 condition (e.g.@: error) codes.
27210
27211 @item -mdebug-main=@var{prefix}
27212 @opindex mdebug-main=@var{prefix}
27213 Flag the first routine whose name starts with @var{prefix} as the main
27214 routine for the debugger.
27215
27216 @item -mmalloc64
27217 @opindex mmalloc64
27218 Default to 64-bit memory allocation routines.
27219
27220 @item -mpointer-size=@var{size}
27221 @opindex mpointer-size=@var{size}
27222 Set the default size of pointers. Possible options for @var{size} are
27223 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27224 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27225 The later option disables @code{pragma pointer_size}.
27226 @end table
27227
27228 @node VxWorks Options
27229 @subsection VxWorks Options
27230 @cindex VxWorks Options
27231
27232 The options in this section are defined for all VxWorks targets.
27233 Options specific to the target hardware are listed with the other
27234 options for that target.
27235
27236 @table @gcctabopt
27237 @item -mrtp
27238 @opindex mrtp
27239 GCC can generate code for both VxWorks kernels and real time processes
27240 (RTPs). This option switches from the former to the latter. It also
27241 defines the preprocessor macro @code{__RTP__}.
27242
27243 @item -non-static
27244 @opindex non-static
27245 Link an RTP executable against shared libraries rather than static
27246 libraries. The options @option{-static} and @option{-shared} can
27247 also be used for RTPs (@pxref{Link Options}); @option{-static}
27248 is the default.
27249
27250 @item -Bstatic
27251 @itemx -Bdynamic
27252 @opindex Bstatic
27253 @opindex Bdynamic
27254 These options are passed down to the linker. They are defined for
27255 compatibility with Diab.
27256
27257 @item -Xbind-lazy
27258 @opindex Xbind-lazy
27259 Enable lazy binding of function calls. This option is equivalent to
27260 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27261
27262 @item -Xbind-now
27263 @opindex Xbind-now
27264 Disable lazy binding of function calls. This option is the default and
27265 is defined for compatibility with Diab.
27266 @end table
27267
27268 @node x86 Options
27269 @subsection x86 Options
27270 @cindex x86 Options
27271
27272 These @samp{-m} options are defined for the x86 family of computers.
27273
27274 @table @gcctabopt
27275
27276 @item -march=@var{cpu-type}
27277 @opindex march
27278 Generate instructions for the machine type @var{cpu-type}. In contrast to
27279 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27280 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27281 to generate code that may not run at all on processors other than the one
27282 indicated. Specifying @option{-march=@var{cpu-type}} implies
27283 @option{-mtune=@var{cpu-type}}.
27284
27285 The choices for @var{cpu-type} are:
27286
27287 @table @samp
27288 @item native
27289 This selects the CPU to generate code for at compilation time by determining
27290 the processor type of the compiling machine. Using @option{-march=native}
27291 enables all instruction subsets supported by the local machine (hence
27292 the result might not run on different machines). Using @option{-mtune=native}
27293 produces code optimized for the local machine under the constraints
27294 of the selected instruction set.
27295
27296 @item x86-64
27297 A generic CPU with 64-bit extensions.
27298
27299 @item i386
27300 Original Intel i386 CPU@.
27301
27302 @item i486
27303 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27304
27305 @item i586
27306 @itemx pentium
27307 Intel Pentium CPU with no MMX support.
27308
27309 @item lakemont
27310 Intel Lakemont MCU, based on Intel Pentium CPU.
27311
27312 @item pentium-mmx
27313 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27314
27315 @item pentiumpro
27316 Intel Pentium Pro CPU@.
27317
27318 @item i686
27319 When used with @option{-march}, the Pentium Pro
27320 instruction set is used, so the code runs on all i686 family chips.
27321 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27322
27323 @item pentium2
27324 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27325 support.
27326
27327 @item pentium3
27328 @itemx pentium3m
27329 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27330 set support.
27331
27332 @item pentium-m
27333 Intel Pentium M; low-power version of Intel Pentium III CPU
27334 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27335
27336 @item pentium4
27337 @itemx pentium4m
27338 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27339
27340 @item prescott
27341 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27342 set support.
27343
27344 @item nocona
27345 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27346 SSE2 and SSE3 instruction set support.
27347
27348 @item core2
27349 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27350 instruction set support.
27351
27352 @item nehalem
27353 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27354 SSE4.1, SSE4.2 and POPCNT instruction set support.
27355
27356 @item westmere
27357 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27358 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27359
27360 @item sandybridge
27361 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27362 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27363
27364 @item ivybridge
27365 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27366 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27367 instruction set support.
27368
27369 @item haswell
27370 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27371 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27372 BMI, BMI2 and F16C instruction set support.
27373
27374 @item broadwell
27375 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27376 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27377 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27378
27379 @item skylake
27380 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27381 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27382 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27383 XSAVES instruction set support.
27384
27385 @item bonnell
27386 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27387 instruction set support.
27388
27389 @item silvermont
27390 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27391 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27392
27393 @item goldmont
27394 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27395 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27396 instruction set support.
27397
27398 @item goldmont-plus
27399 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27400 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27401 PTWRITE, RDPID, SGX and UMIP instruction set support.
27402
27403 @item tremont
27404 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27405 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27406 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27407
27408 @item knl
27409 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27410 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27411 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27412 AVX512CD instruction set support.
27413
27414 @item knm
27415 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27416 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27417 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27418 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27419
27420 @item skylake-avx512
27421 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27422 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27423 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27424 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27425
27426 @item cannonlake
27427 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27428 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27429 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27430 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27431 AVX512IFMA, SHA and UMIP instruction set support.
27432
27433 @item icelake-client
27434 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27435 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27436 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27437 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27438 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27439 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27440
27441 @item icelake-server
27442 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27443 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27444 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27445 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27446 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27447 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27448 set support.
27449
27450 @item cascadelake
27451 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27452 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27453 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27454 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27455
27456 @item k6
27457 AMD K6 CPU with MMX instruction set support.
27458
27459 @item k6-2
27460 @itemx k6-3
27461 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27462
27463 @item athlon
27464 @itemx athlon-tbird
27465 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27466 support.
27467
27468 @item athlon-4
27469 @itemx athlon-xp
27470 @itemx athlon-mp
27471 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27472 instruction set support.
27473
27474 @item k8
27475 @itemx opteron
27476 @itemx athlon64
27477 @itemx athlon-fx
27478 Processors based on the AMD K8 core with x86-64 instruction set support,
27479 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27480 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27481 instruction set extensions.)
27482
27483 @item k8-sse3
27484 @itemx opteron-sse3
27485 @itemx athlon64-sse3
27486 Improved versions of AMD K8 cores with SSE3 instruction set support.
27487
27488 @item amdfam10
27489 @itemx barcelona
27490 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27491 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27492 instruction set extensions.)
27493
27494 @item bdver1
27495 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27496 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27497 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27498 @item bdver2
27499 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27500 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27501 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27502 extensions.)
27503 @item bdver3
27504 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27505 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27506 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27507 64-bit instruction set extensions.
27508 @item bdver4
27509 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27510 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27511 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27512 SSE4.2, ABM and 64-bit instruction set extensions.
27513
27514 @item znver1
27515 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27516 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27517 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27518 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27519 instruction set extensions.
27520 @item znver2
27521 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27522 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27523 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27524 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27525 instruction set extensions.)
27526
27527
27528 @item btver1
27529 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27530 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27531 instruction set extensions.)
27532
27533 @item btver2
27534 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27535 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27536 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27537
27538 @item winchip-c6
27539 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27540 set support.
27541
27542 @item winchip2
27543 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27544 instruction set support.
27545
27546 @item c3
27547 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27548 (No scheduling is implemented for this chip.)
27549
27550 @item c3-2
27551 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27552 (No scheduling is implemented for this chip.)
27553
27554 @item c7
27555 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27556 (No scheduling is implemented for this chip.)
27557
27558 @item samuel-2
27559 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27560 (No scheduling is implemented for this chip.)
27561
27562 @item nehemiah
27563 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27564 (No scheduling is implemented for this chip.)
27565
27566 @item esther
27567 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27568 (No scheduling is implemented for this chip.)
27569
27570 @item eden-x2
27571 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27572 (No scheduling is implemented for this chip.)
27573
27574 @item eden-x4
27575 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27576 AVX and AVX2 instruction set support.
27577 (No scheduling is implemented for this chip.)
27578
27579 @item nano
27580 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27581 instruction set support.
27582 (No scheduling is implemented for this chip.)
27583
27584 @item nano-1000
27585 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27586 instruction set support.
27587 (No scheduling is implemented for this chip.)
27588
27589 @item nano-2000
27590 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27591 instruction set support.
27592 (No scheduling is implemented for this chip.)
27593
27594 @item nano-3000
27595 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27596 instruction set support.
27597 (No scheduling is implemented for this chip.)
27598
27599 @item nano-x2
27600 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27601 instruction set support.
27602 (No scheduling is implemented for this chip.)
27603
27604 @item nano-x4
27605 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27606 instruction set support.
27607 (No scheduling is implemented for this chip.)
27608
27609 @item geode
27610 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27611 @end table
27612
27613 @item -mtune=@var{cpu-type}
27614 @opindex mtune
27615 Tune to @var{cpu-type} everything applicable about the generated code, except
27616 for the ABI and the set of available instructions.
27617 While picking a specific @var{cpu-type} schedules things appropriately
27618 for that particular chip, the compiler does not generate any code that
27619 cannot run on the default machine type unless you use a
27620 @option{-march=@var{cpu-type}} option.
27621 For example, if GCC is configured for i686-pc-linux-gnu
27622 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27623 but still runs on i686 machines.
27624
27625 The choices for @var{cpu-type} are the same as for @option{-march}.
27626 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27627
27628 @table @samp
27629 @item generic
27630 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27631 If you know the CPU on which your code will run, then you should use
27632 the corresponding @option{-mtune} or @option{-march} option instead of
27633 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27634 of your application will have, then you should use this option.
27635
27636 As new processors are deployed in the marketplace, the behavior of this
27637 option will change. Therefore, if you upgrade to a newer version of
27638 GCC, code generation controlled by this option will change to reflect
27639 the processors
27640 that are most common at the time that version of GCC is released.
27641
27642 There is no @option{-march=generic} option because @option{-march}
27643 indicates the instruction set the compiler can use, and there is no
27644 generic instruction set applicable to all processors. In contrast,
27645 @option{-mtune} indicates the processor (or, in this case, collection of
27646 processors) for which the code is optimized.
27647
27648 @item intel
27649 Produce code optimized for the most current Intel processors, which are
27650 Haswell and Silvermont for this version of GCC. If you know the CPU
27651 on which your code will run, then you should use the corresponding
27652 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27653 But, if you want your application performs better on both Haswell and
27654 Silvermont, then you should use this option.
27655
27656 As new Intel processors are deployed in the marketplace, the behavior of
27657 this option will change. Therefore, if you upgrade to a newer version of
27658 GCC, code generation controlled by this option will change to reflect
27659 the most current Intel processors at the time that version of GCC is
27660 released.
27661
27662 There is no @option{-march=intel} option because @option{-march} indicates
27663 the instruction set the compiler can use, and there is no common
27664 instruction set applicable to all processors. In contrast,
27665 @option{-mtune} indicates the processor (or, in this case, collection of
27666 processors) for which the code is optimized.
27667 @end table
27668
27669 @item -mcpu=@var{cpu-type}
27670 @opindex mcpu
27671 A deprecated synonym for @option{-mtune}.
27672
27673 @item -mfpmath=@var{unit}
27674 @opindex mfpmath
27675 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27676 for @var{unit} are:
27677
27678 @table @samp
27679 @item 387
27680 Use the standard 387 floating-point coprocessor present on the majority of chips and
27681 emulated otherwise. Code compiled with this option runs almost everywhere.
27682 The temporary results are computed in 80-bit precision instead of the precision
27683 specified by the type, resulting in slightly different results compared to most
27684 of other chips. See @option{-ffloat-store} for more detailed description.
27685
27686 This is the default choice for non-Darwin x86-32 targets.
27687
27688 @item sse
27689 Use scalar floating-point instructions present in the SSE instruction set.
27690 This instruction set is supported by Pentium III and newer chips,
27691 and in the AMD line
27692 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27693 instruction set supports only single-precision arithmetic, thus the double and
27694 extended-precision arithmetic are still done using 387. A later version, present
27695 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27696 arithmetic too.
27697
27698 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27699 or @option{-msse2} switches to enable SSE extensions and make this option
27700 effective. For the x86-64 compiler, these extensions are enabled by default.
27701
27702 The resulting code should be considerably faster in the majority of cases and avoid
27703 the numerical instability problems of 387 code, but may break some existing
27704 code that expects temporaries to be 80 bits.
27705
27706 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27707 and the default choice for x86-32 targets with the SSE2 instruction set
27708 when @option{-ffast-math} is enabled.
27709
27710 @item sse,387
27711 @itemx sse+387
27712 @itemx both
27713 Attempt to utilize both instruction sets at once. This effectively doubles the
27714 amount of available registers, and on chips with separate execution units for
27715 387 and SSE the execution resources too. Use this option with care, as it is
27716 still experimental, because the GCC register allocator does not model separate
27717 functional units well, resulting in unstable performance.
27718 @end table
27719
27720 @item -masm=@var{dialect}
27721 @opindex masm=@var{dialect}
27722 Output assembly instructions using selected @var{dialect}. Also affects
27723 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27724 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27725 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27726 not support @samp{intel}.
27727
27728 @item -mieee-fp
27729 @itemx -mno-ieee-fp
27730 @opindex mieee-fp
27731 @opindex mno-ieee-fp
27732 Control whether or not the compiler uses IEEE floating-point
27733 comparisons. These correctly handle the case where the result of a
27734 comparison is unordered.
27735
27736 @item -m80387
27737 @itemx -mhard-float
27738 @opindex 80387
27739 @opindex mhard-float
27740 Generate output containing 80387 instructions for floating point.
27741
27742 @item -mno-80387
27743 @itemx -msoft-float
27744 @opindex no-80387
27745 @opindex msoft-float
27746 Generate output containing library calls for floating point.
27747
27748 @strong{Warning:} the requisite libraries are not part of GCC@.
27749 Normally the facilities of the machine's usual C compiler are used, but
27750 this cannot be done directly in cross-compilation. You must make your
27751 own arrangements to provide suitable library functions for
27752 cross-compilation.
27753
27754 On machines where a function returns floating-point results in the 80387
27755 register stack, some floating-point opcodes may be emitted even if
27756 @option{-msoft-float} is used.
27757
27758 @item -mno-fp-ret-in-387
27759 @opindex mno-fp-ret-in-387
27760 @opindex mfp-ret-in-387
27761 Do not use the FPU registers for return values of functions.
27762
27763 The usual calling convention has functions return values of types
27764 @code{float} and @code{double} in an FPU register, even if there
27765 is no FPU@. The idea is that the operating system should emulate
27766 an FPU@.
27767
27768 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27769 in ordinary CPU registers instead.
27770
27771 @item -mno-fancy-math-387
27772 @opindex mno-fancy-math-387
27773 @opindex mfancy-math-387
27774 Some 387 emulators do not support the @code{sin}, @code{cos} and
27775 @code{sqrt} instructions for the 387. Specify this option to avoid
27776 generating those instructions.
27777 This option is overridden when @option{-march}
27778 indicates that the target CPU always has an FPU and so the
27779 instruction does not need emulation. These
27780 instructions are not generated unless you also use the
27781 @option{-funsafe-math-optimizations} switch.
27782
27783 @item -malign-double
27784 @itemx -mno-align-double
27785 @opindex malign-double
27786 @opindex mno-align-double
27787 Control whether GCC aligns @code{double}, @code{long double}, and
27788 @code{long long} variables on a two-word boundary or a one-word
27789 boundary. Aligning @code{double} variables on a two-word boundary
27790 produces code that runs somewhat faster on a Pentium at the
27791 expense of more memory.
27792
27793 On x86-64, @option{-malign-double} is enabled by default.
27794
27795 @strong{Warning:} if you use the @option{-malign-double} switch,
27796 structures containing the above types are aligned differently than
27797 the published application binary interface specifications for the x86-32
27798 and are not binary compatible with structures in code compiled
27799 without that switch.
27800
27801 @item -m96bit-long-double
27802 @itemx -m128bit-long-double
27803 @opindex m96bit-long-double
27804 @opindex m128bit-long-double
27805 These switches control the size of @code{long double} type. The x86-32
27806 application binary interface specifies the size to be 96 bits,
27807 so @option{-m96bit-long-double} is the default in 32-bit mode.
27808
27809 Modern architectures (Pentium and newer) prefer @code{long double}
27810 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27811 conforming to the ABI, this is not possible. So specifying
27812 @option{-m128bit-long-double} aligns @code{long double}
27813 to a 16-byte boundary by padding the @code{long double} with an additional
27814 32-bit zero.
27815
27816 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27817 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27818
27819 Notice that neither of these options enable any extra precision over the x87
27820 standard of 80 bits for a @code{long double}.
27821
27822 @strong{Warning:} if you override the default value for your target ABI, this
27823 changes the size of
27824 structures and arrays containing @code{long double} variables,
27825 as well as modifying the function calling convention for functions taking
27826 @code{long double}. Hence they are not binary-compatible
27827 with code compiled without that switch.
27828
27829 @item -mlong-double-64
27830 @itemx -mlong-double-80
27831 @itemx -mlong-double-128
27832 @opindex mlong-double-64
27833 @opindex mlong-double-80
27834 @opindex mlong-double-128
27835 These switches control the size of @code{long double} type. A size
27836 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27837 type. This is the default for 32-bit Bionic C library. A size
27838 of 128 bits makes the @code{long double} type equivalent to the
27839 @code{__float128} type. This is the default for 64-bit Bionic C library.
27840
27841 @strong{Warning:} if you override the default value for your target ABI, this
27842 changes the size of
27843 structures and arrays containing @code{long double} variables,
27844 as well as modifying the function calling convention for functions taking
27845 @code{long double}. Hence they are not binary-compatible
27846 with code compiled without that switch.
27847
27848 @item -malign-data=@var{type}
27849 @opindex malign-data
27850 Control how GCC aligns variables. Supported values for @var{type} are
27851 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27852 and earlier, @samp{abi} uses alignment value as specified by the
27853 psABI, and @samp{cacheline} uses increased alignment value to match
27854 the cache line size. @samp{compat} is the default.
27855
27856 @item -mlarge-data-threshold=@var{threshold}
27857 @opindex mlarge-data-threshold
27858 When @option{-mcmodel=medium} is specified, data objects larger than
27859 @var{threshold} are placed in the large data section. This value must be the
27860 same across all objects linked into the binary, and defaults to 65535.
27861
27862 @item -mrtd
27863 @opindex mrtd
27864 Use a different function-calling convention, in which functions that
27865 take a fixed number of arguments return with the @code{ret @var{num}}
27866 instruction, which pops their arguments while returning. This saves one
27867 instruction in the caller since there is no need to pop the arguments
27868 there.
27869
27870 You can specify that an individual function is called with this calling
27871 sequence with the function attribute @code{stdcall}. You can also
27872 override the @option{-mrtd} option by using the function attribute
27873 @code{cdecl}. @xref{Function Attributes}.
27874
27875 @strong{Warning:} this calling convention is incompatible with the one
27876 normally used on Unix, so you cannot use it if you need to call
27877 libraries compiled with the Unix compiler.
27878
27879 Also, you must provide function prototypes for all functions that
27880 take variable numbers of arguments (including @code{printf});
27881 otherwise incorrect code is generated for calls to those
27882 functions.
27883
27884 In addition, seriously incorrect code results if you call a
27885 function with too many arguments. (Normally, extra arguments are
27886 harmlessly ignored.)
27887
27888 @item -mregparm=@var{num}
27889 @opindex mregparm
27890 Control how many registers are used to pass integer arguments. By
27891 default, no registers are used to pass arguments, and at most 3
27892 registers can be used. You can control this behavior for a specific
27893 function by using the function attribute @code{regparm}.
27894 @xref{Function Attributes}.
27895
27896 @strong{Warning:} if you use this switch, and
27897 @var{num} is nonzero, then you must build all modules with the same
27898 value, including any libraries. This includes the system libraries and
27899 startup modules.
27900
27901 @item -msseregparm
27902 @opindex msseregparm
27903 Use SSE register passing conventions for float and double arguments
27904 and return values. You can control this behavior for a specific
27905 function by using the function attribute @code{sseregparm}.
27906 @xref{Function Attributes}.
27907
27908 @strong{Warning:} if you use this switch then you must build all
27909 modules with the same value, including any libraries. This includes
27910 the system libraries and startup modules.
27911
27912 @item -mvect8-ret-in-mem
27913 @opindex mvect8-ret-in-mem
27914 Return 8-byte vectors in memory instead of MMX registers. This is the
27915 default on VxWorks to match the ABI of the Sun Studio compilers until
27916 version 12. @emph{Only} use this option if you need to remain
27917 compatible with existing code produced by those previous compiler
27918 versions or older versions of GCC@.
27919
27920 @item -mpc32
27921 @itemx -mpc64
27922 @itemx -mpc80
27923 @opindex mpc32
27924 @opindex mpc64
27925 @opindex mpc80
27926
27927 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27928 is specified, the significands of results of floating-point operations are
27929 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27930 significands of results of floating-point operations to 53 bits (double
27931 precision) and @option{-mpc80} rounds the significands of results of
27932 floating-point operations to 64 bits (extended double precision), which is
27933 the default. When this option is used, floating-point operations in higher
27934 precisions are not available to the programmer without setting the FPU
27935 control word explicitly.
27936
27937 Setting the rounding of floating-point operations to less than the default
27938 80 bits can speed some programs by 2% or more. Note that some mathematical
27939 libraries assume that extended-precision (80-bit) floating-point operations
27940 are enabled by default; routines in such libraries could suffer significant
27941 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27942 when this option is used to set the precision to less than extended precision.
27943
27944 @item -mstackrealign
27945 @opindex mstackrealign
27946 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27947 option generates an alternate prologue and epilogue that realigns the
27948 run-time stack if necessary. This supports mixing legacy codes that keep
27949 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27950 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27951 applicable to individual functions.
27952
27953 @item -mpreferred-stack-boundary=@var{num}
27954 @opindex mpreferred-stack-boundary
27955 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27956 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27957 the default is 4 (16 bytes or 128 bits).
27958
27959 @strong{Warning:} When generating code for the x86-64 architecture with
27960 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27961 used to keep the stack boundary aligned to 8 byte boundary. Since
27962 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27963 intended to be used in controlled environment where stack space is
27964 important limitation. This option leads to wrong code when functions
27965 compiled with 16 byte stack alignment (such as functions from a standard
27966 library) are called with misaligned stack. In this case, SSE
27967 instructions may lead to misaligned memory access traps. In addition,
27968 variable arguments are handled incorrectly for 16 byte aligned
27969 objects (including x87 long double and __int128), leading to wrong
27970 results. You must build all modules with
27971 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27972 includes the system libraries and startup modules.
27973
27974 @item -mincoming-stack-boundary=@var{num}
27975 @opindex mincoming-stack-boundary
27976 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27977 boundary. If @option{-mincoming-stack-boundary} is not specified,
27978 the one specified by @option{-mpreferred-stack-boundary} is used.
27979
27980 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27981 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27982 suffer significant run time performance penalties. On Pentium III, the
27983 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27984 properly if it is not 16-byte aligned.
27985
27986 To ensure proper alignment of this values on the stack, the stack boundary
27987 must be as aligned as that required by any value stored on the stack.
27988 Further, every function must be generated such that it keeps the stack
27989 aligned. Thus calling a function compiled with a higher preferred
27990 stack boundary from a function compiled with a lower preferred stack
27991 boundary most likely misaligns the stack. It is recommended that
27992 libraries that use callbacks always use the default setting.
27993
27994 This extra alignment does consume extra stack space, and generally
27995 increases code size. Code that is sensitive to stack space usage, such
27996 as embedded systems and operating system kernels, may want to reduce the
27997 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27998
27999 @need 200
28000 @item -mmmx
28001 @opindex mmmx
28002 @need 200
28003 @itemx -msse
28004 @opindex msse
28005 @need 200
28006 @itemx -msse2
28007 @opindex msse2
28008 @need 200
28009 @itemx -msse3
28010 @opindex msse3
28011 @need 200
28012 @itemx -mssse3
28013 @opindex mssse3
28014 @need 200
28015 @itemx -msse4
28016 @opindex msse4
28017 @need 200
28018 @itemx -msse4a
28019 @opindex msse4a
28020 @need 200
28021 @itemx -msse4.1
28022 @opindex msse4.1
28023 @need 200
28024 @itemx -msse4.2
28025 @opindex msse4.2
28026 @need 200
28027 @itemx -mavx
28028 @opindex mavx
28029 @need 200
28030 @itemx -mavx2
28031 @opindex mavx2
28032 @need 200
28033 @itemx -mavx512f
28034 @opindex mavx512f
28035 @need 200
28036 @itemx -mavx512pf
28037 @opindex mavx512pf
28038 @need 200
28039 @itemx -mavx512er
28040 @opindex mavx512er
28041 @need 200
28042 @itemx -mavx512cd
28043 @opindex mavx512cd
28044 @need 200
28045 @itemx -mavx512vl
28046 @opindex mavx512vl
28047 @need 200
28048 @itemx -mavx512bw
28049 @opindex mavx512bw
28050 @need 200
28051 @itemx -mavx512dq
28052 @opindex mavx512dq
28053 @need 200
28054 @itemx -mavx512ifma
28055 @opindex mavx512ifma
28056 @need 200
28057 @itemx -mavx512vbmi
28058 @opindex mavx512vbmi
28059 @need 200
28060 @itemx -msha
28061 @opindex msha
28062 @need 200
28063 @itemx -maes
28064 @opindex maes
28065 @need 200
28066 @itemx -mpclmul
28067 @opindex mpclmul
28068 @need 200
28069 @itemx -mclflushopt
28070 @opindex mclflushopt
28071 @need 200
28072 @itemx -mclwb
28073 @opindex mclwb
28074 @need 200
28075 @itemx -mfsgsbase
28076 @opindex mfsgsbase
28077 @need 200
28078 @itemx -mptwrite
28079 @opindex mptwrite
28080 @need 200
28081 @itemx -mrdrnd
28082 @opindex mrdrnd
28083 @need 200
28084 @itemx -mf16c
28085 @opindex mf16c
28086 @need 200
28087 @itemx -mfma
28088 @opindex mfma
28089 @need 200
28090 @itemx -mpconfig
28091 @opindex mpconfig
28092 @need 200
28093 @itemx -mwbnoinvd
28094 @opindex mwbnoinvd
28095 @need 200
28096 @itemx -mfma4
28097 @opindex mfma4
28098 @need 200
28099 @itemx -mprfchw
28100 @opindex mprfchw
28101 @need 200
28102 @itemx -mrdpid
28103 @opindex mrdpid
28104 @need 200
28105 @itemx -mprefetchwt1
28106 @opindex mprefetchwt1
28107 @need 200
28108 @itemx -mrdseed
28109 @opindex mrdseed
28110 @need 200
28111 @itemx -msgx
28112 @opindex msgx
28113 @need 200
28114 @itemx -mxop
28115 @opindex mxop
28116 @need 200
28117 @itemx -mlwp
28118 @opindex mlwp
28119 @need 200
28120 @itemx -m3dnow
28121 @opindex m3dnow
28122 @need 200
28123 @itemx -m3dnowa
28124 @opindex m3dnowa
28125 @need 200
28126 @itemx -mpopcnt
28127 @opindex mpopcnt
28128 @need 200
28129 @itemx -mabm
28130 @opindex mabm
28131 @need 200
28132 @itemx -madx
28133 @opindex madx
28134 @need 200
28135 @itemx -mbmi
28136 @opindex mbmi
28137 @need 200
28138 @itemx -mbmi2
28139 @opindex mbmi2
28140 @need 200
28141 @itemx -mlzcnt
28142 @opindex mlzcnt
28143 @need 200
28144 @itemx -mfxsr
28145 @opindex mfxsr
28146 @need 200
28147 @itemx -mxsave
28148 @opindex mxsave
28149 @need 200
28150 @itemx -mxsaveopt
28151 @opindex mxsaveopt
28152 @need 200
28153 @itemx -mxsavec
28154 @opindex mxsavec
28155 @need 200
28156 @itemx -mxsaves
28157 @opindex mxsaves
28158 @need 200
28159 @itemx -mrtm
28160 @opindex mrtm
28161 @need 200
28162 @itemx -mhle
28163 @opindex mhle
28164 @need 200
28165 @itemx -mtbm
28166 @opindex mtbm
28167 @need 200
28168 @itemx -mmwaitx
28169 @opindex mmwaitx
28170 @need 200
28171 @itemx -mclzero
28172 @opindex mclzero
28173 @need 200
28174 @itemx -mpku
28175 @opindex mpku
28176 @need 200
28177 @itemx -mavx512vbmi2
28178 @opindex mavx512vbmi2
28179 @need 200
28180 @itemx -mavx512bf16
28181 @opindex mavx512bf16
28182 @need 200
28183 @itemx -mgfni
28184 @opindex mgfni
28185 @need 200
28186 @itemx -mvaes
28187 @opindex mvaes
28188 @need 200
28189 @itemx -mwaitpkg
28190 @opindex mwaitpkg
28191 @need 200
28192 @itemx -mvpclmulqdq
28193 @opindex mvpclmulqdq
28194 @need 200
28195 @itemx -mavx512bitalg
28196 @opindex mavx512bitalg
28197 @need 200
28198 @itemx -mmovdiri
28199 @opindex mmovdiri
28200 @need 200
28201 @itemx -mmovdir64b
28202 @opindex mmovdir64b
28203 @need 200
28204 @itemx -menqcmd
28205 @opindex menqcmd
28206 @need 200
28207 @itemx -mavx512vpopcntdq
28208 @opindex mavx512vpopcntdq
28209 @need 200
28210 @itemx -mavx512vp2intersect
28211 @opindex mavx512vp2intersect
28212 @need 200
28213 @itemx -mavx5124fmaps
28214 @opindex mavx5124fmaps
28215 @need 200
28216 @itemx -mavx512vnni
28217 @opindex mavx512vnni
28218 @need 200
28219 @itemx -mavx5124vnniw
28220 @opindex mavx5124vnniw
28221 @need 200
28222 @itemx -mcldemote
28223 @opindex mcldemote
28224 These switches enable the use of instructions in the MMX, SSE,
28225 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28226 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28227 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28228 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28229 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28230 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28231 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28232 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28233 extended instruction sets. Each has a corresponding @option{-mno-} option to
28234 disable use of these instructions.
28235
28236 These extensions are also available as built-in functions: see
28237 @ref{x86 Built-in Functions}, for details of the functions enabled and
28238 disabled by these switches.
28239
28240 To generate SSE/SSE2 instructions automatically from floating-point
28241 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28242
28243 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28244 generates new AVX instructions or AVX equivalence for all SSEx instructions
28245 when needed.
28246
28247 These options enable GCC to use these extended instructions in
28248 generated code, even without @option{-mfpmath=sse}. Applications that
28249 perform run-time CPU detection must compile separate files for each
28250 supported architecture, using the appropriate flags. In particular,
28251 the file containing the CPU detection code should be compiled without
28252 these options.
28253
28254 @item -mdump-tune-features
28255 @opindex mdump-tune-features
28256 This option instructs GCC to dump the names of the x86 performance
28257 tuning features and default settings. The names can be used in
28258 @option{-mtune-ctrl=@var{feature-list}}.
28259
28260 @item -mtune-ctrl=@var{feature-list}
28261 @opindex mtune-ctrl=@var{feature-list}
28262 This option is used to do fine grain control of x86 code generation features.
28263 @var{feature-list} is a comma separated list of @var{feature} names. See also
28264 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28265 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28266 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28267 developers. Using it may lead to code paths not covered by testing and can
28268 potentially result in compiler ICEs or runtime errors.
28269
28270 @item -mno-default
28271 @opindex mno-default
28272 This option instructs GCC to turn off all tunable features. See also
28273 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28274
28275 @item -mcld
28276 @opindex mcld
28277 This option instructs GCC to emit a @code{cld} instruction in the prologue
28278 of functions that use string instructions. String instructions depend on
28279 the DF flag to select between autoincrement or autodecrement mode. While the
28280 ABI specifies the DF flag to be cleared on function entry, some operating
28281 systems violate this specification by not clearing the DF flag in their
28282 exception dispatchers. The exception handler can be invoked with the DF flag
28283 set, which leads to wrong direction mode when string instructions are used.
28284 This option can be enabled by default on 32-bit x86 targets by configuring
28285 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28286 instructions can be suppressed with the @option{-mno-cld} compiler option
28287 in this case.
28288
28289 @item -mvzeroupper
28290 @opindex mvzeroupper
28291 This option instructs GCC to emit a @code{vzeroupper} instruction
28292 before a transfer of control flow out of the function to minimize
28293 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28294 intrinsics.
28295
28296 @item -mprefer-avx128
28297 @opindex mprefer-avx128
28298 This option instructs GCC to use 128-bit AVX instructions instead of
28299 256-bit AVX instructions in the auto-vectorizer.
28300
28301 @item -mprefer-vector-width=@var{opt}
28302 @opindex mprefer-vector-width
28303 This option instructs GCC to use @var{opt}-bit vector width in instructions
28304 instead of default on the selected platform.
28305
28306 @table @samp
28307 @item none
28308 No extra limitations applied to GCC other than defined by the selected platform.
28309
28310 @item 128
28311 Prefer 128-bit vector width for instructions.
28312
28313 @item 256
28314 Prefer 256-bit vector width for instructions.
28315
28316 @item 512
28317 Prefer 512-bit vector width for instructions.
28318 @end table
28319
28320 @item -mcx16
28321 @opindex mcx16
28322 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28323 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28324 objects. This is useful for atomic updates of data structures exceeding one
28325 machine word in size. The compiler uses this instruction to implement
28326 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28327 128-bit integers, a library call is always used.
28328
28329 @item -msahf
28330 @opindex msahf
28331 This option enables generation of @code{SAHF} instructions in 64-bit code.
28332 Early Intel Pentium 4 CPUs with Intel 64 support,
28333 prior to the introduction of Pentium 4 G1 step in December 2005,
28334 lacked the @code{LAHF} and @code{SAHF} instructions
28335 which are supported by AMD64.
28336 These are load and store instructions, respectively, for certain status flags.
28337 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28338 @code{drem}, and @code{remainder} built-in functions;
28339 see @ref{Other Builtins} for details.
28340
28341 @item -mmovbe
28342 @opindex mmovbe
28343 This option enables use of the @code{movbe} instruction to implement
28344 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28345
28346 @item -mshstk
28347 @opindex mshstk
28348 The @option{-mshstk} option enables shadow stack built-in functions
28349 from x86 Control-flow Enforcement Technology (CET).
28350
28351 @item -mcrc32
28352 @opindex mcrc32
28353 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28354 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28355 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28356
28357 @item -mrecip
28358 @opindex mrecip
28359 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28360 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28361 with an additional Newton-Raphson step
28362 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28363 (and their vectorized
28364 variants) for single-precision floating-point arguments. These instructions
28365 are generated only when @option{-funsafe-math-optimizations} is enabled
28366 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28367 Note that while the throughput of the sequence is higher than the throughput
28368 of the non-reciprocal instruction, the precision of the sequence can be
28369 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28370
28371 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28372 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28373 combination), and doesn't need @option{-mrecip}.
28374
28375 Also note that GCC emits the above sequence with additional Newton-Raphson step
28376 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28377 already with @option{-ffast-math} (or the above option combination), and
28378 doesn't need @option{-mrecip}.
28379
28380 @item -mrecip=@var{opt}
28381 @opindex mrecip=opt
28382 This option controls which reciprocal estimate instructions
28383 may be used. @var{opt} is a comma-separated list of options, which may
28384 be preceded by a @samp{!} to invert the option:
28385
28386 @table @samp
28387 @item all
28388 Enable all estimate instructions.
28389
28390 @item default
28391 Enable the default instructions, equivalent to @option{-mrecip}.
28392
28393 @item none
28394 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28395
28396 @item div
28397 Enable the approximation for scalar division.
28398
28399 @item vec-div
28400 Enable the approximation for vectorized division.
28401
28402 @item sqrt
28403 Enable the approximation for scalar square root.
28404
28405 @item vec-sqrt
28406 Enable the approximation for vectorized square root.
28407 @end table
28408
28409 So, for example, @option{-mrecip=all,!sqrt} enables
28410 all of the reciprocal approximations, except for square root.
28411
28412 @item -mveclibabi=@var{type}
28413 @opindex mveclibabi
28414 Specifies the ABI type to use for vectorizing intrinsics using an
28415 external library. Supported values for @var{type} are @samp{svml}
28416 for the Intel short
28417 vector math library and @samp{acml} for the AMD math core library.
28418 To use this option, both @option{-ftree-vectorize} and
28419 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28420 ABI-compatible library must be specified at link time.
28421
28422 GCC currently emits calls to @code{vmldExp2},
28423 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28424 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28425 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28426 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28427 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28428 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28429 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28430 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28431 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28432 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28433 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28434 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28435 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28436 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28437 when @option{-mveclibabi=acml} is used.
28438
28439 @item -mabi=@var{name}
28440 @opindex mabi
28441 Generate code for the specified calling convention. Permissible values
28442 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28443 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28444 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28445 You can control this behavior for specific functions by
28446 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28447 @xref{Function Attributes}.
28448
28449 @item -mforce-indirect-call
28450 @opindex mforce-indirect-call
28451 Force all calls to functions to be indirect. This is useful
28452 when using Intel Processor Trace where it generates more precise timing
28453 information for function calls.
28454
28455 @item -mmanual-endbr
28456 @opindex mmanual-endbr
28457 Insert ENDBR instruction at function entry only via the @code{cf_check}
28458 function attribute. This is useful when used with the option
28459 @option{-fcf-protection=branch} to control ENDBR insertion at the
28460 function entry.
28461
28462 @item -mcall-ms2sysv-xlogues
28463 @opindex mcall-ms2sysv-xlogues
28464 @opindex mno-call-ms2sysv-xlogues
28465 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28466 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28467 default, the code for saving and restoring these registers is emitted inline,
28468 resulting in fairly lengthy prologues and epilogues. Using
28469 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28470 use stubs in the static portion of libgcc to perform these saves and restores,
28471 thus reducing function size at the cost of a few extra instructions.
28472
28473 @item -mtls-dialect=@var{type}
28474 @opindex mtls-dialect
28475 Generate code to access thread-local storage using the @samp{gnu} or
28476 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28477 @samp{gnu2} is more efficient, but it may add compile- and run-time
28478 requirements that cannot be satisfied on all systems.
28479
28480 @item -mpush-args
28481 @itemx -mno-push-args
28482 @opindex mpush-args
28483 @opindex mno-push-args
28484 Use PUSH operations to store outgoing parameters. This method is shorter
28485 and usually equally fast as method using SUB/MOV operations and is enabled
28486 by default. In some cases disabling it may improve performance because of
28487 improved scheduling and reduced dependencies.
28488
28489 @item -maccumulate-outgoing-args
28490 @opindex maccumulate-outgoing-args
28491 If enabled, the maximum amount of space required for outgoing arguments is
28492 computed in the function prologue. This is faster on most modern CPUs
28493 because of reduced dependencies, improved scheduling and reduced stack usage
28494 when the preferred stack boundary is not equal to 2. The drawback is a notable
28495 increase in code size. This switch implies @option{-mno-push-args}.
28496
28497 @item -mthreads
28498 @opindex mthreads
28499 Support thread-safe exception handling on MinGW. Programs that rely
28500 on thread-safe exception handling must compile and link all code with the
28501 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28502 @option{-D_MT}; when linking, it links in a special thread helper library
28503 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28504
28505 @item -mms-bitfields
28506 @itemx -mno-ms-bitfields
28507 @opindex mms-bitfields
28508 @opindex mno-ms-bitfields
28509
28510 Enable/disable bit-field layout compatible with the native Microsoft
28511 Windows compiler.
28512
28513 If @code{packed} is used on a structure, or if bit-fields are used,
28514 it may be that the Microsoft ABI lays out the structure differently
28515 than the way GCC normally does. Particularly when moving packed
28516 data between functions compiled with GCC and the native Microsoft compiler
28517 (either via function call or as data in a file), it may be necessary to access
28518 either format.
28519
28520 This option is enabled by default for Microsoft Windows
28521 targets. This behavior can also be controlled locally by use of variable
28522 or type attributes. For more information, see @ref{x86 Variable Attributes}
28523 and @ref{x86 Type Attributes}.
28524
28525 The Microsoft structure layout algorithm is fairly simple with the exception
28526 of the bit-field packing.
28527 The padding and alignment of members of structures and whether a bit-field
28528 can straddle a storage-unit boundary are determine by these rules:
28529
28530 @enumerate
28531 @item Structure members are stored sequentially in the order in which they are
28532 declared: the first member has the lowest memory address and the last member
28533 the highest.
28534
28535 @item Every data object has an alignment requirement. The alignment requirement
28536 for all data except structures, unions, and arrays is either the size of the
28537 object or the current packing size (specified with either the
28538 @code{aligned} attribute or the @code{pack} pragma),
28539 whichever is less. For structures, unions, and arrays,
28540 the alignment requirement is the largest alignment requirement of its members.
28541 Every object is allocated an offset so that:
28542
28543 @smallexample
28544 offset % alignment_requirement == 0
28545 @end smallexample
28546
28547 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28548 unit if the integral types are the same size and if the next bit-field fits
28549 into the current allocation unit without crossing the boundary imposed by the
28550 common alignment requirements of the bit-fields.
28551 @end enumerate
28552
28553 MSVC interprets zero-length bit-fields in the following ways:
28554
28555 @enumerate
28556 @item If a zero-length bit-field is inserted between two bit-fields that
28557 are normally coalesced, the bit-fields are not coalesced.
28558
28559 For example:
28560
28561 @smallexample
28562 struct
28563 @{
28564 unsigned long bf_1 : 12;
28565 unsigned long : 0;
28566 unsigned long bf_2 : 12;
28567 @} t1;
28568 @end smallexample
28569
28570 @noindent
28571 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28572 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28573
28574 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28575 alignment of the zero-length bit-field is greater than the member that follows it,
28576 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28577
28578 For example:
28579
28580 @smallexample
28581 struct
28582 @{
28583 char foo : 4;
28584 short : 0;
28585 char bar;
28586 @} t2;
28587
28588 struct
28589 @{
28590 char foo : 4;
28591 short : 0;
28592 double bar;
28593 @} t3;
28594 @end smallexample
28595
28596 @noindent
28597 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28598 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28599 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28600 of the structure.
28601
28602 Taking this into account, it is important to note the following:
28603
28604 @enumerate
28605 @item If a zero-length bit-field follows a normal bit-field, the type of the
28606 zero-length bit-field may affect the alignment of the structure as whole. For
28607 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28608 normal bit-field, and is of type short.
28609
28610 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28611 still affect the alignment of the structure:
28612
28613 @smallexample
28614 struct
28615 @{
28616 char foo : 6;
28617 long : 0;
28618 @} t4;
28619 @end smallexample
28620
28621 @noindent
28622 Here, @code{t4} takes up 4 bytes.
28623 @end enumerate
28624
28625 @item Zero-length bit-fields following non-bit-field members are ignored:
28626
28627 @smallexample
28628 struct
28629 @{
28630 char foo;
28631 long : 0;
28632 char bar;
28633 @} t5;
28634 @end smallexample
28635
28636 @noindent
28637 Here, @code{t5} takes up 2 bytes.
28638 @end enumerate
28639
28640
28641 @item -mno-align-stringops
28642 @opindex mno-align-stringops
28643 @opindex malign-stringops
28644 Do not align the destination of inlined string operations. This switch reduces
28645 code size and improves performance in case the destination is already aligned,
28646 but GCC doesn't know about it.
28647
28648 @item -minline-all-stringops
28649 @opindex minline-all-stringops
28650 By default GCC inlines string operations only when the destination is
28651 known to be aligned to least a 4-byte boundary.
28652 This enables more inlining and increases code
28653 size, but may improve performance of code that depends on fast
28654 @code{memcpy} and @code{memset} for short lengths.
28655 The option enables inline expansion of @code{strlen} for all
28656 pointer alignments.
28657
28658 @item -minline-stringops-dynamically
28659 @opindex minline-stringops-dynamically
28660 For string operations of unknown size, use run-time checks with
28661 inline code for small blocks and a library call for large blocks.
28662
28663 @item -mstringop-strategy=@var{alg}
28664 @opindex mstringop-strategy=@var{alg}
28665 Override the internal decision heuristic for the particular algorithm to use
28666 for inlining string operations. The allowed values for @var{alg} are:
28667
28668 @table @samp
28669 @item rep_byte
28670 @itemx rep_4byte
28671 @itemx rep_8byte
28672 Expand using i386 @code{rep} prefix of the specified size.
28673
28674 @item byte_loop
28675 @itemx loop
28676 @itemx unrolled_loop
28677 Expand into an inline loop.
28678
28679 @item libcall
28680 Always use a library call.
28681 @end table
28682
28683 @item -mmemcpy-strategy=@var{strategy}
28684 @opindex mmemcpy-strategy=@var{strategy}
28685 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28686 should be inlined and what inline algorithm to use when the expected size
28687 of the copy operation is known. @var{strategy}
28688 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28689 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28690 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28691 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28692 in the list must be specified in increasing order. The minimal byte size for
28693 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28694 preceding range.
28695
28696 @item -mmemset-strategy=@var{strategy}
28697 @opindex mmemset-strategy=@var{strategy}
28698 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28699 @code{__builtin_memset} expansion.
28700
28701 @item -momit-leaf-frame-pointer
28702 @opindex momit-leaf-frame-pointer
28703 Don't keep the frame pointer in a register for leaf functions. This
28704 avoids the instructions to save, set up, and restore frame pointers and
28705 makes an extra register available in leaf functions. The option
28706 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28707 which might make debugging harder.
28708
28709 @item -mtls-direct-seg-refs
28710 @itemx -mno-tls-direct-seg-refs
28711 @opindex mtls-direct-seg-refs
28712 Controls whether TLS variables may be accessed with offsets from the
28713 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28714 or whether the thread base pointer must be added. Whether or not this
28715 is valid depends on the operating system, and whether it maps the
28716 segment to cover the entire TLS area.
28717
28718 For systems that use the GNU C Library, the default is on.
28719
28720 @item -msse2avx
28721 @itemx -mno-sse2avx
28722 @opindex msse2avx
28723 Specify that the assembler should encode SSE instructions with VEX
28724 prefix. The option @option{-mavx} turns this on by default.
28725
28726 @item -mfentry
28727 @itemx -mno-fentry
28728 @opindex mfentry
28729 If profiling is active (@option{-pg}), put the profiling
28730 counter call before the prologue.
28731 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28732 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28733
28734 @item -mrecord-mcount
28735 @itemx -mno-record-mcount
28736 @opindex mrecord-mcount
28737 If profiling is active (@option{-pg}), generate a __mcount_loc section
28738 that contains pointers to each profiling call. This is useful for
28739 automatically patching and out calls.
28740
28741 @item -mnop-mcount
28742 @itemx -mno-nop-mcount
28743 @opindex mnop-mcount
28744 If profiling is active (@option{-pg}), generate the calls to
28745 the profiling functions as NOPs. This is useful when they
28746 should be patched in later dynamically. This is likely only
28747 useful together with @option{-mrecord-mcount}.
28748
28749 @item -minstrument-return=@var{type}
28750 @opindex minstrument-return
28751 Instrument function exit in -pg -mfentry instrumented functions with
28752 call to specified function. This only instruments true returns ending
28753 with ret, but not sibling calls ending with jump. Valid types
28754 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28755 or @var{nop5} to generate a 5 byte nop.
28756
28757 @item -mrecord-return
28758 @itemx -mno-record-return
28759 @opindex mrecord-return
28760 Generate a __return_loc section pointing to all return instrumentation code.
28761
28762 @item -mfentry-name=@var{name}
28763 @opindex mfentry-name
28764 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28765
28766 @item -mfentry-section=@var{name}
28767 @opindex mfentry-section
28768 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28769
28770 @item -mskip-rax-setup
28771 @itemx -mno-skip-rax-setup
28772 @opindex mskip-rax-setup
28773 When generating code for the x86-64 architecture with SSE extensions
28774 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28775 register when there are no variable arguments passed in vector registers.
28776
28777 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28778 saving vector registers on stack when passing variable arguments, the
28779 impacts of this option are callees may waste some stack space,
28780 misbehave or jump to a random location. GCC 4.4 or newer don't have
28781 those issues, regardless the RAX register value.
28782
28783 @item -m8bit-idiv
28784 @itemx -mno-8bit-idiv
28785 @opindex m8bit-idiv
28786 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28787 much faster than 32-bit/64-bit integer divide. This option generates a
28788 run-time check. If both dividend and divisor are within range of 0
28789 to 255, 8-bit unsigned integer divide is used instead of
28790 32-bit/64-bit integer divide.
28791
28792 @item -mavx256-split-unaligned-load
28793 @itemx -mavx256-split-unaligned-store
28794 @opindex mavx256-split-unaligned-load
28795 @opindex mavx256-split-unaligned-store
28796 Split 32-byte AVX unaligned load and store.
28797
28798 @item -mstack-protector-guard=@var{guard}
28799 @itemx -mstack-protector-guard-reg=@var{reg}
28800 @itemx -mstack-protector-guard-offset=@var{offset}
28801 @opindex mstack-protector-guard
28802 @opindex mstack-protector-guard-reg
28803 @opindex mstack-protector-guard-offset
28804 Generate stack protection code using canary at @var{guard}. Supported
28805 locations are @samp{global} for global canary or @samp{tls} for per-thread
28806 canary in the TLS block (the default). This option has effect only when
28807 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28808
28809 With the latter choice the options
28810 @option{-mstack-protector-guard-reg=@var{reg}} and
28811 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28812 which segment register (@code{%fs} or @code{%gs}) to use as base register
28813 for reading the canary, and from what offset from that base register.
28814 The default for those is as specified in the relevant ABI.
28815
28816 @item -mgeneral-regs-only
28817 @opindex mgeneral-regs-only
28818 Generate code that uses only the general-purpose registers. This
28819 prevents the compiler from using floating-point, vector, mask and bound
28820 registers.
28821
28822 @item -mindirect-branch=@var{choice}
28823 @opindex mindirect-branch
28824 Convert indirect call and jump with @var{choice}. The default is
28825 @samp{keep}, which keeps indirect call and jump unmodified.
28826 @samp{thunk} converts indirect call and jump to call and return thunk.
28827 @samp{thunk-inline} converts indirect call and jump to inlined call
28828 and return thunk. @samp{thunk-extern} converts indirect call and jump
28829 to external call and return thunk provided in a separate object file.
28830 You can control this behavior for a specific function by using the
28831 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28832
28833 Note that @option{-mcmodel=large} is incompatible with
28834 @option{-mindirect-branch=thunk} and
28835 @option{-mindirect-branch=thunk-extern} since the thunk function may
28836 not be reachable in the large code model.
28837
28838 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28839 @option{-fcf-protection=branch} since the external thunk cannot be modified
28840 to disable control-flow check.
28841
28842 @item -mfunction-return=@var{choice}
28843 @opindex mfunction-return
28844 Convert function return with @var{choice}. The default is @samp{keep},
28845 which keeps function return unmodified. @samp{thunk} converts function
28846 return to call and return thunk. @samp{thunk-inline} converts function
28847 return to inlined call and return thunk. @samp{thunk-extern} converts
28848 function return to external call and return thunk provided in a separate
28849 object file. You can control this behavior for a specific function by
28850 using the function attribute @code{function_return}.
28851 @xref{Function Attributes}.
28852
28853 Note that @option{-mcmodel=large} is incompatible with
28854 @option{-mfunction-return=thunk} and
28855 @option{-mfunction-return=thunk-extern} since the thunk function may
28856 not be reachable in the large code model.
28857
28858
28859 @item -mindirect-branch-register
28860 @opindex mindirect-branch-register
28861 Force indirect call and jump via register.
28862
28863 @end table
28864
28865 These @samp{-m} switches are supported in addition to the above
28866 on x86-64 processors in 64-bit environments.
28867
28868 @table @gcctabopt
28869 @item -m32
28870 @itemx -m64
28871 @itemx -mx32
28872 @itemx -m16
28873 @itemx -miamcu
28874 @opindex m32
28875 @opindex m64
28876 @opindex mx32
28877 @opindex m16
28878 @opindex miamcu
28879 Generate code for a 16-bit, 32-bit or 64-bit environment.
28880 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28881 to 32 bits, and
28882 generates code that runs on any i386 system.
28883
28884 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28885 types to 64 bits, and generates code for the x86-64 architecture.
28886 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28887 and @option{-mdynamic-no-pic} options.
28888
28889 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28890 to 32 bits, and
28891 generates code for the x86-64 architecture.
28892
28893 The @option{-m16} option is the same as @option{-m32}, except for that
28894 it outputs the @code{.code16gcc} assembly directive at the beginning of
28895 the assembly output so that the binary can run in 16-bit mode.
28896
28897 The @option{-miamcu} option generates code which conforms to Intel MCU
28898 psABI. It requires the @option{-m32} option to be turned on.
28899
28900 @item -mno-red-zone
28901 @opindex mno-red-zone
28902 @opindex mred-zone
28903 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28904 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28905 stack pointer that is not modified by signal or interrupt handlers
28906 and therefore can be used for temporary data without adjusting the stack
28907 pointer. The flag @option{-mno-red-zone} disables this red zone.
28908
28909 @item -mcmodel=small
28910 @opindex mcmodel=small
28911 Generate code for the small code model: the program and its symbols must
28912 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28913 Programs can be statically or dynamically linked. This is the default
28914 code model.
28915
28916 @item -mcmodel=kernel
28917 @opindex mcmodel=kernel
28918 Generate code for the kernel code model. The kernel runs in the
28919 negative 2 GB of the address space.
28920 This model has to be used for Linux kernel code.
28921
28922 @item -mcmodel=medium
28923 @opindex mcmodel=medium
28924 Generate code for the medium model: the program is linked in the lower 2
28925 GB of the address space. Small symbols are also placed there. Symbols
28926 with sizes larger than @option{-mlarge-data-threshold} are put into
28927 large data or BSS sections and can be located above 2GB. Programs can
28928 be statically or dynamically linked.
28929
28930 @item -mcmodel=large
28931 @opindex mcmodel=large
28932 Generate code for the large model. This model makes no assumptions
28933 about addresses and sizes of sections.
28934
28935 @item -maddress-mode=long
28936 @opindex maddress-mode=long
28937 Generate code for long address mode. This is only supported for 64-bit
28938 and x32 environments. It is the default address mode for 64-bit
28939 environments.
28940
28941 @item -maddress-mode=short
28942 @opindex maddress-mode=short
28943 Generate code for short address mode. This is only supported for 32-bit
28944 and x32 environments. It is the default address mode for 32-bit and
28945 x32 environments.
28946 @end table
28947
28948 @node x86 Windows Options
28949 @subsection x86 Windows Options
28950 @cindex x86 Windows Options
28951 @cindex Windows Options for x86
28952
28953 These additional options are available for Microsoft Windows targets:
28954
28955 @table @gcctabopt
28956 @item -mconsole
28957 @opindex mconsole
28958 This option
28959 specifies that a console application is to be generated, by
28960 instructing the linker to set the PE header subsystem type
28961 required for console applications.
28962 This option is available for Cygwin and MinGW targets and is
28963 enabled by default on those targets.
28964
28965 @item -mdll
28966 @opindex mdll
28967 This option is available for Cygwin and MinGW targets. It
28968 specifies that a DLL---a dynamic link library---is to be
28969 generated, enabling the selection of the required runtime
28970 startup object and entry point.
28971
28972 @item -mnop-fun-dllimport
28973 @opindex mnop-fun-dllimport
28974 This option is available for Cygwin and MinGW targets. It
28975 specifies that the @code{dllimport} attribute should be ignored.
28976
28977 @item -mthread
28978 @opindex mthread
28979 This option is available for MinGW targets. It specifies
28980 that MinGW-specific thread support is to be used.
28981
28982 @item -municode
28983 @opindex municode
28984 This option is available for MinGW-w64 targets. It causes
28985 the @code{UNICODE} preprocessor macro to be predefined, and
28986 chooses Unicode-capable runtime startup code.
28987
28988 @item -mwin32
28989 @opindex mwin32
28990 This option is available for Cygwin and MinGW targets. It
28991 specifies that the typical Microsoft Windows predefined macros are to
28992 be set in the pre-processor, but does not influence the choice
28993 of runtime library/startup code.
28994
28995 @item -mwindows
28996 @opindex mwindows
28997 This option is available for Cygwin and MinGW targets. It
28998 specifies that a GUI application is to be generated by
28999 instructing the linker to set the PE header subsystem type
29000 appropriately.
29001
29002 @item -fno-set-stack-executable
29003 @opindex fno-set-stack-executable
29004 @opindex fset-stack-executable
29005 This option is available for MinGW targets. It specifies that
29006 the executable flag for the stack used by nested functions isn't
29007 set. This is necessary for binaries running in kernel mode of
29008 Microsoft Windows, as there the User32 API, which is used to set executable
29009 privileges, isn't available.
29010
29011 @item -fwritable-relocated-rdata
29012 @opindex fno-writable-relocated-rdata
29013 @opindex fwritable-relocated-rdata
29014 This option is available for MinGW and Cygwin targets. It specifies
29015 that relocated-data in read-only section is put into the @code{.data}
29016 section. This is a necessary for older runtimes not supporting
29017 modification of @code{.rdata} sections for pseudo-relocation.
29018
29019 @item -mpe-aligned-commons
29020 @opindex mpe-aligned-commons
29021 This option is available for Cygwin and MinGW targets. It
29022 specifies that the GNU extension to the PE file format that
29023 permits the correct alignment of COMMON variables should be
29024 used when generating code. It is enabled by default if
29025 GCC detects that the target assembler found during configuration
29026 supports the feature.
29027 @end table
29028
29029 See also under @ref{x86 Options} for standard options.
29030
29031 @node Xstormy16 Options
29032 @subsection Xstormy16 Options
29033 @cindex Xstormy16 Options
29034
29035 These options are defined for Xstormy16:
29036
29037 @table @gcctabopt
29038 @item -msim
29039 @opindex msim
29040 Choose startup files and linker script suitable for the simulator.
29041 @end table
29042
29043 @node Xtensa Options
29044 @subsection Xtensa Options
29045 @cindex Xtensa Options
29046
29047 These options are supported for Xtensa targets:
29048
29049 @table @gcctabopt
29050 @item -mconst16
29051 @itemx -mno-const16
29052 @opindex mconst16
29053 @opindex mno-const16
29054 Enable or disable use of @code{CONST16} instructions for loading
29055 constant values. The @code{CONST16} instruction is currently not a
29056 standard option from Tensilica. When enabled, @code{CONST16}
29057 instructions are always used in place of the standard @code{L32R}
29058 instructions. The use of @code{CONST16} is enabled by default only if
29059 the @code{L32R} instruction is not available.
29060
29061 @item -mfused-madd
29062 @itemx -mno-fused-madd
29063 @opindex mfused-madd
29064 @opindex mno-fused-madd
29065 Enable or disable use of fused multiply/add and multiply/subtract
29066 instructions in the floating-point option. This has no effect if the
29067 floating-point option is not also enabled. Disabling fused multiply/add
29068 and multiply/subtract instructions forces the compiler to use separate
29069 instructions for the multiply and add/subtract operations. This may be
29070 desirable in some cases where strict IEEE 754-compliant results are
29071 required: the fused multiply add/subtract instructions do not round the
29072 intermediate result, thereby producing results with @emph{more} bits of
29073 precision than specified by the IEEE standard. Disabling fused multiply
29074 add/subtract instructions also ensures that the program output is not
29075 sensitive to the compiler's ability to combine multiply and add/subtract
29076 operations.
29077
29078 @item -mserialize-volatile
29079 @itemx -mno-serialize-volatile
29080 @opindex mserialize-volatile
29081 @opindex mno-serialize-volatile
29082 When this option is enabled, GCC inserts @code{MEMW} instructions before
29083 @code{volatile} memory references to guarantee sequential consistency.
29084 The default is @option{-mserialize-volatile}. Use
29085 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29086
29087 @item -mforce-no-pic
29088 @opindex mforce-no-pic
29089 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29090 position-independent code (PIC), this option disables PIC for compiling
29091 kernel code.
29092
29093 @item -mtext-section-literals
29094 @itemx -mno-text-section-literals
29095 @opindex mtext-section-literals
29096 @opindex mno-text-section-literals
29097 These options control the treatment of literal pools. The default is
29098 @option{-mno-text-section-literals}, which places literals in a separate
29099 section in the output file. This allows the literal pool to be placed
29100 in a data RAM/ROM, and it also allows the linker to combine literal
29101 pools from separate object files to remove redundant literals and
29102 improve code size. With @option{-mtext-section-literals}, the literals
29103 are interspersed in the text section in order to keep them as close as
29104 possible to their references. This may be necessary for large assembly
29105 files. Literals for each function are placed right before that function.
29106
29107 @item -mauto-litpools
29108 @itemx -mno-auto-litpools
29109 @opindex mauto-litpools
29110 @opindex mno-auto-litpools
29111 These options control the treatment of literal pools. The default is
29112 @option{-mno-auto-litpools}, which places literals in a separate
29113 section in the output file unless @option{-mtext-section-literals} is
29114 used. With @option{-mauto-litpools} the literals are interspersed in
29115 the text section by the assembler. Compiler does not produce explicit
29116 @code{.literal} directives and loads literals into registers with
29117 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29118 do relaxation and place literals as necessary. This option allows
29119 assembler to create several literal pools per function and assemble
29120 very big functions, which may not be possible with
29121 @option{-mtext-section-literals}.
29122
29123 @item -mtarget-align
29124 @itemx -mno-target-align
29125 @opindex mtarget-align
29126 @opindex mno-target-align
29127 When this option is enabled, GCC instructs the assembler to
29128 automatically align instructions to reduce branch penalties at the
29129 expense of some code density. The assembler attempts to widen density
29130 instructions to align branch targets and the instructions following call
29131 instructions. If there are not enough preceding safe density
29132 instructions to align a target, no widening is performed. The
29133 default is @option{-mtarget-align}. These options do not affect the
29134 treatment of auto-aligned instructions like @code{LOOP}, which the
29135 assembler always aligns, either by widening density instructions or
29136 by inserting NOP instructions.
29137
29138 @item -mlongcalls
29139 @itemx -mno-longcalls
29140 @opindex mlongcalls
29141 @opindex mno-longcalls
29142 When this option is enabled, GCC instructs the assembler to translate
29143 direct calls to indirect calls unless it can determine that the target
29144 of a direct call is in the range allowed by the call instruction. This
29145 translation typically occurs for calls to functions in other source
29146 files. Specifically, the assembler translates a direct @code{CALL}
29147 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29148 The default is @option{-mno-longcalls}. This option should be used in
29149 programs where the call target can potentially be out of range. This
29150 option is implemented in the assembler, not the compiler, so the
29151 assembly code generated by GCC still shows direct call
29152 instructions---look at the disassembled object code to see the actual
29153 instructions. Note that the assembler uses an indirect call for
29154 every cross-file call, not just those that really are out of range.
29155 @end table
29156
29157 @node zSeries Options
29158 @subsection zSeries Options
29159 @cindex zSeries options
29160
29161 These are listed under @xref{S/390 and zSeries Options}.
29162
29163
29164 @c man end
29165
29166 @node Spec Files
29167 @section Specifying Subprocesses and the Switches to Pass to Them
29168 @cindex Spec Files
29169
29170 @command{gcc} is a driver program. It performs its job by invoking a
29171 sequence of other programs to do the work of compiling, assembling and
29172 linking. GCC interprets its command-line parameters and uses these to
29173 deduce which programs it should invoke, and which command-line options
29174 it ought to place on their command lines. This behavior is controlled
29175 by @dfn{spec strings}. In most cases there is one spec string for each
29176 program that GCC can invoke, but a few programs have multiple spec
29177 strings to control their behavior. The spec strings built into GCC can
29178 be overridden by using the @option{-specs=} command-line switch to specify
29179 a spec file.
29180
29181 @dfn{Spec files} are plain-text files that are used to construct spec
29182 strings. They consist of a sequence of directives separated by blank
29183 lines. The type of directive is determined by the first non-whitespace
29184 character on the line, which can be one of the following:
29185
29186 @table @code
29187 @item %@var{command}
29188 Issues a @var{command} to the spec file processor. The commands that can
29189 appear here are:
29190
29191 @table @code
29192 @item %include <@var{file}>
29193 @cindex @code{%include}
29194 Search for @var{file} and insert its text at the current point in the
29195 specs file.
29196
29197 @item %include_noerr <@var{file}>
29198 @cindex @code{%include_noerr}
29199 Just like @samp{%include}, but do not generate an error message if the include
29200 file cannot be found.
29201
29202 @item %rename @var{old_name} @var{new_name}
29203 @cindex @code{%rename}
29204 Rename the spec string @var{old_name} to @var{new_name}.
29205
29206 @end table
29207
29208 @item *[@var{spec_name}]:
29209 This tells the compiler to create, override or delete the named spec
29210 string. All lines after this directive up to the next directive or
29211 blank line are considered to be the text for the spec string. If this
29212 results in an empty string then the spec is deleted. (Or, if the
29213 spec did not exist, then nothing happens.) Otherwise, if the spec
29214 does not currently exist a new spec is created. If the spec does
29215 exist then its contents are overridden by the text of this
29216 directive, unless the first character of that text is the @samp{+}
29217 character, in which case the text is appended to the spec.
29218
29219 @item [@var{suffix}]:
29220 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29221 and up to the next directive or blank line are considered to make up the
29222 spec string for the indicated suffix. When the compiler encounters an
29223 input file with the named suffix, it processes the spec string in
29224 order to work out how to compile that file. For example:
29225
29226 @smallexample
29227 .ZZ:
29228 z-compile -input %i
29229 @end smallexample
29230
29231 This says that any input file whose name ends in @samp{.ZZ} should be
29232 passed to the program @samp{z-compile}, which should be invoked with the
29233 command-line switch @option{-input} and with the result of performing the
29234 @samp{%i} substitution. (See below.)
29235
29236 As an alternative to providing a spec string, the text following a
29237 suffix directive can be one of the following:
29238
29239 @table @code
29240 @item @@@var{language}
29241 This says that the suffix is an alias for a known @var{language}. This is
29242 similar to using the @option{-x} command-line switch to GCC to specify a
29243 language explicitly. For example:
29244
29245 @smallexample
29246 .ZZ:
29247 @@c++
29248 @end smallexample
29249
29250 Says that .ZZ files are, in fact, C++ source files.
29251
29252 @item #@var{name}
29253 This causes an error messages saying:
29254
29255 @smallexample
29256 @var{name} compiler not installed on this system.
29257 @end smallexample
29258 @end table
29259
29260 GCC already has an extensive list of suffixes built into it.
29261 This directive adds an entry to the end of the list of suffixes, but
29262 since the list is searched from the end backwards, it is effectively
29263 possible to override earlier entries using this technique.
29264
29265 @end table
29266
29267 GCC has the following spec strings built into it. Spec files can
29268 override these strings or create their own. Note that individual
29269 targets can also add their own spec strings to this list.
29270
29271 @smallexample
29272 asm Options to pass to the assembler
29273 asm_final Options to pass to the assembler post-processor
29274 cpp Options to pass to the C preprocessor
29275 cc1 Options to pass to the C compiler
29276 cc1plus Options to pass to the C++ compiler
29277 endfile Object files to include at the end of the link
29278 link Options to pass to the linker
29279 lib Libraries to include on the command line to the linker
29280 libgcc Decides which GCC support library to pass to the linker
29281 linker Sets the name of the linker
29282 predefines Defines to be passed to the C preprocessor
29283 signed_char Defines to pass to CPP to say whether @code{char} is signed
29284 by default
29285 startfile Object files to include at the start of the link
29286 @end smallexample
29287
29288 Here is a small example of a spec file:
29289
29290 @smallexample
29291 %rename lib old_lib
29292
29293 *lib:
29294 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29295 @end smallexample
29296
29297 This example renames the spec called @samp{lib} to @samp{old_lib} and
29298 then overrides the previous definition of @samp{lib} with a new one.
29299 The new definition adds in some extra command-line options before
29300 including the text of the old definition.
29301
29302 @dfn{Spec strings} are a list of command-line options to be passed to their
29303 corresponding program. In addition, the spec strings can contain
29304 @samp{%}-prefixed sequences to substitute variable text or to
29305 conditionally insert text into the command line. Using these constructs
29306 it is possible to generate quite complex command lines.
29307
29308 Here is a table of all defined @samp{%}-sequences for spec
29309 strings. Note that spaces are not generated automatically around the
29310 results of expanding these sequences. Therefore you can concatenate them
29311 together or combine them with constant text in a single argument.
29312
29313 @table @code
29314 @item %%
29315 Substitute one @samp{%} into the program name or argument.
29316
29317 @item %i
29318 Substitute the name of the input file being processed.
29319
29320 @item %b
29321 Substitute the basename of the input file being processed.
29322 This is the substring up to (and not including) the last period
29323 and not including the directory.
29324
29325 @item %B
29326 This is the same as @samp{%b}, but include the file suffix (text after
29327 the last period).
29328
29329 @item %d
29330 Marks the argument containing or following the @samp{%d} as a
29331 temporary file name, so that that file is deleted if GCC exits
29332 successfully. Unlike @samp{%g}, this contributes no text to the
29333 argument.
29334
29335 @item %g@var{suffix}
29336 Substitute a file name that has suffix @var{suffix} and is chosen
29337 once per compilation, and mark the argument in the same way as
29338 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29339 name is now chosen in a way that is hard to predict even when previously
29340 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29341 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29342 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29343 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29344 was simply substituted with a file name chosen once per compilation,
29345 without regard to any appended suffix (which was therefore treated
29346 just like ordinary text), making such attacks more likely to succeed.
29347
29348 @item %u@var{suffix}
29349 Like @samp{%g}, but generates a new temporary file name
29350 each time it appears instead of once per compilation.
29351
29352 @item %U@var{suffix}
29353 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29354 new one if there is no such last file name. In the absence of any
29355 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29356 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29357 involves the generation of two distinct file names, one
29358 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29359 simply substituted with a file name chosen for the previous @samp{%u},
29360 without regard to any appended suffix.
29361
29362 @item %j@var{suffix}
29363 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29364 writable, and if @option{-save-temps} is not used;
29365 otherwise, substitute the name
29366 of a temporary file, just like @samp{%u}. This temporary file is not
29367 meant for communication between processes, but rather as a junk
29368 disposal mechanism.
29369
29370 @item %|@var{suffix}
29371 @itemx %m@var{suffix}
29372 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29373 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29374 all. These are the two most common ways to instruct a program that it
29375 should read from standard input or write to standard output. If you
29376 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29377 construct: see for example @file{gcc/fortran/lang-specs.h}.
29378
29379 @item %.@var{SUFFIX}
29380 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29381 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29382 terminated by the next space or %.
29383
29384 @item %w
29385 Marks the argument containing or following the @samp{%w} as the
29386 designated output file of this compilation. This puts the argument
29387 into the sequence of arguments that @samp{%o} substitutes.
29388
29389 @item %o
29390 Substitutes the names of all the output files, with spaces
29391 automatically placed around them. You should write spaces
29392 around the @samp{%o} as well or the results are undefined.
29393 @samp{%o} is for use in the specs for running the linker.
29394 Input files whose names have no recognized suffix are not compiled
29395 at all, but they are included among the output files, so they are
29396 linked.
29397
29398 @item %O
29399 Substitutes the suffix for object files. Note that this is
29400 handled specially when it immediately follows @samp{%g, %u, or %U},
29401 because of the need for those to form complete file names. The
29402 handling is such that @samp{%O} is treated exactly as if it had already
29403 been substituted, except that @samp{%g, %u, and %U} do not currently
29404 support additional @var{suffix} characters following @samp{%O} as they do
29405 following, for example, @samp{.o}.
29406
29407 @item %p
29408 Substitutes the standard macro predefinitions for the
29409 current target machine. Use this when running @command{cpp}.
29410
29411 @item %P
29412 Like @samp{%p}, but puts @samp{__} before and after the name of each
29413 predefined macro, except for macros that start with @samp{__} or with
29414 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29415 C@.
29416
29417 @item %I
29418 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29419 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29420 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29421 and @option{-imultilib} as necessary.
29422
29423 @item %s
29424 Current argument is the name of a library or startup file of some sort.
29425 Search for that file in a standard list of directories and substitute
29426 the full name found. The current working directory is included in the
29427 list of directories scanned.
29428
29429 @item %T
29430 Current argument is the name of a linker script. Search for that file
29431 in the current list of directories to scan for libraries. If the file
29432 is located insert a @option{--script} option into the command line
29433 followed by the full path name found. If the file is not found then
29434 generate an error message. Note: the current working directory is not
29435 searched.
29436
29437 @item %e@var{str}
29438 Print @var{str} as an error message. @var{str} is terminated by a newline.
29439 Use this when inconsistent options are detected.
29440
29441 @item %(@var{name})
29442 Substitute the contents of spec string @var{name} at this point.
29443
29444 @item %x@{@var{option}@}
29445 Accumulate an option for @samp{%X}.
29446
29447 @item %X
29448 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29449 spec string.
29450
29451 @item %Y
29452 Output the accumulated assembler options specified by @option{-Wa}.
29453
29454 @item %Z
29455 Output the accumulated preprocessor options specified by @option{-Wp}.
29456
29457 @item %a
29458 Process the @code{asm} spec. This is used to compute the
29459 switches to be passed to the assembler.
29460
29461 @item %A
29462 Process the @code{asm_final} spec. This is a spec string for
29463 passing switches to an assembler post-processor, if such a program is
29464 needed.
29465
29466 @item %l
29467 Process the @code{link} spec. This is the spec for computing the
29468 command line passed to the linker. Typically it makes use of the
29469 @samp{%L %G %S %D and %E} sequences.
29470
29471 @item %D
29472 Dump out a @option{-L} option for each directory that GCC believes might
29473 contain startup files. If the target supports multilibs then the
29474 current multilib directory is prepended to each of these paths.
29475
29476 @item %L
29477 Process the @code{lib} spec. This is a spec string for deciding which
29478 libraries are included on the command line to the linker.
29479
29480 @item %G
29481 Process the @code{libgcc} spec. This is a spec string for deciding
29482 which GCC support library is included on the command line to the linker.
29483
29484 @item %S
29485 Process the @code{startfile} spec. This is a spec for deciding which
29486 object files are the first ones passed to the linker. Typically
29487 this might be a file named @file{crt0.o}.
29488
29489 @item %E
29490 Process the @code{endfile} spec. This is a spec string that specifies
29491 the last object files that are passed to the linker.
29492
29493 @item %C
29494 Process the @code{cpp} spec. This is used to construct the arguments
29495 to be passed to the C preprocessor.
29496
29497 @item %1
29498 Process the @code{cc1} spec. This is used to construct the options to be
29499 passed to the actual C compiler (@command{cc1}).
29500
29501 @item %2
29502 Process the @code{cc1plus} spec. This is used to construct the options to be
29503 passed to the actual C++ compiler (@command{cc1plus}).
29504
29505 @item %*
29506 Substitute the variable part of a matched option. See below.
29507 Note that each comma in the substituted string is replaced by
29508 a single space.
29509
29510 @item %<S
29511 Remove all occurrences of @code{-S} from the command line. Note---this
29512 command is position dependent. @samp{%} commands in the spec string
29513 before this one see @code{-S}, @samp{%} commands in the spec string
29514 after this one do not.
29515
29516 @item %:@var{function}(@var{args})
29517 Call the named function @var{function}, passing it @var{args}.
29518 @var{args} is first processed as a nested spec string, then split
29519 into an argument vector in the usual fashion. The function returns
29520 a string which is processed as if it had appeared literally as part
29521 of the current spec.
29522
29523 The following built-in spec functions are provided:
29524
29525 @table @code
29526 @item @code{getenv}
29527 The @code{getenv} spec function takes two arguments: an environment
29528 variable name and a string. If the environment variable is not
29529 defined, a fatal error is issued. Otherwise, the return value is the
29530 value of the environment variable concatenated with the string. For
29531 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29532
29533 @smallexample
29534 %:getenv(TOPDIR /include)
29535 @end smallexample
29536
29537 expands to @file{/path/to/top/include}.
29538
29539 @item @code{if-exists}
29540 The @code{if-exists} spec function takes one argument, an absolute
29541 pathname to a file. If the file exists, @code{if-exists} returns the
29542 pathname. Here is a small example of its usage:
29543
29544 @smallexample
29545 *startfile:
29546 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29547 @end smallexample
29548
29549 @item @code{if-exists-else}
29550 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29551 spec function, except that it takes two arguments. The first argument is
29552 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29553 returns the pathname. If it does not exist, it returns the second argument.
29554 This way, @code{if-exists-else} can be used to select one file or another,
29555 based on the existence of the first. Here is a small example of its usage:
29556
29557 @smallexample
29558 *startfile:
29559 crt0%O%s %:if-exists(crti%O%s) \
29560 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29561 @end smallexample
29562
29563 @item @code{replace-outfile}
29564 The @code{replace-outfile} spec function takes two arguments. It looks for the
29565 first argument in the outfiles array and replaces it with the second argument. Here
29566 is a small example of its usage:
29567
29568 @smallexample
29569 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29570 @end smallexample
29571
29572 @item @code{remove-outfile}
29573 The @code{remove-outfile} spec function takes one argument. It looks for the
29574 first argument in the outfiles array and removes it. Here is a small example
29575 its usage:
29576
29577 @smallexample
29578 %:remove-outfile(-lm)
29579 @end smallexample
29580
29581 @item @code{pass-through-libs}
29582 The @code{pass-through-libs} spec function takes any number of arguments. It
29583 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29584 assumes are the names of linker input library archive files) and returns a
29585 result containing all the found arguments each prepended by
29586 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29587 intended to be passed to the LTO linker plugin.
29588
29589 @smallexample
29590 %:pass-through-libs(%G %L %G)
29591 @end smallexample
29592
29593 @item @code{print-asm-header}
29594 The @code{print-asm-header} function takes no arguments and simply
29595 prints a banner like:
29596
29597 @smallexample
29598 Assembler options
29599 =================
29600
29601 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29602 @end smallexample
29603
29604 It is used to separate compiler options from assembler options
29605 in the @option{--target-help} output.
29606 @end table
29607
29608 @item %@{S@}
29609 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29610 If that switch is not specified, this substitutes nothing. Note that
29611 the leading dash is omitted when specifying this option, and it is
29612 automatically inserted if the substitution is performed. Thus the spec
29613 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29614 and outputs the command-line option @option{-foo}.
29615
29616 @item %W@{S@}
29617 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29618 deleted on failure.
29619
29620 @item %@{S*@}
29621 Substitutes all the switches specified to GCC whose names start
29622 with @code{-S}, but which also take an argument. This is used for
29623 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29624 GCC considers @option{-o foo} as being
29625 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29626 text, including the space. Thus two arguments are generated.
29627
29628 @item %@{S*&T*@}
29629 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29630 (the order of @code{S} and @code{T} in the spec is not significant).
29631 There can be any number of ampersand-separated variables; for each the
29632 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29633
29634 @item %@{S:X@}
29635 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29636
29637 @item %@{!S:X@}
29638 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29639
29640 @item %@{S*:X@}
29641 Substitutes @code{X} if one or more switches whose names start with
29642 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29643 once, no matter how many such switches appeared. However, if @code{%*}
29644 appears somewhere in @code{X}, then @code{X} is substituted once
29645 for each matching switch, with the @code{%*} replaced by the part of
29646 that switch matching the @code{*}.
29647
29648 If @code{%*} appears as the last part of a spec sequence then a space
29649 is added after the end of the last substitution. If there is more
29650 text in the sequence, however, then a space is not generated. This
29651 allows the @code{%*} substitution to be used as part of a larger
29652 string. For example, a spec string like this:
29653
29654 @smallexample
29655 %@{mcu=*:--script=%*/memory.ld@}
29656 @end smallexample
29657
29658 @noindent
29659 when matching an option like @option{-mcu=newchip} produces:
29660
29661 @smallexample
29662 --script=newchip/memory.ld
29663 @end smallexample
29664
29665 @item %@{.S:X@}
29666 Substitutes @code{X}, if processing a file with suffix @code{S}.
29667
29668 @item %@{!.S:X@}
29669 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29670
29671 @item %@{,S:X@}
29672 Substitutes @code{X}, if processing a file for language @code{S}.
29673
29674 @item %@{!,S:X@}
29675 Substitutes @code{X}, if not processing a file for language @code{S}.
29676
29677 @item %@{S|P:X@}
29678 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29679 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29680 @code{*} sequences as well, although they have a stronger binding than
29681 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29682 alternatives must be starred, and only the first matching alternative
29683 is substituted.
29684
29685 For example, a spec string like this:
29686
29687 @smallexample
29688 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29689 @end smallexample
29690
29691 @noindent
29692 outputs the following command-line options from the following input
29693 command-line options:
29694
29695 @smallexample
29696 fred.c -foo -baz
29697 jim.d -bar -boggle
29698 -d fred.c -foo -baz -boggle
29699 -d jim.d -bar -baz -boggle
29700 @end smallexample
29701
29702 @item %@{S:X; T:Y; :D@}
29703
29704 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29705 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29706 be as many clauses as you need. This may be combined with @code{.},
29707 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29708
29709
29710 @end table
29711
29712 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29713 or similar construct can use a backslash to ignore the special meaning
29714 of the character following it, thus allowing literal matching of a
29715 character that is otherwise specially treated. For example,
29716 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29717 @option{-std=iso9899:1999} option is given.
29718
29719 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29720 construct may contain other nested @samp{%} constructs or spaces, or
29721 even newlines. They are processed as usual, as described above.
29722 Trailing white space in @code{X} is ignored. White space may also
29723 appear anywhere on the left side of the colon in these constructs,
29724 except between @code{.} or @code{*} and the corresponding word.
29725
29726 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29727 handled specifically in these constructs. If another value of
29728 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29729 @option{-W} switch is found later in the command line, the earlier
29730 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29731 just one letter, which passes all matching options.
29732
29733 The character @samp{|} at the beginning of the predicate text is used to
29734 indicate that a command should be piped to the following command, but
29735 only if @option{-pipe} is specified.
29736
29737 It is built into GCC which switches take arguments and which do not.
29738 (You might think it would be useful to generalize this to allow each
29739 compiler's spec to say which switches take arguments. But this cannot
29740 be done in a consistent fashion. GCC cannot even decide which input
29741 files have been specified without knowing which switches take arguments,
29742 and it must know which input files to compile in order to tell which
29743 compilers to run).
29744
29745 GCC also knows implicitly that arguments starting in @option{-l} are to be
29746 treated as compiler output files, and passed to the linker in their
29747 proper position among the other output files.
29748
29749 @node Environment Variables
29750 @section Environment Variables Affecting GCC
29751 @cindex environment variables
29752
29753 @c man begin ENVIRONMENT
29754 This section describes several environment variables that affect how GCC
29755 operates. Some of them work by specifying directories or prefixes to use
29756 when searching for various kinds of files. Some are used to specify other
29757 aspects of the compilation environment.
29758
29759 Note that you can also specify places to search using options such as
29760 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29761 take precedence over places specified using environment variables, which
29762 in turn take precedence over those specified by the configuration of GCC@.
29763 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29764 GNU Compiler Collection (GCC) Internals}.
29765
29766 @table @env
29767 @item LANG
29768 @itemx LC_CTYPE
29769 @c @itemx LC_COLLATE
29770 @itemx LC_MESSAGES
29771 @c @itemx LC_MONETARY
29772 @c @itemx LC_NUMERIC
29773 @c @itemx LC_TIME
29774 @itemx LC_ALL
29775 @findex LANG
29776 @findex LC_CTYPE
29777 @c @findex LC_COLLATE
29778 @findex LC_MESSAGES
29779 @c @findex LC_MONETARY
29780 @c @findex LC_NUMERIC
29781 @c @findex LC_TIME
29782 @findex LC_ALL
29783 @cindex locale
29784 These environment variables control the way that GCC uses
29785 localization information which allows GCC to work with different
29786 national conventions. GCC inspects the locale categories
29787 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29788 so. These locale categories can be set to any value supported by your
29789 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29790 Kingdom encoded in UTF-8.
29791
29792 The @env{LC_CTYPE} environment variable specifies character
29793 classification. GCC uses it to determine the character boundaries in
29794 a string; this is needed for some multibyte encodings that contain quote
29795 and escape characters that are otherwise interpreted as a string
29796 end or escape.
29797
29798 The @env{LC_MESSAGES} environment variable specifies the language to
29799 use in diagnostic messages.
29800
29801 If the @env{LC_ALL} environment variable is set, it overrides the value
29802 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29803 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29804 environment variable. If none of these variables are set, GCC
29805 defaults to traditional C English behavior.
29806
29807 @item TMPDIR
29808 @findex TMPDIR
29809 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29810 files. GCC uses temporary files to hold the output of one stage of
29811 compilation which is to be used as input to the next stage: for example,
29812 the output of the preprocessor, which is the input to the compiler
29813 proper.
29814
29815 @item GCC_COMPARE_DEBUG
29816 @findex GCC_COMPARE_DEBUG
29817 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29818 @option{-fcompare-debug} to the compiler driver. See the documentation
29819 of this option for more details.
29820
29821 @item GCC_EXEC_PREFIX
29822 @findex GCC_EXEC_PREFIX
29823 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29824 names of the subprograms executed by the compiler. No slash is added
29825 when this prefix is combined with the name of a subprogram, but you can
29826 specify a prefix that ends with a slash if you wish.
29827
29828 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29829 an appropriate prefix to use based on the pathname it is invoked with.
29830
29831 If GCC cannot find the subprogram using the specified prefix, it
29832 tries looking in the usual places for the subprogram.
29833
29834 The default value of @env{GCC_EXEC_PREFIX} is
29835 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29836 the installed compiler. In many cases @var{prefix} is the value
29837 of @code{prefix} when you ran the @file{configure} script.
29838
29839 Other prefixes specified with @option{-B} take precedence over this prefix.
29840
29841 This prefix is also used for finding files such as @file{crt0.o} that are
29842 used for linking.
29843
29844 In addition, the prefix is used in an unusual way in finding the
29845 directories to search for header files. For each of the standard
29846 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29847 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29848 replacing that beginning with the specified prefix to produce an
29849 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29850 @file{foo/bar} just before it searches the standard directory
29851 @file{/usr/local/lib/bar}.
29852 If a standard directory begins with the configured
29853 @var{prefix} then the value of @var{prefix} is replaced by
29854 @env{GCC_EXEC_PREFIX} when looking for header files.
29855
29856 @item COMPILER_PATH
29857 @findex COMPILER_PATH
29858 The value of @env{COMPILER_PATH} is a colon-separated list of
29859 directories, much like @env{PATH}. GCC tries the directories thus
29860 specified when searching for subprograms, if it cannot find the
29861 subprograms using @env{GCC_EXEC_PREFIX}.
29862
29863 @item LIBRARY_PATH
29864 @findex LIBRARY_PATH
29865 The value of @env{LIBRARY_PATH} is a colon-separated list of
29866 directories, much like @env{PATH}. When configured as a native compiler,
29867 GCC tries the directories thus specified when searching for special
29868 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29869 using GCC also uses these directories when searching for ordinary
29870 libraries for the @option{-l} option (but directories specified with
29871 @option{-L} come first).
29872
29873 @item LANG
29874 @findex LANG
29875 @cindex locale definition
29876 This variable is used to pass locale information to the compiler. One way in
29877 which this information is used is to determine the character set to be used
29878 when character literals, string literals and comments are parsed in C and C++.
29879 When the compiler is configured to allow multibyte characters,
29880 the following values for @env{LANG} are recognized:
29881
29882 @table @samp
29883 @item C-JIS
29884 Recognize JIS characters.
29885 @item C-SJIS
29886 Recognize SJIS characters.
29887 @item C-EUCJP
29888 Recognize EUCJP characters.
29889 @end table
29890
29891 If @env{LANG} is not defined, or if it has some other value, then the
29892 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29893 recognize and translate multibyte characters.
29894 @end table
29895
29896 @noindent
29897 Some additional environment variables affect the behavior of the
29898 preprocessor.
29899
29900 @include cppenv.texi
29901
29902 @c man end
29903
29904 @node Precompiled Headers
29905 @section Using Precompiled Headers
29906 @cindex precompiled headers
29907 @cindex speed of compilation
29908
29909 Often large projects have many header files that are included in every
29910 source file. The time the compiler takes to process these header files
29911 over and over again can account for nearly all of the time required to
29912 build the project. To make builds faster, GCC allows you to
29913 @dfn{precompile} a header file.
29914
29915 To create a precompiled header file, simply compile it as you would any
29916 other file, if necessary using the @option{-x} option to make the driver
29917 treat it as a C or C++ header file. You may want to use a
29918 tool like @command{make} to keep the precompiled header up-to-date when
29919 the headers it contains change.
29920
29921 A precompiled header file is searched for when @code{#include} is
29922 seen in the compilation. As it searches for the included file
29923 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29924 compiler looks for a precompiled header in each directory just before it
29925 looks for the include file in that directory. The name searched for is
29926 the name specified in the @code{#include} with @samp{.gch} appended. If
29927 the precompiled header file cannot be used, it is ignored.
29928
29929 For instance, if you have @code{#include "all.h"}, and you have
29930 @file{all.h.gch} in the same directory as @file{all.h}, then the
29931 precompiled header file is used if possible, and the original
29932 header is used otherwise.
29933
29934 Alternatively, you might decide to put the precompiled header file in a
29935 directory and use @option{-I} to ensure that directory is searched
29936 before (or instead of) the directory containing the original header.
29937 Then, if you want to check that the precompiled header file is always
29938 used, you can put a file of the same name as the original header in this
29939 directory containing an @code{#error} command.
29940
29941 This also works with @option{-include}. So yet another way to use
29942 precompiled headers, good for projects not designed with precompiled
29943 header files in mind, is to simply take most of the header files used by
29944 a project, include them from another header file, precompile that header
29945 file, and @option{-include} the precompiled header. If the header files
29946 have guards against multiple inclusion, they are skipped because
29947 they've already been included (in the precompiled header).
29948
29949 If you need to precompile the same header file for different
29950 languages, targets, or compiler options, you can instead make a
29951 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29952 header in the directory, perhaps using @option{-o}. It doesn't matter
29953 what you call the files in the directory; every precompiled header in
29954 the directory is considered. The first precompiled header
29955 encountered in the directory that is valid for this compilation is
29956 used; they're searched in no particular order.
29957
29958 There are many other possibilities, limited only by your imagination,
29959 good sense, and the constraints of your build system.
29960
29961 A precompiled header file can be used only when these conditions apply:
29962
29963 @itemize
29964 @item
29965 Only one precompiled header can be used in a particular compilation.
29966
29967 @item
29968 A precompiled header cannot be used once the first C token is seen. You
29969 can have preprocessor directives before a precompiled header; you cannot
29970 include a precompiled header from inside another header.
29971
29972 @item
29973 The precompiled header file must be produced for the same language as
29974 the current compilation. You cannot use a C precompiled header for a C++
29975 compilation.
29976
29977 @item
29978 The precompiled header file must have been produced by the same compiler
29979 binary as the current compilation is using.
29980
29981 @item
29982 Any macros defined before the precompiled header is included must
29983 either be defined in the same way as when the precompiled header was
29984 generated, or must not affect the precompiled header, which usually
29985 means that they don't appear in the precompiled header at all.
29986
29987 The @option{-D} option is one way to define a macro before a
29988 precompiled header is included; using a @code{#define} can also do it.
29989 There are also some options that define macros implicitly, like
29990 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29991 defined this way.
29992
29993 @item If debugging information is output when using the precompiled
29994 header, using @option{-g} or similar, the same kind of debugging information
29995 must have been output when building the precompiled header. However,
29996 a precompiled header built using @option{-g} can be used in a compilation
29997 when no debugging information is being output.
29998
29999 @item The same @option{-m} options must generally be used when building
30000 and using the precompiled header. @xref{Submodel Options},
30001 for any cases where this rule is relaxed.
30002
30003 @item Each of the following options must be the same when building and using
30004 the precompiled header:
30005
30006 @gccoptlist{-fexceptions}
30007
30008 @item
30009 Some other command-line options starting with @option{-f},
30010 @option{-p}, or @option{-O} must be defined in the same way as when
30011 the precompiled header was generated. At present, it's not clear
30012 which options are safe to change and which are not; the safest choice
30013 is to use exactly the same options when generating and using the
30014 precompiled header. The following are known to be safe:
30015
30016 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30017 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30018 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30019 -pedantic-errors}
30020
30021 @end itemize
30022
30023 For all of these except the last, the compiler automatically
30024 ignores the precompiled header if the conditions aren't met. If you
30025 find an option combination that doesn't work and doesn't cause the
30026 precompiled header to be ignored, please consider filing a bug report,
30027 see @ref{Bugs}.
30028
30029 If you do use differing options when generating and using the
30030 precompiled header, the actual behavior is a mixture of the
30031 behavior for the options. For instance, if you use @option{-g} to
30032 generate the precompiled header but not when using it, you may or may
30033 not get debugging information for routines in the precompiled header.