]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Remove indirect call top N counter type.
[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-loop-limit=@var{n} @gol
213 -fconstexpr-ops-limit=@var{n} -fno-elide-constructors @gol
214 -fno-enforce-eh-specs @gol
215 -fno-gnu-keywords @gol
216 -fno-implicit-templates @gol
217 -fno-implicit-inline-templates @gol
218 -fno-implement-inlines -fms-extensions @gol
219 -fnew-inheriting-ctors @gol
220 -fnew-ttp-matching @gol
221 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
222 -fno-optional-diags -fpermissive @gol
223 -fno-pretty-templates @gol
224 -frepo -fno-rtti -fsized-deallocation @gol
225 -ftemplate-backtrace-limit=@var{n} @gol
226 -ftemplate-depth=@var{n} @gol
227 -fno-threadsafe-statics -fuse-cxa-atexit @gol
228 -fno-weak -nostdinc++ @gol
229 -fvisibility-inlines-hidden @gol
230 -fvisibility-ms-compat @gol
231 -fext-numeric-literals @gol
232 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
233 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
234 -Wliteral-suffix @gol
235 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
236 -Wnamespaces -Wnarrowing @gol
237 -Wpessimizing-move -Wredundant-move @gol
238 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
239 -Wnon-virtual-dtor -Wreorder -Wregister @gol
240 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
241 -Wno-non-template-friend -Wold-style-cast @gol
242 -Woverloaded-virtual -Wno-pmf-conversions @gol
243 -Wno-class-conversion -Wno-terminate @gol
244 -Wsign-promo -Wvirtual-inheritance}
245
246 @item Objective-C and Objective-C++ Language Options
247 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
248 Objective-C and Objective-C++ Dialects}.
249 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
250 -fgnu-runtime -fnext-runtime @gol
251 -fno-nil-receivers @gol
252 -fobjc-abi-version=@var{n} @gol
253 -fobjc-call-cxx-cdtors @gol
254 -fobjc-direct-dispatch @gol
255 -fobjc-exceptions @gol
256 -fobjc-gc @gol
257 -fobjc-nilcheck @gol
258 -fobjc-std=objc1 @gol
259 -fno-local-ivars @gol
260 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
261 -freplace-objc-classes @gol
262 -fzero-link @gol
263 -gen-decls @gol
264 -Wassign-intercept @gol
265 -Wno-protocol -Wselector @gol
266 -Wstrict-selector-match @gol
267 -Wundeclared-selector}
268
269 @item Diagnostic Message Formatting Options
270 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
271 @gccoptlist{-fmessage-length=@var{n} @gol
272 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
273 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
274 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
275 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
276 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
277 -fdiagnostics-minimum-margin-width=@var{width} @gol
278 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
279 -fdiagnostics-show-template-tree -fno-elide-type @gol
280 -fno-show-column}
281
282 @item Warning Options
283 @xref{Warning Options,,Options to Request or Suppress Warnings}.
284 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
285 -pedantic-errors @gol
286 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
287 -Waggregate-return -Waligned-new @gol
288 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
289 -Walloca -Walloca-larger-than=@var{byte-size} @gol
290 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
291 -Wno-attributes -Wattribute-alias=@var{n} @gol
292 -Wbool-compare -Wbool-operation @gol
293 -Wno-builtin-declaration-mismatch @gol
294 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
295 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
296 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
297 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
298 -Wclobbered -Wcomment -Wconditionally-supported @gol
299 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
300 -Wdelete-incomplete @gol
301 -Wno-attribute-warning @gol
302 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
303 -Wdisabled-optimization @gol
304 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
305 -Wno-div-by-zero -Wdouble-promotion @gol
306 -Wduplicated-branches -Wduplicated-cond @gol
307 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
308 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
309 -Wfloat-equal -Wformat -Wformat=2 @gol
310 -Wno-format-contains-nul -Wno-format-extra-args @gol
311 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
312 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
313 -Wformat-y2k -Wframe-address @gol
314 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
315 -Wjump-misses-init @gol
316 -Whsa -Wif-not-aligned @gol
317 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
318 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
319 -Wimplicit-function-declaration -Wimplicit-int @gol
320 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
321 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
322 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
323 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
324 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
325 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
326 -Wmissing-field-initializers -Wmissing-format-attribute @gol
327 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
328 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
329 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
330 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
331 -Woverride-init-side-effects -Woverlength-strings @gol
332 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
333 -Wparentheses -Wno-pedantic-ms-format @gol
334 -Wplacement-new -Wplacement-new=@var{n} @gol
335 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
336 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
337 -Wrestrict -Wno-return-local-addr @gol
338 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
339 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
340 -Wshift-overflow -Wshift-overflow=@var{n} @gol
341 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
342 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
343 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
344 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
345 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
346 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
347 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
348 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
349 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
350 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
351 -Wswitch-unreachable -Wsync-nand @gol
352 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
353 -Wtype-limits -Wundef @gol
354 -Wuninitialized -Wunknown-pragmas @gol
355 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
356 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
357 -Wunused-parameter -Wno-unused-result @gol
358 -Wunused-value -Wunused-variable @gol
359 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
360 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
361 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
362 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
363 -Wwrite-strings @gol
364 -Wzero-as-null-pointer-constant}
365
366 @item C and Objective-C-only Warning Options
367 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
368 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
369 -Wold-style-declaration -Wold-style-definition @gol
370 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
371 -Wdeclaration-after-statement -Wpointer-sign}
372
373 @item Debugging Options
374 @xref{Debugging Options,,Options for Debugging Your Program}.
375 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
376 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
377 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
378 -gas-loc-support -gno-as-loc-support @gol
379 -gas-locview-support -gno-as-locview-support @gol
380 -gcolumn-info -gno-column-info @gol
381 -gstatement-frontiers -gno-statement-frontiers @gol
382 -gvariable-location-views -gno-variable-location-views @gol
383 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
384 -ginline-points -gno-inline-points @gol
385 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
386 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
387 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
388 -fno-eliminate-unused-debug-types @gol
389 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
390 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
391 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
392 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
393 -fvar-tracking -fvar-tracking-assignments}
394
395 @item Optimization Options
396 @xref{Optimize Options,,Options that Control Optimization}.
397 @gccoptlist{-faggressive-loop-optimizations @gol
398 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
399 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
400 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
403 -fauto-inc-dec -fbranch-probabilities @gol
404 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
405 -fbtr-bb-exclusive -fcaller-saves @gol
406 -fcombine-stack-adjustments -fconserve-stack @gol
407 -fcompare-elim -fcprop-registers -fcrossjumping @gol
408 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
409 -fcx-limited-range @gol
410 -fdata-sections -fdce -fdelayed-branch @gol
411 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
412 -fdevirtualize-at-ltrans -fdse @gol
413 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
414 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
415 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
416 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
417 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
418 -fif-conversion2 -findirect-inlining @gol
419 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
420 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
421 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
422 -fipa-reference -fipa-reference-addressable @gol
423 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
424 -flive-patching=@var{level} @gol
425 -fira-region=@var{region} -fira-hoist-pressure @gol
426 -fira-loop-pressure -fno-ira-share-save-slots @gol
427 -fno-ira-share-spill-slots @gol
428 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
429 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
430 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
431 -floop-block -floop-interchange -floop-strip-mine @gol
432 -floop-unroll-and-jam -floop-nest-optimize @gol
433 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
434 -flto-partition=@var{alg} -fmerge-all-constants @gol
435 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
436 -fmove-loop-invariants -fno-branch-count-reg @gol
437 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
438 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
439 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
440 -fno-sched-spec -fno-signed-zeros @gol
441 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
442 -fomit-frame-pointer -foptimize-sibling-calls @gol
443 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
444 -fprefetch-loop-arrays @gol
445 -fprofile-correction @gol
446 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
447 -fprofile-reorder-functions @gol
448 -freciprocal-math -free -frename-registers -freorder-blocks @gol
449 -freorder-blocks-algorithm=@var{algorithm} @gol
450 -freorder-blocks-and-partition -freorder-functions @gol
451 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
452 -frounding-math -fsave-optimization-record @gol
453 -fsched2-use-superblocks -fsched-pressure @gol
454 -fsched-spec-load -fsched-spec-load-dangerous @gol
455 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
456 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
457 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
458 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
459 -fschedule-fusion @gol
460 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
461 -fselective-scheduling -fselective-scheduling2 @gol
462 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
463 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
464 -fsignaling-nans @gol
465 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
466 -fsplit-paths @gol
467 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
468 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
469 -fthread-jumps -ftracer -ftree-bit-ccp @gol
470 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
471 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
472 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
473 -ftree-loop-if-convert -ftree-loop-im @gol
474 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
475 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
476 -ftree-loop-vectorize @gol
477 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
478 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
479 -ftree-switch-conversion -ftree-tail-merge @gol
480 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
481 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
482 -funsafe-math-optimizations -funswitch-loops @gol
483 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
484 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
485 --param @var{name}=@var{value}
486 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
487
488 @item Program Instrumentation Options
489 @xref{Instrumentation Options,,Program Instrumentation Options}.
490 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
491 -fprofile-abs-path @gol
492 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
493 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
494 -fprofile-exclude-files=@var{regex} @gol
495 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
496 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
497 -fsanitize-undefined-trap-on-error -fbounds-check @gol
498 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
499 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
500 -fstack-protector-explicit -fstack-check @gol
501 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
502 -fno-stack-limit -fsplit-stack @gol
503 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
504 -fvtv-counts -fvtv-debug @gol
505 -finstrument-functions @gol
506 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
507 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
508
509 @item Preprocessor Options
510 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
511 @gccoptlist{-A@var{question}=@var{answer} @gol
512 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
513 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
514 -dD -dI -dM -dN -dU @gol
515 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
516 -fexec-charset=@var{charset} -fextended-identifiers @gol
517 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
518 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
519 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
520 -fwide-exec-charset=@var{charset} -fworking-directory @gol
521 -H -imacros @var{file} -include @var{file} @gol
522 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
523 -no-integrated-cpp -P -pthread -remap @gol
524 -traditional -traditional-cpp -trigraphs @gol
525 -U@var{macro} -undef @gol
526 -Wp,@var{option} -Xpreprocessor @var{option}}
527
528 @item Assembler Options
529 @xref{Assembler Options,,Passing Options to the Assembler}.
530 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
531
532 @item Linker Options
533 @xref{Link Options,,Options for Linking}.
534 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
535 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
536 -e @var{entry} --entry=@var{entry} @gol
537 -pie -pthread -r -rdynamic @gol
538 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
539 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
540 -shared -shared-libgcc -symbolic @gol
541 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
542 -u @var{symbol} -z @var{keyword}}
543
544 @item Directory Options
545 @xref{Directory Options,,Options for Directory Search}.
546 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
547 -idirafter @var{dir} @gol
548 -imacros @var{file} -imultilib @var{dir} @gol
549 -iplugindir=@var{dir} -iprefix @var{file} @gol
550 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
551 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
552 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
553 -nostdinc -nostdinc++ --sysroot=@var{dir}}
554
555 @item Code Generation Options
556 @xref{Code Gen Options,,Options for Code Generation Conventions}.
557 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
558 -ffixed-@var{reg} -fexceptions @gol
559 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
560 -fasynchronous-unwind-tables @gol
561 -fno-gnu-unique @gol
562 -finhibit-size-directive -fno-common -fno-ident @gol
563 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
564 -fno-jump-tables @gol
565 -frecord-gcc-switches @gol
566 -freg-struct-return -fshort-enums -fshort-wchar @gol
567 -fverbose-asm -fpack-struct[=@var{n}] @gol
568 -fleading-underscore -ftls-model=@var{model} @gol
569 -fstack-reuse=@var{reuse_level} @gol
570 -ftrampolines -ftrapv -fwrapv @gol
571 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
572 -fstrict-volatile-bitfields -fsync-libcalls}
573
574 @item Developer Options
575 @xref{Developer Options,,GCC Developer Options}.
576 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
577 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
578 -fdbg-cnt=@var{counter-value-list} @gol
579 -fdisable-ipa-@var{pass_name} @gol
580 -fdisable-rtl-@var{pass_name} @gol
581 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
582 -fdisable-tree-@var{pass_name} @gol
583 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
584 -fdump-debug -fdump-earlydebug @gol
585 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
586 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
587 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
588 -fdump-lang-all @gol
589 -fdump-lang-@var{switch} @gol
590 -fdump-lang-@var{switch}-@var{options} @gol
591 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
592 -fdump-passes @gol
593 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
594 -fdump-statistics @gol
595 -fdump-tree-all @gol
596 -fdump-tree-@var{switch} @gol
597 -fdump-tree-@var{switch}-@var{options} @gol
598 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
599 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
600 -fenable-@var{kind}-@var{pass} @gol
601 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
602 -fira-verbose=@var{n} @gol
603 -flto-report -flto-report-wpa -fmem-report-wpa @gol
604 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
605 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
606 -fprofile-report @gol
607 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
608 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
609 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
610 -fvar-tracking-assignments-toggle -gtoggle @gol
611 -print-file-name=@var{library} -print-libgcc-file-name @gol
612 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
613 -print-prog-name=@var{program} -print-search-dirs -Q @gol
614 -print-sysroot -print-sysroot-headers-suffix @gol
615 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
616
617 @item Machine-Dependent Options
618 @xref{Submodel Options,,Machine-Dependent Options}.
619 @c This list is ordered alphanumerically by subsection name.
620 @c Try and put the significant identifier (CPU or system) first,
621 @c so users have a clue at guessing where the ones they want will be.
622
623 @emph{AArch64 Options}
624 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
625 -mgeneral-regs-only @gol
626 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
627 -mstrict-align -mno-strict-align @gol
628 -momit-leaf-frame-pointer @gol
629 -mtls-dialect=desc -mtls-dialect=traditional @gol
630 -mtls-size=@var{size} @gol
631 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
632 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
633 -mpc-relative-literal-loads @gol
634 -msign-return-address=@var{scope} @gol
635 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
636 +@var{b-key}]|@var{bti} @gol
637 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
638 -moverride=@var{string} -mverbose-cost-dump @gol
639 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
640 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
641
642 @emph{Adapteva Epiphany Options}
643 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
644 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
645 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
646 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
647 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
648 -msplit-vecmove-early -m1reg-@var{reg}}
649
650 @emph{AMD GCN Options}
651 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
652
653 @emph{ARC Options}
654 @gccoptlist{-mbarrel-shifter -mjli-always @gol
655 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
656 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
657 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
658 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
659 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
660 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
661 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
662 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
663 -mvolatile-cache -mtp-regno=@var{regno} @gol
664 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
665 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
666 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
667 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
668 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
669 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
670 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
671 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
672
673 @emph{ARM Options}
674 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
675 -mabi=@var{name} @gol
676 -mapcs-stack-check -mno-apcs-stack-check @gol
677 -mapcs-reentrant -mno-apcs-reentrant @gol
678 -mgeneral-regs-only @gol
679 -msched-prolog -mno-sched-prolog @gol
680 -mlittle-endian -mbig-endian @gol
681 -mbe8 -mbe32 @gol
682 -mfloat-abi=@var{name} @gol
683 -mfp16-format=@var{name}
684 -mthumb-interwork -mno-thumb-interwork @gol
685 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
686 -mtune=@var{name} -mprint-tune-info @gol
687 -mstructure-size-boundary=@var{n} @gol
688 -mabort-on-noreturn @gol
689 -mlong-calls -mno-long-calls @gol
690 -msingle-pic-base -mno-single-pic-base @gol
691 -mpic-register=@var{reg} @gol
692 -mnop-fun-dllimport @gol
693 -mpoke-function-name @gol
694 -mthumb -marm -mflip-thumb @gol
695 -mtpcs-frame -mtpcs-leaf-frame @gol
696 -mcaller-super-interworking -mcallee-super-interworking @gol
697 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
698 -mword-relocations @gol
699 -mfix-cortex-m3-ldrd @gol
700 -munaligned-access @gol
701 -mneon-for-64bits @gol
702 -mslow-flash-data @gol
703 -masm-syntax-unified @gol
704 -mrestrict-it @gol
705 -mverbose-cost-dump @gol
706 -mpure-code @gol
707 -mcmse}
708
709 @emph{AVR Options}
710 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
711 -mbranch-cost=@var{cost} @gol
712 -mcall-prologues -mgas-isr-prologues -mint8 @gol
713 -mn_flash=@var{size} -mno-interrupts @gol
714 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
715 -mfract-convert-truncate @gol
716 -mshort-calls -nodevicelib @gol
717 -Waddr-space-convert -Wmisspelled-isr}
718
719 @emph{Blackfin Options}
720 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
721 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
722 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
723 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
724 -mno-id-shared-library -mshared-library-id=@var{n} @gol
725 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
726 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
727 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
728 -micplb}
729
730 @emph{C6X Options}
731 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
732 -msim -msdata=@var{sdata-type}}
733
734 @emph{CRIS Options}
735 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
736 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
737 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
738 -mstack-align -mdata-align -mconst-align @gol
739 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
740 -melf -maout -melinux -mlinux -sim -sim2 @gol
741 -mmul-bug-workaround -mno-mul-bug-workaround}
742
743 @emph{CR16 Options}
744 @gccoptlist{-mmac @gol
745 -mcr16cplus -mcr16c @gol
746 -msim -mint32 -mbit-ops
747 -mdata-model=@var{model}}
748
749 @emph{C-SKY Options}
750 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
751 -mbig-endian -EB -mlittle-endian -EL @gol
752 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
753 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
754 -mdsp -medsp -mvdsp @gol
755 -mdiv -msmart -mhigh-registers -manchor @gol
756 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
757 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
758
759 @emph{Darwin Options}
760 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
761 -arch_only -bind_at_load -bundle -bundle_loader @gol
762 -client_name -compatibility_version -current_version @gol
763 -dead_strip @gol
764 -dependency-file -dylib_file -dylinker_install_name @gol
765 -dynamic -dynamiclib -exported_symbols_list @gol
766 -filelist -flat_namespace -force_cpusubtype_ALL @gol
767 -force_flat_namespace -headerpad_max_install_names @gol
768 -iframework @gol
769 -image_base -init -install_name -keep_private_externs @gol
770 -multi_module -multiply_defined -multiply_defined_unused @gol
771 -noall_load -no_dead_strip_inits_and_terms @gol
772 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
773 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
774 -private_bundle -read_only_relocs -sectalign @gol
775 -sectobjectsymbols -whyload -seg1addr @gol
776 -sectcreate -sectobjectsymbols -sectorder @gol
777 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
778 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
779 -segprot -segs_read_only_addr -segs_read_write_addr @gol
780 -single_module -static -sub_library -sub_umbrella @gol
781 -twolevel_namespace -umbrella -undefined @gol
782 -unexported_symbols_list -weak_reference_mismatches @gol
783 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
784 -mkernel -mone-byte-bool}
785
786 @emph{DEC Alpha Options}
787 @gccoptlist{-mno-fp-regs -msoft-float @gol
788 -mieee -mieee-with-inexact -mieee-conformant @gol
789 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
790 -mtrap-precision=@var{mode} -mbuild-constants @gol
791 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
792 -mbwx -mmax -mfix -mcix @gol
793 -mfloat-vax -mfloat-ieee @gol
794 -mexplicit-relocs -msmall-data -mlarge-data @gol
795 -msmall-text -mlarge-text @gol
796 -mmemory-latency=@var{time}}
797
798 @emph{FR30 Options}
799 @gccoptlist{-msmall-model -mno-lsim}
800
801 @emph{FT32 Options}
802 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
803
804 @emph{FRV Options}
805 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
806 -mhard-float -msoft-float @gol
807 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
808 -mdouble -mno-double @gol
809 -mmedia -mno-media -mmuladd -mno-muladd @gol
810 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
811 -mlinked-fp -mlong-calls -malign-labels @gol
812 -mlibrary-pic -macc-4 -macc-8 @gol
813 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
814 -moptimize-membar -mno-optimize-membar @gol
815 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
816 -mvliw-branch -mno-vliw-branch @gol
817 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
818 -mno-nested-cond-exec -mtomcat-stats @gol
819 -mTLS -mtls @gol
820 -mcpu=@var{cpu}}
821
822 @emph{GNU/Linux Options}
823 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
824 -tno-android-cc -tno-android-ld}
825
826 @emph{H8/300 Options}
827 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
828
829 @emph{HPPA Options}
830 @gccoptlist{-march=@var{architecture-type} @gol
831 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
832 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
833 -mfixed-range=@var{register-range} @gol
834 -mjump-in-delay -mlinker-opt -mlong-calls @gol
835 -mlong-load-store -mno-disable-fpregs @gol
836 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
837 -mno-jump-in-delay -mno-long-load-store @gol
838 -mno-portable-runtime -mno-soft-float @gol
839 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
840 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
841 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
842 -munix=@var{unix-std} -nolibdld -static -threads}
843
844 @emph{IA-64 Options}
845 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
846 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
847 -mconstant-gp -mauto-pic -mfused-madd @gol
848 -minline-float-divide-min-latency @gol
849 -minline-float-divide-max-throughput @gol
850 -mno-inline-float-divide @gol
851 -minline-int-divide-min-latency @gol
852 -minline-int-divide-max-throughput @gol
853 -mno-inline-int-divide @gol
854 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
855 -mno-inline-sqrt @gol
856 -mdwarf2-asm -mearly-stop-bits @gol
857 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
858 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
859 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
860 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
861 -msched-spec-ldc -msched-spec-control-ldc @gol
862 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
863 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
864 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
865 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
866
867 @emph{LM32 Options}
868 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
869 -msign-extend-enabled -muser-enabled}
870
871 @emph{M32R/D Options}
872 @gccoptlist{-m32r2 -m32rx -m32r @gol
873 -mdebug @gol
874 -malign-loops -mno-align-loops @gol
875 -missue-rate=@var{number} @gol
876 -mbranch-cost=@var{number} @gol
877 -mmodel=@var{code-size-model-type} @gol
878 -msdata=@var{sdata-type} @gol
879 -mno-flush-func -mflush-func=@var{name} @gol
880 -mno-flush-trap -mflush-trap=@var{number} @gol
881 -G @var{num}}
882
883 @emph{M32C Options}
884 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
885
886 @emph{M680x0 Options}
887 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
888 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
889 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
890 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
891 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
892 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
893 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
894 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
895 -mxgot -mno-xgot -mlong-jump-table-offsets}
896
897 @emph{MCore Options}
898 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
899 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
900 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
901 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
902 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
903
904 @emph{MeP Options}
905 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
906 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
907 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
908 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
909 -mtiny=@var{n}}
910
911 @emph{MicroBlaze Options}
912 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
913 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
914 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
915 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
916 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
917 -mpic-data-is-text-relative}
918
919 @emph{MIPS Options}
920 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
921 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
922 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
923 -mips16 -mno-mips16 -mflip-mips16 @gol
924 -minterlink-compressed -mno-interlink-compressed @gol
925 -minterlink-mips16 -mno-interlink-mips16 @gol
926 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
927 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
928 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
929 -mno-float -msingle-float -mdouble-float @gol
930 -modd-spreg -mno-odd-spreg @gol
931 -mabs=@var{mode} -mnan=@var{encoding} @gol
932 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
933 -mmcu -mmno-mcu @gol
934 -meva -mno-eva @gol
935 -mvirt -mno-virt @gol
936 -mxpa -mno-xpa @gol
937 -mcrc -mno-crc @gol
938 -mginv -mno-ginv @gol
939 -mmicromips -mno-micromips @gol
940 -mmsa -mno-msa @gol
941 -mloongson-mmi -mno-loongson-mmi @gol
942 -mloongson-ext -mno-loongson-ext @gol
943 -mloongson-ext2 -mno-loongson-ext2 @gol
944 -mfpu=@var{fpu-type} @gol
945 -msmartmips -mno-smartmips @gol
946 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
947 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
948 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
949 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
950 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
951 -membedded-data -mno-embedded-data @gol
952 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
953 -mcode-readable=@var{setting} @gol
954 -msplit-addresses -mno-split-addresses @gol
955 -mexplicit-relocs -mno-explicit-relocs @gol
956 -mcheck-zero-division -mno-check-zero-division @gol
957 -mdivide-traps -mdivide-breaks @gol
958 -mload-store-pairs -mno-load-store-pairs @gol
959 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
960 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
961 -mfix-24k -mno-fix-24k @gol
962 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
963 -mfix-r5900 -mno-fix-r5900 @gol
964 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
965 -mfix-vr4120 -mno-fix-vr4120 @gol
966 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
967 -mflush-func=@var{func} -mno-flush-func @gol
968 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
969 -mcompact-branches=@var{policy} @gol
970 -mfp-exceptions -mno-fp-exceptions @gol
971 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
972 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
973 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
974 -mframe-header-opt -mno-frame-header-opt}
975
976 @emph{MMIX Options}
977 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
978 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
979 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
980 -mno-base-addresses -msingle-exit -mno-single-exit}
981
982 @emph{MN10300 Options}
983 @gccoptlist{-mmult-bug -mno-mult-bug @gol
984 -mno-am33 -mam33 -mam33-2 -mam34 @gol
985 -mtune=@var{cpu-type} @gol
986 -mreturn-pointer-on-d0 @gol
987 -mno-crt0 -mrelax -mliw -msetlb}
988
989 @emph{Moxie Options}
990 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
991
992 @emph{MSP430 Options}
993 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
994 -mwarn-mcu @gol
995 -mcode-region= -mdata-region= @gol
996 -msilicon-errata= -msilicon-errata-warn= @gol
997 -mhwmult= -minrt}
998
999 @emph{NDS32 Options}
1000 @gccoptlist{-mbig-endian -mlittle-endian @gol
1001 -mreduced-regs -mfull-regs @gol
1002 -mcmov -mno-cmov @gol
1003 -mext-perf -mno-ext-perf @gol
1004 -mext-perf2 -mno-ext-perf2 @gol
1005 -mext-string -mno-ext-string @gol
1006 -mv3push -mno-v3push @gol
1007 -m16bit -mno-16bit @gol
1008 -misr-vector-size=@var{num} @gol
1009 -mcache-block-size=@var{num} @gol
1010 -march=@var{arch} @gol
1011 -mcmodel=@var{code-model} @gol
1012 -mctor-dtor -mrelax}
1013
1014 @emph{Nios II Options}
1015 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1016 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1017 -mel -meb @gol
1018 -mno-bypass-cache -mbypass-cache @gol
1019 -mno-cache-volatile -mcache-volatile @gol
1020 -mno-fast-sw-div -mfast-sw-div @gol
1021 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1022 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1023 -mcustom-fpu-cfg=@var{name} @gol
1024 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1025 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1026
1027 @emph{Nvidia PTX Options}
1028 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1029
1030 @emph{OpenRISC Options}
1031 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1032 -msoft-mul -msoft-div @gol
1033 -mcmov -mror -msext -msfimm -mshftimm}
1034
1035 @emph{PDP-11 Options}
1036 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1037 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1038 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1039
1040 @emph{picoChip Options}
1041 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1042 -msymbol-as-address -mno-inefficient-warnings}
1043
1044 @emph{PowerPC Options}
1045 See RS/6000 and PowerPC Options.
1046
1047 @emph{RISC-V Options}
1048 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1049 -mplt -mno-plt @gol
1050 -mabi=@var{ABI-string} @gol
1051 -mfdiv -mno-fdiv @gol
1052 -mdiv -mno-div @gol
1053 -march=@var{ISA-string} @gol
1054 -mtune=@var{processor-string} @gol
1055 -mpreferred-stack-boundary=@var{num} @gol
1056 -msmall-data-limit=@var{N-bytes} @gol
1057 -msave-restore -mno-save-restore @gol
1058 -mstrict-align -mno-strict-align @gol
1059 -mcmodel=medlow -mcmodel=medany @gol
1060 -mexplicit-relocs -mno-explicit-relocs @gol
1061 -mrelax -mno-relax @gol
1062 -mriscv-attribute -mmo-riscv-attribute}
1063
1064 @emph{RL78 Options}
1065 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1066 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1067 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1068
1069 @emph{RS/6000 and PowerPC Options}
1070 @gccoptlist{-mcpu=@var{cpu-type} @gol
1071 -mtune=@var{cpu-type} @gol
1072 -mcmodel=@var{code-model} @gol
1073 -mpowerpc64 @gol
1074 -maltivec -mno-altivec @gol
1075 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1076 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1077 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1078 -mfprnd -mno-fprnd @gol
1079 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1080 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1081 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1082 -malign-power -malign-natural @gol
1083 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1084 -mupdate -mno-update @gol
1085 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1086 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1087 -mstrict-align -mno-strict-align -mrelocatable @gol
1088 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1089 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1090 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1091 -mprioritize-restricted-insns=@var{priority} @gol
1092 -msched-costly-dep=@var{dependence_type} @gol
1093 -minsert-sched-nops=@var{scheme} @gol
1094 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1095 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1096 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1097 -mtraceback=@var{traceback_type} @gol
1098 -maix-struct-return -msvr4-struct-return @gol
1099 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1100 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1101 -mblock-move-inline-limit=@var{num} @gol
1102 -mblock-compare-inline-limit=@var{num} @gol
1103 -mblock-compare-inline-loop-limit=@var{num} @gol
1104 -mstring-compare-inline-limit=@var{num} @gol
1105 -misel -mno-isel @gol
1106 -mvrsave -mno-vrsave @gol
1107 -mmulhw -mno-mulhw @gol
1108 -mdlmzb -mno-dlmzb @gol
1109 -mprototype -mno-prototype @gol
1110 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1111 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1112 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1113 -mno-recip-precision @gol
1114 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1115 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1116 -msave-toc-indirect -mno-save-toc-indirect @gol
1117 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1118 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1119 -mquad-memory -mno-quad-memory @gol
1120 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1121 -mcompat-align-parm -mno-compat-align-parm @gol
1122 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1123 -mgnu-attribute -mno-gnu-attribute @gol
1124 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1125 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1126
1127 @emph{RX Options}
1128 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1129 -mcpu=@gol
1130 -mbig-endian-data -mlittle-endian-data @gol
1131 -msmall-data @gol
1132 -msim -mno-sim@gol
1133 -mas100-syntax -mno-as100-syntax@gol
1134 -mrelax@gol
1135 -mmax-constant-size=@gol
1136 -mint-register=@gol
1137 -mpid@gol
1138 -mallow-string-insns -mno-allow-string-insns@gol
1139 -mjsr@gol
1140 -mno-warn-multiple-fast-interrupts@gol
1141 -msave-acc-in-interrupts}
1142
1143 @emph{S/390 and zSeries Options}
1144 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1145 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1146 -mlong-double-64 -mlong-double-128 @gol
1147 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1148 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1149 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1150 -mhtm -mvx -mzvector @gol
1151 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1152 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1153 -mhotpatch=@var{halfwords},@var{halfwords}}
1154
1155 @emph{Score Options}
1156 @gccoptlist{-meb -mel @gol
1157 -mnhwloop @gol
1158 -muls @gol
1159 -mmac @gol
1160 -mscore5 -mscore5u -mscore7 -mscore7d}
1161
1162 @emph{SH Options}
1163 @gccoptlist{-m1 -m2 -m2e @gol
1164 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1165 -m3 -m3e @gol
1166 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1167 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1168 -mb -ml -mdalign -mrelax @gol
1169 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1170 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1171 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1172 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1173 -maccumulate-outgoing-args @gol
1174 -matomic-model=@var{atomic-model} @gol
1175 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1176 -mcbranch-force-delay-slot @gol
1177 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1178 -mpretend-cmove -mtas}
1179
1180 @emph{Solaris 2 Options}
1181 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1182 -pthreads}
1183
1184 @emph{SPARC Options}
1185 @gccoptlist{-mcpu=@var{cpu-type} @gol
1186 -mtune=@var{cpu-type} @gol
1187 -mcmodel=@var{code-model} @gol
1188 -mmemory-model=@var{mem-model} @gol
1189 -m32 -m64 -mapp-regs -mno-app-regs @gol
1190 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1191 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1192 -mhard-quad-float -msoft-quad-float @gol
1193 -mstack-bias -mno-stack-bias @gol
1194 -mstd-struct-return -mno-std-struct-return @gol
1195 -munaligned-doubles -mno-unaligned-doubles @gol
1196 -muser-mode -mno-user-mode @gol
1197 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1198 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1199 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1200 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1201 -mpopc -mno-popc -msubxc -mno-subxc @gol
1202 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1203 -mlra -mno-lra}
1204
1205 @emph{SPU Options}
1206 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1207 -msafe-dma -munsafe-dma @gol
1208 -mbranch-hints @gol
1209 -msmall-mem -mlarge-mem -mstdmain @gol
1210 -mfixed-range=@var{register-range} @gol
1211 -mea32 -mea64 @gol
1212 -maddress-space-conversion -mno-address-space-conversion @gol
1213 -mcache-size=@var{cache-size} @gol
1214 -matomic-updates -mno-atomic-updates}
1215
1216 @emph{System V Options}
1217 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1218
1219 @emph{TILE-Gx Options}
1220 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1221 -mcmodel=@var{code-model}}
1222
1223 @emph{TILEPro Options}
1224 @gccoptlist{-mcpu=@var{cpu} -m32}
1225
1226 @emph{V850 Options}
1227 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1228 -mprolog-function -mno-prolog-function -mspace @gol
1229 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1230 -mapp-regs -mno-app-regs @gol
1231 -mdisable-callt -mno-disable-callt @gol
1232 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1233 -mv850e -mv850 -mv850e3v5 @gol
1234 -mloop @gol
1235 -mrelax @gol
1236 -mlong-jumps @gol
1237 -msoft-float @gol
1238 -mhard-float @gol
1239 -mgcc-abi @gol
1240 -mrh850-abi @gol
1241 -mbig-switch}
1242
1243 @emph{VAX Options}
1244 @gccoptlist{-mg -mgnu -munix}
1245
1246 @emph{Visium Options}
1247 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1248 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1249
1250 @emph{VMS Options}
1251 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1252 -mpointer-size=@var{size}}
1253
1254 @emph{VxWorks Options}
1255 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1256 -Xbind-lazy -Xbind-now}
1257
1258 @emph{x86 Options}
1259 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1260 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1261 -mfpmath=@var{unit} @gol
1262 -masm=@var{dialect} -mno-fancy-math-387 @gol
1263 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1264 -mno-wide-multiply -mrtd -malign-double @gol
1265 -mpreferred-stack-boundary=@var{num} @gol
1266 -mincoming-stack-boundary=@var{num} @gol
1267 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1268 -mrecip -mrecip=@var{opt} @gol
1269 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1270 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1271 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1272 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1273 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1274 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1275 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1276 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1277 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1278 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1279 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1280 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1281 -mrdseed -msgx @gol
1282 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1283 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1284 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1285 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1286 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1287 -mregparm=@var{num} -msseregparm @gol
1288 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1289 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1290 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1291 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1292 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1293 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1294 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1295 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1296 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1297 -mstack-protector-guard-reg=@var{reg} @gol
1298 -mstack-protector-guard-offset=@var{offset} @gol
1299 -mstack-protector-guard-symbol=@var{symbol} @gol
1300 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1301 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1302 -mindirect-branch-register}
1303
1304 @emph{x86 Windows Options}
1305 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1306 -mnop-fun-dllimport -mthread @gol
1307 -municode -mwin32 -mwindows -fno-set-stack-executable}
1308
1309 @emph{Xstormy16 Options}
1310 @gccoptlist{-msim}
1311
1312 @emph{Xtensa Options}
1313 @gccoptlist{-mconst16 -mno-const16 @gol
1314 -mfused-madd -mno-fused-madd @gol
1315 -mforce-no-pic @gol
1316 -mserialize-volatile -mno-serialize-volatile @gol
1317 -mtext-section-literals -mno-text-section-literals @gol
1318 -mauto-litpools -mno-auto-litpools @gol
1319 -mtarget-align -mno-target-align @gol
1320 -mlongcalls -mno-longcalls}
1321
1322 @emph{zSeries Options}
1323 See S/390 and zSeries Options.
1324 @end table
1325
1326
1327 @node Overall Options
1328 @section Options Controlling the Kind of Output
1329
1330 Compilation can involve up to four stages: preprocessing, compilation
1331 proper, assembly and linking, always in that order. GCC is capable of
1332 preprocessing and compiling several files either into several
1333 assembler input files, or into one assembler input file; then each
1334 assembler input file produces an object file, and linking combines all
1335 the object files (those newly compiled, and those specified as input)
1336 into an executable file.
1337
1338 @cindex file name suffix
1339 For any given input file, the file name suffix determines what kind of
1340 compilation is done:
1341
1342 @table @gcctabopt
1343 @item @var{file}.c
1344 C source code that must be preprocessed.
1345
1346 @item @var{file}.i
1347 C source code that should not be preprocessed.
1348
1349 @item @var{file}.ii
1350 C++ source code that should not be preprocessed.
1351
1352 @item @var{file}.m
1353 Objective-C source code. Note that you must link with the @file{libobjc}
1354 library to make an Objective-C program work.
1355
1356 @item @var{file}.mi
1357 Objective-C source code that should not be preprocessed.
1358
1359 @item @var{file}.mm
1360 @itemx @var{file}.M
1361 Objective-C++ source code. Note that you must link with the @file{libobjc}
1362 library to make an Objective-C++ program work. Note that @samp{.M} refers
1363 to a literal capital M@.
1364
1365 @item @var{file}.mii
1366 Objective-C++ source code that should not be preprocessed.
1367
1368 @item @var{file}.h
1369 C, C++, Objective-C or Objective-C++ header file to be turned into a
1370 precompiled header (default), or C, C++ header file to be turned into an
1371 Ada spec (via the @option{-fdump-ada-spec} switch).
1372
1373 @item @var{file}.cc
1374 @itemx @var{file}.cp
1375 @itemx @var{file}.cxx
1376 @itemx @var{file}.cpp
1377 @itemx @var{file}.CPP
1378 @itemx @var{file}.c++
1379 @itemx @var{file}.C
1380 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1381 the last two letters must both be literally @samp{x}. Likewise,
1382 @samp{.C} refers to a literal capital C@.
1383
1384 @item @var{file}.mm
1385 @itemx @var{file}.M
1386 Objective-C++ source code that must be preprocessed.
1387
1388 @item @var{file}.mii
1389 Objective-C++ source code that should not be preprocessed.
1390
1391 @item @var{file}.hh
1392 @itemx @var{file}.H
1393 @itemx @var{file}.hp
1394 @itemx @var{file}.hxx
1395 @itemx @var{file}.hpp
1396 @itemx @var{file}.HPP
1397 @itemx @var{file}.h++
1398 @itemx @var{file}.tcc
1399 C++ header file to be turned into a precompiled header or Ada spec.
1400
1401 @item @var{file}.f
1402 @itemx @var{file}.for
1403 @itemx @var{file}.ftn
1404 Fixed form Fortran source code that should not be preprocessed.
1405
1406 @item @var{file}.F
1407 @itemx @var{file}.FOR
1408 @itemx @var{file}.fpp
1409 @itemx @var{file}.FPP
1410 @itemx @var{file}.FTN
1411 Fixed form Fortran source code that must be preprocessed (with the traditional
1412 preprocessor).
1413
1414 @item @var{file}.f90
1415 @itemx @var{file}.f95
1416 @itemx @var{file}.f03
1417 @itemx @var{file}.f08
1418 Free form Fortran source code that should not be preprocessed.
1419
1420 @item @var{file}.F90
1421 @itemx @var{file}.F95
1422 @itemx @var{file}.F03
1423 @itemx @var{file}.F08
1424 Free form Fortran source code that must be preprocessed (with the
1425 traditional preprocessor).
1426
1427 @item @var{file}.go
1428 Go source code.
1429
1430 @item @var{file}.brig
1431 BRIG files (binary representation of HSAIL).
1432
1433 @item @var{file}.d
1434 D source code.
1435
1436 @item @var{file}.di
1437 D interface file.
1438
1439 @item @var{file}.dd
1440 D documentation code (Ddoc).
1441
1442 @item @var{file}.ads
1443 Ada source code file that contains a library unit declaration (a
1444 declaration of a package, subprogram, or generic, or a generic
1445 instantiation), or a library unit renaming declaration (a package,
1446 generic, or subprogram renaming declaration). Such files are also
1447 called @dfn{specs}.
1448
1449 @item @var{file}.adb
1450 Ada source code file containing a library unit body (a subprogram or
1451 package body). Such files are also called @dfn{bodies}.
1452
1453 @c GCC also knows about some suffixes for languages not yet included:
1454 @c Ratfor:
1455 @c @var{file}.r
1456
1457 @item @var{file}.s
1458 Assembler code.
1459
1460 @item @var{file}.S
1461 @itemx @var{file}.sx
1462 Assembler code that must be preprocessed.
1463
1464 @item @var{other}
1465 An object file to be fed straight into linking.
1466 Any file name with no recognized suffix is treated this way.
1467 @end table
1468
1469 @opindex x
1470 You can specify the input language explicitly with the @option{-x} option:
1471
1472 @table @gcctabopt
1473 @item -x @var{language}
1474 Specify explicitly the @var{language} for the following input files
1475 (rather than letting the compiler choose a default based on the file
1476 name suffix). This option applies to all following input files until
1477 the next @option{-x} option. Possible values for @var{language} are:
1478 @smallexample
1479 c c-header cpp-output
1480 c++ c++-header c++-cpp-output
1481 objective-c objective-c-header objective-c-cpp-output
1482 objective-c++ objective-c++-header objective-c++-cpp-output
1483 assembler assembler-with-cpp
1484 ada
1485 d
1486 f77 f77-cpp-input f95 f95-cpp-input
1487 go
1488 brig
1489 @end smallexample
1490
1491 @item -x none
1492 Turn off any specification of a language, so that subsequent files are
1493 handled according to their file name suffixes (as they are if @option{-x}
1494 has not been used at all).
1495 @end table
1496
1497 If you only want some of the stages of compilation, you can use
1498 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1499 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1500 @command{gcc} is to stop. Note that some combinations (for example,
1501 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1502
1503 @table @gcctabopt
1504 @item -c
1505 @opindex c
1506 Compile or assemble the source files, but do not link. The linking
1507 stage simply is not done. The ultimate output is in the form of an
1508 object file for each source file.
1509
1510 By default, the object file name for a source file is made by replacing
1511 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1512
1513 Unrecognized input files, not requiring compilation or assembly, are
1514 ignored.
1515
1516 @item -S
1517 @opindex S
1518 Stop after the stage of compilation proper; do not assemble. The output
1519 is in the form of an assembler code file for each non-assembler input
1520 file specified.
1521
1522 By default, the assembler file name for a source file is made by
1523 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1524
1525 Input files that don't require compilation are ignored.
1526
1527 @item -E
1528 @opindex E
1529 Stop after the preprocessing stage; do not run the compiler proper. The
1530 output is in the form of preprocessed source code, which is sent to the
1531 standard output.
1532
1533 Input files that don't require preprocessing are ignored.
1534
1535 @cindex output file option
1536 @item -o @var{file}
1537 @opindex o
1538 Place output in file @var{file}. This applies to whatever
1539 sort of output is being produced, whether it be an executable file,
1540 an object file, an assembler file or preprocessed C code.
1541
1542 If @option{-o} is not specified, the default is to put an executable
1543 file in @file{a.out}, the object file for
1544 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1545 assembler file in @file{@var{source}.s}, a precompiled header file in
1546 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1547 standard output.
1548
1549 @item -v
1550 @opindex v
1551 Print (on standard error output) the commands executed to run the stages
1552 of compilation. Also print the version number of the compiler driver
1553 program and of the preprocessor and the compiler proper.
1554
1555 @item -###
1556 @opindex ###
1557 Like @option{-v} except the commands are not executed and arguments
1558 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1559 This is useful for shell scripts to capture the driver-generated command lines.
1560
1561 @item --help
1562 @opindex help
1563 Print (on the standard output) a description of the command-line options
1564 understood by @command{gcc}. If the @option{-v} option is also specified
1565 then @option{--help} is also passed on to the various processes
1566 invoked by @command{gcc}, so that they can display the command-line options
1567 they accept. If the @option{-Wextra} option has also been specified
1568 (prior to the @option{--help} option), then command-line options that
1569 have no documentation associated with them are also displayed.
1570
1571 @item --target-help
1572 @opindex target-help
1573 Print (on the standard output) a description of target-specific command-line
1574 options for each tool. For some targets extra target-specific
1575 information may also be printed.
1576
1577 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1578 Print (on the standard output) a description of the command-line
1579 options understood by the compiler that fit into all specified classes
1580 and qualifiers. These are the supported classes:
1581
1582 @table @asis
1583 @item @samp{optimizers}
1584 Display all of the optimization options supported by the
1585 compiler.
1586
1587 @item @samp{warnings}
1588 Display all of the options controlling warning messages
1589 produced by the compiler.
1590
1591 @item @samp{target}
1592 Display target-specific options. Unlike the
1593 @option{--target-help} option however, target-specific options of the
1594 linker and assembler are not displayed. This is because those
1595 tools do not currently support the extended @option{--help=} syntax.
1596
1597 @item @samp{params}
1598 Display the values recognized by the @option{--param}
1599 option.
1600
1601 @item @var{language}
1602 Display the options supported for @var{language}, where
1603 @var{language} is the name of one of the languages supported in this
1604 version of GCC@.
1605
1606 @item @samp{common}
1607 Display the options that are common to all languages.
1608 @end table
1609
1610 These are the supported qualifiers:
1611
1612 @table @asis
1613 @item @samp{undocumented}
1614 Display only those options that are undocumented.
1615
1616 @item @samp{joined}
1617 Display options taking an argument that appears after an equal
1618 sign in the same continuous piece of text, such as:
1619 @samp{--help=target}.
1620
1621 @item @samp{separate}
1622 Display options taking an argument that appears as a separate word
1623 following the original option, such as: @samp{-o output-file}.
1624 @end table
1625
1626 Thus for example to display all the undocumented target-specific
1627 switches supported by the compiler, use:
1628
1629 @smallexample
1630 --help=target,undocumented
1631 @end smallexample
1632
1633 The sense of a qualifier can be inverted by prefixing it with the
1634 @samp{^} character, so for example to display all binary warning
1635 options (i.e., ones that are either on or off and that do not take an
1636 argument) that have a description, use:
1637
1638 @smallexample
1639 --help=warnings,^joined,^undocumented
1640 @end smallexample
1641
1642 The argument to @option{--help=} should not consist solely of inverted
1643 qualifiers.
1644
1645 Combining several classes is possible, although this usually
1646 restricts the output so much that there is nothing to display. One
1647 case where it does work, however, is when one of the classes is
1648 @var{target}. For example, to display all the target-specific
1649 optimization options, use:
1650
1651 @smallexample
1652 --help=target,optimizers
1653 @end smallexample
1654
1655 The @option{--help=} option can be repeated on the command line. Each
1656 successive use displays its requested class of options, skipping
1657 those that have already been displayed. If @option{--help} is also
1658 specified anywhere on the command line then this takes precedence
1659 over any @option{--help=} option.
1660
1661 If the @option{-Q} option appears on the command line before the
1662 @option{--help=} option, then the descriptive text displayed by
1663 @option{--help=} is changed. Instead of describing the displayed
1664 options, an indication is given as to whether the option is enabled,
1665 disabled or set to a specific value (assuming that the compiler
1666 knows this at the point where the @option{--help=} option is used).
1667
1668 Here is a truncated example from the ARM port of @command{gcc}:
1669
1670 @smallexample
1671 % gcc -Q -mabi=2 --help=target -c
1672 The following options are target specific:
1673 -mabi= 2
1674 -mabort-on-noreturn [disabled]
1675 -mapcs [disabled]
1676 @end smallexample
1677
1678 The output is sensitive to the effects of previous command-line
1679 options, so for example it is possible to find out which optimizations
1680 are enabled at @option{-O2} by using:
1681
1682 @smallexample
1683 -Q -O2 --help=optimizers
1684 @end smallexample
1685
1686 Alternatively you can discover which binary optimizations are enabled
1687 by @option{-O3} by using:
1688
1689 @smallexample
1690 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1691 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1692 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1693 @end smallexample
1694
1695 @item --version
1696 @opindex version
1697 Display the version number and copyrights of the invoked GCC@.
1698
1699 @item -pass-exit-codes
1700 @opindex pass-exit-codes
1701 Normally the @command{gcc} program exits with the code of 1 if any
1702 phase of the compiler returns a non-success return code. If you specify
1703 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1704 the numerically highest error produced by any phase returning an error
1705 indication. The C, C++, and Fortran front ends return 4 if an internal
1706 compiler error is encountered.
1707
1708 @item -pipe
1709 @opindex pipe
1710 Use pipes rather than temporary files for communication between the
1711 various stages of compilation. This fails to work on some systems where
1712 the assembler is unable to read from a pipe; but the GNU assembler has
1713 no trouble.
1714
1715 @item -specs=@var{file}
1716 @opindex specs
1717 Process @var{file} after the compiler reads in the standard @file{specs}
1718 file, in order to override the defaults which the @command{gcc} driver
1719 program uses when determining what switches to pass to @command{cc1},
1720 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1721 @option{-specs=@var{file}} can be specified on the command line, and they
1722 are processed in order, from left to right. @xref{Spec Files}, for
1723 information about the format of the @var{file}.
1724
1725 @item -wrapper
1726 @opindex wrapper
1727 Invoke all subcommands under a wrapper program. The name of the
1728 wrapper program and its parameters are passed as a comma separated
1729 list.
1730
1731 @smallexample
1732 gcc -c t.c -wrapper gdb,--args
1733 @end smallexample
1734
1735 @noindent
1736 This invokes all subprograms of @command{gcc} under
1737 @samp{gdb --args}, thus the invocation of @command{cc1} is
1738 @samp{gdb --args cc1 @dots{}}.
1739
1740 @item -ffile-prefix-map=@var{old}=@var{new}
1741 @opindex ffile-prefix-map
1742 When compiling files residing in directory @file{@var{old}}, record
1743 any references to them in the result of the compilation as if the
1744 files resided in directory @file{@var{new}} instead. Specifying this
1745 option is equivalent to specifying all the individual
1746 @option{-f*-prefix-map} options. This can be used to make reproducible
1747 builds that are location independent. See also
1748 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1749
1750 @item -fplugin=@var{name}.so
1751 @opindex fplugin
1752 Load the plugin code in file @var{name}.so, assumed to be a
1753 shared object to be dlopen'd by the compiler. The base name of
1754 the shared object file is used to identify the plugin for the
1755 purposes of argument parsing (See
1756 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1757 Each plugin should define the callback functions specified in the
1758 Plugins API.
1759
1760 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1761 @opindex fplugin-arg
1762 Define an argument called @var{key} with a value of @var{value}
1763 for the plugin called @var{name}.
1764
1765 @item -fdump-ada-spec@r{[}-slim@r{]}
1766 @opindex fdump-ada-spec
1767 For C and C++ source and include files, generate corresponding Ada specs.
1768 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1769 GNAT User's Guide}, which provides detailed documentation on this feature.
1770
1771 @item -fada-spec-parent=@var{unit}
1772 @opindex fada-spec-parent
1773 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1774 Ada specs as child units of parent @var{unit}.
1775
1776 @item -fdump-go-spec=@var{file}
1777 @opindex fdump-go-spec
1778 For input files in any language, generate corresponding Go
1779 declarations in @var{file}. This generates Go @code{const},
1780 @code{type}, @code{var}, and @code{func} declarations which may be a
1781 useful way to start writing a Go interface to code written in some
1782 other language.
1783
1784 @include @value{srcdir}/../libiberty/at-file.texi
1785 @end table
1786
1787 @node Invoking G++
1788 @section Compiling C++ Programs
1789
1790 @cindex suffixes for C++ source
1791 @cindex C++ source file suffixes
1792 C++ source files conventionally use one of the suffixes @samp{.C},
1793 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1794 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1795 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1796 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1797 files with these names and compiles them as C++ programs even if you
1798 call the compiler the same way as for compiling C programs (usually
1799 with the name @command{gcc}).
1800
1801 @findex g++
1802 @findex c++
1803 However, the use of @command{gcc} does not add the C++ library.
1804 @command{g++} is a program that calls GCC and automatically specifies linking
1805 against the C++ library. It treats @samp{.c},
1806 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1807 files unless @option{-x} is used. This program is also useful when
1808 precompiling a C header file with a @samp{.h} extension for use in C++
1809 compilations. On many systems, @command{g++} is also installed with
1810 the name @command{c++}.
1811
1812 @cindex invoking @command{g++}
1813 When you compile C++ programs, you may specify many of the same
1814 command-line options that you use for compiling programs in any
1815 language; or command-line options meaningful for C and related
1816 languages; or options that are meaningful only for C++ programs.
1817 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1818 explanations of options for languages related to C@.
1819 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1820 explanations of options that are meaningful only for C++ programs.
1821
1822 @node C Dialect Options
1823 @section Options Controlling C Dialect
1824 @cindex dialect options
1825 @cindex language dialect options
1826 @cindex options, dialect
1827
1828 The following options control the dialect of C (or languages derived
1829 from C, such as C++, Objective-C and Objective-C++) that the compiler
1830 accepts:
1831
1832 @table @gcctabopt
1833 @cindex ANSI support
1834 @cindex ISO support
1835 @item -ansi
1836 @opindex ansi
1837 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1838 equivalent to @option{-std=c++98}.
1839
1840 This turns off certain features of GCC that are incompatible with ISO
1841 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1842 such as the @code{asm} and @code{typeof} keywords, and
1843 predefined macros such as @code{unix} and @code{vax} that identify the
1844 type of system you are using. It also enables the undesirable and
1845 rarely used ISO trigraph feature. For the C compiler,
1846 it disables recognition of C++ style @samp{//} comments as well as
1847 the @code{inline} keyword.
1848
1849 The alternate keywords @code{__asm__}, @code{__extension__},
1850 @code{__inline__} and @code{__typeof__} continue to work despite
1851 @option{-ansi}. You would not want to use them in an ISO C program, of
1852 course, but it is useful to put them in header files that might be included
1853 in compilations done with @option{-ansi}. Alternate predefined macros
1854 such as @code{__unix__} and @code{__vax__} are also available, with or
1855 without @option{-ansi}.
1856
1857 The @option{-ansi} option does not cause non-ISO programs to be
1858 rejected gratuitously. For that, @option{-Wpedantic} is required in
1859 addition to @option{-ansi}. @xref{Warning Options}.
1860
1861 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1862 option is used. Some header files may notice this macro and refrain
1863 from declaring certain functions or defining certain macros that the
1864 ISO standard doesn't call for; this is to avoid interfering with any
1865 programs that might use these names for other things.
1866
1867 Functions that are normally built in but do not have semantics
1868 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1869 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1870 built-in functions provided by GCC}, for details of the functions
1871 affected.
1872
1873 @item -std=
1874 @opindex std
1875 Determine the language standard. @xref{Standards,,Language Standards
1876 Supported by GCC}, for details of these standard versions. This option
1877 is currently only supported when compiling C or C++.
1878
1879 The compiler can accept several base standards, such as @samp{c90} or
1880 @samp{c++98}, and GNU dialects of those standards, such as
1881 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1882 compiler accepts all programs following that standard plus those
1883 using GNU extensions that do not contradict it. For example,
1884 @option{-std=c90} turns off certain features of GCC that are
1885 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1886 keywords, but not other GNU extensions that do not have a meaning in
1887 ISO C90, such as omitting the middle term of a @code{?:}
1888 expression. On the other hand, when a GNU dialect of a standard is
1889 specified, all features supported by the compiler are enabled, even when
1890 those features change the meaning of the base standard. As a result, some
1891 strict-conforming programs may be rejected. The particular standard
1892 is used by @option{-Wpedantic} to identify which features are GNU
1893 extensions given that version of the standard. For example
1894 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1895 comments, while @option{-std=gnu99 -Wpedantic} does not.
1896
1897 A value for this option must be provided; possible values are
1898
1899 @table @samp
1900 @item c90
1901 @itemx c89
1902 @itemx iso9899:1990
1903 Support all ISO C90 programs (certain GNU extensions that conflict
1904 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1905
1906 @item iso9899:199409
1907 ISO C90 as modified in amendment 1.
1908
1909 @item c99
1910 @itemx c9x
1911 @itemx iso9899:1999
1912 @itemx iso9899:199x
1913 ISO C99. This standard is substantially completely supported, modulo
1914 bugs and floating-point issues
1915 (mainly but not entirely relating to optional C99 features from
1916 Annexes F and G). See
1917 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1918 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1919
1920 @item c11
1921 @itemx c1x
1922 @itemx iso9899:2011
1923 ISO C11, the 2011 revision of the ISO C standard. This standard is
1924 substantially completely supported, modulo bugs, floating-point issues
1925 (mainly but not entirely relating to optional C11 features from
1926 Annexes F and G) and the optional Annexes K (Bounds-checking
1927 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1928
1929 @item c17
1930 @itemx c18
1931 @itemx iso9899:2017
1932 @itemx iso9899:2018
1933 ISO C17, the 2017 revision of the ISO C standard
1934 (published in 2018). This standard is
1935 same as C11 except for corrections of defects (all of which are also
1936 applied with @option{-std=c11}) and a new value of
1937 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1938
1939 @item c2x
1940 The next version of the ISO C standard, still under development. The
1941 support for this version is experimental and incomplete.
1942
1943 @item gnu90
1944 @itemx gnu89
1945 GNU dialect of ISO C90 (including some C99 features).
1946
1947 @item gnu99
1948 @itemx gnu9x
1949 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1950
1951 @item gnu11
1952 @itemx gnu1x
1953 GNU dialect of ISO C11.
1954 The name @samp{gnu1x} is deprecated.
1955
1956 @item gnu17
1957 @itemx gnu18
1958 GNU dialect of ISO C17. This is the default for C code.
1959
1960 @item gnu2x
1961 The next version of the ISO C standard, still under development, plus
1962 GNU extensions. The support for this version is experimental and
1963 incomplete.
1964
1965 @item c++98
1966 @itemx c++03
1967 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1968 additional defect reports. Same as @option{-ansi} for C++ code.
1969
1970 @item gnu++98
1971 @itemx gnu++03
1972 GNU dialect of @option{-std=c++98}.
1973
1974 @item c++11
1975 @itemx c++0x
1976 The 2011 ISO C++ standard plus amendments.
1977 The name @samp{c++0x} is deprecated.
1978
1979 @item gnu++11
1980 @itemx gnu++0x
1981 GNU dialect of @option{-std=c++11}.
1982 The name @samp{gnu++0x} is deprecated.
1983
1984 @item c++14
1985 @itemx c++1y
1986 The 2014 ISO C++ standard plus amendments.
1987 The name @samp{c++1y} is deprecated.
1988
1989 @item gnu++14
1990 @itemx gnu++1y
1991 GNU dialect of @option{-std=c++14}.
1992 This is the default for C++ code.
1993 The name @samp{gnu++1y} is deprecated.
1994
1995 @item c++17
1996 @itemx c++1z
1997 The 2017 ISO C++ standard plus amendments.
1998 The name @samp{c++1z} is deprecated.
1999
2000 @item gnu++17
2001 @itemx gnu++1z
2002 GNU dialect of @option{-std=c++17}.
2003 The name @samp{gnu++1z} is deprecated.
2004
2005 @item c++2a
2006 The next revision of the ISO C++ standard, tentatively planned for
2007 2020. Support is highly experimental, and will almost certainly
2008 change in incompatible ways in future releases.
2009
2010 @item gnu++2a
2011 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2012 and will almost certainly change in incompatible ways in future
2013 releases.
2014 @end table
2015
2016 @item -fgnu89-inline
2017 @opindex fgnu89-inline
2018 The option @option{-fgnu89-inline} tells GCC to use the traditional
2019 GNU semantics for @code{inline} functions when in C99 mode.
2020 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2021 Using this option is roughly equivalent to adding the
2022 @code{gnu_inline} function attribute to all inline functions
2023 (@pxref{Function Attributes}).
2024
2025 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2026 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2027 specifies the default behavior).
2028 This option is not supported in @option{-std=c90} or
2029 @option{-std=gnu90} mode.
2030
2031 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2032 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2033 in effect for @code{inline} functions. @xref{Common Predefined
2034 Macros,,,cpp,The C Preprocessor}.
2035
2036 @item -fpermitted-flt-eval-methods=@var{style}
2037 @opindex fpermitted-flt-eval-methods
2038 @opindex fpermitted-flt-eval-methods=c11
2039 @opindex fpermitted-flt-eval-methods=ts-18661-3
2040 ISO/IEC TS 18661-3 defines new permissible values for
2041 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2042 a semantic type that is an interchange or extended format should be
2043 evaluated to the precision and range of that type. These new values are
2044 a superset of those permitted under C99/C11, which does not specify the
2045 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2046 conforming to C11 may not have been written expecting the possibility of
2047 the new values.
2048
2049 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2050 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2051 or the extended set of values specified in ISO/IEC TS 18661-3.
2052
2053 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2054
2055 The default when in a standards compliant mode (@option{-std=c11} or similar)
2056 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2057 dialect (@option{-std=gnu11} or similar) is
2058 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2059
2060 @item -aux-info @var{filename}
2061 @opindex aux-info
2062 Output to the given filename prototyped declarations for all functions
2063 declared and/or defined in a translation unit, including those in header
2064 files. This option is silently ignored in any language other than C@.
2065
2066 Besides declarations, the file indicates, in comments, the origin of
2067 each declaration (source file and line), whether the declaration was
2068 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2069 @samp{O} for old, respectively, in the first character after the line
2070 number and the colon), and whether it came from a declaration or a
2071 definition (@samp{C} or @samp{F}, respectively, in the following
2072 character). In the case of function definitions, a K&R-style list of
2073 arguments followed by their declarations is also provided, inside
2074 comments, after the declaration.
2075
2076 @item -fallow-parameterless-variadic-functions
2077 @opindex fallow-parameterless-variadic-functions
2078 Accept variadic functions without named parameters.
2079
2080 Although it is possible to define such a function, this is not very
2081 useful as it is not possible to read the arguments. This is only
2082 supported for C as this construct is allowed by C++.
2083
2084 @item -fno-asm
2085 @opindex fno-asm
2086 @opindex fasm
2087 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2088 keyword, so that code can use these words as identifiers. You can use
2089 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2090 instead. @option{-ansi} implies @option{-fno-asm}.
2091
2092 In C++, this switch only affects the @code{typeof} keyword, since
2093 @code{asm} and @code{inline} are standard keywords. You may want to
2094 use the @option{-fno-gnu-keywords} flag instead, which has the same
2095 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2096 switch only affects the @code{asm} and @code{typeof} keywords, since
2097 @code{inline} is a standard keyword in ISO C99.
2098
2099 @item -fno-builtin
2100 @itemx -fno-builtin-@var{function}
2101 @opindex fno-builtin
2102 @opindex fbuiltin
2103 @cindex built-in functions
2104 Don't recognize built-in functions that do not begin with
2105 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2106 functions provided by GCC}, for details of the functions affected,
2107 including those which are not built-in functions when @option{-ansi} or
2108 @option{-std} options for strict ISO C conformance are used because they
2109 do not have an ISO standard meaning.
2110
2111 GCC normally generates special code to handle certain built-in functions
2112 more efficiently; for instance, calls to @code{alloca} may become single
2113 instructions which adjust the stack directly, and calls to @code{memcpy}
2114 may become inline copy loops. The resulting code is often both smaller
2115 and faster, but since the function calls no longer appear as such, you
2116 cannot set a breakpoint on those calls, nor can you change the behavior
2117 of the functions by linking with a different library. In addition,
2118 when a function is recognized as a built-in function, GCC may use
2119 information about that function to warn about problems with calls to
2120 that function, or to generate more efficient code, even if the
2121 resulting code still contains calls to that function. For example,
2122 warnings are given with @option{-Wformat} for bad calls to
2123 @code{printf} when @code{printf} is built in and @code{strlen} is
2124 known not to modify global memory.
2125
2126 With the @option{-fno-builtin-@var{function}} option
2127 only the built-in function @var{function} is
2128 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2129 function is named that is not built-in in this version of GCC, this
2130 option is ignored. There is no corresponding
2131 @option{-fbuiltin-@var{function}} option; if you wish to enable
2132 built-in functions selectively when using @option{-fno-builtin} or
2133 @option{-ffreestanding}, you may define macros such as:
2134
2135 @smallexample
2136 #define abs(n) __builtin_abs ((n))
2137 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2138 @end smallexample
2139
2140 @item -fgimple
2141 @opindex fgimple
2142
2143 Enable parsing of function definitions marked with @code{__GIMPLE}.
2144 This is an experimental feature that allows unit testing of GIMPLE
2145 passes.
2146
2147 @item -fhosted
2148 @opindex fhosted
2149 @cindex hosted environment
2150
2151 Assert that compilation targets a hosted environment. This implies
2152 @option{-fbuiltin}. A hosted environment is one in which the
2153 entire standard library is available, and in which @code{main} has a return
2154 type of @code{int}. Examples are nearly everything except a kernel.
2155 This is equivalent to @option{-fno-freestanding}.
2156
2157 @item -ffreestanding
2158 @opindex ffreestanding
2159 @cindex hosted environment
2160
2161 Assert that compilation targets a freestanding environment. This
2162 implies @option{-fno-builtin}. A freestanding environment
2163 is one in which the standard library may not exist, and program startup may
2164 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2165 This is equivalent to @option{-fno-hosted}.
2166
2167 @xref{Standards,,Language Standards Supported by GCC}, for details of
2168 freestanding and hosted environments.
2169
2170 @item -fopenacc
2171 @opindex fopenacc
2172 @cindex OpenACC accelerator programming
2173 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2174 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2175 compiler generates accelerated code according to the OpenACC Application
2176 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2177 implies @option{-pthread}, and thus is only supported on targets that
2178 have support for @option{-pthread}.
2179
2180 @item -fopenacc-dim=@var{geom}
2181 @opindex fopenacc-dim
2182 @cindex OpenACC accelerator programming
2183 Specify default compute dimensions for parallel offload regions that do
2184 not explicitly specify. The @var{geom} value is a triple of
2185 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2186 can be omitted, to use a target-specific default value.
2187
2188 @item -fopenmp
2189 @opindex fopenmp
2190 @cindex OpenMP parallel
2191 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2192 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2193 compiler generates parallel code according to the OpenMP Application
2194 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2195 implies @option{-pthread}, and thus is only supported on targets that
2196 have support for @option{-pthread}. @option{-fopenmp} implies
2197 @option{-fopenmp-simd}.
2198
2199 @item -fopenmp-simd
2200 @opindex fopenmp-simd
2201 @cindex OpenMP SIMD
2202 @cindex SIMD
2203 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2204 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2205 are ignored.
2206
2207 @item -fgnu-tm
2208 @opindex fgnu-tm
2209 When the option @option{-fgnu-tm} is specified, the compiler
2210 generates code for the Linux variant of Intel's current Transactional
2211 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2212 an experimental feature whose interface may change in future versions
2213 of GCC, as the official specification changes. Please note that not
2214 all architectures are supported for this feature.
2215
2216 For more information on GCC's support for transactional memory,
2217 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2218 Transactional Memory Library}.
2219
2220 Note that the transactional memory feature is not supported with
2221 non-call exceptions (@option{-fnon-call-exceptions}).
2222
2223 @item -fms-extensions
2224 @opindex fms-extensions
2225 Accept some non-standard constructs used in Microsoft header files.
2226
2227 In C++ code, this allows member names in structures to be similar
2228 to previous types declarations.
2229
2230 @smallexample
2231 typedef int UOW;
2232 struct ABC @{
2233 UOW UOW;
2234 @};
2235 @end smallexample
2236
2237 Some cases of unnamed fields in structures and unions are only
2238 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2239 fields within structs/unions}, for details.
2240
2241 Note that this option is off for all targets but x86
2242 targets using ms-abi.
2243
2244 @item -fplan9-extensions
2245 @opindex fplan9-extensions
2246 Accept some non-standard constructs used in Plan 9 code.
2247
2248 This enables @option{-fms-extensions}, permits passing pointers to
2249 structures with anonymous fields to functions that expect pointers to
2250 elements of the type of the field, and permits referring to anonymous
2251 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2252 struct/union fields within structs/unions}, for details. This is only
2253 supported for C, not C++.
2254
2255 @item -fcond-mismatch
2256 @opindex fcond-mismatch
2257 Allow conditional expressions with mismatched types in the second and
2258 third arguments. The value of such an expression is void. This option
2259 is not supported for C++.
2260
2261 @item -flax-vector-conversions
2262 @opindex flax-vector-conversions
2263 Allow implicit conversions between vectors with differing numbers of
2264 elements and/or incompatible element types. This option should not be
2265 used for new code.
2266
2267 @item -funsigned-char
2268 @opindex funsigned-char
2269 Let the type @code{char} be unsigned, like @code{unsigned char}.
2270
2271 Each kind of machine has a default for what @code{char} should
2272 be. It is either like @code{unsigned char} by default or like
2273 @code{signed char} by default.
2274
2275 Ideally, a portable program should always use @code{signed char} or
2276 @code{unsigned char} when it depends on the signedness of an object.
2277 But many programs have been written to use plain @code{char} and
2278 expect it to be signed, or expect it to be unsigned, depending on the
2279 machines they were written for. This option, and its inverse, let you
2280 make such a program work with the opposite default.
2281
2282 The type @code{char} is always a distinct type from each of
2283 @code{signed char} or @code{unsigned char}, even though its behavior
2284 is always just like one of those two.
2285
2286 @item -fsigned-char
2287 @opindex fsigned-char
2288 Let the type @code{char} be signed, like @code{signed char}.
2289
2290 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2291 the negative form of @option{-funsigned-char}. Likewise, the option
2292 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2293
2294 @item -fsigned-bitfields
2295 @itemx -funsigned-bitfields
2296 @itemx -fno-signed-bitfields
2297 @itemx -fno-unsigned-bitfields
2298 @opindex fsigned-bitfields
2299 @opindex funsigned-bitfields
2300 @opindex fno-signed-bitfields
2301 @opindex fno-unsigned-bitfields
2302 These options control whether a bit-field is signed or unsigned, when the
2303 declaration does not use either @code{signed} or @code{unsigned}. By
2304 default, such a bit-field is signed, because this is consistent: the
2305 basic integer types such as @code{int} are signed types.
2306
2307 @item -fsso-struct=@var{endianness}
2308 @opindex fsso-struct
2309 Set the default scalar storage order of structures and unions to the
2310 specified endianness. The accepted values are @samp{big-endian},
2311 @samp{little-endian} and @samp{native} for the native endianness of
2312 the target (the default). This option is not supported for C++.
2313
2314 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2315 code that is not binary compatible with code generated without it if the
2316 specified endianness is not the native endianness of the target.
2317 @end table
2318
2319 @node C++ Dialect Options
2320 @section Options Controlling C++ Dialect
2321
2322 @cindex compiler options, C++
2323 @cindex C++ options, command-line
2324 @cindex options, C++
2325 This section describes the command-line options that are only meaningful
2326 for C++ programs. You can also use most of the GNU compiler options
2327 regardless of what language your program is in. For example, you
2328 might compile a file @file{firstClass.C} like this:
2329
2330 @smallexample
2331 g++ -g -fstrict-enums -O -c firstClass.C
2332 @end smallexample
2333
2334 @noindent
2335 In this example, only @option{-fstrict-enums} is an option meant
2336 only for C++ programs; you can use the other options with any
2337 language supported by GCC@.
2338
2339 Some options for compiling C programs, such as @option{-std}, are also
2340 relevant for C++ programs.
2341 @xref{C Dialect Options,,Options Controlling C Dialect}.
2342
2343 Here is a list of options that are @emph{only} for compiling C++ programs:
2344
2345 @table @gcctabopt
2346
2347 @item -fabi-version=@var{n}
2348 @opindex fabi-version
2349 Use version @var{n} of the C++ ABI@. The default is version 0.
2350
2351 Version 0 refers to the version conforming most closely to
2352 the C++ ABI specification. Therefore, the ABI obtained using version 0
2353 will change in different versions of G++ as ABI bugs are fixed.
2354
2355 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2356
2357 Version 2 is the version of the C++ ABI that first appeared in G++
2358 3.4, and was the default through G++ 4.9.
2359
2360 Version 3 corrects an error in mangling a constant address as a
2361 template argument.
2362
2363 Version 4, which first appeared in G++ 4.5, implements a standard
2364 mangling for vector types.
2365
2366 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2367 attribute const/volatile on function pointer types, decltype of a
2368 plain decl, and use of a function parameter in the declaration of
2369 another parameter.
2370
2371 Version 6, which first appeared in G++ 4.7, corrects the promotion
2372 behavior of C++11 scoped enums and the mangling of template argument
2373 packs, const/static_cast, prefix ++ and --, and a class scope function
2374 used as a template argument.
2375
2376 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2377 builtin type and corrects the mangling of lambdas in default argument
2378 scope.
2379
2380 Version 8, which first appeared in G++ 4.9, corrects the substitution
2381 behavior of function types with function-cv-qualifiers.
2382
2383 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2384 @code{nullptr_t}.
2385
2386 Version 10, which first appeared in G++ 6.1, adds mangling of
2387 attributes that affect type identity, such as ia32 calling convention
2388 attributes (e.g.@: @samp{stdcall}).
2389
2390 Version 11, which first appeared in G++ 7, corrects the mangling of
2391 sizeof... expressions and operator names. For multiple entities with
2392 the same name within a function, that are declared in different scopes,
2393 the mangling now changes starting with the twelfth occurrence. It also
2394 implies @option{-fnew-inheriting-ctors}.
2395
2396 Version 12, which first appeared in G++ 8, corrects the calling
2397 conventions for empty classes on the x86_64 target and for classes
2398 with only deleted copy/move constructors. It accidentally changes the
2399 calling convention for classes with a deleted copy constructor and a
2400 trivial move constructor.
2401
2402 Version 13, which first appeared in G++ 8.2, fixes the accidental
2403 change in version 12.
2404
2405 See also @option{-Wabi}.
2406
2407 @item -fabi-compat-version=@var{n}
2408 @opindex fabi-compat-version
2409 On targets that support strong aliases, G++
2410 works around mangling changes by creating an alias with the correct
2411 mangled name when defining a symbol with an incorrect mangled name.
2412 This switch specifies which ABI version to use for the alias.
2413
2414 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2415 compatibility). If another ABI version is explicitly selected, this
2416 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2417 use @option{-fabi-compat-version=2}.
2418
2419 If this option is not provided but @option{-Wabi=@var{n}} is, that
2420 version is used for compatibility aliases. If this option is provided
2421 along with @option{-Wabi} (without the version), the version from this
2422 option is used for the warning.
2423
2424 @item -fno-access-control
2425 @opindex fno-access-control
2426 @opindex faccess-control
2427 Turn off all access checking. This switch is mainly useful for working
2428 around bugs in the access control code.
2429
2430 @item -faligned-new
2431 @opindex faligned-new
2432 Enable support for C++17 @code{new} of types that require more
2433 alignment than @code{void* ::operator new(std::size_t)} provides. A
2434 numeric argument such as @code{-faligned-new=32} can be used to
2435 specify how much alignment (in bytes) is provided by that function,
2436 but few users will need to override the default of
2437 @code{alignof(std::max_align_t)}.
2438
2439 This flag is enabled by default for @option{-std=c++17}.
2440
2441 @item -fchar8_t
2442 @itemx -fno-char8_t
2443 @opindex fchar8_t
2444 @opindex fno-char8_t
2445 Enable support for @code{char8_t} as adopted for C++2a. This includes
2446 the addition of a new @code{char8_t} fundamental type, changes to the
2447 types of UTF-8 string and character literals, new signatures for
2448 user-defined literals, associated standard library updates, and new
2449 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2450
2451 This option enables functions to be overloaded for ordinary and UTF-8
2452 strings:
2453
2454 @smallexample
2455 int f(const char *); // #1
2456 int f(const char8_t *); // #2
2457 int v1 = f("text"); // Calls #1
2458 int v2 = f(u8"text"); // Calls #2
2459 @end smallexample
2460
2461 @noindent
2462 and introduces new signatures for user-defined literals:
2463
2464 @smallexample
2465 int operator""_udl1(char8_t);
2466 int v3 = u8'x'_udl1;
2467 int operator""_udl2(const char8_t*, std::size_t);
2468 int v4 = u8"text"_udl2;
2469 template<typename T, T...> int operator""_udl3();
2470 int v5 = u8"text"_udl3;
2471 @end smallexample
2472
2473 @noindent
2474 The change to the types of UTF-8 string and character literals introduces
2475 incompatibilities with ISO C++11 and later standards. For example, the
2476 following code is well-formed under ISO C++11, but is ill-formed when
2477 @option{-fchar8_t} is specified.
2478
2479 @smallexample
2480 char ca[] = u8"xx"; // error: char-array initialized from wide
2481 // string
2482 const char *cp = u8"xx";// error: invalid conversion from
2483 // `const char8_t*' to `const char*'
2484 int f(const char*);
2485 auto v = f(u8"xx"); // error: invalid conversion from
2486 // `const char8_t*' to `const char*'
2487 std::string s@{u8"xx"@}; // error: no matching function for call to
2488 // `std::basic_string<char>::basic_string()'
2489 using namespace std::literals;
2490 s = u8"xx"s; // error: conversion from
2491 // `basic_string<char8_t>' to non-scalar
2492 // type `basic_string<char>' requested
2493 @end smallexample
2494
2495 @item -fcheck-new
2496 @opindex fcheck-new
2497 Check that the pointer returned by @code{operator new} is non-null
2498 before attempting to modify the storage allocated. This check is
2499 normally unnecessary because the C++ standard specifies that
2500 @code{operator new} only returns @code{0} if it is declared
2501 @code{throw()}, in which case the compiler always checks the
2502 return value even without this option. In all other cases, when
2503 @code{operator new} has a non-empty exception specification, memory
2504 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2505 @samp{new (nothrow)}.
2506
2507 @item -fconcepts
2508 @opindex fconcepts
2509 Enable support for the C++ Extensions for Concepts Technical
2510 Specification, ISO 19217 (2015), which allows code like
2511
2512 @smallexample
2513 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2514 template <Addable T> T add (T a, T b) @{ return a + b; @}
2515 @end smallexample
2516
2517 @item -fconstexpr-depth=@var{n}
2518 @opindex fconstexpr-depth
2519 Set the maximum nested evaluation depth for C++11 constexpr functions
2520 to @var{n}. A limit is needed to detect endless recursion during
2521 constant expression evaluation. The minimum specified by the standard
2522 is 512.
2523
2524 @item -fconstexpr-loop-limit=@var{n}
2525 @opindex fconstexpr-loop-limit
2526 Set the maximum number of iterations for a loop in C++14 constexpr functions
2527 to @var{n}. A limit is needed to detect infinite loops during
2528 constant expression evaluation. The default is 262144 (1<<18).
2529
2530 @item -fconstexpr-ops-limit=@var{n}
2531 @opindex fconstexpr-ops-limit
2532 Set the maximum number of operations during a single constexpr evaluation.
2533 Even when number of iterations of a single loop is limited with the above limit,
2534 if there are several nested loops and each of them has many iterations but still
2535 smaller than the above limit, or if in a body of some loop or even outside
2536 of a loop too many expressions need to be evaluated, the resulting constexpr
2537 evaluation might take too long.
2538 The default is 33554432 (1<<25).
2539
2540 @item -fdeduce-init-list
2541 @opindex fdeduce-init-list
2542 Enable deduction of a template type parameter as
2543 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2544
2545 @smallexample
2546 template <class T> auto forward(T t) -> decltype (realfn (t))
2547 @{
2548 return realfn (t);
2549 @}
2550
2551 void f()
2552 @{
2553 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2554 @}
2555 @end smallexample
2556
2557 This deduction was implemented as a possible extension to the
2558 originally proposed semantics for the C++11 standard, but was not part
2559 of the final standard, so it is disabled by default. This option is
2560 deprecated, and may be removed in a future version of G++.
2561
2562 @item -fno-elide-constructors
2563 @opindex fno-elide-constructors
2564 @opindex felide-constructors
2565 The C++ standard allows an implementation to omit creating a temporary
2566 that is only used to initialize another object of the same type.
2567 Specifying this option disables that optimization, and forces G++ to
2568 call the copy constructor in all cases. This option also causes G++
2569 to call trivial member functions which otherwise would be expanded inline.
2570
2571 In C++17, the compiler is required to omit these temporaries, but this
2572 option still affects trivial member functions.
2573
2574 @item -fno-enforce-eh-specs
2575 @opindex fno-enforce-eh-specs
2576 @opindex fenforce-eh-specs
2577 Don't generate code to check for violation of exception specifications
2578 at run time. This option violates the C++ standard, but may be useful
2579 for reducing code size in production builds, much like defining
2580 @code{NDEBUG}. This does not give user code permission to throw
2581 exceptions in violation of the exception specifications; the compiler
2582 still optimizes based on the specifications, so throwing an
2583 unexpected exception results in undefined behavior at run time.
2584
2585 @item -fextern-tls-init
2586 @itemx -fno-extern-tls-init
2587 @opindex fextern-tls-init
2588 @opindex fno-extern-tls-init
2589 The C++11 and OpenMP standards allow @code{thread_local} and
2590 @code{threadprivate} variables to have dynamic (runtime)
2591 initialization. To support this, any use of such a variable goes
2592 through a wrapper function that performs any necessary initialization.
2593 When the use and definition of the variable are in the same
2594 translation unit, this overhead can be optimized away, but when the
2595 use is in a different translation unit there is significant overhead
2596 even if the variable doesn't actually need dynamic initialization. If
2597 the programmer can be sure that no use of the variable in a
2598 non-defining TU needs to trigger dynamic initialization (either
2599 because the variable is statically initialized, or a use of the
2600 variable in the defining TU will be executed before any uses in
2601 another TU), they can avoid this overhead with the
2602 @option{-fno-extern-tls-init} option.
2603
2604 On targets that support symbol aliases, the default is
2605 @option{-fextern-tls-init}. On targets that do not support symbol
2606 aliases, the default is @option{-fno-extern-tls-init}.
2607
2608 @item -fno-gnu-keywords
2609 @opindex fno-gnu-keywords
2610 @opindex fgnu-keywords
2611 Do not recognize @code{typeof} as a keyword, so that code can use this
2612 word as an identifier. You can use the keyword @code{__typeof__} instead.
2613 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2614 @option{-std=c++98}, @option{-std=c++11}, etc.
2615
2616 @item -fno-implicit-templates
2617 @opindex fno-implicit-templates
2618 @opindex fimplicit-templates
2619 Never emit code for non-inline templates that are instantiated
2620 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2621 If you use this option, you must take care to structure your code to
2622 include all the necessary explicit instantiations to avoid getting
2623 undefined symbols at link time.
2624 @xref{Template Instantiation}, for more information.
2625
2626 @item -fno-implicit-inline-templates
2627 @opindex fno-implicit-inline-templates
2628 @opindex fimplicit-inline-templates
2629 Don't emit code for implicit instantiations of inline templates, either.
2630 The default is to handle inlines differently so that compiles with and
2631 without optimization need the same set of explicit instantiations.
2632
2633 @item -fno-implement-inlines
2634 @opindex fno-implement-inlines
2635 @opindex fimplement-inlines
2636 To save space, do not emit out-of-line copies of inline functions
2637 controlled by @code{#pragma implementation}. This causes linker
2638 errors if these functions are not inlined everywhere they are called.
2639
2640 @item -fms-extensions
2641 @opindex fms-extensions
2642 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2643 int and getting a pointer to member function via non-standard syntax.
2644
2645 @item -fnew-inheriting-ctors
2646 @opindex fnew-inheriting-ctors
2647 Enable the P0136 adjustment to the semantics of C++11 constructor
2648 inheritance. This is part of C++17 but also considered to be a Defect
2649 Report against C++11 and C++14. This flag is enabled by default
2650 unless @option{-fabi-version=10} or lower is specified.
2651
2652 @item -fnew-ttp-matching
2653 @opindex fnew-ttp-matching
2654 Enable the P0522 resolution to Core issue 150, template template
2655 parameters and default arguments: this allows a template with default
2656 template arguments as an argument for a template template parameter
2657 with fewer template parameters. This flag is enabled by default for
2658 @option{-std=c++17}.
2659
2660 @item -fno-nonansi-builtins
2661 @opindex fno-nonansi-builtins
2662 @opindex fnonansi-builtins
2663 Disable built-in declarations of functions that are not mandated by
2664 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2665 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2666
2667 @item -fnothrow-opt
2668 @opindex fnothrow-opt
2669 Treat a @code{throw()} exception specification as if it were a
2670 @code{noexcept} specification to reduce or eliminate the text size
2671 overhead relative to a function with no exception specification. If
2672 the function has local variables of types with non-trivial
2673 destructors, the exception specification actually makes the
2674 function smaller because the EH cleanups for those variables can be
2675 optimized away. The semantic effect is that an exception thrown out of
2676 a function with such an exception specification results in a call
2677 to @code{terminate} rather than @code{unexpected}.
2678
2679 @item -fno-operator-names
2680 @opindex fno-operator-names
2681 @opindex foperator-names
2682 Do not treat the operator name keywords @code{and}, @code{bitand},
2683 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2684 synonyms as keywords.
2685
2686 @item -fno-optional-diags
2687 @opindex fno-optional-diags
2688 @opindex foptional-diags
2689 Disable diagnostics that the standard says a compiler does not need to
2690 issue. Currently, the only such diagnostic issued by G++ is the one for
2691 a name having multiple meanings within a class.
2692
2693 @item -fpermissive
2694 @opindex fpermissive
2695 Downgrade some diagnostics about nonconformant code from errors to
2696 warnings. Thus, using @option{-fpermissive} allows some
2697 nonconforming code to compile.
2698
2699 @item -fno-pretty-templates
2700 @opindex fno-pretty-templates
2701 @opindex fpretty-templates
2702 When an error message refers to a specialization of a function
2703 template, the compiler normally prints the signature of the
2704 template followed by the template arguments and any typedefs or
2705 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2706 rather than @code{void f(int)}) so that it's clear which template is
2707 involved. When an error message refers to a specialization of a class
2708 template, the compiler omits any template arguments that match
2709 the default template arguments for that template. If either of these
2710 behaviors make it harder to understand the error message rather than
2711 easier, you can use @option{-fno-pretty-templates} to disable them.
2712
2713 @item -frepo
2714 @opindex frepo
2715 Enable automatic template instantiation at link time. This option also
2716 implies @option{-fno-implicit-templates}. @xref{Template
2717 Instantiation}, for more information.
2718
2719 @item -fno-rtti
2720 @opindex fno-rtti
2721 @opindex frtti
2722 Disable generation of information about every class with virtual
2723 functions for use by the C++ run-time type identification features
2724 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2725 of the language, you can save some space by using this flag. Note that
2726 exception handling uses the same information, but G++ generates it as
2727 needed. The @code{dynamic_cast} operator can still be used for casts that
2728 do not require run-time type information, i.e.@: casts to @code{void *} or to
2729 unambiguous base classes.
2730
2731 Mixing code compiled with @option{-frtti} with that compiled with
2732 @option{-fno-rtti} may not work. For example, programs may
2733 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2734 for a class compiled with @option{-frtti}.
2735
2736 @item -fsized-deallocation
2737 @opindex fsized-deallocation
2738 Enable the built-in global declarations
2739 @smallexample
2740 void operator delete (void *, std::size_t) noexcept;
2741 void operator delete[] (void *, std::size_t) noexcept;
2742 @end smallexample
2743 as introduced in C++14. This is useful for user-defined replacement
2744 deallocation functions that, for example, use the size of the object
2745 to make deallocation faster. Enabled by default under
2746 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2747 warns about places that might want to add a definition.
2748
2749 @item -fstrict-enums
2750 @opindex fstrict-enums
2751 Allow the compiler to optimize using the assumption that a value of
2752 enumerated type can only be one of the values of the enumeration (as
2753 defined in the C++ standard; basically, a value that can be
2754 represented in the minimum number of bits needed to represent all the
2755 enumerators). This assumption may not be valid if the program uses a
2756 cast to convert an arbitrary integer value to the enumerated type.
2757
2758 @item -fstrong-eval-order
2759 @opindex fstrong-eval-order
2760 Evaluate member access, array subscripting, and shift expressions in
2761 left-to-right order, and evaluate assignment in right-to-left order,
2762 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2763 @option{-fstrong-eval-order=some} enables just the ordering of member
2764 access and shift expressions, and is the default without
2765 @option{-std=c++17}.
2766
2767 @item -ftemplate-backtrace-limit=@var{n}
2768 @opindex ftemplate-backtrace-limit
2769 Set the maximum number of template instantiation notes for a single
2770 warning or error to @var{n}. The default value is 10.
2771
2772 @item -ftemplate-depth=@var{n}
2773 @opindex ftemplate-depth
2774 Set the maximum instantiation depth for template classes to @var{n}.
2775 A limit on the template instantiation depth is needed to detect
2776 endless recursions during template class instantiation. ANSI/ISO C++
2777 conforming programs must not rely on a maximum depth greater than 17
2778 (changed to 1024 in C++11). The default value is 900, as the compiler
2779 can run out of stack space before hitting 1024 in some situations.
2780
2781 @item -fno-threadsafe-statics
2782 @opindex fno-threadsafe-statics
2783 @opindex fthreadsafe-statics
2784 Do not emit the extra code to use the routines specified in the C++
2785 ABI for thread-safe initialization of local statics. You can use this
2786 option to reduce code size slightly in code that doesn't need to be
2787 thread-safe.
2788
2789 @item -fuse-cxa-atexit
2790 @opindex fuse-cxa-atexit
2791 Register destructors for objects with static storage duration with the
2792 @code{__cxa_atexit} function rather than the @code{atexit} function.
2793 This option is required for fully standards-compliant handling of static
2794 destructors, but only works if your C library supports
2795 @code{__cxa_atexit}.
2796
2797 @item -fno-use-cxa-get-exception-ptr
2798 @opindex fno-use-cxa-get-exception-ptr
2799 @opindex fuse-cxa-get-exception-ptr
2800 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2801 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2802 if the runtime routine is not available.
2803
2804 @item -fvisibility-inlines-hidden
2805 @opindex fvisibility-inlines-hidden
2806 This switch declares that the user does not attempt to compare
2807 pointers to inline functions or methods where the addresses of the two functions
2808 are taken in different shared objects.
2809
2810 The effect of this is that GCC may, effectively, mark inline methods with
2811 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2812 appear in the export table of a DSO and do not require a PLT indirection
2813 when used within the DSO@. Enabling this option can have a dramatic effect
2814 on load and link times of a DSO as it massively reduces the size of the
2815 dynamic export table when the library makes heavy use of templates.
2816
2817 The behavior of this switch is not quite the same as marking the
2818 methods as hidden directly, because it does not affect static variables
2819 local to the function or cause the compiler to deduce that
2820 the function is defined in only one shared object.
2821
2822 You may mark a method as having a visibility explicitly to negate the
2823 effect of the switch for that method. For example, if you do want to
2824 compare pointers to a particular inline method, you might mark it as
2825 having default visibility. Marking the enclosing class with explicit
2826 visibility has no effect.
2827
2828 Explicitly instantiated inline methods are unaffected by this option
2829 as their linkage might otherwise cross a shared library boundary.
2830 @xref{Template Instantiation}.
2831
2832 @item -fvisibility-ms-compat
2833 @opindex fvisibility-ms-compat
2834 This flag attempts to use visibility settings to make GCC's C++
2835 linkage model compatible with that of Microsoft Visual Studio.
2836
2837 The flag makes these changes to GCC's linkage model:
2838
2839 @enumerate
2840 @item
2841 It sets the default visibility to @code{hidden}, like
2842 @option{-fvisibility=hidden}.
2843
2844 @item
2845 Types, but not their members, are not hidden by default.
2846
2847 @item
2848 The One Definition Rule is relaxed for types without explicit
2849 visibility specifications that are defined in more than one
2850 shared object: those declarations are permitted if they are
2851 permitted when this option is not used.
2852 @end enumerate
2853
2854 In new code it is better to use @option{-fvisibility=hidden} and
2855 export those classes that are intended to be externally visible.
2856 Unfortunately it is possible for code to rely, perhaps accidentally,
2857 on the Visual Studio behavior.
2858
2859 Among the consequences of these changes are that static data members
2860 of the same type with the same name but defined in different shared
2861 objects are different, so changing one does not change the other;
2862 and that pointers to function members defined in different shared
2863 objects may not compare equal. When this flag is given, it is a
2864 violation of the ODR to define types with the same name differently.
2865
2866 @item -fno-weak
2867 @opindex fno-weak
2868 @opindex fweak
2869 Do not use weak symbol support, even if it is provided by the linker.
2870 By default, G++ uses weak symbols if they are available. This
2871 option exists only for testing, and should not be used by end-users;
2872 it results in inferior code and has no benefits. This option may
2873 be removed in a future release of G++.
2874
2875 @item -nostdinc++
2876 @opindex nostdinc++
2877 Do not search for header files in the standard directories specific to
2878 C++, but do still search the other standard directories. (This option
2879 is used when building the C++ library.)
2880 @end table
2881
2882 In addition, these optimization, warning, and code generation options
2883 have meanings only for C++ programs:
2884
2885 @table @gcctabopt
2886 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2887 @opindex Wabi
2888 @opindex Wno-abi
2889 Warn when G++ it generates code that is probably not compatible with
2890 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2891 ABI with each major release, normally @option{-Wabi} will warn only if
2892 there is a check added later in a release series for an ABI issue
2893 discovered since the initial release. @option{-Wabi} will warn about
2894 more things if an older ABI version is selected (with
2895 @option{-fabi-version=@var{n}}).
2896
2897 @option{-Wabi} can also be used with an explicit version number to
2898 warn about compatibility with a particular @option{-fabi-version}
2899 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2900 @option{-fabi-version=2}.
2901
2902 If an explicit version number is provided and
2903 @option{-fabi-compat-version} is not specified, the version number
2904 from this option is used for compatibility aliases. If no explicit
2905 version number is provided with this option, but
2906 @option{-fabi-compat-version} is specified, that version number is
2907 used for ABI warnings.
2908
2909 Although an effort has been made to warn about
2910 all such cases, there are probably some cases that are not warned about,
2911 even though G++ is generating incompatible code. There may also be
2912 cases where warnings are emitted even though the code that is generated
2913 is compatible.
2914
2915 You should rewrite your code to avoid these warnings if you are
2916 concerned about the fact that code generated by G++ may not be binary
2917 compatible with code generated by other compilers.
2918
2919 Known incompatibilities in @option{-fabi-version=2} (which was the
2920 default from GCC 3.4 to 4.9) include:
2921
2922 @itemize @bullet
2923
2924 @item
2925 A template with a non-type template parameter of reference type was
2926 mangled incorrectly:
2927 @smallexample
2928 extern int N;
2929 template <int &> struct S @{@};
2930 void n (S<N>) @{2@}
2931 @end smallexample
2932
2933 This was fixed in @option{-fabi-version=3}.
2934
2935 @item
2936 SIMD vector types declared using @code{__attribute ((vector_size))} were
2937 mangled in a non-standard way that does not allow for overloading of
2938 functions taking vectors of different sizes.
2939
2940 The mangling was changed in @option{-fabi-version=4}.
2941
2942 @item
2943 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2944 qualifiers, and @code{decltype} of a plain declaration was folded away.
2945
2946 These mangling issues were fixed in @option{-fabi-version=5}.
2947
2948 @item
2949 Scoped enumerators passed as arguments to a variadic function are
2950 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2951 On most targets this does not actually affect the parameter passing
2952 ABI, as there is no way to pass an argument smaller than @code{int}.
2953
2954 Also, the ABI changed the mangling of template argument packs,
2955 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2956 a class scope function used as a template argument.
2957
2958 These issues were corrected in @option{-fabi-version=6}.
2959
2960 @item
2961 Lambdas in default argument scope were mangled incorrectly, and the
2962 ABI changed the mangling of @code{nullptr_t}.
2963
2964 These issues were corrected in @option{-fabi-version=7}.
2965
2966 @item
2967 When mangling a function type with function-cv-qualifiers, the
2968 un-qualified function type was incorrectly treated as a substitution
2969 candidate.
2970
2971 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2972
2973 @item
2974 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2975 unaligned accesses. Note that this did not affect the ABI of a
2976 function with a @code{nullptr_t} parameter, as parameters have a
2977 minimum alignment.
2978
2979 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2980
2981 @item
2982 Target-specific attributes that affect the identity of a type, such as
2983 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2984 did not affect the mangled name, leading to name collisions when
2985 function pointers were used as template arguments.
2986
2987 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2988
2989 @end itemize
2990
2991 It also warns about psABI-related changes. The known psABI changes at this
2992 point include:
2993
2994 @itemize @bullet
2995
2996 @item
2997 For SysV/x86-64, unions with @code{long double} members are
2998 passed in memory as specified in psABI. For example:
2999
3000 @smallexample
3001 union U @{
3002 long double ld;
3003 int i;
3004 @};
3005 @end smallexample
3006
3007 @noindent
3008 @code{union U} is always passed in memory.
3009
3010 @end itemize
3011
3012 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3013 @opindex Wabi-tag
3014 @opindex Wabi-tag
3015 Warn when a type with an ABI tag is used in a context that does not
3016 have that ABI tag. See @ref{C++ Attributes} for more information
3017 about ABI tags.
3018
3019 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3020 @opindex Wctor-dtor-privacy
3021 @opindex Wno-ctor-dtor-privacy
3022 Warn when a class seems unusable because all the constructors or
3023 destructors in that class are private, and it has neither friends nor
3024 public static member functions. Also warn if there are no non-private
3025 methods, and there's at least one private member function that isn't
3026 a constructor or destructor.
3027
3028 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3029 @opindex Wdelete-non-virtual-dtor
3030 @opindex Wno-delete-non-virtual-dtor
3031 Warn when @code{delete} is used to destroy an instance of a class that
3032 has virtual functions and non-virtual destructor. It is unsafe to delete
3033 an instance of a derived class through a pointer to a base class if the
3034 base class does not have a virtual destructor. This warning is enabled
3035 by @option{-Wall}.
3036
3037 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3038 @opindex Wdeprecated-copy
3039 @opindex Wno-deprecated-copy
3040 Warn that the implicit declaration of a copy constructor or copy
3041 assignment operator is deprecated if the class has a user-provided
3042 copy constructor or copy assignment operator, in C++11 and up. This
3043 warning is enabled by @option{-Wextra}. With
3044 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3045 user-provided destructor.
3046
3047 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3048 @opindex Winit-list-lifetime
3049 @opindex Wno-init-list-lifetime
3050 Do not warn about uses of @code{std::initializer_list} that are likely
3051 to result in dangling pointers. Since the underlying array for an
3052 @code{initializer_list} is handled like a normal C++ temporary object,
3053 it is easy to inadvertently keep a pointer to the array past the end
3054 of the array's lifetime. For example:
3055
3056 @itemize @bullet
3057 @item
3058 If a function returns a temporary @code{initializer_list}, or a local
3059 @code{initializer_list} variable, the array's lifetime ends at the end
3060 of the return statement, so the value returned has a dangling pointer.
3061
3062 @item
3063 If a new-expression creates an @code{initializer_list}, the array only
3064 lives until the end of the enclosing full-expression, so the
3065 @code{initializer_list} in the heap has a dangling pointer.
3066
3067 @item
3068 When an @code{initializer_list} variable is assigned from a
3069 brace-enclosed initializer list, the temporary array created for the
3070 right side of the assignment only lives until the end of the
3071 full-expression, so at the next statement the @code{initializer_list}
3072 variable has a dangling pointer.
3073
3074 @smallexample
3075 // li's initial underlying array lives as long as li
3076 std::initializer_list<int> li = @{ 1,2,3 @};
3077 // assignment changes li to point to a temporary array
3078 li = @{ 4, 5 @};
3079 // now the temporary is gone and li has a dangling pointer
3080 int i = li.begin()[0] // undefined behavior
3081 @end smallexample
3082
3083 @item
3084 When a list constructor stores the @code{begin} pointer from the
3085 @code{initializer_list} argument, this doesn't extend the lifetime of
3086 the array, so if a class variable is constructed from a temporary
3087 @code{initializer_list}, the pointer is left dangling by the end of
3088 the variable declaration statement.
3089
3090 @end itemize
3091
3092 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3093 @opindex Wliteral-suffix
3094 @opindex Wno-literal-suffix
3095 Warn when a string or character literal is followed by a ud-suffix which does
3096 not begin with an underscore. As a conforming extension, GCC treats such
3097 suffixes as separate preprocessing tokens in order to maintain backwards
3098 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3099 For example:
3100
3101 @smallexample
3102 #define __STDC_FORMAT_MACROS
3103 #include <inttypes.h>
3104 #include <stdio.h>
3105
3106 int main() @{
3107 int64_t i64 = 123;
3108 printf("My int64: %" PRId64"\n", i64);
3109 @}
3110 @end smallexample
3111
3112 In this case, @code{PRId64} is treated as a separate preprocessing token.
3113
3114 Additionally, warn when a user-defined literal operator is declared with
3115 a literal suffix identifier that doesn't begin with an underscore. Literal
3116 suffix identifiers that don't begin with an underscore are reserved for
3117 future standardization.
3118
3119 This warning is enabled by default.
3120
3121 @item -Wlto-type-mismatch
3122 @opindex Wlto-type-mismatch
3123 @opindex Wno-lto-type-mismatch
3124
3125 During the link-time optimization warn about type mismatches in
3126 global declarations from different compilation units.
3127 Requires @option{-flto} to be enabled. Enabled by default.
3128
3129 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3130 @opindex Wnarrowing
3131 @opindex Wno-narrowing
3132 For C++11 and later standards, narrowing conversions are diagnosed by default,
3133 as required by the standard. A narrowing conversion from a constant produces
3134 an error, and a narrowing conversion from a non-constant produces a warning,
3135 but @option{-Wno-narrowing} suppresses the diagnostic.
3136 Note that this does not affect the meaning of well-formed code;
3137 narrowing conversions are still considered ill-formed in SFINAE contexts.
3138
3139 With @option{-Wnarrowing} in C++98, warn when a narrowing
3140 conversion prohibited by C++11 occurs within
3141 @samp{@{ @}}, e.g.
3142
3143 @smallexample
3144 int i = @{ 2.2 @}; // error: narrowing from double to int
3145 @end smallexample
3146
3147 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3148
3149 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3150 @opindex Wnoexcept
3151 @opindex Wno-noexcept
3152 Warn when a noexcept-expression evaluates to false because of a call
3153 to a function that does not have a non-throwing exception
3154 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3155 the compiler to never throw an exception.
3156
3157 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3158 @opindex Wnoexcept-type
3159 @opindex Wno-noexcept-type
3160 Warn if the C++17 feature making @code{noexcept} part of a function
3161 type changes the mangled name of a symbol relative to C++14. Enabled
3162 by @option{-Wabi} and @option{-Wc++17-compat}.
3163
3164 As an example:
3165
3166 @smallexample
3167 template <class T> void f(T t) @{ t(); @};
3168 void g() noexcept;
3169 void h() @{ f(g); @}
3170 @end smallexample
3171
3172 @noindent
3173 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3174 C++17 it calls @code{f<void(*)()noexcept>}.
3175
3176 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3177 @opindex Wclass-memaccess
3178 @opindex Wno-class-memaccess
3179 Warn when the destination of a call to a raw memory function such as
3180 @code{memset} or @code{memcpy} is an object of class type, and when writing
3181 into such an object might bypass the class non-trivial or deleted constructor
3182 or copy assignment, violate const-correctness or encapsulation, or corrupt
3183 virtual table pointers. Modifying the representation of such objects may
3184 violate invariants maintained by member functions of the class. For example,
3185 the call to @code{memset} below is undefined because it modifies a non-trivial
3186 class object and is, therefore, diagnosed. The safe way to either initialize
3187 or clear the storage of objects of such types is by using the appropriate
3188 constructor or assignment operator, if one is available.
3189 @smallexample
3190 std::string str = "abc";
3191 memset (&str, 0, sizeof str);
3192 @end smallexample
3193 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3194 Explicitly casting the pointer to the class object to @code{void *} or
3195 to a type that can be safely accessed by the raw memory function suppresses
3196 the warning.
3197
3198 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3199 @opindex Wnon-virtual-dtor
3200 @opindex Wno-non-virtual-dtor
3201 Warn when a class has virtual functions and an accessible non-virtual
3202 destructor itself or in an accessible polymorphic base class, in which
3203 case it is possible but unsafe to delete an instance of a derived
3204 class through a pointer to the class itself or base class. This
3205 warning is automatically enabled if @option{-Weffc++} is specified.
3206
3207 @item -Wregister @r{(C++ and Objective-C++ only)}
3208 @opindex Wregister
3209 @opindex Wno-register
3210 Warn on uses of the @code{register} storage class specifier, except
3211 when it is part of the GNU @ref{Explicit Register Variables} extension.
3212 The use of the @code{register} keyword as storage class specifier has
3213 been deprecated in C++11 and removed in C++17.
3214 Enabled by default with @option{-std=c++17}.
3215
3216 @item -Wreorder @r{(C++ and Objective-C++ only)}
3217 @opindex Wreorder
3218 @opindex Wno-reorder
3219 @cindex reordering, warning
3220 @cindex warning for reordering of member initializers
3221 Warn when the order of member initializers given in the code does not
3222 match the order in which they must be executed. For instance:
3223
3224 @smallexample
3225 struct A @{
3226 int i;
3227 int j;
3228 A(): j (0), i (1) @{ @}
3229 @};
3230 @end smallexample
3231
3232 @noindent
3233 The compiler rearranges the member initializers for @code{i}
3234 and @code{j} to match the declaration order of the members, emitting
3235 a warning to that effect. This warning is enabled by @option{-Wall}.
3236
3237 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3238 @opindex Wpessimizing-move
3239 @opindex Wno-pessimizing-move
3240 This warning warns when a call to @code{std::move} prevents copy
3241 elision. A typical scenario when copy elision can occur is when returning in
3242 a function with a class return type, when the expression being returned is the
3243 name of a non-volatile automatic object, and is not a function parameter, and
3244 has the same type as the function return type.
3245
3246 @smallexample
3247 struct T @{
3248 @dots{}
3249 @};
3250 T fn()
3251 @{
3252 T t;
3253 @dots{}
3254 return std::move (t);
3255 @}
3256 @end smallexample
3257
3258 But in this example, the @code{std::move} call prevents copy elision.
3259
3260 This warning is enabled by @option{-Wall}.
3261
3262 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3263 @opindex Wredundant-move
3264 @opindex Wno-redundant-move
3265 This warning warns about redundant calls to @code{std::move}; that is, when
3266 a move operation would have been performed even without the @code{std::move}
3267 call. This happens because the compiler is forced to treat the object as if
3268 it were an rvalue in certain situations such as returning a local variable,
3269 where copy elision isn't applicable. Consider:
3270
3271 @smallexample
3272 struct T @{
3273 @dots{}
3274 @};
3275 T fn(T t)
3276 @{
3277 @dots{}
3278 return std::move (t);
3279 @}
3280 @end smallexample
3281
3282 Here, the @code{std::move} call is redundant. Because G++ implements Core
3283 Issue 1579, another example is:
3284
3285 @smallexample
3286 struct T @{ // convertible to U
3287 @dots{}
3288 @};
3289 struct U @{
3290 @dots{}
3291 @};
3292 U fn()
3293 @{
3294 T t;
3295 @dots{}
3296 return std::move (t);
3297 @}
3298 @end smallexample
3299 In this example, copy elision isn't applicable because the type of the
3300 expression being returned and the function return type differ, yet G++
3301 treats the return value as if it were designated by an rvalue.
3302
3303 This warning is enabled by @option{-Wextra}.
3304
3305 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3306 @opindex fext-numeric-literals
3307 @opindex fno-ext-numeric-literals
3308 Accept imaginary, fixed-point, or machine-defined
3309 literal number suffixes as GNU extensions.
3310 When this option is turned off these suffixes are treated
3311 as C++11 user-defined literal numeric suffixes.
3312 This is on by default for all pre-C++11 dialects and all GNU dialects:
3313 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3314 @option{-std=gnu++14}.
3315 This option is off by default
3316 for ISO C++11 onwards (@option{-std=c++11}, ...).
3317 @end table
3318
3319 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3320
3321 @table @gcctabopt
3322 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3323 @opindex Weffc++
3324 @opindex Wno-effc++
3325 Warn about violations of the following style guidelines from Scott Meyers'
3326 @cite{Effective C++} series of books:
3327
3328 @itemize @bullet
3329 @item
3330 Define a copy constructor and an assignment operator for classes
3331 with dynamically-allocated memory.
3332
3333 @item
3334 Prefer initialization to assignment in constructors.
3335
3336 @item
3337 Have @code{operator=} return a reference to @code{*this}.
3338
3339 @item
3340 Don't try to return a reference when you must return an object.
3341
3342 @item
3343 Distinguish between prefix and postfix forms of increment and
3344 decrement operators.
3345
3346 @item
3347 Never overload @code{&&}, @code{||}, or @code{,}.
3348
3349 @end itemize
3350
3351 This option also enables @option{-Wnon-virtual-dtor}, which is also
3352 one of the effective C++ recommendations. However, the check is
3353 extended to warn about the lack of virtual destructor in accessible
3354 non-polymorphic bases classes too.
3355
3356 When selecting this option, be aware that the standard library
3357 headers do not obey all of these guidelines; use @samp{grep -v}
3358 to filter out those warnings.
3359
3360 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3361 @opindex Wstrict-null-sentinel
3362 @opindex Wno-strict-null-sentinel
3363 Warn about the use of an uncasted @code{NULL} as sentinel. When
3364 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3365 to @code{__null}. Although it is a null pointer constant rather than a
3366 null pointer, it is guaranteed to be of the same size as a pointer.
3367 But this use is not portable across different compilers.
3368
3369 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3370 @opindex Wno-non-template-friend
3371 @opindex Wnon-template-friend
3372 Disable warnings when non-template friend functions are declared
3373 within a template. In very old versions of GCC that predate implementation
3374 of the ISO standard, declarations such as
3375 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3376 could be interpreted as a particular specialization of a template
3377 function; the warning exists to diagnose compatibility problems,
3378 and is enabled by default.
3379
3380 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3381 @opindex Wold-style-cast
3382 @opindex Wno-old-style-cast
3383 Warn if an old-style (C-style) cast to a non-void type is used within
3384 a C++ program. The new-style casts (@code{dynamic_cast},
3385 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3386 less vulnerable to unintended effects and much easier to search for.
3387
3388 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3389 @opindex Woverloaded-virtual
3390 @opindex Wno-overloaded-virtual
3391 @cindex overloaded virtual function, warning
3392 @cindex warning for overloaded virtual function
3393 Warn when a function declaration hides virtual functions from a
3394 base class. For example, in:
3395
3396 @smallexample
3397 struct A @{
3398 virtual void f();
3399 @};
3400
3401 struct B: public A @{
3402 void f(int);
3403 @};
3404 @end smallexample
3405
3406 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3407 like:
3408
3409 @smallexample
3410 B* b;
3411 b->f();
3412 @end smallexample
3413
3414 @noindent
3415 fails to compile.
3416
3417 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3418 @opindex Wno-pmf-conversions
3419 @opindex Wpmf-conversions
3420 Disable the diagnostic for converting a bound pointer to member function
3421 to a plain pointer.
3422
3423 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3424 @opindex Wsign-promo
3425 @opindex Wno-sign-promo
3426 Warn when overload resolution chooses a promotion from unsigned or
3427 enumerated type to a signed type, over a conversion to an unsigned type of
3428 the same size. Previous versions of G++ tried to preserve
3429 unsignedness, but the standard mandates the current behavior.
3430
3431 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3432 @opindex Wtemplates
3433 @opindex Wno-templates
3434 Warn when a primary template declaration is encountered. Some coding
3435 rules disallow templates, and this may be used to enforce that rule.
3436 The warning is inactive inside a system header file, such as the STL, so
3437 one can still use the STL. One may also instantiate or specialize
3438 templates.
3439
3440 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3441 @opindex Wmultiple-inheritance
3442 @opindex Wno-multiple-inheritance
3443 Warn when a class is defined with multiple direct base classes. Some
3444 coding rules disallow multiple inheritance, and this may be used to
3445 enforce that rule. The warning is inactive inside a system header file,
3446 such as the STL, so one can still use the STL. One may also define
3447 classes that indirectly use multiple inheritance.
3448
3449 @item -Wvirtual-inheritance
3450 @opindex Wvirtual-inheritance
3451 @opindex Wno-virtual-inheritance
3452 Warn when a class is defined with a virtual direct base class. Some
3453 coding rules disallow multiple inheritance, and this may be used to
3454 enforce that rule. The warning is inactive inside a system header file,
3455 such as the STL, so one can still use the STL. One may also define
3456 classes that indirectly use virtual inheritance.
3457
3458 @item -Wnamespaces
3459 @opindex Wnamespaces
3460 @opindex Wno-namespaces
3461 Warn when a namespace definition is opened. Some coding rules disallow
3462 namespaces, and this may be used to enforce that rule. The warning is
3463 inactive inside a system header file, such as the STL, so one can still
3464 use the STL. One may also use using directives and qualified names.
3465
3466 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3467 @opindex Wterminate
3468 @opindex Wno-terminate
3469 Disable the warning about a throw-expression that will immediately
3470 result in a call to @code{terminate}.
3471
3472 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3473 @opindex Wno-class-conversion
3474 @opindex Wclass-conversion
3475 Disable the warning about the case when a conversion function converts an
3476 object to the same type, to a base class of that type, or to void; such
3477 a conversion function will never be called.
3478 @end table
3479
3480 @node Objective-C and Objective-C++ Dialect Options
3481 @section Options Controlling Objective-C and Objective-C++ Dialects
3482
3483 @cindex compiler options, Objective-C and Objective-C++
3484 @cindex Objective-C and Objective-C++ options, command-line
3485 @cindex options, Objective-C and Objective-C++
3486 (NOTE: This manual does not describe the Objective-C and Objective-C++
3487 languages themselves. @xref{Standards,,Language Standards
3488 Supported by GCC}, for references.)
3489
3490 This section describes the command-line options that are only meaningful
3491 for Objective-C and Objective-C++ programs. You can also use most of
3492 the language-independent GNU compiler options.
3493 For example, you might compile a file @file{some_class.m} like this:
3494
3495 @smallexample
3496 gcc -g -fgnu-runtime -O -c some_class.m
3497 @end smallexample
3498
3499 @noindent
3500 In this example, @option{-fgnu-runtime} is an option meant only for
3501 Objective-C and Objective-C++ programs; you can use the other options with
3502 any language supported by GCC@.
3503
3504 Note that since Objective-C is an extension of the C language, Objective-C
3505 compilations may also use options specific to the C front-end (e.g.,
3506 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3507 C++-specific options (e.g., @option{-Wabi}).
3508
3509 Here is a list of options that are @emph{only} for compiling Objective-C
3510 and Objective-C++ programs:
3511
3512 @table @gcctabopt
3513 @item -fconstant-string-class=@var{class-name}
3514 @opindex fconstant-string-class
3515 Use @var{class-name} as the name of the class to instantiate for each
3516 literal string specified with the syntax @code{@@"@dots{}"}. The default
3517 class name is @code{NXConstantString} if the GNU runtime is being used, and
3518 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3519 @option{-fconstant-cfstrings} option, if also present, overrides the
3520 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3521 to be laid out as constant CoreFoundation strings.
3522
3523 @item -fgnu-runtime
3524 @opindex fgnu-runtime
3525 Generate object code compatible with the standard GNU Objective-C
3526 runtime. This is the default for most types of systems.
3527
3528 @item -fnext-runtime
3529 @opindex fnext-runtime
3530 Generate output compatible with the NeXT runtime. This is the default
3531 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3532 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3533 used.
3534
3535 @item -fno-nil-receivers
3536 @opindex fno-nil-receivers
3537 @opindex fnil-receivers
3538 Assume that all Objective-C message dispatches (@code{[receiver
3539 message:arg]}) in this translation unit ensure that the receiver is
3540 not @code{nil}. This allows for more efficient entry points in the
3541 runtime to be used. This option is only available in conjunction with
3542 the NeXT runtime and ABI version 0 or 1.
3543
3544 @item -fobjc-abi-version=@var{n}
3545 @opindex fobjc-abi-version
3546 Use version @var{n} of the Objective-C ABI for the selected runtime.
3547 This option is currently supported only for the NeXT runtime. In that
3548 case, Version 0 is the traditional (32-bit) ABI without support for
3549 properties and other Objective-C 2.0 additions. Version 1 is the
3550 traditional (32-bit) ABI with support for properties and other
3551 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3552 nothing is specified, the default is Version 0 on 32-bit target
3553 machines, and Version 2 on 64-bit target machines.
3554
3555 @item -fobjc-call-cxx-cdtors
3556 @opindex fobjc-call-cxx-cdtors
3557 For each Objective-C class, check if any of its instance variables is a
3558 C++ object with a non-trivial default constructor. If so, synthesize a
3559 special @code{- (id) .cxx_construct} instance method which runs
3560 non-trivial default constructors on any such instance variables, in order,
3561 and then return @code{self}. Similarly, check if any instance variable
3562 is a C++ object with a non-trivial destructor, and if so, synthesize a
3563 special @code{- (void) .cxx_destruct} method which runs
3564 all such default destructors, in reverse order.
3565
3566 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3567 methods thusly generated only operate on instance variables
3568 declared in the current Objective-C class, and not those inherited
3569 from superclasses. It is the responsibility of the Objective-C
3570 runtime to invoke all such methods in an object's inheritance
3571 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3572 by the runtime immediately after a new object instance is allocated;
3573 the @code{- (void) .cxx_destruct} methods are invoked immediately
3574 before the runtime deallocates an object instance.
3575
3576 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3577 support for invoking the @code{- (id) .cxx_construct} and
3578 @code{- (void) .cxx_destruct} methods.
3579
3580 @item -fobjc-direct-dispatch
3581 @opindex fobjc-direct-dispatch
3582 Allow fast jumps to the message dispatcher. On Darwin this is
3583 accomplished via the comm page.
3584
3585 @item -fobjc-exceptions
3586 @opindex fobjc-exceptions
3587 Enable syntactic support for structured exception handling in
3588 Objective-C, similar to what is offered by C++. This option
3589 is required to use the Objective-C keywords @code{@@try},
3590 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3591 @code{@@synchronized}. This option is available with both the GNU
3592 runtime and the NeXT runtime (but not available in conjunction with
3593 the NeXT runtime on Mac OS X 10.2 and earlier).
3594
3595 @item -fobjc-gc
3596 @opindex fobjc-gc
3597 Enable garbage collection (GC) in Objective-C and Objective-C++
3598 programs. This option is only available with the NeXT runtime; the
3599 GNU runtime has a different garbage collection implementation that
3600 does not require special compiler flags.
3601
3602 @item -fobjc-nilcheck
3603 @opindex fobjc-nilcheck
3604 For the NeXT runtime with version 2 of the ABI, check for a nil
3605 receiver in method invocations before doing the actual method call.
3606 This is the default and can be disabled using
3607 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3608 checked for nil in this way no matter what this flag is set to.
3609 Currently this flag does nothing when the GNU runtime, or an older
3610 version of the NeXT runtime ABI, is used.
3611
3612 @item -fobjc-std=objc1
3613 @opindex fobjc-std
3614 Conform to the language syntax of Objective-C 1.0, the language
3615 recognized by GCC 4.0. This only affects the Objective-C additions to
3616 the C/C++ language; it does not affect conformance to C/C++ standards,
3617 which is controlled by the separate C/C++ dialect option flags. When
3618 this option is used with the Objective-C or Objective-C++ compiler,
3619 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3620 This is useful if you need to make sure that your Objective-C code can
3621 be compiled with older versions of GCC@.
3622
3623 @item -freplace-objc-classes
3624 @opindex freplace-objc-classes
3625 Emit a special marker instructing @command{ld(1)} not to statically link in
3626 the resulting object file, and allow @command{dyld(1)} to load it in at
3627 run time instead. This is used in conjunction with the Fix-and-Continue
3628 debugging mode, where the object file in question may be recompiled and
3629 dynamically reloaded in the course of program execution, without the need
3630 to restart the program itself. Currently, Fix-and-Continue functionality
3631 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3632 and later.
3633
3634 @item -fzero-link
3635 @opindex fzero-link
3636 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3637 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3638 compile time) with static class references that get initialized at load time,
3639 which improves run-time performance. Specifying the @option{-fzero-link} flag
3640 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3641 to be retained. This is useful in Zero-Link debugging mode, since it allows
3642 for individual class implementations to be modified during program execution.
3643 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3644 regardless of command-line options.
3645
3646 @item -fno-local-ivars
3647 @opindex fno-local-ivars
3648 @opindex flocal-ivars
3649 By default instance variables in Objective-C can be accessed as if
3650 they were local variables from within the methods of the class they're
3651 declared in. This can lead to shadowing between instance variables
3652 and other variables declared either locally inside a class method or
3653 globally with the same name. Specifying the @option{-fno-local-ivars}
3654 flag disables this behavior thus avoiding variable shadowing issues.
3655
3656 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3657 @opindex fivar-visibility
3658 Set the default instance variable visibility to the specified option
3659 so that instance variables declared outside the scope of any access
3660 modifier directives default to the specified visibility.
3661
3662 @item -gen-decls
3663 @opindex gen-decls
3664 Dump interface declarations for all classes seen in the source file to a
3665 file named @file{@var{sourcename}.decl}.
3666
3667 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3668 @opindex Wassign-intercept
3669 @opindex Wno-assign-intercept
3670 Warn whenever an Objective-C assignment is being intercepted by the
3671 garbage collector.
3672
3673 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3674 @opindex Wno-protocol
3675 @opindex Wprotocol
3676 If a class is declared to implement a protocol, a warning is issued for
3677 every method in the protocol that is not implemented by the class. The
3678 default behavior is to issue a warning for every method not explicitly
3679 implemented in the class, even if a method implementation is inherited
3680 from the superclass. If you use the @option{-Wno-protocol} option, then
3681 methods inherited from the superclass are considered to be implemented,
3682 and no warning is issued for them.
3683
3684 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3685 @opindex Wselector
3686 @opindex Wno-selector
3687 Warn if multiple methods of different types for the same selector are
3688 found during compilation. The check is performed on the list of methods
3689 in the final stage of compilation. Additionally, a check is performed
3690 for each selector appearing in a @code{@@selector(@dots{})}
3691 expression, and a corresponding method for that selector has been found
3692 during compilation. Because these checks scan the method table only at
3693 the end of compilation, these warnings are not produced if the final
3694 stage of compilation is not reached, for example because an error is
3695 found during compilation, or because the @option{-fsyntax-only} option is
3696 being used.
3697
3698 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3699 @opindex Wstrict-selector-match
3700 @opindex Wno-strict-selector-match
3701 Warn if multiple methods with differing argument and/or return types are
3702 found for a given selector when attempting to send a message using this
3703 selector to a receiver of type @code{id} or @code{Class}. When this flag
3704 is off (which is the default behavior), the compiler omits such warnings
3705 if any differences found are confined to types that share the same size
3706 and alignment.
3707
3708 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3709 @opindex Wundeclared-selector
3710 @opindex Wno-undeclared-selector
3711 Warn if a @code{@@selector(@dots{})} expression referring to an
3712 undeclared selector is found. A selector is considered undeclared if no
3713 method with that name has been declared before the
3714 @code{@@selector(@dots{})} expression, either explicitly in an
3715 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3716 an @code{@@implementation} section. This option always performs its
3717 checks as soon as a @code{@@selector(@dots{})} expression is found,
3718 while @option{-Wselector} only performs its checks in the final stage of
3719 compilation. This also enforces the coding style convention
3720 that methods and selectors must be declared before being used.
3721
3722 @item -print-objc-runtime-info
3723 @opindex print-objc-runtime-info
3724 Generate C header describing the largest structure that is passed by
3725 value, if any.
3726
3727 @end table
3728
3729 @node Diagnostic Message Formatting Options
3730 @section Options to Control Diagnostic Messages Formatting
3731 @cindex options to control diagnostics formatting
3732 @cindex diagnostic messages
3733 @cindex message formatting
3734
3735 Traditionally, diagnostic messages have been formatted irrespective of
3736 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3737 options described below
3738 to control the formatting algorithm for diagnostic messages,
3739 e.g.@: how many characters per line, how often source location
3740 information should be reported. Note that some language front ends may not
3741 honor these options.
3742
3743 @table @gcctabopt
3744 @item -fmessage-length=@var{n}
3745 @opindex fmessage-length
3746 Try to format error messages so that they fit on lines of about
3747 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3748 done; each error message appears on a single line. This is the
3749 default for all front ends.
3750
3751 Note - this option also affects the display of the @samp{#error} and
3752 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3753 function/type/variable attribute. It does not however affect the
3754 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3755
3756 @item -fdiagnostics-show-location=once
3757 @opindex fdiagnostics-show-location
3758 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3759 reporter to emit source location information @emph{once}; that is, in
3760 case the message is too long to fit on a single physical line and has to
3761 be wrapped, the source location won't be emitted (as prefix) again,
3762 over and over, in subsequent continuation lines. This is the default
3763 behavior.
3764
3765 @item -fdiagnostics-show-location=every-line
3766 Only meaningful in line-wrapping mode. Instructs the diagnostic
3767 messages reporter to emit the same source location information (as
3768 prefix) for physical lines that result from the process of breaking
3769 a message which is too long to fit on a single line.
3770
3771 @item -fdiagnostics-color[=@var{WHEN}]
3772 @itemx -fno-diagnostics-color
3773 @opindex fdiagnostics-color
3774 @cindex highlight, color
3775 @vindex GCC_COLORS @r{environment variable}
3776 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3777 or @samp{auto}. The default depends on how the compiler has been configured,
3778 it can be any of the above @var{WHEN} options or also @samp{never}
3779 if @env{GCC_COLORS} environment variable isn't present in the environment,
3780 and @samp{auto} otherwise.
3781 @samp{auto} means to use color only when the standard error is a terminal.
3782 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3783 aliases for @option{-fdiagnostics-color=always} and
3784 @option{-fdiagnostics-color=never}, respectively.
3785
3786 The colors are defined by the environment variable @env{GCC_COLORS}.
3787 Its value is a colon-separated list of capabilities and Select Graphic
3788 Rendition (SGR) substrings. SGR commands are interpreted by the
3789 terminal or terminal emulator. (See the section in the documentation
3790 of your text terminal for permitted values and their meanings as
3791 character attributes.) These substring values are integers in decimal
3792 representation and can be concatenated with semicolons.
3793 Common values to concatenate include
3794 @samp{1} for bold,
3795 @samp{4} for underline,
3796 @samp{5} for blink,
3797 @samp{7} for inverse,
3798 @samp{39} for default foreground color,
3799 @samp{30} to @samp{37} for foreground colors,
3800 @samp{90} to @samp{97} for 16-color mode foreground colors,
3801 @samp{38;5;0} to @samp{38;5;255}
3802 for 88-color and 256-color modes foreground colors,
3803 @samp{49} for default background color,
3804 @samp{40} to @samp{47} for background colors,
3805 @samp{100} to @samp{107} for 16-color mode background colors,
3806 and @samp{48;5;0} to @samp{48;5;255}
3807 for 88-color and 256-color modes background colors.
3808
3809 The default @env{GCC_COLORS} is
3810 @smallexample
3811 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3812 quote=01:fixit-insert=32:fixit-delete=31:\
3813 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3814 type-diff=01;32
3815 @end smallexample
3816 @noindent
3817 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3818 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3819 @samp{01} is bold, and @samp{31} is red.
3820 Setting @env{GCC_COLORS} to the empty string disables colors.
3821 Supported capabilities are as follows.
3822
3823 @table @code
3824 @item error=
3825 @vindex error GCC_COLORS @r{capability}
3826 SGR substring for error: markers.
3827
3828 @item warning=
3829 @vindex warning GCC_COLORS @r{capability}
3830 SGR substring for warning: markers.
3831
3832 @item note=
3833 @vindex note GCC_COLORS @r{capability}
3834 SGR substring for note: markers.
3835
3836 @item range1=
3837 @vindex range1 GCC_COLORS @r{capability}
3838 SGR substring for first additional range.
3839
3840 @item range2=
3841 @vindex range2 GCC_COLORS @r{capability}
3842 SGR substring for second additional range.
3843
3844 @item locus=
3845 @vindex locus GCC_COLORS @r{capability}
3846 SGR substring for location information, @samp{file:line} or
3847 @samp{file:line:column} etc.
3848
3849 @item quote=
3850 @vindex quote GCC_COLORS @r{capability}
3851 SGR substring for information printed within quotes.
3852
3853 @item fixit-insert=
3854 @vindex fixit-insert GCC_COLORS @r{capability}
3855 SGR substring for fix-it hints suggesting text to
3856 be inserted or replaced.
3857
3858 @item fixit-delete=
3859 @vindex fixit-delete GCC_COLORS @r{capability}
3860 SGR substring for fix-it hints suggesting text to
3861 be deleted.
3862
3863 @item diff-filename=
3864 @vindex diff-filename GCC_COLORS @r{capability}
3865 SGR substring for filename headers within generated patches.
3866
3867 @item diff-hunk=
3868 @vindex diff-hunk GCC_COLORS @r{capability}
3869 SGR substring for the starts of hunks within generated patches.
3870
3871 @item diff-delete=
3872 @vindex diff-delete GCC_COLORS @r{capability}
3873 SGR substring for deleted lines within generated patches.
3874
3875 @item diff-insert=
3876 @vindex diff-insert GCC_COLORS @r{capability}
3877 SGR substring for inserted lines within generated patches.
3878
3879 @item type-diff=
3880 @vindex type-diff GCC_COLORS @r{capability}
3881 SGR substring for highlighting mismatching types within template
3882 arguments in the C++ frontend.
3883 @end table
3884
3885 @item -fno-diagnostics-show-option
3886 @opindex fno-diagnostics-show-option
3887 @opindex fdiagnostics-show-option
3888 By default, each diagnostic emitted includes text indicating the
3889 command-line option that directly controls the diagnostic (if such an
3890 option is known to the diagnostic machinery). Specifying the
3891 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3892
3893 @item -fno-diagnostics-show-caret
3894 @opindex fno-diagnostics-show-caret
3895 @opindex fdiagnostics-show-caret
3896 By default, each diagnostic emitted includes the original source line
3897 and a caret @samp{^} indicating the column. This option suppresses this
3898 information. The source line is truncated to @var{n} characters, if
3899 the @option{-fmessage-length=n} option is given. When the output is done
3900 to the terminal, the width is limited to the width given by the
3901 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3902
3903 @item -fno-diagnostics-show-labels
3904 @opindex fno-diagnostics-show-labels
3905 @opindex fdiagnostics-show-labels
3906 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3907 diagnostics can label ranges of source code with pertinent information, such
3908 as the types of expressions:
3909
3910 @smallexample
3911 printf ("foo %s bar", long_i + long_j);
3912 ~^ ~~~~~~~~~~~~~~~
3913 | |
3914 char * long int
3915 @end smallexample
3916
3917 This option suppresses the printing of these labels (in the example above,
3918 the vertical bars and the ``char *'' and ``long int'' text).
3919
3920 @item -fno-diagnostics-show-line-numbers
3921 @opindex fno-diagnostics-show-line-numbers
3922 @opindex fdiagnostics-show-line-numbers
3923 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3924 a left margin is printed, showing line numbers. This option suppresses this
3925 left margin.
3926
3927 @item -fdiagnostics-minimum-margin-width=@var{width}
3928 @opindex fdiagnostics-minimum-margin-width
3929 This option controls the minimum width of the left margin printed by
3930 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3931
3932 @item -fdiagnostics-parseable-fixits
3933 @opindex fdiagnostics-parseable-fixits
3934 Emit fix-it hints in a machine-parseable format, suitable for consumption
3935 by IDEs. For each fix-it, a line will be printed after the relevant
3936 diagnostic, starting with the string ``fix-it:''. For example:
3937
3938 @smallexample
3939 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3940 @end smallexample
3941
3942 The location is expressed as a half-open range, expressed as a count of
3943 bytes, starting at byte 1 for the initial column. In the above example,
3944 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3945 given string:
3946
3947 @smallexample
3948 00000000011111111112222222222
3949 12345678901234567890123456789
3950 gtk_widget_showall (dlg);
3951 ^^^^^^^^^^^^^^^^^^
3952 gtk_widget_show_all
3953 @end smallexample
3954
3955 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3956 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3957 (e.g. vertical tab as ``\013'').
3958
3959 An empty replacement string indicates that the given range is to be removed.
3960 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3961 be inserted at the given position.
3962
3963 @item -fdiagnostics-generate-patch
3964 @opindex fdiagnostics-generate-patch
3965 Print fix-it hints to stderr in unified diff format, after any diagnostics
3966 are printed. For example:
3967
3968 @smallexample
3969 --- test.c
3970 +++ test.c
3971 @@ -42,5 +42,5 @@
3972
3973 void show_cb(GtkDialog *dlg)
3974 @{
3975 - gtk_widget_showall(dlg);
3976 + gtk_widget_show_all(dlg);
3977 @}
3978
3979 @end smallexample
3980
3981 The diff may or may not be colorized, following the same rules
3982 as for diagnostics (see @option{-fdiagnostics-color}).
3983
3984 @item -fdiagnostics-show-template-tree
3985 @opindex fdiagnostics-show-template-tree
3986
3987 In the C++ frontend, when printing diagnostics showing mismatching
3988 template types, such as:
3989
3990 @smallexample
3991 could not convert 'std::map<int, std::vector<double> >()'
3992 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3993 @end smallexample
3994
3995 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3996 tree-like structure showing the common and differing parts of the types,
3997 such as:
3998
3999 @smallexample
4000 map<
4001 [...],
4002 vector<
4003 [double != float]>>
4004 @end smallexample
4005
4006 The parts that differ are highlighted with color (``double'' and
4007 ``float'' in this case).
4008
4009 @item -fno-elide-type
4010 @opindex fno-elide-type
4011 @opindex felide-type
4012 By default when the C++ frontend prints diagnostics showing mismatching
4013 template types, common parts of the types are printed as ``[...]'' to
4014 simplify the error message. For example:
4015
4016 @smallexample
4017 could not convert 'std::map<int, std::vector<double> >()'
4018 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4019 @end smallexample
4020
4021 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4022 This flag also affects the output of the
4023 @option{-fdiagnostics-show-template-tree} flag.
4024
4025 @item -fno-show-column
4026 @opindex fno-show-column
4027 @opindex fshow-column
4028 Do not print column numbers in diagnostics. This may be necessary if
4029 diagnostics are being scanned by a program that does not understand the
4030 column numbers, such as @command{dejagnu}.
4031
4032 @item -fdiagnostics-format=@var{FORMAT}
4033 @opindex fdiagnostics-format
4034 Select a different format for printing diagnostics.
4035 @var{FORMAT} is @samp{text} or @samp{json}.
4036 The default is @samp{text}.
4037
4038 The @samp{json} format consists of a top-level JSON array containing JSON
4039 objects representing the diagnostics.
4040
4041 The JSON is emitted as one line, without formatting; the examples below
4042 have been formatted for clarity.
4043
4044 Diagnostics can have child diagnostics. For example, this error and note:
4045
4046 @smallexample
4047 misleading-indentation.c:15:3: warning: this 'if' clause does not
4048 guard... [-Wmisleading-indentation]
4049 15 | if (flag)
4050 | ^~
4051 misleading-indentation.c:17:5: note: ...this statement, but the latter
4052 is misleadingly indented as if it were guarded by the 'if'
4053 17 | y = 2;
4054 | ^
4055 @end smallexample
4056
4057 @noindent
4058 might be printed in JSON form (after formatting) like this:
4059
4060 @smallexample
4061 [
4062 @{
4063 "kind": "warning",
4064 "locations": [
4065 @{
4066 "caret": @{
4067 "column": 3,
4068 "file": "misleading-indentation.c",
4069 "line": 15
4070 @},
4071 "finish": @{
4072 "column": 4,
4073 "file": "misleading-indentation.c",
4074 "line": 15
4075 @}
4076 @}
4077 ],
4078 "message": "this \u2018if\u2019 clause does not guard...",
4079 "option": "-Wmisleading-indentation",
4080 "children": [
4081 @{
4082 "kind": "note",
4083 "locations": [
4084 @{
4085 "caret": @{
4086 "column": 5,
4087 "file": "misleading-indentation.c",
4088 "line": 17
4089 @}
4090 @}
4091 ],
4092 "message": "...this statement, but the latter is @dots{}"
4093 @}
4094 ]
4095 @},
4096 @dots{}
4097 ]
4098 @end smallexample
4099
4100 @noindent
4101 where the @code{note} is a child of the @code{warning}.
4102
4103 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4104 an @code{option} key describing the command-line option controlling the
4105 warning.
4106
4107 A diagnostic can contain zero or more locations. Each location has up
4108 to three positions within it: a @code{caret} position and optional
4109 @code{start} and @code{finish} positions. A location can also have
4110 an optional @code{label} string. For example, this error:
4111
4112 @smallexample
4113 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4114 'struct s'@} and 'T' @{aka 'struct t'@})
4115 64 | return callee_4a () + callee_4b ();
4116 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4117 | | |
4118 | | T @{aka struct t@}
4119 | S @{aka struct s@}
4120 @end smallexample
4121
4122 @noindent
4123 has three locations. Its primary location is at the ``+'' token at column
4124 23. It has two secondary locations, describing the left and right-hand sides
4125 of the expression, which have labels. It might be printed in JSON form as:
4126
4127 @smallexample
4128 @{
4129 "children": [],
4130 "kind": "error",
4131 "locations": [
4132 @{
4133 "caret": @{
4134 "column": 23, "file": "bad-binary-ops.c", "line": 64
4135 @}
4136 @},
4137 @{
4138 "caret": @{
4139 "column": 10, "file": "bad-binary-ops.c", "line": 64
4140 @},
4141 "finish": @{
4142 "column": 21, "file": "bad-binary-ops.c", "line": 64
4143 @},
4144 "label": "S @{aka struct s@}"
4145 @},
4146 @{
4147 "caret": @{
4148 "column": 25, "file": "bad-binary-ops.c", "line": 64
4149 @},
4150 "finish": @{
4151 "column": 36, "file": "bad-binary-ops.c", "line": 64
4152 @},
4153 "label": "T @{aka struct t@}"
4154 @}
4155 ],
4156 "message": "invalid operands to binary + @dots{}"
4157 @}
4158 @end smallexample
4159
4160 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4161 consisting of half-open intervals, similar to the output of
4162 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4163 with a replacement fix-it hint:
4164
4165 @smallexample
4166 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4167 mean 'color'?
4168 8 | return ptr->colour;
4169 | ^~~~~~
4170 | color
4171 @end smallexample
4172
4173 @noindent
4174 might be printed in JSON form as:
4175
4176 @smallexample
4177 @{
4178 "children": [],
4179 "fixits": [
4180 @{
4181 "next": @{
4182 "column": 21,
4183 "file": "demo.c",
4184 "line": 8
4185 @},
4186 "start": @{
4187 "column": 15,
4188 "file": "demo.c",
4189 "line": 8
4190 @},
4191 "string": "color"
4192 @}
4193 ],
4194 "kind": "error",
4195 "locations": [
4196 @{
4197 "caret": @{
4198 "column": 15,
4199 "file": "demo.c",
4200 "line": 8
4201 @},
4202 "finish": @{
4203 "column": 20,
4204 "file": "demo.c",
4205 "line": 8
4206 @}
4207 @}
4208 ],
4209 "message": "\u2018struct s\u2019 has no member named @dots{}"
4210 @}
4211 @end smallexample
4212
4213 @noindent
4214 where the fix-it hint suggests replacing the text from @code{start} up
4215 to but not including @code{next} with @code{string}'s value. Deletions
4216 are expressed via an empty value for @code{string}, insertions by
4217 having @code{start} equal @code{next}.
4218
4219 @end table
4220
4221 @node Warning Options
4222 @section Options to Request or Suppress Warnings
4223 @cindex options to control warnings
4224 @cindex warning messages
4225 @cindex messages, warning
4226 @cindex suppressing warnings
4227
4228 Warnings are diagnostic messages that report constructions that
4229 are not inherently erroneous but that are risky or suggest there
4230 may have been an error.
4231
4232 The following language-independent options do not enable specific
4233 warnings but control the kinds of diagnostics produced by GCC@.
4234
4235 @table @gcctabopt
4236 @cindex syntax checking
4237 @item -fsyntax-only
4238 @opindex fsyntax-only
4239 Check the code for syntax errors, but don't do anything beyond that.
4240
4241 @item -fmax-errors=@var{n}
4242 @opindex fmax-errors
4243 Limits the maximum number of error messages to @var{n}, at which point
4244 GCC bails out rather than attempting to continue processing the source
4245 code. If @var{n} is 0 (the default), there is no limit on the number
4246 of error messages produced. If @option{-Wfatal-errors} is also
4247 specified, then @option{-Wfatal-errors} takes precedence over this
4248 option.
4249
4250 @item -w
4251 @opindex w
4252 Inhibit all warning messages.
4253
4254 @item -Werror
4255 @opindex Werror
4256 @opindex Wno-error
4257 Make all warnings into errors.
4258
4259 @item -Werror=
4260 @opindex Werror=
4261 @opindex Wno-error=
4262 Make the specified warning into an error. The specifier for a warning
4263 is appended; for example @option{-Werror=switch} turns the warnings
4264 controlled by @option{-Wswitch} into errors. This switch takes a
4265 negative form, to be used to negate @option{-Werror} for specific
4266 warnings; for example @option{-Wno-error=switch} makes
4267 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4268 is in effect.
4269
4270 The warning message for each controllable warning includes the
4271 option that controls the warning. That option can then be used with
4272 @option{-Werror=} and @option{-Wno-error=} as described above.
4273 (Printing of the option in the warning message can be disabled using the
4274 @option{-fno-diagnostics-show-option} flag.)
4275
4276 Note that specifying @option{-Werror=}@var{foo} automatically implies
4277 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4278 imply anything.
4279
4280 @item -Wfatal-errors
4281 @opindex Wfatal-errors
4282 @opindex Wno-fatal-errors
4283 This option causes the compiler to abort compilation on the first error
4284 occurred rather than trying to keep going and printing further error
4285 messages.
4286
4287 @end table
4288
4289 You can request many specific warnings with options beginning with
4290 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4291 implicit declarations. Each of these specific warning options also
4292 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4293 example, @option{-Wno-implicit}. This manual lists only one of the
4294 two forms, whichever is not the default. For further
4295 language-specific options also refer to @ref{C++ Dialect Options} and
4296 @ref{Objective-C and Objective-C++ Dialect Options}.
4297
4298 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4299 options, such as @option{-Wunused}, which may turn on further options,
4300 such as @option{-Wunused-value}. The combined effect of positive and
4301 negative forms is that more specific options have priority over less
4302 specific ones, independently of their position in the command-line. For
4303 options of the same specificity, the last one takes effect. Options
4304 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4305 as if they appeared at the end of the command-line.
4306
4307 When an unrecognized warning option is requested (e.g.,
4308 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4309 that the option is not recognized. However, if the @option{-Wno-} form
4310 is used, the behavior is slightly different: no diagnostic is
4311 produced for @option{-Wno-unknown-warning} unless other diagnostics
4312 are being produced. This allows the use of new @option{-Wno-} options
4313 with old compilers, but if something goes wrong, the compiler
4314 warns that an unrecognized option is present.
4315
4316 @table @gcctabopt
4317 @item -Wpedantic
4318 @itemx -pedantic
4319 @opindex pedantic
4320 @opindex Wpedantic
4321 @opindex Wno-pedantic
4322 Issue all the warnings demanded by strict ISO C and ISO C++;
4323 reject all programs that use forbidden extensions, and some other
4324 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4325 version of the ISO C standard specified by any @option{-std} option used.
4326
4327 Valid ISO C and ISO C++ programs should compile properly with or without
4328 this option (though a rare few require @option{-ansi} or a
4329 @option{-std} option specifying the required version of ISO C)@. However,
4330 without this option, certain GNU extensions and traditional C and C++
4331 features are supported as well. With this option, they are rejected.
4332
4333 @option{-Wpedantic} does not cause warning messages for use of the
4334 alternate keywords whose names begin and end with @samp{__}. Pedantic
4335 warnings are also disabled in the expression that follows
4336 @code{__extension__}. However, only system header files should use
4337 these escape routes; application programs should avoid them.
4338 @xref{Alternate Keywords}.
4339
4340 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4341 C conformance. They soon find that it does not do quite what they want:
4342 it finds some non-ISO practices, but not all---only those for which
4343 ISO C @emph{requires} a diagnostic, and some others for which
4344 diagnostics have been added.
4345
4346 A feature to report any failure to conform to ISO C might be useful in
4347 some instances, but would require considerable additional work and would
4348 be quite different from @option{-Wpedantic}. We don't have plans to
4349 support such a feature in the near future.
4350
4351 Where the standard specified with @option{-std} represents a GNU
4352 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4353 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4354 extended dialect is based. Warnings from @option{-Wpedantic} are given
4355 where they are required by the base standard. (It does not make sense
4356 for such warnings to be given only for features not in the specified GNU
4357 C dialect, since by definition the GNU dialects of C include all
4358 features the compiler supports with the given option, and there would be
4359 nothing to warn about.)
4360
4361 @item -pedantic-errors
4362 @opindex pedantic-errors
4363 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4364 requires a diagnostic, in some cases where there is undefined behavior
4365 at compile-time and in some other cases that do not prevent compilation
4366 of programs that are valid according to the standard. This is not
4367 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4368 by this option and not enabled by the latter and vice versa.
4369
4370 @item -Wall
4371 @opindex Wall
4372 @opindex Wno-all
4373 This enables all the warnings about constructions that some users
4374 consider questionable, and that are easy to avoid (or modify to
4375 prevent the warning), even in conjunction with macros. This also
4376 enables some language-specific warnings described in @ref{C++ Dialect
4377 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4378
4379 @option{-Wall} turns on the following warning flags:
4380
4381 @gccoptlist{-Waddress @gol
4382 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4383 -Wbool-compare @gol
4384 -Wbool-operation @gol
4385 -Wc++11-compat -Wc++14-compat @gol
4386 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4387 -Wchar-subscripts @gol
4388 -Wcomment @gol
4389 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4390 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4391 -Wformat @gol
4392 -Wint-in-bool-context @gol
4393 -Wimplicit @r{(C and Objective-C only)} @gol
4394 -Wimplicit-int @r{(C and Objective-C only)} @gol
4395 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4396 -Winit-self @r{(only for C++)} @gol
4397 -Wlogical-not-parentheses @gol
4398 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4399 -Wmaybe-uninitialized @gol
4400 -Wmemset-elt-size @gol
4401 -Wmemset-transposed-args @gol
4402 -Wmisleading-indentation @r{(only for C/C++)} @gol
4403 -Wmissing-attributes @gol
4404 -Wmissing-braces @r{(only for C/ObjC)} @gol
4405 -Wmultistatement-macros @gol
4406 -Wnarrowing @r{(only for C++)} @gol
4407 -Wnonnull @gol
4408 -Wnonnull-compare @gol
4409 -Wopenmp-simd @gol
4410 -Wparentheses @gol
4411 -Wpessimizing-move @r{(only for C++)} @gol
4412 -Wpointer-sign @gol
4413 -Wreorder @gol
4414 -Wrestrict @gol
4415 -Wreturn-type @gol
4416 -Wsequence-point @gol
4417 -Wsign-compare @r{(only in C++)} @gol
4418 -Wsizeof-pointer-div @gol
4419 -Wsizeof-pointer-memaccess @gol
4420 -Wstrict-aliasing @gol
4421 -Wstrict-overflow=1 @gol
4422 -Wswitch @gol
4423 -Wtautological-compare @gol
4424 -Wtrigraphs @gol
4425 -Wuninitialized @gol
4426 -Wunknown-pragmas @gol
4427 -Wunused-function @gol
4428 -Wunused-label @gol
4429 -Wunused-value @gol
4430 -Wunused-variable @gol
4431 -Wvolatile-register-var}
4432
4433 Note that some warning flags are not implied by @option{-Wall}. Some of
4434 them warn about constructions that users generally do not consider
4435 questionable, but which occasionally you might wish to check for;
4436 others warn about constructions that are necessary or hard to avoid in
4437 some cases, and there is no simple way to modify the code to suppress
4438 the warning. Some of them are enabled by @option{-Wextra} but many of
4439 them must be enabled individually.
4440
4441 @item -Wextra
4442 @opindex W
4443 @opindex Wextra
4444 @opindex Wno-extra
4445 This enables some extra warning flags that are not enabled by
4446 @option{-Wall}. (This option used to be called @option{-W}. The older
4447 name is still supported, but the newer name is more descriptive.)
4448
4449 @gccoptlist{-Wclobbered @gol
4450 -Wcast-function-type @gol
4451 -Wdeprecated-copy @r{(C++ only)} @gol
4452 -Wempty-body @gol
4453 -Wignored-qualifiers @gol
4454 -Wimplicit-fallthrough=3 @gol
4455 -Wmissing-field-initializers @gol
4456 -Wmissing-parameter-type @r{(C only)} @gol
4457 -Wold-style-declaration @r{(C only)} @gol
4458 -Woverride-init @gol
4459 -Wsign-compare @r{(C only)} @gol
4460 -Wredundant-move @r{(only for C++)} @gol
4461 -Wtype-limits @gol
4462 -Wuninitialized @gol
4463 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4464 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4465 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4466
4467
4468 The option @option{-Wextra} also prints warning messages for the
4469 following cases:
4470
4471 @itemize @bullet
4472
4473 @item
4474 A pointer is compared against integer zero with @code{<}, @code{<=},
4475 @code{>}, or @code{>=}.
4476
4477 @item
4478 (C++ only) An enumerator and a non-enumerator both appear in a
4479 conditional expression.
4480
4481 @item
4482 (C++ only) Ambiguous virtual bases.
4483
4484 @item
4485 (C++ only) Subscripting an array that has been declared @code{register}.
4486
4487 @item
4488 (C++ only) Taking the address of a variable that has been declared
4489 @code{register}.
4490
4491 @item
4492 (C++ only) A base class is not initialized in the copy constructor
4493 of a derived class.
4494
4495 @end itemize
4496
4497 @item -Wchar-subscripts
4498 @opindex Wchar-subscripts
4499 @opindex Wno-char-subscripts
4500 Warn if an array subscript has type @code{char}. This is a common cause
4501 of error, as programmers often forget that this type is signed on some
4502 machines.
4503 This warning is enabled by @option{-Wall}.
4504
4505 @item -Wno-coverage-mismatch
4506 @opindex Wno-coverage-mismatch
4507 @opindex Wcoverage-mismatch
4508 Warn if feedback profiles do not match when using the
4509 @option{-fprofile-use} option.
4510 If a source file is changed between compiling with @option{-fprofile-generate}
4511 and with @option{-fprofile-use}, the files with the profile feedback can fail
4512 to match the source file and GCC cannot use the profile feedback
4513 information. By default, this warning is enabled and is treated as an
4514 error. @option{-Wno-coverage-mismatch} can be used to disable the
4515 warning or @option{-Wno-error=coverage-mismatch} can be used to
4516 disable the error. Disabling the error for this warning can result in
4517 poorly optimized code and is useful only in the
4518 case of very minor changes such as bug fixes to an existing code-base.
4519 Completely disabling the warning is not recommended.
4520
4521 @item -Wno-cpp
4522 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4523
4524 Suppress warning messages emitted by @code{#warning} directives.
4525
4526 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4527 @opindex Wdouble-promotion
4528 @opindex Wno-double-promotion
4529 Give a warning when a value of type @code{float} is implicitly
4530 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4531 floating-point unit implement @code{float} in hardware, but emulate
4532 @code{double} in software. On such a machine, doing computations
4533 using @code{double} values is much more expensive because of the
4534 overhead required for software emulation.
4535
4536 It is easy to accidentally do computations with @code{double} because
4537 floating-point literals are implicitly of type @code{double}. For
4538 example, in:
4539 @smallexample
4540 @group
4541 float area(float radius)
4542 @{
4543 return 3.14159 * radius * radius;
4544 @}
4545 @end group
4546 @end smallexample
4547 the compiler performs the entire computation with @code{double}
4548 because the floating-point literal is a @code{double}.
4549
4550 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4551 @opindex Wduplicate-decl-specifier
4552 @opindex Wno-duplicate-decl-specifier
4553 Warn if a declaration has duplicate @code{const}, @code{volatile},
4554 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4555 @option{-Wall}.
4556
4557 @item -Wformat
4558 @itemx -Wformat=@var{n}
4559 @opindex Wformat
4560 @opindex Wno-format
4561 @opindex ffreestanding
4562 @opindex fno-builtin
4563 @opindex Wformat=
4564 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4565 the arguments supplied have types appropriate to the format string
4566 specified, and that the conversions specified in the format string make
4567 sense. This includes standard functions, and others specified by format
4568 attributes (@pxref{Function Attributes}), in the @code{printf},
4569 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4570 not in the C standard) families (or other target-specific families).
4571 Which functions are checked without format attributes having been
4572 specified depends on the standard version selected, and such checks of
4573 functions without the attribute specified are disabled by
4574 @option{-ffreestanding} or @option{-fno-builtin}.
4575
4576 The formats are checked against the format features supported by GNU
4577 libc version 2.2. These include all ISO C90 and C99 features, as well
4578 as features from the Single Unix Specification and some BSD and GNU
4579 extensions. Other library implementations may not support all these
4580 features; GCC does not support warning about features that go beyond a
4581 particular library's limitations. However, if @option{-Wpedantic} is used
4582 with @option{-Wformat}, warnings are given about format features not
4583 in the selected standard version (but not for @code{strfmon} formats,
4584 since those are not in any version of the C standard). @xref{C Dialect
4585 Options,,Options Controlling C Dialect}.
4586
4587 @table @gcctabopt
4588 @item -Wformat=1
4589 @itemx -Wformat
4590 @opindex Wformat
4591 @opindex Wformat=1
4592 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4593 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4594 @option{-Wformat} also checks for null format arguments for several
4595 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4596 aspects of this level of format checking can be disabled by the
4597 options: @option{-Wno-format-contains-nul},
4598 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4599 @option{-Wformat} is enabled by @option{-Wall}.
4600
4601 @item -Wno-format-contains-nul
4602 @opindex Wno-format-contains-nul
4603 @opindex Wformat-contains-nul
4604 If @option{-Wformat} is specified, do not warn about format strings that
4605 contain NUL bytes.
4606
4607 @item -Wno-format-extra-args
4608 @opindex Wno-format-extra-args
4609 @opindex Wformat-extra-args
4610 If @option{-Wformat} is specified, do not warn about excess arguments to a
4611 @code{printf} or @code{scanf} format function. The C standard specifies
4612 that such arguments are ignored.
4613
4614 Where the unused arguments lie between used arguments that are
4615 specified with @samp{$} operand number specifications, normally
4616 warnings are still given, since the implementation could not know what
4617 type to pass to @code{va_arg} to skip the unused arguments. However,
4618 in the case of @code{scanf} formats, this option suppresses the
4619 warning if the unused arguments are all pointers, since the Single
4620 Unix Specification says that such unused arguments are allowed.
4621
4622 @item -Wformat-overflow
4623 @itemx -Wformat-overflow=@var{level}
4624 @opindex Wformat-overflow
4625 @opindex Wno-format-overflow
4626 Warn about calls to formatted input/output functions such as @code{sprintf}
4627 and @code{vsprintf} that might overflow the destination buffer. When the
4628 exact number of bytes written by a format directive cannot be determined
4629 at compile-time it is estimated based on heuristics that depend on the
4630 @var{level} argument and on optimization. While enabling optimization
4631 will in most cases improve the accuracy of the warning, it may also
4632 result in false positives.
4633
4634 @table @gcctabopt
4635 @item -Wformat-overflow
4636 @itemx -Wformat-overflow=1
4637 @opindex Wformat-overflow
4638 @opindex Wno-format-overflow
4639 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4640 employs a conservative approach that warns only about calls that most
4641 likely overflow the buffer. At this level, numeric arguments to format
4642 directives with unknown values are assumed to have the value of one, and
4643 strings of unknown length to be empty. Numeric arguments that are known
4644 to be bounded to a subrange of their type, or string arguments whose output
4645 is bounded either by their directive's precision or by a finite set of
4646 string literals, are assumed to take on the value within the range that
4647 results in the most bytes on output. For example, the call to @code{sprintf}
4648 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4649 the terminating NUL character (@code{'\0'}) appended by the function
4650 to the destination buffer will be written past its end. Increasing
4651 the size of the buffer by a single byte is sufficient to avoid the
4652 warning, though it may not be sufficient to avoid the overflow.
4653
4654 @smallexample
4655 void f (int a, int b)
4656 @{
4657 char buf [13];
4658 sprintf (buf, "a = %i, b = %i\n", a, b);
4659 @}
4660 @end smallexample
4661
4662 @item -Wformat-overflow=2
4663 Level @var{2} warns also about calls that might overflow the destination
4664 buffer given an argument of sufficient length or magnitude. At level
4665 @var{2}, unknown numeric arguments are assumed to have the minimum
4666 representable value for signed types with a precision greater than 1, and
4667 the maximum representable value otherwise. Unknown string arguments whose
4668 length cannot be assumed to be bounded either by the directive's precision,
4669 or by a finite set of string literals they may evaluate to, or the character
4670 array they may point to, are assumed to be 1 character long.
4671
4672 At level @var{2}, the call in the example above is again diagnosed, but
4673 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4674 @code{%i} directive will write some of its digits beyond the end of
4675 the destination buffer. To make the call safe regardless of the values
4676 of the two variables, the size of the destination buffer must be increased
4677 to at least 34 bytes. GCC includes the minimum size of the buffer in
4678 an informational note following the warning.
4679
4680 An alternative to increasing the size of the destination buffer is to
4681 constrain the range of formatted values. The maximum length of string
4682 arguments can be bounded by specifying the precision in the format
4683 directive. When numeric arguments of format directives can be assumed
4684 to be bounded by less than the precision of their type, choosing
4685 an appropriate length modifier to the format specifier will reduce
4686 the required buffer size. For example, if @var{a} and @var{b} in the
4687 example above can be assumed to be within the precision of
4688 the @code{short int} type then using either the @code{%hi} format
4689 directive or casting the argument to @code{short} reduces the maximum
4690 required size of the buffer to 24 bytes.
4691
4692 @smallexample
4693 void f (int a, int b)
4694 @{
4695 char buf [23];
4696 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4697 @}
4698 @end smallexample
4699 @end table
4700
4701 @item -Wno-format-zero-length
4702 @opindex Wno-format-zero-length
4703 @opindex Wformat-zero-length
4704 If @option{-Wformat} is specified, do not warn about zero-length formats.
4705 The C standard specifies that zero-length formats are allowed.
4706
4707
4708 @item -Wformat=2
4709 @opindex Wformat=2
4710 Enable @option{-Wformat} plus additional format checks. Currently
4711 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4712 -Wformat-y2k}.
4713
4714 @item -Wformat-nonliteral
4715 @opindex Wformat-nonliteral
4716 @opindex Wno-format-nonliteral
4717 If @option{-Wformat} is specified, also warn if the format string is not a
4718 string literal and so cannot be checked, unless the format function
4719 takes its format arguments as a @code{va_list}.
4720
4721 @item -Wformat-security
4722 @opindex Wformat-security
4723 @opindex Wno-format-security
4724 If @option{-Wformat} is specified, also warn about uses of format
4725 functions that represent possible security problems. At present, this
4726 warns about calls to @code{printf} and @code{scanf} functions where the
4727 format string is not a string literal and there are no format arguments,
4728 as in @code{printf (foo);}. This may be a security hole if the format
4729 string came from untrusted input and contains @samp{%n}. (This is
4730 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4731 in future warnings may be added to @option{-Wformat-security} that are not
4732 included in @option{-Wformat-nonliteral}.)
4733
4734 @item -Wformat-signedness
4735 @opindex Wformat-signedness
4736 @opindex Wno-format-signedness
4737 If @option{-Wformat} is specified, also warn if the format string
4738 requires an unsigned argument and the argument is signed and vice versa.
4739
4740 @item -Wformat-truncation
4741 @itemx -Wformat-truncation=@var{level}
4742 @opindex Wformat-truncation
4743 @opindex Wno-format-truncation
4744 Warn about calls to formatted input/output functions such as @code{snprintf}
4745 and @code{vsnprintf} that might result in output truncation. When the exact
4746 number of bytes written by a format directive cannot be determined at
4747 compile-time it is estimated based on heuristics that depend on
4748 the @var{level} argument and on optimization. While enabling optimization
4749 will in most cases improve the accuracy of the warning, it may also result
4750 in false positives. Except as noted otherwise, the option uses the same
4751 logic @option{-Wformat-overflow}.
4752
4753 @table @gcctabopt
4754 @item -Wformat-truncation
4755 @itemx -Wformat-truncation=1
4756 @opindex Wformat-truncation
4757 @opindex Wno-format-truncation
4758 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4759 employs a conservative approach that warns only about calls to bounded
4760 functions whose return value is unused and that will most likely result
4761 in output truncation.
4762
4763 @item -Wformat-truncation=2
4764 Level @var{2} warns also about calls to bounded functions whose return
4765 value is used and that might result in truncation given an argument of
4766 sufficient length or magnitude.
4767 @end table
4768
4769 @item -Wformat-y2k
4770 @opindex Wformat-y2k
4771 @opindex Wno-format-y2k
4772 If @option{-Wformat} is specified, also warn about @code{strftime}
4773 formats that may yield only a two-digit year.
4774 @end table
4775
4776 @item -Wnonnull
4777 @opindex Wnonnull
4778 @opindex Wno-nonnull
4779 Warn about passing a null pointer for arguments marked as
4780 requiring a non-null value by the @code{nonnull} function attribute.
4781
4782 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4783 can be disabled with the @option{-Wno-nonnull} option.
4784
4785 @item -Wnonnull-compare
4786 @opindex Wnonnull-compare
4787 @opindex Wno-nonnull-compare
4788 Warn when comparing an argument marked with the @code{nonnull}
4789 function attribute against null inside the function.
4790
4791 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4792 can be disabled with the @option{-Wno-nonnull-compare} option.
4793
4794 @item -Wnull-dereference
4795 @opindex Wnull-dereference
4796 @opindex Wno-null-dereference
4797 Warn if the compiler detects paths that trigger erroneous or
4798 undefined behavior due to dereferencing a null pointer. This option
4799 is only active when @option{-fdelete-null-pointer-checks} is active,
4800 which is enabled by optimizations in most targets. The precision of
4801 the warnings depends on the optimization options used.
4802
4803 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4804 @opindex Winit-self
4805 @opindex Wno-init-self
4806 Warn about uninitialized variables that are initialized with themselves.
4807 Note this option can only be used with the @option{-Wuninitialized} option.
4808
4809 For example, GCC warns about @code{i} being uninitialized in the
4810 following snippet only when @option{-Winit-self} has been specified:
4811 @smallexample
4812 @group
4813 int f()
4814 @{
4815 int i = i;
4816 return i;
4817 @}
4818 @end group
4819 @end smallexample
4820
4821 This warning is enabled by @option{-Wall} in C++.
4822
4823 @item -Wimplicit-int @r{(C and Objective-C only)}
4824 @opindex Wimplicit-int
4825 @opindex Wno-implicit-int
4826 Warn when a declaration does not specify a type.
4827 This warning is enabled by @option{-Wall}.
4828
4829 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4830 @opindex Wimplicit-function-declaration
4831 @opindex Wno-implicit-function-declaration
4832 Give a warning whenever a function is used before being declared. In
4833 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4834 enabled by default and it is made into an error by
4835 @option{-pedantic-errors}. This warning is also enabled by
4836 @option{-Wall}.
4837
4838 @item -Wimplicit @r{(C and Objective-C only)}
4839 @opindex Wimplicit
4840 @opindex Wno-implicit
4841 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4842 This warning is enabled by @option{-Wall}.
4843
4844 @item -Wimplicit-fallthrough
4845 @opindex Wimplicit-fallthrough
4846 @opindex Wno-implicit-fallthrough
4847 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4848 and @option{-Wno-implicit-fallthrough} is the same as
4849 @option{-Wimplicit-fallthrough=0}.
4850
4851 @item -Wimplicit-fallthrough=@var{n}
4852 @opindex Wimplicit-fallthrough=
4853 Warn when a switch case falls through. For example:
4854
4855 @smallexample
4856 @group
4857 switch (cond)
4858 @{
4859 case 1:
4860 a = 1;
4861 break;
4862 case 2:
4863 a = 2;
4864 case 3:
4865 a = 3;
4866 break;
4867 @}
4868 @end group
4869 @end smallexample
4870
4871 This warning does not warn when the last statement of a case cannot
4872 fall through, e.g. when there is a return statement or a call to function
4873 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4874 also takes into account control flow statements, such as ifs, and only
4875 warns when appropriate. E.g.@:
4876
4877 @smallexample
4878 @group
4879 switch (cond)
4880 @{
4881 case 1:
4882 if (i > 3) @{
4883 bar (5);
4884 break;
4885 @} else if (i < 1) @{
4886 bar (0);
4887 @} else
4888 return;
4889 default:
4890 @dots{}
4891 @}
4892 @end group
4893 @end smallexample
4894
4895 Since there are occasions where a switch case fall through is desirable,
4896 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4897 to be used along with a null statement to suppress this warning that
4898 would normally occur:
4899
4900 @smallexample
4901 @group
4902 switch (cond)
4903 @{
4904 case 1:
4905 bar (0);
4906 __attribute__ ((fallthrough));
4907 default:
4908 @dots{}
4909 @}
4910 @end group
4911 @end smallexample
4912
4913 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4914 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4915 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4916 Instead of these attributes, it is also possible to add a fallthrough comment
4917 to silence the warning. The whole body of the C or C++ style comment should
4918 match the given regular expressions listed below. The option argument @var{n}
4919 specifies what kind of comments are accepted:
4920
4921 @itemize @bullet
4922
4923 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4924
4925 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4926 expression, any comment is used as fallthrough comment.
4927
4928 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4929 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4930
4931 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4932 following regular expressions:
4933
4934 @itemize @bullet
4935
4936 @item @code{-fallthrough}
4937
4938 @item @code{@@fallthrough@@}
4939
4940 @item @code{lint -fallthrough[ \t]*}
4941
4942 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4943
4944 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4945
4946 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4947
4948 @end itemize
4949
4950 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4951 following regular expressions:
4952
4953 @itemize @bullet
4954
4955 @item @code{-fallthrough}
4956
4957 @item @code{@@fallthrough@@}
4958
4959 @item @code{lint -fallthrough[ \t]*}
4960
4961 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4962
4963 @end itemize
4964
4965 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4966 fallthrough comments, only attributes disable the warning.
4967
4968 @end itemize
4969
4970 The comment needs to be followed after optional whitespace and other comments
4971 by @code{case} or @code{default} keywords or by a user label that precedes some
4972 @code{case} or @code{default} label.
4973
4974 @smallexample
4975 @group
4976 switch (cond)
4977 @{
4978 case 1:
4979 bar (0);
4980 /* FALLTHRU */
4981 default:
4982 @dots{}
4983 @}
4984 @end group
4985 @end smallexample
4986
4987 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4988
4989 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4990 @opindex Wif-not-aligned
4991 @opindex Wno-if-not-aligned
4992 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4993 should be issued. This is enabled by default.
4994 Use @option{-Wno-if-not-aligned} to disable it.
4995
4996 @item -Wignored-qualifiers @r{(C and C++ only)}
4997 @opindex Wignored-qualifiers
4998 @opindex Wno-ignored-qualifiers
4999 Warn if the return type of a function has a type qualifier
5000 such as @code{const}. For ISO C such a type qualifier has no effect,
5001 since the value returned by a function is not an lvalue.
5002 For C++, the warning is only emitted for scalar types or @code{void}.
5003 ISO C prohibits qualified @code{void} return types on function
5004 definitions, so such return types always receive a warning
5005 even without this option.
5006
5007 This warning is also enabled by @option{-Wextra}.
5008
5009 @item -Wignored-attributes @r{(C and C++ only)}
5010 @opindex Wignored-attributes
5011 @opindex Wno-ignored-attributes
5012 Warn when an attribute is ignored. This is different from the
5013 @option{-Wattributes} option in that it warns whenever the compiler decides
5014 to drop an attribute, not that the attribute is either unknown, used in a
5015 wrong place, etc. This warning is enabled by default.
5016
5017 @item -Wmain
5018 @opindex Wmain
5019 @opindex Wno-main
5020 Warn if the type of @code{main} is suspicious. @code{main} should be
5021 a function with external linkage, returning int, taking either zero
5022 arguments, two, or three arguments of appropriate types. This warning
5023 is enabled by default in C++ and is enabled by either @option{-Wall}
5024 or @option{-Wpedantic}.
5025
5026 @item -Wmisleading-indentation @r{(C and C++ only)}
5027 @opindex Wmisleading-indentation
5028 @opindex Wno-misleading-indentation
5029 Warn when the indentation of the code does not reflect the block structure.
5030 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5031 @code{for} clauses with a guarded statement that does not use braces,
5032 followed by an unguarded statement with the same indentation.
5033
5034 In the following example, the call to ``bar'' is misleadingly indented as
5035 if it were guarded by the ``if'' conditional.
5036
5037 @smallexample
5038 if (some_condition ())
5039 foo ();
5040 bar (); /* Gotcha: this is not guarded by the "if". */
5041 @end smallexample
5042
5043 In the case of mixed tabs and spaces, the warning uses the
5044 @option{-ftabstop=} option to determine if the statements line up
5045 (defaulting to 8).
5046
5047 The warning is not issued for code involving multiline preprocessor logic
5048 such as the following example.
5049
5050 @smallexample
5051 if (flagA)
5052 foo (0);
5053 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5054 if (flagB)
5055 #endif
5056 foo (1);
5057 @end smallexample
5058
5059 The warning is not issued after a @code{#line} directive, since this
5060 typically indicates autogenerated code, and no assumptions can be made
5061 about the layout of the file that the directive references.
5062
5063 This warning is enabled by @option{-Wall} in C and C++.
5064
5065 @item -Wmissing-attributes
5066 @opindex Wmissing-attributes
5067 @opindex Wno-missing-attributes
5068 Warn when a declaration of a function is missing one or more attributes
5069 that a related function is declared with and whose absence may adversely
5070 affect the correctness or efficiency of generated code. For example,
5071 the warning is issued for declarations of aliases that use attributes
5072 to specify less restrictive requirements than those of their targets.
5073 This typically represents a potential optimization opportunity.
5074 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5075 issued when the alias is more restrictive than the target, which could
5076 lead to incorrect code generation.
5077 Attributes considered include @code{alloc_align}, @code{alloc_size},
5078 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5079 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5080 @code{returns_nonnull}, and @code{returns_twice}.
5081
5082 In C++, the warning is issued when an explicit specialization of a primary
5083 template declared with attribute @code{alloc_align}, @code{alloc_size},
5084 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5085 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5086 @code{error}, and @code{warning} suppress the warning.
5087 (@pxref{Function Attributes}).
5088
5089 You can use the @code{copy} attribute to apply the same
5090 set of attributes to a declaration as that on another declaration without
5091 explicitly enumerating the attributes. This attribute can be applied
5092 to declarations of functions (@pxref{Common Function Attributes}),
5093 variables (@pxref{Common Variable Attributes}), or types
5094 (@pxref{Common Type Attributes}).
5095
5096 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5097
5098 For example, since the declaration of the primary function template
5099 below makes use of both attribute @code{malloc} and @code{alloc_size}
5100 the declaration of the explicit specialization of the template is
5101 diagnosed because it is missing one of the attributes.
5102
5103 @smallexample
5104 template <class T>
5105 T* __attribute__ ((malloc, alloc_size (1)))
5106 allocate (size_t);
5107
5108 template <>
5109 void* __attribute__ ((malloc)) // missing alloc_size
5110 allocate<void> (size_t);
5111 @end smallexample
5112
5113 @item -Wmissing-braces
5114 @opindex Wmissing-braces
5115 @opindex Wno-missing-braces
5116 Warn if an aggregate or union initializer is not fully bracketed. In
5117 the following example, the initializer for @code{a} is not fully
5118 bracketed, but that for @code{b} is fully bracketed. This warning is
5119 enabled by @option{-Wall} in C.
5120
5121 @smallexample
5122 int a[2][2] = @{ 0, 1, 2, 3 @};
5123 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5124 @end smallexample
5125
5126 This warning is enabled by @option{-Wall}.
5127
5128 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5129 @opindex Wmissing-include-dirs
5130 @opindex Wno-missing-include-dirs
5131 Warn if a user-supplied include directory does not exist.
5132
5133 @item -Wmissing-profile
5134 @opindex Wmissing-profile
5135 @opindex Wno-missing-profile
5136 Warn if feedback profiles are missing when using the
5137 @option{-fprofile-use} option.
5138 This option diagnoses those cases where a new function or a new file is added
5139 to the user code between compiling with @option{-fprofile-generate} and with
5140 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5141 profile feedback data files do not contain any profile feedback information for
5142 the newly added function or file respectively. Also, in the case when profile
5143 count data (.gcda) files are removed, GCC cannot use any profile feedback
5144 information. In all these cases, warnings are issued to inform the user that a
5145 profile generation step is due. @option{-Wno-missing-profile} can be used to
5146 disable the warning. Ignoring the warning can result in poorly optimized code.
5147 Completely disabling the warning is not recommended and should be done only
5148 when non-existent profile data is justified.
5149
5150 @item -Wmultistatement-macros
5151 @opindex Wmultistatement-macros
5152 @opindex Wno-multistatement-macros
5153 Warn about unsafe multiple statement macros that appear to be guarded
5154 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5155 @code{while}, in which only the first statement is actually guarded after
5156 the macro is expanded.
5157
5158 For example:
5159
5160 @smallexample
5161 #define DOIT x++; y++
5162 if (c)
5163 DOIT;
5164 @end smallexample
5165
5166 will increment @code{y} unconditionally, not just when @code{c} holds.
5167 The can usually be fixed by wrapping the macro in a do-while loop:
5168 @smallexample
5169 #define DOIT do @{ x++; y++; @} while (0)
5170 if (c)
5171 DOIT;
5172 @end smallexample
5173
5174 This warning is enabled by @option{-Wall} in C and C++.
5175
5176 @item -Wparentheses
5177 @opindex Wparentheses
5178 @opindex Wno-parentheses
5179 Warn if parentheses are omitted in certain contexts, such
5180 as when there is an assignment in a context where a truth value
5181 is expected, or when operators are nested whose precedence people
5182 often get confused about.
5183
5184 Also warn if a comparison like @code{x<=y<=z} appears; this is
5185 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5186 interpretation from that of ordinary mathematical notation.
5187
5188 Also warn for dangerous uses of the GNU extension to
5189 @code{?:} with omitted middle operand. When the condition
5190 in the @code{?}: operator is a boolean expression, the omitted value is
5191 always 1. Often programmers expect it to be a value computed
5192 inside the conditional expression instead.
5193
5194 For C++ this also warns for some cases of unnecessary parentheses in
5195 declarations, which can indicate an attempt at a function call instead
5196 of a declaration:
5197 @smallexample
5198 @{
5199 // Declares a local variable called mymutex.
5200 std::unique_lock<std::mutex> (mymutex);
5201 // User meant std::unique_lock<std::mutex> lock (mymutex);
5202 @}
5203 @end smallexample
5204
5205 This warning is enabled by @option{-Wall}.
5206
5207 @item -Wsequence-point
5208 @opindex Wsequence-point
5209 @opindex Wno-sequence-point
5210 Warn about code that may have undefined semantics because of violations
5211 of sequence point rules in the C and C++ standards.
5212
5213 The C and C++ standards define the order in which expressions in a C/C++
5214 program are evaluated in terms of @dfn{sequence points}, which represent
5215 a partial ordering between the execution of parts of the program: those
5216 executed before the sequence point, and those executed after it. These
5217 occur after the evaluation of a full expression (one which is not part
5218 of a larger expression), after the evaluation of the first operand of a
5219 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5220 function is called (but after the evaluation of its arguments and the
5221 expression denoting the called function), and in certain other places.
5222 Other than as expressed by the sequence point rules, the order of
5223 evaluation of subexpressions of an expression is not specified. All
5224 these rules describe only a partial order rather than a total order,
5225 since, for example, if two functions are called within one expression
5226 with no sequence point between them, the order in which the functions
5227 are called is not specified. However, the standards committee have
5228 ruled that function calls do not overlap.
5229
5230 It is not specified when between sequence points modifications to the
5231 values of objects take effect. Programs whose behavior depends on this
5232 have undefined behavior; the C and C++ standards specify that ``Between
5233 the previous and next sequence point an object shall have its stored
5234 value modified at most once by the evaluation of an expression.
5235 Furthermore, the prior value shall be read only to determine the value
5236 to be stored.''. If a program breaks these rules, the results on any
5237 particular implementation are entirely unpredictable.
5238
5239 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5240 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5241 diagnosed by this option, and it may give an occasional false positive
5242 result, but in general it has been found fairly effective at detecting
5243 this sort of problem in programs.
5244
5245 The C++17 standard will define the order of evaluation of operands in
5246 more cases: in particular it requires that the right-hand side of an
5247 assignment be evaluated before the left-hand side, so the above
5248 examples are no longer undefined. But this warning will still warn
5249 about them, to help people avoid writing code that is undefined in C
5250 and earlier revisions of C++.
5251
5252 The standard is worded confusingly, therefore there is some debate
5253 over the precise meaning of the sequence point rules in subtle cases.
5254 Links to discussions of the problem, including proposed formal
5255 definitions, may be found on the GCC readings page, at
5256 @uref{http://gcc.gnu.org/@/readings.html}.
5257
5258 This warning is enabled by @option{-Wall} for C and C++.
5259
5260 @item -Wno-return-local-addr
5261 @opindex Wno-return-local-addr
5262 @opindex Wreturn-local-addr
5263 Do not warn about returning a pointer (or in C++, a reference) to a
5264 variable that goes out of scope after the function returns.
5265
5266 @item -Wreturn-type
5267 @opindex Wreturn-type
5268 @opindex Wno-return-type
5269 Warn whenever a function is defined with a return type that defaults
5270 to @code{int}. Also warn about any @code{return} statement with no
5271 return value in a function whose return type is not @code{void}
5272 (falling off the end of the function body is considered returning
5273 without a value).
5274
5275 For C only, warn about a @code{return} statement with an expression in a
5276 function whose return type is @code{void}, unless the expression type is
5277 also @code{void}. As a GNU extension, the latter case is accepted
5278 without a warning unless @option{-Wpedantic} is used. Attempting
5279 to use the return value of a non-@code{void} function other than @code{main}
5280 that flows off the end by reaching the closing curly brace that terminates
5281 the function is undefined.
5282
5283 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5284 than @code{main} results in undefined behavior even when the value of
5285 the function is not used.
5286
5287 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5288
5289 @item -Wshift-count-negative
5290 @opindex Wshift-count-negative
5291 @opindex Wno-shift-count-negative
5292 Warn if shift count is negative. This warning is enabled by default.
5293
5294 @item -Wshift-count-overflow
5295 @opindex Wshift-count-overflow
5296 @opindex Wno-shift-count-overflow
5297 Warn if shift count >= width of type. This warning is enabled by default.
5298
5299 @item -Wshift-negative-value
5300 @opindex Wshift-negative-value
5301 @opindex Wno-shift-negative-value
5302 Warn if left shifting a negative value. This warning is enabled by
5303 @option{-Wextra} in C99 and C++11 modes (and newer).
5304
5305 @item -Wshift-overflow
5306 @itemx -Wshift-overflow=@var{n}
5307 @opindex Wshift-overflow
5308 @opindex Wno-shift-overflow
5309 Warn about left shift overflows. This warning is enabled by
5310 default in C99 and C++11 modes (and newer).
5311
5312 @table @gcctabopt
5313 @item -Wshift-overflow=1
5314 This is the warning level of @option{-Wshift-overflow} and is enabled
5315 by default in C99 and C++11 modes (and newer). This warning level does
5316 not warn about left-shifting 1 into the sign bit. (However, in C, such
5317 an overflow is still rejected in contexts where an integer constant expression
5318 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5319 shifts always wrap.
5320
5321 @item -Wshift-overflow=2
5322 This warning level also warns about left-shifting 1 into the sign bit,
5323 unless C++14 mode (or newer) is active.
5324 @end table
5325
5326 @item -Wswitch
5327 @opindex Wswitch
5328 @opindex Wno-switch
5329 Warn whenever a @code{switch} statement has an index of enumerated type
5330 and lacks a @code{case} for one or more of the named codes of that
5331 enumeration. (The presence of a @code{default} label prevents this
5332 warning.) @code{case} labels outside the enumeration range also
5333 provoke warnings when this option is used (even if there is a
5334 @code{default} label).
5335 This warning is enabled by @option{-Wall}.
5336
5337 @item -Wswitch-default
5338 @opindex Wswitch-default
5339 @opindex Wno-switch-default
5340 Warn whenever a @code{switch} statement does not have a @code{default}
5341 case.
5342
5343 @item -Wswitch-enum
5344 @opindex Wswitch-enum
5345 @opindex Wno-switch-enum
5346 Warn whenever a @code{switch} statement has an index of enumerated type
5347 and lacks a @code{case} for one or more of the named codes of that
5348 enumeration. @code{case} labels outside the enumeration range also
5349 provoke warnings when this option is used. The only difference
5350 between @option{-Wswitch} and this option is that this option gives a
5351 warning about an omitted enumeration code even if there is a
5352 @code{default} label.
5353
5354 @item -Wswitch-bool
5355 @opindex Wswitch-bool
5356 @opindex Wno-switch-bool
5357 Warn whenever a @code{switch} statement has an index of boolean type
5358 and the case values are outside the range of a boolean type.
5359 It is possible to suppress this warning by casting the controlling
5360 expression to a type other than @code{bool}. For example:
5361 @smallexample
5362 @group
5363 switch ((int) (a == 4))
5364 @{
5365 @dots{}
5366 @}
5367 @end group
5368 @end smallexample
5369 This warning is enabled by default for C and C++ programs.
5370
5371 @item -Wswitch-unreachable
5372 @opindex Wswitch-unreachable
5373 @opindex Wno-switch-unreachable
5374 Warn whenever a @code{switch} statement contains statements between the
5375 controlling expression and the first case label, which will never be
5376 executed. For example:
5377 @smallexample
5378 @group
5379 switch (cond)
5380 @{
5381 i = 15;
5382 @dots{}
5383 case 5:
5384 @dots{}
5385 @}
5386 @end group
5387 @end smallexample
5388 @option{-Wswitch-unreachable} does not warn if the statement between the
5389 controlling expression and the first case label is just a declaration:
5390 @smallexample
5391 @group
5392 switch (cond)
5393 @{
5394 int i;
5395 @dots{}
5396 case 5:
5397 i = 5;
5398 @dots{}
5399 @}
5400 @end group
5401 @end smallexample
5402 This warning is enabled by default for C and C++ programs.
5403
5404 @item -Wsync-nand @r{(C and C++ only)}
5405 @opindex Wsync-nand
5406 @opindex Wno-sync-nand
5407 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5408 built-in functions are used. These functions changed semantics in GCC 4.4.
5409
5410 @item -Wunused-but-set-parameter
5411 @opindex Wunused-but-set-parameter
5412 @opindex Wno-unused-but-set-parameter
5413 Warn whenever a function parameter is assigned to, but otherwise unused
5414 (aside from its declaration).
5415
5416 To suppress this warning use the @code{unused} attribute
5417 (@pxref{Variable Attributes}).
5418
5419 This warning is also enabled by @option{-Wunused} together with
5420 @option{-Wextra}.
5421
5422 @item -Wunused-but-set-variable
5423 @opindex Wunused-but-set-variable
5424 @opindex Wno-unused-but-set-variable
5425 Warn whenever a local variable is assigned to, but otherwise unused
5426 (aside from its declaration).
5427 This warning is enabled by @option{-Wall}.
5428
5429 To suppress this warning use the @code{unused} attribute
5430 (@pxref{Variable Attributes}).
5431
5432 This warning is also enabled by @option{-Wunused}, which is enabled
5433 by @option{-Wall}.
5434
5435 @item -Wunused-function
5436 @opindex Wunused-function
5437 @opindex Wno-unused-function
5438 Warn whenever a static function is declared but not defined or a
5439 non-inline static function is unused.
5440 This warning is enabled by @option{-Wall}.
5441
5442 @item -Wunused-label
5443 @opindex Wunused-label
5444 @opindex Wno-unused-label
5445 Warn whenever a label is declared but not used.
5446 This warning is enabled by @option{-Wall}.
5447
5448 To suppress this warning use the @code{unused} attribute
5449 (@pxref{Variable Attributes}).
5450
5451 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5452 @opindex Wunused-local-typedefs
5453 @opindex Wno-unused-local-typedefs
5454 Warn when a typedef locally defined in a function is not used.
5455 This warning is enabled by @option{-Wall}.
5456
5457 @item -Wunused-parameter
5458 @opindex Wunused-parameter
5459 @opindex Wno-unused-parameter
5460 Warn whenever a function parameter is unused aside from its declaration.
5461
5462 To suppress this warning use the @code{unused} attribute
5463 (@pxref{Variable Attributes}).
5464
5465 @item -Wno-unused-result
5466 @opindex Wunused-result
5467 @opindex Wno-unused-result
5468 Do not warn if a caller of a function marked with attribute
5469 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5470 its return value. The default is @option{-Wunused-result}.
5471
5472 @item -Wunused-variable
5473 @opindex Wunused-variable
5474 @opindex Wno-unused-variable
5475 Warn whenever a local or static variable is unused aside from its
5476 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5477 but not for C++. This warning is enabled by @option{-Wall}.
5478
5479 To suppress this warning use the @code{unused} attribute
5480 (@pxref{Variable Attributes}).
5481
5482 @item -Wunused-const-variable
5483 @itemx -Wunused-const-variable=@var{n}
5484 @opindex Wunused-const-variable
5485 @opindex Wno-unused-const-variable
5486 Warn whenever a constant static variable is unused aside from its declaration.
5487 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5488 for C, but not for C++. In C this declares variable storage, but in C++ this
5489 is not an error since const variables take the place of @code{#define}s.
5490
5491 To suppress this warning use the @code{unused} attribute
5492 (@pxref{Variable Attributes}).
5493
5494 @table @gcctabopt
5495 @item -Wunused-const-variable=1
5496 This is the warning level that is enabled by @option{-Wunused-variable} for
5497 C. It warns only about unused static const variables defined in the main
5498 compilation unit, but not about static const variables declared in any
5499 header included.
5500
5501 @item -Wunused-const-variable=2
5502 This warning level also warns for unused constant static variables in
5503 headers (excluding system headers). This is the warning level of
5504 @option{-Wunused-const-variable} and must be explicitly requested since
5505 in C++ this isn't an error and in C it might be harder to clean up all
5506 headers included.
5507 @end table
5508
5509 @item -Wunused-value
5510 @opindex Wunused-value
5511 @opindex Wno-unused-value
5512 Warn whenever a statement computes a result that is explicitly not
5513 used. To suppress this warning cast the unused expression to
5514 @code{void}. This includes an expression-statement or the left-hand
5515 side of a comma expression that contains no side effects. For example,
5516 an expression such as @code{x[i,j]} causes a warning, while
5517 @code{x[(void)i,j]} does not.
5518
5519 This warning is enabled by @option{-Wall}.
5520
5521 @item -Wunused
5522 @opindex Wunused
5523 @opindex Wno-unused
5524 All the above @option{-Wunused} options combined.
5525
5526 In order to get a warning about an unused function parameter, you must
5527 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5528 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5529
5530 @item -Wuninitialized
5531 @opindex Wuninitialized
5532 @opindex Wno-uninitialized
5533 Warn if an automatic variable is used without first being initialized
5534 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5535 warn if a non-static reference or non-static @code{const} member
5536 appears in a class without constructors.
5537
5538 If you want to warn about code that uses the uninitialized value of the
5539 variable in its own initializer, use the @option{-Winit-self} option.
5540
5541 These warnings occur for individual uninitialized or clobbered
5542 elements of structure, union or array variables as well as for
5543 variables that are uninitialized or clobbered as a whole. They do
5544 not occur for variables or elements declared @code{volatile}. Because
5545 these warnings depend on optimization, the exact variables or elements
5546 for which there are warnings depends on the precise optimization
5547 options and version of GCC used.
5548
5549 Note that there may be no warning about a variable that is used only
5550 to compute a value that itself is never used, because such
5551 computations may be deleted by data flow analysis before the warnings
5552 are printed.
5553
5554 @item -Winvalid-memory-model
5555 @opindex Winvalid-memory-model
5556 @opindex Wno-invalid-memory-model
5557 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5558 and the C11 atomic generic functions with a memory consistency argument
5559 that is either invalid for the operation or outside the range of values
5560 of the @code{memory_order} enumeration. For example, since the
5561 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5562 defined for the relaxed, release, and sequentially consistent memory
5563 orders the following code is diagnosed:
5564
5565 @smallexample
5566 void store (int *i)
5567 @{
5568 __atomic_store_n (i, 0, memory_order_consume);
5569 @}
5570 @end smallexample
5571
5572 @option{-Winvalid-memory-model} is enabled by default.
5573
5574 @item -Wmaybe-uninitialized
5575 @opindex Wmaybe-uninitialized
5576 @opindex Wno-maybe-uninitialized
5577 For an automatic (i.e.@: local) variable, if there exists a path from the
5578 function entry to a use of the variable that is initialized, but there exist
5579 some other paths for which the variable is not initialized, the compiler
5580 emits a warning if it cannot prove the uninitialized paths are not
5581 executed at run time.
5582
5583 These warnings are only possible in optimizing compilation, because otherwise
5584 GCC does not keep track of the state of variables.
5585
5586 These warnings are made optional because GCC may not be able to determine when
5587 the code is correct in spite of appearing to have an error. Here is one
5588 example of how this can happen:
5589
5590 @smallexample
5591 @group
5592 @{
5593 int x;
5594 switch (y)
5595 @{
5596 case 1: x = 1;
5597 break;
5598 case 2: x = 4;
5599 break;
5600 case 3: x = 5;
5601 @}
5602 foo (x);
5603 @}
5604 @end group
5605 @end smallexample
5606
5607 @noindent
5608 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5609 always initialized, but GCC doesn't know this. To suppress the
5610 warning, you need to provide a default case with assert(0) or
5611 similar code.
5612
5613 @cindex @code{longjmp} warnings
5614 This option also warns when a non-volatile automatic variable might be
5615 changed by a call to @code{longjmp}.
5616 The compiler sees only the calls to @code{setjmp}. It cannot know
5617 where @code{longjmp} will be called; in fact, a signal handler could
5618 call it at any point in the code. As a result, you may get a warning
5619 even when there is in fact no problem because @code{longjmp} cannot
5620 in fact be called at the place that would cause a problem.
5621
5622 Some spurious warnings can be avoided if you declare all the functions
5623 you use that never return as @code{noreturn}. @xref{Function
5624 Attributes}.
5625
5626 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5627
5628 @item -Wunknown-pragmas
5629 @opindex Wunknown-pragmas
5630 @opindex Wno-unknown-pragmas
5631 @cindex warning for unknown pragmas
5632 @cindex unknown pragmas, warning
5633 @cindex pragmas, warning of unknown
5634 Warn when a @code{#pragma} directive is encountered that is not understood by
5635 GCC@. If this command-line option is used, warnings are even issued
5636 for unknown pragmas in system header files. This is not the case if
5637 the warnings are only enabled by the @option{-Wall} command-line option.
5638
5639 @item -Wno-pragmas
5640 @opindex Wno-pragmas
5641 @opindex Wpragmas
5642 Do not warn about misuses of pragmas, such as incorrect parameters,
5643 invalid syntax, or conflicts between pragmas. See also
5644 @option{-Wunknown-pragmas}.
5645
5646 @item -Wno-prio-ctor-dtor
5647 @opindex Wno-prio-ctor-dtor
5648 @opindex Wprio-ctor-dtor
5649 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5650 The use of constructor and destructor attributes allow you to assign a
5651 priority to the constructor/destructor to control its order of execution
5652 before @code{main} is called or after it returns. The priority values must be
5653 greater than 100 as the compiler reserves priority values between 0--100 for
5654 the implementation.
5655
5656 @item -Wstrict-aliasing
5657 @opindex Wstrict-aliasing
5658 @opindex Wno-strict-aliasing
5659 This option is only active when @option{-fstrict-aliasing} is active.
5660 It warns about code that might break the strict aliasing rules that the
5661 compiler is using for optimization. The warning does not catch all
5662 cases, but does attempt to catch the more common pitfalls. It is
5663 included in @option{-Wall}.
5664 It is equivalent to @option{-Wstrict-aliasing=3}
5665
5666 @item -Wstrict-aliasing=n
5667 @opindex Wstrict-aliasing=n
5668 This option is only active when @option{-fstrict-aliasing} is active.
5669 It warns about code that might break the strict aliasing rules that the
5670 compiler is using for optimization.
5671 Higher levels correspond to higher accuracy (fewer false positives).
5672 Higher levels also correspond to more effort, similar to the way @option{-O}
5673 works.
5674 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5675
5676 Level 1: Most aggressive, quick, least accurate.
5677 Possibly useful when higher levels
5678 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5679 false negatives. However, it has many false positives.
5680 Warns for all pointer conversions between possibly incompatible types,
5681 even if never dereferenced. Runs in the front end only.
5682
5683 Level 2: Aggressive, quick, not too precise.
5684 May still have many false positives (not as many as level 1 though),
5685 and few false negatives (but possibly more than level 1).
5686 Unlike level 1, it only warns when an address is taken. Warns about
5687 incomplete types. Runs in the front end only.
5688
5689 Level 3 (default for @option{-Wstrict-aliasing}):
5690 Should have very few false positives and few false
5691 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5692 Takes care of the common pun+dereference pattern in the front end:
5693 @code{*(int*)&some_float}.
5694 If optimization is enabled, it also runs in the back end, where it deals
5695 with multiple statement cases using flow-sensitive points-to information.
5696 Only warns when the converted pointer is dereferenced.
5697 Does not warn about incomplete types.
5698
5699 @item -Wstrict-overflow
5700 @itemx -Wstrict-overflow=@var{n}
5701 @opindex Wstrict-overflow
5702 @opindex Wno-strict-overflow
5703 This option is only active when signed overflow is undefined.
5704 It warns about cases where the compiler optimizes based on the
5705 assumption that signed overflow does not occur. Note that it does not
5706 warn about all cases where the code might overflow: it only warns
5707 about cases where the compiler implements some optimization. Thus
5708 this warning depends on the optimization level.
5709
5710 An optimization that assumes that signed overflow does not occur is
5711 perfectly safe if the values of the variables involved are such that
5712 overflow never does, in fact, occur. Therefore this warning can
5713 easily give a false positive: a warning about code that is not
5714 actually a problem. To help focus on important issues, several
5715 warning levels are defined. No warnings are issued for the use of
5716 undefined signed overflow when estimating how many iterations a loop
5717 requires, in particular when determining whether a loop will be
5718 executed at all.
5719
5720 @table @gcctabopt
5721 @item -Wstrict-overflow=1
5722 Warn about cases that are both questionable and easy to avoid. For
5723 example the compiler simplifies
5724 @code{x + 1 > x} to @code{1}. This level of
5725 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5726 are not, and must be explicitly requested.
5727
5728 @item -Wstrict-overflow=2
5729 Also warn about other cases where a comparison is simplified to a
5730 constant. For example: @code{abs (x) >= 0}. This can only be
5731 simplified when signed integer overflow is undefined, because
5732 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5733 zero. @option{-Wstrict-overflow} (with no level) is the same as
5734 @option{-Wstrict-overflow=2}.
5735
5736 @item -Wstrict-overflow=3
5737 Also warn about other cases where a comparison is simplified. For
5738 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5739
5740 @item -Wstrict-overflow=4
5741 Also warn about other simplifications not covered by the above cases.
5742 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5743
5744 @item -Wstrict-overflow=5
5745 Also warn about cases where the compiler reduces the magnitude of a
5746 constant involved in a comparison. For example: @code{x + 2 > y} is
5747 simplified to @code{x + 1 >= y}. This is reported only at the
5748 highest warning level because this simplification applies to many
5749 comparisons, so this warning level gives a very large number of
5750 false positives.
5751 @end table
5752
5753 @item -Wstringop-overflow
5754 @itemx -Wstringop-overflow=@var{type}
5755 @opindex Wstringop-overflow
5756 @opindex Wno-stringop-overflow
5757 Warn for calls to string manipulation functions such as @code{memcpy} and
5758 @code{strcpy} that are determined to overflow the destination buffer. The
5759 optional argument is one greater than the type of Object Size Checking to
5760 perform to determine the size of the destination. @xref{Object Size Checking}.
5761 The argument is meaningful only for functions that operate on character arrays
5762 but not for raw memory functions like @code{memcpy} which always make use
5763 of Object Size type-0. The option also warns for calls that specify a size
5764 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5765 The option produces the best results with optimization enabled but can detect
5766 a small subset of simple buffer overflows even without optimization in
5767 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5768 correspond to the standard functions. In any case, the option warns about
5769 just a subset of buffer overflows detected by the corresponding overflow
5770 checking built-ins. For example, the option will issue a warning for
5771 the @code{strcpy} call below because it copies at least 5 characters
5772 (the string @code{"blue"} including the terminating NUL) into the buffer
5773 of size 4.
5774
5775 @smallexample
5776 enum Color @{ blue, purple, yellow @};
5777 const char* f (enum Color clr)
5778 @{
5779 static char buf [4];
5780 const char *str;
5781 switch (clr)
5782 @{
5783 case blue: str = "blue"; break;
5784 case purple: str = "purple"; break;
5785 case yellow: str = "yellow"; break;
5786 @}
5787
5788 return strcpy (buf, str); // warning here
5789 @}
5790 @end smallexample
5791
5792 Option @option{-Wstringop-overflow=2} is enabled by default.
5793
5794 @table @gcctabopt
5795 @item -Wstringop-overflow
5796 @itemx -Wstringop-overflow=1
5797 @opindex Wstringop-overflow
5798 @opindex Wno-stringop-overflow
5799 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5800 to determine the sizes of destination objects. This is the default setting
5801 of the option. At this setting the option will not warn for writes past
5802 the end of subobjects of larger objects accessed by pointers unless the
5803 size of the largest surrounding object is known. When the destination may
5804 be one of several objects it is assumed to be the largest one of them. On
5805 Linux systems, when optimization is enabled at this setting the option warns
5806 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5807 a non-zero value.
5808
5809 @item -Wstringop-overflow=2
5810 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5811 to determine the sizes of destination objects. At this setting the option
5812 will warn about overflows when writing to members of the largest complete
5813 objects whose exact size is known. It will, however, not warn for excessive
5814 writes to the same members of unknown objects referenced by pointers since
5815 they may point to arrays containing unknown numbers of elements.
5816
5817 @item -Wstringop-overflow=3
5818 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5819 to determine the sizes of destination objects. At this setting the option
5820 warns about overflowing the smallest object or data member. This is the
5821 most restrictive setting of the option that may result in warnings for safe
5822 code.
5823
5824 @item -Wstringop-overflow=4
5825 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5826 to determine the sizes of destination objects. At this setting the option
5827 will warn about overflowing any data members, and when the destination is
5828 one of several objects it uses the size of the largest of them to decide
5829 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5830 setting of the option may result in warnings for benign code.
5831 @end table
5832
5833 @item -Wstringop-truncation
5834 @opindex Wstringop-truncation
5835 @opindex Wno-stringop-truncation
5836 Warn for calls to bounded string manipulation functions such as @code{strncat},
5837 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5838 or leave the destination unchanged.
5839
5840 In the following example, the call to @code{strncat} specifies a bound that
5841 is less than the length of the source string. As a result, the copy of
5842 the source will be truncated and so the call is diagnosed. To avoid the
5843 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5844
5845 @smallexample
5846 void append (char *buf, size_t bufsize)
5847 @{
5848 strncat (buf, ".txt", 3);
5849 @}
5850 @end smallexample
5851
5852 As another example, the following call to @code{strncpy} results in copying
5853 to @code{d} just the characters preceding the terminating NUL, without
5854 appending the NUL to the end. Assuming the result of @code{strncpy} is
5855 necessarily a NUL-terminated string is a common mistake, and so the call
5856 is diagnosed. To avoid the warning when the result is not expected to be
5857 NUL-terminated, call @code{memcpy} instead.
5858
5859 @smallexample
5860 void copy (char *d, const char *s)
5861 @{
5862 strncpy (d, s, strlen (s));
5863 @}
5864 @end smallexample
5865
5866 In the following example, the call to @code{strncpy} specifies the size
5867 of the destination buffer as the bound. If the length of the source
5868 string is equal to or greater than this size the result of the copy will
5869 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5870 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5871 element of the buffer to @code{NUL}.
5872
5873 @smallexample
5874 void copy (const char *s)
5875 @{
5876 char buf[80];
5877 strncpy (buf, s, sizeof buf);
5878 @dots{}
5879 @}
5880 @end smallexample
5881
5882 In situations where a character array is intended to store a sequence
5883 of bytes with no terminating @code{NUL} such an array may be annotated
5884 with attribute @code{nonstring} to avoid this warning. Such arrays,
5885 however, are not suitable arguments to functions that expect
5886 @code{NUL}-terminated strings. To help detect accidental misuses of
5887 such arrays GCC issues warnings unless it can prove that the use is
5888 safe. @xref{Common Variable Attributes}.
5889
5890 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5891 @opindex Wsuggest-attribute=
5892 @opindex Wno-suggest-attribute=
5893 Warn for cases where adding an attribute may be beneficial. The
5894 attributes currently supported are listed below.
5895
5896 @table @gcctabopt
5897 @item -Wsuggest-attribute=pure
5898 @itemx -Wsuggest-attribute=const
5899 @itemx -Wsuggest-attribute=noreturn
5900 @itemx -Wmissing-noreturn
5901 @itemx -Wsuggest-attribute=malloc
5902 @opindex Wsuggest-attribute=pure
5903 @opindex Wno-suggest-attribute=pure
5904 @opindex Wsuggest-attribute=const
5905 @opindex Wno-suggest-attribute=const
5906 @opindex Wsuggest-attribute=noreturn
5907 @opindex Wno-suggest-attribute=noreturn
5908 @opindex Wmissing-noreturn
5909 @opindex Wno-missing-noreturn
5910 @opindex Wsuggest-attribute=malloc
5911 @opindex Wno-suggest-attribute=malloc
5912
5913 Warn about functions that might be candidates for attributes
5914 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5915 only warns for functions visible in other compilation units or (in the case of
5916 @code{pure} and @code{const}) if it cannot prove that the function returns
5917 normally. A function returns normally if it doesn't contain an infinite loop or
5918 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5919 requires option @option{-fipa-pure-const}, which is enabled by default at
5920 @option{-O} and higher. Higher optimization levels improve the accuracy
5921 of the analysis.
5922
5923 @item -Wsuggest-attribute=format
5924 @itemx -Wmissing-format-attribute
5925 @opindex Wsuggest-attribute=format
5926 @opindex Wmissing-format-attribute
5927 @opindex Wno-suggest-attribute=format
5928 @opindex Wno-missing-format-attribute
5929 @opindex Wformat
5930 @opindex Wno-format
5931
5932 Warn about function pointers that might be candidates for @code{format}
5933 attributes. Note these are only possible candidates, not absolute ones.
5934 GCC guesses that function pointers with @code{format} attributes that
5935 are used in assignment, initialization, parameter passing or return
5936 statements should have a corresponding @code{format} attribute in the
5937 resulting type. I.e.@: the left-hand side of the assignment or
5938 initialization, the type of the parameter variable, or the return type
5939 of the containing function respectively should also have a @code{format}
5940 attribute to avoid the warning.
5941
5942 GCC also warns about function definitions that might be
5943 candidates for @code{format} attributes. Again, these are only
5944 possible candidates. GCC guesses that @code{format} attributes
5945 might be appropriate for any function that calls a function like
5946 @code{vprintf} or @code{vscanf}, but this might not always be the
5947 case, and some functions for which @code{format} attributes are
5948 appropriate may not be detected.
5949
5950 @item -Wsuggest-attribute=cold
5951 @opindex Wsuggest-attribute=cold
5952 @opindex Wno-suggest-attribute=cold
5953
5954 Warn about functions that might be candidates for @code{cold} attribute. This
5955 is based on static detection and generally will only warn about functions which
5956 always leads to a call to another @code{cold} function such as wrappers of
5957 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5958 @end table
5959
5960 @item -Wsuggest-final-types
5961 @opindex Wno-suggest-final-types
5962 @opindex Wsuggest-final-types
5963 Warn about types with virtual methods where code quality would be improved
5964 if the type were declared with the C++11 @code{final} specifier,
5965 or, if possible,
5966 declared in an anonymous namespace. This allows GCC to more aggressively
5967 devirtualize the polymorphic calls. This warning is more effective with link
5968 time optimization, where the information about the class hierarchy graph is
5969 more complete.
5970
5971 @item -Wsuggest-final-methods
5972 @opindex Wno-suggest-final-methods
5973 @opindex Wsuggest-final-methods
5974 Warn about virtual methods where code quality would be improved if the method
5975 were declared with the C++11 @code{final} specifier,
5976 or, if possible, its type were
5977 declared in an anonymous namespace or with the @code{final} specifier.
5978 This warning is
5979 more effective with link-time optimization, where the information about the
5980 class hierarchy graph is more complete. It is recommended to first consider
5981 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5982 annotations.
5983
5984 @item -Wsuggest-override
5985 Warn about overriding virtual functions that are not marked with the override
5986 keyword.
5987
5988 @item -Walloc-zero
5989 @opindex Wno-alloc-zero
5990 @opindex Walloc-zero
5991 Warn about calls to allocation functions decorated with attribute
5992 @code{alloc_size} that specify zero bytes, including those to the built-in
5993 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5994 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5995 when called with a zero size differs among implementations (and in the case
5996 of @code{realloc} has been deprecated) relying on it may result in subtle
5997 portability bugs and should be avoided.
5998
5999 @item -Walloc-size-larger-than=@var{byte-size}
6000 @opindex Walloc-size-larger-than=
6001 @opindex Wno-alloc-size-larger-than
6002 Warn about calls to functions decorated with attribute @code{alloc_size}
6003 that attempt to allocate objects larger than the specified number of bytes,
6004 or where the result of the size computation in an integer type with infinite
6005 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6006 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6007 Warnings controlled by the option can be disabled either by specifying
6008 @var{byte-size} of @samp{SIZE_MAX} or more or by
6009 @option{-Wno-alloc-size-larger-than}.
6010 @xref{Function Attributes}.
6011
6012 @item -Wno-alloc-size-larger-than
6013 @opindex Wno-alloc-size-larger-than
6014 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6015 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6016 larger.
6017
6018 @item -Walloca
6019 @opindex Wno-alloca
6020 @opindex Walloca
6021 This option warns on all uses of @code{alloca} in the source.
6022
6023 @item -Walloca-larger-than=@var{byte-size}
6024 @opindex Walloca-larger-than=
6025 @opindex Wno-alloca-larger-than
6026 This option warns on calls to @code{alloca} with an integer argument whose
6027 value is either zero, or that is not bounded by a controlling predicate
6028 that limits its value to at most @var{byte-size}. It also warns for calls
6029 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6030 types are considered unbounded even if they appear to be constrained to
6031 the expected range.
6032
6033 For example, a bounded case of @code{alloca} could be:
6034
6035 @smallexample
6036 void func (size_t n)
6037 @{
6038 void *p;
6039 if (n <= 1000)
6040 p = alloca (n);
6041 else
6042 p = malloc (n);
6043 f (p);
6044 @}
6045 @end smallexample
6046
6047 In the above example, passing @code{-Walloca-larger-than=1000} would not
6048 issue a warning because the call to @code{alloca} is known to be at most
6049 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6050 the compiler would emit a warning.
6051
6052 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6053 controlling predicate constraining its integer argument. For example:
6054
6055 @smallexample
6056 void func ()
6057 @{
6058 void *p = alloca (n);
6059 f (p);
6060 @}
6061 @end smallexample
6062
6063 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6064 a warning, but this time because of the lack of bounds checking.
6065
6066 Note, that even seemingly correct code involving signed integers could
6067 cause a warning:
6068
6069 @smallexample
6070 void func (signed int n)
6071 @{
6072 if (n < 500)
6073 @{
6074 p = alloca (n);
6075 f (p);
6076 @}
6077 @}
6078 @end smallexample
6079
6080 In the above example, @var{n} could be negative, causing a larger than
6081 expected argument to be implicitly cast into the @code{alloca} call.
6082
6083 This option also warns when @code{alloca} is used in a loop.
6084
6085 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6086 but is usually only effective when @option{-ftree-vrp} is active (default
6087 for @option{-O2} and above).
6088
6089 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6090
6091 @item -Wno-alloca-larger-than
6092 @opindex Wno-alloca-larger-than
6093 Disable @option{-Walloca-larger-than=} warnings. The option is
6094 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6095
6096 @item -Warray-bounds
6097 @itemx -Warray-bounds=@var{n}
6098 @opindex Wno-array-bounds
6099 @opindex Warray-bounds
6100 This option is only active when @option{-ftree-vrp} is active
6101 (default for @option{-O2} and above). It warns about subscripts to arrays
6102 that are always out of bounds. This warning is enabled by @option{-Wall}.
6103
6104 @table @gcctabopt
6105 @item -Warray-bounds=1
6106 This is the warning level of @option{-Warray-bounds} and is enabled
6107 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6108
6109 @item -Warray-bounds=2
6110 This warning level also warns about out of bounds access for
6111 arrays at the end of a struct and for arrays accessed through
6112 pointers. This warning level may give a larger number of
6113 false positives and is deactivated by default.
6114 @end table
6115
6116 @item -Wattribute-alias=@var{n}
6117 @itemx -Wno-attribute-alias
6118 @opindex -Wattribute-alias
6119 @opindex -Wno-attribute-alias
6120 Warn about declarations using the @code{alias} and similar attributes whose
6121 target is incompatible with the type of the alias.
6122 @xref{Function Attributes,,Declaring Attributes of Functions}.
6123
6124 @table @gcctabopt
6125 @item -Wattribute-alias=1
6126 The default warning level of the @option{-Wattribute-alias} option diagnoses
6127 incompatibilities between the type of the alias declaration and that of its
6128 target. Such incompatibilities are typically indicative of bugs.
6129
6130 @item -Wattribute-alias=2
6131
6132 At this level @option{-Wattribute-alias} also diagnoses cases where
6133 the attributes of the alias declaration are more restrictive than the
6134 attributes applied to its target. These mismatches can potentially
6135 result in incorrect code generation. In other cases they may be
6136 benign and could be resolved simply by adding the missing attribute to
6137 the target. For comparison, see the @option{-Wmissing-attributes}
6138 option, which controls diagnostics when the alias declaration is less
6139 restrictive than the target, rather than more restrictive.
6140
6141 Attributes considered include @code{alloc_align}, @code{alloc_size},
6142 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6143 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6144 @code{returns_nonnull}, and @code{returns_twice}.
6145 @end table
6146
6147 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6148 This is the default. You can disable these warnings with either
6149 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6150
6151 @item -Wbool-compare
6152 @opindex Wno-bool-compare
6153 @opindex Wbool-compare
6154 Warn about boolean expression compared with an integer value different from
6155 @code{true}/@code{false}. For instance, the following comparison is
6156 always false:
6157 @smallexample
6158 int n = 5;
6159 @dots{}
6160 if ((n > 1) == 2) @{ @dots{} @}
6161 @end smallexample
6162 This warning is enabled by @option{-Wall}.
6163
6164 @item -Wbool-operation
6165 @opindex Wno-bool-operation
6166 @opindex Wbool-operation
6167 Warn about suspicious operations on expressions of a boolean type. For
6168 instance, bitwise negation of a boolean is very likely a bug in the program.
6169 For C, this warning also warns about incrementing or decrementing a boolean,
6170 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6171 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6172
6173 This warning is enabled by @option{-Wall}.
6174
6175 @item -Wduplicated-branches
6176 @opindex Wno-duplicated-branches
6177 @opindex Wduplicated-branches
6178 Warn when an if-else has identical branches. This warning detects cases like
6179 @smallexample
6180 if (p != NULL)
6181 return 0;
6182 else
6183 return 0;
6184 @end smallexample
6185 It doesn't warn when both branches contain just a null statement. This warning
6186 also warn for conditional operators:
6187 @smallexample
6188 int i = x ? *p : *p;
6189 @end smallexample
6190
6191 @item -Wduplicated-cond
6192 @opindex Wno-duplicated-cond
6193 @opindex Wduplicated-cond
6194 Warn about duplicated conditions in an if-else-if chain. For instance,
6195 warn for the following code:
6196 @smallexample
6197 if (p->q != NULL) @{ @dots{} @}
6198 else if (p->q != NULL) @{ @dots{} @}
6199 @end smallexample
6200
6201 @item -Wframe-address
6202 @opindex Wno-frame-address
6203 @opindex Wframe-address
6204 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6205 is called with an argument greater than 0. Such calls may return indeterminate
6206 values or crash the program. The warning is included in @option{-Wall}.
6207
6208 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6209 @opindex Wno-discarded-qualifiers
6210 @opindex Wdiscarded-qualifiers
6211 Do not warn if type qualifiers on pointers are being discarded.
6212 Typically, the compiler warns if a @code{const char *} variable is
6213 passed to a function that takes a @code{char *} parameter. This option
6214 can be used to suppress such a warning.
6215
6216 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6217 @opindex Wno-discarded-array-qualifiers
6218 @opindex Wdiscarded-array-qualifiers
6219 Do not warn if type qualifiers on arrays which are pointer targets
6220 are being discarded. Typically, the compiler warns if a
6221 @code{const int (*)[]} variable is passed to a function that
6222 takes a @code{int (*)[]} parameter. This option can be used to
6223 suppress such a warning.
6224
6225 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6226 @opindex Wno-incompatible-pointer-types
6227 @opindex Wincompatible-pointer-types
6228 Do not warn when there is a conversion between pointers that have incompatible
6229 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6230 which warns for pointer argument passing or assignment with different
6231 signedness.
6232
6233 @item -Wno-int-conversion @r{(C and Objective-C only)}
6234 @opindex Wno-int-conversion
6235 @opindex Wint-conversion
6236 Do not warn about incompatible integer to pointer and pointer to integer
6237 conversions. This warning is about implicit conversions; for explicit
6238 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6239 @option{-Wno-pointer-to-int-cast} may be used.
6240
6241 @item -Wno-div-by-zero
6242 @opindex Wno-div-by-zero
6243 @opindex Wdiv-by-zero
6244 Do not warn about compile-time integer division by zero. Floating-point
6245 division by zero is not warned about, as it can be a legitimate way of
6246 obtaining infinities and NaNs.
6247
6248 @item -Wsystem-headers
6249 @opindex Wsystem-headers
6250 @opindex Wno-system-headers
6251 @cindex warnings from system headers
6252 @cindex system headers, warnings from
6253 Print warning messages for constructs found in system header files.
6254 Warnings from system headers are normally suppressed, on the assumption
6255 that they usually do not indicate real problems and would only make the
6256 compiler output harder to read. Using this command-line option tells
6257 GCC to emit warnings from system headers as if they occurred in user
6258 code. However, note that using @option{-Wall} in conjunction with this
6259 option does @emph{not} warn about unknown pragmas in system
6260 headers---for that, @option{-Wunknown-pragmas} must also be used.
6261
6262 @item -Wtautological-compare
6263 @opindex Wtautological-compare
6264 @opindex Wno-tautological-compare
6265 Warn if a self-comparison always evaluates to true or false. This
6266 warning detects various mistakes such as:
6267 @smallexample
6268 int i = 1;
6269 @dots{}
6270 if (i > i) @{ @dots{} @}
6271 @end smallexample
6272
6273 This warning also warns about bitwise comparisons that always evaluate
6274 to true or false, for instance:
6275 @smallexample
6276 if ((a & 16) == 10) @{ @dots{} @}
6277 @end smallexample
6278 will always be false.
6279
6280 This warning is enabled by @option{-Wall}.
6281
6282 @item -Wtrampolines
6283 @opindex Wtrampolines
6284 @opindex Wno-trampolines
6285 Warn about trampolines generated for pointers to nested functions.
6286 A trampoline is a small piece of data or code that is created at run
6287 time on the stack when the address of a nested function is taken, and is
6288 used to call the nested function indirectly. For some targets, it is
6289 made up of data only and thus requires no special treatment. But, for
6290 most targets, it is made up of code and thus requires the stack to be
6291 made executable in order for the program to work properly.
6292
6293 @item -Wfloat-equal
6294 @opindex Wfloat-equal
6295 @opindex Wno-float-equal
6296 Warn if floating-point values are used in equality comparisons.
6297
6298 The idea behind this is that sometimes it is convenient (for the
6299 programmer) to consider floating-point values as approximations to
6300 infinitely precise real numbers. If you are doing this, then you need
6301 to compute (by analyzing the code, or in some other way) the maximum or
6302 likely maximum error that the computation introduces, and allow for it
6303 when performing comparisons (and when producing output, but that's a
6304 different problem). In particular, instead of testing for equality, you
6305 should check to see whether the two values have ranges that overlap; and
6306 this is done with the relational operators, so equality comparisons are
6307 probably mistaken.
6308
6309 @item -Wtraditional @r{(C and Objective-C only)}
6310 @opindex Wtraditional
6311 @opindex Wno-traditional
6312 Warn about certain constructs that behave differently in traditional and
6313 ISO C@. Also warn about ISO C constructs that have no traditional C
6314 equivalent, and/or problematic constructs that should be avoided.
6315
6316 @itemize @bullet
6317 @item
6318 Macro parameters that appear within string literals in the macro body.
6319 In traditional C macro replacement takes place within string literals,
6320 but in ISO C it does not.
6321
6322 @item
6323 In traditional C, some preprocessor directives did not exist.
6324 Traditional preprocessors only considered a line to be a directive
6325 if the @samp{#} appeared in column 1 on the line. Therefore
6326 @option{-Wtraditional} warns about directives that traditional C
6327 understands but ignores because the @samp{#} does not appear as the
6328 first character on the line. It also suggests you hide directives like
6329 @code{#pragma} not understood by traditional C by indenting them. Some
6330 traditional implementations do not recognize @code{#elif}, so this option
6331 suggests avoiding it altogether.
6332
6333 @item
6334 A function-like macro that appears without arguments.
6335
6336 @item
6337 The unary plus operator.
6338
6339 @item
6340 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6341 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6342 constants.) Note, these suffixes appear in macros defined in the system
6343 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6344 Use of these macros in user code might normally lead to spurious
6345 warnings, however GCC's integrated preprocessor has enough context to
6346 avoid warning in these cases.
6347
6348 @item
6349 A function declared external in one block and then used after the end of
6350 the block.
6351
6352 @item
6353 A @code{switch} statement has an operand of type @code{long}.
6354
6355 @item
6356 A non-@code{static} function declaration follows a @code{static} one.
6357 This construct is not accepted by some traditional C compilers.
6358
6359 @item
6360 The ISO type of an integer constant has a different width or
6361 signedness from its traditional type. This warning is only issued if
6362 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6363 typically represent bit patterns, are not warned about.
6364
6365 @item
6366 Usage of ISO string concatenation is detected.
6367
6368 @item
6369 Initialization of automatic aggregates.
6370
6371 @item
6372 Identifier conflicts with labels. Traditional C lacks a separate
6373 namespace for labels.
6374
6375 @item
6376 Initialization of unions. If the initializer is zero, the warning is
6377 omitted. This is done under the assumption that the zero initializer in
6378 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6379 initializer warnings and relies on default initialization to zero in the
6380 traditional C case.
6381
6382 @item
6383 Conversions by prototypes between fixed/floating-point values and vice
6384 versa. The absence of these prototypes when compiling with traditional
6385 C causes serious problems. This is a subset of the possible
6386 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6387
6388 @item
6389 Use of ISO C style function definitions. This warning intentionally is
6390 @emph{not} issued for prototype declarations or variadic functions
6391 because these ISO C features appear in your code when using
6392 libiberty's traditional C compatibility macros, @code{PARAMS} and
6393 @code{VPARAMS}. This warning is also bypassed for nested functions
6394 because that feature is already a GCC extension and thus not relevant to
6395 traditional C compatibility.
6396 @end itemize
6397
6398 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6399 @opindex Wtraditional-conversion
6400 @opindex Wno-traditional-conversion
6401 Warn if a prototype causes a type conversion that is different from what
6402 would happen to the same argument in the absence of a prototype. This
6403 includes conversions of fixed point to floating and vice versa, and
6404 conversions changing the width or signedness of a fixed-point argument
6405 except when the same as the default promotion.
6406
6407 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6408 @opindex Wdeclaration-after-statement
6409 @opindex Wno-declaration-after-statement
6410 Warn when a declaration is found after a statement in a block. This
6411 construct, known from C++, was introduced with ISO C99 and is by default
6412 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6413
6414 @item -Wshadow
6415 @opindex Wshadow
6416 @opindex Wno-shadow
6417 Warn whenever a local variable or type declaration shadows another
6418 variable, parameter, type, class member (in C++), or instance variable
6419 (in Objective-C) or whenever a built-in function is shadowed. Note
6420 that in C++, the compiler warns if a local variable shadows an
6421 explicit typedef, but not if it shadows a struct/class/enum.
6422 Same as @option{-Wshadow=global}.
6423
6424 @item -Wno-shadow-ivar @r{(Objective-C only)}
6425 @opindex Wno-shadow-ivar
6426 @opindex Wshadow-ivar
6427 Do not warn whenever a local variable shadows an instance variable in an
6428 Objective-C method.
6429
6430 @item -Wshadow=global
6431 @opindex Wshadow=local
6432 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6433
6434 @item -Wshadow=local
6435 @opindex Wshadow=local
6436 Warn when a local variable shadows another local variable or parameter.
6437 This warning is enabled by @option{-Wshadow=global}.
6438
6439 @item -Wshadow=compatible-local
6440 @opindex Wshadow=compatible-local
6441 Warn when a local variable shadows another local variable or parameter
6442 whose type is compatible with that of the shadowing variable. In C++,
6443 type compatibility here means the type of the shadowing variable can be
6444 converted to that of the shadowed variable. The creation of this flag
6445 (in addition to @option{-Wshadow=local}) is based on the idea that when
6446 a local variable shadows another one of incompatible type, it is most
6447 likely intentional, not a bug or typo, as shown in the following example:
6448
6449 @smallexample
6450 @group
6451 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6452 @{
6453 for (int i = 0; i < N; ++i)
6454 @{
6455 ...
6456 @}
6457 ...
6458 @}
6459 @end group
6460 @end smallexample
6461
6462 Since the two variable @code{i} in the example above have incompatible types,
6463 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6464 Because their types are incompatible, if a programmer accidentally uses one
6465 in place of the other, type checking will catch that and emit an error or
6466 warning. So not warning (about shadowing) in this case will not lead to
6467 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6468 possibly reduce the number of warnings triggered by intentional shadowing.
6469
6470 This warning is enabled by @option{-Wshadow=local}.
6471
6472 @item -Wlarger-than=@var{byte-size}
6473 @opindex Wlarger-than=
6474 @opindex Wlarger-than-@var{byte-size}
6475 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6476 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6477 Warnings controlled by the option can be disabled either by specifying
6478 @var{byte-size} of @samp{SIZE_MAX} or more or by
6479 @option{-Wno-larger-than}.
6480
6481 @item -Wno-larger-than
6482 @opindex Wno-larger-than
6483 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6484 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6485
6486 @item -Wframe-larger-than=@var{byte-size}
6487 @opindex Wframe-larger-than=
6488 @opindex Wno-frame-larger-than
6489 Warn if the size of a function frame exceeds @var{byte-size}.
6490 The computation done to determine the stack frame size is approximate
6491 and not conservative.
6492 The actual requirements may be somewhat greater than @var{byte-size}
6493 even if you do not get a warning. In addition, any space allocated
6494 via @code{alloca}, variable-length arrays, or related constructs
6495 is not included by the compiler when determining
6496 whether or not to issue a warning.
6497 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6498 Warnings controlled by the option can be disabled either by specifying
6499 @var{byte-size} of @samp{SIZE_MAX} or more or by
6500 @option{-Wno-frame-larger-than}.
6501
6502 @item -Wno-frame-larger-than
6503 @opindex Wno-frame-larger-than
6504 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6505 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6506
6507 @item -Wno-free-nonheap-object
6508 @opindex Wno-free-nonheap-object
6509 @opindex Wfree-nonheap-object
6510 Do not warn when attempting to free an object that was not allocated
6511 on the heap.
6512
6513 @item -Wstack-usage=@var{byte-size}
6514 @opindex Wstack-usage
6515 @opindex Wno-stack-usage
6516 Warn if the stack usage of a function might exceed @var{byte-size}.
6517 The computation done to determine the stack usage is conservative.
6518 Any space allocated via @code{alloca}, variable-length arrays, or related
6519 constructs is included by the compiler when determining whether or not to
6520 issue a warning.
6521
6522 The message is in keeping with the output of @option{-fstack-usage}.
6523
6524 @itemize
6525 @item
6526 If the stack usage is fully static but exceeds the specified amount, it's:
6527
6528 @smallexample
6529 warning: stack usage is 1120 bytes
6530 @end smallexample
6531 @item
6532 If the stack usage is (partly) dynamic but bounded, it's:
6533
6534 @smallexample
6535 warning: stack usage might be 1648 bytes
6536 @end smallexample
6537 @item
6538 If the stack usage is (partly) dynamic and not bounded, it's:
6539
6540 @smallexample
6541 warning: stack usage might be unbounded
6542 @end smallexample
6543 @end itemize
6544
6545 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6546 Warnings controlled by the option can be disabled either by specifying
6547 @var{byte-size} of @samp{SIZE_MAX} or more or by
6548 @option{-Wno-stack-usage}.
6549
6550 @item -Wno-stack-usage
6551 @opindex Wno-stack-usage
6552 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6553 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6554
6555 @item -Wunsafe-loop-optimizations
6556 @opindex Wunsafe-loop-optimizations
6557 @opindex Wno-unsafe-loop-optimizations
6558 Warn if the loop cannot be optimized because the compiler cannot
6559 assume anything on the bounds of the loop indices. With
6560 @option{-funsafe-loop-optimizations} warn if the compiler makes
6561 such assumptions.
6562
6563 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6564 @opindex Wno-pedantic-ms-format
6565 @opindex Wpedantic-ms-format
6566 When used in combination with @option{-Wformat}
6567 and @option{-pedantic} without GNU extensions, this option
6568 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6569 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6570 which depend on the MS runtime.
6571
6572 @item -Waligned-new
6573 @opindex Waligned-new
6574 @opindex Wno-aligned-new
6575 Warn about a new-expression of a type that requires greater alignment
6576 than the @code{alignof(std::max_align_t)} but uses an allocation
6577 function without an explicit alignment parameter. This option is
6578 enabled by @option{-Wall}.
6579
6580 Normally this only warns about global allocation functions, but
6581 @option{-Waligned-new=all} also warns about class member allocation
6582 functions.
6583
6584 @item -Wplacement-new
6585 @itemx -Wplacement-new=@var{n}
6586 @opindex Wplacement-new
6587 @opindex Wno-placement-new
6588 Warn about placement new expressions with undefined behavior, such as
6589 constructing an object in a buffer that is smaller than the type of
6590 the object. For example, the placement new expression below is diagnosed
6591 because it attempts to construct an array of 64 integers in a buffer only
6592 64 bytes large.
6593 @smallexample
6594 char buf [64];
6595 new (buf) int[64];
6596 @end smallexample
6597 This warning is enabled by default.
6598
6599 @table @gcctabopt
6600 @item -Wplacement-new=1
6601 This is the default warning level of @option{-Wplacement-new}. At this
6602 level the warning is not issued for some strictly undefined constructs that
6603 GCC allows as extensions for compatibility with legacy code. For example,
6604 the following @code{new} expression is not diagnosed at this level even
6605 though it has undefined behavior according to the C++ standard because
6606 it writes past the end of the one-element array.
6607 @smallexample
6608 struct S @{ int n, a[1]; @};
6609 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6610 new (s->a)int [32]();
6611 @end smallexample
6612
6613 @item -Wplacement-new=2
6614 At this level, in addition to diagnosing all the same constructs as at level
6615 1, a diagnostic is also issued for placement new expressions that construct
6616 an object in the last member of structure whose type is an array of a single
6617 element and whose size is less than the size of the object being constructed.
6618 While the previous example would be diagnosed, the following construct makes
6619 use of the flexible member array extension to avoid the warning at level 2.
6620 @smallexample
6621 struct S @{ int n, a[]; @};
6622 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6623 new (s->a)int [32]();
6624 @end smallexample
6625
6626 @end table
6627
6628 @item -Wpointer-arith
6629 @opindex Wpointer-arith
6630 @opindex Wno-pointer-arith
6631 Warn about anything that depends on the ``size of'' a function type or
6632 of @code{void}. GNU C assigns these types a size of 1, for
6633 convenience in calculations with @code{void *} pointers and pointers
6634 to functions. In C++, warn also when an arithmetic operation involves
6635 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6636
6637 @item -Wpointer-compare
6638 @opindex Wpointer-compare
6639 @opindex Wno-pointer-compare
6640 Warn if a pointer is compared with a zero character constant. This usually
6641 means that the pointer was meant to be dereferenced. For example:
6642
6643 @smallexample
6644 const char *p = foo ();
6645 if (p == '\0')
6646 return 42;
6647 @end smallexample
6648
6649 Note that the code above is invalid in C++11.
6650
6651 This warning is enabled by default.
6652
6653 @item -Wtype-limits
6654 @opindex Wtype-limits
6655 @opindex Wno-type-limits
6656 Warn if a comparison is always true or always false due to the limited
6657 range of the data type, but do not warn for constant expressions. For
6658 example, warn if an unsigned variable is compared against zero with
6659 @code{<} or @code{>=}. This warning is also enabled by
6660 @option{-Wextra}.
6661
6662 @item -Wabsolute-value @r{(C and Objective-C only)}
6663 @opindex Wabsolute-value
6664 @opindex Wno-absolute-value
6665 Warn for calls to standard functions that compute the absolute value
6666 of an argument when a more appropriate standard function is available.
6667 For example, calling @code{abs(3.14)} triggers the warning because the
6668 appropriate function to call to compute the absolute value of a double
6669 argument is @code{fabs}. The option also triggers warnings when the
6670 argument in a call to such a function has an unsigned type. This
6671 warning can be suppressed with an explicit type cast and it is also
6672 enabled by @option{-Wextra}.
6673
6674 @include cppwarnopts.texi
6675
6676 @item -Wbad-function-cast @r{(C and Objective-C only)}
6677 @opindex Wbad-function-cast
6678 @opindex Wno-bad-function-cast
6679 Warn when a function call is cast to a non-matching type.
6680 For example, warn if a call to a function returning an integer type
6681 is cast to a pointer type.
6682
6683 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6684 @opindex Wc90-c99-compat
6685 @opindex Wno-c90-c99-compat
6686 Warn about features not present in ISO C90, but present in ISO C99.
6687 For instance, warn about use of variable length arrays, @code{long long}
6688 type, @code{bool} type, compound literals, designated initializers, and so
6689 on. This option is independent of the standards mode. Warnings are disabled
6690 in the expression that follows @code{__extension__}.
6691
6692 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6693 @opindex Wc99-c11-compat
6694 @opindex Wno-c99-c11-compat
6695 Warn about features not present in ISO C99, but present in ISO C11.
6696 For instance, warn about use of anonymous structures and unions,
6697 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6698 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6699 and so on. This option is independent of the standards mode. Warnings are
6700 disabled in the expression that follows @code{__extension__}.
6701
6702 @item -Wc++-compat @r{(C and Objective-C only)}
6703 @opindex Wc++-compat
6704 @opindex Wno-c++-compat
6705 Warn about ISO C constructs that are outside of the common subset of
6706 ISO C and ISO C++, e.g.@: request for implicit conversion from
6707 @code{void *} to a pointer to non-@code{void} type.
6708
6709 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6710 @opindex Wc++11-compat
6711 @opindex Wno-c++11-compat
6712 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6713 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6714 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6715 enabled by @option{-Wall}.
6716
6717 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6718 @opindex Wc++14-compat
6719 @opindex Wno-c++14-compat
6720 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6721 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6722
6723 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6724 @opindex Wc++17-compat
6725 @opindex Wno-c++17-compat
6726 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6727 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6728
6729 @item -Wcast-qual
6730 @opindex Wcast-qual
6731 @opindex Wno-cast-qual
6732 Warn whenever a pointer is cast so as to remove a type qualifier from
6733 the target type. For example, warn if a @code{const char *} is cast
6734 to an ordinary @code{char *}.
6735
6736 Also warn when making a cast that introduces a type qualifier in an
6737 unsafe way. For example, casting @code{char **} to @code{const char **}
6738 is unsafe, as in this example:
6739
6740 @smallexample
6741 /* p is char ** value. */
6742 const char **q = (const char **) p;
6743 /* Assignment of readonly string to const char * is OK. */
6744 *q = "string";
6745 /* Now char** pointer points to read-only memory. */
6746 **p = 'b';
6747 @end smallexample
6748
6749 @item -Wcast-align
6750 @opindex Wcast-align
6751 @opindex Wno-cast-align
6752 Warn whenever a pointer is cast such that the required alignment of the
6753 target is increased. For example, warn if a @code{char *} is cast to
6754 an @code{int *} on machines where integers can only be accessed at
6755 two- or four-byte boundaries.
6756
6757 @item -Wcast-align=strict
6758 @opindex Wcast-align=strict
6759 Warn whenever a pointer is cast such that the required alignment of the
6760 target is increased. For example, warn if a @code{char *} is cast to
6761 an @code{int *} regardless of the target machine.
6762
6763 @item -Wcast-function-type
6764 @opindex Wcast-function-type
6765 @opindex Wno-cast-function-type
6766 Warn when a function pointer is cast to an incompatible function pointer.
6767 In a cast involving function types with a variable argument list only
6768 the types of initial arguments that are provided are considered.
6769 Any parameter of pointer-type matches any other pointer-type. Any benign
6770 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6771 on ILP32 targets. Likewise type qualifiers are ignored. The function
6772 type @code{void (*) (void)} is special and matches everything, which can
6773 be used to suppress this warning.
6774 In a cast involving pointer to member types this warning warns whenever
6775 the type cast is changing the pointer to member type.
6776 This warning is enabled by @option{-Wextra}.
6777
6778 @item -Wwrite-strings
6779 @opindex Wwrite-strings
6780 @opindex Wno-write-strings
6781 When compiling C, give string constants the type @code{const
6782 char[@var{length}]} so that copying the address of one into a
6783 non-@code{const} @code{char *} pointer produces a warning. These
6784 warnings help you find at compile time code that can try to write
6785 into a string constant, but only if you have been very careful about
6786 using @code{const} in declarations and prototypes. Otherwise, it is
6787 just a nuisance. This is why we did not make @option{-Wall} request
6788 these warnings.
6789
6790 When compiling C++, warn about the deprecated conversion from string
6791 literals to @code{char *}. This warning is enabled by default for C++
6792 programs.
6793
6794 @item -Wcatch-value
6795 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6796 @opindex Wcatch-value
6797 @opindex Wno-catch-value
6798 Warn about catch handlers that do not catch via reference.
6799 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6800 warn about polymorphic class types that are caught by value.
6801 With @option{-Wcatch-value=2} warn about all class types that are caught
6802 by value. With @option{-Wcatch-value=3} warn about all types that are
6803 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6804
6805 @item -Wclobbered
6806 @opindex Wclobbered
6807 @opindex Wno-clobbered
6808 Warn for variables that might be changed by @code{longjmp} or
6809 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6810
6811 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6812 @opindex Wconditionally-supported
6813 @opindex Wno-conditionally-supported
6814 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6815
6816 @item -Wconversion
6817 @opindex Wconversion
6818 @opindex Wno-conversion
6819 Warn for implicit conversions that may alter a value. This includes
6820 conversions between real and integer, like @code{abs (x)} when
6821 @code{x} is @code{double}; conversions between signed and unsigned,
6822 like @code{unsigned ui = -1}; and conversions to smaller types, like
6823 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6824 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6825 changed by the conversion like in @code{abs (2.0)}. Warnings about
6826 conversions between signed and unsigned integers can be disabled by
6827 using @option{-Wno-sign-conversion}.
6828
6829 For C++, also warn for confusing overload resolution for user-defined
6830 conversions; and conversions that never use a type conversion
6831 operator: conversions to @code{void}, the same type, a base class or a
6832 reference to them. Warnings about conversions between signed and
6833 unsigned integers are disabled by default in C++ unless
6834 @option{-Wsign-conversion} is explicitly enabled.
6835
6836 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6837 @opindex Wconversion-null
6838 @opindex Wno-conversion-null
6839 Do not warn for conversions between @code{NULL} and non-pointer
6840 types. @option{-Wconversion-null} is enabled by default.
6841
6842 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6843 @opindex Wzero-as-null-pointer-constant
6844 @opindex Wno-zero-as-null-pointer-constant
6845 Warn when a literal @samp{0} is used as null pointer constant. This can
6846 be useful to facilitate the conversion to @code{nullptr} in C++11.
6847
6848 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6849 @opindex Wsubobject-linkage
6850 @opindex Wno-subobject-linkage
6851 Warn if a class type has a base or a field whose type uses the anonymous
6852 namespace or depends on a type with no linkage. If a type A depends on
6853 a type B with no or internal linkage, defining it in multiple
6854 translation units would be an ODR violation because the meaning of B
6855 is different in each translation unit. If A only appears in a single
6856 translation unit, the best way to silence the warning is to give it
6857 internal linkage by putting it in an anonymous namespace as well. The
6858 compiler doesn't give this warning for types defined in the main .C
6859 file, as those are unlikely to have multiple definitions.
6860 @option{-Wsubobject-linkage} is enabled by default.
6861
6862 @item -Wdangling-else
6863 @opindex Wdangling-else
6864 @opindex Wno-dangling-else
6865 Warn about constructions where there may be confusion to which
6866 @code{if} statement an @code{else} branch belongs. Here is an example of
6867 such a case:
6868
6869 @smallexample
6870 @group
6871 @{
6872 if (a)
6873 if (b)
6874 foo ();
6875 else
6876 bar ();
6877 @}
6878 @end group
6879 @end smallexample
6880
6881 In C/C++, every @code{else} branch belongs to the innermost possible
6882 @code{if} statement, which in this example is @code{if (b)}. This is
6883 often not what the programmer expected, as illustrated in the above
6884 example by indentation the programmer chose. When there is the
6885 potential for this confusion, GCC issues a warning when this flag
6886 is specified. To eliminate the warning, add explicit braces around
6887 the innermost @code{if} statement so there is no way the @code{else}
6888 can belong to the enclosing @code{if}. The resulting code
6889 looks like this:
6890
6891 @smallexample
6892 @group
6893 @{
6894 if (a)
6895 @{
6896 if (b)
6897 foo ();
6898 else
6899 bar ();
6900 @}
6901 @}
6902 @end group
6903 @end smallexample
6904
6905 This warning is enabled by @option{-Wparentheses}.
6906
6907 @item -Wdate-time
6908 @opindex Wdate-time
6909 @opindex Wno-date-time
6910 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6911 are encountered as they might prevent bit-wise-identical reproducible
6912 compilations.
6913
6914 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6915 @opindex Wdelete-incomplete
6916 @opindex Wno-delete-incomplete
6917 Warn when deleting a pointer to incomplete type, which may cause
6918 undefined behavior at runtime. This warning is enabled by default.
6919
6920 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6921 @opindex Wuseless-cast
6922 @opindex Wno-useless-cast
6923 Warn when an expression is casted to its own type.
6924
6925 @item -Wempty-body
6926 @opindex Wempty-body
6927 @opindex Wno-empty-body
6928 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6929 while} statement. This warning is also enabled by @option{-Wextra}.
6930
6931 @item -Wenum-compare
6932 @opindex Wenum-compare
6933 @opindex Wno-enum-compare
6934 Warn about a comparison between values of different enumerated types.
6935 In C++ enumerated type mismatches in conditional expressions are also
6936 diagnosed and the warning is enabled by default. In C this warning is
6937 enabled by @option{-Wall}.
6938
6939 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6940 @opindex Wextra-semi
6941 @opindex Wno-extra-semi
6942 Warn about redundant semicolon after in-class function definition.
6943
6944 @item -Wjump-misses-init @r{(C, Objective-C only)}
6945 @opindex Wjump-misses-init
6946 @opindex Wno-jump-misses-init
6947 Warn if a @code{goto} statement or a @code{switch} statement jumps
6948 forward across the initialization of a variable, or jumps backward to a
6949 label after the variable has been initialized. This only warns about
6950 variables that are initialized when they are declared. This warning is
6951 only supported for C and Objective-C; in C++ this sort of branch is an
6952 error in any case.
6953
6954 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6955 can be disabled with the @option{-Wno-jump-misses-init} option.
6956
6957 @item -Wsign-compare
6958 @opindex Wsign-compare
6959 @opindex Wno-sign-compare
6960 @cindex warning for comparison of signed and unsigned values
6961 @cindex comparison of signed and unsigned values, warning
6962 @cindex signed and unsigned values, comparison warning
6963 Warn when a comparison between signed and unsigned values could produce
6964 an incorrect result when the signed value is converted to unsigned.
6965 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6966 also enabled by @option{-Wextra}.
6967
6968 @item -Wsign-conversion
6969 @opindex Wsign-conversion
6970 @opindex Wno-sign-conversion
6971 Warn for implicit conversions that may change the sign of an integer
6972 value, like assigning a signed integer expression to an unsigned
6973 integer variable. An explicit cast silences the warning. In C, this
6974 option is enabled also by @option{-Wconversion}.
6975
6976 @item -Wfloat-conversion
6977 @opindex Wfloat-conversion
6978 @opindex Wno-float-conversion
6979 Warn for implicit conversions that reduce the precision of a real value.
6980 This includes conversions from real to integer, and from higher precision
6981 real to lower precision real values. This option is also enabled by
6982 @option{-Wconversion}.
6983
6984 @item -Wno-scalar-storage-order
6985 @opindex Wno-scalar-storage-order
6986 @opindex Wscalar-storage-order
6987 Do not warn on suspicious constructs involving reverse scalar storage order.
6988
6989 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6990 @opindex Wsized-deallocation
6991 @opindex Wno-sized-deallocation
6992 Warn about a definition of an unsized deallocation function
6993 @smallexample
6994 void operator delete (void *) noexcept;
6995 void operator delete[] (void *) noexcept;
6996 @end smallexample
6997 without a definition of the corresponding sized deallocation function
6998 @smallexample
6999 void operator delete (void *, std::size_t) noexcept;
7000 void operator delete[] (void *, std::size_t) noexcept;
7001 @end smallexample
7002 or vice versa. Enabled by @option{-Wextra} along with
7003 @option{-fsized-deallocation}.
7004
7005 @item -Wsizeof-pointer-div
7006 @opindex Wsizeof-pointer-div
7007 @opindex Wno-sizeof-pointer-div
7008 Warn for suspicious divisions of two sizeof expressions that divide
7009 the pointer size by the element size, which is the usual way to compute
7010 the array size but won't work out correctly with pointers. This warning
7011 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7012 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7013
7014 @item -Wsizeof-pointer-memaccess
7015 @opindex Wsizeof-pointer-memaccess
7016 @opindex Wno-sizeof-pointer-memaccess
7017 Warn for suspicious length parameters to certain string and memory built-in
7018 functions if the argument uses @code{sizeof}. This warning triggers for
7019 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7020 an array, but a pointer, and suggests a possible fix, or about
7021 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7022 also warns about calls to bounded string copy functions like @code{strncat}
7023 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7024 the source array. For example, in the following function the call to
7025 @code{strncat} specifies the size of the source string as the bound. That
7026 is almost certainly a mistake and so the call is diagnosed.
7027 @smallexample
7028 void make_file (const char *name)
7029 @{
7030 char path[PATH_MAX];
7031 strncpy (path, name, sizeof path - 1);
7032 strncat (path, ".text", sizeof ".text");
7033 @dots{}
7034 @}
7035 @end smallexample
7036
7037 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7038
7039 @item -Wsizeof-array-argument
7040 @opindex Wsizeof-array-argument
7041 @opindex Wno-sizeof-array-argument
7042 Warn when the @code{sizeof} operator is applied to a parameter that is
7043 declared as an array in a function definition. This warning is enabled by
7044 default for C and C++ programs.
7045
7046 @item -Wmemset-elt-size
7047 @opindex Wmemset-elt-size
7048 @opindex Wno-memset-elt-size
7049 Warn for suspicious calls to the @code{memset} built-in function, if the
7050 first argument references an array, and the third argument is a number
7051 equal to the number of elements, but not equal to the size of the array
7052 in memory. This indicates that the user has omitted a multiplication by
7053 the element size. This warning is enabled by @option{-Wall}.
7054
7055 @item -Wmemset-transposed-args
7056 @opindex Wmemset-transposed-args
7057 @opindex Wno-memset-transposed-args
7058 Warn for suspicious calls to the @code{memset} built-in function where
7059 the second argument is not zero and the third argument is zero. For
7060 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7061 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7062 is only emitted if the third argument is a literal zero. Otherwise, if
7063 it is an expression that is folded to zero, or a cast of zero to some
7064 type, it is far less likely that the arguments have been mistakenly
7065 transposed and no warning is emitted. This warning is enabled
7066 by @option{-Wall}.
7067
7068 @item -Waddress
7069 @opindex Waddress
7070 @opindex Wno-address
7071 Warn about suspicious uses of memory addresses. These include using
7072 the address of a function in a conditional expression, such as
7073 @code{void func(void); if (func)}, and comparisons against the memory
7074 address of a string literal, such as @code{if (x == "abc")}. Such
7075 uses typically indicate a programmer error: the address of a function
7076 always evaluates to true, so their use in a conditional usually
7077 indicate that the programmer forgot the parentheses in a function
7078 call; and comparisons against string literals result in unspecified
7079 behavior and are not portable in C, so they usually indicate that the
7080 programmer intended to use @code{strcmp}. This warning is enabled by
7081 @option{-Wall}.
7082
7083 @item -Waddress-of-packed-member
7084 @opindex Waddress-of-packed-member
7085 @opindex Wno-address-of-packed-member
7086 Warn when the address of packed member of struct or union is taken,
7087 which usually results in an unaligned pointer value. This is
7088 enabled by default.
7089
7090 @item -Wlogical-op
7091 @opindex Wlogical-op
7092 @opindex Wno-logical-op
7093 Warn about suspicious uses of logical operators in expressions.
7094 This includes using logical operators in contexts where a
7095 bit-wise operator is likely to be expected. Also warns when
7096 the operands of a logical operator are the same:
7097 @smallexample
7098 extern int a;
7099 if (a < 0 && a < 0) @{ @dots{} @}
7100 @end smallexample
7101
7102 @item -Wlogical-not-parentheses
7103 @opindex Wlogical-not-parentheses
7104 @opindex Wno-logical-not-parentheses
7105 Warn about logical not used on the left hand side operand of a comparison.
7106 This option does not warn if the right operand is considered to be a boolean
7107 expression. Its purpose is to detect suspicious code like the following:
7108 @smallexample
7109 int a;
7110 @dots{}
7111 if (!a > 1) @{ @dots{} @}
7112 @end smallexample
7113
7114 It is possible to suppress the warning by wrapping the LHS into
7115 parentheses:
7116 @smallexample
7117 if ((!a) > 1) @{ @dots{} @}
7118 @end smallexample
7119
7120 This warning is enabled by @option{-Wall}.
7121
7122 @item -Waggregate-return
7123 @opindex Waggregate-return
7124 @opindex Wno-aggregate-return
7125 Warn if any functions that return structures or unions are defined or
7126 called. (In languages where you can return an array, this also elicits
7127 a warning.)
7128
7129 @item -Wno-aggressive-loop-optimizations
7130 @opindex Wno-aggressive-loop-optimizations
7131 @opindex Waggressive-loop-optimizations
7132 Warn if in a loop with constant number of iterations the compiler detects
7133 undefined behavior in some statement during one or more of the iterations.
7134
7135 @item -Wno-attributes
7136 @opindex Wno-attributes
7137 @opindex Wattributes
7138 Do not warn if an unexpected @code{__attribute__} is used, such as
7139 unrecognized attributes, function attributes applied to variables,
7140 etc. This does not stop errors for incorrect use of supported
7141 attributes.
7142
7143 @item -Wno-builtin-declaration-mismatch
7144 @opindex Wno-builtin-declaration-mismatch
7145 @opindex Wbuiltin-declaration-mismatch
7146 Warn if a built-in function is declared with an incompatible signature
7147 or as a non-function, or when a built-in function declared with a type
7148 that does not include a prototype is called with arguments whose promoted
7149 types do not match those expected by the function. When @option{-Wextra}
7150 is specified, also warn when a built-in function that takes arguments is
7151 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7152 warning is enabled by default. To avoid the warning include the appropriate
7153 header to bring the prototypes of built-in functions into scope.
7154
7155 For example, the call to @code{memset} below is diagnosed by the warning
7156 because the function expects a value of type @code{size_t} as its argument
7157 but the type of @code{32} is @code{int}. With @option{-Wextra},
7158 the declaration of the function is diagnosed as well.
7159 @smallexample
7160 extern void* memset ();
7161 void f (void *d)
7162 @{
7163 memset (d, '\0', 32);
7164 @}
7165 @end smallexample
7166
7167 @item -Wno-builtin-macro-redefined
7168 @opindex Wno-builtin-macro-redefined
7169 @opindex Wbuiltin-macro-redefined
7170 Do not warn if certain built-in macros are redefined. This suppresses
7171 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7172 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7173
7174 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7175 @opindex Wstrict-prototypes
7176 @opindex Wno-strict-prototypes
7177 Warn if a function is declared or defined without specifying the
7178 argument types. (An old-style function definition is permitted without
7179 a warning if preceded by a declaration that specifies the argument
7180 types.)
7181
7182 @item -Wold-style-declaration @r{(C and Objective-C only)}
7183 @opindex Wold-style-declaration
7184 @opindex Wno-old-style-declaration
7185 Warn for obsolescent usages, according to the C Standard, in a
7186 declaration. For example, warn if storage-class specifiers like
7187 @code{static} are not the first things in a declaration. This warning
7188 is also enabled by @option{-Wextra}.
7189
7190 @item -Wold-style-definition @r{(C and Objective-C only)}
7191 @opindex Wold-style-definition
7192 @opindex Wno-old-style-definition
7193 Warn if an old-style function definition is used. A warning is given
7194 even if there is a previous prototype.
7195
7196 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7197 @opindex Wmissing-parameter-type
7198 @opindex Wno-missing-parameter-type
7199 A function parameter is declared without a type specifier in K&R-style
7200 functions:
7201
7202 @smallexample
7203 void foo(bar) @{ @}
7204 @end smallexample
7205
7206 This warning is also enabled by @option{-Wextra}.
7207
7208 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7209 @opindex Wmissing-prototypes
7210 @opindex Wno-missing-prototypes
7211 Warn if a global function is defined without a previous prototype
7212 declaration. This warning is issued even if the definition itself
7213 provides a prototype. Use this option to detect global functions
7214 that do not have a matching prototype declaration in a header file.
7215 This option is not valid for C++ because all function declarations
7216 provide prototypes and a non-matching declaration declares an
7217 overload rather than conflict with an earlier declaration.
7218 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7219
7220 @item -Wmissing-declarations
7221 @opindex Wmissing-declarations
7222 @opindex Wno-missing-declarations
7223 Warn if a global function is defined without a previous declaration.
7224 Do so even if the definition itself provides a prototype.
7225 Use this option to detect global functions that are not declared in
7226 header files. In C, no warnings are issued for functions with previous
7227 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7228 missing prototypes. In C++, no warnings are issued for function templates,
7229 or for inline functions, or for functions in anonymous namespaces.
7230
7231 @item -Wmissing-field-initializers
7232 @opindex Wmissing-field-initializers
7233 @opindex Wno-missing-field-initializers
7234 @opindex W
7235 @opindex Wextra
7236 @opindex Wno-extra
7237 Warn if a structure's initializer has some fields missing. For
7238 example, the following code causes such a warning, because
7239 @code{x.h} is implicitly zero:
7240
7241 @smallexample
7242 struct s @{ int f, g, h; @};
7243 struct s x = @{ 3, 4 @};
7244 @end smallexample
7245
7246 This option does not warn about designated initializers, so the following
7247 modification does not trigger a warning:
7248
7249 @smallexample
7250 struct s @{ int f, g, h; @};
7251 struct s x = @{ .f = 3, .g = 4 @};
7252 @end smallexample
7253
7254 In C this option does not warn about the universal zero initializer
7255 @samp{@{ 0 @}}:
7256
7257 @smallexample
7258 struct s @{ int f, g, h; @};
7259 struct s x = @{ 0 @};
7260 @end smallexample
7261
7262 Likewise, in C++ this option does not warn about the empty @{ @}
7263 initializer, for example:
7264
7265 @smallexample
7266 struct s @{ int f, g, h; @};
7267 s x = @{ @};
7268 @end smallexample
7269
7270 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7271 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7272
7273 @item -Wno-multichar
7274 @opindex Wno-multichar
7275 @opindex Wmultichar
7276 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7277 Usually they indicate a typo in the user's code, as they have
7278 implementation-defined values, and should not be used in portable code.
7279
7280 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7281 @opindex Wnormalized=
7282 @opindex Wnormalized
7283 @opindex Wno-normalized
7284 @cindex NFC
7285 @cindex NFKC
7286 @cindex character set, input normalization
7287 In ISO C and ISO C++, two identifiers are different if they are
7288 different sequences of characters. However, sometimes when characters
7289 outside the basic ASCII character set are used, you can have two
7290 different character sequences that look the same. To avoid confusion,
7291 the ISO 10646 standard sets out some @dfn{normalization rules} which
7292 when applied ensure that two sequences that look the same are turned into
7293 the same sequence. GCC can warn you if you are using identifiers that
7294 have not been normalized; this option controls that warning.
7295
7296 There are four levels of warning supported by GCC@. The default is
7297 @option{-Wnormalized=nfc}, which warns about any identifier that is
7298 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7299 recommended form for most uses. It is equivalent to
7300 @option{-Wnormalized}.
7301
7302 Unfortunately, there are some characters allowed in identifiers by
7303 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7304 identifiers. That is, there's no way to use these symbols in portable
7305 ISO C or C++ and have all your identifiers in NFC@.
7306 @option{-Wnormalized=id} suppresses the warning for these characters.
7307 It is hoped that future versions of the standards involved will correct
7308 this, which is why this option is not the default.
7309
7310 You can switch the warning off for all characters by writing
7311 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7312 only do this if you are using some other normalization scheme (like
7313 ``D''), because otherwise you can easily create bugs that are
7314 literally impossible to see.
7315
7316 Some characters in ISO 10646 have distinct meanings but look identical
7317 in some fonts or display methodologies, especially once formatting has
7318 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7319 LETTER N'', displays just like a regular @code{n} that has been
7320 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7321 normalization scheme to convert all these into a standard form as
7322 well, and GCC warns if your code is not in NFKC if you use
7323 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7324 about every identifier that contains the letter O because it might be
7325 confused with the digit 0, and so is not the default, but may be
7326 useful as a local coding convention if the programming environment
7327 cannot be fixed to display these characters distinctly.
7328
7329 @item -Wno-attribute-warning
7330 @opindex Wno-attribute-warning
7331 @opindex Wattribute-warning
7332 Do not warn about usage of functions (@pxref{Function Attributes})
7333 declared with @code{warning} attribute. By default, this warning is
7334 enabled. @option{-Wno-attribute-warning} can be used to disable the
7335 warning or @option{-Wno-error=attribute-warning} can be used to
7336 disable the error when compiled with @option{-Werror} flag.
7337
7338 @item -Wno-deprecated
7339 @opindex Wno-deprecated
7340 @opindex Wdeprecated
7341 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7342
7343 @item -Wno-deprecated-declarations
7344 @opindex Wno-deprecated-declarations
7345 @opindex Wdeprecated-declarations
7346 Do not warn about uses of functions (@pxref{Function Attributes}),
7347 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7348 Attributes}) marked as deprecated by using the @code{deprecated}
7349 attribute.
7350
7351 @item -Wno-overflow
7352 @opindex Wno-overflow
7353 @opindex Woverflow
7354 Do not warn about compile-time overflow in constant expressions.
7355
7356 @item -Wno-odr
7357 @opindex Wno-odr
7358 @opindex Wodr
7359 Warn about One Definition Rule violations during link-time optimization.
7360 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7361
7362 @item -Wopenmp-simd
7363 @opindex Wopenmp-simd
7364 @opindex Wno-openmp-simd
7365 Warn if the vectorizer cost model overrides the OpenMP
7366 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7367 option can be used to relax the cost model.
7368
7369 @item -Woverride-init @r{(C and Objective-C only)}
7370 @opindex Woverride-init
7371 @opindex Wno-override-init
7372 @opindex W
7373 @opindex Wextra
7374 @opindex Wno-extra
7375 Warn if an initialized field without side effects is overridden when
7376 using designated initializers (@pxref{Designated Inits, , Designated
7377 Initializers}).
7378
7379 This warning is included in @option{-Wextra}. To get other
7380 @option{-Wextra} warnings without this one, use @option{-Wextra
7381 -Wno-override-init}.
7382
7383 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7384 @opindex Woverride-init-side-effects
7385 @opindex Wno-override-init-side-effects
7386 Warn if an initialized field with side effects is overridden when
7387 using designated initializers (@pxref{Designated Inits, , Designated
7388 Initializers}). This warning is enabled by default.
7389
7390 @item -Wpacked
7391 @opindex Wpacked
7392 @opindex Wno-packed
7393 Warn if a structure is given the packed attribute, but the packed
7394 attribute has no effect on the layout or size of the structure.
7395 Such structures may be mis-aligned for little benefit. For
7396 instance, in this code, the variable @code{f.x} in @code{struct bar}
7397 is misaligned even though @code{struct bar} does not itself
7398 have the packed attribute:
7399
7400 @smallexample
7401 @group
7402 struct foo @{
7403 int x;
7404 char a, b, c, d;
7405 @} __attribute__((packed));
7406 struct bar @{
7407 char z;
7408 struct foo f;
7409 @};
7410 @end group
7411 @end smallexample
7412
7413 @item -Wpacked-bitfield-compat
7414 @opindex Wpacked-bitfield-compat
7415 @opindex Wno-packed-bitfield-compat
7416 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7417 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7418 the change can lead to differences in the structure layout. GCC
7419 informs you when the offset of such a field has changed in GCC 4.4.
7420 For example there is no longer a 4-bit padding between field @code{a}
7421 and @code{b} in this structure:
7422
7423 @smallexample
7424 struct foo
7425 @{
7426 char a:4;
7427 char b:8;
7428 @} __attribute__ ((packed));
7429 @end smallexample
7430
7431 This warning is enabled by default. Use
7432 @option{-Wno-packed-bitfield-compat} to disable this warning.
7433
7434 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7435 @opindex Wpacked-not-aligned
7436 @opindex Wno-packed-not-aligned
7437 Warn if a structure field with explicitly specified alignment in a
7438 packed struct or union is misaligned. For example, a warning will
7439 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7440 'struct S' is less than 8}, in this code:
7441
7442 @smallexample
7443 @group
7444 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7445 struct __attribute__ ((packed)) S @{
7446 struct S8 s8;
7447 @};
7448 @end group
7449 @end smallexample
7450
7451 This warning is enabled by @option{-Wall}.
7452
7453 @item -Wpadded
7454 @opindex Wpadded
7455 @opindex Wno-padded
7456 Warn if padding is included in a structure, either to align an element
7457 of the structure or to align the whole structure. Sometimes when this
7458 happens it is possible to rearrange the fields of the structure to
7459 reduce the padding and so make the structure smaller.
7460
7461 @item -Wredundant-decls
7462 @opindex Wredundant-decls
7463 @opindex Wno-redundant-decls
7464 Warn if anything is declared more than once in the same scope, even in
7465 cases where multiple declaration is valid and changes nothing.
7466
7467 @item -Wno-restrict
7468 @opindex Wrestrict
7469 @opindex Wno-restrict
7470 Warn when an object referenced by a @code{restrict}-qualified parameter
7471 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7472 argument, or when copies between such objects overlap. For example,
7473 the call to the @code{strcpy} function below attempts to truncate the string
7474 by replacing its initial characters with the last four. However, because
7475 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7476 the call is diagnosed.
7477
7478 @smallexample
7479 void foo (void)
7480 @{
7481 char a[] = "abcd1234";
7482 strcpy (a, a + 4);
7483 @dots{}
7484 @}
7485 @end smallexample
7486 The @option{-Wrestrict} option detects some instances of simple overlap
7487 even without optimization but works best at @option{-O2} and above. It
7488 is included in @option{-Wall}.
7489
7490 @item -Wnested-externs @r{(C and Objective-C only)}
7491 @opindex Wnested-externs
7492 @opindex Wno-nested-externs
7493 Warn if an @code{extern} declaration is encountered within a function.
7494
7495 @item -Wno-inherited-variadic-ctor
7496 @opindex Winherited-variadic-ctor
7497 @opindex Wno-inherited-variadic-ctor
7498 Suppress warnings about use of C++11 inheriting constructors when the
7499 base class inherited from has a C variadic constructor; the warning is
7500 on by default because the ellipsis is not inherited.
7501
7502 @item -Winline
7503 @opindex Winline
7504 @opindex Wno-inline
7505 Warn if a function that is declared as inline cannot be inlined.
7506 Even with this option, the compiler does not warn about failures to
7507 inline functions declared in system headers.
7508
7509 The compiler uses a variety of heuristics to determine whether or not
7510 to inline a function. For example, the compiler takes into account
7511 the size of the function being inlined and the amount of inlining
7512 that has already been done in the current function. Therefore,
7513 seemingly insignificant changes in the source program can cause the
7514 warnings produced by @option{-Winline} to appear or disappear.
7515
7516 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7517 @opindex Wno-invalid-offsetof
7518 @opindex Winvalid-offsetof
7519 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7520 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7521 to a non-standard-layout type is undefined. In existing C++ implementations,
7522 however, @code{offsetof} typically gives meaningful results.
7523 This flag is for users who are aware that they are
7524 writing nonportable code and who have deliberately chosen to ignore the
7525 warning about it.
7526
7527 The restrictions on @code{offsetof} may be relaxed in a future version
7528 of the C++ standard.
7529
7530 @item -Wint-in-bool-context
7531 @opindex Wint-in-bool-context
7532 @opindex Wno-int-in-bool-context
7533 Warn for suspicious use of integer values where boolean values are expected,
7534 such as conditional expressions (?:) using non-boolean integer constants in
7535 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7536 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7537 for all kinds of multiplications regardless of the data type.
7538 This warning is enabled by @option{-Wall}.
7539
7540 @item -Wno-int-to-pointer-cast
7541 @opindex Wno-int-to-pointer-cast
7542 @opindex Wint-to-pointer-cast
7543 Suppress warnings from casts to pointer type of an integer of a
7544 different size. In C++, casting to a pointer type of smaller size is
7545 an error. @option{Wint-to-pointer-cast} is enabled by default.
7546
7547
7548 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7549 @opindex Wno-pointer-to-int-cast
7550 @opindex Wpointer-to-int-cast
7551 Suppress warnings from casts from a pointer to an integer type of a
7552 different size.
7553
7554 @item -Winvalid-pch
7555 @opindex Winvalid-pch
7556 @opindex Wno-invalid-pch
7557 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7558 the search path but cannot be used.
7559
7560 @item -Wlong-long
7561 @opindex Wlong-long
7562 @opindex Wno-long-long
7563 Warn if @code{long long} type is used. This is enabled by either
7564 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7565 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7566
7567 @item -Wvariadic-macros
7568 @opindex Wvariadic-macros
7569 @opindex Wno-variadic-macros
7570 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7571 alternate syntax is used in ISO C99 mode. This is enabled by either
7572 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7573 messages, use @option{-Wno-variadic-macros}.
7574
7575 @item -Wvarargs
7576 @opindex Wvarargs
7577 @opindex Wno-varargs
7578 Warn upon questionable usage of the macros used to handle variable
7579 arguments like @code{va_start}. This is default. To inhibit the
7580 warning messages, use @option{-Wno-varargs}.
7581
7582 @item -Wvector-operation-performance
7583 @opindex Wvector-operation-performance
7584 @opindex Wno-vector-operation-performance
7585 Warn if vector operation is not implemented via SIMD capabilities of the
7586 architecture. Mainly useful for the performance tuning.
7587 Vector operation can be implemented @code{piecewise}, which means that the
7588 scalar operation is performed on every vector element;
7589 @code{in parallel}, which means that the vector operation is implemented
7590 using scalars of wider type, which normally is more performance efficient;
7591 and @code{as a single scalar}, which means that vector fits into a
7592 scalar type.
7593
7594 @item -Wno-virtual-move-assign
7595 @opindex Wvirtual-move-assign
7596 @opindex Wno-virtual-move-assign
7597 Suppress warnings about inheriting from a virtual base with a
7598 non-trivial C++11 move assignment operator. This is dangerous because
7599 if the virtual base is reachable along more than one path, it is
7600 moved multiple times, which can mean both objects end up in the
7601 moved-from state. If the move assignment operator is written to avoid
7602 moving from a moved-from object, this warning can be disabled.
7603
7604 @item -Wvla
7605 @opindex Wvla
7606 @opindex Wno-vla
7607 Warn if a variable-length array is used in the code.
7608 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7609 the variable-length array.
7610
7611 @item -Wvla-larger-than=@var{byte-size}
7612 @opindex Wvla-larger-than=
7613 @opindex Wno-vla-larger-than
7614 If this option is used, the compiler will warn for declarations of
7615 variable-length arrays whose size is either unbounded, or bounded
7616 by an argument that allows the array size to exceed @var{byte-size}
7617 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7618 works, but with variable-length arrays.
7619
7620 Note that GCC may optimize small variable-length arrays of a known
7621 value into plain arrays, so this warning may not get triggered for
7622 such arrays.
7623
7624 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7625 is typically only effective when @option{-ftree-vrp} is active (default
7626 for @option{-O2} and above).
7627
7628 See also @option{-Walloca-larger-than=@var{byte-size}}.
7629
7630 @item -Wno-vla-larger-than
7631 @opindex Wno-vla-larger-than
7632 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7633 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7634
7635 @item -Wvolatile-register-var
7636 @opindex Wvolatile-register-var
7637 @opindex Wno-volatile-register-var
7638 Warn if a register variable is declared volatile. The volatile
7639 modifier does not inhibit all optimizations that may eliminate reads
7640 and/or writes to register variables. This warning is enabled by
7641 @option{-Wall}.
7642
7643 @item -Wdisabled-optimization
7644 @opindex Wdisabled-optimization
7645 @opindex Wno-disabled-optimization
7646 Warn if a requested optimization pass is disabled. This warning does
7647 not generally indicate that there is anything wrong with your code; it
7648 merely indicates that GCC's optimizers are unable to handle the code
7649 effectively. Often, the problem is that your code is too big or too
7650 complex; GCC refuses to optimize programs when the optimization
7651 itself is likely to take inordinate amounts of time.
7652
7653 @item -Wpointer-sign @r{(C and Objective-C only)}
7654 @opindex Wpointer-sign
7655 @opindex Wno-pointer-sign
7656 Warn for pointer argument passing or assignment with different signedness.
7657 This option is only supported for C and Objective-C@. It is implied by
7658 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7659 @option{-Wno-pointer-sign}.
7660
7661 @item -Wstack-protector
7662 @opindex Wstack-protector
7663 @opindex Wno-stack-protector
7664 This option is only active when @option{-fstack-protector} is active. It
7665 warns about functions that are not protected against stack smashing.
7666
7667 @item -Woverlength-strings
7668 @opindex Woverlength-strings
7669 @opindex Wno-overlength-strings
7670 Warn about string constants that are longer than the ``minimum
7671 maximum'' length specified in the C standard. Modern compilers
7672 generally allow string constants that are much longer than the
7673 standard's minimum limit, but very portable programs should avoid
7674 using longer strings.
7675
7676 The limit applies @emph{after} string constant concatenation, and does
7677 not count the trailing NUL@. In C90, the limit was 509 characters; in
7678 C99, it was raised to 4095. C++98 does not specify a normative
7679 minimum maximum, so we do not diagnose overlength strings in C++@.
7680
7681 This option is implied by @option{-Wpedantic}, and can be disabled with
7682 @option{-Wno-overlength-strings}.
7683
7684 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7685 @opindex Wunsuffixed-float-constants
7686 @opindex Wno-unsuffixed-float-constants
7687
7688 Issue a warning for any floating constant that does not have
7689 a suffix. When used together with @option{-Wsystem-headers} it
7690 warns about such constants in system header files. This can be useful
7691 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7692 from the decimal floating-point extension to C99.
7693
7694 @item -Wno-designated-init @r{(C and Objective-C only)}
7695 Suppress warnings when a positional initializer is used to initialize
7696 a structure that has been marked with the @code{designated_init}
7697 attribute.
7698
7699 @item -Whsa
7700 Issue a warning when HSAIL cannot be emitted for the compiled function or
7701 OpenMP construct.
7702
7703 @end table
7704
7705 @node Debugging Options
7706 @section Options for Debugging Your Program
7707 @cindex options, debugging
7708 @cindex debugging information options
7709
7710 To tell GCC to emit extra information for use by a debugger, in almost
7711 all cases you need only to add @option{-g} to your other options.
7712
7713 GCC allows you to use @option{-g} with
7714 @option{-O}. The shortcuts taken by optimized code may occasionally
7715 be surprising: some variables you declared may not exist
7716 at all; flow of control may briefly move where you did not expect it;
7717 some statements may not be executed because they compute constant
7718 results or their values are already at hand; some statements may
7719 execute in different places because they have been moved out of loops.
7720 Nevertheless it is possible to debug optimized output. This makes
7721 it reasonable to use the optimizer for programs that might have bugs.
7722
7723 If you are not using some other optimization option, consider
7724 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7725 With no @option{-O} option at all, some compiler passes that collect
7726 information useful for debugging do not run at all, so that
7727 @option{-Og} may result in a better debugging experience.
7728
7729 @table @gcctabopt
7730 @item -g
7731 @opindex g
7732 Produce debugging information in the operating system's native format
7733 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7734 information.
7735
7736 On most systems that use stabs format, @option{-g} enables use of extra
7737 debugging information that only GDB can use; this extra information
7738 makes debugging work better in GDB but probably makes other debuggers
7739 crash or
7740 refuse to read the program. If you want to control for certain whether
7741 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7742 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7743
7744 @item -ggdb
7745 @opindex ggdb
7746 Produce debugging information for use by GDB@. This means to use the
7747 most expressive format available (DWARF, stabs, or the native format
7748 if neither of those are supported), including GDB extensions if at all
7749 possible.
7750
7751 @item -gdwarf
7752 @itemx -gdwarf-@var{version}
7753 @opindex gdwarf
7754 Produce debugging information in DWARF format (if that is supported).
7755 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7756 for most targets is 4. DWARF Version 5 is only experimental.
7757
7758 Note that with DWARF Version 2, some ports require and always
7759 use some non-conflicting DWARF 3 extensions in the unwind tables.
7760
7761 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7762 for maximum benefit.
7763
7764 GCC no longer supports DWARF Version 1, which is substantially
7765 different than Version 2 and later. For historical reasons, some
7766 other DWARF-related options such as
7767 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7768 in their names, but apply to all currently-supported versions of DWARF.
7769
7770 @item -gstabs
7771 @opindex gstabs
7772 Produce debugging information in stabs format (if that is supported),
7773 without GDB extensions. This is the format used by DBX on most BSD
7774 systems. On MIPS, Alpha and System V Release 4 systems this option
7775 produces stabs debugging output that is not understood by DBX@.
7776 On System V Release 4 systems this option requires the GNU assembler.
7777
7778 @item -gstabs+
7779 @opindex gstabs+
7780 Produce debugging information in stabs format (if that is supported),
7781 using GNU extensions understood only by the GNU debugger (GDB)@. The
7782 use of these extensions is likely to make other debuggers crash or
7783 refuse to read the program.
7784
7785 @item -gxcoff
7786 @opindex gxcoff
7787 Produce debugging information in XCOFF format (if that is supported).
7788 This is the format used by the DBX debugger on IBM RS/6000 systems.
7789
7790 @item -gxcoff+
7791 @opindex gxcoff+
7792 Produce debugging information in XCOFF format (if that is supported),
7793 using GNU extensions understood only by the GNU debugger (GDB)@. The
7794 use of these extensions is likely to make other debuggers crash or
7795 refuse to read the program, and may cause assemblers other than the GNU
7796 assembler (GAS) to fail with an error.
7797
7798 @item -gvms
7799 @opindex gvms
7800 Produce debugging information in Alpha/VMS debug format (if that is
7801 supported). This is the format used by DEBUG on Alpha/VMS systems.
7802
7803 @item -g@var{level}
7804 @itemx -ggdb@var{level}
7805 @itemx -gstabs@var{level}
7806 @itemx -gxcoff@var{level}
7807 @itemx -gvms@var{level}
7808 Request debugging information and also use @var{level} to specify how
7809 much information. The default level is 2.
7810
7811 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7812 @option{-g}.
7813
7814 Level 1 produces minimal information, enough for making backtraces in
7815 parts of the program that you don't plan to debug. This includes
7816 descriptions of functions and external variables, and line number
7817 tables, but no information about local variables.
7818
7819 Level 3 includes extra information, such as all the macro definitions
7820 present in the program. Some debuggers support macro expansion when
7821 you use @option{-g3}.
7822
7823 If you use multiple @option{-g} options, with or without level numbers,
7824 the last such option is the one that is effective.
7825
7826 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7827 confusion with @option{-gdwarf-@var{level}}.
7828 Instead use an additional @option{-g@var{level}} option to change the
7829 debug level for DWARF.
7830
7831 @item -fno-eliminate-unused-debug-symbols
7832 @opindex feliminate-unused-debug-symbols
7833 @opindex fno-eliminate-unused-debug-symbols
7834 By default, no debug information is produced for symbols that are not actually
7835 used. Use this option if you want debug information for all symbols.
7836
7837 @item -femit-class-debug-always
7838 @opindex femit-class-debug-always
7839 Instead of emitting debugging information for a C++ class in only one
7840 object file, emit it in all object files using the class. This option
7841 should be used only with debuggers that are unable to handle the way GCC
7842 normally emits debugging information for classes because using this
7843 option increases the size of debugging information by as much as a
7844 factor of two.
7845
7846 @item -fno-merge-debug-strings
7847 @opindex fmerge-debug-strings
7848 @opindex fno-merge-debug-strings
7849 Direct the linker to not merge together strings in the debugging
7850 information that are identical in different object files. Merging is
7851 not supported by all assemblers or linkers. Merging decreases the size
7852 of the debug information in the output file at the cost of increasing
7853 link processing time. Merging is enabled by default.
7854
7855 @item -fdebug-prefix-map=@var{old}=@var{new}
7856 @opindex fdebug-prefix-map
7857 When compiling files residing in directory @file{@var{old}}, record
7858 debugging information describing them as if the files resided in
7859 directory @file{@var{new}} instead. This can be used to replace a
7860 build-time path with an install-time path in the debug info. It can
7861 also be used to change an absolute path to a relative path by using
7862 @file{.} for @var{new}. This can give more reproducible builds, which
7863 are location independent, but may require an extra command to tell GDB
7864 where to find the source files. See also @option{-ffile-prefix-map}.
7865
7866 @item -fvar-tracking
7867 @opindex fvar-tracking
7868 Run variable tracking pass. It computes where variables are stored at each
7869 position in code. Better debugging information is then generated
7870 (if the debugging information format supports this information).
7871
7872 It is enabled by default when compiling with optimization (@option{-Os},
7873 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7874 the debug info format supports it.
7875
7876 @item -fvar-tracking-assignments
7877 @opindex fvar-tracking-assignments
7878 @opindex fno-var-tracking-assignments
7879 Annotate assignments to user variables early in the compilation and
7880 attempt to carry the annotations over throughout the compilation all the
7881 way to the end, in an attempt to improve debug information while
7882 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7883
7884 It can be enabled even if var-tracking is disabled, in which case
7885 annotations are created and maintained, but discarded at the end.
7886 By default, this flag is enabled together with @option{-fvar-tracking},
7887 except when selective scheduling is enabled.
7888
7889 @item -gsplit-dwarf
7890 @opindex gsplit-dwarf
7891 Separate as much DWARF debugging information as possible into a
7892 separate output file with the extension @file{.dwo}. This option allows
7893 the build system to avoid linking files with debug information. To
7894 be useful, this option requires a debugger capable of reading @file{.dwo}
7895 files.
7896
7897 @item -gdescribe-dies
7898 @opindex gdescribe-dies
7899 Add description attributes to some DWARF DIEs that have no name attribute,
7900 such as artificial variables, external references and call site
7901 parameter DIEs.
7902
7903 @item -gpubnames
7904 @opindex gpubnames
7905 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7906
7907 @item -ggnu-pubnames
7908 @opindex ggnu-pubnames
7909 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7910 suitable for conversion into a GDB@ index. This option is only useful
7911 with a linker that can produce GDB@ index version 7.
7912
7913 @item -fdebug-types-section
7914 @opindex fdebug-types-section
7915 @opindex fno-debug-types-section
7916 When using DWARF Version 4 or higher, type DIEs can be put into
7917 their own @code{.debug_types} section instead of making them part of the
7918 @code{.debug_info} section. It is more efficient to put them in a separate
7919 comdat section since the linker can then remove duplicates.
7920 But not all DWARF consumers support @code{.debug_types} sections yet
7921 and on some objects @code{.debug_types} produces larger instead of smaller
7922 debugging information.
7923
7924 @item -grecord-gcc-switches
7925 @itemx -gno-record-gcc-switches
7926 @opindex grecord-gcc-switches
7927 @opindex gno-record-gcc-switches
7928 This switch causes the command-line options used to invoke the
7929 compiler that may affect code generation to be appended to the
7930 DW_AT_producer attribute in DWARF debugging information. The options
7931 are concatenated with spaces separating them from each other and from
7932 the compiler version.
7933 It is enabled by default.
7934 See also @option{-frecord-gcc-switches} for another
7935 way of storing compiler options into the object file.
7936
7937 @item -gstrict-dwarf
7938 @opindex gstrict-dwarf
7939 Disallow using extensions of later DWARF standard version than selected
7940 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7941 DWARF extensions from later standard versions is allowed.
7942
7943 @item -gno-strict-dwarf
7944 @opindex gno-strict-dwarf
7945 Allow using extensions of later DWARF standard version than selected with
7946 @option{-gdwarf-@var{version}}.
7947
7948 @item -gas-loc-support
7949 @opindex gas-loc-support
7950 Inform the compiler that the assembler supports @code{.loc} directives.
7951 It may then use them for the assembler to generate DWARF2+ line number
7952 tables.
7953
7954 This is generally desirable, because assembler-generated line-number
7955 tables are a lot more compact than those the compiler can generate
7956 itself.
7957
7958 This option will be enabled by default if, at GCC configure time, the
7959 assembler was found to support such directives.
7960
7961 @item -gno-as-loc-support
7962 @opindex gno-as-loc-support
7963 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7964 line number tables are to be generated.
7965
7966 @item -gas-locview-support
7967 @opindex gas-locview-support
7968 Inform the compiler that the assembler supports @code{view} assignment
7969 and reset assertion checking in @code{.loc} directives.
7970
7971 This option will be enabled by default if, at GCC configure time, the
7972 assembler was found to support them.
7973
7974 @item -gno-as-locview-support
7975 Force GCC to assign view numbers internally, if
7976 @option{-gvariable-location-views} are explicitly requested.
7977
7978 @item -gcolumn-info
7979 @itemx -gno-column-info
7980 @opindex gcolumn-info
7981 @opindex gno-column-info
7982 Emit location column information into DWARF debugging information, rather
7983 than just file and line.
7984 This option is enabled by default.
7985
7986 @item -gstatement-frontiers
7987 @itemx -gno-statement-frontiers
7988 @opindex gstatement-frontiers
7989 @opindex gno-statement-frontiers
7990 This option causes GCC to create markers in the internal representation
7991 at the beginning of statements, and to keep them roughly in place
7992 throughout compilation, using them to guide the output of @code{is_stmt}
7993 markers in the line number table. This is enabled by default when
7994 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7995 @dots{}), and outputting DWARF 2 debug information at the normal level.
7996
7997 @item -gvariable-location-views
7998 @itemx -gvariable-location-views=incompat5
7999 @itemx -gno-variable-location-views
8000 @opindex gvariable-location-views
8001 @opindex gvariable-location-views=incompat5
8002 @opindex gno-variable-location-views
8003 Augment variable location lists with progressive view numbers implied
8004 from the line number table. This enables debug information consumers to
8005 inspect state at certain points of the program, even if no instructions
8006 associated with the corresponding source locations are present at that
8007 point. If the assembler lacks support for view numbers in line number
8008 tables, this will cause the compiler to emit the line number table,
8009 which generally makes them somewhat less compact. The augmented line
8010 number tables and location lists are fully backward-compatible, so they
8011 can be consumed by debug information consumers that are not aware of
8012 these augmentations, but they won't derive any benefit from them either.
8013
8014 This is enabled by default when outputting DWARF 2 debug information at
8015 the normal level, as long as there is assembler support,
8016 @option{-fvar-tracking-assignments} is enabled and
8017 @option{-gstrict-dwarf} is not. When assembler support is not
8018 available, this may still be enabled, but it will force GCC to output
8019 internal line number tables, and if
8020 @option{-ginternal-reset-location-views} is not enabled, that will most
8021 certainly lead to silently mismatching location views.
8022
8023 There is a proposed representation for view numbers that is not backward
8024 compatible with the location list format introduced in DWARF 5, that can
8025 be enabled with @option{-gvariable-location-views=incompat5}. This
8026 option may be removed in the future, is only provided as a reference
8027 implementation of the proposed representation. Debug information
8028 consumers are not expected to support this extended format, and they
8029 would be rendered unable to decode location lists using it.
8030
8031 @item -ginternal-reset-location-views
8032 @itemx -gnointernal-reset-location-views
8033 @opindex ginternal-reset-location-views
8034 @opindex gno-internal-reset-location-views
8035 Attempt to determine location views that can be omitted from location
8036 view lists. This requires the compiler to have very accurate insn
8037 length estimates, which isn't always the case, and it may cause
8038 incorrect view lists to be generated silently when using an assembler
8039 that does not support location view lists. The GNU assembler will flag
8040 any such error as a @code{view number mismatch}. This is only enabled
8041 on ports that define a reliable estimation function.
8042
8043 @item -ginline-points
8044 @itemx -gno-inline-points
8045 @opindex ginline-points
8046 @opindex gno-inline-points
8047 Generate extended debug information for inlined functions. Location
8048 view tracking markers are inserted at inlined entry points, so that
8049 address and view numbers can be computed and output in debug
8050 information. This can be enabled independently of location views, in
8051 which case the view numbers won't be output, but it can only be enabled
8052 along with statement frontiers, and it is only enabled by default if
8053 location views are enabled.
8054
8055 @item -gz@r{[}=@var{type}@r{]}
8056 @opindex gz
8057 Produce compressed debug sections in DWARF format, if that is supported.
8058 If @var{type} is not given, the default type depends on the capabilities
8059 of the assembler and linker used. @var{type} may be one of
8060 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8061 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8062 compression in traditional GNU format). If the linker doesn't support
8063 writing compressed debug sections, the option is rejected. Otherwise,
8064 if the assembler does not support them, @option{-gz} is silently ignored
8065 when producing object files.
8066
8067 @item -femit-struct-debug-baseonly
8068 @opindex femit-struct-debug-baseonly
8069 Emit debug information for struct-like types
8070 only when the base name of the compilation source file
8071 matches the base name of file in which the struct is defined.
8072
8073 This option substantially reduces the size of debugging information,
8074 but at significant potential loss in type information to the debugger.
8075 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8076 See @option{-femit-struct-debug-detailed} for more detailed control.
8077
8078 This option works only with DWARF debug output.
8079
8080 @item -femit-struct-debug-reduced
8081 @opindex femit-struct-debug-reduced
8082 Emit debug information for struct-like types
8083 only when the base name of the compilation source file
8084 matches the base name of file in which the type is defined,
8085 unless the struct is a template or defined in a system header.
8086
8087 This option significantly reduces the size of debugging information,
8088 with some potential loss in type information to the debugger.
8089 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8090 See @option{-femit-struct-debug-detailed} for more detailed control.
8091
8092 This option works only with DWARF debug output.
8093
8094 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8095 @opindex femit-struct-debug-detailed
8096 Specify the struct-like types
8097 for which the compiler generates debug information.
8098 The intent is to reduce duplicate struct debug information
8099 between different object files within the same program.
8100
8101 This option is a detailed version of
8102 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8103 which serves for most needs.
8104
8105 A specification has the syntax@*
8106 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8107
8108 The optional first word limits the specification to
8109 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8110 A struct type is used directly when it is the type of a variable, member.
8111 Indirect uses arise through pointers to structs.
8112 That is, when use of an incomplete struct is valid, the use is indirect.
8113 An example is
8114 @samp{struct one direct; struct two * indirect;}.
8115
8116 The optional second word limits the specification to
8117 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8118 Generic structs are a bit complicated to explain.
8119 For C++, these are non-explicit specializations of template classes,
8120 or non-template classes within the above.
8121 Other programming languages have generics,
8122 but @option{-femit-struct-debug-detailed} does not yet implement them.
8123
8124 The third word specifies the source files for those
8125 structs for which the compiler should emit debug information.
8126 The values @samp{none} and @samp{any} have the normal meaning.
8127 The value @samp{base} means that
8128 the base of name of the file in which the type declaration appears
8129 must match the base of the name of the main compilation file.
8130 In practice, this means that when compiling @file{foo.c}, debug information
8131 is generated for types declared in that file and @file{foo.h},
8132 but not other header files.
8133 The value @samp{sys} means those types satisfying @samp{base}
8134 or declared in system or compiler headers.
8135
8136 You may need to experiment to determine the best settings for your application.
8137
8138 The default is @option{-femit-struct-debug-detailed=all}.
8139
8140 This option works only with DWARF debug output.
8141
8142 @item -fno-dwarf2-cfi-asm
8143 @opindex fdwarf2-cfi-asm
8144 @opindex fno-dwarf2-cfi-asm
8145 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8146 instead of using GAS @code{.cfi_*} directives.
8147
8148 @item -fno-eliminate-unused-debug-types
8149 @opindex feliminate-unused-debug-types
8150 @opindex fno-eliminate-unused-debug-types
8151 Normally, when producing DWARF output, GCC avoids producing debug symbol
8152 output for types that are nowhere used in the source file being compiled.
8153 Sometimes it is useful to have GCC emit debugging
8154 information for all types declared in a compilation
8155 unit, regardless of whether or not they are actually used
8156 in that compilation unit, for example
8157 if, in the debugger, you want to cast a value to a type that is
8158 not actually used in your program (but is declared). More often,
8159 however, this results in a significant amount of wasted space.
8160 @end table
8161
8162 @node Optimize Options
8163 @section Options That Control Optimization
8164 @cindex optimize options
8165 @cindex options, optimization
8166
8167 These options control various sorts of optimizations.
8168
8169 Without any optimization option, the compiler's goal is to reduce the
8170 cost of compilation and to make debugging produce the expected
8171 results. Statements are independent: if you stop the program with a
8172 breakpoint between statements, you can then assign a new value to any
8173 variable or change the program counter to any other statement in the
8174 function and get exactly the results you expect from the source
8175 code.
8176
8177 Turning on optimization flags makes the compiler attempt to improve
8178 the performance and/or code size at the expense of compilation time
8179 and possibly the ability to debug the program.
8180
8181 The compiler performs optimization based on the knowledge it has of the
8182 program. Compiling multiple files at once to a single output file mode allows
8183 the compiler to use information gained from all of the files when compiling
8184 each of them.
8185
8186 Not all optimizations are controlled directly by a flag. Only
8187 optimizations that have a flag are listed in this section.
8188
8189 Most optimizations are completely disabled at @option{-O0} or if an
8190 @option{-O} level is not set on the command line, even if individual
8191 optimization flags are specified. Similarly, @option{-Og} suppresses
8192 many optimization passes.
8193
8194 Depending on the target and how GCC was configured, a slightly different
8195 set of optimizations may be enabled at each @option{-O} level than
8196 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8197 to find out the exact set of optimizations that are enabled at each level.
8198 @xref{Overall Options}, for examples.
8199
8200 @table @gcctabopt
8201 @item -O
8202 @itemx -O1
8203 @opindex O
8204 @opindex O1
8205 Optimize. Optimizing compilation takes somewhat more time, and a lot
8206 more memory for a large function.
8207
8208 With @option{-O}, the compiler tries to reduce code size and execution
8209 time, without performing any optimizations that take a great deal of
8210 compilation time.
8211
8212 @c Note that in addition to the default_options_table list in opts.c,
8213 @c several optimization flags default to true but control optimization
8214 @c passes that are explicitly disabled at -O0.
8215
8216 @option{-O} turns on the following optimization flags:
8217
8218 @c Please keep the following list alphabetized.
8219 @gccoptlist{-fauto-inc-dec @gol
8220 -fbranch-count-reg @gol
8221 -fcombine-stack-adjustments @gol
8222 -fcompare-elim @gol
8223 -fcprop-registers @gol
8224 -fdce @gol
8225 -fdefer-pop @gol
8226 -fdelayed-branch @gol
8227 -fdse @gol
8228 -fforward-propagate @gol
8229 -fguess-branch-probability @gol
8230 -fif-conversion @gol
8231 -fif-conversion2 @gol
8232 -finline-functions-called-once @gol
8233 -fipa-profile @gol
8234 -fipa-pure-const @gol
8235 -fipa-reference @gol
8236 -fipa-reference-addressable @gol
8237 -fmerge-constants @gol
8238 -fmove-loop-invariants @gol
8239 -fomit-frame-pointer @gol
8240 -freorder-blocks @gol
8241 -fshrink-wrap @gol
8242 -fshrink-wrap-separate @gol
8243 -fsplit-wide-types @gol
8244 -fssa-backprop @gol
8245 -fssa-phiopt @gol
8246 -ftree-bit-ccp @gol
8247 -ftree-ccp @gol
8248 -ftree-ch @gol
8249 -ftree-coalesce-vars @gol
8250 -ftree-copy-prop @gol
8251 -ftree-dce @gol
8252 -ftree-dominator-opts @gol
8253 -ftree-dse @gol
8254 -ftree-forwprop @gol
8255 -ftree-fre @gol
8256 -ftree-phiprop @gol
8257 -ftree-pta @gol
8258 -ftree-scev-cprop @gol
8259 -ftree-sink @gol
8260 -ftree-slsr @gol
8261 -ftree-sra @gol
8262 -ftree-ter @gol
8263 -funit-at-a-time}
8264
8265 @item -O2
8266 @opindex O2
8267 Optimize even more. GCC performs nearly all supported optimizations
8268 that do not involve a space-speed tradeoff.
8269 As compared to @option{-O}, this option increases both compilation time
8270 and the performance of the generated code.
8271
8272 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8273 also turns on the following optimization flags:
8274
8275 @c Please keep the following list alphabetized!
8276 @gccoptlist{-falign-functions -falign-jumps @gol
8277 -falign-labels -falign-loops @gol
8278 -fcaller-saves @gol
8279 -fcode-hoisting @gol
8280 -fcrossjumping @gol
8281 -fcse-follow-jumps -fcse-skip-blocks @gol
8282 -fdelete-null-pointer-checks @gol
8283 -fdevirtualize -fdevirtualize-speculatively @gol
8284 -fexpensive-optimizations @gol
8285 -fgcse -fgcse-lm @gol
8286 -fhoist-adjacent-loads @gol
8287 -finline-small-functions @gol
8288 -findirect-inlining @gol
8289 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8290 -fipa-ra -fipa-sra -fipa-vrp @gol
8291 -fisolate-erroneous-paths-dereference @gol
8292 -flra-remat @gol
8293 -foptimize-sibling-calls @gol
8294 -foptimize-strlen @gol
8295 -fpartial-inlining @gol
8296 -fpeephole2 @gol
8297 -freorder-blocks-algorithm=stc @gol
8298 -freorder-blocks-and-partition -freorder-functions @gol
8299 -frerun-cse-after-loop @gol
8300 -fschedule-insns -fschedule-insns2 @gol
8301 -fsched-interblock -fsched-spec @gol
8302 -fstore-merging @gol
8303 -fstrict-aliasing @gol
8304 -fthread-jumps @gol
8305 -ftree-builtin-call-dce @gol
8306 -ftree-pre @gol
8307 -ftree-switch-conversion -ftree-tail-merge @gol
8308 -ftree-vrp}
8309
8310 Please note the warning under @option{-fgcse} about
8311 invoking @option{-O2} on programs that use computed gotos.
8312
8313 @item -O3
8314 @opindex O3
8315 Optimize yet more. @option{-O3} turns on all optimizations specified
8316 by @option{-O2} and also turns on the following optimization flags:
8317
8318 @c Please keep the following list alphabetized!
8319 @gccoptlist{-fgcse-after-reload @gol
8320 -finline-functions @gol
8321 -fipa-cp-clone
8322 -floop-interchange @gol
8323 -floop-unroll-and-jam @gol
8324 -fpeel-loops @gol
8325 -fpredictive-commoning @gol
8326 -fsplit-paths @gol
8327 -ftree-loop-distribute-patterns @gol
8328 -ftree-loop-distribution @gol
8329 -ftree-loop-vectorize @gol
8330 -ftree-partial-pre @gol
8331 -ftree-slp-vectorize @gol
8332 -funswitch-loops @gol
8333 -fvect-cost-model @gol
8334 -fversion-loops-for-strides}
8335
8336 @item -O0
8337 @opindex O0
8338 Reduce compilation time and make debugging produce the expected
8339 results. This is the default.
8340
8341 @item -Os
8342 @opindex Os
8343 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8344 except those that often increase code size:
8345
8346 @gccoptlist{-falign-functions -falign-jumps @gol
8347 -falign-labels -falign-loops @gol
8348 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8349
8350 It also enables @option{-finline-functions}, causes the compiler to tune for
8351 code size rather than execution speed, and performs further optimizations
8352 designed to reduce code size.
8353
8354 @item -Ofast
8355 @opindex Ofast
8356 Disregard strict standards compliance. @option{-Ofast} enables all
8357 @option{-O3} optimizations. It also enables optimizations that are not
8358 valid for all standard-compliant programs.
8359 It turns on @option{-ffast-math} and the Fortran-specific
8360 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8361 specified, and @option{-fno-protect-parens}.
8362
8363 @item -Og
8364 @opindex Og
8365 Optimize debugging experience. @option{-Og} should be the optimization
8366 level of choice for the standard edit-compile-debug cycle, offering
8367 a reasonable level of optimization while maintaining fast compilation
8368 and a good debugging experience. It is a better choice than @option{-O0}
8369 for producing debuggable code because some compiler passes
8370 that collect debug information are disabled at @option{-O0}.
8371
8372 Like @option{-O0}, @option{-Og} completely disables a number of
8373 optimization passes so that individual options controlling them have
8374 no effect. Otherwise @option{-Og} enables all @option{-O1}
8375 optimization flags except for those that may interfere with debugging:
8376
8377 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8378 -fif-conversion -fif-conversion2 @gol
8379 -finline-functions-called-once @gol
8380 -fmove-loop-invariants -fssa-phiopt @gol
8381 -ftree-bit-ccp -ftree-pta -ftree-sra}
8382
8383 @end table
8384
8385 If you use multiple @option{-O} options, with or without level numbers,
8386 the last such option is the one that is effective.
8387
8388 Options of the form @option{-f@var{flag}} specify machine-independent
8389 flags. Most flags have both positive and negative forms; the negative
8390 form of @option{-ffoo} is @option{-fno-foo}. In the table
8391 below, only one of the forms is listed---the one you typically
8392 use. You can figure out the other form by either removing @samp{no-}
8393 or adding it.
8394
8395 The following options control specific optimizations. They are either
8396 activated by @option{-O} options or are related to ones that are. You
8397 can use the following flags in the rare cases when ``fine-tuning'' of
8398 optimizations to be performed is desired.
8399
8400 @table @gcctabopt
8401 @item -fno-defer-pop
8402 @opindex fno-defer-pop
8403 @opindex fdefer-pop
8404 For machines that must pop arguments after a function call, always pop
8405 the arguments as soon as each function returns.
8406 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8407 this allows the compiler to let arguments accumulate on the stack for several
8408 function calls and pop them all at once.
8409
8410 @item -fforward-propagate
8411 @opindex fforward-propagate
8412 Perform a forward propagation pass on RTL@. The pass tries to combine two
8413 instructions and checks if the result can be simplified. If loop unrolling
8414 is active, two passes are performed and the second is scheduled after
8415 loop unrolling.
8416
8417 This option is enabled by default at optimization levels @option{-O},
8418 @option{-O2}, @option{-O3}, @option{-Os}.
8419
8420 @item -ffp-contract=@var{style}
8421 @opindex ffp-contract
8422 @option{-ffp-contract=off} disables floating-point expression contraction.
8423 @option{-ffp-contract=fast} enables floating-point expression contraction
8424 such as forming of fused multiply-add operations if the target has
8425 native support for them.
8426 @option{-ffp-contract=on} enables floating-point expression contraction
8427 if allowed by the language standard. This is currently not implemented
8428 and treated equal to @option{-ffp-contract=off}.
8429
8430 The default is @option{-ffp-contract=fast}.
8431
8432 @item -fomit-frame-pointer
8433 @opindex fomit-frame-pointer
8434 Omit the frame pointer in functions that don't need one. This avoids the
8435 instructions to save, set up and restore the frame pointer; on many targets
8436 it also makes an extra register available.
8437
8438 On some targets this flag has no effect because the standard calling sequence
8439 always uses a frame pointer, so it cannot be omitted.
8440
8441 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8442 is used in all functions. Several targets always omit the frame pointer in
8443 leaf functions.
8444
8445 Enabled by default at @option{-O} and higher.
8446
8447 @item -foptimize-sibling-calls
8448 @opindex foptimize-sibling-calls
8449 Optimize sibling and tail recursive calls.
8450
8451 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8452
8453 @item -foptimize-strlen
8454 @opindex foptimize-strlen
8455 Optimize various standard C string functions (e.g.@: @code{strlen},
8456 @code{strchr} or @code{strcpy}) and
8457 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8458
8459 Enabled at levels @option{-O2}, @option{-O3}.
8460
8461 @item -fno-inline
8462 @opindex fno-inline
8463 @opindex finline
8464 Do not expand any functions inline apart from those marked with
8465 the @code{always_inline} attribute. This is the default when not
8466 optimizing.
8467
8468 Single functions can be exempted from inlining by marking them
8469 with the @code{noinline} attribute.
8470
8471 @item -finline-small-functions
8472 @opindex finline-small-functions
8473 Integrate functions into their callers when their body is smaller than expected
8474 function call code (so overall size of program gets smaller). The compiler
8475 heuristically decides which functions are simple enough to be worth integrating
8476 in this way. This inlining applies to all functions, even those not declared
8477 inline.
8478
8479 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8480
8481 @item -findirect-inlining
8482 @opindex findirect-inlining
8483 Inline also indirect calls that are discovered to be known at compile
8484 time thanks to previous inlining. This option has any effect only
8485 when inlining itself is turned on by the @option{-finline-functions}
8486 or @option{-finline-small-functions} options.
8487
8488 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8489
8490 @item -finline-functions
8491 @opindex finline-functions
8492 Consider all functions for inlining, even if they are not declared inline.
8493 The compiler heuristically decides which functions are worth integrating
8494 in this way.
8495
8496 If all calls to a given function are integrated, and the function is
8497 declared @code{static}, then the function is normally not output as
8498 assembler code in its own right.
8499
8500 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8501 by @option{-fprofile-use} and @option{-fauto-profile}.
8502
8503 @item -finline-functions-called-once
8504 @opindex finline-functions-called-once
8505 Consider all @code{static} functions called once for inlining into their
8506 caller even if they are not marked @code{inline}. If a call to a given
8507 function is integrated, then the function is not output as assembler code
8508 in its own right.
8509
8510 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8511 but not @option{-Og}.
8512
8513 @item -fearly-inlining
8514 @opindex fearly-inlining
8515 Inline functions marked by @code{always_inline} and functions whose body seems
8516 smaller than the function call overhead early before doing
8517 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8518 makes profiling significantly cheaper and usually inlining faster on programs
8519 having large chains of nested wrapper functions.
8520
8521 Enabled by default.
8522
8523 @item -fipa-sra
8524 @opindex fipa-sra
8525 Perform interprocedural scalar replacement of aggregates, removal of
8526 unused parameters and replacement of parameters passed by reference
8527 by parameters passed by value.
8528
8529 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8530
8531 @item -finline-limit=@var{n}
8532 @opindex finline-limit
8533 By default, GCC limits the size of functions that can be inlined. This flag
8534 allows coarse control of this limit. @var{n} is the size of functions that
8535 can be inlined in number of pseudo instructions.
8536
8537 Inlining is actually controlled by a number of parameters, which may be
8538 specified individually by using @option{--param @var{name}=@var{value}}.
8539 The @option{-finline-limit=@var{n}} option sets some of these parameters
8540 as follows:
8541
8542 @table @gcctabopt
8543 @item max-inline-insns-single
8544 is set to @var{n}/2.
8545 @item max-inline-insns-auto
8546 is set to @var{n}/2.
8547 @end table
8548
8549 See below for a documentation of the individual
8550 parameters controlling inlining and for the defaults of these parameters.
8551
8552 @emph{Note:} there may be no value to @option{-finline-limit} that results
8553 in default behavior.
8554
8555 @emph{Note:} pseudo instruction represents, in this particular context, an
8556 abstract measurement of function's size. In no way does it represent a count
8557 of assembly instructions and as such its exact meaning might change from one
8558 release to an another.
8559
8560 @item -fno-keep-inline-dllexport
8561 @opindex fno-keep-inline-dllexport
8562 @opindex fkeep-inline-dllexport
8563 This is a more fine-grained version of @option{-fkeep-inline-functions},
8564 which applies only to functions that are declared using the @code{dllexport}
8565 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8566 Functions}.
8567
8568 @item -fkeep-inline-functions
8569 @opindex fkeep-inline-functions
8570 In C, emit @code{static} functions that are declared @code{inline}
8571 into the object file, even if the function has been inlined into all
8572 of its callers. This switch does not affect functions using the
8573 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8574 inline functions into the object file.
8575
8576 @item -fkeep-static-functions
8577 @opindex fkeep-static-functions
8578 Emit @code{static} functions into the object file, even if the function
8579 is never used.
8580
8581 @item -fkeep-static-consts
8582 @opindex fkeep-static-consts
8583 Emit variables declared @code{static const} when optimization isn't turned
8584 on, even if the variables aren't referenced.
8585
8586 GCC enables this option by default. If you want to force the compiler to
8587 check if a variable is referenced, regardless of whether or not
8588 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8589
8590 @item -fmerge-constants
8591 @opindex fmerge-constants
8592 Attempt to merge identical constants (string constants and floating-point
8593 constants) across compilation units.
8594
8595 This option is the default for optimized compilation if the assembler and
8596 linker support it. Use @option{-fno-merge-constants} to inhibit this
8597 behavior.
8598
8599 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8600
8601 @item -fmerge-all-constants
8602 @opindex fmerge-all-constants
8603 Attempt to merge identical constants and identical variables.
8604
8605 This option implies @option{-fmerge-constants}. In addition to
8606 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8607 arrays or initialized constant variables with integral or floating-point
8608 types. Languages like C or C++ require each variable, including multiple
8609 instances of the same variable in recursive calls, to have distinct locations,
8610 so using this option results in non-conforming
8611 behavior.
8612
8613 @item -fmodulo-sched
8614 @opindex fmodulo-sched
8615 Perform swing modulo scheduling immediately before the first scheduling
8616 pass. This pass looks at innermost loops and reorders their
8617 instructions by overlapping different iterations.
8618
8619 @item -fmodulo-sched-allow-regmoves
8620 @opindex fmodulo-sched-allow-regmoves
8621 Perform more aggressive SMS-based modulo scheduling with register moves
8622 allowed. By setting this flag certain anti-dependences edges are
8623 deleted, which triggers the generation of reg-moves based on the
8624 life-range analysis. This option is effective only with
8625 @option{-fmodulo-sched} enabled.
8626
8627 @item -fno-branch-count-reg
8628 @opindex fno-branch-count-reg
8629 @opindex fbranch-count-reg
8630 Disable the optimization pass that scans for opportunities to use
8631 ``decrement and branch'' instructions on a count register instead of
8632 instruction sequences that decrement a register, compare it against zero, and
8633 then branch based upon the result. This option is only meaningful on
8634 architectures that support such instructions, which include x86, PowerPC,
8635 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8636 doesn't remove the decrement and branch instructions from the generated
8637 instruction stream introduced by other optimization passes.
8638
8639 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8640 except for @option{-Og}.
8641
8642 @item -fno-function-cse
8643 @opindex fno-function-cse
8644 @opindex ffunction-cse
8645 Do not put function addresses in registers; make each instruction that
8646 calls a constant function contain the function's address explicitly.
8647
8648 This option results in less efficient code, but some strange hacks
8649 that alter the assembler output may be confused by the optimizations
8650 performed when this option is not used.
8651
8652 The default is @option{-ffunction-cse}
8653
8654 @item -fno-zero-initialized-in-bss
8655 @opindex fno-zero-initialized-in-bss
8656 @opindex fzero-initialized-in-bss
8657 If the target supports a BSS section, GCC by default puts variables that
8658 are initialized to zero into BSS@. This can save space in the resulting
8659 code.
8660
8661 This option turns off this behavior because some programs explicitly
8662 rely on variables going to the data section---e.g., so that the
8663 resulting executable can find the beginning of that section and/or make
8664 assumptions based on that.
8665
8666 The default is @option{-fzero-initialized-in-bss}.
8667
8668 @item -fthread-jumps
8669 @opindex fthread-jumps
8670 Perform optimizations that check to see if a jump branches to a
8671 location where another comparison subsumed by the first is found. If
8672 so, the first branch is redirected to either the destination of the
8673 second branch or a point immediately following it, depending on whether
8674 the condition is known to be true or false.
8675
8676 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8677
8678 @item -fsplit-wide-types
8679 @opindex fsplit-wide-types
8680 When using a type that occupies multiple registers, such as @code{long
8681 long} on a 32-bit system, split the registers apart and allocate them
8682 independently. This normally generates better code for those types,
8683 but may make debugging more difficult.
8684
8685 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8686 @option{-Os}.
8687
8688 @item -fcse-follow-jumps
8689 @opindex fcse-follow-jumps
8690 In common subexpression elimination (CSE), scan through jump instructions
8691 when the target of the jump is not reached by any other path. For
8692 example, when CSE encounters an @code{if} statement with an
8693 @code{else} clause, CSE follows the jump when the condition
8694 tested is false.
8695
8696 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8697
8698 @item -fcse-skip-blocks
8699 @opindex fcse-skip-blocks
8700 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8701 follow jumps that conditionally skip over blocks. When CSE
8702 encounters a simple @code{if} statement with no else clause,
8703 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8704 body of the @code{if}.
8705
8706 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8707
8708 @item -frerun-cse-after-loop
8709 @opindex frerun-cse-after-loop
8710 Re-run common subexpression elimination after loop optimizations are
8711 performed.
8712
8713 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8714
8715 @item -fgcse
8716 @opindex fgcse
8717 Perform a global common subexpression elimination pass.
8718 This pass also performs global constant and copy propagation.
8719
8720 @emph{Note:} When compiling a program using computed gotos, a GCC
8721 extension, you may get better run-time performance if you disable
8722 the global common subexpression elimination pass by adding
8723 @option{-fno-gcse} to the command line.
8724
8725 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8726
8727 @item -fgcse-lm
8728 @opindex fgcse-lm
8729 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8730 attempts to move loads that are only killed by stores into themselves. This
8731 allows a loop containing a load/store sequence to be changed to a load outside
8732 the loop, and a copy/store within the loop.
8733
8734 Enabled by default when @option{-fgcse} is enabled.
8735
8736 @item -fgcse-sm
8737 @opindex fgcse-sm
8738 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8739 global common subexpression elimination. This pass attempts to move
8740 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8741 loops containing a load/store sequence can be changed to a load before
8742 the loop and a store after the loop.
8743
8744 Not enabled at any optimization level.
8745
8746 @item -fgcse-las
8747 @opindex fgcse-las
8748 When @option{-fgcse-las} is enabled, the global common subexpression
8749 elimination pass eliminates redundant loads that come after stores to the
8750 same memory location (both partial and full redundancies).
8751
8752 Not enabled at any optimization level.
8753
8754 @item -fgcse-after-reload
8755 @opindex fgcse-after-reload
8756 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8757 pass is performed after reload. The purpose of this pass is to clean up
8758 redundant spilling.
8759
8760 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8761
8762 @item -faggressive-loop-optimizations
8763 @opindex faggressive-loop-optimizations
8764 This option tells the loop optimizer to use language constraints to
8765 derive bounds for the number of iterations of a loop. This assumes that
8766 loop code does not invoke undefined behavior by for example causing signed
8767 integer overflows or out-of-bound array accesses. The bounds for the
8768 number of iterations of a loop are used to guide loop unrolling and peeling
8769 and loop exit test optimizations.
8770 This option is enabled by default.
8771
8772 @item -funconstrained-commons
8773 @opindex funconstrained-commons
8774 This option tells the compiler that variables declared in common blocks
8775 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8776 prevents certain optimizations that depend on knowing the array bounds.
8777
8778 @item -fcrossjumping
8779 @opindex fcrossjumping
8780 Perform cross-jumping transformation.
8781 This transformation unifies equivalent code and saves code size. The
8782 resulting code may or may not perform better than without cross-jumping.
8783
8784 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8785
8786 @item -fauto-inc-dec
8787 @opindex fauto-inc-dec
8788 Combine increments or decrements of addresses with memory accesses.
8789 This pass is always skipped on architectures that do not have
8790 instructions to support this. Enabled by default at @option{-O} and
8791 higher on architectures that support this.
8792
8793 @item -fdce
8794 @opindex fdce
8795 Perform dead code elimination (DCE) on RTL@.
8796 Enabled by default at @option{-O} and higher.
8797
8798 @item -fdse
8799 @opindex fdse
8800 Perform dead store elimination (DSE) on RTL@.
8801 Enabled by default at @option{-O} and higher.
8802
8803 @item -fif-conversion
8804 @opindex fif-conversion
8805 Attempt to transform conditional jumps into branch-less equivalents. This
8806 includes use of conditional moves, min, max, set flags and abs instructions, and
8807 some tricks doable by standard arithmetics. The use of conditional execution
8808 on chips where it is available is controlled by @option{-fif-conversion2}.
8809
8810 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8811 not with @option{-Og}.
8812
8813 @item -fif-conversion2
8814 @opindex fif-conversion2
8815 Use conditional execution (where available) to transform conditional jumps into
8816 branch-less equivalents.
8817
8818 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8819 not with @option{-Og}.
8820
8821 @item -fdeclone-ctor-dtor
8822 @opindex fdeclone-ctor-dtor
8823 The C++ ABI requires multiple entry points for constructors and
8824 destructors: one for a base subobject, one for a complete object, and
8825 one for a virtual destructor that calls operator delete afterwards.
8826 For a hierarchy with virtual bases, the base and complete variants are
8827 clones, which means two copies of the function. With this option, the
8828 base and complete variants are changed to be thunks that call a common
8829 implementation.
8830
8831 Enabled by @option{-Os}.
8832
8833 @item -fdelete-null-pointer-checks
8834 @opindex fdelete-null-pointer-checks
8835 Assume that programs cannot safely dereference null pointers, and that
8836 no code or data element resides at address zero.
8837 This option enables simple constant
8838 folding optimizations at all optimization levels. In addition, other
8839 optimization passes in GCC use this flag to control global dataflow
8840 analyses that eliminate useless checks for null pointers; these assume
8841 that a memory access to address zero always results in a trap, so
8842 that if a pointer is checked after it has already been dereferenced,
8843 it cannot be null.
8844
8845 Note however that in some environments this assumption is not true.
8846 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8847 for programs that depend on that behavior.
8848
8849 This option is enabled by default on most targets. On Nios II ELF, it
8850 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8851
8852 Passes that use the dataflow information
8853 are enabled independently at different optimization levels.
8854
8855 @item -fdevirtualize
8856 @opindex fdevirtualize
8857 Attempt to convert calls to virtual functions to direct calls. This
8858 is done both within a procedure and interprocedurally as part of
8859 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8860 propagation (@option{-fipa-cp}).
8861 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8862
8863 @item -fdevirtualize-speculatively
8864 @opindex fdevirtualize-speculatively
8865 Attempt to convert calls to virtual functions to speculative direct calls.
8866 Based on the analysis of the type inheritance graph, determine for a given call
8867 the set of likely targets. If the set is small, preferably of size 1, change
8868 the call into a conditional deciding between direct and indirect calls. The
8869 speculative calls enable more optimizations, such as inlining. When they seem
8870 useless after further optimization, they are converted back into original form.
8871
8872 @item -fdevirtualize-at-ltrans
8873 @opindex fdevirtualize-at-ltrans
8874 Stream extra information needed for aggressive devirtualization when running
8875 the link-time optimizer in local transformation mode.
8876 This option enables more devirtualization but
8877 significantly increases the size of streamed data. For this reason it is
8878 disabled by default.
8879
8880 @item -fexpensive-optimizations
8881 @opindex fexpensive-optimizations
8882 Perform a number of minor optimizations that are relatively expensive.
8883
8884 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8885
8886 @item -free
8887 @opindex free
8888 Attempt to remove redundant extension instructions. This is especially
8889 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8890 registers after writing to their lower 32-bit half.
8891
8892 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8893 @option{-O3}, @option{-Os}.
8894
8895 @item -fno-lifetime-dse
8896 @opindex fno-lifetime-dse
8897 @opindex flifetime-dse
8898 In C++ the value of an object is only affected by changes within its
8899 lifetime: when the constructor begins, the object has an indeterminate
8900 value, and any changes during the lifetime of the object are dead when
8901 the object is destroyed. Normally dead store elimination will take
8902 advantage of this; if your code relies on the value of the object
8903 storage persisting beyond the lifetime of the object, you can use this
8904 flag to disable this optimization. To preserve stores before the
8905 constructor starts (e.g.@: because your operator new clears the object
8906 storage) but still treat the object as dead after the destructor you,
8907 can use @option{-flifetime-dse=1}. The default behavior can be
8908 explicitly selected with @option{-flifetime-dse=2}.
8909 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8910
8911 @item -flive-range-shrinkage
8912 @opindex flive-range-shrinkage
8913 Attempt to decrease register pressure through register live range
8914 shrinkage. This is helpful for fast processors with small or moderate
8915 size register sets.
8916
8917 @item -fira-algorithm=@var{algorithm}
8918 @opindex fira-algorithm
8919 Use the specified coloring algorithm for the integrated register
8920 allocator. The @var{algorithm} argument can be @samp{priority}, which
8921 specifies Chow's priority coloring, or @samp{CB}, which specifies
8922 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8923 for all architectures, but for those targets that do support it, it is
8924 the default because it generates better code.
8925
8926 @item -fira-region=@var{region}
8927 @opindex fira-region
8928 Use specified regions for the integrated register allocator. The
8929 @var{region} argument should be one of the following:
8930
8931 @table @samp
8932
8933 @item all
8934 Use all loops as register allocation regions.
8935 This can give the best results for machines with a small and/or
8936 irregular register set.
8937
8938 @item mixed
8939 Use all loops except for loops with small register pressure
8940 as the regions. This value usually gives
8941 the best results in most cases and for most architectures,
8942 and is enabled by default when compiling with optimization for speed
8943 (@option{-O}, @option{-O2}, @dots{}).
8944
8945 @item one
8946 Use all functions as a single region.
8947 This typically results in the smallest code size, and is enabled by default for
8948 @option{-Os} or @option{-O0}.
8949
8950 @end table
8951
8952 @item -fira-hoist-pressure
8953 @opindex fira-hoist-pressure
8954 Use IRA to evaluate register pressure in the code hoisting pass for
8955 decisions to hoist expressions. This option usually results in smaller
8956 code, but it can slow the compiler down.
8957
8958 This option is enabled at level @option{-Os} for all targets.
8959
8960 @item -fira-loop-pressure
8961 @opindex fira-loop-pressure
8962 Use IRA to evaluate register pressure in loops for decisions to move
8963 loop invariants. This option usually results in generation
8964 of faster and smaller code on machines with large register files (>= 32
8965 registers), but it can slow the compiler down.
8966
8967 This option is enabled at level @option{-O3} for some targets.
8968
8969 @item -fno-ira-share-save-slots
8970 @opindex fno-ira-share-save-slots
8971 @opindex fira-share-save-slots
8972 Disable sharing of stack slots used for saving call-used hard
8973 registers living through a call. Each hard register gets a
8974 separate stack slot, and as a result function stack frames are
8975 larger.
8976
8977 @item -fno-ira-share-spill-slots
8978 @opindex fno-ira-share-spill-slots
8979 @opindex fira-share-spill-slots
8980 Disable sharing of stack slots allocated for pseudo-registers. Each
8981 pseudo-register that does not get a hard register gets a separate
8982 stack slot, and as a result function stack frames are larger.
8983
8984 @item -flra-remat
8985 @opindex flra-remat
8986 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8987 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8988 values if it is profitable.
8989
8990 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8991
8992 @item -fdelayed-branch
8993 @opindex fdelayed-branch
8994 If supported for the target machine, attempt to reorder instructions
8995 to exploit instruction slots available after delayed branch
8996 instructions.
8997
8998 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8999 but not at @option{-Og}.
9000
9001 @item -fschedule-insns
9002 @opindex fschedule-insns
9003 If supported for the target machine, attempt to reorder instructions to
9004 eliminate execution stalls due to required data being unavailable. This
9005 helps machines that have slow floating point or memory load instructions
9006 by allowing other instructions to be issued until the result of the load
9007 or floating-point instruction is required.
9008
9009 Enabled at levels @option{-O2}, @option{-O3}.
9010
9011 @item -fschedule-insns2
9012 @opindex fschedule-insns2
9013 Similar to @option{-fschedule-insns}, but requests an additional pass of
9014 instruction scheduling after register allocation has been done. This is
9015 especially useful on machines with a relatively small number of
9016 registers and where memory load instructions take more than one cycle.
9017
9018 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9019
9020 @item -fno-sched-interblock
9021 @opindex fno-sched-interblock
9022 @opindex fsched-interblock
9023 Disable instruction scheduling across basic blocks, which
9024 is normally enabled when scheduling before register allocation, i.e.@:
9025 with @option{-fschedule-insns} or at @option{-O2} or higher.
9026
9027 @item -fno-sched-spec
9028 @opindex fno-sched-spec
9029 @opindex fsched-spec
9030 Disable speculative motion of non-load instructions, which
9031 is normally enabled when scheduling before register allocation, i.e.@:
9032 with @option{-fschedule-insns} or at @option{-O2} or higher.
9033
9034 @item -fsched-pressure
9035 @opindex fsched-pressure
9036 Enable register pressure sensitive insn scheduling before register
9037 allocation. This only makes sense when scheduling before register
9038 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9039 @option{-O2} or higher. Usage of this option can improve the
9040 generated code and decrease its size by preventing register pressure
9041 increase above the number of available hard registers and subsequent
9042 spills in register allocation.
9043
9044 @item -fsched-spec-load
9045 @opindex fsched-spec-load
9046 Allow speculative motion of some load instructions. This only makes
9047 sense when scheduling before register allocation, i.e.@: with
9048 @option{-fschedule-insns} or at @option{-O2} or higher.
9049
9050 @item -fsched-spec-load-dangerous
9051 @opindex fsched-spec-load-dangerous
9052 Allow speculative motion of more load instructions. This only makes
9053 sense when scheduling before register allocation, i.e.@: with
9054 @option{-fschedule-insns} or at @option{-O2} or higher.
9055
9056 @item -fsched-stalled-insns
9057 @itemx -fsched-stalled-insns=@var{n}
9058 @opindex fsched-stalled-insns
9059 Define how many insns (if any) can be moved prematurely from the queue
9060 of stalled insns into the ready list during the second scheduling pass.
9061 @option{-fno-sched-stalled-insns} means that no insns are moved
9062 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9063 on how many queued insns can be moved prematurely.
9064 @option{-fsched-stalled-insns} without a value is equivalent to
9065 @option{-fsched-stalled-insns=1}.
9066
9067 @item -fsched-stalled-insns-dep
9068 @itemx -fsched-stalled-insns-dep=@var{n}
9069 @opindex fsched-stalled-insns-dep
9070 Define how many insn groups (cycles) are examined for a dependency
9071 on a stalled insn that is a candidate for premature removal from the queue
9072 of stalled insns. This has an effect only during the second scheduling pass,
9073 and only if @option{-fsched-stalled-insns} is used.
9074 @option{-fno-sched-stalled-insns-dep} is equivalent to
9075 @option{-fsched-stalled-insns-dep=0}.
9076 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9077 @option{-fsched-stalled-insns-dep=1}.
9078
9079 @item -fsched2-use-superblocks
9080 @opindex fsched2-use-superblocks
9081 When scheduling after register allocation, use superblock scheduling.
9082 This allows motion across basic block boundaries,
9083 resulting in faster schedules. This option is experimental, as not all machine
9084 descriptions used by GCC model the CPU closely enough to avoid unreliable
9085 results from the algorithm.
9086
9087 This only makes sense when scheduling after register allocation, i.e.@: with
9088 @option{-fschedule-insns2} or at @option{-O2} or higher.
9089
9090 @item -fsched-group-heuristic
9091 @opindex fsched-group-heuristic
9092 Enable the group heuristic in the scheduler. This heuristic favors
9093 the instruction that belongs to a schedule group. This is enabled
9094 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9095 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9096
9097 @item -fsched-critical-path-heuristic
9098 @opindex fsched-critical-path-heuristic
9099 Enable the critical-path heuristic in the scheduler. This heuristic favors
9100 instructions on the critical path. This is enabled by default when
9101 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9102 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9103
9104 @item -fsched-spec-insn-heuristic
9105 @opindex fsched-spec-insn-heuristic
9106 Enable the speculative instruction heuristic in the scheduler. This
9107 heuristic favors speculative instructions with greater dependency weakness.
9108 This is enabled by default when scheduling is enabled, i.e.@:
9109 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9110 or at @option{-O2} or higher.
9111
9112 @item -fsched-rank-heuristic
9113 @opindex fsched-rank-heuristic
9114 Enable the rank heuristic in the scheduler. This heuristic favors
9115 the instruction belonging to a basic block with greater size or frequency.
9116 This is enabled by default when scheduling is enabled, i.e.@:
9117 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9118 at @option{-O2} or higher.
9119
9120 @item -fsched-last-insn-heuristic
9121 @opindex fsched-last-insn-heuristic
9122 Enable the last-instruction heuristic in the scheduler. This heuristic
9123 favors the instruction that is less dependent on the last instruction
9124 scheduled. This is enabled by default when scheduling is enabled,
9125 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9126 at @option{-O2} or higher.
9127
9128 @item -fsched-dep-count-heuristic
9129 @opindex fsched-dep-count-heuristic
9130 Enable the dependent-count heuristic in the scheduler. This heuristic
9131 favors the instruction that has more instructions depending on it.
9132 This is enabled by default when scheduling is enabled, i.e.@:
9133 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9134 at @option{-O2} or higher.
9135
9136 @item -freschedule-modulo-scheduled-loops
9137 @opindex freschedule-modulo-scheduled-loops
9138 Modulo scheduling is performed before traditional scheduling. If a loop
9139 is modulo scheduled, later scheduling passes may change its schedule.
9140 Use this option to control that behavior.
9141
9142 @item -fselective-scheduling
9143 @opindex fselective-scheduling
9144 Schedule instructions using selective scheduling algorithm. Selective
9145 scheduling runs instead of the first scheduler pass.
9146
9147 @item -fselective-scheduling2
9148 @opindex fselective-scheduling2
9149 Schedule instructions using selective scheduling algorithm. Selective
9150 scheduling runs instead of the second scheduler pass.
9151
9152 @item -fsel-sched-pipelining
9153 @opindex fsel-sched-pipelining
9154 Enable software pipelining of innermost loops during selective scheduling.
9155 This option has no effect unless one of @option{-fselective-scheduling} or
9156 @option{-fselective-scheduling2} is turned on.
9157
9158 @item -fsel-sched-pipelining-outer-loops
9159 @opindex fsel-sched-pipelining-outer-loops
9160 When pipelining loops during selective scheduling, also pipeline outer loops.
9161 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9162
9163 @item -fsemantic-interposition
9164 @opindex fsemantic-interposition
9165 Some object formats, like ELF, allow interposing of symbols by the
9166 dynamic linker.
9167 This means that for symbols exported from the DSO, the compiler cannot perform
9168 interprocedural propagation, inlining and other optimizations in anticipation
9169 that the function or variable in question may change. While this feature is
9170 useful, for example, to rewrite memory allocation functions by a debugging
9171 implementation, it is expensive in the terms of code quality.
9172 With @option{-fno-semantic-interposition} the compiler assumes that
9173 if interposition happens for functions the overwriting function will have
9174 precisely the same semantics (and side effects).
9175 Similarly if interposition happens
9176 for variables, the constructor of the variable will be the same. The flag
9177 has no effect for functions explicitly declared inline
9178 (where it is never allowed for interposition to change semantics)
9179 and for symbols explicitly declared weak.
9180
9181 @item -fshrink-wrap
9182 @opindex fshrink-wrap
9183 Emit function prologues only before parts of the function that need it,
9184 rather than at the top of the function. This flag is enabled by default at
9185 @option{-O} and higher.
9186
9187 @item -fshrink-wrap-separate
9188 @opindex fshrink-wrap-separate
9189 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9190 those parts are only executed when needed.
9191 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9192 is also turned on and the target supports this.
9193
9194 @item -fcaller-saves
9195 @opindex fcaller-saves
9196 Enable allocation of values to registers that are clobbered by
9197 function calls, by emitting extra instructions to save and restore the
9198 registers around such calls. Such allocation is done only when it
9199 seems to result in better code.
9200
9201 This option is always enabled by default on certain machines, usually
9202 those which have no call-preserved registers to use instead.
9203
9204 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9205
9206 @item -fcombine-stack-adjustments
9207 @opindex fcombine-stack-adjustments
9208 Tracks stack adjustments (pushes and pops) and stack memory references
9209 and then tries to find ways to combine them.
9210
9211 Enabled by default at @option{-O1} and higher.
9212
9213 @item -fipa-ra
9214 @opindex fipa-ra
9215 Use caller save registers for allocation if those registers are not used by
9216 any called function. In that case it is not necessary to save and restore
9217 them around calls. This is only possible if called functions are part of
9218 same compilation unit as current function and they are compiled before it.
9219
9220 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9221 is disabled if generated code will be instrumented for profiling
9222 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9223 exactly (this happens on targets that do not expose prologues
9224 and epilogues in RTL).
9225
9226 @item -fconserve-stack
9227 @opindex fconserve-stack
9228 Attempt to minimize stack usage. The compiler attempts to use less
9229 stack space, even if that makes the program slower. This option
9230 implies setting the @option{large-stack-frame} parameter to 100
9231 and the @option{large-stack-frame-growth} parameter to 400.
9232
9233 @item -ftree-reassoc
9234 @opindex ftree-reassoc
9235 Perform reassociation on trees. This flag is enabled by default
9236 at @option{-O} and higher.
9237
9238 @item -fcode-hoisting
9239 @opindex fcode-hoisting
9240 Perform code hoisting. Code hoisting tries to move the
9241 evaluation of expressions executed on all paths to the function exit
9242 as early as possible. This is especially useful as a code size
9243 optimization, but it often helps for code speed as well.
9244 This flag is enabled by default at @option{-O2} and higher.
9245
9246 @item -ftree-pre
9247 @opindex ftree-pre
9248 Perform partial redundancy elimination (PRE) on trees. This flag is
9249 enabled by default at @option{-O2} and @option{-O3}.
9250
9251 @item -ftree-partial-pre
9252 @opindex ftree-partial-pre
9253 Make partial redundancy elimination (PRE) more aggressive. This flag is
9254 enabled by default at @option{-O3}.
9255
9256 @item -ftree-forwprop
9257 @opindex ftree-forwprop
9258 Perform forward propagation on trees. This flag is enabled by default
9259 at @option{-O} and higher.
9260
9261 @item -ftree-fre
9262 @opindex ftree-fre
9263 Perform full redundancy elimination (FRE) on trees. The difference
9264 between FRE and PRE is that FRE only considers expressions
9265 that are computed on all paths leading to the redundant computation.
9266 This analysis is faster than PRE, though it exposes fewer redundancies.
9267 This flag is enabled by default at @option{-O} and higher.
9268
9269 @item -ftree-phiprop
9270 @opindex ftree-phiprop
9271 Perform hoisting of loads from conditional pointers on trees. This
9272 pass is enabled by default at @option{-O} and higher.
9273
9274 @item -fhoist-adjacent-loads
9275 @opindex fhoist-adjacent-loads
9276 Speculatively hoist loads from both branches of an if-then-else if the
9277 loads are from adjacent locations in the same structure and the target
9278 architecture has a conditional move instruction. This flag is enabled
9279 by default at @option{-O2} and higher.
9280
9281 @item -ftree-copy-prop
9282 @opindex ftree-copy-prop
9283 Perform copy propagation on trees. This pass eliminates unnecessary
9284 copy operations. This flag is enabled by default at @option{-O} and
9285 higher.
9286
9287 @item -fipa-pure-const
9288 @opindex fipa-pure-const
9289 Discover which functions are pure or constant.
9290 Enabled by default at @option{-O} and higher.
9291
9292 @item -fipa-reference
9293 @opindex fipa-reference
9294 Discover which static variables do not escape the
9295 compilation unit.
9296 Enabled by default at @option{-O} and higher.
9297
9298 @item -fipa-reference-addressable
9299 @opindex fipa-reference-addressable
9300 Discover read-only, write-only and non-addressable static variables.
9301 Enabled by default at @option{-O} and higher.
9302
9303 @item -fipa-stack-alignment
9304 @opindex fipa-stack-alignment
9305 Reduce stack alignment on call sites if possible.
9306 Enabled by default.
9307
9308 @item -fipa-pta
9309 @opindex fipa-pta
9310 Perform interprocedural pointer analysis and interprocedural modification
9311 and reference analysis. This option can cause excessive memory and
9312 compile-time usage on large compilation units. It is not enabled by
9313 default at any optimization level.
9314
9315 @item -fipa-profile
9316 @opindex fipa-profile
9317 Perform interprocedural profile propagation. The functions called only from
9318 cold functions are marked as cold. Also functions executed once (such as
9319 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9320 functions and loop less parts of functions executed once are then optimized for
9321 size.
9322 Enabled by default at @option{-O} and higher.
9323
9324 @item -fipa-cp
9325 @opindex fipa-cp
9326 Perform interprocedural constant propagation.
9327 This optimization analyzes the program to determine when values passed
9328 to functions are constants and then optimizes accordingly.
9329 This optimization can substantially increase performance
9330 if the application has constants passed to functions.
9331 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9332 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9333
9334 @item -fipa-cp-clone
9335 @opindex fipa-cp-clone
9336 Perform function cloning to make interprocedural constant propagation stronger.
9337 When enabled, interprocedural constant propagation performs function cloning
9338 when externally visible function can be called with constant arguments.
9339 Because this optimization can create multiple copies of functions,
9340 it may significantly increase code size
9341 (see @option{--param ipcp-unit-growth=@var{value}}).
9342 This flag is enabled by default at @option{-O3}.
9343 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9344
9345 @item -fipa-bit-cp
9346 @opindex fipa-bit-cp
9347 When enabled, perform interprocedural bitwise constant
9348 propagation. This flag is enabled by default at @option{-O2} and
9349 by @option{-fprofile-use} and @option{-fauto-profile}.
9350 It requires that @option{-fipa-cp} is enabled.
9351
9352 @item -fipa-vrp
9353 @opindex fipa-vrp
9354 When enabled, perform interprocedural propagation of value
9355 ranges. This flag is enabled by default at @option{-O2}. It requires
9356 that @option{-fipa-cp} is enabled.
9357
9358 @item -fipa-icf
9359 @opindex fipa-icf
9360 Perform Identical Code Folding for functions and read-only variables.
9361 The optimization reduces code size and may disturb unwind stacks by replacing
9362 a function by equivalent one with a different name. The optimization works
9363 more effectively with link-time optimization enabled.
9364
9365 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9366 works on different levels and thus the optimizations are not same - there are
9367 equivalences that are found only by GCC and equivalences found only by Gold.
9368
9369 This flag is enabled by default at @option{-O2} and @option{-Os}.
9370
9371 @item -flive-patching=@var{level}
9372 @opindex flive-patching
9373 Control GCC's optimizations to produce output suitable for live-patching.
9374
9375 If the compiler's optimization uses a function's body or information extracted
9376 from its body to optimize/change another function, the latter is called an
9377 impacted function of the former. If a function is patched, its impacted
9378 functions should be patched too.
9379
9380 The impacted functions are determined by the compiler's interprocedural
9381 optimizations. For example, a caller is impacted when inlining a function
9382 into its caller,
9383 cloning a function and changing its caller to call this new clone,
9384 or extracting a function's pureness/constness information to optimize
9385 its direct or indirect callers, etc.
9386
9387 Usually, the more IPA optimizations enabled, the larger the number of
9388 impacted functions for each function. In order to control the number of
9389 impacted functions and more easily compute the list of impacted function,
9390 IPA optimizations can be partially enabled at two different levels.
9391
9392 The @var{level} argument should be one of the following:
9393
9394 @table @samp
9395
9396 @item inline-clone
9397
9398 Only enable inlining and cloning optimizations, which includes inlining,
9399 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9400 As a result, when patching a function, all its callers and its clones'
9401 callers are impacted, therefore need to be patched as well.
9402
9403 @option{-flive-patching=inline-clone} disables the following optimization flags:
9404 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9405 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9406 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9407 -fipa-stack-alignment}
9408
9409 @item inline-only-static
9410
9411 Only enable inlining of static functions.
9412 As a result, when patching a static function, all its callers are impacted
9413 and so need to be patched as well.
9414
9415 In addition to all the flags that @option{-flive-patching=inline-clone}
9416 disables,
9417 @option{-flive-patching=inline-only-static} disables the following additional
9418 optimization flags:
9419 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9420
9421 @end table
9422
9423 When @option{-flive-patching} is specified without any value, the default value
9424 is @var{inline-clone}.
9425
9426 This flag is disabled by default.
9427
9428 Note that @option{-flive-patching} is not supported with link-time optimization
9429 (@option{-flto}).
9430
9431 @item -fisolate-erroneous-paths-dereference
9432 @opindex fisolate-erroneous-paths-dereference
9433 Detect paths that trigger erroneous or undefined behavior due to
9434 dereferencing a null pointer. Isolate those paths from the main control
9435 flow and turn the statement with erroneous or undefined behavior into a trap.
9436 This flag is enabled by default at @option{-O2} and higher and depends on
9437 @option{-fdelete-null-pointer-checks} also being enabled.
9438
9439 @item -fisolate-erroneous-paths-attribute
9440 @opindex fisolate-erroneous-paths-attribute
9441 Detect paths that trigger erroneous or undefined behavior due to a null value
9442 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9443 attribute. Isolate those paths from the main control flow and turn the
9444 statement with erroneous or undefined behavior into a trap. This is not
9445 currently enabled, but may be enabled by @option{-O2} in the future.
9446
9447 @item -ftree-sink
9448 @opindex ftree-sink
9449 Perform forward store motion on trees. This flag is
9450 enabled by default at @option{-O} and higher.
9451
9452 @item -ftree-bit-ccp
9453 @opindex ftree-bit-ccp
9454 Perform sparse conditional bit constant propagation on trees and propagate
9455 pointer alignment information.
9456 This pass only operates on local scalar variables and is enabled by default
9457 at @option{-O1} and higher, except for @option{-Og}.
9458 It requires that @option{-ftree-ccp} is enabled.
9459
9460 @item -ftree-ccp
9461 @opindex ftree-ccp
9462 Perform sparse conditional constant propagation (CCP) on trees. This
9463 pass only operates on local scalar variables and is enabled by default
9464 at @option{-O} and higher.
9465
9466 @item -fssa-backprop
9467 @opindex fssa-backprop
9468 Propagate information about uses of a value up the definition chain
9469 in order to simplify the definitions. For example, this pass strips
9470 sign operations if the sign of a value never matters. The flag is
9471 enabled by default at @option{-O} and higher.
9472
9473 @item -fssa-phiopt
9474 @opindex fssa-phiopt
9475 Perform pattern matching on SSA PHI nodes to optimize conditional
9476 code. This pass is enabled by default at @option{-O1} and higher,
9477 except for @option{-Og}.
9478
9479 @item -ftree-switch-conversion
9480 @opindex ftree-switch-conversion
9481 Perform conversion of simple initializations in a switch to
9482 initializations from a scalar array. This flag is enabled by default
9483 at @option{-O2} and higher.
9484
9485 @item -ftree-tail-merge
9486 @opindex ftree-tail-merge
9487 Look for identical code sequences. When found, replace one with a jump to the
9488 other. This optimization is known as tail merging or cross jumping. This flag
9489 is enabled by default at @option{-O2} and higher. The compilation time
9490 in this pass can
9491 be limited using @option{max-tail-merge-comparisons} parameter and
9492 @option{max-tail-merge-iterations} parameter.
9493
9494 @item -ftree-dce
9495 @opindex ftree-dce
9496 Perform dead code elimination (DCE) on trees. This flag is enabled by
9497 default at @option{-O} and higher.
9498
9499 @item -ftree-builtin-call-dce
9500 @opindex ftree-builtin-call-dce
9501 Perform conditional dead code elimination (DCE) for calls to built-in functions
9502 that may set @code{errno} but are otherwise free of side effects. This flag is
9503 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9504 specified.
9505
9506 @item -ftree-dominator-opts
9507 @opindex ftree-dominator-opts
9508 Perform a variety of simple scalar cleanups (constant/copy
9509 propagation, redundancy elimination, range propagation and expression
9510 simplification) based on a dominator tree traversal. This also
9511 performs jump threading (to reduce jumps to jumps). This flag is
9512 enabled by default at @option{-O} and higher.
9513
9514 @item -ftree-dse
9515 @opindex ftree-dse
9516 Perform dead store elimination (DSE) on trees. A dead store is a store into
9517 a memory location that is later overwritten by another store without
9518 any intervening loads. In this case the earlier store can be deleted. This
9519 flag is enabled by default at @option{-O} and higher.
9520
9521 @item -ftree-ch
9522 @opindex ftree-ch
9523 Perform loop header copying on trees. This is beneficial since it increases
9524 effectiveness of code motion optimizations. It also saves one jump. This flag
9525 is enabled by default at @option{-O} and higher. It is not enabled
9526 for @option{-Os}, since it usually increases code size.
9527
9528 @item -ftree-loop-optimize
9529 @opindex ftree-loop-optimize
9530 Perform loop optimizations on trees. This flag is enabled by default
9531 at @option{-O} and higher.
9532
9533 @item -ftree-loop-linear
9534 @itemx -floop-strip-mine
9535 @itemx -floop-block
9536 @opindex ftree-loop-linear
9537 @opindex floop-strip-mine
9538 @opindex floop-block
9539 Perform loop nest optimizations. Same as
9540 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9541 to be configured with @option{--with-isl} to enable the Graphite loop
9542 transformation infrastructure.
9543
9544 @item -fgraphite-identity
9545 @opindex fgraphite-identity
9546 Enable the identity transformation for graphite. For every SCoP we generate
9547 the polyhedral representation and transform it back to gimple. Using
9548 @option{-fgraphite-identity} we can check the costs or benefits of the
9549 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9550 are also performed by the code generator isl, like index splitting and
9551 dead code elimination in loops.
9552
9553 @item -floop-nest-optimize
9554 @opindex floop-nest-optimize
9555 Enable the isl based loop nest optimizer. This is a generic loop nest
9556 optimizer based on the Pluto optimization algorithms. It calculates a loop
9557 structure optimized for data-locality and parallelism. This option
9558 is experimental.
9559
9560 @item -floop-parallelize-all
9561 @opindex floop-parallelize-all
9562 Use the Graphite data dependence analysis to identify loops that can
9563 be parallelized. Parallelize all the loops that can be analyzed to
9564 not contain loop carried dependences without checking that it is
9565 profitable to parallelize the loops.
9566
9567 @item -ftree-coalesce-vars
9568 @opindex ftree-coalesce-vars
9569 While transforming the program out of the SSA representation, attempt to
9570 reduce copying by coalescing versions of different user-defined
9571 variables, instead of just compiler temporaries. This may severely
9572 limit the ability to debug an optimized program compiled with
9573 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9574 prevents SSA coalescing of user variables. This option is enabled by
9575 default if optimization is enabled, and it does very little otherwise.
9576
9577 @item -ftree-loop-if-convert
9578 @opindex ftree-loop-if-convert
9579 Attempt to transform conditional jumps in the innermost loops to
9580 branch-less equivalents. The intent is to remove control-flow from
9581 the innermost loops in order to improve the ability of the
9582 vectorization pass to handle these loops. This is enabled by default
9583 if vectorization is enabled.
9584
9585 @item -ftree-loop-distribution
9586 @opindex ftree-loop-distribution
9587 Perform loop distribution. This flag can improve cache performance on
9588 big loop bodies and allow further loop optimizations, like
9589 parallelization or vectorization, to take place. For example, the loop
9590 @smallexample
9591 DO I = 1, N
9592 A(I) = B(I) + C
9593 D(I) = E(I) * F
9594 ENDDO
9595 @end smallexample
9596 is transformed to
9597 @smallexample
9598 DO I = 1, N
9599 A(I) = B(I) + C
9600 ENDDO
9601 DO I = 1, N
9602 D(I) = E(I) * F
9603 ENDDO
9604 @end smallexample
9605 This flag is enabled by default at @option{-O3}.
9606 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9607
9608 @item -ftree-loop-distribute-patterns
9609 @opindex ftree-loop-distribute-patterns
9610 Perform loop distribution of patterns that can be code generated with
9611 calls to a library. This flag is enabled by default at @option{-O3}, and
9612 by @option{-fprofile-use} and @option{-fauto-profile}.
9613
9614 This pass distributes the initialization loops and generates a call to
9615 memset zero. For example, the loop
9616 @smallexample
9617 DO I = 1, N
9618 A(I) = 0
9619 B(I) = A(I) + I
9620 ENDDO
9621 @end smallexample
9622 is transformed to
9623 @smallexample
9624 DO I = 1, N
9625 A(I) = 0
9626 ENDDO
9627 DO I = 1, N
9628 B(I) = A(I) + I
9629 ENDDO
9630 @end smallexample
9631 and the initialization loop is transformed into a call to memset zero.
9632 This flag is enabled by default at @option{-O3}.
9633 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9634
9635 @item -floop-interchange
9636 @opindex floop-interchange
9637 Perform loop interchange outside of graphite. This flag can improve cache
9638 performance on loop nest and allow further loop optimizations, like
9639 vectorization, to take place. For example, the loop
9640 @smallexample
9641 for (int i = 0; i < N; i++)
9642 for (int j = 0; j < N; j++)
9643 for (int k = 0; k < N; k++)
9644 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9645 @end smallexample
9646 is transformed to
9647 @smallexample
9648 for (int i = 0; i < N; i++)
9649 for (int k = 0; k < N; k++)
9650 for (int j = 0; j < N; j++)
9651 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9652 @end smallexample
9653 This flag is enabled by default at @option{-O3}.
9654 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9655
9656 @item -floop-unroll-and-jam
9657 @opindex floop-unroll-and-jam
9658 Apply unroll and jam transformations on feasible loops. In a loop
9659 nest this unrolls the outer loop by some factor and fuses the resulting
9660 multiple inner loops. This flag is enabled by default at @option{-O3}.
9661 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9662
9663 @item -ftree-loop-im
9664 @opindex ftree-loop-im
9665 Perform loop invariant motion on trees. This pass moves only invariants that
9666 are hard to handle at RTL level (function calls, operations that expand to
9667 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9668 operands of conditions that are invariant out of the loop, so that we can use
9669 just trivial invariantness analysis in loop unswitching. The pass also includes
9670 store motion.
9671
9672 @item -ftree-loop-ivcanon
9673 @opindex ftree-loop-ivcanon
9674 Create a canonical counter for number of iterations in loops for which
9675 determining number of iterations requires complicated analysis. Later
9676 optimizations then may determine the number easily. Useful especially
9677 in connection with unrolling.
9678
9679 @item -ftree-scev-cprop
9680 @opindex ftree-scev-cprop
9681 Perform final value replacement. If a variable is modified in a loop
9682 in such a way that its value when exiting the loop can be determined using
9683 only its initial value and the number of loop iterations, replace uses of
9684 the final value by such a computation, provided it is sufficiently cheap.
9685 This reduces data dependencies and may allow further simplifications.
9686 Enabled by default at @option{-O} and higher.
9687
9688 @item -fivopts
9689 @opindex fivopts
9690 Perform induction variable optimizations (strength reduction, induction
9691 variable merging and induction variable elimination) on trees.
9692
9693 @item -ftree-parallelize-loops=n
9694 @opindex ftree-parallelize-loops
9695 Parallelize loops, i.e., split their iteration space to run in n threads.
9696 This is only possible for loops whose iterations are independent
9697 and can be arbitrarily reordered. The optimization is only
9698 profitable on multiprocessor machines, for loops that are CPU-intensive,
9699 rather than constrained e.g.@: by memory bandwidth. This option
9700 implies @option{-pthread}, and thus is only supported on targets
9701 that have support for @option{-pthread}.
9702
9703 @item -ftree-pta
9704 @opindex ftree-pta
9705 Perform function-local points-to analysis on trees. This flag is
9706 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9707
9708 @item -ftree-sra
9709 @opindex ftree-sra
9710 Perform scalar replacement of aggregates. This pass replaces structure
9711 references with scalars to prevent committing structures to memory too
9712 early. This flag is enabled by default at @option{-O1} and higher,
9713 except for @option{-Og}.
9714
9715 @item -fstore-merging
9716 @opindex fstore-merging
9717 Perform merging of narrow stores to consecutive memory addresses. This pass
9718 merges contiguous stores of immediate values narrower than a word into fewer
9719 wider stores to reduce the number of instructions. This is enabled by default
9720 at @option{-O2} and higher as well as @option{-Os}.
9721
9722 @item -ftree-ter
9723 @opindex ftree-ter
9724 Perform temporary expression replacement during the SSA->normal phase. Single
9725 use/single def temporaries are replaced at their use location with their
9726 defining expression. This results in non-GIMPLE code, but gives the expanders
9727 much more complex trees to work on resulting in better RTL generation. This is
9728 enabled by default at @option{-O} and higher.
9729
9730 @item -ftree-slsr
9731 @opindex ftree-slsr
9732 Perform straight-line strength reduction on trees. This recognizes related
9733 expressions involving multiplications and replaces them by less expensive
9734 calculations when possible. This is enabled by default at @option{-O} and
9735 higher.
9736
9737 @item -ftree-vectorize
9738 @opindex ftree-vectorize
9739 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9740 and @option{-ftree-slp-vectorize} if not explicitly specified.
9741
9742 @item -ftree-loop-vectorize
9743 @opindex ftree-loop-vectorize
9744 Perform loop vectorization on trees. This flag is enabled by default at
9745 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9746 and @option{-fauto-profile}.
9747
9748 @item -ftree-slp-vectorize
9749 @opindex ftree-slp-vectorize
9750 Perform basic block vectorization on trees. This flag is enabled by default at
9751 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9752 and @option{-fauto-profile}.
9753
9754 @item -fvect-cost-model=@var{model}
9755 @opindex fvect-cost-model
9756 Alter the cost model used for vectorization. The @var{model} argument
9757 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9758 With the @samp{unlimited} model the vectorized code-path is assumed
9759 to be profitable while with the @samp{dynamic} model a runtime check
9760 guards the vectorized code-path to enable it only for iteration
9761 counts that will likely execute faster than when executing the original
9762 scalar loop. The @samp{cheap} model disables vectorization of
9763 loops where doing so would be cost prohibitive for example due to
9764 required runtime checks for data dependence or alignment but otherwise
9765 is equal to the @samp{dynamic} model.
9766 The default cost model depends on other optimization flags and is
9767 either @samp{dynamic} or @samp{cheap}.
9768
9769 @item -fsimd-cost-model=@var{model}
9770 @opindex fsimd-cost-model
9771 Alter the cost model used for vectorization of loops marked with the OpenMP
9772 simd directive. The @var{model} argument should be one of
9773 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9774 have the same meaning as described in @option{-fvect-cost-model} and by
9775 default a cost model defined with @option{-fvect-cost-model} is used.
9776
9777 @item -ftree-vrp
9778 @opindex ftree-vrp
9779 Perform Value Range Propagation on trees. This is similar to the
9780 constant propagation pass, but instead of values, ranges of values are
9781 propagated. This allows the optimizers to remove unnecessary range
9782 checks like array bound checks and null pointer checks. This is
9783 enabled by default at @option{-O2} and higher. Null pointer check
9784 elimination is only done if @option{-fdelete-null-pointer-checks} is
9785 enabled.
9786
9787 @item -fsplit-paths
9788 @opindex fsplit-paths
9789 Split paths leading to loop backedges. This can improve dead code
9790 elimination and common subexpression elimination. This is enabled by
9791 default at @option{-O3} and above.
9792
9793 @item -fsplit-ivs-in-unroller
9794 @opindex fsplit-ivs-in-unroller
9795 Enables expression of values of induction variables in later iterations
9796 of the unrolled loop using the value in the first iteration. This breaks
9797 long dependency chains, thus improving efficiency of the scheduling passes.
9798
9799 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9800 same effect. However, that is not reliable in cases where the loop body
9801 is more complicated than a single basic block. It also does not work at all
9802 on some architectures due to restrictions in the CSE pass.
9803
9804 This optimization is enabled by default.
9805
9806 @item -fvariable-expansion-in-unroller
9807 @opindex fvariable-expansion-in-unroller
9808 With this option, the compiler creates multiple copies of some
9809 local variables when unrolling a loop, which can result in superior code.
9810
9811 @item -fpartial-inlining
9812 @opindex fpartial-inlining
9813 Inline parts of functions. This option has any effect only
9814 when inlining itself is turned on by the @option{-finline-functions}
9815 or @option{-finline-small-functions} options.
9816
9817 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9818
9819 @item -fpredictive-commoning
9820 @opindex fpredictive-commoning
9821 Perform predictive commoning optimization, i.e., reusing computations
9822 (especially memory loads and stores) performed in previous
9823 iterations of loops.
9824
9825 This option is enabled at level @option{-O3}.
9826 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9827
9828 @item -fprefetch-loop-arrays
9829 @opindex fprefetch-loop-arrays
9830 If supported by the target machine, generate instructions to prefetch
9831 memory to improve the performance of loops that access large arrays.
9832
9833 This option may generate better or worse code; results are highly
9834 dependent on the structure of loops within the source code.
9835
9836 Disabled at level @option{-Os}.
9837
9838 @item -fno-printf-return-value
9839 @opindex fno-printf-return-value
9840 @opindex fprintf-return-value
9841 Do not substitute constants for known return value of formatted output
9842 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9843 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9844 transformation allows GCC to optimize or even eliminate branches based
9845 on the known return value of these functions called with arguments that
9846 are either constant, or whose values are known to be in a range that
9847 makes determining the exact return value possible. For example, when
9848 @option{-fprintf-return-value} is in effect, both the branch and the
9849 body of the @code{if} statement (but not the call to @code{snprint})
9850 can be optimized away when @code{i} is a 32-bit or smaller integer
9851 because the return value is guaranteed to be at most 8.
9852
9853 @smallexample
9854 char buf[9];
9855 if (snprintf (buf, "%08x", i) >= sizeof buf)
9856 @dots{}
9857 @end smallexample
9858
9859 The @option{-fprintf-return-value} option relies on other optimizations
9860 and yields best results with @option{-O2} and above. It works in tandem
9861 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9862 options. The @option{-fprintf-return-value} option is enabled by default.
9863
9864 @item -fno-peephole
9865 @itemx -fno-peephole2
9866 @opindex fno-peephole
9867 @opindex fpeephole
9868 @opindex fno-peephole2
9869 @opindex fpeephole2
9870 Disable any machine-specific peephole optimizations. The difference
9871 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9872 are implemented in the compiler; some targets use one, some use the
9873 other, a few use both.
9874
9875 @option{-fpeephole} is enabled by default.
9876 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9877
9878 @item -fno-guess-branch-probability
9879 @opindex fno-guess-branch-probability
9880 @opindex fguess-branch-probability
9881 Do not guess branch probabilities using heuristics.
9882
9883 GCC uses heuristics to guess branch probabilities if they are
9884 not provided by profiling feedback (@option{-fprofile-arcs}). These
9885 heuristics are based on the control flow graph. If some branch probabilities
9886 are specified by @code{__builtin_expect}, then the heuristics are
9887 used to guess branch probabilities for the rest of the control flow graph,
9888 taking the @code{__builtin_expect} info into account. The interactions
9889 between the heuristics and @code{__builtin_expect} can be complex, and in
9890 some cases, it may be useful to disable the heuristics so that the effects
9891 of @code{__builtin_expect} are easier to understand.
9892
9893 It is also possible to specify expected probability of the expression
9894 with @code{__builtin_expect_with_probability} built-in function.
9895
9896 The default is @option{-fguess-branch-probability} at levels
9897 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9898
9899 @item -freorder-blocks
9900 @opindex freorder-blocks
9901 Reorder basic blocks in the compiled function in order to reduce number of
9902 taken branches and improve code locality.
9903
9904 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9905
9906 @item -freorder-blocks-algorithm=@var{algorithm}
9907 @opindex freorder-blocks-algorithm
9908 Use the specified algorithm for basic block reordering. The
9909 @var{algorithm} argument can be @samp{simple}, which does not increase
9910 code size (except sometimes due to secondary effects like alignment),
9911 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9912 put all often executed code together, minimizing the number of branches
9913 executed by making extra copies of code.
9914
9915 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9916 @samp{stc} at levels @option{-O2}, @option{-O3}.
9917
9918 @item -freorder-blocks-and-partition
9919 @opindex freorder-blocks-and-partition
9920 In addition to reordering basic blocks in the compiled function, in order
9921 to reduce number of taken branches, partitions hot and cold basic blocks
9922 into separate sections of the assembly and @file{.o} files, to improve
9923 paging and cache locality performance.
9924
9925 This optimization is automatically turned off in the presence of
9926 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9927 section attribute and on any architecture that does not support named
9928 sections. When @option{-fsplit-stack} is used this option is not
9929 enabled by default (to avoid linker errors), but may be enabled
9930 explicitly (if using a working linker).
9931
9932 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9933
9934 @item -freorder-functions
9935 @opindex freorder-functions
9936 Reorder functions in the object file in order to
9937 improve code locality. This is implemented by using special
9938 subsections @code{.text.hot} for most frequently executed functions and
9939 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9940 the linker so object file format must support named sections and linker must
9941 place them in a reasonable way.
9942
9943 This option isn't effective unless you either provide profile feedback
9944 (see @option{-fprofile-arcs} for details) or manually annotate functions with
9945 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9946
9947 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9948
9949 @item -fstrict-aliasing
9950 @opindex fstrict-aliasing
9951 Allow the compiler to assume the strictest aliasing rules applicable to
9952 the language being compiled. For C (and C++), this activates
9953 optimizations based on the type of expressions. In particular, an
9954 object of one type is assumed never to reside at the same address as an
9955 object of a different type, unless the types are almost the same. For
9956 example, an @code{unsigned int} can alias an @code{int}, but not a
9957 @code{void*} or a @code{double}. A character type may alias any other
9958 type.
9959
9960 @anchor{Type-punning}Pay special attention to code like this:
9961 @smallexample
9962 union a_union @{
9963 int i;
9964 double d;
9965 @};
9966
9967 int f() @{
9968 union a_union t;
9969 t.d = 3.0;
9970 return t.i;
9971 @}
9972 @end smallexample
9973 The practice of reading from a different union member than the one most
9974 recently written to (called ``type-punning'') is common. Even with
9975 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9976 is accessed through the union type. So, the code above works as
9977 expected. @xref{Structures unions enumerations and bit-fields
9978 implementation}. However, this code might not:
9979 @smallexample
9980 int f() @{
9981 union a_union t;
9982 int* ip;
9983 t.d = 3.0;
9984 ip = &t.i;
9985 return *ip;
9986 @}
9987 @end smallexample
9988
9989 Similarly, access by taking the address, casting the resulting pointer
9990 and dereferencing the result has undefined behavior, even if the cast
9991 uses a union type, e.g.:
9992 @smallexample
9993 int f() @{
9994 double d = 3.0;
9995 return ((union a_union *) &d)->i;
9996 @}
9997 @end smallexample
9998
9999 The @option{-fstrict-aliasing} option is enabled at levels
10000 @option{-O2}, @option{-O3}, @option{-Os}.
10001
10002 @item -falign-functions
10003 @itemx -falign-functions=@var{n}
10004 @itemx -falign-functions=@var{n}:@var{m}
10005 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10006 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10007 @opindex falign-functions
10008 Align the start of functions to the next power-of-two greater than
10009 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10010 the first @var{m} bytes of the function can be fetched by the CPU
10011 without crossing an @var{n}-byte alignment boundary.
10012
10013 If @var{m} is not specified, it defaults to @var{n}.
10014
10015 Examples: @option{-falign-functions=32} aligns functions to the next
10016 32-byte boundary, @option{-falign-functions=24} aligns to the next
10017 32-byte boundary only if this can be done by skipping 23 bytes or less,
10018 @option{-falign-functions=32:7} aligns to the next
10019 32-byte boundary only if this can be done by skipping 6 bytes or less.
10020
10021 The second pair of @var{n2}:@var{m2} values allows you to specify
10022 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10023 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10024 otherwise aligns to the next 32-byte boundary if this can be done
10025 by skipping 2 bytes or less.
10026 If @var{m2} is not specified, it defaults to @var{n2}.
10027
10028 Some assemblers only support this flag when @var{n} is a power of two;
10029 in that case, it is rounded up.
10030
10031 @option{-fno-align-functions} and @option{-falign-functions=1} are
10032 equivalent and mean that functions are not aligned.
10033
10034 If @var{n} is not specified or is zero, use a machine-dependent default.
10035 The maximum allowed @var{n} option value is 65536.
10036
10037 Enabled at levels @option{-O2}, @option{-O3}.
10038
10039 @item -flimit-function-alignment
10040 If this option is enabled, the compiler tries to avoid unnecessarily
10041 overaligning functions. It attempts to instruct the assembler to align
10042 by the amount specified by @option{-falign-functions}, but not to
10043 skip more bytes than the size of the function.
10044
10045 @item -falign-labels
10046 @itemx -falign-labels=@var{n}
10047 @itemx -falign-labels=@var{n}:@var{m}
10048 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10049 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10050 @opindex falign-labels
10051 Align all branch targets to a power-of-two boundary.
10052
10053 Parameters of this option are analogous to the @option{-falign-functions} option.
10054 @option{-fno-align-labels} and @option{-falign-labels=1} are
10055 equivalent and mean that labels are not aligned.
10056
10057 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10058 are greater than this value, then their values are used instead.
10059
10060 If @var{n} is not specified or is zero, use a machine-dependent default
10061 which is very likely to be @samp{1}, meaning no alignment.
10062 The maximum allowed @var{n} option value is 65536.
10063
10064 Enabled at levels @option{-O2}, @option{-O3}.
10065
10066 @item -falign-loops
10067 @itemx -falign-loops=@var{n}
10068 @itemx -falign-loops=@var{n}:@var{m}
10069 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10070 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10071 @opindex falign-loops
10072 Align loops to a power-of-two boundary. If the loops are executed
10073 many times, this makes up for any execution of the dummy padding
10074 instructions.
10075
10076 Parameters of this option are analogous to the @option{-falign-functions} option.
10077 @option{-fno-align-loops} and @option{-falign-loops=1} are
10078 equivalent and mean that loops are not aligned.
10079 The maximum allowed @var{n} option value is 65536.
10080
10081 If @var{n} is not specified or is zero, use a machine-dependent default.
10082
10083 Enabled at levels @option{-O2}, @option{-O3}.
10084
10085 @item -falign-jumps
10086 @itemx -falign-jumps=@var{n}
10087 @itemx -falign-jumps=@var{n}:@var{m}
10088 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10089 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10090 @opindex falign-jumps
10091 Align branch targets to a power-of-two boundary, for branch targets
10092 where the targets can only be reached by jumping. In this case,
10093 no dummy operations need be executed.
10094
10095 Parameters of this option are analogous to the @option{-falign-functions} option.
10096 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10097 equivalent and mean that loops are not aligned.
10098
10099 If @var{n} is not specified or is zero, use a machine-dependent default.
10100 The maximum allowed @var{n} option value is 65536.
10101
10102 Enabled at levels @option{-O2}, @option{-O3}.
10103
10104 @item -funit-at-a-time
10105 @opindex funit-at-a-time
10106 This option is left for compatibility reasons. @option{-funit-at-a-time}
10107 has no effect, while @option{-fno-unit-at-a-time} implies
10108 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10109
10110 Enabled by default.
10111
10112 @item -fno-toplevel-reorder
10113 @opindex fno-toplevel-reorder
10114 @opindex ftoplevel-reorder
10115 Do not reorder top-level functions, variables, and @code{asm}
10116 statements. Output them in the same order that they appear in the
10117 input file. When this option is used, unreferenced static variables
10118 are not removed. This option is intended to support existing code
10119 that relies on a particular ordering. For new code, it is better to
10120 use attributes when possible.
10121
10122 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10123 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10124 Additionally @option{-fno-toplevel-reorder} implies
10125 @option{-fno-section-anchors}.
10126
10127 @item -fweb
10128 @opindex fweb
10129 Constructs webs as commonly used for register allocation purposes and assign
10130 each web individual pseudo register. This allows the register allocation pass
10131 to operate on pseudos directly, but also strengthens several other optimization
10132 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10133 however, make debugging impossible, since variables no longer stay in a
10134 ``home register''.
10135
10136 Enabled by default with @option{-funroll-loops}.
10137
10138 @item -fwhole-program
10139 @opindex fwhole-program
10140 Assume that the current compilation unit represents the whole program being
10141 compiled. All public functions and variables with the exception of @code{main}
10142 and those merged by attribute @code{externally_visible} become static functions
10143 and in effect are optimized more aggressively by interprocedural optimizers.
10144
10145 This option should not be used in combination with @option{-flto}.
10146 Instead relying on a linker plugin should provide safer and more precise
10147 information.
10148
10149 @item -flto[=@var{n}]
10150 @opindex flto
10151 This option runs the standard link-time optimizer. When invoked
10152 with source code, it generates GIMPLE (one of GCC's internal
10153 representations) and writes it to special ELF sections in the object
10154 file. When the object files are linked together, all the function
10155 bodies are read from these ELF sections and instantiated as if they
10156 had been part of the same translation unit.
10157
10158 To use the link-time optimizer, @option{-flto} and optimization
10159 options should be specified at compile time and during the final link.
10160 It is recommended that you compile all the files participating in the
10161 same link with the same options and also specify those options at
10162 link time.
10163 For example:
10164
10165 @smallexample
10166 gcc -c -O2 -flto foo.c
10167 gcc -c -O2 -flto bar.c
10168 gcc -o myprog -flto -O2 foo.o bar.o
10169 @end smallexample
10170
10171 The first two invocations to GCC save a bytecode representation
10172 of GIMPLE into special ELF sections inside @file{foo.o} and
10173 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10174 @file{foo.o} and @file{bar.o}, merges the two files into a single
10175 internal image, and compiles the result as usual. Since both
10176 @file{foo.o} and @file{bar.o} are merged into a single image, this
10177 causes all the interprocedural analyses and optimizations in GCC to
10178 work across the two files as if they were a single one. This means,
10179 for example, that the inliner is able to inline functions in
10180 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10181
10182 Another (simpler) way to enable link-time optimization is:
10183
10184 @smallexample
10185 gcc -o myprog -flto -O2 foo.c bar.c
10186 @end smallexample
10187
10188 The above generates bytecode for @file{foo.c} and @file{bar.c},
10189 merges them together into a single GIMPLE representation and optimizes
10190 them as usual to produce @file{myprog}.
10191
10192 The important thing to keep in mind is that to enable link-time
10193 optimizations you need to use the GCC driver to perform the link step.
10194 GCC automatically performs link-time optimization if any of the
10195 objects involved were compiled with the @option{-flto} command-line option.
10196 You can always override
10197 the automatic decision to do link-time optimization
10198 by passing @option{-fno-lto} to the link command.
10199
10200 To make whole program optimization effective, it is necessary to make
10201 certain whole program assumptions. The compiler needs to know
10202 what functions and variables can be accessed by libraries and runtime
10203 outside of the link-time optimized unit. When supported by the linker,
10204 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10205 to the compiler about used and externally visible symbols. When
10206 the linker plugin is not available, @option{-fwhole-program} should be
10207 used to allow the compiler to make these assumptions, which leads
10208 to more aggressive optimization decisions.
10209
10210 When a file is compiled with @option{-flto} without
10211 @option{-fuse-linker-plugin}, the generated object file is larger than
10212 a regular object file because it contains GIMPLE bytecodes and the usual
10213 final code (see @option{-ffat-lto-objects}. This means that
10214 object files with LTO information can be linked as normal object
10215 files; if @option{-fno-lto} is passed to the linker, no
10216 interprocedural optimizations are applied. Note that when
10217 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10218 but you cannot perform a regular, non-LTO link on them.
10219
10220 When producing the final binary, GCC only
10221 applies link-time optimizations to those files that contain bytecode.
10222 Therefore, you can mix and match object files and libraries with
10223 GIMPLE bytecodes and final object code. GCC automatically selects
10224 which files to optimize in LTO mode and which files to link without
10225 further processing.
10226
10227 Generally, options specified at link time override those
10228 specified at compile time, although in some cases GCC attempts to infer
10229 link-time options from the settings used to compile the input files.
10230
10231 If you do not specify an optimization level option @option{-O} at
10232 link time, then GCC uses the highest optimization level
10233 used when compiling the object files. Note that it is generally
10234 ineffective to specify an optimization level option only at link time and
10235 not at compile time, for two reasons. First, compiling without
10236 optimization suppresses compiler passes that gather information
10237 needed for effective optimization at link time. Second, some early
10238 optimization passes can be performed only at compile time and
10239 not at link time.
10240
10241 There are some code generation flags preserved by GCC when
10242 generating bytecodes, as they need to be used during the final link.
10243 Currently, the following options and their settings are taken from
10244 the first object file that explicitly specifies them:
10245 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10246 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10247 and all the @option{-m} target flags.
10248
10249 Certain ABI-changing flags are required to match in all compilation units,
10250 and trying to override this at link time with a conflicting value
10251 is ignored. This includes options such as @option{-freg-struct-return}
10252 and @option{-fpcc-struct-return}.
10253
10254 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10255 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10256 are passed through to the link stage and merged conservatively for
10257 conflicting translation units. Specifically
10258 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10259 precedence; and for example @option{-ffp-contract=off} takes precedence
10260 over @option{-ffp-contract=fast}. You can override them at link time.
10261
10262 If LTO encounters objects with C linkage declared with incompatible
10263 types in separate translation units to be linked together (undefined
10264 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10265 issued. The behavior is still undefined at run time. Similar
10266 diagnostics may be raised for other languages.
10267
10268 Another feature of LTO is that it is possible to apply interprocedural
10269 optimizations on files written in different languages:
10270
10271 @smallexample
10272 gcc -c -flto foo.c
10273 g++ -c -flto bar.cc
10274 gfortran -c -flto baz.f90
10275 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10276 @end smallexample
10277
10278 Notice that the final link is done with @command{g++} to get the C++
10279 runtime libraries and @option{-lgfortran} is added to get the Fortran
10280 runtime libraries. In general, when mixing languages in LTO mode, you
10281 should use the same link command options as when mixing languages in a
10282 regular (non-LTO) compilation.
10283
10284 If object files containing GIMPLE bytecode are stored in a library archive, say
10285 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10286 are using a linker with plugin support. To create static libraries suitable
10287 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10288 and @command{ranlib};
10289 to show the symbols of object files with GIMPLE bytecode, use
10290 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10291 and @command{nm} have been compiled with plugin support. At link time, use the
10292 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10293 the LTO optimization process:
10294
10295 @smallexample
10296 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10297 @end smallexample
10298
10299 With the linker plugin enabled, the linker extracts the needed
10300 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10301 to make them part of the aggregated GIMPLE image to be optimized.
10302
10303 If you are not using a linker with plugin support and/or do not
10304 enable the linker plugin, then the objects inside @file{libfoo.a}
10305 are extracted and linked as usual, but they do not participate
10306 in the LTO optimization process. In order to make a static library suitable
10307 for both LTO optimization and usual linkage, compile its object files with
10308 @option{-flto} @option{-ffat-lto-objects}.
10309
10310 Link-time optimizations do not require the presence of the whole program to
10311 operate. If the program does not require any symbols to be exported, it is
10312 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10313 the interprocedural optimizers to use more aggressive assumptions which may
10314 lead to improved optimization opportunities.
10315 Use of @option{-fwhole-program} is not needed when linker plugin is
10316 active (see @option{-fuse-linker-plugin}).
10317
10318 The current implementation of LTO makes no
10319 attempt to generate bytecode that is portable between different
10320 types of hosts. The bytecode files are versioned and there is a
10321 strict version check, so bytecode files generated in one version of
10322 GCC do not work with an older or newer version of GCC.
10323
10324 Link-time optimization does not work well with generation of debugging
10325 information on systems other than those using a combination of ELF and
10326 DWARF.
10327
10328 If you specify the optional @var{n}, the optimization and code
10329 generation done at link time is executed in parallel using @var{n}
10330 parallel jobs by utilizing an installed @command{make} program. The
10331 environment variable @env{MAKE} may be used to override the program
10332 used. The default value for @var{n} is 1.
10333
10334 You can also specify @option{-flto=jobserver} to use GNU make's
10335 job server mode to determine the number of parallel jobs. This
10336 is useful when the Makefile calling GCC is already executing in parallel.
10337 You must prepend a @samp{+} to the command recipe in the parent Makefile
10338 for this to work. This option likely only works if @env{MAKE} is
10339 GNU make.
10340
10341 @item -flto-partition=@var{alg}
10342 @opindex flto-partition
10343 Specify the partitioning algorithm used by the link-time optimizer.
10344 The value is either @samp{1to1} to specify a partitioning mirroring
10345 the original source files or @samp{balanced} to specify partitioning
10346 into equally sized chunks (whenever possible) or @samp{max} to create
10347 new partition for every symbol where possible. Specifying @samp{none}
10348 as an algorithm disables partitioning and streaming completely.
10349 The default value is @samp{balanced}. While @samp{1to1} can be used
10350 as an workaround for various code ordering issues, the @samp{max}
10351 partitioning is intended for internal testing only.
10352 The value @samp{one} specifies that exactly one partition should be
10353 used while the value @samp{none} bypasses partitioning and executes
10354 the link-time optimization step directly from the WPA phase.
10355
10356 @item -flto-odr-type-merging
10357 @opindex flto-odr-type-merging
10358 Enable streaming of mangled types names of C++ types and their unification
10359 at link time. This increases size of LTO object files, but enables
10360 diagnostics about One Definition Rule violations.
10361
10362 @item -flto-compression-level=@var{n}
10363 @opindex flto-compression-level
10364 This option specifies the level of compression used for intermediate
10365 language written to LTO object files, and is only meaningful in
10366 conjunction with LTO mode (@option{-flto}). Valid
10367 values are 0 (no compression) to 9 (maximum compression). Values
10368 outside this range are clamped to either 0 or 9. If the option is not
10369 given, a default balanced compression setting is used.
10370
10371 @item -fuse-linker-plugin
10372 @opindex fuse-linker-plugin
10373 Enables the use of a linker plugin during link-time optimization. This
10374 option relies on plugin support in the linker, which is available in gold
10375 or in GNU ld 2.21 or newer.
10376
10377 This option enables the extraction of object files with GIMPLE bytecode out
10378 of library archives. This improves the quality of optimization by exposing
10379 more code to the link-time optimizer. This information specifies what
10380 symbols can be accessed externally (by non-LTO object or during dynamic
10381 linking). Resulting code quality improvements on binaries (and shared
10382 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10383 See @option{-flto} for a description of the effect of this flag and how to
10384 use it.
10385
10386 This option is enabled by default when LTO support in GCC is enabled
10387 and GCC was configured for use with
10388 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10389
10390 @item -ffat-lto-objects
10391 @opindex ffat-lto-objects
10392 Fat LTO objects are object files that contain both the intermediate language
10393 and the object code. This makes them usable for both LTO linking and normal
10394 linking. This option is effective only when compiling with @option{-flto}
10395 and is ignored at link time.
10396
10397 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10398 requires the complete toolchain to be aware of LTO. It requires a linker with
10399 linker plugin support for basic functionality. Additionally,
10400 @command{nm}, @command{ar} and @command{ranlib}
10401 need to support linker plugins to allow a full-featured build environment
10402 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10403 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10404 to these tools. With non fat LTO makefiles need to be modified to use them.
10405
10406 Note that modern binutils provide plugin auto-load mechanism.
10407 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10408 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10409 @command{gcc-ranlib}).
10410
10411 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10412 support.
10413
10414 @item -fcompare-elim
10415 @opindex fcompare-elim
10416 After register allocation and post-register allocation instruction splitting,
10417 identify arithmetic instructions that compute processor flags similar to a
10418 comparison operation based on that arithmetic. If possible, eliminate the
10419 explicit comparison operation.
10420
10421 This pass only applies to certain targets that cannot explicitly represent
10422 the comparison operation before register allocation is complete.
10423
10424 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10425
10426 @item -fcprop-registers
10427 @opindex fcprop-registers
10428 After register allocation and post-register allocation instruction splitting,
10429 perform a copy-propagation pass to try to reduce scheduling dependencies
10430 and occasionally eliminate the copy.
10431
10432 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10433
10434 @item -fprofile-correction
10435 @opindex fprofile-correction
10436 Profiles collected using an instrumented binary for multi-threaded programs may
10437 be inconsistent due to missed counter updates. When this option is specified,
10438 GCC uses heuristics to correct or smooth out such inconsistencies. By
10439 default, GCC emits an error message when an inconsistent profile is detected.
10440
10441 This option is enabled by @option{-fauto-profile}.
10442
10443 @item -fprofile-use
10444 @itemx -fprofile-use=@var{path}
10445 @opindex fprofile-use
10446 Enable profile feedback-directed optimizations,
10447 and the following optimizations, many of which
10448 are generally profitable only with profile feedback available:
10449
10450 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10451 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10452 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10453 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10454 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10455 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10456 -fprofile-reorder-functions}
10457
10458 Before you can use this option, you must first generate profiling information.
10459 @xref{Instrumentation Options}, for information about the
10460 @option{-fprofile-generate} option.
10461
10462 By default, GCC emits an error message if the feedback profiles do not
10463 match the source code. This error can be turned into a warning by using
10464 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10465 optimized code. Additionally, by default, GCC also emits a warning message if
10466 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10467
10468 If @var{path} is specified, GCC looks at the @var{path} to find
10469 the profile feedback data files. See @option{-fprofile-dir}.
10470
10471 @item -fauto-profile
10472 @itemx -fauto-profile=@var{path}
10473 @opindex fauto-profile
10474 Enable sampling-based feedback-directed optimizations,
10475 and the following optimizations,
10476 many of which are generally profitable only with profile feedback available:
10477
10478 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10479 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10480 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10481 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10482 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10483 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10484 -fprofile-correction}
10485
10486 @var{path} is the name of a file containing AutoFDO profile information.
10487 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10488
10489 Producing an AutoFDO profile data file requires running your program
10490 with the @command{perf} utility on a supported GNU/Linux target system.
10491 For more information, see @uref{https://perf.wiki.kernel.org/}.
10492
10493 E.g.
10494 @smallexample
10495 perf record -e br_inst_retired:near_taken -b -o perf.data \
10496 -- your_program
10497 @end smallexample
10498
10499 Then use the @command{create_gcov} tool to convert the raw profile data
10500 to a format that can be used by GCC.@ You must also supply the
10501 unstripped binary for your program to this tool.
10502 See @uref{https://github.com/google/autofdo}.
10503
10504 E.g.
10505 @smallexample
10506 create_gcov --binary=your_program.unstripped --profile=perf.data \
10507 --gcov=profile.afdo
10508 @end smallexample
10509 @end table
10510
10511 The following options control compiler behavior regarding floating-point
10512 arithmetic. These options trade off between speed and
10513 correctness. All must be specifically enabled.
10514
10515 @table @gcctabopt
10516 @item -ffloat-store
10517 @opindex ffloat-store
10518 Do not store floating-point variables in registers, and inhibit other
10519 options that might change whether a floating-point value is taken from a
10520 register or memory.
10521
10522 @cindex floating-point precision
10523 This option prevents undesirable excess precision on machines such as
10524 the 68000 where the floating registers (of the 68881) keep more
10525 precision than a @code{double} is supposed to have. Similarly for the
10526 x86 architecture. For most programs, the excess precision does only
10527 good, but a few programs rely on the precise definition of IEEE floating
10528 point. Use @option{-ffloat-store} for such programs, after modifying
10529 them to store all pertinent intermediate computations into variables.
10530
10531 @item -fexcess-precision=@var{style}
10532 @opindex fexcess-precision
10533 This option allows further control over excess precision on machines
10534 where floating-point operations occur in a format with more precision or
10535 range than the IEEE standard and interchange floating-point types. By
10536 default, @option{-fexcess-precision=fast} is in effect; this means that
10537 operations may be carried out in a wider precision than the types specified
10538 in the source if that would result in faster code, and it is unpredictable
10539 when rounding to the types specified in the source code takes place.
10540 When compiling C, if @option{-fexcess-precision=standard} is specified then
10541 excess precision follows the rules specified in ISO C99; in particular,
10542 both casts and assignments cause values to be rounded to their
10543 semantic types (whereas @option{-ffloat-store} only affects
10544 assignments). This option is enabled by default for C if a strict
10545 conformance option such as @option{-std=c99} is used.
10546 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10547 regardless of whether a strict conformance option is used.
10548
10549 @opindex mfpmath
10550 @option{-fexcess-precision=standard} is not implemented for languages
10551 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10552 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10553 semantics apply without excess precision, and in the latter, rounding
10554 is unpredictable.
10555
10556 @item -ffast-math
10557 @opindex ffast-math
10558 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10559 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10560 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10561 @option{-fexcess-precision=fast}.
10562
10563 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10564
10565 This option is not turned on by any @option{-O} option besides
10566 @option{-Ofast} since it can result in incorrect output for programs
10567 that depend on an exact implementation of IEEE or ISO rules/specifications
10568 for math functions. It may, however, yield faster code for programs
10569 that do not require the guarantees of these specifications.
10570
10571 @item -fno-math-errno
10572 @opindex fno-math-errno
10573 @opindex fmath-errno
10574 Do not set @code{errno} after calling math functions that are executed
10575 with a single instruction, e.g., @code{sqrt}. A program that relies on
10576 IEEE exceptions for math error handling may want to use this flag
10577 for speed while maintaining IEEE arithmetic compatibility.
10578
10579 This option is not turned on by any @option{-O} option since
10580 it can result in incorrect output for programs that depend on
10581 an exact implementation of IEEE or ISO rules/specifications for
10582 math functions. It may, however, yield faster code for programs
10583 that do not require the guarantees of these specifications.
10584
10585 The default is @option{-fmath-errno}.
10586
10587 On Darwin systems, the math library never sets @code{errno}. There is
10588 therefore no reason for the compiler to consider the possibility that
10589 it might, and @option{-fno-math-errno} is the default.
10590
10591 @item -funsafe-math-optimizations
10592 @opindex funsafe-math-optimizations
10593
10594 Allow optimizations for floating-point arithmetic that (a) assume
10595 that arguments and results are valid and (b) may violate IEEE or
10596 ANSI standards. When used at link time, it may include libraries
10597 or startup files that change the default FPU control word or other
10598 similar optimizations.
10599
10600 This option is not turned on by any @option{-O} option since
10601 it can result in incorrect output for programs that depend on
10602 an exact implementation of IEEE or ISO rules/specifications for
10603 math functions. It may, however, yield faster code for programs
10604 that do not require the guarantees of these specifications.
10605 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10606 @option{-fassociative-math} and @option{-freciprocal-math}.
10607
10608 The default is @option{-fno-unsafe-math-optimizations}.
10609
10610 @item -fassociative-math
10611 @opindex fassociative-math
10612
10613 Allow re-association of operands in series of floating-point operations.
10614 This violates the ISO C and C++ language standard by possibly changing
10615 computation result. NOTE: re-ordering may change the sign of zero as
10616 well as ignore NaNs and inhibit or create underflow or overflow (and
10617 thus cannot be used on code that relies on rounding behavior like
10618 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10619 and thus may not be used when ordered comparisons are required.
10620 This option requires that both @option{-fno-signed-zeros} and
10621 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10622 much sense with @option{-frounding-math}. For Fortran the option
10623 is automatically enabled when both @option{-fno-signed-zeros} and
10624 @option{-fno-trapping-math} are in effect.
10625
10626 The default is @option{-fno-associative-math}.
10627
10628 @item -freciprocal-math
10629 @opindex freciprocal-math
10630
10631 Allow the reciprocal of a value to be used instead of dividing by
10632 the value if this enables optimizations. For example @code{x / y}
10633 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10634 is subject to common subexpression elimination. Note that this loses
10635 precision and increases the number of flops operating on the value.
10636
10637 The default is @option{-fno-reciprocal-math}.
10638
10639 @item -ffinite-math-only
10640 @opindex ffinite-math-only
10641 Allow optimizations for floating-point arithmetic that assume
10642 that arguments and results are not NaNs or +-Infs.
10643
10644 This option is not turned on by any @option{-O} option since
10645 it can result in incorrect output for programs that depend on
10646 an exact implementation of IEEE or ISO rules/specifications for
10647 math functions. It may, however, yield faster code for programs
10648 that do not require the guarantees of these specifications.
10649
10650 The default is @option{-fno-finite-math-only}.
10651
10652 @item -fno-signed-zeros
10653 @opindex fno-signed-zeros
10654 @opindex fsigned-zeros
10655 Allow optimizations for floating-point arithmetic that ignore the
10656 signedness of zero. IEEE arithmetic specifies the behavior of
10657 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10658 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10659 This option implies that the sign of a zero result isn't significant.
10660
10661 The default is @option{-fsigned-zeros}.
10662
10663 @item -fno-trapping-math
10664 @opindex fno-trapping-math
10665 @opindex ftrapping-math
10666 Compile code assuming that floating-point operations cannot generate
10667 user-visible traps. These traps include division by zero, overflow,
10668 underflow, inexact result and invalid operation. This option requires
10669 that @option{-fno-signaling-nans} be in effect. Setting this option may
10670 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10671
10672 This option should never be turned on by any @option{-O} option since
10673 it can result in incorrect output for programs that depend on
10674 an exact implementation of IEEE or ISO rules/specifications for
10675 math functions.
10676
10677 The default is @option{-ftrapping-math}.
10678
10679 @item -frounding-math
10680 @opindex frounding-math
10681 Disable transformations and optimizations that assume default floating-point
10682 rounding behavior. This is round-to-zero for all floating point
10683 to integer conversions, and round-to-nearest for all other arithmetic
10684 truncations. This option should be specified for programs that change
10685 the FP rounding mode dynamically, or that may be executed with a
10686 non-default rounding mode. This option disables constant folding of
10687 floating-point expressions at compile time (which may be affected by
10688 rounding mode) and arithmetic transformations that are unsafe in the
10689 presence of sign-dependent rounding modes.
10690
10691 The default is @option{-fno-rounding-math}.
10692
10693 This option is experimental and does not currently guarantee to
10694 disable all GCC optimizations that are affected by rounding mode.
10695 Future versions of GCC may provide finer control of this setting
10696 using C99's @code{FENV_ACCESS} pragma. This command-line option
10697 will be used to specify the default state for @code{FENV_ACCESS}.
10698
10699 @item -fsignaling-nans
10700 @opindex fsignaling-nans
10701 Compile code assuming that IEEE signaling NaNs may generate user-visible
10702 traps during floating-point operations. Setting this option disables
10703 optimizations that may change the number of exceptions visible with
10704 signaling NaNs. This option implies @option{-ftrapping-math}.
10705
10706 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10707 be defined.
10708
10709 The default is @option{-fno-signaling-nans}.
10710
10711 This option is experimental and does not currently guarantee to
10712 disable all GCC optimizations that affect signaling NaN behavior.
10713
10714 @item -fno-fp-int-builtin-inexact
10715 @opindex fno-fp-int-builtin-inexact
10716 @opindex ffp-int-builtin-inexact
10717 Do not allow the built-in functions @code{ceil}, @code{floor},
10718 @code{round} and @code{trunc}, and their @code{float} and @code{long
10719 double} variants, to generate code that raises the ``inexact''
10720 floating-point exception for noninteger arguments. ISO C99 and C11
10721 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10722 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10723 functions to do so.
10724
10725 The default is @option{-ffp-int-builtin-inexact}, allowing the
10726 exception to be raised. This option does nothing unless
10727 @option{-ftrapping-math} is in effect.
10728
10729 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10730 generate a call to a library function then the ``inexact'' exception
10731 may be raised if the library implementation does not follow TS 18661.
10732
10733 @item -fsingle-precision-constant
10734 @opindex fsingle-precision-constant
10735 Treat floating-point constants as single precision instead of
10736 implicitly converting them to double-precision constants.
10737
10738 @item -fcx-limited-range
10739 @opindex fcx-limited-range
10740 When enabled, this option states that a range reduction step is not
10741 needed when performing complex division. Also, there is no checking
10742 whether the result of a complex multiplication or division is @code{NaN
10743 + I*NaN}, with an attempt to rescue the situation in that case. The
10744 default is @option{-fno-cx-limited-range}, but is enabled by
10745 @option{-ffast-math}.
10746
10747 This option controls the default setting of the ISO C99
10748 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10749 all languages.
10750
10751 @item -fcx-fortran-rules
10752 @opindex fcx-fortran-rules
10753 Complex multiplication and division follow Fortran rules. Range
10754 reduction is done as part of complex division, but there is no checking
10755 whether the result of a complex multiplication or division is @code{NaN
10756 + I*NaN}, with an attempt to rescue the situation in that case.
10757
10758 The default is @option{-fno-cx-fortran-rules}.
10759
10760 @end table
10761
10762 The following options control optimizations that may improve
10763 performance, but are not enabled by any @option{-O} options. This
10764 section includes experimental options that may produce broken code.
10765
10766 @table @gcctabopt
10767 @item -fbranch-probabilities
10768 @opindex fbranch-probabilities
10769 After running a program compiled with @option{-fprofile-arcs}
10770 (@pxref{Instrumentation Options}),
10771 you can compile it a second time using
10772 @option{-fbranch-probabilities}, to improve optimizations based on
10773 the number of times each branch was taken. When a program
10774 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10775 counts to a file called @file{@var{sourcename}.gcda} for each source
10776 file. The information in this data file is very dependent on the
10777 structure of the generated code, so you must use the same source code
10778 and the same optimization options for both compilations.
10779
10780 With @option{-fbranch-probabilities}, GCC puts a
10781 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10782 These can be used to improve optimization. Currently, they are only
10783 used in one place: in @file{reorg.c}, instead of guessing which path a
10784 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10785 exactly determine which path is taken more often.
10786
10787 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10788
10789 @item -fprofile-values
10790 @opindex fprofile-values
10791 If combined with @option{-fprofile-arcs}, it adds code so that some
10792 data about values of expressions in the program is gathered.
10793
10794 With @option{-fbranch-probabilities}, it reads back the data gathered
10795 from profiling values of expressions for usage in optimizations.
10796
10797 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10798 @option{-fauto-profile}.
10799
10800 @item -fprofile-reorder-functions
10801 @opindex fprofile-reorder-functions
10802 Function reordering based on profile instrumentation collects
10803 first time of execution of a function and orders these functions
10804 in ascending order.
10805
10806 Enabled with @option{-fprofile-use}.
10807
10808 @item -fvpt
10809 @opindex fvpt
10810 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10811 to add code to gather information about values of expressions.
10812
10813 With @option{-fbranch-probabilities}, it reads back the data gathered
10814 and actually performs the optimizations based on them.
10815 Currently the optimizations include specialization of division operations
10816 using the knowledge about the value of the denominator.
10817
10818 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10819
10820 @item -frename-registers
10821 @opindex frename-registers
10822 Attempt to avoid false dependencies in scheduled code by making use
10823 of registers left over after register allocation. This optimization
10824 most benefits processors with lots of registers. Depending on the
10825 debug information format adopted by the target, however, it can
10826 make debugging impossible, since variables no longer stay in
10827 a ``home register''.
10828
10829 Enabled by default with @option{-funroll-loops}.
10830
10831 @item -fschedule-fusion
10832 @opindex fschedule-fusion
10833 Performs a target dependent pass over the instruction stream to schedule
10834 instructions of same type together because target machine can execute them
10835 more efficiently if they are adjacent to each other in the instruction flow.
10836
10837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10838
10839 @item -ftracer
10840 @opindex ftracer
10841 Perform tail duplication to enlarge superblock size. This transformation
10842 simplifies the control flow of the function allowing other optimizations to do
10843 a better job.
10844
10845 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10846
10847 @item -funroll-loops
10848 @opindex funroll-loops
10849 Unroll loops whose number of iterations can be determined at compile time or
10850 upon entry to the loop. @option{-funroll-loops} implies
10851 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10852 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10853 a small constant number of iterations). This option makes code larger, and may
10854 or may not make it run faster.
10855
10856 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10857
10858 @item -funroll-all-loops
10859 @opindex funroll-all-loops
10860 Unroll all loops, even if their number of iterations is uncertain when
10861 the loop is entered. This usually makes programs run more slowly.
10862 @option{-funroll-all-loops} implies the same options as
10863 @option{-funroll-loops}.
10864
10865 @item -fpeel-loops
10866 @opindex fpeel-loops
10867 Peels loops for which there is enough information that they do not
10868 roll much (from profile feedback or static analysis). It also turns on
10869 complete loop peeling (i.e.@: complete removal of loops with small constant
10870 number of iterations).
10871
10872 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10873
10874 @item -fmove-loop-invariants
10875 @opindex fmove-loop-invariants
10876 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10877 at level @option{-O1} and higher, except for @option{-Og}.
10878
10879 @item -fsplit-loops
10880 @opindex fsplit-loops
10881 Split a loop into two if it contains a condition that's always true
10882 for one side of the iteration space and false for the other.
10883
10884 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10885
10886 @item -funswitch-loops
10887 @opindex funswitch-loops
10888 Move branches with loop invariant conditions out of the loop, with duplicates
10889 of the loop on both branches (modified according to result of the condition).
10890
10891 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10892
10893 @item -fversion-loops-for-strides
10894 @opindex fversion-loops-for-strides
10895 If a loop iterates over an array with a variable stride, create another
10896 version of the loop that assumes the stride is always one. For example:
10897
10898 @smallexample
10899 for (int i = 0; i < n; ++i)
10900 x[i * stride] = @dots{};
10901 @end smallexample
10902
10903 becomes:
10904
10905 @smallexample
10906 if (stride == 1)
10907 for (int i = 0; i < n; ++i)
10908 x[i] = @dots{};
10909 else
10910 for (int i = 0; i < n; ++i)
10911 x[i * stride] = @dots{};
10912 @end smallexample
10913
10914 This is particularly useful for assumed-shape arrays in Fortran where
10915 (for example) it allows better vectorization assuming contiguous accesses.
10916 This flag is enabled by default at @option{-O3}.
10917 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10918
10919 @item -ffunction-sections
10920 @itemx -fdata-sections
10921 @opindex ffunction-sections
10922 @opindex fdata-sections
10923 Place each function or data item into its own section in the output
10924 file if the target supports arbitrary sections. The name of the
10925 function or the name of the data item determines the section's name
10926 in the output file.
10927
10928 Use these options on systems where the linker can perform optimizations to
10929 improve locality of reference in the instruction space. Most systems using the
10930 ELF object format have linkers with such optimizations. On AIX, the linker
10931 rearranges sections (CSECTs) based on the call graph. The performance impact
10932 varies.
10933
10934 Together with a linker garbage collection (linker @option{--gc-sections}
10935 option) these options may lead to smaller statically-linked executables (after
10936 stripping).
10937
10938 On ELF/DWARF systems these options do not degenerate the quality of the debug
10939 information. There could be issues with other object files/debug info formats.
10940
10941 Only use these options when there are significant benefits from doing so. When
10942 you specify these options, the assembler and linker create larger object and
10943 executable files and are also slower. These options affect code generation.
10944 They prevent optimizations by the compiler and assembler using relative
10945 locations inside a translation unit since the locations are unknown until
10946 link time. An example of such an optimization is relaxing calls to short call
10947 instructions.
10948
10949 @item -fbranch-target-load-optimize
10950 @opindex fbranch-target-load-optimize
10951 Perform branch target register load optimization before prologue / epilogue
10952 threading.
10953 The use of target registers can typically be exposed only during reload,
10954 thus hoisting loads out of loops and doing inter-block scheduling needs
10955 a separate optimization pass.
10956
10957 @item -fbranch-target-load-optimize2
10958 @opindex fbranch-target-load-optimize2
10959 Perform branch target register load optimization after prologue / epilogue
10960 threading.
10961
10962 @item -fbtr-bb-exclusive
10963 @opindex fbtr-bb-exclusive
10964 When performing branch target register load optimization, don't reuse
10965 branch target registers within any basic block.
10966
10967 @item -fstdarg-opt
10968 @opindex fstdarg-opt
10969 Optimize the prologue of variadic argument functions with respect to usage of
10970 those arguments.
10971
10972 @item -fsection-anchors
10973 @opindex fsection-anchors
10974 Try to reduce the number of symbolic address calculations by using
10975 shared ``anchor'' symbols to address nearby objects. This transformation
10976 can help to reduce the number of GOT entries and GOT accesses on some
10977 targets.
10978
10979 For example, the implementation of the following function @code{foo}:
10980
10981 @smallexample
10982 static int a, b, c;
10983 int foo (void) @{ return a + b + c; @}
10984 @end smallexample
10985
10986 @noindent
10987 usually calculates the addresses of all three variables, but if you
10988 compile it with @option{-fsection-anchors}, it accesses the variables
10989 from a common anchor point instead. The effect is similar to the
10990 following pseudocode (which isn't valid C):
10991
10992 @smallexample
10993 int foo (void)
10994 @{
10995 register int *xr = &x;
10996 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10997 @}
10998 @end smallexample
10999
11000 Not all targets support this option.
11001
11002 @item --param @var{name}=@var{value}
11003 @opindex param
11004 In some places, GCC uses various constants to control the amount of
11005 optimization that is done. For example, GCC does not inline functions
11006 that contain more than a certain number of instructions. You can
11007 control some of these constants on the command line using the
11008 @option{--param} option.
11009
11010 The names of specific parameters, and the meaning of the values, are
11011 tied to the internals of the compiler, and are subject to change
11012 without notice in future releases.
11013
11014 In order to get minimal, maximal and default value of a parameter,
11015 one can use @option{--help=param -Q} options.
11016
11017 In each case, the @var{value} is an integer. The allowable choices for
11018 @var{name} are:
11019
11020 @table @gcctabopt
11021 @item predictable-branch-outcome
11022 When branch is predicted to be taken with probability lower than this threshold
11023 (in percent), then it is considered well predictable.
11024
11025 @item max-rtl-if-conversion-insns
11026 RTL if-conversion tries to remove conditional branches around a block and
11027 replace them with conditionally executed instructions. This parameter
11028 gives the maximum number of instructions in a block which should be
11029 considered for if-conversion. The compiler will
11030 also use other heuristics to decide whether if-conversion is likely to be
11031 profitable.
11032
11033 @item max-rtl-if-conversion-predictable-cost
11034 @itemx max-rtl-if-conversion-unpredictable-cost
11035 RTL if-conversion will try to remove conditional branches around a block
11036 and replace them with conditionally executed instructions. These parameters
11037 give the maximum permissible cost for the sequence that would be generated
11038 by if-conversion depending on whether the branch is statically determined
11039 to be predictable or not. The units for this parameter are the same as
11040 those for the GCC internal seq_cost metric. The compiler will try to
11041 provide a reasonable default for this parameter using the BRANCH_COST
11042 target macro.
11043
11044 @item max-crossjump-edges
11045 The maximum number of incoming edges to consider for cross-jumping.
11046 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11047 the number of edges incoming to each block. Increasing values mean
11048 more aggressive optimization, making the compilation time increase with
11049 probably small improvement in executable size.
11050
11051 @item min-crossjump-insns
11052 The minimum number of instructions that must be matched at the end
11053 of two blocks before cross-jumping is performed on them. This
11054 value is ignored in the case where all instructions in the block being
11055 cross-jumped from are matched.
11056
11057 @item max-grow-copy-bb-insns
11058 The maximum code size expansion factor when copying basic blocks
11059 instead of jumping. The expansion is relative to a jump instruction.
11060
11061 @item max-goto-duplication-insns
11062 The maximum number of instructions to duplicate to a block that jumps
11063 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11064 passes, GCC factors computed gotos early in the compilation process,
11065 and unfactors them as late as possible. Only computed jumps at the
11066 end of a basic blocks with no more than max-goto-duplication-insns are
11067 unfactored.
11068
11069 @item max-delay-slot-insn-search
11070 The maximum number of instructions to consider when looking for an
11071 instruction to fill a delay slot. If more than this arbitrary number of
11072 instructions are searched, the time savings from filling the delay slot
11073 are minimal, so stop searching. Increasing values mean more
11074 aggressive optimization, making the compilation time increase with probably
11075 small improvement in execution time.
11076
11077 @item max-delay-slot-live-search
11078 When trying to fill delay slots, the maximum number of instructions to
11079 consider when searching for a block with valid live register
11080 information. Increasing this arbitrarily chosen value means more
11081 aggressive optimization, increasing the compilation time. This parameter
11082 should be removed when the delay slot code is rewritten to maintain the
11083 control-flow graph.
11084
11085 @item max-gcse-memory
11086 The approximate maximum amount of memory that can be allocated in
11087 order to perform the global common subexpression elimination
11088 optimization. If more memory than specified is required, the
11089 optimization is not done.
11090
11091 @item max-gcse-insertion-ratio
11092 If the ratio of expression insertions to deletions is larger than this value
11093 for any expression, then RTL PRE inserts or removes the expression and thus
11094 leaves partially redundant computations in the instruction stream.
11095
11096 @item max-pending-list-length
11097 The maximum number of pending dependencies scheduling allows
11098 before flushing the current state and starting over. Large functions
11099 with few branches or calls can create excessively large lists which
11100 needlessly consume memory and resources.
11101
11102 @item max-modulo-backtrack-attempts
11103 The maximum number of backtrack attempts the scheduler should make
11104 when modulo scheduling a loop. Larger values can exponentially increase
11105 compilation time.
11106
11107 @item max-inline-insns-single
11108 Several parameters control the tree inliner used in GCC@.
11109 This number sets the maximum number of instructions (counted in GCC's
11110 internal representation) in a single function that the tree inliner
11111 considers for inlining. This only affects functions declared
11112 inline and methods implemented in a class declaration (C++).
11113
11114 @item max-inline-insns-auto
11115 When you use @option{-finline-functions} (included in @option{-O3}),
11116 a lot of functions that would otherwise not be considered for inlining
11117 by the compiler are investigated. To those functions, a different
11118 (more restrictive) limit compared to functions declared inline can
11119 be applied.
11120
11121 @item max-inline-insns-small
11122 This is bound applied to calls which are considered relevant with
11123 @option{-finline-small-functions}.
11124
11125 @item max-inline-insns-size
11126 This is bound applied to calls which are optimized for size. Small growth
11127 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11128
11129 @item uninlined-function-insns
11130 Number of instructions accounted by inliner for function overhead such as
11131 function prologue and epilogue.
11132
11133 @item uninlined-function-time
11134 Extra time accounted by inliner for function overhead such as time needed to
11135 execute function prologue and epilogue
11136
11137 @item uninlined-thunk-insns
11138 @item uninlined-thunk-time
11139 Same as @option{--param uninlined-function-insns} and
11140 @option{--param uninlined-function-time} but applied to function thunks
11141
11142 @item inline-min-speedup
11143 When estimated performance improvement of caller + callee runtime exceeds this
11144 threshold (in percent), the function can be inlined regardless of the limit on
11145 @option{--param max-inline-insns-single} and @option{--param
11146 max-inline-insns-auto}.
11147
11148 @item large-function-insns
11149 The limit specifying really large functions. For functions larger than this
11150 limit after inlining, inlining is constrained by
11151 @option{--param large-function-growth}. This parameter is useful primarily
11152 to avoid extreme compilation time caused by non-linear algorithms used by the
11153 back end.
11154
11155 @item large-function-growth
11156 Specifies maximal growth of large function caused by inlining in percents.
11157 For example, parameter value 100 limits large function growth to 2.0 times
11158 the original size.
11159
11160 @item large-unit-insns
11161 The limit specifying large translation unit. Growth caused by inlining of
11162 units larger than this limit is limited by @option{--param inline-unit-growth}.
11163 For small units this might be too tight.
11164 For example, consider a unit consisting of function A
11165 that is inline and B that just calls A three times. If B is small relative to
11166 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11167 large units consisting of small inlineable functions, however, the overall unit
11168 growth limit is needed to avoid exponential explosion of code size. Thus for
11169 smaller units, the size is increased to @option{--param large-unit-insns}
11170 before applying @option{--param inline-unit-growth}.
11171
11172 @item inline-unit-growth
11173 Specifies maximal overall growth of the compilation unit caused by inlining.
11174 For example, parameter value 20 limits unit growth to 1.2 times the original
11175 size. Cold functions (either marked cold via an attribute or by profile
11176 feedback) are not accounted into the unit size.
11177
11178 @item ipcp-unit-growth
11179 Specifies maximal overall growth of the compilation unit caused by
11180 interprocedural constant propagation. For example, parameter value 10 limits
11181 unit growth to 1.1 times the original size.
11182
11183 @item large-stack-frame
11184 The limit specifying large stack frames. While inlining the algorithm is trying
11185 to not grow past this limit too much.
11186
11187 @item large-stack-frame-growth
11188 Specifies maximal growth of large stack frames caused by inlining in percents.
11189 For example, parameter value 1000 limits large stack frame growth to 11 times
11190 the original size.
11191
11192 @item max-inline-insns-recursive
11193 @itemx max-inline-insns-recursive-auto
11194 Specifies the maximum number of instructions an out-of-line copy of a
11195 self-recursive inline
11196 function can grow into by performing recursive inlining.
11197
11198 @option{--param max-inline-insns-recursive} applies to functions
11199 declared inline.
11200 For functions not declared inline, recursive inlining
11201 happens only when @option{-finline-functions} (included in @option{-O3}) is
11202 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11203
11204 @item max-inline-recursive-depth
11205 @itemx max-inline-recursive-depth-auto
11206 Specifies the maximum recursion depth used for recursive inlining.
11207
11208 @option{--param max-inline-recursive-depth} applies to functions
11209 declared inline. For functions not declared inline, recursive inlining
11210 happens only when @option{-finline-functions} (included in @option{-O3}) is
11211 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11212
11213 @item min-inline-recursive-probability
11214 Recursive inlining is profitable only for function having deep recursion
11215 in average and can hurt for function having little recursion depth by
11216 increasing the prologue size or complexity of function body to other
11217 optimizers.
11218
11219 When profile feedback is available (see @option{-fprofile-generate}) the actual
11220 recursion depth can be guessed from the probability that function recurses
11221 via a given call expression. This parameter limits inlining only to call
11222 expressions whose probability exceeds the given threshold (in percents).
11223
11224 @item early-inlining-insns
11225 Specify growth that the early inliner can make. In effect it increases
11226 the amount of inlining for code having a large abstraction penalty.
11227
11228 @item max-early-inliner-iterations
11229 Limit of iterations of the early inliner. This basically bounds
11230 the number of nested indirect calls the early inliner can resolve.
11231 Deeper chains are still handled by late inlining.
11232
11233 @item comdat-sharing-probability
11234 Probability (in percent) that C++ inline function with comdat visibility
11235 are shared across multiple compilation units.
11236
11237 @item profile-func-internal-id
11238 A parameter to control whether to use function internal id in profile
11239 database lookup. If the value is 0, the compiler uses an id that
11240 is based on function assembler name and filename, which makes old profile
11241 data more tolerant to source changes such as function reordering etc.
11242
11243 @item min-vect-loop-bound
11244 The minimum number of iterations under which loops are not vectorized
11245 when @option{-ftree-vectorize} is used. The number of iterations after
11246 vectorization needs to be greater than the value specified by this option
11247 to allow vectorization.
11248
11249 @item gcse-cost-distance-ratio
11250 Scaling factor in calculation of maximum distance an expression
11251 can be moved by GCSE optimizations. This is currently supported only in the
11252 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11253 is with simple expressions, i.e., the expressions that have cost
11254 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11255 hoisting of simple expressions.
11256
11257 @item gcse-unrestricted-cost
11258 Cost, roughly measured as the cost of a single typical machine
11259 instruction, at which GCSE optimizations do not constrain
11260 the distance an expression can travel. This is currently
11261 supported only in the code hoisting pass. The lesser the cost,
11262 the more aggressive code hoisting is. Specifying 0
11263 allows all expressions to travel unrestricted distances.
11264
11265 @item max-hoist-depth
11266 The depth of search in the dominator tree for expressions to hoist.
11267 This is used to avoid quadratic behavior in hoisting algorithm.
11268 The value of 0 does not limit on the search, but may slow down compilation
11269 of huge functions.
11270
11271 @item max-tail-merge-comparisons
11272 The maximum amount of similar bbs to compare a bb with. This is used to
11273 avoid quadratic behavior in tree tail merging.
11274
11275 @item max-tail-merge-iterations
11276 The maximum amount of iterations of the pass over the function. This is used to
11277 limit compilation time in tree tail merging.
11278
11279 @item store-merging-allow-unaligned
11280 Allow the store merging pass to introduce unaligned stores if it is legal to
11281 do so.
11282
11283 @item max-stores-to-merge
11284 The maximum number of stores to attempt to merge into wider stores in the store
11285 merging pass.
11286
11287 @item max-unrolled-insns
11288 The maximum number of instructions that a loop may have to be unrolled.
11289 If a loop is unrolled, this parameter also determines how many times
11290 the loop code is unrolled.
11291
11292 @item max-average-unrolled-insns
11293 The maximum number of instructions biased by probabilities of their execution
11294 that a loop may have to be unrolled. If a loop is unrolled,
11295 this parameter also determines how many times the loop code is unrolled.
11296
11297 @item max-unroll-times
11298 The maximum number of unrollings of a single loop.
11299
11300 @item max-peeled-insns
11301 The maximum number of instructions that a loop may have to be peeled.
11302 If a loop is peeled, this parameter also determines how many times
11303 the loop code is peeled.
11304
11305 @item max-peel-times
11306 The maximum number of peelings of a single loop.
11307
11308 @item max-peel-branches
11309 The maximum number of branches on the hot path through the peeled sequence.
11310
11311 @item max-completely-peeled-insns
11312 The maximum number of insns of a completely peeled loop.
11313
11314 @item max-completely-peel-times
11315 The maximum number of iterations of a loop to be suitable for complete peeling.
11316
11317 @item max-completely-peel-loop-nest-depth
11318 The maximum depth of a loop nest suitable for complete peeling.
11319
11320 @item max-unswitch-insns
11321 The maximum number of insns of an unswitched loop.
11322
11323 @item max-unswitch-level
11324 The maximum number of branches unswitched in a single loop.
11325
11326 @item lim-expensive
11327 The minimum cost of an expensive expression in the loop invariant motion.
11328
11329 @item iv-consider-all-candidates-bound
11330 Bound on number of candidates for induction variables, below which
11331 all candidates are considered for each use in induction variable
11332 optimizations. If there are more candidates than this,
11333 only the most relevant ones are considered to avoid quadratic time complexity.
11334
11335 @item iv-max-considered-uses
11336 The induction variable optimizations give up on loops that contain more
11337 induction variable uses.
11338
11339 @item iv-always-prune-cand-set-bound
11340 If the number of candidates in the set is smaller than this value,
11341 always try to remove unnecessary ivs from the set
11342 when adding a new one.
11343
11344 @item avg-loop-niter
11345 Average number of iterations of a loop.
11346
11347 @item dse-max-object-size
11348 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11349 Larger values may result in larger compilation times.
11350
11351 @item dse-max-alias-queries-per-store
11352 Maximum number of queries into the alias oracle per store.
11353 Larger values result in larger compilation times and may result in more
11354 removed dead stores.
11355
11356 @item scev-max-expr-size
11357 Bound on size of expressions used in the scalar evolutions analyzer.
11358 Large expressions slow the analyzer.
11359
11360 @item scev-max-expr-complexity
11361 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11362 Complex expressions slow the analyzer.
11363
11364 @item max-tree-if-conversion-phi-args
11365 Maximum number of arguments in a PHI supported by TREE if conversion
11366 unless the loop is marked with simd pragma.
11367
11368 @item vect-max-version-for-alignment-checks
11369 The maximum number of run-time checks that can be performed when
11370 doing loop versioning for alignment in the vectorizer.
11371
11372 @item vect-max-version-for-alias-checks
11373 The maximum number of run-time checks that can be performed when
11374 doing loop versioning for alias in the vectorizer.
11375
11376 @item vect-max-peeling-for-alignment
11377 The maximum number of loop peels to enhance access alignment
11378 for vectorizer. Value -1 means no limit.
11379
11380 @item max-iterations-to-track
11381 The maximum number of iterations of a loop the brute-force algorithm
11382 for analysis of the number of iterations of the loop tries to evaluate.
11383
11384 @item hot-bb-count-ws-permille
11385 A basic block profile count is considered hot if it contributes to
11386 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11387
11388 @item hot-bb-frequency-fraction
11389 Select fraction of the entry block frequency of executions of basic block in
11390 function given basic block needs to have to be considered hot.
11391
11392 @item max-predicted-iterations
11393 The maximum number of loop iterations we predict statically. This is useful
11394 in cases where a function contains a single loop with known bound and
11395 another loop with unknown bound.
11396 The known number of iterations is predicted correctly, while
11397 the unknown number of iterations average to roughly 10. This means that the
11398 loop without bounds appears artificially cold relative to the other one.
11399
11400 @item builtin-expect-probability
11401 Control the probability of the expression having the specified value. This
11402 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11403
11404 @item builtin-string-cmp-inline-length
11405 The maximum length of a constant string for a builtin string cmp call
11406 eligible for inlining.
11407
11408 @item align-threshold
11409
11410 Select fraction of the maximal frequency of executions of a basic block in
11411 a function to align the basic block.
11412
11413 @item align-loop-iterations
11414
11415 A loop expected to iterate at least the selected number of iterations is
11416 aligned.
11417
11418 @item tracer-dynamic-coverage
11419 @itemx tracer-dynamic-coverage-feedback
11420
11421 This value is used to limit superblock formation once the given percentage of
11422 executed instructions is covered. This limits unnecessary code size
11423 expansion.
11424
11425 The @option{tracer-dynamic-coverage-feedback} parameter
11426 is used only when profile
11427 feedback is available. The real profiles (as opposed to statically estimated
11428 ones) are much less balanced allowing the threshold to be larger value.
11429
11430 @item tracer-max-code-growth
11431 Stop tail duplication once code growth has reached given percentage. This is
11432 a rather artificial limit, as most of the duplicates are eliminated later in
11433 cross jumping, so it may be set to much higher values than is the desired code
11434 growth.
11435
11436 @item tracer-min-branch-ratio
11437
11438 Stop reverse growth when the reverse probability of best edge is less than this
11439 threshold (in percent).
11440
11441 @item tracer-min-branch-probability
11442 @itemx tracer-min-branch-probability-feedback
11443
11444 Stop forward growth if the best edge has probability lower than this
11445 threshold.
11446
11447 Similarly to @option{tracer-dynamic-coverage} two parameters are
11448 provided. @option{tracer-min-branch-probability-feedback} is used for
11449 compilation with profile feedback and @option{tracer-min-branch-probability}
11450 compilation without. The value for compilation with profile feedback
11451 needs to be more conservative (higher) in order to make tracer
11452 effective.
11453
11454 @item stack-clash-protection-guard-size
11455 Specify the size of the operating system provided stack guard as
11456 2 raised to @var{num} bytes. Higher values may reduce the
11457 number of explicit probes, but a value larger than the operating system
11458 provided guard will leave code vulnerable to stack clash style attacks.
11459
11460 @item stack-clash-protection-probe-interval
11461 Stack clash protection involves probing stack space as it is allocated. This
11462 param controls the maximum distance between probes into the stack as 2 raised
11463 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11464 larger than the operating system provided guard will leave code vulnerable to
11465 stack clash style attacks.
11466
11467 @item max-cse-path-length
11468
11469 The maximum number of basic blocks on path that CSE considers.
11470
11471 @item max-cse-insns
11472 The maximum number of instructions CSE processes before flushing.
11473
11474 @item ggc-min-expand
11475
11476 GCC uses a garbage collector to manage its own memory allocation. This
11477 parameter specifies the minimum percentage by which the garbage
11478 collector's heap should be allowed to expand between collections.
11479 Tuning this may improve compilation speed; it has no effect on code
11480 generation.
11481
11482 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11483 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11484 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11485 GCC is not able to calculate RAM on a particular platform, the lower
11486 bound of 30% is used. Setting this parameter and
11487 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11488 every opportunity. This is extremely slow, but can be useful for
11489 debugging.
11490
11491 @item ggc-min-heapsize
11492
11493 Minimum size of the garbage collector's heap before it begins bothering
11494 to collect garbage. The first collection occurs after the heap expands
11495 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11496 tuning this may improve compilation speed, and has no effect on code
11497 generation.
11498
11499 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11500 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11501 with a lower bound of 4096 (four megabytes) and an upper bound of
11502 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11503 particular platform, the lower bound is used. Setting this parameter
11504 very large effectively disables garbage collection. Setting this
11505 parameter and @option{ggc-min-expand} to zero causes a full collection
11506 to occur at every opportunity.
11507
11508 @item max-reload-search-insns
11509 The maximum number of instruction reload should look backward for equivalent
11510 register. Increasing values mean more aggressive optimization, making the
11511 compilation time increase with probably slightly better performance.
11512
11513 @item max-cselib-memory-locations
11514 The maximum number of memory locations cselib should take into account.
11515 Increasing values mean more aggressive optimization, making the compilation time
11516 increase with probably slightly better performance.
11517
11518 @item max-sched-ready-insns
11519 The maximum number of instructions ready to be issued the scheduler should
11520 consider at any given time during the first scheduling pass. Increasing
11521 values mean more thorough searches, making the compilation time increase
11522 with probably little benefit.
11523
11524 @item max-sched-region-blocks
11525 The maximum number of blocks in a region to be considered for
11526 interblock scheduling.
11527
11528 @item max-pipeline-region-blocks
11529 The maximum number of blocks in a region to be considered for
11530 pipelining in the selective scheduler.
11531
11532 @item max-sched-region-insns
11533 The maximum number of insns in a region to be considered for
11534 interblock scheduling.
11535
11536 @item max-pipeline-region-insns
11537 The maximum number of insns in a region to be considered for
11538 pipelining in the selective scheduler.
11539
11540 @item min-spec-prob
11541 The minimum probability (in percents) of reaching a source block
11542 for interblock speculative scheduling.
11543
11544 @item max-sched-extend-regions-iters
11545 The maximum number of iterations through CFG to extend regions.
11546 A value of 0 disables region extensions.
11547
11548 @item max-sched-insn-conflict-delay
11549 The maximum conflict delay for an insn to be considered for speculative motion.
11550
11551 @item sched-spec-prob-cutoff
11552 The minimal probability of speculation success (in percents), so that
11553 speculative insns are scheduled.
11554
11555 @item sched-state-edge-prob-cutoff
11556 The minimum probability an edge must have for the scheduler to save its
11557 state across it.
11558
11559 @item sched-mem-true-dep-cost
11560 Minimal distance (in CPU cycles) between store and load targeting same
11561 memory locations.
11562
11563 @item selsched-max-lookahead
11564 The maximum size of the lookahead window of selective scheduling. It is a
11565 depth of search for available instructions.
11566
11567 @item selsched-max-sched-times
11568 The maximum number of times that an instruction is scheduled during
11569 selective scheduling. This is the limit on the number of iterations
11570 through which the instruction may be pipelined.
11571
11572 @item selsched-insns-to-rename
11573 The maximum number of best instructions in the ready list that are considered
11574 for renaming in the selective scheduler.
11575
11576 @item sms-min-sc
11577 The minimum value of stage count that swing modulo scheduler
11578 generates.
11579
11580 @item max-last-value-rtl
11581 The maximum size measured as number of RTLs that can be recorded in an expression
11582 in combiner for a pseudo register as last known value of that register.
11583
11584 @item max-combine-insns
11585 The maximum number of instructions the RTL combiner tries to combine.
11586
11587 @item integer-share-limit
11588 Small integer constants can use a shared data structure, reducing the
11589 compiler's memory usage and increasing its speed. This sets the maximum
11590 value of a shared integer constant.
11591
11592 @item ssp-buffer-size
11593 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11594 protection when @option{-fstack-protection} is used.
11595
11596 @item min-size-for-stack-sharing
11597 The minimum size of variables taking part in stack slot sharing when not
11598 optimizing.
11599
11600 @item max-jump-thread-duplication-stmts
11601 Maximum number of statements allowed in a block that needs to be
11602 duplicated when threading jumps.
11603
11604 @item max-fields-for-field-sensitive
11605 Maximum number of fields in a structure treated in
11606 a field sensitive manner during pointer analysis.
11607
11608 @item prefetch-latency
11609 Estimate on average number of instructions that are executed before
11610 prefetch finishes. The distance prefetched ahead is proportional
11611 to this constant. Increasing this number may also lead to less
11612 streams being prefetched (see @option{simultaneous-prefetches}).
11613
11614 @item simultaneous-prefetches
11615 Maximum number of prefetches that can run at the same time.
11616
11617 @item l1-cache-line-size
11618 The size of cache line in L1 data cache, in bytes.
11619
11620 @item l1-cache-size
11621 The size of L1 data cache, in kilobytes.
11622
11623 @item l2-cache-size
11624 The size of L2 data cache, in kilobytes.
11625
11626 @item prefetch-dynamic-strides
11627 Whether the loop array prefetch pass should issue software prefetch hints
11628 for strides that are non-constant. In some cases this may be
11629 beneficial, though the fact the stride is non-constant may make it
11630 hard to predict when there is clear benefit to issuing these hints.
11631
11632 Set to 1 if the prefetch hints should be issued for non-constant
11633 strides. Set to 0 if prefetch hints should be issued only for strides that
11634 are known to be constant and below @option{prefetch-minimum-stride}.
11635
11636 @item prefetch-minimum-stride
11637 Minimum constant stride, in bytes, to start using prefetch hints for. If
11638 the stride is less than this threshold, prefetch hints will not be issued.
11639
11640 This setting is useful for processors that have hardware prefetchers, in
11641 which case there may be conflicts between the hardware prefetchers and
11642 the software prefetchers. If the hardware prefetchers have a maximum
11643 stride they can handle, it should be used here to improve the use of
11644 software prefetchers.
11645
11646 A value of -1 means we don't have a threshold and therefore
11647 prefetch hints can be issued for any constant stride.
11648
11649 This setting is only useful for strides that are known and constant.
11650
11651 @item loop-interchange-max-num-stmts
11652 The maximum number of stmts in a loop to be interchanged.
11653
11654 @item loop-interchange-stride-ratio
11655 The minimum ratio between stride of two loops for interchange to be profitable.
11656
11657 @item min-insn-to-prefetch-ratio
11658 The minimum ratio between the number of instructions and the
11659 number of prefetches to enable prefetching in a loop.
11660
11661 @item prefetch-min-insn-to-mem-ratio
11662 The minimum ratio between the number of instructions and the
11663 number of memory references to enable prefetching in a loop.
11664
11665 @item use-canonical-types
11666 Whether the compiler should use the ``canonical'' type system.
11667 Should always be 1, which uses a more efficient internal
11668 mechanism for comparing types in C++ and Objective-C++. However, if
11669 bugs in the canonical type system are causing compilation failures,
11670 set this value to 0 to disable canonical types.
11671
11672 @item switch-conversion-max-branch-ratio
11673 Switch initialization conversion refuses to create arrays that are
11674 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11675 branches in the switch.
11676
11677 @item max-partial-antic-length
11678 Maximum length of the partial antic set computed during the tree
11679 partial redundancy elimination optimization (@option{-ftree-pre}) when
11680 optimizing at @option{-O3} and above. For some sorts of source code
11681 the enhanced partial redundancy elimination optimization can run away,
11682 consuming all of the memory available on the host machine. This
11683 parameter sets a limit on the length of the sets that are computed,
11684 which prevents the runaway behavior. Setting a value of 0 for
11685 this parameter allows an unlimited set length.
11686
11687 @item rpo-vn-max-loop-depth
11688 Maximum loop depth that is value-numbered optimistically.
11689 When the limit hits the innermost
11690 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11691 loop nest are value-numbered optimistically and the remaining ones not.
11692
11693 @item sccvn-max-alias-queries-per-access
11694 Maximum number of alias-oracle queries we perform when looking for
11695 redundancies for loads and stores. If this limit is hit the search
11696 is aborted and the load or store is not considered redundant. The
11697 number of queries is algorithmically limited to the number of
11698 stores on all paths from the load to the function entry.
11699
11700 @item ira-max-loops-num
11701 IRA uses regional register allocation by default. If a function
11702 contains more loops than the number given by this parameter, only at most
11703 the given number of the most frequently-executed loops form regions
11704 for regional register allocation.
11705
11706 @item ira-max-conflict-table-size
11707 Although IRA uses a sophisticated algorithm to compress the conflict
11708 table, the table can still require excessive amounts of memory for
11709 huge functions. If the conflict table for a function could be more
11710 than the size in MB given by this parameter, the register allocator
11711 instead uses a faster, simpler, and lower-quality
11712 algorithm that does not require building a pseudo-register conflict table.
11713
11714 @item ira-loop-reserved-regs
11715 IRA can be used to evaluate more accurate register pressure in loops
11716 for decisions to move loop invariants (see @option{-O3}). The number
11717 of available registers reserved for some other purposes is given
11718 by this parameter. Default of the parameter
11719 is the best found from numerous experiments.
11720
11721 @item lra-inheritance-ebb-probability-cutoff
11722 LRA tries to reuse values reloaded in registers in subsequent insns.
11723 This optimization is called inheritance. EBB is used as a region to
11724 do this optimization. The parameter defines a minimal fall-through
11725 edge probability in percentage used to add BB to inheritance EBB in
11726 LRA. The default value was chosen
11727 from numerous runs of SPEC2000 on x86-64.
11728
11729 @item loop-invariant-max-bbs-in-loop
11730 Loop invariant motion can be very expensive, both in compilation time and
11731 in amount of needed compile-time memory, with very large loops. Loops
11732 with more basic blocks than this parameter won't have loop invariant
11733 motion optimization performed on them.
11734
11735 @item loop-max-datarefs-for-datadeps
11736 Building data dependencies is expensive for very large loops. This
11737 parameter limits the number of data references in loops that are
11738 considered for data dependence analysis. These large loops are no
11739 handled by the optimizations using loop data dependencies.
11740
11741 @item max-vartrack-size
11742 Sets a maximum number of hash table slots to use during variable
11743 tracking dataflow analysis of any function. If this limit is exceeded
11744 with variable tracking at assignments enabled, analysis for that
11745 function is retried without it, after removing all debug insns from
11746 the function. If the limit is exceeded even without debug insns, var
11747 tracking analysis is completely disabled for the function. Setting
11748 the parameter to zero makes it unlimited.
11749
11750 @item max-vartrack-expr-depth
11751 Sets a maximum number of recursion levels when attempting to map
11752 variable names or debug temporaries to value expressions. This trades
11753 compilation time for more complete debug information. If this is set too
11754 low, value expressions that are available and could be represented in
11755 debug information may end up not being used; setting this higher may
11756 enable the compiler to find more complex debug expressions, but compile
11757 time and memory use may grow.
11758
11759 @item max-debug-marker-count
11760 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11761 markers) to avoid complexity explosion at inlining or expanding to RTL.
11762 If a function has more such gimple stmts than the set limit, such stmts
11763 will be dropped from the inlined copy of a function, and from its RTL
11764 expansion.
11765
11766 @item min-nondebug-insn-uid
11767 Use uids starting at this parameter for nondebug insns. The range below
11768 the parameter is reserved exclusively for debug insns created by
11769 @option{-fvar-tracking-assignments}, but debug insns may get
11770 (non-overlapping) uids above it if the reserved range is exhausted.
11771
11772 @item ipa-sra-ptr-growth-factor
11773 IPA-SRA replaces a pointer to an aggregate with one or more new
11774 parameters only when their cumulative size is less or equal to
11775 @option{ipa-sra-ptr-growth-factor} times the size of the original
11776 pointer parameter.
11777
11778 @item sra-max-scalarization-size-Ospeed
11779 @itemx sra-max-scalarization-size-Osize
11780 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11781 replace scalar parts of aggregates with uses of independent scalar
11782 variables. These parameters control the maximum size, in storage units,
11783 of aggregate which is considered for replacement when compiling for
11784 speed
11785 (@option{sra-max-scalarization-size-Ospeed}) or size
11786 (@option{sra-max-scalarization-size-Osize}) respectively.
11787
11788 @item tm-max-aggregate-size
11789 When making copies of thread-local variables in a transaction, this
11790 parameter specifies the size in bytes after which variables are
11791 saved with the logging functions as opposed to save/restore code
11792 sequence pairs. This option only applies when using
11793 @option{-fgnu-tm}.
11794
11795 @item graphite-max-nb-scop-params
11796 To avoid exponential effects in the Graphite loop transforms, the
11797 number of parameters in a Static Control Part (SCoP) is bounded.
11798 A value of zero can be used to lift
11799 the bound. A variable whose value is unknown at compilation time and
11800 defined outside a SCoP is a parameter of the SCoP.
11801
11802 @item loop-block-tile-size
11803 Loop blocking or strip mining transforms, enabled with
11804 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11805 loop in the loop nest by a given number of iterations. The strip
11806 length can be changed using the @option{loop-block-tile-size}
11807 parameter.
11808
11809 @item ipa-cp-value-list-size
11810 IPA-CP attempts to track all possible values and types passed to a function's
11811 parameter in order to propagate them and perform devirtualization.
11812 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11813 stores per one formal parameter of a function.
11814
11815 @item ipa-cp-eval-threshold
11816 IPA-CP calculates its own score of cloning profitability heuristics
11817 and performs those cloning opportunities with scores that exceed
11818 @option{ipa-cp-eval-threshold}.
11819
11820 @item ipa-cp-recursion-penalty
11821 Percentage penalty the recursive functions will receive when they
11822 are evaluated for cloning.
11823
11824 @item ipa-cp-single-call-penalty
11825 Percentage penalty functions containing a single call to another
11826 function will receive when they are evaluated for cloning.
11827
11828 @item ipa-max-agg-items
11829 IPA-CP is also capable to propagate a number of scalar values passed
11830 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11831 number of such values per one parameter.
11832
11833 @item ipa-cp-loop-hint-bonus
11834 When IPA-CP determines that a cloning candidate would make the number
11835 of iterations of a loop known, it adds a bonus of
11836 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11837 the candidate.
11838
11839 @item ipa-cp-array-index-hint-bonus
11840 When IPA-CP determines that a cloning candidate would make the index of
11841 an array access known, it adds a bonus of
11842 @option{ipa-cp-array-index-hint-bonus} to the profitability
11843 score of the candidate.
11844
11845 @item ipa-max-aa-steps
11846 During its analysis of function bodies, IPA-CP employs alias analysis
11847 in order to track values pointed to by function parameters. In order
11848 not spend too much time analyzing huge functions, it gives up and
11849 consider all memory clobbered after examining
11850 @option{ipa-max-aa-steps} statements modifying memory.
11851
11852 @item lto-partitions
11853 Specify desired number of partitions produced during WHOPR compilation.
11854 The number of partitions should exceed the number of CPUs used for compilation.
11855
11856 @item lto-min-partition
11857 Size of minimal partition for WHOPR (in estimated instructions).
11858 This prevents expenses of splitting very small programs into too many
11859 partitions.
11860
11861 @item lto-max-partition
11862 Size of max partition for WHOPR (in estimated instructions).
11863 to provide an upper bound for individual size of partition.
11864 Meant to be used only with balanced partitioning.
11865
11866 @item lto-max-streaming-parallelism
11867 Maximal number of parallel processes used for LTO streaming.
11868
11869 @item cxx-max-namespaces-for-diagnostic-help
11870 The maximum number of namespaces to consult for suggestions when C++
11871 name lookup fails for an identifier.
11872
11873 @item sink-frequency-threshold
11874 The maximum relative execution frequency (in percents) of the target block
11875 relative to a statement's original block to allow statement sinking of a
11876 statement. Larger numbers result in more aggressive statement sinking.
11877 A small positive adjustment is applied for
11878 statements with memory operands as those are even more profitable so sink.
11879
11880 @item max-stores-to-sink
11881 The maximum number of conditional store pairs that can be sunk. Set to 0
11882 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11883 (@option{-ftree-loop-if-convert}) is disabled.
11884
11885 @item allow-store-data-races
11886 Allow optimizers to introduce new data races on stores.
11887 Set to 1 to allow, otherwise to 0.
11888
11889 @item case-values-threshold
11890 The smallest number of different values for which it is best to use a
11891 jump-table instead of a tree of conditional branches. If the value is
11892 0, use the default for the machine.
11893
11894 @item jump-table-max-growth-ratio-for-size
11895 The maximum code size growth ratio when expanding
11896 into a jump table (in percent). The parameter is used when
11897 optimizing for size.
11898
11899 @item jump-table-max-growth-ratio-for-speed
11900 The maximum code size growth ratio when expanding
11901 into a jump table (in percent). The parameter is used when
11902 optimizing for speed.
11903
11904 @item tree-reassoc-width
11905 Set the maximum number of instructions executed in parallel in
11906 reassociated tree. This parameter overrides target dependent
11907 heuristics used by default if has non zero value.
11908
11909 @item sched-pressure-algorithm
11910 Choose between the two available implementations of
11911 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11912 and is the more likely to prevent instructions from being reordered.
11913 Algorithm 2 was designed to be a compromise between the relatively
11914 conservative approach taken by algorithm 1 and the rather aggressive
11915 approach taken by the default scheduler. It relies more heavily on
11916 having a regular register file and accurate register pressure classes.
11917 See @file{haifa-sched.c} in the GCC sources for more details.
11918
11919 The default choice depends on the target.
11920
11921 @item max-slsr-cand-scan
11922 Set the maximum number of existing candidates that are considered when
11923 seeking a basis for a new straight-line strength reduction candidate.
11924
11925 @item asan-globals
11926 Enable buffer overflow detection for global objects. This kind
11927 of protection is enabled by default if you are using
11928 @option{-fsanitize=address} option.
11929 To disable global objects protection use @option{--param asan-globals=0}.
11930
11931 @item asan-stack
11932 Enable buffer overflow detection for stack objects. This kind of
11933 protection is enabled by default when using @option{-fsanitize=address}.
11934 To disable stack protection use @option{--param asan-stack=0} option.
11935
11936 @item asan-instrument-reads
11937 Enable buffer overflow detection for memory reads. This kind of
11938 protection is enabled by default when using @option{-fsanitize=address}.
11939 To disable memory reads protection use
11940 @option{--param asan-instrument-reads=0}.
11941
11942 @item asan-instrument-writes
11943 Enable buffer overflow detection for memory writes. This kind of
11944 protection is enabled by default when using @option{-fsanitize=address}.
11945 To disable memory writes protection use
11946 @option{--param asan-instrument-writes=0} option.
11947
11948 @item asan-memintrin
11949 Enable detection for built-in functions. This kind of protection
11950 is enabled by default when using @option{-fsanitize=address}.
11951 To disable built-in functions protection use
11952 @option{--param asan-memintrin=0}.
11953
11954 @item asan-use-after-return
11955 Enable detection of use-after-return. This kind of protection
11956 is enabled by default when using the @option{-fsanitize=address} option.
11957 To disable it use @option{--param asan-use-after-return=0}.
11958
11959 Note: By default the check is disabled at run time. To enable it,
11960 add @code{detect_stack_use_after_return=1} to the environment variable
11961 @env{ASAN_OPTIONS}.
11962
11963 @item asan-instrumentation-with-call-threshold
11964 If number of memory accesses in function being instrumented
11965 is greater or equal to this number, use callbacks instead of inline checks.
11966 E.g. to disable inline code use
11967 @option{--param asan-instrumentation-with-call-threshold=0}.
11968
11969 @item use-after-scope-direct-emission-threshold
11970 If the size of a local variable in bytes is smaller or equal to this
11971 number, directly poison (or unpoison) shadow memory instead of using
11972 run-time callbacks.
11973
11974 @item max-fsm-thread-path-insns
11975 Maximum number of instructions to copy when duplicating blocks on a
11976 finite state automaton jump thread path.
11977
11978 @item max-fsm-thread-length
11979 Maximum number of basic blocks on a finite state automaton jump thread
11980 path.
11981
11982 @item max-fsm-thread-paths
11983 Maximum number of new jump thread paths to create for a finite state
11984 automaton.
11985
11986 @item parloops-chunk-size
11987 Chunk size of omp schedule for loops parallelized by parloops.
11988
11989 @item parloops-schedule
11990 Schedule type of omp schedule for loops parallelized by parloops (static,
11991 dynamic, guided, auto, runtime).
11992
11993 @item parloops-min-per-thread
11994 The minimum number of iterations per thread of an innermost parallelized
11995 loop for which the parallelized variant is preferred over the single threaded
11996 one. Note that for a parallelized loop nest the
11997 minimum number of iterations of the outermost loop per thread is two.
11998
11999 @item max-ssa-name-query-depth
12000 Maximum depth of recursion when querying properties of SSA names in things
12001 like fold routines. One level of recursion corresponds to following a
12002 use-def chain.
12003
12004 @item hsa-gen-debug-stores
12005 Enable emission of special debug stores within HSA kernels which are
12006 then read and reported by libgomp plugin. Generation of these stores
12007 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12008 enable it.
12009
12010 @item max-speculative-devirt-maydefs
12011 The maximum number of may-defs we analyze when looking for a must-def
12012 specifying the dynamic type of an object that invokes a virtual call
12013 we may be able to devirtualize speculatively.
12014
12015 @item max-vrp-switch-assertions
12016 The maximum number of assertions to add along the default edge of a switch
12017 statement during VRP.
12018
12019 @item unroll-jam-min-percent
12020 The minimum percentage of memory references that must be optimized
12021 away for the unroll-and-jam transformation to be considered profitable.
12022
12023 @item unroll-jam-max-unroll
12024 The maximum number of times the outer loop should be unrolled by
12025 the unroll-and-jam transformation.
12026
12027 @item max-rtl-if-conversion-unpredictable-cost
12028 Maximum permissible cost for the sequence that would be generated
12029 by the RTL if-conversion pass for a branch that is considered unpredictable.
12030
12031 @item max-variable-expansions-in-unroller
12032 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12033 of times that an individual variable will be expanded during loop unrolling.
12034
12035 @item tracer-min-branch-probability-feedback
12036 Stop forward growth if the probability of best edge is less than
12037 this threshold (in percent). Used when profile feedback is available.
12038
12039 @item partial-inlining-entry-probability
12040 Maximum probability of the entry BB of split region
12041 (in percent relative to entry BB of the function)
12042 to make partial inlining happen.
12043
12044 @item max-tracked-strlens
12045 Maximum number of strings for which strlen optimization pass will
12046 track string lengths.
12047
12048 @item gcse-after-reload-partial-fraction
12049 The threshold ratio for performing partial redundancy
12050 elimination after reload.
12051
12052 @item gcse-after-reload-critical-fraction
12053 The threshold ratio of critical edges execution count that
12054 permit performing redundancy elimination after reload.
12055
12056 @item max-loop-header-insns
12057 The maximum number of insns in loop header duplicated
12058 by the copy loop headers pass.
12059
12060 @item vect-epilogues-nomask
12061 Enable loop epilogue vectorization using smaller vector size.
12062
12063 @item slp-max-insns-in-bb
12064 Maximum number of instructions in basic block to be
12065 considered for SLP vectorization.
12066
12067 @item avoid-fma-max-bits
12068 Maximum number of bits for which we avoid creating FMAs.
12069
12070 @item sms-loop-average-count-threshold
12071 A threshold on the average loop count considered by the swing modulo scheduler.
12072
12073 @item sms-dfa-history
12074 The number of cycles the swing modulo scheduler considers when checking
12075 conflicts using DFA.
12076
12077 @item hot-bb-count-fraction
12078 Select fraction of the maximal count of repetitions of basic block
12079 in program given basic block needs
12080 to have to be considered hot (used in non-LTO mode)
12081
12082 @item max-inline-insns-recursive-auto
12083 The maximum number of instructions non-inline function
12084 can grow to via recursive inlining.
12085
12086 @item graphite-allow-codegen-errors
12087 Whether codegen errors should be ICEs when @option{-fchecking}.
12088
12089 @item sms-max-ii-factor
12090 A factor for tuning the upper bound that swing modulo scheduler
12091 uses for scheduling a loop.
12092
12093 @item lra-max-considered-reload-pseudos
12094 The max number of reload pseudos which are considered during
12095 spilling a non-reload pseudo.
12096
12097 @item max-pow-sqrt-depth
12098 Maximum depth of sqrt chains to use when synthesizing exponentiation
12099 by a real constant.
12100
12101 @item max-dse-active-local-stores
12102 Maximum number of active local stores in RTL dead store elimination.
12103
12104 @item asan-instrument-allocas
12105 Enable asan allocas/VLAs protection.
12106
12107 @item max-iterations-computation-cost
12108 Bound on the cost of an expression to compute the number of iterations.
12109
12110 @item max-isl-operations
12111 Maximum number of isl operations, 0 means unlimited.
12112
12113 @item graphite-max-arrays-per-scop
12114 Maximum number of arrays per scop.
12115
12116 @item max-vartrack-reverse-op-size
12117 Max. size of loc list for which reverse ops should be added.
12118
12119 @item unlikely-bb-count-fraction
12120 The minimum fraction of profile runs a given basic block execution count
12121 must be not to be considered unlikely.
12122
12123 @item tracer-dynamic-coverage-feedback
12124 The percentage of function, weighted by execution frequency,
12125 that must be covered by trace formation.
12126 Used when profile feedback is available.
12127
12128 @item max-inline-recursive-depth-auto
12129 The maximum depth of recursive inlining for non-inline functions.
12130
12131 @item fsm-scale-path-stmts
12132 Scale factor to apply to the number of statements in a threading path
12133 when comparing to the number of (scaled) blocks.
12134
12135 @item fsm-maximum-phi-arguments
12136 Maximum number of arguments a PHI may have before the FSM threader
12137 will not try to thread through its block.
12138
12139 @item uninit-control-dep-attempts
12140 Maximum number of nested calls to search for control dependencies
12141 during uninitialized variable analysis.
12142
12143 @item max-once-peeled-insns
12144 The maximum number of insns of a peeled loop that rolls only once.
12145
12146 @item sra-max-scalarization-size-Osize
12147 Maximum size, in storage units, of an aggregate
12148 which should be considered for scalarization when compiling for size.
12149
12150 @item fsm-scale-path-blocks
12151 Scale factor to apply to the number of blocks in a threading path
12152 when comparing to the number of (scaled) statements.
12153
12154 @item sched-autopref-queue-depth
12155 Hardware autoprefetcher scheduler model control flag.
12156 Number of lookahead cycles the model looks into; at '
12157 ' only enable instruction sorting heuristic.
12158
12159 @item loop-versioning-max-inner-insns
12160 The maximum number of instructions that an inner loop can have
12161 before the loop versioning pass considers it too big to copy.
12162
12163 @item loop-versioning-max-outer-insns
12164 The maximum number of instructions that an outer loop can have
12165 before the loop versioning pass considers it too big to copy,
12166 discounting any instructions in inner loops that directly benefit
12167 from versioning.
12168
12169 @end table
12170 @end table
12171
12172 @node Instrumentation Options
12173 @section Program Instrumentation Options
12174 @cindex instrumentation options
12175 @cindex program instrumentation options
12176 @cindex run-time error checking options
12177 @cindex profiling options
12178 @cindex options, program instrumentation
12179 @cindex options, run-time error checking
12180 @cindex options, profiling
12181
12182 GCC supports a number of command-line options that control adding
12183 run-time instrumentation to the code it normally generates.
12184 For example, one purpose of instrumentation is collect profiling
12185 statistics for use in finding program hot spots, code coverage
12186 analysis, or profile-guided optimizations.
12187 Another class of program instrumentation is adding run-time checking
12188 to detect programming errors like invalid pointer
12189 dereferences or out-of-bounds array accesses, as well as deliberately
12190 hostile attacks such as stack smashing or C++ vtable hijacking.
12191 There is also a general hook which can be used to implement other
12192 forms of tracing or function-level instrumentation for debug or
12193 program analysis purposes.
12194
12195 @table @gcctabopt
12196 @cindex @command{prof}
12197 @cindex @command{gprof}
12198 @item -p
12199 @itemx -pg
12200 @opindex p
12201 @opindex pg
12202 Generate extra code to write profile information suitable for the
12203 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12204 (for @option{-pg}). You must use this option when compiling
12205 the source files you want data about, and you must also use it when
12206 linking.
12207
12208 You can use the function attribute @code{no_instrument_function} to
12209 suppress profiling of individual functions when compiling with these options.
12210 @xref{Common Function Attributes}.
12211
12212 @item -fprofile-arcs
12213 @opindex fprofile-arcs
12214 Add code so that program flow @dfn{arcs} are instrumented. During
12215 execution the program records how many times each branch and call is
12216 executed and how many times it is taken or returns. On targets that support
12217 constructors with priority support, profiling properly handles constructors,
12218 destructors and C++ constructors (and destructors) of classes which are used
12219 as a type of a global variable.
12220
12221 When the compiled
12222 program exits it saves this data to a file called
12223 @file{@var{auxname}.gcda} for each source file. The data may be used for
12224 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12225 test coverage analysis (@option{-ftest-coverage}). Each object file's
12226 @var{auxname} is generated from the name of the output file, if
12227 explicitly specified and it is not the final executable, otherwise it is
12228 the basename of the source file. In both cases any suffix is removed
12229 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12230 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12231 @xref{Cross-profiling}.
12232
12233 @cindex @command{gcov}
12234 @item --coverage
12235 @opindex coverage
12236
12237 This option is used to compile and link code instrumented for coverage
12238 analysis. The option is a synonym for @option{-fprofile-arcs}
12239 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12240 linking). See the documentation for those options for more details.
12241
12242 @itemize
12243
12244 @item
12245 Compile the source files with @option{-fprofile-arcs} plus optimization
12246 and code generation options. For test coverage analysis, use the
12247 additional @option{-ftest-coverage} option. You do not need to profile
12248 every source file in a program.
12249
12250 @item
12251 Compile the source files additionally with @option{-fprofile-abs-path}
12252 to create absolute path names in the @file{.gcno} files. This allows
12253 @command{gcov} to find the correct sources in projects where compilations
12254 occur with different working directories.
12255
12256 @item
12257 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12258 (the latter implies the former).
12259
12260 @item
12261 Run the program on a representative workload to generate the arc profile
12262 information. This may be repeated any number of times. You can run
12263 concurrent instances of your program, and provided that the file system
12264 supports locking, the data files will be correctly updated. Unless
12265 a strict ISO C dialect option is in effect, @code{fork} calls are
12266 detected and correctly handled without double counting.
12267
12268 @item
12269 For profile-directed optimizations, compile the source files again with
12270 the same optimization and code generation options plus
12271 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12272 Control Optimization}).
12273
12274 @item
12275 For test coverage analysis, use @command{gcov} to produce human readable
12276 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12277 @command{gcov} documentation for further information.
12278
12279 @end itemize
12280
12281 With @option{-fprofile-arcs}, for each function of your program GCC
12282 creates a program flow graph, then finds a spanning tree for the graph.
12283 Only arcs that are not on the spanning tree have to be instrumented: the
12284 compiler adds code to count the number of times that these arcs are
12285 executed. When an arc is the only exit or only entrance to a block, the
12286 instrumentation code can be added to the block; otherwise, a new basic
12287 block must be created to hold the instrumentation code.
12288
12289 @need 2000
12290 @item -ftest-coverage
12291 @opindex ftest-coverage
12292 Produce a notes file that the @command{gcov} code-coverage utility
12293 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12294 show program coverage. Each source file's note file is called
12295 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12296 above for a description of @var{auxname} and instructions on how to
12297 generate test coverage data. Coverage data matches the source files
12298 more closely if you do not optimize.
12299
12300 @item -fprofile-abs-path
12301 @opindex fprofile-abs-path
12302 Automatically convert relative source file names to absolute path names
12303 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12304 sources in projects where compilations occur with different working
12305 directories.
12306
12307 @item -fprofile-dir=@var{path}
12308 @opindex fprofile-dir
12309
12310 Set the directory to search for the profile data files in to @var{path}.
12311 This option affects only the profile data generated by
12312 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12313 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12314 and its related options. Both absolute and relative paths can be used.
12315 By default, GCC uses the current directory as @var{path}, thus the
12316 profile data file appears in the same directory as the object file.
12317 In order to prevent the file name clashing, if the object file name is
12318 not an absolute path, we mangle the absolute path of the
12319 @file{@var{sourcename}.gcda} file and use it as the file name of a
12320 @file{.gcda} file.
12321
12322 When an executable is run in a massive parallel environment, it is recommended
12323 to save profile to different folders. That can be done with variables
12324 in @var{path} that are exported during run-time:
12325
12326 @table @gcctabopt
12327
12328 @item %p
12329 process ID.
12330
12331 @item %q@{VAR@}
12332 value of environment variable @var{VAR}
12333
12334 @end table
12335
12336 @item -fprofile-generate
12337 @itemx -fprofile-generate=@var{path}
12338 @opindex fprofile-generate
12339
12340 Enable options usually used for instrumenting application to produce
12341 profile useful for later recompilation with profile feedback based
12342 optimization. You must use @option{-fprofile-generate} both when
12343 compiling and when linking your program.
12344
12345 The following options are enabled:
12346 @option{-fprofile-arcs}, @option{-fprofile-values},
12347 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12348
12349 If @var{path} is specified, GCC looks at the @var{path} to find
12350 the profile feedback data files. See @option{-fprofile-dir}.
12351
12352 To optimize the program based on the collected profile information, use
12353 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12354
12355 @item -fprofile-update=@var{method}
12356 @opindex fprofile-update
12357
12358 Alter the update method for an application instrumented for profile
12359 feedback based optimization. The @var{method} argument should be one of
12360 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12361 The first one is useful for single-threaded applications,
12362 while the second one prevents profile corruption by emitting thread-safe code.
12363
12364 @strong{Warning:} When an application does not properly join all threads
12365 (or creates an detached thread), a profile file can be still corrupted.
12366
12367 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12368 when supported by a target, or to @samp{single} otherwise. The GCC driver
12369 automatically selects @samp{prefer-atomic} when @option{-pthread}
12370 is present in the command line.
12371
12372 @item -fprofile-filter-files=@var{regex}
12373 @opindex fprofile-filter-files
12374
12375 Instrument only functions from files where names match
12376 any regular expression (separated by a semi-colon).
12377
12378 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12379 only @file{main.c} and all C files starting with 'module'.
12380
12381 @item -fprofile-exclude-files=@var{regex}
12382 @opindex fprofile-exclude-files
12383
12384 Instrument only functions from files where names do not match
12385 all the regular expressions (separated by a semi-colon).
12386
12387 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12388 of all files that are located in @file{/usr/} folder.
12389
12390 @item -fsanitize=address
12391 @opindex fsanitize=address
12392 Enable AddressSanitizer, a fast memory error detector.
12393 Memory access instructions are instrumented to detect
12394 out-of-bounds and use-after-free bugs.
12395 The option enables @option{-fsanitize-address-use-after-scope}.
12396 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12397 more details. The run-time behavior can be influenced using the
12398 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12399 the available options are shown at startup of the instrumented program. See
12400 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12401 for a list of supported options.
12402 The option cannot be combined with @option{-fsanitize=thread}.
12403
12404 @item -fsanitize=kernel-address
12405 @opindex fsanitize=kernel-address
12406 Enable AddressSanitizer for Linux kernel.
12407 See @uref{https://github.com/google/kasan/wiki} for more details.
12408
12409 @item -fsanitize=pointer-compare
12410 @opindex fsanitize=pointer-compare
12411 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12412 The option must be combined with either @option{-fsanitize=kernel-address} or
12413 @option{-fsanitize=address}
12414 The option cannot be combined with @option{-fsanitize=thread}.
12415 Note: By default the check is disabled at run time. To enable it,
12416 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12417 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12418 invalid operation only when both pointers are non-null.
12419
12420 @item -fsanitize=pointer-subtract
12421 @opindex fsanitize=pointer-subtract
12422 Instrument subtraction with pointer operands.
12423 The option must be combined with either @option{-fsanitize=kernel-address} or
12424 @option{-fsanitize=address}
12425 The option cannot be combined with @option{-fsanitize=thread}.
12426 Note: By default the check is disabled at run time. To enable it,
12427 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12428 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12429 invalid operation only when both pointers are non-null.
12430
12431 @item -fsanitize=thread
12432 @opindex fsanitize=thread
12433 Enable ThreadSanitizer, a fast data race detector.
12434 Memory access instructions are instrumented to detect
12435 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12436 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12437 environment variable; see
12438 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12439 supported options.
12440 The option cannot be combined with @option{-fsanitize=address},
12441 @option{-fsanitize=leak}.
12442
12443 Note that sanitized atomic builtins cannot throw exceptions when
12444 operating on invalid memory addresses with non-call exceptions
12445 (@option{-fnon-call-exceptions}).
12446
12447 @item -fsanitize=leak
12448 @opindex fsanitize=leak
12449 Enable LeakSanitizer, a memory leak detector.
12450 This option only matters for linking of executables and
12451 the executable is linked against a library that overrides @code{malloc}
12452 and other allocator functions. See
12453 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12454 details. The run-time behavior can be influenced using the
12455 @env{LSAN_OPTIONS} environment variable.
12456 The option cannot be combined with @option{-fsanitize=thread}.
12457
12458 @item -fsanitize=undefined
12459 @opindex fsanitize=undefined
12460 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12461 Various computations are instrumented to detect undefined behavior
12462 at runtime. Current suboptions are:
12463
12464 @table @gcctabopt
12465
12466 @item -fsanitize=shift
12467 @opindex fsanitize=shift
12468 This option enables checking that the result of a shift operation is
12469 not undefined. Note that what exactly is considered undefined differs
12470 slightly between C and C++, as well as between ISO C90 and C99, etc.
12471 This option has two suboptions, @option{-fsanitize=shift-base} and
12472 @option{-fsanitize=shift-exponent}.
12473
12474 @item -fsanitize=shift-exponent
12475 @opindex fsanitize=shift-exponent
12476 This option enables checking that the second argument of a shift operation
12477 is not negative and is smaller than the precision of the promoted first
12478 argument.
12479
12480 @item -fsanitize=shift-base
12481 @opindex fsanitize=shift-base
12482 If the second argument of a shift operation is within range, check that the
12483 result of a shift operation is not undefined. Note that what exactly is
12484 considered undefined differs slightly between C and C++, as well as between
12485 ISO C90 and C99, etc.
12486
12487 @item -fsanitize=integer-divide-by-zero
12488 @opindex fsanitize=integer-divide-by-zero
12489 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12490
12491 @item -fsanitize=unreachable
12492 @opindex fsanitize=unreachable
12493 With this option, the compiler turns the @code{__builtin_unreachable}
12494 call into a diagnostics message call instead. When reaching the
12495 @code{__builtin_unreachable} call, the behavior is undefined.
12496
12497 @item -fsanitize=vla-bound
12498 @opindex fsanitize=vla-bound
12499 This option instructs the compiler to check that the size of a variable
12500 length array is positive.
12501
12502 @item -fsanitize=null
12503 @opindex fsanitize=null
12504 This option enables pointer checking. Particularly, the application
12505 built with this option turned on will issue an error message when it
12506 tries to dereference a NULL pointer, or if a reference (possibly an
12507 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12508 on an object pointed by a NULL pointer.
12509
12510 @item -fsanitize=return
12511 @opindex fsanitize=return
12512 This option enables return statement checking. Programs
12513 built with this option turned on will issue an error message
12514 when the end of a non-void function is reached without actually
12515 returning a value. This option works in C++ only.
12516
12517 @item -fsanitize=signed-integer-overflow
12518 @opindex fsanitize=signed-integer-overflow
12519 This option enables signed integer overflow checking. We check that
12520 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12521 does not overflow in the signed arithmetics. Note, integer promotion
12522 rules must be taken into account. That is, the following is not an
12523 overflow:
12524 @smallexample
12525 signed char a = SCHAR_MAX;
12526 a++;
12527 @end smallexample
12528
12529 @item -fsanitize=bounds
12530 @opindex fsanitize=bounds
12531 This option enables instrumentation of array bounds. Various out of bounds
12532 accesses are detected. Flexible array members, flexible array member-like
12533 arrays, and initializers of variables with static storage are not instrumented.
12534
12535 @item -fsanitize=bounds-strict
12536 @opindex fsanitize=bounds-strict
12537 This option enables strict instrumentation of array bounds. Most out of bounds
12538 accesses are detected, including flexible array members and flexible array
12539 member-like arrays. Initializers of variables with static storage are not
12540 instrumented.
12541
12542 @item -fsanitize=alignment
12543 @opindex fsanitize=alignment
12544
12545 This option enables checking of alignment of pointers when they are
12546 dereferenced, or when a reference is bound to insufficiently aligned target,
12547 or when a method or constructor is invoked on insufficiently aligned object.
12548
12549 @item -fsanitize=object-size
12550 @opindex fsanitize=object-size
12551 This option enables instrumentation of memory references using the
12552 @code{__builtin_object_size} function. Various out of bounds pointer
12553 accesses are detected.
12554
12555 @item -fsanitize=float-divide-by-zero
12556 @opindex fsanitize=float-divide-by-zero
12557 Detect floating-point division by zero. Unlike other similar options,
12558 @option{-fsanitize=float-divide-by-zero} is not enabled by
12559 @option{-fsanitize=undefined}, since floating-point division by zero can
12560 be a legitimate way of obtaining infinities and NaNs.
12561
12562 @item -fsanitize=float-cast-overflow
12563 @opindex fsanitize=float-cast-overflow
12564 This option enables floating-point type to integer conversion checking.
12565 We check that the result of the conversion does not overflow.
12566 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12567 not enabled by @option{-fsanitize=undefined}.
12568 This option does not work well with @code{FE_INVALID} exceptions enabled.
12569
12570 @item -fsanitize=nonnull-attribute
12571 @opindex fsanitize=nonnull-attribute
12572
12573 This option enables instrumentation of calls, checking whether null values
12574 are not passed to arguments marked as requiring a non-null value by the
12575 @code{nonnull} function attribute.
12576
12577 @item -fsanitize=returns-nonnull-attribute
12578 @opindex fsanitize=returns-nonnull-attribute
12579
12580 This option enables instrumentation of return statements in functions
12581 marked with @code{returns_nonnull} function attribute, to detect returning
12582 of null values from such functions.
12583
12584 @item -fsanitize=bool
12585 @opindex fsanitize=bool
12586
12587 This option enables instrumentation of loads from bool. If a value other
12588 than 0/1 is loaded, a run-time error is issued.
12589
12590 @item -fsanitize=enum
12591 @opindex fsanitize=enum
12592
12593 This option enables instrumentation of loads from an enum type. If
12594 a value outside the range of values for the enum type is loaded,
12595 a run-time error is issued.
12596
12597 @item -fsanitize=vptr
12598 @opindex fsanitize=vptr
12599
12600 This option enables instrumentation of C++ member function calls, member
12601 accesses and some conversions between pointers to base and derived classes,
12602 to verify the referenced object has the correct dynamic type.
12603
12604 @item -fsanitize=pointer-overflow
12605 @opindex fsanitize=pointer-overflow
12606
12607 This option enables instrumentation of pointer arithmetics. If the pointer
12608 arithmetics overflows, a run-time error is issued.
12609
12610 @item -fsanitize=builtin
12611 @opindex fsanitize=builtin
12612
12613 This option enables instrumentation of arguments to selected builtin
12614 functions. If an invalid value is passed to such arguments, a run-time
12615 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12616 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12617 by this option.
12618
12619 @end table
12620
12621 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12622 @option{-fsanitize=undefined} gives a diagnostic message.
12623 This currently works only for the C family of languages.
12624
12625 @item -fno-sanitize=all
12626 @opindex fno-sanitize=all
12627
12628 This option disables all previously enabled sanitizers.
12629 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12630 together.
12631
12632 @item -fasan-shadow-offset=@var{number}
12633 @opindex fasan-shadow-offset
12634 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12635 It is useful for experimenting with different shadow memory layouts in
12636 Kernel AddressSanitizer.
12637
12638 @item -fsanitize-sections=@var{s1},@var{s2},...
12639 @opindex fsanitize-sections
12640 Sanitize global variables in selected user-defined sections. @var{si} may
12641 contain wildcards.
12642
12643 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12644 @opindex fsanitize-recover
12645 @opindex fno-sanitize-recover
12646 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12647 mentioned in comma-separated list of @var{opts}. Enabling this option
12648 for a sanitizer component causes it to attempt to continue
12649 running the program as if no error happened. This means multiple
12650 runtime errors can be reported in a single program run, and the exit
12651 code of the program may indicate success even when errors
12652 have been reported. The @option{-fno-sanitize-recover=} option
12653 can be used to alter
12654 this behavior: only the first detected error is reported
12655 and program then exits with a non-zero exit code.
12656
12657 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12658 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12659 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12660 @option{-fsanitize=bounds-strict},
12661 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12662 For these sanitizers error recovery is turned on by default,
12663 except @option{-fsanitize=address}, for which this feature is experimental.
12664 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12665 accepted, the former enables recovery for all sanitizers that support it,
12666 the latter disables recovery for all sanitizers that support it.
12667
12668 Even if a recovery mode is turned on the compiler side, it needs to be also
12669 enabled on the runtime library side, otherwise the failures are still fatal.
12670 The runtime library defaults to @code{halt_on_error=0} for
12671 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12672 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12673 setting the @code{halt_on_error} flag in the corresponding environment variable.
12674
12675 Syntax without an explicit @var{opts} parameter is deprecated. It is
12676 equivalent to specifying an @var{opts} list of:
12677
12678 @smallexample
12679 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12680 @end smallexample
12681
12682 @item -fsanitize-address-use-after-scope
12683 @opindex fsanitize-address-use-after-scope
12684 Enable sanitization of local variables to detect use-after-scope bugs.
12685 The option sets @option{-fstack-reuse} to @samp{none}.
12686
12687 @item -fsanitize-undefined-trap-on-error
12688 @opindex fsanitize-undefined-trap-on-error
12689 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12690 report undefined behavior using @code{__builtin_trap} rather than
12691 a @code{libubsan} library routine. The advantage of this is that the
12692 @code{libubsan} library is not needed and is not linked in, so this
12693 is usable even in freestanding environments.
12694
12695 @item -fsanitize-coverage=trace-pc
12696 @opindex fsanitize-coverage=trace-pc
12697 Enable coverage-guided fuzzing code instrumentation.
12698 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12699
12700 @item -fsanitize-coverage=trace-cmp
12701 @opindex fsanitize-coverage=trace-cmp
12702 Enable dataflow guided fuzzing code instrumentation.
12703 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12704 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12705 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12706 variable or @code{__sanitizer_cov_trace_const_cmp1},
12707 @code{__sanitizer_cov_trace_const_cmp2},
12708 @code{__sanitizer_cov_trace_const_cmp4} or
12709 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12710 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12711 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12712 @code{__sanitizer_cov_trace_switch} for switch statements.
12713
12714 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12715 @opindex fcf-protection
12716 Enable code instrumentation of control-flow transfers to increase
12717 program security by checking that target addresses of control-flow
12718 transfer instructions (such as indirect function call, function return,
12719 indirect jump) are valid. This prevents diverting the flow of control
12720 to an unexpected target. This is intended to protect against such
12721 threats as Return-oriented Programming (ROP), and similarly
12722 call/jmp-oriented programming (COP/JOP).
12723
12724 The value @code{branch} tells the compiler to implement checking of
12725 validity of control-flow transfer at the point of indirect branch
12726 instructions, i.e.@: call/jmp instructions. The value @code{return}
12727 implements checking of validity at the point of returning from a
12728 function. The value @code{full} is an alias for specifying both
12729 @code{branch} and @code{return}. The value @code{none} turns off
12730 instrumentation.
12731
12732 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12733 used. The first bit of @code{__CET__} is set to 1 for the value
12734 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12735 the @code{return}.
12736
12737 You can also use the @code{nocf_check} attribute to identify
12738 which functions and calls should be skipped from instrumentation
12739 (@pxref{Function Attributes}).
12740
12741 Currently the x86 GNU/Linux target provides an implementation based
12742 on Intel Control-flow Enforcement Technology (CET).
12743
12744 @item -fstack-protector
12745 @opindex fstack-protector
12746 Emit extra code to check for buffer overflows, such as stack smashing
12747 attacks. This is done by adding a guard variable to functions with
12748 vulnerable objects. This includes functions that call @code{alloca}, and
12749 functions with buffers larger than 8 bytes. The guards are initialized
12750 when a function is entered and then checked when the function exits.
12751 If a guard check fails, an error message is printed and the program exits.
12752
12753 @item -fstack-protector-all
12754 @opindex fstack-protector-all
12755 Like @option{-fstack-protector} except that all functions are protected.
12756
12757 @item -fstack-protector-strong
12758 @opindex fstack-protector-strong
12759 Like @option{-fstack-protector} but includes additional functions to
12760 be protected --- those that have local array definitions, or have
12761 references to local frame addresses.
12762
12763 @item -fstack-protector-explicit
12764 @opindex fstack-protector-explicit
12765 Like @option{-fstack-protector} but only protects those functions which
12766 have the @code{stack_protect} attribute.
12767
12768 @item -fstack-check
12769 @opindex fstack-check
12770 Generate code to verify that you do not go beyond the boundary of the
12771 stack. You should specify this flag if you are running in an
12772 environment with multiple threads, but you only rarely need to specify it in
12773 a single-threaded environment since stack overflow is automatically
12774 detected on nearly all systems if there is only one stack.
12775
12776 Note that this switch does not actually cause checking to be done; the
12777 operating system or the language runtime must do that. The switch causes
12778 generation of code to ensure that they see the stack being extended.
12779
12780 You can additionally specify a string parameter: @samp{no} means no
12781 checking, @samp{generic} means force the use of old-style checking,
12782 @samp{specific} means use the best checking method and is equivalent
12783 to bare @option{-fstack-check}.
12784
12785 Old-style checking is a generic mechanism that requires no specific
12786 target support in the compiler but comes with the following drawbacks:
12787
12788 @enumerate
12789 @item
12790 Modified allocation strategy for large objects: they are always
12791 allocated dynamically if their size exceeds a fixed threshold. Note this
12792 may change the semantics of some code.
12793
12794 @item
12795 Fixed limit on the size of the static frame of functions: when it is
12796 topped by a particular function, stack checking is not reliable and
12797 a warning is issued by the compiler.
12798
12799 @item
12800 Inefficiency: because of both the modified allocation strategy and the
12801 generic implementation, code performance is hampered.
12802 @end enumerate
12803
12804 Note that old-style stack checking is also the fallback method for
12805 @samp{specific} if no target support has been added in the compiler.
12806
12807 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12808 and stack overflows. @samp{specific} is an excellent choice when compiling
12809 Ada code. It is not generally sufficient to protect against stack-clash
12810 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12811
12812 @item -fstack-clash-protection
12813 @opindex fstack-clash-protection
12814 Generate code to prevent stack clash style attacks. When this option is
12815 enabled, the compiler will only allocate one page of stack space at a time
12816 and each page is accessed immediately after allocation. Thus, it prevents
12817 allocations from jumping over any stack guard page provided by the
12818 operating system.
12819
12820 Most targets do not fully support stack clash protection. However, on
12821 those targets @option{-fstack-clash-protection} will protect dynamic stack
12822 allocations. @option{-fstack-clash-protection} may also provide limited
12823 protection for static stack allocations if the target supports
12824 @option{-fstack-check=specific}.
12825
12826 @item -fstack-limit-register=@var{reg}
12827 @itemx -fstack-limit-symbol=@var{sym}
12828 @itemx -fno-stack-limit
12829 @opindex fstack-limit-register
12830 @opindex fstack-limit-symbol
12831 @opindex fno-stack-limit
12832 Generate code to ensure that the stack does not grow beyond a certain value,
12833 either the value of a register or the address of a symbol. If a larger
12834 stack is required, a signal is raised at run time. For most targets,
12835 the signal is raised before the stack overruns the boundary, so
12836 it is possible to catch the signal without taking special precautions.
12837
12838 For instance, if the stack starts at absolute address @samp{0x80000000}
12839 and grows downwards, you can use the flags
12840 @option{-fstack-limit-symbol=__stack_limit} and
12841 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12842 of 128KB@. Note that this may only work with the GNU linker.
12843
12844 You can locally override stack limit checking by using the
12845 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12846
12847 @item -fsplit-stack
12848 @opindex fsplit-stack
12849 Generate code to automatically split the stack before it overflows.
12850 The resulting program has a discontiguous stack which can only
12851 overflow if the program is unable to allocate any more memory. This
12852 is most useful when running threaded programs, as it is no longer
12853 necessary to calculate a good stack size to use for each thread. This
12854 is currently only implemented for the x86 targets running
12855 GNU/Linux.
12856
12857 When code compiled with @option{-fsplit-stack} calls code compiled
12858 without @option{-fsplit-stack}, there may not be much stack space
12859 available for the latter code to run. If compiling all code,
12860 including library code, with @option{-fsplit-stack} is not an option,
12861 then the linker can fix up these calls so that the code compiled
12862 without @option{-fsplit-stack} always has a large stack. Support for
12863 this is implemented in the gold linker in GNU binutils release 2.21
12864 and later.
12865
12866 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12867 @opindex fvtable-verify
12868 This option is only available when compiling C++ code.
12869 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12870 feature that verifies at run time, for every virtual call, that
12871 the vtable pointer through which the call is made is valid for the type of
12872 the object, and has not been corrupted or overwritten. If an invalid vtable
12873 pointer is detected at run time, an error is reported and execution of the
12874 program is immediately halted.
12875
12876 This option causes run-time data structures to be built at program startup,
12877 which are used for verifying the vtable pointers.
12878 The options @samp{std} and @samp{preinit}
12879 control the timing of when these data structures are built. In both cases the
12880 data structures are built before execution reaches @code{main}. Using
12881 @option{-fvtable-verify=std} causes the data structures to be built after
12882 shared libraries have been loaded and initialized.
12883 @option{-fvtable-verify=preinit} causes them to be built before shared
12884 libraries have been loaded and initialized.
12885
12886 If this option appears multiple times in the command line with different
12887 values specified, @samp{none} takes highest priority over both @samp{std} and
12888 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12889
12890 @item -fvtv-debug
12891 @opindex fvtv-debug
12892 When used in conjunction with @option{-fvtable-verify=std} or
12893 @option{-fvtable-verify=preinit}, causes debug versions of the
12894 runtime functions for the vtable verification feature to be called.
12895 This flag also causes the compiler to log information about which
12896 vtable pointers it finds for each class.
12897 This information is written to a file named @file{vtv_set_ptr_data.log}
12898 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12899 if that is defined or the current working directory otherwise.
12900
12901 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12902 file, be sure to delete any existing one.
12903
12904 @item -fvtv-counts
12905 @opindex fvtv-counts
12906 This is a debugging flag. When used in conjunction with
12907 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12908 causes the compiler to keep track of the total number of virtual calls
12909 it encounters and the number of verifications it inserts. It also
12910 counts the number of calls to certain run-time library functions
12911 that it inserts and logs this information for each compilation unit.
12912 The compiler writes this information to a file named
12913 @file{vtv_count_data.log} in the directory named by the environment
12914 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12915 directory otherwise. It also counts the size of the vtable pointer sets
12916 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12917 in the same directory.
12918
12919 Note: This feature @emph{appends} data to the log files. To get fresh log
12920 files, be sure to delete any existing ones.
12921
12922 @item -finstrument-functions
12923 @opindex finstrument-functions
12924 Generate instrumentation calls for entry and exit to functions. Just
12925 after function entry and just before function exit, the following
12926 profiling functions are called with the address of the current
12927 function and its call site. (On some platforms,
12928 @code{__builtin_return_address} does not work beyond the current
12929 function, so the call site information may not be available to the
12930 profiling functions otherwise.)
12931
12932 @smallexample
12933 void __cyg_profile_func_enter (void *this_fn,
12934 void *call_site);
12935 void __cyg_profile_func_exit (void *this_fn,
12936 void *call_site);
12937 @end smallexample
12938
12939 The first argument is the address of the start of the current function,
12940 which may be looked up exactly in the symbol table.
12941
12942 This instrumentation is also done for functions expanded inline in other
12943 functions. The profiling calls indicate where, conceptually, the
12944 inline function is entered and exited. This means that addressable
12945 versions of such functions must be available. If all your uses of a
12946 function are expanded inline, this may mean an additional expansion of
12947 code size. If you use @code{extern inline} in your C code, an
12948 addressable version of such functions must be provided. (This is
12949 normally the case anyway, but if you get lucky and the optimizer always
12950 expands the functions inline, you might have gotten away without
12951 providing static copies.)
12952
12953 A function may be given the attribute @code{no_instrument_function}, in
12954 which case this instrumentation is not done. This can be used, for
12955 example, for the profiling functions listed above, high-priority
12956 interrupt routines, and any functions from which the profiling functions
12957 cannot safely be called (perhaps signal handlers, if the profiling
12958 routines generate output or allocate memory).
12959 @xref{Common Function Attributes}.
12960
12961 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12962 @opindex finstrument-functions-exclude-file-list
12963
12964 Set the list of functions that are excluded from instrumentation (see
12965 the description of @option{-finstrument-functions}). If the file that
12966 contains a function definition matches with one of @var{file}, then
12967 that function is not instrumented. The match is done on substrings:
12968 if the @var{file} parameter is a substring of the file name, it is
12969 considered to be a match.
12970
12971 For example:
12972
12973 @smallexample
12974 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12975 @end smallexample
12976
12977 @noindent
12978 excludes any inline function defined in files whose pathnames
12979 contain @file{/bits/stl} or @file{include/sys}.
12980
12981 If, for some reason, you want to include letter @samp{,} in one of
12982 @var{sym}, write @samp{\,}. For example,
12983 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12984 (note the single quote surrounding the option).
12985
12986 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12987 @opindex finstrument-functions-exclude-function-list
12988
12989 This is similar to @option{-finstrument-functions-exclude-file-list},
12990 but this option sets the list of function names to be excluded from
12991 instrumentation. The function name to be matched is its user-visible
12992 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12993 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12994 match is done on substrings: if the @var{sym} parameter is a substring
12995 of the function name, it is considered to be a match. For C99 and C++
12996 extended identifiers, the function name must be given in UTF-8, not
12997 using universal character names.
12998
12999 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13000 @opindex fpatchable-function-entry
13001 Generate @var{N} NOPs right at the beginning
13002 of each function, with the function entry point before the @var{M}th NOP.
13003 If @var{M} is omitted, it defaults to @code{0} so the
13004 function entry points to the address just at the first NOP.
13005 The NOP instructions reserve extra space which can be used to patch in
13006 any desired instrumentation at run time, provided that the code segment
13007 is writable. The amount of space is controllable indirectly via
13008 the number of NOPs; the NOP instruction used corresponds to the instruction
13009 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13010 is target-specific and may also depend on the architecture variant and/or
13011 other compilation options.
13012
13013 For run-time identification, the starting addresses of these areas,
13014 which correspond to their respective function entries minus @var{M},
13015 are additionally collected in the @code{__patchable_function_entries}
13016 section of the resulting binary.
13017
13018 Note that the value of @code{__attribute__ ((patchable_function_entry
13019 (N,M)))} takes precedence over command-line option
13020 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13021 the area size or to remove it completely on a single function.
13022 If @code{N=0}, no pad location is recorded.
13023
13024 The NOP instructions are inserted at---and maybe before, depending on
13025 @var{M}---the function entry address, even before the prologue.
13026
13027 @end table
13028
13029
13030 @node Preprocessor Options
13031 @section Options Controlling the Preprocessor
13032 @cindex preprocessor options
13033 @cindex options, preprocessor
13034
13035 These options control the C preprocessor, which is run on each C source
13036 file before actual compilation.
13037
13038 If you use the @option{-E} option, nothing is done except preprocessing.
13039 Some of these options make sense only together with @option{-E} because
13040 they cause the preprocessor output to be unsuitable for actual
13041 compilation.
13042
13043 In addition to the options listed here, there are a number of options
13044 to control search paths for include files documented in
13045 @ref{Directory Options}.
13046 Options to control preprocessor diagnostics are listed in
13047 @ref{Warning Options}.
13048
13049 @table @gcctabopt
13050 @include cppopts.texi
13051
13052 @item -Wp,@var{option}
13053 @opindex Wp
13054 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13055 and pass @var{option} directly through to the preprocessor. If
13056 @var{option} contains commas, it is split into multiple options at the
13057 commas. However, many options are modified, translated or interpreted
13058 by the compiler driver before being passed to the preprocessor, and
13059 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13060 interface is undocumented and subject to change, so whenever possible
13061 you should avoid using @option{-Wp} and let the driver handle the
13062 options instead.
13063
13064 @item -Xpreprocessor @var{option}
13065 @opindex Xpreprocessor
13066 Pass @var{option} as an option to the preprocessor. You can use this to
13067 supply system-specific preprocessor options that GCC does not
13068 recognize.
13069
13070 If you want to pass an option that takes an argument, you must use
13071 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13072
13073 @item -no-integrated-cpp
13074 @opindex no-integrated-cpp
13075 Perform preprocessing as a separate pass before compilation.
13076 By default, GCC performs preprocessing as an integrated part of
13077 input tokenization and parsing.
13078 If this option is provided, the appropriate language front end
13079 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13080 and Objective-C, respectively) is instead invoked twice,
13081 once for preprocessing only and once for actual compilation
13082 of the preprocessed input.
13083 This option may be useful in conjunction with the @option{-B} or
13084 @option{-wrapper} options to specify an alternate preprocessor or
13085 perform additional processing of the program source between
13086 normal preprocessing and compilation.
13087
13088 @end table
13089
13090 @node Assembler Options
13091 @section Passing Options to the Assembler
13092
13093 @c prevent bad page break with this line
13094 You can pass options to the assembler.
13095
13096 @table @gcctabopt
13097 @item -Wa,@var{option}
13098 @opindex Wa
13099 Pass @var{option} as an option to the assembler. If @var{option}
13100 contains commas, it is split into multiple options at the commas.
13101
13102 @item -Xassembler @var{option}
13103 @opindex Xassembler
13104 Pass @var{option} as an option to the assembler. You can use this to
13105 supply system-specific assembler options that GCC does not
13106 recognize.
13107
13108 If you want to pass an option that takes an argument, you must use
13109 @option{-Xassembler} twice, once for the option and once for the argument.
13110
13111 @end table
13112
13113 @node Link Options
13114 @section Options for Linking
13115 @cindex link options
13116 @cindex options, linking
13117
13118 These options come into play when the compiler links object files into
13119 an executable output file. They are meaningless if the compiler is
13120 not doing a link step.
13121
13122 @table @gcctabopt
13123 @cindex file names
13124 @item @var{object-file-name}
13125 A file name that does not end in a special recognized suffix is
13126 considered to name an object file or library. (Object files are
13127 distinguished from libraries by the linker according to the file
13128 contents.) If linking is done, these object files are used as input
13129 to the linker.
13130
13131 @item -c
13132 @itemx -S
13133 @itemx -E
13134 @opindex c
13135 @opindex S
13136 @opindex E
13137 If any of these options is used, then the linker is not run, and
13138 object file names should not be used as arguments. @xref{Overall
13139 Options}.
13140
13141 @item -flinker-output=@var{type}
13142 @opindex flinker-output
13143 This option controls code generation of the link time optimizer. By
13144 default the linker output is automatically determined by the linker
13145 plugin. For debugging the compiler and if incremental linking with a
13146 non-LTO object file is desired, it may be useful to control the type
13147 manually.
13148
13149 If @var{type} is @samp{exec} code generation produces a static
13150 binary. In this case @option{-fpic} and @option{-fpie} are both
13151 disabled.
13152
13153 If @var{type} is @samp{dyn} code generation produces a shared
13154 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13155 but not enabled automatically. This allows to build shared libraries
13156 without position independent code on architectures where this is
13157 possible, i.e.@: on x86.
13158
13159 If @var{type} is @samp{pie} code generation produces an @option{-fpie}
13160 executable. This results in similar optimizations as @samp{exec}
13161 except that @option{-fpie} is not disabled if specified at compilation
13162 time.
13163
13164 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13165 done. The sections containing intermediate code for link-time optimization are
13166 merged, pre-optimized, and output to the resulting object file. In addition, if
13167 @option{-ffat-lto-objects} is specified the binary code is produced for future
13168 non-LTO linking. The object file produced by incremental linking will be smaller
13169 than a static library produced from the same object files. At link time the
13170 result of incremental linking will also load faster to compiler than a static
13171 library assuming that the majority of objects in the library are used.
13172
13173 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13174 code generation is forced, a final binary is produced and the intermediate
13175 code for later link-time optimization is stripped. When multiple object files
13176 are linked together the resulting code will be optimized better than with
13177 link-time optimizations disabled (for example, cross-module inlining will
13178 happen), most of benefits of whole program optimizations are however lost.
13179
13180 During the incremental link (by @option{-r}) the linker plugin will default to
13181 @option{rel}. With current interfaces to GNU Binutils it is however not
13182 possible to incrementally link LTO objects and non-LTO objects into a single
13183 mixed object file. In the case any of object files in incremental link cannot
13184 be used for link-time optimization the linker plugin will issue a warning and
13185 use @samp{nolto-rel}. To maintain the whole program optimization it is
13186 recommended to link such objects into static library instead. Alternatively it
13187 is possible to use H.J. Lu's binutils with support for mixed objects.
13188
13189 @item -fuse-ld=bfd
13190 @opindex fuse-ld=bfd
13191 Use the @command{bfd} linker instead of the default linker.
13192
13193 @item -fuse-ld=gold
13194 @opindex fuse-ld=gold
13195 Use the @command{gold} linker instead of the default linker.
13196
13197 @item -fuse-ld=lld
13198 @opindex fuse-ld=lld
13199 Use the LLVM @command{lld} linker instead of the default linker.
13200
13201 @cindex Libraries
13202 @item -l@var{library}
13203 @itemx -l @var{library}
13204 @opindex l
13205 Search the library named @var{library} when linking. (The second
13206 alternative with the library as a separate argument is only for
13207 POSIX compliance and is not recommended.)
13208
13209 The @option{-l} option is passed directly to the linker by GCC. Refer
13210 to your linker documentation for exact details. The general
13211 description below applies to the GNU linker.
13212
13213 The linker searches a standard list of directories for the library.
13214 The directories searched include several standard system directories
13215 plus any that you specify with @option{-L}.
13216
13217 Static libraries are archives of object files, and have file names
13218 like @file{lib@var{library}.a}. Some targets also support shared
13219 libraries, which typically have names like @file{lib@var{library}.so}.
13220 If both static and shared libraries are found, the linker gives
13221 preference to linking with the shared library unless the
13222 @option{-static} option is used.
13223
13224 It makes a difference where in the command you write this option; the
13225 linker searches and processes libraries and object files in the order they
13226 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13227 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13228 to functions in @samp{z}, those functions may not be loaded.
13229
13230 @item -lobjc
13231 @opindex lobjc
13232 You need this special case of the @option{-l} option in order to
13233 link an Objective-C or Objective-C++ program.
13234
13235 @item -nostartfiles
13236 @opindex nostartfiles
13237 Do not use the standard system startup files when linking.
13238 The standard system libraries are used normally, unless @option{-nostdlib},
13239 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13240
13241 @item -nodefaultlibs
13242 @opindex nodefaultlibs
13243 Do not use the standard system libraries when linking.
13244 Only the libraries you specify are passed to the linker, and options
13245 specifying linkage of the system libraries, such as @option{-static-libgcc}
13246 or @option{-shared-libgcc}, are ignored.
13247 The standard startup files are used normally, unless @option{-nostartfiles}
13248 is used.
13249
13250 The compiler may generate calls to @code{memcmp},
13251 @code{memset}, @code{memcpy} and @code{memmove}.
13252 These entries are usually resolved by entries in
13253 libc. These entry points should be supplied through some other
13254 mechanism when this option is specified.
13255
13256 @item -nolibc
13257 @opindex nolibc
13258 Do not use the C library or system libraries tightly coupled with it when
13259 linking. Still link with the startup files, @file{libgcc} or toolchain
13260 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13261 or @file{libstdc++} unless options preventing their inclusion are used as
13262 well. This typically removes @option{-lc} from the link command line, as well
13263 as system libraries that normally go with it and become meaningless when
13264 absence of a C library is assumed, for example @option{-lpthread} or
13265 @option{-lm} in some configurations. This is intended for bare-board
13266 targets when there is indeed no C library available.
13267
13268 @item -nostdlib
13269 @opindex nostdlib
13270 Do not use the standard system startup files or libraries when linking.
13271 No startup files and only the libraries you specify are passed to
13272 the linker, and options specifying linkage of the system libraries, such as
13273 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13274
13275 The compiler may generate calls to @code{memcmp}, @code{memset},
13276 @code{memcpy} and @code{memmove}.
13277 These entries are usually resolved by entries in
13278 libc. These entry points should be supplied through some other
13279 mechanism when this option is specified.
13280
13281 @cindex @option{-lgcc}, use with @option{-nostdlib}
13282 @cindex @option{-nostdlib} and unresolved references
13283 @cindex unresolved references and @option{-nostdlib}
13284 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13285 @cindex @option{-nodefaultlibs} and unresolved references
13286 @cindex unresolved references and @option{-nodefaultlibs}
13287 One of the standard libraries bypassed by @option{-nostdlib} and
13288 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13289 which GCC uses to overcome shortcomings of particular machines, or special
13290 needs for some languages.
13291 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13292 Collection (GCC) Internals},
13293 for more discussion of @file{libgcc.a}.)
13294 In most cases, you need @file{libgcc.a} even when you want to avoid
13295 other standard libraries. In other words, when you specify @option{-nostdlib}
13296 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13297 This ensures that you have no unresolved references to internal GCC
13298 library subroutines.
13299 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13300 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13301 GNU Compiler Collection (GCC) Internals}.)
13302
13303 @item -e @var{entry}
13304 @itemx --entry=@var{entry}
13305 @opindex e
13306 @opindex entry
13307
13308 Specify that the program entry point is @var{entry}. The argument is
13309 interpreted by the linker; the GNU linker accepts either a symbol name
13310 or an address.
13311
13312 @item -pie
13313 @opindex pie
13314 Produce a dynamically linked position independent executable on targets
13315 that support it. For predictable results, you must also specify the same
13316 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13317 or model suboptions) when you specify this linker option.
13318
13319 @item -no-pie
13320 @opindex no-pie
13321 Don't produce a dynamically linked position independent executable.
13322
13323 @item -static-pie
13324 @opindex static-pie
13325 Produce a static position independent executable on targets that support
13326 it. A static position independent executable is similar to a static
13327 executable, but can be loaded at any address without a dynamic linker.
13328 For predictable results, you must also specify the same set of options
13329 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13330 suboptions) when you specify this linker option.
13331
13332 @item -pthread
13333 @opindex pthread
13334 Link with the POSIX threads library. This option is supported on
13335 GNU/Linux targets, most other Unix derivatives, and also on
13336 x86 Cygwin and MinGW targets. On some targets this option also sets
13337 flags for the preprocessor, so it should be used consistently for both
13338 compilation and linking.
13339
13340 @item -r
13341 @opindex r
13342 Produce a relocatable object as output. This is also known as partial
13343 linking.
13344
13345 @item -rdynamic
13346 @opindex rdynamic
13347 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13348 that support it. This instructs the linker to add all symbols, not
13349 only used ones, to the dynamic symbol table. This option is needed
13350 for some uses of @code{dlopen} or to allow obtaining backtraces
13351 from within a program.
13352
13353 @item -s
13354 @opindex s
13355 Remove all symbol table and relocation information from the executable.
13356
13357 @item -static
13358 @opindex static
13359 On systems that support dynamic linking, this overrides @option{-pie}
13360 and prevents linking with the shared libraries. On other systems, this
13361 option has no effect.
13362
13363 @item -shared
13364 @opindex shared
13365 Produce a shared object which can then be linked with other objects to
13366 form an executable. Not all systems support this option. For predictable
13367 results, you must also specify the same set of options used for compilation
13368 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13369 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13370 needs to build supplementary stub code for constructors to work. On
13371 multi-libbed systems, @samp{gcc -shared} must select the correct support
13372 libraries to link against. Failing to supply the correct flags may lead
13373 to subtle defects. Supplying them in cases where they are not necessary
13374 is innocuous.}
13375
13376 @item -shared-libgcc
13377 @itemx -static-libgcc
13378 @opindex shared-libgcc
13379 @opindex static-libgcc
13380 On systems that provide @file{libgcc} as a shared library, these options
13381 force the use of either the shared or static version, respectively.
13382 If no shared version of @file{libgcc} was built when the compiler was
13383 configured, these options have no effect.
13384
13385 There are several situations in which an application should use the
13386 shared @file{libgcc} instead of the static version. The most common
13387 of these is when the application wishes to throw and catch exceptions
13388 across different shared libraries. In that case, each of the libraries
13389 as well as the application itself should use the shared @file{libgcc}.
13390
13391 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13392 whenever you build a shared library or a main executable, because C++
13393 programs typically use exceptions, so this is the right thing to do.
13394
13395 If, instead, you use the GCC driver to create shared libraries, you may
13396 find that they are not always linked with the shared @file{libgcc}.
13397 If GCC finds, at its configuration time, that you have a non-GNU linker
13398 or a GNU linker that does not support option @option{--eh-frame-hdr},
13399 it links the shared version of @file{libgcc} into shared libraries
13400 by default. Otherwise, it takes advantage of the linker and optimizes
13401 away the linking with the shared version of @file{libgcc}, linking with
13402 the static version of libgcc by default. This allows exceptions to
13403 propagate through such shared libraries, without incurring relocation
13404 costs at library load time.
13405
13406 However, if a library or main executable is supposed to throw or catch
13407 exceptions, you must link it using the G++ driver, or using the option
13408 @option{-shared-libgcc}, such that it is linked with the shared
13409 @file{libgcc}.
13410
13411 @item -static-libasan
13412 @opindex static-libasan
13413 When the @option{-fsanitize=address} option is used to link a program,
13414 the GCC driver automatically links against @option{libasan}. If
13415 @file{libasan} is available as a shared library, and the @option{-static}
13416 option is not used, then this links against the shared version of
13417 @file{libasan}. The @option{-static-libasan} option directs the GCC
13418 driver to link @file{libasan} statically, without necessarily linking
13419 other libraries statically.
13420
13421 @item -static-libtsan
13422 @opindex static-libtsan
13423 When the @option{-fsanitize=thread} option is used to link a program,
13424 the GCC driver automatically links against @option{libtsan}. If
13425 @file{libtsan} is available as a shared library, and the @option{-static}
13426 option is not used, then this links against the shared version of
13427 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13428 driver to link @file{libtsan} statically, without necessarily linking
13429 other libraries statically.
13430
13431 @item -static-liblsan
13432 @opindex static-liblsan
13433 When the @option{-fsanitize=leak} option is used to link a program,
13434 the GCC driver automatically links against @option{liblsan}. If
13435 @file{liblsan} is available as a shared library, and the @option{-static}
13436 option is not used, then this links against the shared version of
13437 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13438 driver to link @file{liblsan} statically, without necessarily linking
13439 other libraries statically.
13440
13441 @item -static-libubsan
13442 @opindex static-libubsan
13443 When the @option{-fsanitize=undefined} option is used to link a program,
13444 the GCC driver automatically links against @option{libubsan}. If
13445 @file{libubsan} is available as a shared library, and the @option{-static}
13446 option is not used, then this links against the shared version of
13447 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13448 driver to link @file{libubsan} statically, without necessarily linking
13449 other libraries statically.
13450
13451 @item -static-libstdc++
13452 @opindex static-libstdc++
13453 When the @command{g++} program is used to link a C++ program, it
13454 normally automatically links against @option{libstdc++}. If
13455 @file{libstdc++} is available as a shared library, and the
13456 @option{-static} option is not used, then this links against the
13457 shared version of @file{libstdc++}. That is normally fine. However, it
13458 is sometimes useful to freeze the version of @file{libstdc++} used by
13459 the program without going all the way to a fully static link. The
13460 @option{-static-libstdc++} option directs the @command{g++} driver to
13461 link @file{libstdc++} statically, without necessarily linking other
13462 libraries statically.
13463
13464 @item -symbolic
13465 @opindex symbolic
13466 Bind references to global symbols when building a shared object. Warn
13467 about any unresolved references (unless overridden by the link editor
13468 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13469 this option.
13470
13471 @item -T @var{script}
13472 @opindex T
13473 @cindex linker script
13474 Use @var{script} as the linker script. This option is supported by most
13475 systems using the GNU linker. On some targets, such as bare-board
13476 targets without an operating system, the @option{-T} option may be required
13477 when linking to avoid references to undefined symbols.
13478
13479 @item -Xlinker @var{option}
13480 @opindex Xlinker
13481 Pass @var{option} as an option to the linker. You can use this to
13482 supply system-specific linker options that GCC does not recognize.
13483
13484 If you want to pass an option that takes a separate argument, you must use
13485 @option{-Xlinker} twice, once for the option and once for the argument.
13486 For example, to pass @option{-assert definitions}, you must write
13487 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13488 @option{-Xlinker "-assert definitions"}, because this passes the entire
13489 string as a single argument, which is not what the linker expects.
13490
13491 When using the GNU linker, it is usually more convenient to pass
13492 arguments to linker options using the @option{@var{option}=@var{value}}
13493 syntax than as separate arguments. For example, you can specify
13494 @option{-Xlinker -Map=output.map} rather than
13495 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13496 this syntax for command-line options.
13497
13498 @item -Wl,@var{option}
13499 @opindex Wl
13500 Pass @var{option} as an option to the linker. If @var{option} contains
13501 commas, it is split into multiple options at the commas. You can use this
13502 syntax to pass an argument to the option.
13503 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13504 linker. When using the GNU linker, you can also get the same effect with
13505 @option{-Wl,-Map=output.map}.
13506
13507 @item -u @var{symbol}
13508 @opindex u
13509 Pretend the symbol @var{symbol} is undefined, to force linking of
13510 library modules to define it. You can use @option{-u} multiple times with
13511 different symbols to force loading of additional library modules.
13512
13513 @item -z @var{keyword}
13514 @opindex z
13515 @option{-z} is passed directly on to the linker along with the keyword
13516 @var{keyword}. See the section in the documentation of your linker for
13517 permitted values and their meanings.
13518 @end table
13519
13520 @node Directory Options
13521 @section Options for Directory Search
13522 @cindex directory options
13523 @cindex options, directory search
13524 @cindex search path
13525
13526 These options specify directories to search for header files, for
13527 libraries and for parts of the compiler:
13528
13529 @table @gcctabopt
13530 @include cppdiropts.texi
13531
13532 @item -iplugindir=@var{dir}
13533 @opindex iplugindir=
13534 Set the directory to search for plugins that are passed
13535 by @option{-fplugin=@var{name}} instead of
13536 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13537 to be used by the user, but only passed by the driver.
13538
13539 @item -L@var{dir}
13540 @opindex L
13541 Add directory @var{dir} to the list of directories to be searched
13542 for @option{-l}.
13543
13544 @item -B@var{prefix}
13545 @opindex B
13546 This option specifies where to find the executables, libraries,
13547 include files, and data files of the compiler itself.
13548
13549 The compiler driver program runs one or more of the subprograms
13550 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13551 @var{prefix} as a prefix for each program it tries to run, both with and
13552 without @samp{@var{machine}/@var{version}/} for the corresponding target
13553 machine and compiler version.
13554
13555 For each subprogram to be run, the compiler driver first tries the
13556 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13557 is not specified, the driver tries two standard prefixes,
13558 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13559 those results in a file name that is found, the unmodified program
13560 name is searched for using the directories specified in your
13561 @env{PATH} environment variable.
13562
13563 The compiler checks to see if the path provided by @option{-B}
13564 refers to a directory, and if necessary it adds a directory
13565 separator character at the end of the path.
13566
13567 @option{-B} prefixes that effectively specify directory names also apply
13568 to libraries in the linker, because the compiler translates these
13569 options into @option{-L} options for the linker. They also apply to
13570 include files in the preprocessor, because the compiler translates these
13571 options into @option{-isystem} options for the preprocessor. In this case,
13572 the compiler appends @samp{include} to the prefix.
13573
13574 The runtime support file @file{libgcc.a} can also be searched for using
13575 the @option{-B} prefix, if needed. If it is not found there, the two
13576 standard prefixes above are tried, and that is all. The file is left
13577 out of the link if it is not found by those means.
13578
13579 Another way to specify a prefix much like the @option{-B} prefix is to use
13580 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13581 Variables}.
13582
13583 As a special kludge, if the path provided by @option{-B} is
13584 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13585 9, then it is replaced by @file{[dir/]include}. This is to help
13586 with boot-strapping the compiler.
13587
13588 @item -no-canonical-prefixes
13589 @opindex no-canonical-prefixes
13590 Do not expand any symbolic links, resolve references to @samp{/../}
13591 or @samp{/./}, or make the path absolute when generating a relative
13592 prefix.
13593
13594 @item --sysroot=@var{dir}
13595 @opindex sysroot
13596 Use @var{dir} as the logical root directory for headers and libraries.
13597 For example, if the compiler normally searches for headers in
13598 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13599 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13600
13601 If you use both this option and the @option{-isysroot} option, then
13602 the @option{--sysroot} option applies to libraries, but the
13603 @option{-isysroot} option applies to header files.
13604
13605 The GNU linker (beginning with version 2.16) has the necessary support
13606 for this option. If your linker does not support this option, the
13607 header file aspect of @option{--sysroot} still works, but the
13608 library aspect does not.
13609
13610 @item --no-sysroot-suffix
13611 @opindex no-sysroot-suffix
13612 For some targets, a suffix is added to the root directory specified
13613 with @option{--sysroot}, depending on the other options used, so that
13614 headers may for example be found in
13615 @file{@var{dir}/@var{suffix}/usr/include} instead of
13616 @file{@var{dir}/usr/include}. This option disables the addition of
13617 such a suffix.
13618
13619 @end table
13620
13621 @node Code Gen Options
13622 @section Options for Code Generation Conventions
13623 @cindex code generation conventions
13624 @cindex options, code generation
13625 @cindex run-time options
13626
13627 These machine-independent options control the interface conventions
13628 used in code generation.
13629
13630 Most of them have both positive and negative forms; the negative form
13631 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13632 one of the forms is listed---the one that is not the default. You
13633 can figure out the other form by either removing @samp{no-} or adding
13634 it.
13635
13636 @table @gcctabopt
13637 @item -fstack-reuse=@var{reuse-level}
13638 @opindex fstack_reuse
13639 This option controls stack space reuse for user declared local/auto variables
13640 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13641 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13642 local variables and temporaries, @samp{named_vars} enables the reuse only for
13643 user defined local variables with names, and @samp{none} disables stack reuse
13644 completely. The default value is @samp{all}. The option is needed when the
13645 program extends the lifetime of a scoped local variable or a compiler generated
13646 temporary beyond the end point defined by the language. When a lifetime of
13647 a variable ends, and if the variable lives in memory, the optimizing compiler
13648 has the freedom to reuse its stack space with other temporaries or scoped
13649 local variables whose live range does not overlap with it. Legacy code extending
13650 local lifetime is likely to break with the stack reuse optimization.
13651
13652 For example,
13653
13654 @smallexample
13655 int *p;
13656 @{
13657 int local1;
13658
13659 p = &local1;
13660 local1 = 10;
13661 ....
13662 @}
13663 @{
13664 int local2;
13665 local2 = 20;
13666 ...
13667 @}
13668
13669 if (*p == 10) // out of scope use of local1
13670 @{
13671
13672 @}
13673 @end smallexample
13674
13675 Another example:
13676 @smallexample
13677
13678 struct A
13679 @{
13680 A(int k) : i(k), j(k) @{ @}
13681 int i;
13682 int j;
13683 @};
13684
13685 A *ap;
13686
13687 void foo(const A& ar)
13688 @{
13689 ap = &ar;
13690 @}
13691
13692 void bar()
13693 @{
13694 foo(A(10)); // temp object's lifetime ends when foo returns
13695
13696 @{
13697 A a(20);
13698 ....
13699 @}
13700 ap->i+= 10; // ap references out of scope temp whose space
13701 // is reused with a. What is the value of ap->i?
13702 @}
13703
13704 @end smallexample
13705
13706 The lifetime of a compiler generated temporary is well defined by the C++
13707 standard. When a lifetime of a temporary ends, and if the temporary lives
13708 in memory, the optimizing compiler has the freedom to reuse its stack
13709 space with other temporaries or scoped local variables whose live range
13710 does not overlap with it. However some of the legacy code relies on
13711 the behavior of older compilers in which temporaries' stack space is
13712 not reused, the aggressive stack reuse can lead to runtime errors. This
13713 option is used to control the temporary stack reuse optimization.
13714
13715 @item -ftrapv
13716 @opindex ftrapv
13717 This option generates traps for signed overflow on addition, subtraction,
13718 multiplication operations.
13719 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13720 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13721 @option{-fwrapv} being effective. Note that only active options override, so
13722 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13723 results in @option{-ftrapv} being effective.
13724
13725 @item -fwrapv
13726 @opindex fwrapv
13727 This option instructs the compiler to assume that signed arithmetic
13728 overflow of addition, subtraction and multiplication wraps around
13729 using twos-complement representation. This flag enables some optimizations
13730 and disables others.
13731 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13732 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13733 @option{-fwrapv} being effective. Note that only active options override, so
13734 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13735 results in @option{-ftrapv} being effective.
13736
13737 @item -fwrapv-pointer
13738 @opindex fwrapv-pointer
13739 This option instructs the compiler to assume that pointer arithmetic
13740 overflow on addition and subtraction wraps around using twos-complement
13741 representation. This flag disables some optimizations which assume
13742 pointer overflow is invalid.
13743
13744 @item -fstrict-overflow
13745 @opindex fstrict-overflow
13746 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13747 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13748
13749 @item -fexceptions
13750 @opindex fexceptions
13751 Enable exception handling. Generates extra code needed to propagate
13752 exceptions. For some targets, this implies GCC generates frame
13753 unwind information for all functions, which can produce significant data
13754 size overhead, although it does not affect execution. If you do not
13755 specify this option, GCC enables it by default for languages like
13756 C++ that normally require exception handling, and disables it for
13757 languages like C that do not normally require it. However, you may need
13758 to enable this option when compiling C code that needs to interoperate
13759 properly with exception handlers written in C++. You may also wish to
13760 disable this option if you are compiling older C++ programs that don't
13761 use exception handling.
13762
13763 @item -fnon-call-exceptions
13764 @opindex fnon-call-exceptions
13765 Generate code that allows trapping instructions to throw exceptions.
13766 Note that this requires platform-specific runtime support that does
13767 not exist everywhere. Moreover, it only allows @emph{trapping}
13768 instructions to throw exceptions, i.e.@: memory references or floating-point
13769 instructions. It does not allow exceptions to be thrown from
13770 arbitrary signal handlers such as @code{SIGALRM}.
13771
13772 @item -fdelete-dead-exceptions
13773 @opindex fdelete-dead-exceptions
13774 Consider that instructions that may throw exceptions but don't otherwise
13775 contribute to the execution of the program can be optimized away.
13776 This option is enabled by default for the Ada front end, as permitted by
13777 the Ada language specification.
13778 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13779
13780 @item -funwind-tables
13781 @opindex funwind-tables
13782 Similar to @option{-fexceptions}, except that it just generates any needed
13783 static data, but does not affect the generated code in any other way.
13784 You normally do not need to enable this option; instead, a language processor
13785 that needs this handling enables it on your behalf.
13786
13787 @item -fasynchronous-unwind-tables
13788 @opindex fasynchronous-unwind-tables
13789 Generate unwind table in DWARF format, if supported by target machine. The
13790 table is exact at each instruction boundary, so it can be used for stack
13791 unwinding from asynchronous events (such as debugger or garbage collector).
13792
13793 @item -fno-gnu-unique
13794 @opindex fno-gnu-unique
13795 @opindex fgnu-unique
13796 On systems with recent GNU assembler and C library, the C++ compiler
13797 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13798 of template static data members and static local variables in inline
13799 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13800 is necessary to avoid problems with a library used by two different
13801 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13802 therefore disagreeing with the other one about the binding of the
13803 symbol. But this causes @code{dlclose} to be ignored for affected
13804 DSOs; if your program relies on reinitialization of a DSO via
13805 @code{dlclose} and @code{dlopen}, you can use
13806 @option{-fno-gnu-unique}.
13807
13808 @item -fpcc-struct-return
13809 @opindex fpcc-struct-return
13810 Return ``short'' @code{struct} and @code{union} values in memory like
13811 longer ones, rather than in registers. This convention is less
13812 efficient, but it has the advantage of allowing intercallability between
13813 GCC-compiled files and files compiled with other compilers, particularly
13814 the Portable C Compiler (pcc).
13815
13816 The precise convention for returning structures in memory depends
13817 on the target configuration macros.
13818
13819 Short structures and unions are those whose size and alignment match
13820 that of some integer type.
13821
13822 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13823 switch is not binary compatible with code compiled with the
13824 @option{-freg-struct-return} switch.
13825 Use it to conform to a non-default application binary interface.
13826
13827 @item -freg-struct-return
13828 @opindex freg-struct-return
13829 Return @code{struct} and @code{union} values in registers when possible.
13830 This is more efficient for small structures than
13831 @option{-fpcc-struct-return}.
13832
13833 If you specify neither @option{-fpcc-struct-return} nor
13834 @option{-freg-struct-return}, GCC defaults to whichever convention is
13835 standard for the target. If there is no standard convention, GCC
13836 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13837 the principal compiler. In those cases, we can choose the standard, and
13838 we chose the more efficient register return alternative.
13839
13840 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13841 switch is not binary compatible with code compiled with the
13842 @option{-fpcc-struct-return} switch.
13843 Use it to conform to a non-default application binary interface.
13844
13845 @item -fshort-enums
13846 @opindex fshort-enums
13847 Allocate to an @code{enum} type only as many bytes as it needs for the
13848 declared range of possible values. Specifically, the @code{enum} type
13849 is equivalent to the smallest integer type that has enough room.
13850
13851 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13852 code that is not binary compatible with code generated without that switch.
13853 Use it to conform to a non-default application binary interface.
13854
13855 @item -fshort-wchar
13856 @opindex fshort-wchar
13857 Override the underlying type for @code{wchar_t} to be @code{short
13858 unsigned int} instead of the default for the target. This option is
13859 useful for building programs to run under WINE@.
13860
13861 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13862 code that is not binary compatible with code generated without that switch.
13863 Use it to conform to a non-default application binary interface.
13864
13865 @item -fno-common
13866 @opindex fno-common
13867 @opindex fcommon
13868 @cindex tentative definitions
13869 In C code, this option controls the placement of global variables
13870 defined without an initializer, known as @dfn{tentative definitions}
13871 in the C standard. Tentative definitions are distinct from declarations
13872 of a variable with the @code{extern} keyword, which do not allocate storage.
13873
13874 Unix C compilers have traditionally allocated storage for
13875 uninitialized global variables in a common block. This allows the
13876 linker to resolve all tentative definitions of the same variable
13877 in different compilation units to the same object, or to a non-tentative
13878 definition.
13879 This is the behavior specified by @option{-fcommon}, and is the default for
13880 GCC on most targets.
13881 On the other hand, this behavior is not required by ISO
13882 C, and on some targets may carry a speed or code size penalty on
13883 variable references.
13884
13885 The @option{-fno-common} option specifies that the compiler should instead
13886 place uninitialized global variables in the BSS section of the object file.
13887 This inhibits the merging of tentative definitions by the linker so
13888 you get a multiple-definition error if the same
13889 variable is defined in more than one compilation unit.
13890 Compiling with @option{-fno-common} is useful on targets for which
13891 it provides better performance, or if you wish to verify that the
13892 program will work on other systems that always treat uninitialized
13893 variable definitions this way.
13894
13895 @item -fno-ident
13896 @opindex fno-ident
13897 @opindex fident
13898 Ignore the @code{#ident} directive.
13899
13900 @item -finhibit-size-directive
13901 @opindex finhibit-size-directive
13902 Don't output a @code{.size} assembler directive, or anything else that
13903 would cause trouble if the function is split in the middle, and the
13904 two halves are placed at locations far apart in memory. This option is
13905 used when compiling @file{crtstuff.c}; you should not need to use it
13906 for anything else.
13907
13908 @item -fverbose-asm
13909 @opindex fverbose-asm
13910 Put extra commentary information in the generated assembly code to
13911 make it more readable. This option is generally only of use to those
13912 who actually need to read the generated assembly code (perhaps while
13913 debugging the compiler itself).
13914
13915 @option{-fno-verbose-asm}, the default, causes the
13916 extra information to be omitted and is useful when comparing two assembler
13917 files.
13918
13919 The added comments include:
13920
13921 @itemize @bullet
13922
13923 @item
13924 information on the compiler version and command-line options,
13925
13926 @item
13927 the source code lines associated with the assembly instructions,
13928 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13929
13930 @item
13931 hints on which high-level expressions correspond to
13932 the various assembly instruction operands.
13933
13934 @end itemize
13935
13936 For example, given this C source file:
13937
13938 @smallexample
13939 int test (int n)
13940 @{
13941 int i;
13942 int total = 0;
13943
13944 for (i = 0; i < n; i++)
13945 total += i * i;
13946
13947 return total;
13948 @}
13949 @end smallexample
13950
13951 compiling to (x86_64) assembly via @option{-S} and emitting the result
13952 direct to stdout via @option{-o} @option{-}
13953
13954 @smallexample
13955 gcc -S test.c -fverbose-asm -Os -o -
13956 @end smallexample
13957
13958 gives output similar to this:
13959
13960 @smallexample
13961 .file "test.c"
13962 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13963 [...snip...]
13964 # options passed:
13965 [...snip...]
13966
13967 .text
13968 .globl test
13969 .type test, @@function
13970 test:
13971 .LFB0:
13972 .cfi_startproc
13973 # test.c:4: int total = 0;
13974 xorl %eax, %eax # <retval>
13975 # test.c:6: for (i = 0; i < n; i++)
13976 xorl %edx, %edx # i
13977 .L2:
13978 # test.c:6: for (i = 0; i < n; i++)
13979 cmpl %edi, %edx # n, i
13980 jge .L5 #,
13981 # test.c:7: total += i * i;
13982 movl %edx, %ecx # i, tmp92
13983 imull %edx, %ecx # i, tmp92
13984 # test.c:6: for (i = 0; i < n; i++)
13985 incl %edx # i
13986 # test.c:7: total += i * i;
13987 addl %ecx, %eax # tmp92, <retval>
13988 jmp .L2 #
13989 .L5:
13990 # test.c:10: @}
13991 ret
13992 .cfi_endproc
13993 .LFE0:
13994 .size test, .-test
13995 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13996 .section .note.GNU-stack,"",@@progbits
13997 @end smallexample
13998
13999 The comments are intended for humans rather than machines and hence the
14000 precise format of the comments is subject to change.
14001
14002 @item -frecord-gcc-switches
14003 @opindex frecord-gcc-switches
14004 This switch causes the command line used to invoke the
14005 compiler to be recorded into the object file that is being created.
14006 This switch is only implemented on some targets and the exact format
14007 of the recording is target and binary file format dependent, but it
14008 usually takes the form of a section containing ASCII text. This
14009 switch is related to the @option{-fverbose-asm} switch, but that
14010 switch only records information in the assembler output file as
14011 comments, so it never reaches the object file.
14012 See also @option{-grecord-gcc-switches} for another
14013 way of storing compiler options into the object file.
14014
14015 @item -fpic
14016 @opindex fpic
14017 @cindex global offset table
14018 @cindex PIC
14019 Generate position-independent code (PIC) suitable for use in a shared
14020 library, if supported for the target machine. Such code accesses all
14021 constant addresses through a global offset table (GOT)@. The dynamic
14022 loader resolves the GOT entries when the program starts (the dynamic
14023 loader is not part of GCC; it is part of the operating system). If
14024 the GOT size for the linked executable exceeds a machine-specific
14025 maximum size, you get an error message from the linker indicating that
14026 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14027 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14028 on the m68k and RS/6000. The x86 has no such limit.)
14029
14030 Position-independent code requires special support, and therefore works
14031 only on certain machines. For the x86, GCC supports PIC for System V
14032 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14033 position-independent.
14034
14035 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14036 are defined to 1.
14037
14038 @item -fPIC
14039 @opindex fPIC
14040 If supported for the target machine, emit position-independent code,
14041 suitable for dynamic linking and avoiding any limit on the size of the
14042 global offset table. This option makes a difference on AArch64, m68k,
14043 PowerPC and SPARC@.
14044
14045 Position-independent code requires special support, and therefore works
14046 only on certain machines.
14047
14048 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14049 are defined to 2.
14050
14051 @item -fpie
14052 @itemx -fPIE
14053 @opindex fpie
14054 @opindex fPIE
14055 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14056 generated position-independent code can be only linked into executables.
14057 Usually these options are used to compile code that will be linked using
14058 the @option{-pie} GCC option.
14059
14060 @option{-fpie} and @option{-fPIE} both define the macros
14061 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14062 for @option{-fpie} and 2 for @option{-fPIE}.
14063
14064 @item -fno-plt
14065 @opindex fno-plt
14066 @opindex fplt
14067 Do not use the PLT for external function calls in position-independent code.
14068 Instead, load the callee address at call sites from the GOT and branch to it.
14069 This leads to more efficient code by eliminating PLT stubs and exposing
14070 GOT loads to optimizations. On architectures such as 32-bit x86 where
14071 PLT stubs expect the GOT pointer in a specific register, this gives more
14072 register allocation freedom to the compiler.
14073 Lazy binding requires use of the PLT;
14074 with @option{-fno-plt} all external symbols are resolved at load time.
14075
14076 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14077 through the PLT for specific external functions.
14078
14079 In position-dependent code, a few targets also convert calls to
14080 functions that are marked to not use the PLT to use the GOT instead.
14081
14082 @item -fno-jump-tables
14083 @opindex fno-jump-tables
14084 @opindex fjump-tables
14085 Do not use jump tables for switch statements even where it would be
14086 more efficient than other code generation strategies. This option is
14087 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14088 building code that forms part of a dynamic linker and cannot
14089 reference the address of a jump table. On some targets, jump tables
14090 do not require a GOT and this option is not needed.
14091
14092 @item -ffixed-@var{reg}
14093 @opindex ffixed
14094 Treat the register named @var{reg} as a fixed register; generated code
14095 should never refer to it (except perhaps as a stack pointer, frame
14096 pointer or in some other fixed role).
14097
14098 @var{reg} must be the name of a register. The register names accepted
14099 are machine-specific and are defined in the @code{REGISTER_NAMES}
14100 macro in the machine description macro file.
14101
14102 This flag does not have a negative form, because it specifies a
14103 three-way choice.
14104
14105 @item -fcall-used-@var{reg}
14106 @opindex fcall-used
14107 Treat the register named @var{reg} as an allocable register that is
14108 clobbered by function calls. It may be allocated for temporaries or
14109 variables that do not live across a call. Functions compiled this way
14110 do not save and restore the register @var{reg}.
14111
14112 It is an error to use this flag with the frame pointer or stack pointer.
14113 Use of this flag for other registers that have fixed pervasive roles in
14114 the machine's execution model produces disastrous results.
14115
14116 This flag does not have a negative form, because it specifies a
14117 three-way choice.
14118
14119 @item -fcall-saved-@var{reg}
14120 @opindex fcall-saved
14121 Treat the register named @var{reg} as an allocable register saved by
14122 functions. It may be allocated even for temporaries or variables that
14123 live across a call. Functions compiled this way save and restore
14124 the register @var{reg} if they use it.
14125
14126 It is an error to use this flag with the frame pointer or stack pointer.
14127 Use of this flag for other registers that have fixed pervasive roles in
14128 the machine's execution model produces disastrous results.
14129
14130 A different sort of disaster results from the use of this flag for
14131 a register in which function values may be returned.
14132
14133 This flag does not have a negative form, because it specifies a
14134 three-way choice.
14135
14136 @item -fpack-struct[=@var{n}]
14137 @opindex fpack-struct
14138 Without a value specified, pack all structure members together without
14139 holes. When a value is specified (which must be a small power of two), pack
14140 structure members according to this value, representing the maximum
14141 alignment (that is, objects with default alignment requirements larger than
14142 this are output potentially unaligned at the next fitting location.
14143
14144 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14145 code that is not binary compatible with code generated without that switch.
14146 Additionally, it makes the code suboptimal.
14147 Use it to conform to a non-default application binary interface.
14148
14149 @item -fleading-underscore
14150 @opindex fleading-underscore
14151 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14152 change the way C symbols are represented in the object file. One use
14153 is to help link with legacy assembly code.
14154
14155 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14156 generate code that is not binary compatible with code generated without that
14157 switch. Use it to conform to a non-default application binary interface.
14158 Not all targets provide complete support for this switch.
14159
14160 @item -ftls-model=@var{model}
14161 @opindex ftls-model
14162 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14163 The @var{model} argument should be one of @samp{global-dynamic},
14164 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14165 Note that the choice is subject to optimization: the compiler may use
14166 a more efficient model for symbols not visible outside of the translation
14167 unit, or if @option{-fpic} is not given on the command line.
14168
14169 The default without @option{-fpic} is @samp{initial-exec}; with
14170 @option{-fpic} the default is @samp{global-dynamic}.
14171
14172 @item -ftrampolines
14173 @opindex ftrampolines
14174 For targets that normally need trampolines for nested functions, always
14175 generate them instead of using descriptors. Otherwise, for targets that
14176 do not need them, like for example HP-PA or IA-64, do nothing.
14177
14178 A trampoline is a small piece of code that is created at run time on the
14179 stack when the address of a nested function is taken, and is used to call
14180 the nested function indirectly. Therefore, it requires the stack to be
14181 made executable in order for the program to work properly.
14182
14183 @option{-fno-trampolines} is enabled by default on a language by language
14184 basis to let the compiler avoid generating them, if it computes that this
14185 is safe, and replace them with descriptors. Descriptors are made up of data
14186 only, but the generated code must be prepared to deal with them. As of this
14187 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14188
14189 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14190 @option{-fno-trampolines} are not binary compatible if nested functions are
14191 present. This option must therefore be used on a program-wide basis and be
14192 manipulated with extreme care.
14193
14194 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14195 @opindex fvisibility
14196 Set the default ELF image symbol visibility to the specified option---all
14197 symbols are marked with this unless overridden within the code.
14198 Using this feature can very substantially improve linking and
14199 load times of shared object libraries, produce more optimized
14200 code, provide near-perfect API export and prevent symbol clashes.
14201 It is @strong{strongly} recommended that you use this in any shared objects
14202 you distribute.
14203
14204 Despite the nomenclature, @samp{default} always means public; i.e.,
14205 available to be linked against from outside the shared object.
14206 @samp{protected} and @samp{internal} are pretty useless in real-world
14207 usage so the only other commonly used option is @samp{hidden}.
14208 The default if @option{-fvisibility} isn't specified is
14209 @samp{default}, i.e., make every symbol public.
14210
14211 A good explanation of the benefits offered by ensuring ELF
14212 symbols have the correct visibility is given by ``How To Write
14213 Shared Libraries'' by Ulrich Drepper (which can be found at
14214 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14215 solution made possible by this option to marking things hidden when
14216 the default is public is to make the default hidden and mark things
14217 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14218 and @code{__attribute__ ((visibility("default")))} instead of
14219 @code{__declspec(dllexport)} you get almost identical semantics with
14220 identical syntax. This is a great boon to those working with
14221 cross-platform projects.
14222
14223 For those adding visibility support to existing code, you may find
14224 @code{#pragma GCC visibility} of use. This works by you enclosing
14225 the declarations you wish to set visibility for with (for example)
14226 @code{#pragma GCC visibility push(hidden)} and
14227 @code{#pragma GCC visibility pop}.
14228 Bear in mind that symbol visibility should be viewed @strong{as
14229 part of the API interface contract} and thus all new code should
14230 always specify visibility when it is not the default; i.e., declarations
14231 only for use within the local DSO should @strong{always} be marked explicitly
14232 as hidden as so to avoid PLT indirection overheads---making this
14233 abundantly clear also aids readability and self-documentation of the code.
14234 Note that due to ISO C++ specification requirements, @code{operator new} and
14235 @code{operator delete} must always be of default visibility.
14236
14237 Be aware that headers from outside your project, in particular system
14238 headers and headers from any other library you use, may not be
14239 expecting to be compiled with visibility other than the default. You
14240 may need to explicitly say @code{#pragma GCC visibility push(default)}
14241 before including any such headers.
14242
14243 @code{extern} declarations are not affected by @option{-fvisibility}, so
14244 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14245 no modifications. However, this means that calls to @code{extern}
14246 functions with no explicit visibility use the PLT, so it is more
14247 effective to use @code{__attribute ((visibility))} and/or
14248 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14249 declarations should be treated as hidden.
14250
14251 Note that @option{-fvisibility} does affect C++ vague linkage
14252 entities. This means that, for instance, an exception class that is
14253 be thrown between DSOs must be explicitly marked with default
14254 visibility so that the @samp{type_info} nodes are unified between
14255 the DSOs.
14256
14257 An overview of these techniques, their benefits and how to use them
14258 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14259
14260 @item -fstrict-volatile-bitfields
14261 @opindex fstrict-volatile-bitfields
14262 This option should be used if accesses to volatile bit-fields (or other
14263 structure fields, although the compiler usually honors those types
14264 anyway) should use a single access of the width of the
14265 field's type, aligned to a natural alignment if possible. For
14266 example, targets with memory-mapped peripheral registers might require
14267 all such accesses to be 16 bits wide; with this flag you can
14268 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14269 is 16 bits on these targets) to force GCC to use 16-bit accesses
14270 instead of, perhaps, a more efficient 32-bit access.
14271
14272 If this option is disabled, the compiler uses the most efficient
14273 instruction. In the previous example, that might be a 32-bit load
14274 instruction, even though that accesses bytes that do not contain
14275 any portion of the bit-field, or memory-mapped registers unrelated to
14276 the one being updated.
14277
14278 In some cases, such as when the @code{packed} attribute is applied to a
14279 structure field, it may not be possible to access the field with a single
14280 read or write that is correctly aligned for the target machine. In this
14281 case GCC falls back to generating multiple accesses rather than code that
14282 will fault or truncate the result at run time.
14283
14284 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14285 not allowed to touch non bit-field members. It is therefore recommended
14286 to define all bits of the field's type as bit-field members.
14287
14288 The default value of this option is determined by the application binary
14289 interface for the target processor.
14290
14291 @item -fsync-libcalls
14292 @opindex fsync-libcalls
14293 This option controls whether any out-of-line instance of the @code{__sync}
14294 family of functions may be used to implement the C++11 @code{__atomic}
14295 family of functions.
14296
14297 The default value of this option is enabled, thus the only useful form
14298 of the option is @option{-fno-sync-libcalls}. This option is used in
14299 the implementation of the @file{libatomic} runtime library.
14300
14301 @end table
14302
14303 @node Developer Options
14304 @section GCC Developer Options
14305 @cindex developer options
14306 @cindex debugging GCC
14307 @cindex debug dump options
14308 @cindex dump options
14309 @cindex compilation statistics
14310
14311 This section describes command-line options that are primarily of
14312 interest to GCC developers, including options to support compiler
14313 testing and investigation of compiler bugs and compile-time
14314 performance problems. This includes options that produce debug dumps
14315 at various points in the compilation; that print statistics such as
14316 memory use and execution time; and that print information about GCC's
14317 configuration, such as where it searches for libraries. You should
14318 rarely need to use any of these options for ordinary compilation and
14319 linking tasks.
14320
14321 Many developer options that cause GCC to dump output to a file take an
14322 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14323 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14324 error.
14325
14326 If @samp{=@var{filename}} is omitted, a default dump file name is
14327 constructed by concatenating the base dump file name, a pass number,
14328 phase letter, and pass name. The base dump file name is the name of
14329 output file produced by the compiler if explicitly specified and not
14330 an executable; otherwise it is the source file name.
14331 The pass number is determined by the order passes are registered with
14332 the compiler's pass manager.
14333 This is generally the same as the order of execution, but passes
14334 registered by plugins, target-specific passes, or passes that are
14335 otherwise registered late are numbered higher than the pass named
14336 @samp{final}, even if they are executed earlier. The phase letter is
14337 one of @samp{i} (inter-procedural analysis), @samp{l}
14338 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14339 The files are created in the directory of the output file.
14340
14341 @table @gcctabopt
14342
14343 @item -d@var{letters}
14344 @itemx -fdump-rtl-@var{pass}
14345 @itemx -fdump-rtl-@var{pass}=@var{filename}
14346 @opindex d
14347 @opindex fdump-rtl-@var{pass}
14348 Says to make debugging dumps during compilation at times specified by
14349 @var{letters}. This is used for debugging the RTL-based passes of the
14350 compiler.
14351
14352 Some @option{-d@var{letters}} switches have different meaning when
14353 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14354 for information about preprocessor-specific dump options.
14355
14356 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14357 @option{-d} option @var{letters}. Here are the possible
14358 letters for use in @var{pass} and @var{letters}, and their meanings:
14359
14360 @table @gcctabopt
14361
14362 @item -fdump-rtl-alignments
14363 @opindex fdump-rtl-alignments
14364 Dump after branch alignments have been computed.
14365
14366 @item -fdump-rtl-asmcons
14367 @opindex fdump-rtl-asmcons
14368 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14369
14370 @item -fdump-rtl-auto_inc_dec
14371 @opindex fdump-rtl-auto_inc_dec
14372 Dump after auto-inc-dec discovery. This pass is only run on
14373 architectures that have auto inc or auto dec instructions.
14374
14375 @item -fdump-rtl-barriers
14376 @opindex fdump-rtl-barriers
14377 Dump after cleaning up the barrier instructions.
14378
14379 @item -fdump-rtl-bbpart
14380 @opindex fdump-rtl-bbpart
14381 Dump after partitioning hot and cold basic blocks.
14382
14383 @item -fdump-rtl-bbro
14384 @opindex fdump-rtl-bbro
14385 Dump after block reordering.
14386
14387 @item -fdump-rtl-btl1
14388 @itemx -fdump-rtl-btl2
14389 @opindex fdump-rtl-btl2
14390 @opindex fdump-rtl-btl2
14391 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14392 after the two branch
14393 target load optimization passes.
14394
14395 @item -fdump-rtl-bypass
14396 @opindex fdump-rtl-bypass
14397 Dump after jump bypassing and control flow optimizations.
14398
14399 @item -fdump-rtl-combine
14400 @opindex fdump-rtl-combine
14401 Dump after the RTL instruction combination pass.
14402
14403 @item -fdump-rtl-compgotos
14404 @opindex fdump-rtl-compgotos
14405 Dump after duplicating the computed gotos.
14406
14407 @item -fdump-rtl-ce1
14408 @itemx -fdump-rtl-ce2
14409 @itemx -fdump-rtl-ce3
14410 @opindex fdump-rtl-ce1
14411 @opindex fdump-rtl-ce2
14412 @opindex fdump-rtl-ce3
14413 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14414 @option{-fdump-rtl-ce3} enable dumping after the three
14415 if conversion passes.
14416
14417 @item -fdump-rtl-cprop_hardreg
14418 @opindex fdump-rtl-cprop_hardreg
14419 Dump after hard register copy propagation.
14420
14421 @item -fdump-rtl-csa
14422 @opindex fdump-rtl-csa
14423 Dump after combining stack adjustments.
14424
14425 @item -fdump-rtl-cse1
14426 @itemx -fdump-rtl-cse2
14427 @opindex fdump-rtl-cse1
14428 @opindex fdump-rtl-cse2
14429 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14430 the two common subexpression elimination passes.
14431
14432 @item -fdump-rtl-dce
14433 @opindex fdump-rtl-dce
14434 Dump after the standalone dead code elimination passes.
14435
14436 @item -fdump-rtl-dbr
14437 @opindex fdump-rtl-dbr
14438 Dump after delayed branch scheduling.
14439
14440 @item -fdump-rtl-dce1
14441 @itemx -fdump-rtl-dce2
14442 @opindex fdump-rtl-dce1
14443 @opindex fdump-rtl-dce2
14444 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14445 the two dead store elimination passes.
14446
14447 @item -fdump-rtl-eh
14448 @opindex fdump-rtl-eh
14449 Dump after finalization of EH handling code.
14450
14451 @item -fdump-rtl-eh_ranges
14452 @opindex fdump-rtl-eh_ranges
14453 Dump after conversion of EH handling range regions.
14454
14455 @item -fdump-rtl-expand
14456 @opindex fdump-rtl-expand
14457 Dump after RTL generation.
14458
14459 @item -fdump-rtl-fwprop1
14460 @itemx -fdump-rtl-fwprop2
14461 @opindex fdump-rtl-fwprop1
14462 @opindex fdump-rtl-fwprop2
14463 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14464 dumping after the two forward propagation passes.
14465
14466 @item -fdump-rtl-gcse1
14467 @itemx -fdump-rtl-gcse2
14468 @opindex fdump-rtl-gcse1
14469 @opindex fdump-rtl-gcse2
14470 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14471 after global common subexpression elimination.
14472
14473 @item -fdump-rtl-init-regs
14474 @opindex fdump-rtl-init-regs
14475 Dump after the initialization of the registers.
14476
14477 @item -fdump-rtl-initvals
14478 @opindex fdump-rtl-initvals
14479 Dump after the computation of the initial value sets.
14480
14481 @item -fdump-rtl-into_cfglayout
14482 @opindex fdump-rtl-into_cfglayout
14483 Dump after converting to cfglayout mode.
14484
14485 @item -fdump-rtl-ira
14486 @opindex fdump-rtl-ira
14487 Dump after iterated register allocation.
14488
14489 @item -fdump-rtl-jump
14490 @opindex fdump-rtl-jump
14491 Dump after the second jump optimization.
14492
14493 @item -fdump-rtl-loop2
14494 @opindex fdump-rtl-loop2
14495 @option{-fdump-rtl-loop2} enables dumping after the rtl
14496 loop optimization passes.
14497
14498 @item -fdump-rtl-mach
14499 @opindex fdump-rtl-mach
14500 Dump after performing the machine dependent reorganization pass, if that
14501 pass exists.
14502
14503 @item -fdump-rtl-mode_sw
14504 @opindex fdump-rtl-mode_sw
14505 Dump after removing redundant mode switches.
14506
14507 @item -fdump-rtl-rnreg
14508 @opindex fdump-rtl-rnreg
14509 Dump after register renumbering.
14510
14511 @item -fdump-rtl-outof_cfglayout
14512 @opindex fdump-rtl-outof_cfglayout
14513 Dump after converting from cfglayout mode.
14514
14515 @item -fdump-rtl-peephole2
14516 @opindex fdump-rtl-peephole2
14517 Dump after the peephole pass.
14518
14519 @item -fdump-rtl-postreload
14520 @opindex fdump-rtl-postreload
14521 Dump after post-reload optimizations.
14522
14523 @item -fdump-rtl-pro_and_epilogue
14524 @opindex fdump-rtl-pro_and_epilogue
14525 Dump after generating the function prologues and epilogues.
14526
14527 @item -fdump-rtl-sched1
14528 @itemx -fdump-rtl-sched2
14529 @opindex fdump-rtl-sched1
14530 @opindex fdump-rtl-sched2
14531 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14532 after the basic block scheduling passes.
14533
14534 @item -fdump-rtl-ree
14535 @opindex fdump-rtl-ree
14536 Dump after sign/zero extension elimination.
14537
14538 @item -fdump-rtl-seqabstr
14539 @opindex fdump-rtl-seqabstr
14540 Dump after common sequence discovery.
14541
14542 @item -fdump-rtl-shorten
14543 @opindex fdump-rtl-shorten
14544 Dump after shortening branches.
14545
14546 @item -fdump-rtl-sibling
14547 @opindex fdump-rtl-sibling
14548 Dump after sibling call optimizations.
14549
14550 @item -fdump-rtl-split1
14551 @itemx -fdump-rtl-split2
14552 @itemx -fdump-rtl-split3
14553 @itemx -fdump-rtl-split4
14554 @itemx -fdump-rtl-split5
14555 @opindex fdump-rtl-split1
14556 @opindex fdump-rtl-split2
14557 @opindex fdump-rtl-split3
14558 @opindex fdump-rtl-split4
14559 @opindex fdump-rtl-split5
14560 These options enable dumping after five rounds of
14561 instruction splitting.
14562
14563 @item -fdump-rtl-sms
14564 @opindex fdump-rtl-sms
14565 Dump after modulo scheduling. This pass is only run on some
14566 architectures.
14567
14568 @item -fdump-rtl-stack
14569 @opindex fdump-rtl-stack
14570 Dump after conversion from GCC's ``flat register file'' registers to the
14571 x87's stack-like registers. This pass is only run on x86 variants.
14572
14573 @item -fdump-rtl-subreg1
14574 @itemx -fdump-rtl-subreg2
14575 @opindex fdump-rtl-subreg1
14576 @opindex fdump-rtl-subreg2
14577 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14578 the two subreg expansion passes.
14579
14580 @item -fdump-rtl-unshare
14581 @opindex fdump-rtl-unshare
14582 Dump after all rtl has been unshared.
14583
14584 @item -fdump-rtl-vartrack
14585 @opindex fdump-rtl-vartrack
14586 Dump after variable tracking.
14587
14588 @item -fdump-rtl-vregs
14589 @opindex fdump-rtl-vregs
14590 Dump after converting virtual registers to hard registers.
14591
14592 @item -fdump-rtl-web
14593 @opindex fdump-rtl-web
14594 Dump after live range splitting.
14595
14596 @item -fdump-rtl-regclass
14597 @itemx -fdump-rtl-subregs_of_mode_init
14598 @itemx -fdump-rtl-subregs_of_mode_finish
14599 @itemx -fdump-rtl-dfinit
14600 @itemx -fdump-rtl-dfinish
14601 @opindex fdump-rtl-regclass
14602 @opindex fdump-rtl-subregs_of_mode_init
14603 @opindex fdump-rtl-subregs_of_mode_finish
14604 @opindex fdump-rtl-dfinit
14605 @opindex fdump-rtl-dfinish
14606 These dumps are defined but always produce empty files.
14607
14608 @item -da
14609 @itemx -fdump-rtl-all
14610 @opindex da
14611 @opindex fdump-rtl-all
14612 Produce all the dumps listed above.
14613
14614 @item -dA
14615 @opindex dA
14616 Annotate the assembler output with miscellaneous debugging information.
14617
14618 @item -dD
14619 @opindex dD
14620 Dump all macro definitions, at the end of preprocessing, in addition to
14621 normal output.
14622
14623 @item -dH
14624 @opindex dH
14625 Produce a core dump whenever an error occurs.
14626
14627 @item -dp
14628 @opindex dp
14629 Annotate the assembler output with a comment indicating which
14630 pattern and alternative is used. The length and cost of each instruction are
14631 also printed.
14632
14633 @item -dP
14634 @opindex dP
14635 Dump the RTL in the assembler output as a comment before each instruction.
14636 Also turns on @option{-dp} annotation.
14637
14638 @item -dx
14639 @opindex dx
14640 Just generate RTL for a function instead of compiling it. Usually used
14641 with @option{-fdump-rtl-expand}.
14642 @end table
14643
14644 @item -fdump-debug
14645 @opindex fdump-debug
14646 Dump debugging information generated during the debug
14647 generation phase.
14648
14649 @item -fdump-earlydebug
14650 @opindex fdump-earlydebug
14651 Dump debugging information generated during the early debug
14652 generation phase.
14653
14654 @item -fdump-noaddr
14655 @opindex fdump-noaddr
14656 When doing debugging dumps, suppress address output. This makes it more
14657 feasible to use diff on debugging dumps for compiler invocations with
14658 different compiler binaries and/or different
14659 text / bss / data / heap / stack / dso start locations.
14660
14661 @item -freport-bug
14662 @opindex freport-bug
14663 Collect and dump debug information into a temporary file if an
14664 internal compiler error (ICE) occurs.
14665
14666 @item -fdump-unnumbered
14667 @opindex fdump-unnumbered
14668 When doing debugging dumps, suppress instruction numbers and address output.
14669 This makes it more feasible to use diff on debugging dumps for compiler
14670 invocations with different options, in particular with and without
14671 @option{-g}.
14672
14673 @item -fdump-unnumbered-links
14674 @opindex fdump-unnumbered-links
14675 When doing debugging dumps (see @option{-d} option above), suppress
14676 instruction numbers for the links to the previous and next instructions
14677 in a sequence.
14678
14679 @item -fdump-ipa-@var{switch}
14680 @itemx -fdump-ipa-@var{switch}-@var{options}
14681 @opindex fdump-ipa
14682 Control the dumping at various stages of inter-procedural analysis
14683 language tree to a file. The file name is generated by appending a
14684 switch specific suffix to the source file name, and the file is created
14685 in the same directory as the output file. The following dumps are
14686 possible:
14687
14688 @table @samp
14689 @item all
14690 Enables all inter-procedural analysis dumps.
14691
14692 @item cgraph
14693 Dumps information about call-graph optimization, unused function removal,
14694 and inlining decisions.
14695
14696 @item inline
14697 Dump after function inlining.
14698
14699 @end table
14700
14701 Additionally, the options @option{-optimized}, @option{-missed},
14702 @option{-note}, and @option{-all} can be provided, with the same meaning
14703 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14704
14705 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14706 information on callsites that were inlined, along with callsites
14707 that were not inlined.
14708
14709 By default, the dump will contain messages about successful
14710 optimizations (equivalent to @option{-optimized}) together with
14711 low-level details about the analysis.
14712
14713 @item -fdump-lang-all
14714 @itemx -fdump-lang-@var{switch}
14715 @itemx -fdump-lang-@var{switch}-@var{options}
14716 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14717 @opindex fdump-lang-all
14718 @opindex fdump-lang
14719 Control the dumping of language-specific information. The @var{options}
14720 and @var{filename} portions behave as described in the
14721 @option{-fdump-tree} option. The following @var{switch} values are
14722 accepted:
14723
14724 @table @samp
14725 @item all
14726
14727 Enable all language-specific dumps.
14728
14729 @item class
14730 Dump class hierarchy information. Virtual table information is emitted
14731 unless '@option{slim}' is specified. This option is applicable to C++ only.
14732
14733 @item raw
14734 Dump the raw internal tree data. This option is applicable to C++ only.
14735
14736 @end table
14737
14738 @item -fdump-passes
14739 @opindex fdump-passes
14740 Print on @file{stderr} the list of optimization passes that are turned
14741 on and off by the current command-line options.
14742
14743 @item -fdump-statistics-@var{option}
14744 @opindex fdump-statistics
14745 Enable and control dumping of pass statistics in a separate file. The
14746 file name is generated by appending a suffix ending in
14747 @samp{.statistics} to the source file name, and the file is created in
14748 the same directory as the output file. If the @samp{-@var{option}}
14749 form is used, @samp{-stats} causes counters to be summed over the
14750 whole compilation unit while @samp{-details} dumps every event as
14751 the passes generate them. The default with no option is to sum
14752 counters for each function compiled.
14753
14754 @item -fdump-tree-all
14755 @itemx -fdump-tree-@var{switch}
14756 @itemx -fdump-tree-@var{switch}-@var{options}
14757 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14758 @opindex fdump-tree-all
14759 @opindex fdump-tree
14760 Control the dumping at various stages of processing the intermediate
14761 language tree to a file. If the @samp{-@var{options}}
14762 form is used, @var{options} is a list of @samp{-} separated options
14763 which control the details of the dump. Not all options are applicable
14764 to all dumps; those that are not meaningful are ignored. The
14765 following options are available
14766
14767 @table @samp
14768 @item address
14769 Print the address of each node. Usually this is not meaningful as it
14770 changes according to the environment and source file. Its primary use
14771 is for tying up a dump file with a debug environment.
14772 @item asmname
14773 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14774 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14775 use working backward from mangled names in the assembly file.
14776 @item slim
14777 When dumping front-end intermediate representations, inhibit dumping
14778 of members of a scope or body of a function merely because that scope
14779 has been reached. Only dump such items when they are directly reachable
14780 by some other path.
14781
14782 When dumping pretty-printed trees, this option inhibits dumping the
14783 bodies of control structures.
14784
14785 When dumping RTL, print the RTL in slim (condensed) form instead of
14786 the default LISP-like representation.
14787 @item raw
14788 Print a raw representation of the tree. By default, trees are
14789 pretty-printed into a C-like representation.
14790 @item details
14791 Enable more detailed dumps (not honored by every dump option). Also
14792 include information from the optimization passes.
14793 @item stats
14794 Enable dumping various statistics about the pass (not honored by every dump
14795 option).
14796 @item blocks
14797 Enable showing basic block boundaries (disabled in raw dumps).
14798 @item graph
14799 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14800 dump a representation of the control flow graph suitable for viewing with
14801 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14802 the file is pretty-printed as a subgraph, so that GraphViz can render them
14803 all in a single plot.
14804
14805 This option currently only works for RTL dumps, and the RTL is always
14806 dumped in slim form.
14807 @item vops
14808 Enable showing virtual operands for every statement.
14809 @item lineno
14810 Enable showing line numbers for statements.
14811 @item uid
14812 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14813 @item verbose
14814 Enable showing the tree dump for each statement.
14815 @item eh
14816 Enable showing the EH region number holding each statement.
14817 @item scev
14818 Enable showing scalar evolution analysis details.
14819 @item optimized
14820 Enable showing optimization information (only available in certain
14821 passes).
14822 @item missed
14823 Enable showing missed optimization information (only available in certain
14824 passes).
14825 @item note
14826 Enable other detailed optimization information (only available in
14827 certain passes).
14828 @item all
14829 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14830 and @option{lineno}.
14831 @item optall
14832 Turn on all optimization options, i.e., @option{optimized},
14833 @option{missed}, and @option{note}.
14834 @end table
14835
14836 To determine what tree dumps are available or find the dump for a pass
14837 of interest follow the steps below.
14838
14839 @enumerate
14840 @item
14841 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14842 look for a code that corresponds to the pass you are interested in.
14843 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14844 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14845 The number at the end distinguishes distinct invocations of the same pass.
14846 @item
14847 To enable the creation of the dump file, append the pass code to
14848 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14849 to enable the dump from the Early Value Range Propagation pass, invoke
14850 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14851 specify the name of the dump file. If you don't specify one, GCC
14852 creates as described below.
14853 @item
14854 Find the pass dump in a file whose name is composed of three components
14855 separated by a period: the name of the source file GCC was invoked to
14856 compile, a numeric suffix indicating the pass number followed by the
14857 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14858 and finally the pass code. For example, the Early VRP pass dump might
14859 be in a file named @file{myfile.c.038t.evrp} in the current working
14860 directory. Note that the numeric codes are not stable and may change
14861 from one version of GCC to another.
14862 @end enumerate
14863
14864 @item -fopt-info
14865 @itemx -fopt-info-@var{options}
14866 @itemx -fopt-info-@var{options}=@var{filename}
14867 @opindex fopt-info
14868 Controls optimization dumps from various optimization passes. If the
14869 @samp{-@var{options}} form is used, @var{options} is a list of
14870 @samp{-} separated option keywords to select the dump details and
14871 optimizations.
14872
14873 The @var{options} can be divided into three groups:
14874 @enumerate
14875 @item
14876 options describing what kinds of messages should be emitted,
14877 @item
14878 options describing the verbosity of the dump, and
14879 @item
14880 options describing which optimizations should be included.
14881 @end enumerate
14882 The options from each group can be freely mixed as they are
14883 non-overlapping. However, in case of any conflicts,
14884 the later options override the earlier options on the command
14885 line.
14886
14887 The following options control which kinds of messages should be emitted:
14888
14889 @table @samp
14890 @item optimized
14891 Print information when an optimization is successfully applied. It is
14892 up to a pass to decide which information is relevant. For example, the
14893 vectorizer passes print the source location of loops which are
14894 successfully vectorized.
14895 @item missed
14896 Print information about missed optimizations. Individual passes
14897 control which information to include in the output.
14898 @item note
14899 Print verbose information about optimizations, such as certain
14900 transformations, more detailed messages about decisions etc.
14901 @item all
14902 Print detailed optimization information. This includes
14903 @samp{optimized}, @samp{missed}, and @samp{note}.
14904 @end table
14905
14906 The following option controls the dump verbosity:
14907
14908 @table @samp
14909 @item internals
14910 By default, only ``high-level'' messages are emitted. This option enables
14911 additional, more detailed, messages, which are likely to only be of interest
14912 to GCC developers.
14913 @end table
14914
14915 One or more of the following option keywords can be used to describe a
14916 group of optimizations:
14917
14918 @table @samp
14919 @item ipa
14920 Enable dumps from all interprocedural optimizations.
14921 @item loop
14922 Enable dumps from all loop optimizations.
14923 @item inline
14924 Enable dumps from all inlining optimizations.
14925 @item omp
14926 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14927 @item vec
14928 Enable dumps from all vectorization optimizations.
14929 @item optall
14930 Enable dumps from all optimizations. This is a superset of
14931 the optimization groups listed above.
14932 @end table
14933
14934 If @var{options} is
14935 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14936 about successful optimizations from all the passes, omitting messages
14937 that are treated as ``internals''.
14938
14939 If the @var{filename} is provided, then the dumps from all the
14940 applicable optimizations are concatenated into the @var{filename}.
14941 Otherwise the dump is output onto @file{stderr}. Though multiple
14942 @option{-fopt-info} options are accepted, only one of them can include
14943 a @var{filename}. If other filenames are provided then all but the
14944 first such option are ignored.
14945
14946 Note that the output @var{filename} is overwritten
14947 in case of multiple translation units. If a combined output from
14948 multiple translation units is desired, @file{stderr} should be used
14949 instead.
14950
14951 In the following example, the optimization info is output to
14952 @file{stderr}:
14953
14954 @smallexample
14955 gcc -O3 -fopt-info
14956 @end smallexample
14957
14958 This example:
14959 @smallexample
14960 gcc -O3 -fopt-info-missed=missed.all
14961 @end smallexample
14962
14963 @noindent
14964 outputs missed optimization report from all the passes into
14965 @file{missed.all}, and this one:
14966
14967 @smallexample
14968 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14969 @end smallexample
14970
14971 @noindent
14972 prints information about missed optimization opportunities from
14973 vectorization passes on @file{stderr}.
14974 Note that @option{-fopt-info-vec-missed} is equivalent to
14975 @option{-fopt-info-missed-vec}. The order of the optimization group
14976 names and message types listed after @option{-fopt-info} does not matter.
14977
14978 As another example,
14979 @smallexample
14980 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14981 @end smallexample
14982
14983 @noindent
14984 outputs information about missed optimizations as well as
14985 optimized locations from all the inlining passes into
14986 @file{inline.txt}.
14987
14988 Finally, consider:
14989
14990 @smallexample
14991 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14992 @end smallexample
14993
14994 @noindent
14995 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14996 in conflict since only one output file is allowed. In this case, only
14997 the first option takes effect and the subsequent options are
14998 ignored. Thus only @file{vec.miss} is produced which contains
14999 dumps from the vectorizer about missed opportunities.
15000
15001 @item -fsave-optimization-record
15002 @opindex fsave-optimization-record
15003 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15004 were performed, for those optimizations that support @option{-fopt-info}.
15005
15006 This option is experimental and the format of the data within the
15007 compressed JSON file is subject to change.
15008
15009 It is roughly equivalent to a machine-readable version of
15010 @option{-fopt-info-all}, as a collection of messages with source file,
15011 line number and column number, with the following additional data for
15012 each message:
15013
15014 @itemize @bullet
15015
15016 @item
15017 the execution count of the code being optimized, along with metadata about
15018 whether this was from actual profile data, or just an estimate, allowing
15019 consumers to prioritize messages by code hotness,
15020
15021 @item
15022 the function name of the code being optimized, where applicable,
15023
15024 @item
15025 the ``inlining chain'' for the code being optimized, so that when
15026 a function is inlined into several different places (which might
15027 themselves be inlined), the reader can distinguish between the copies,
15028
15029 @item
15030 objects identifying those parts of the message that refer to expressions,
15031 statements or symbol-table nodes, which of these categories they are, and,
15032 when available, their source code location,
15033
15034 @item
15035 the GCC pass that emitted the message, and
15036
15037 @item
15038 the location in GCC's own code from which the message was emitted
15039
15040 @end itemize
15041
15042 Additionally, some messages are logically nested within other
15043 messages, reflecting implementation details of the optimization
15044 passes.
15045
15046 @item -fsched-verbose=@var{n}
15047 @opindex fsched-verbose
15048 On targets that use instruction scheduling, this option controls the
15049 amount of debugging output the scheduler prints to the dump files.
15050
15051 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15052 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15053 For @var{n} greater than one, it also output basic block probabilities,
15054 detailed ready list information and unit/insn info. For @var{n} greater
15055 than two, it includes RTL at abort point, control-flow and regions info.
15056 And for @var{n} over four, @option{-fsched-verbose} also includes
15057 dependence info.
15058
15059
15060
15061 @item -fenable-@var{kind}-@var{pass}
15062 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15063 @opindex fdisable-
15064 @opindex fenable-
15065
15066 This is a set of options that are used to explicitly disable/enable
15067 optimization passes. These options are intended for use for debugging GCC.
15068 Compiler users should use regular options for enabling/disabling
15069 passes instead.
15070
15071 @table @gcctabopt
15072
15073 @item -fdisable-ipa-@var{pass}
15074 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15075 statically invoked in the compiler multiple times, the pass name should be
15076 appended with a sequential number starting from 1.
15077
15078 @item -fdisable-rtl-@var{pass}
15079 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15080 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15081 statically invoked in the compiler multiple times, the pass name should be
15082 appended with a sequential number starting from 1. @var{range-list} is a
15083 comma-separated list of function ranges or assembler names. Each range is a number
15084 pair separated by a colon. The range is inclusive in both ends. If the range
15085 is trivial, the number pair can be simplified as a single number. If the
15086 function's call graph node's @var{uid} falls within one of the specified ranges,
15087 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15088 function header of a dump file, and the pass names can be dumped by using
15089 option @option{-fdump-passes}.
15090
15091 @item -fdisable-tree-@var{pass}
15092 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15093 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15094 option arguments.
15095
15096 @item -fenable-ipa-@var{pass}
15097 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15098 statically invoked in the compiler multiple times, the pass name should be
15099 appended with a sequential number starting from 1.
15100
15101 @item -fenable-rtl-@var{pass}
15102 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15103 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15104 description and examples.
15105
15106 @item -fenable-tree-@var{pass}
15107 @itemx -fenable-tree-@var{pass}=@var{range-list}
15108 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15109 of option arguments.
15110
15111 @end table
15112
15113 Here are some examples showing uses of these options.
15114
15115 @smallexample
15116
15117 # disable ccp1 for all functions
15118 -fdisable-tree-ccp1
15119 # disable complete unroll for function whose cgraph node uid is 1
15120 -fenable-tree-cunroll=1
15121 # disable gcse2 for functions at the following ranges [1,1],
15122 # [300,400], and [400,1000]
15123 # disable gcse2 for functions foo and foo2
15124 -fdisable-rtl-gcse2=foo,foo2
15125 # disable early inlining
15126 -fdisable-tree-einline
15127 # disable ipa inlining
15128 -fdisable-ipa-inline
15129 # enable tree full unroll
15130 -fenable-tree-unroll
15131
15132 @end smallexample
15133
15134 @item -fchecking
15135 @itemx -fchecking=@var{n}
15136 @opindex fchecking
15137 @opindex fno-checking
15138 Enable internal consistency checking. The default depends on
15139 the compiler configuration. @option{-fchecking=2} enables further
15140 internal consistency checking that might affect code generation.
15141
15142 @item -frandom-seed=@var{string}
15143 @opindex frandom-seed
15144 This option provides a seed that GCC uses in place of
15145 random numbers in generating certain symbol names
15146 that have to be different in every compiled file. It is also used to
15147 place unique stamps in coverage data files and the object files that
15148 produce them. You can use the @option{-frandom-seed} option to produce
15149 reproducibly identical object files.
15150
15151 The @var{string} can either be a number (decimal, octal or hex) or an
15152 arbitrary string (in which case it's converted to a number by
15153 computing CRC32).
15154
15155 The @var{string} should be different for every file you compile.
15156
15157 @item -save-temps
15158 @itemx -save-temps=cwd
15159 @opindex save-temps
15160 Store the usual ``temporary'' intermediate files permanently; place them
15161 in the current directory and name them based on the source file. Thus,
15162 compiling @file{foo.c} with @option{-c -save-temps} produces files
15163 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15164 preprocessed @file{foo.i} output file even though the compiler now
15165 normally uses an integrated preprocessor.
15166
15167 When used in combination with the @option{-x} command-line option,
15168 @option{-save-temps} is sensible enough to avoid over writing an
15169 input source file with the same extension as an intermediate file.
15170 The corresponding intermediate file may be obtained by renaming the
15171 source file before using @option{-save-temps}.
15172
15173 If you invoke GCC in parallel, compiling several different source
15174 files that share a common base name in different subdirectories or the
15175 same source file compiled for multiple output destinations, it is
15176 likely that the different parallel compilers will interfere with each
15177 other, and overwrite the temporary files. For instance:
15178
15179 @smallexample
15180 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15181 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15182 @end smallexample
15183
15184 may result in @file{foo.i} and @file{foo.o} being written to
15185 simultaneously by both compilers.
15186
15187 @item -save-temps=obj
15188 @opindex save-temps=obj
15189 Store the usual ``temporary'' intermediate files permanently. If the
15190 @option{-o} option is used, the temporary files are based on the
15191 object file. If the @option{-o} option is not used, the
15192 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15193
15194 For example:
15195
15196 @smallexample
15197 gcc -save-temps=obj -c foo.c
15198 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15199 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15200 @end smallexample
15201
15202 @noindent
15203 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15204 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15205 @file{dir2/yfoobar.o}.
15206
15207 @item -time@r{[}=@var{file}@r{]}
15208 @opindex time
15209 Report the CPU time taken by each subprocess in the compilation
15210 sequence. For C source files, this is the compiler proper and assembler
15211 (plus the linker if linking is done).
15212
15213 Without the specification of an output file, the output looks like this:
15214
15215 @smallexample
15216 # cc1 0.12 0.01
15217 # as 0.00 0.01
15218 @end smallexample
15219
15220 The first number on each line is the ``user time'', that is time spent
15221 executing the program itself. The second number is ``system time'',
15222 time spent executing operating system routines on behalf of the program.
15223 Both numbers are in seconds.
15224
15225 With the specification of an output file, the output is appended to the
15226 named file, and it looks like this:
15227
15228 @smallexample
15229 0.12 0.01 cc1 @var{options}
15230 0.00 0.01 as @var{options}
15231 @end smallexample
15232
15233 The ``user time'' and the ``system time'' are moved before the program
15234 name, and the options passed to the program are displayed, so that one
15235 can later tell what file was being compiled, and with which options.
15236
15237 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15238 @opindex fdump-final-insns
15239 Dump the final internal representation (RTL) to @var{file}. If the
15240 optional argument is omitted (or if @var{file} is @code{.}), the name
15241 of the dump file is determined by appending @code{.gkd} to the
15242 compilation output file name.
15243
15244 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15245 @opindex fcompare-debug
15246 @opindex fno-compare-debug
15247 If no error occurs during compilation, run the compiler a second time,
15248 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15249 passed to the second compilation. Dump the final internal
15250 representation in both compilations, and print an error if they differ.
15251
15252 If the equal sign is omitted, the default @option{-gtoggle} is used.
15253
15254 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15255 and nonzero, implicitly enables @option{-fcompare-debug}. If
15256 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15257 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15258 is used.
15259
15260 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15261 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15262 of the final representation and the second compilation, preventing even
15263 @env{GCC_COMPARE_DEBUG} from taking effect.
15264
15265 To verify full coverage during @option{-fcompare-debug} testing, set
15266 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15267 which GCC rejects as an invalid option in any actual compilation
15268 (rather than preprocessing, assembly or linking). To get just a
15269 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15270 not overridden} will do.
15271
15272 @item -fcompare-debug-second
15273 @opindex fcompare-debug-second
15274 This option is implicitly passed to the compiler for the second
15275 compilation requested by @option{-fcompare-debug}, along with options to
15276 silence warnings, and omitting other options that would cause the compiler
15277 to produce output to files or to standard output as a side effect. Dump
15278 files and preserved temporary files are renamed so as to contain the
15279 @code{.gk} additional extension during the second compilation, to avoid
15280 overwriting those generated by the first.
15281
15282 When this option is passed to the compiler driver, it causes the
15283 @emph{first} compilation to be skipped, which makes it useful for little
15284 other than debugging the compiler proper.
15285
15286 @item -gtoggle
15287 @opindex gtoggle
15288 Turn off generation of debug info, if leaving out this option
15289 generates it, or turn it on at level 2 otherwise. The position of this
15290 argument in the command line does not matter; it takes effect after all
15291 other options are processed, and it does so only once, no matter how
15292 many times it is given. This is mainly intended to be used with
15293 @option{-fcompare-debug}.
15294
15295 @item -fvar-tracking-assignments-toggle
15296 @opindex fvar-tracking-assignments-toggle
15297 @opindex fno-var-tracking-assignments-toggle
15298 Toggle @option{-fvar-tracking-assignments}, in the same way that
15299 @option{-gtoggle} toggles @option{-g}.
15300
15301 @item -Q
15302 @opindex Q
15303 Makes the compiler print out each function name as it is compiled, and
15304 print some statistics about each pass when it finishes.
15305
15306 @item -ftime-report
15307 @opindex ftime-report
15308 Makes the compiler print some statistics about the time consumed by each
15309 pass when it finishes.
15310
15311 @item -ftime-report-details
15312 @opindex ftime-report-details
15313 Record the time consumed by infrastructure parts separately for each pass.
15314
15315 @item -fira-verbose=@var{n}
15316 @opindex fira-verbose
15317 Control the verbosity of the dump file for the integrated register allocator.
15318 The default value is 5. If the value @var{n} is greater or equal to 10,
15319 the dump output is sent to stderr using the same format as @var{n} minus 10.
15320
15321 @item -flto-report
15322 @opindex flto-report
15323 Prints a report with internal details on the workings of the link-time
15324 optimizer. The contents of this report vary from version to version.
15325 It is meant to be useful to GCC developers when processing object
15326 files in LTO mode (via @option{-flto}).
15327
15328 Disabled by default.
15329
15330 @item -flto-report-wpa
15331 @opindex flto-report-wpa
15332 Like @option{-flto-report}, but only print for the WPA phase of Link
15333 Time Optimization.
15334
15335 @item -fmem-report
15336 @opindex fmem-report
15337 Makes the compiler print some statistics about permanent memory
15338 allocation when it finishes.
15339
15340 @item -fmem-report-wpa
15341 @opindex fmem-report-wpa
15342 Makes the compiler print some statistics about permanent memory
15343 allocation for the WPA phase only.
15344
15345 @item -fpre-ipa-mem-report
15346 @opindex fpre-ipa-mem-report
15347 @item -fpost-ipa-mem-report
15348 @opindex fpost-ipa-mem-report
15349 Makes the compiler print some statistics about permanent memory
15350 allocation before or after interprocedural optimization.
15351
15352 @item -fprofile-report
15353 @opindex fprofile-report
15354 Makes the compiler print some statistics about consistency of the
15355 (estimated) profile and effect of individual passes.
15356
15357 @item -fstack-usage
15358 @opindex fstack-usage
15359 Makes the compiler output stack usage information for the program, on a
15360 per-function basis. The filename for the dump is made by appending
15361 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15362 the output file, if explicitly specified and it is not an executable,
15363 otherwise it is the basename of the source file. An entry is made up
15364 of three fields:
15365
15366 @itemize
15367 @item
15368 The name of the function.
15369 @item
15370 A number of bytes.
15371 @item
15372 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15373 @end itemize
15374
15375 The qualifier @code{static} means that the function manipulates the stack
15376 statically: a fixed number of bytes are allocated for the frame on function
15377 entry and released on function exit; no stack adjustments are otherwise made
15378 in the function. The second field is this fixed number of bytes.
15379
15380 The qualifier @code{dynamic} means that the function manipulates the stack
15381 dynamically: in addition to the static allocation described above, stack
15382 adjustments are made in the body of the function, for example to push/pop
15383 arguments around function calls. If the qualifier @code{bounded} is also
15384 present, the amount of these adjustments is bounded at compile time and
15385 the second field is an upper bound of the total amount of stack used by
15386 the function. If it is not present, the amount of these adjustments is
15387 not bounded at compile time and the second field only represents the
15388 bounded part.
15389
15390 @item -fstats
15391 @opindex fstats
15392 Emit statistics about front-end processing at the end of the compilation.
15393 This option is supported only by the C++ front end, and
15394 the information is generally only useful to the G++ development team.
15395
15396 @item -fdbg-cnt-list
15397 @opindex fdbg-cnt-list
15398 Print the name and the counter upper bound for all debug counters.
15399
15400
15401 @item -fdbg-cnt=@var{counter-value-list}
15402 @opindex fdbg-cnt
15403 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15404 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15405 tuples which sets the lower and the upper bound of each debug
15406 counter @var{name}. The @var{lower_bound} is optional and is zero
15407 initialized if not set.
15408 All debug counters have the initial upper bound of @code{UINT_MAX};
15409 thus @code{dbg_cnt} returns true always unless the upper bound
15410 is set by this option.
15411 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15412 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15413 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15414
15415 @item -print-file-name=@var{library}
15416 @opindex print-file-name
15417 Print the full absolute name of the library file @var{library} that
15418 would be used when linking---and don't do anything else. With this
15419 option, GCC does not compile or link anything; it just prints the
15420 file name.
15421
15422 @item -print-multi-directory
15423 @opindex print-multi-directory
15424 Print the directory name corresponding to the multilib selected by any
15425 other switches present in the command line. This directory is supposed
15426 to exist in @env{GCC_EXEC_PREFIX}.
15427
15428 @item -print-multi-lib
15429 @opindex print-multi-lib
15430 Print the mapping from multilib directory names to compiler switches
15431 that enable them. The directory name is separated from the switches by
15432 @samp{;}, and each switch starts with an @samp{@@} instead of the
15433 @samp{-}, without spaces between multiple switches. This is supposed to
15434 ease shell processing.
15435
15436 @item -print-multi-os-directory
15437 @opindex print-multi-os-directory
15438 Print the path to OS libraries for the selected
15439 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15440 present in the @file{lib} subdirectory and no multilibs are used, this is
15441 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15442 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15443 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15444 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15445
15446 @item -print-multiarch
15447 @opindex print-multiarch
15448 Print the path to OS libraries for the selected multiarch,
15449 relative to some @file{lib} subdirectory.
15450
15451 @item -print-prog-name=@var{program}
15452 @opindex print-prog-name
15453 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15454
15455 @item -print-libgcc-file-name
15456 @opindex print-libgcc-file-name
15457 Same as @option{-print-file-name=libgcc.a}.
15458
15459 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15460 but you do want to link with @file{libgcc.a}. You can do:
15461
15462 @smallexample
15463 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15464 @end smallexample
15465
15466 @item -print-search-dirs
15467 @opindex print-search-dirs
15468 Print the name of the configured installation directory and a list of
15469 program and library directories @command{gcc} searches---and don't do anything else.
15470
15471 This is useful when @command{gcc} prints the error message
15472 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15473 To resolve this you either need to put @file{cpp0} and the other compiler
15474 components where @command{gcc} expects to find them, or you can set the environment
15475 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15476 Don't forget the trailing @samp{/}.
15477 @xref{Environment Variables}.
15478
15479 @item -print-sysroot
15480 @opindex print-sysroot
15481 Print the target sysroot directory that is used during
15482 compilation. This is the target sysroot specified either at configure
15483 time or using the @option{--sysroot} option, possibly with an extra
15484 suffix that depends on compilation options. If no target sysroot is
15485 specified, the option prints nothing.
15486
15487 @item -print-sysroot-headers-suffix
15488 @opindex print-sysroot-headers-suffix
15489 Print the suffix added to the target sysroot when searching for
15490 headers, or give an error if the compiler is not configured with such
15491 a suffix---and don't do anything else.
15492
15493 @item -dumpmachine
15494 @opindex dumpmachine
15495 Print the compiler's target machine (for example,
15496 @samp{i686-pc-linux-gnu})---and don't do anything else.
15497
15498 @item -dumpversion
15499 @opindex dumpversion
15500 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15501 anything else. This is the compiler version used in filesystem paths and
15502 specs. Depending on how the compiler has been configured it can be just
15503 a single number (major version), two numbers separated by a dot (major and
15504 minor version) or three numbers separated by dots (major, minor and patchlevel
15505 version).
15506
15507 @item -dumpfullversion
15508 @opindex dumpfullversion
15509 Print the full compiler version---and don't do anything else. The output is
15510 always three numbers separated by dots, major, minor and patchlevel version.
15511
15512 @item -dumpspecs
15513 @opindex dumpspecs
15514 Print the compiler's built-in specs---and don't do anything else. (This
15515 is used when GCC itself is being built.) @xref{Spec Files}.
15516 @end table
15517
15518 @node Submodel Options
15519 @section Machine-Dependent Options
15520 @cindex submodel options
15521 @cindex specifying hardware config
15522 @cindex hardware models and configurations, specifying
15523 @cindex target-dependent options
15524 @cindex machine-dependent options
15525
15526 Each target machine supported by GCC can have its own options---for
15527 example, to allow you to compile for a particular processor variant or
15528 ABI, or to control optimizations specific to that machine. By
15529 convention, the names of machine-specific options start with
15530 @samp{-m}.
15531
15532 Some configurations of the compiler also support additional target-specific
15533 options, usually for compatibility with other compilers on the same
15534 platform.
15535
15536 @c This list is ordered alphanumerically by subsection name.
15537 @c It should be the same order and spelling as these options are listed
15538 @c in Machine Dependent Options
15539
15540 @menu
15541 * AArch64 Options::
15542 * Adapteva Epiphany Options::
15543 * AMD GCN Options::
15544 * ARC Options::
15545 * ARM Options::
15546 * AVR Options::
15547 * Blackfin Options::
15548 * C6X Options::
15549 * CRIS Options::
15550 * CR16 Options::
15551 * C-SKY Options::
15552 * Darwin Options::
15553 * DEC Alpha Options::
15554 * FR30 Options::
15555 * FT32 Options::
15556 * FRV Options::
15557 * GNU/Linux Options::
15558 * H8/300 Options::
15559 * HPPA Options::
15560 * IA-64 Options::
15561 * LM32 Options::
15562 * M32C Options::
15563 * M32R/D Options::
15564 * M680x0 Options::
15565 * MCore Options::
15566 * MeP Options::
15567 * MicroBlaze Options::
15568 * MIPS Options::
15569 * MMIX Options::
15570 * MN10300 Options::
15571 * Moxie Options::
15572 * MSP430 Options::
15573 * NDS32 Options::
15574 * Nios II Options::
15575 * Nvidia PTX Options::
15576 * OpenRISC Options::
15577 * PDP-11 Options::
15578 * picoChip Options::
15579 * PowerPC Options::
15580 * RISC-V Options::
15581 * RL78 Options::
15582 * RS/6000 and PowerPC Options::
15583 * RX Options::
15584 * S/390 and zSeries Options::
15585 * Score Options::
15586 * SH Options::
15587 * Solaris 2 Options::
15588 * SPARC Options::
15589 * SPU Options::
15590 * System V Options::
15591 * TILE-Gx Options::
15592 * TILEPro Options::
15593 * V850 Options::
15594 * VAX Options::
15595 * Visium Options::
15596 * VMS Options::
15597 * VxWorks Options::
15598 * x86 Options::
15599 * x86 Windows Options::
15600 * Xstormy16 Options::
15601 * Xtensa Options::
15602 * zSeries Options::
15603 @end menu
15604
15605 @node AArch64 Options
15606 @subsection AArch64 Options
15607 @cindex AArch64 Options
15608
15609 These options are defined for AArch64 implementations:
15610
15611 @table @gcctabopt
15612
15613 @item -mabi=@var{name}
15614 @opindex mabi
15615 Generate code for the specified data model. Permissible values
15616 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15617 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15618 but long int and pointers are 64 bits.
15619
15620 The default depends on the specific target configuration. Note that
15621 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15622 entire program with the same ABI, and link with a compatible set of libraries.
15623
15624 @item -mbig-endian
15625 @opindex mbig-endian
15626 Generate big-endian code. This is the default when GCC is configured for an
15627 @samp{aarch64_be-*-*} target.
15628
15629 @item -mgeneral-regs-only
15630 @opindex mgeneral-regs-only
15631 Generate code which uses only the general-purpose registers. This will prevent
15632 the compiler from using floating-point and Advanced SIMD registers but will not
15633 impose any restrictions on the assembler.
15634
15635 @item -mlittle-endian
15636 @opindex mlittle-endian
15637 Generate little-endian code. This is the default when GCC is configured for an
15638 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15639
15640 @item -mcmodel=tiny
15641 @opindex mcmodel=tiny
15642 Generate code for the tiny code model. The program and its statically defined
15643 symbols must be within 1MB of each other. Programs can be statically or
15644 dynamically linked.
15645
15646 @item -mcmodel=small
15647 @opindex mcmodel=small
15648 Generate code for the small code model. The program and its statically defined
15649 symbols must be within 4GB of each other. Programs can be statically or
15650 dynamically linked. This is the default code model.
15651
15652 @item -mcmodel=large
15653 @opindex mcmodel=large
15654 Generate code for the large code model. This makes no assumptions about
15655 addresses and sizes of sections. Programs can be statically linked only.
15656
15657 @item -mstrict-align
15658 @itemx -mno-strict-align
15659 @opindex mstrict-align
15660 @opindex mno-strict-align
15661 Avoid or allow generating memory accesses that may not be aligned on a natural
15662 object boundary as described in the architecture specification.
15663
15664 @item -momit-leaf-frame-pointer
15665 @itemx -mno-omit-leaf-frame-pointer
15666 @opindex momit-leaf-frame-pointer
15667 @opindex mno-omit-leaf-frame-pointer
15668 Omit or keep the frame pointer in leaf functions. The former behavior is the
15669 default.
15670
15671 @item -mstack-protector-guard=@var{guard}
15672 @itemx -mstack-protector-guard-reg=@var{reg}
15673 @itemx -mstack-protector-guard-offset=@var{offset}
15674 @opindex mstack-protector-guard
15675 @opindex mstack-protector-guard-reg
15676 @opindex mstack-protector-guard-offset
15677 Generate stack protection code using canary at @var{guard}. Supported
15678 locations are @samp{global} for a global canary or @samp{sysreg} for a
15679 canary in an appropriate system register.
15680
15681 With the latter choice the options
15682 @option{-mstack-protector-guard-reg=@var{reg}} and
15683 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15684 which system register to use as base register for reading the canary,
15685 and from what offset from that base register. There is no default
15686 register or offset as this is entirely for use within the Linux
15687 kernel.
15688
15689 @item -mstack-protector-guard=@var{guard}
15690 @itemx -mstack-protector-guard-reg=@var{reg}
15691 @itemx -mstack-protector-guard-offset=@var{offset}
15692 @opindex mstack-protector-guard
15693 @opindex mstack-protector-guard-reg
15694 @opindex mstack-protector-guard-offset
15695 Generate stack protection code using canary at @var{guard}. Supported
15696 locations are @samp{global} for a global canary or @samp{sysreg} for a
15697 canary in an appropriate system register.
15698
15699 With the latter choice the options
15700 @option{-mstack-protector-guard-reg=@var{reg}} and
15701 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15702 which system register to use as base register for reading the canary,
15703 and from what offset from that base register. There is no default
15704 register or offset as this is entirely for use within the Linux
15705 kernel.
15706
15707 @item -mtls-dialect=desc
15708 @opindex mtls-dialect=desc
15709 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15710 of TLS variables. This is the default.
15711
15712 @item -mtls-dialect=traditional
15713 @opindex mtls-dialect=traditional
15714 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15715 of TLS variables.
15716
15717 @item -mtls-size=@var{size}
15718 @opindex mtls-size
15719 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15720 This option requires binutils 2.26 or newer.
15721
15722 @item -mfix-cortex-a53-835769
15723 @itemx -mno-fix-cortex-a53-835769
15724 @opindex mfix-cortex-a53-835769
15725 @opindex mno-fix-cortex-a53-835769
15726 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15727 This involves inserting a NOP instruction between memory instructions and
15728 64-bit integer multiply-accumulate instructions.
15729
15730 @item -mfix-cortex-a53-843419
15731 @itemx -mno-fix-cortex-a53-843419
15732 @opindex mfix-cortex-a53-843419
15733 @opindex mno-fix-cortex-a53-843419
15734 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15735 This erratum workaround is made at link time and this will only pass the
15736 corresponding flag to the linker.
15737
15738 @item -mlow-precision-recip-sqrt
15739 @itemx -mno-low-precision-recip-sqrt
15740 @opindex mlow-precision-recip-sqrt
15741 @opindex mno-low-precision-recip-sqrt
15742 Enable or disable the reciprocal square root approximation.
15743 This option only has an effect if @option{-ffast-math} or
15744 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15745 precision of reciprocal square root results to about 16 bits for
15746 single precision and to 32 bits for double precision.
15747
15748 @item -mlow-precision-sqrt
15749 @itemx -mno-low-precision-sqrt
15750 @opindex mlow-precision-sqrt
15751 @opindex mno-low-precision-sqrt
15752 Enable or disable the square root approximation.
15753 This option only has an effect if @option{-ffast-math} or
15754 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15755 precision of square root results to about 16 bits for
15756 single precision and to 32 bits for double precision.
15757 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15758
15759 @item -mlow-precision-div
15760 @itemx -mno-low-precision-div
15761 @opindex mlow-precision-div
15762 @opindex mno-low-precision-div
15763 Enable or disable the division approximation.
15764 This option only has an effect if @option{-ffast-math} or
15765 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15766 precision of division results to about 16 bits for
15767 single precision and to 32 bits for double precision.
15768
15769 @item -mtrack-speculation
15770 @itemx -mno-track-speculation
15771 Enable or disable generation of additional code to track speculative
15772 execution through conditional branches. The tracking state can then
15773 be used by the compiler when expanding calls to
15774 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15775 sequence to be generated.
15776
15777 @item -march=@var{name}
15778 @opindex march
15779 Specify the name of the target architecture and, optionally, one or
15780 more feature modifiers. This option has the form
15781 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15782
15783 The permissible values for @var{arch} are @samp{armv8-a},
15784 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15785 @samp{armv8.5-a} or @var{native}.
15786
15787 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15788 support for the ARMv8.5-A architecture extensions.
15789
15790 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15791 support for the ARMv8.4-A architecture extensions.
15792
15793 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15794 support for the ARMv8.3-A architecture extensions.
15795
15796 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15797 support for the ARMv8.2-A architecture extensions.
15798
15799 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15800 support for the ARMv8.1-A architecture extension. In particular, it
15801 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15802
15803 The value @samp{native} is available on native AArch64 GNU/Linux and
15804 causes the compiler to pick the architecture of the host system. This
15805 option has no effect if the compiler is unable to recognize the
15806 architecture of the host system,
15807
15808 The permissible values for @var{feature} are listed in the sub-section
15809 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15810 Feature Modifiers}. Where conflicting feature modifiers are
15811 specified, the right-most feature is used.
15812
15813 GCC uses @var{name} to determine what kind of instructions it can emit
15814 when generating assembly code. If @option{-march} is specified
15815 without either of @option{-mtune} or @option{-mcpu} also being
15816 specified, the code is tuned to perform well across a range of target
15817 processors implementing the target architecture.
15818
15819 @item -mtune=@var{name}
15820 @opindex mtune
15821 Specify the name of the target processor for which GCC should tune the
15822 performance of the code. Permissible values for this option are:
15823 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15824 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15825 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15826 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15827 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15828 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15829 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15830 @samp{thunderxt83}, @samp{thunderx2t99},
15831 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15832 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15833 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15834 @samp{native}.
15835
15836 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15837 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15838 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15839 should tune for a big.LITTLE system.
15840
15841 Additionally on native AArch64 GNU/Linux systems the value
15842 @samp{native} tunes performance to the host system. This option has no effect
15843 if the compiler is unable to recognize the processor of the host system.
15844
15845 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15846 are specified, the code is tuned to perform well across a range
15847 of target processors.
15848
15849 This option cannot be suffixed by feature modifiers.
15850
15851 @item -mcpu=@var{name}
15852 @opindex mcpu
15853 Specify the name of the target processor, optionally suffixed by one
15854 or more feature modifiers. This option has the form
15855 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15856 the permissible values for @var{cpu} are the same as those available
15857 for @option{-mtune}. The permissible values for @var{feature} are
15858 documented in the sub-section on
15859 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15860 Feature Modifiers}. Where conflicting feature modifiers are
15861 specified, the right-most feature is used.
15862
15863 GCC uses @var{name} to determine what kind of instructions it can emit when
15864 generating assembly code (as if by @option{-march}) and to determine
15865 the target processor for which to tune for performance (as if
15866 by @option{-mtune}). Where this option is used in conjunction
15867 with @option{-march} or @option{-mtune}, those options take precedence
15868 over the appropriate part of this option.
15869
15870 @item -moverride=@var{string}
15871 @opindex moverride
15872 Override tuning decisions made by the back-end in response to a
15873 @option{-mtune=} switch. The syntax, semantics, and accepted values
15874 for @var{string} in this option are not guaranteed to be consistent
15875 across releases.
15876
15877 This option is only intended to be useful when developing GCC.
15878
15879 @item -mverbose-cost-dump
15880 @opindex mverbose-cost-dump
15881 Enable verbose cost model dumping in the debug dump files. This option is
15882 provided for use in debugging the compiler.
15883
15884 @item -mpc-relative-literal-loads
15885 @itemx -mno-pc-relative-literal-loads
15886 @opindex mpc-relative-literal-loads
15887 @opindex mno-pc-relative-literal-loads
15888 Enable or disable PC-relative literal loads. With this option literal pools are
15889 accessed using a single instruction and emitted after each function. This
15890 limits the maximum size of functions to 1MB. This is enabled by default for
15891 @option{-mcmodel=tiny}.
15892
15893 @item -msign-return-address=@var{scope}
15894 @opindex msign-return-address
15895 Select the function scope on which return address signing will be applied.
15896 Permissible values are @samp{none}, which disables return address signing,
15897 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15898 functions, and @samp{all}, which enables pointer signing for all functions. The
15899 default value is @samp{none}. This option has been deprecated by
15900 -mbranch-protection.
15901
15902 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15903 @opindex mbranch-protection
15904 Select the branch protection features to use.
15905 @samp{none} is the default and turns off all types of branch protection.
15906 @samp{standard} turns on all types of branch protection features. If a feature
15907 has additional tuning options, then @samp{standard} sets it to its standard
15908 level.
15909 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15910 level: signing functions that save the return address to memory (non-leaf
15911 functions will practically always do this) using the a-key. The optional
15912 argument @samp{leaf} can be used to extend the signing to include leaf
15913 functions. The optional argument @samp{b-key} can be used to sign the functions
15914 with the B-key instead of the A-key.
15915 @samp{bti} turns on branch target identification mechanism.
15916
15917 @item -msve-vector-bits=@var{bits}
15918 @opindex msve-vector-bits
15919 Specify the number of bits in an SVE vector register. This option only has
15920 an effect when SVE is enabled.
15921
15922 GCC supports two forms of SVE code generation: ``vector-length
15923 agnostic'' output that works with any size of vector register and
15924 ``vector-length specific'' output that allows GCC to make assumptions
15925 about the vector length when it is useful for optimization reasons.
15926 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15927 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15928 Specifying @samp{scalable} selects vector-length agnostic
15929 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15930 agnostic output. All other values generate vector-length specific code.
15931 The behavior of these values may change in future releases and no value except
15932 @samp{scalable} should be relied on for producing code that is portable across
15933 different hardware SVE vector lengths.
15934
15935 The default is @samp{-msve-vector-bits=scalable}, which produces
15936 vector-length agnostic code.
15937 @end table
15938
15939 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15940 @anchor{aarch64-feature-modifiers}
15941 @cindex @option{-march} feature modifiers
15942 @cindex @option{-mcpu} feature modifiers
15943 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15944 the following and their inverses @option{no@var{feature}}:
15945
15946 @table @samp
15947 @item crc
15948 Enable CRC extension. This is on by default for
15949 @option{-march=armv8.1-a}.
15950 @item crypto
15951 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15952 instructions.
15953 @item fp
15954 Enable floating-point instructions. This is on by default for all possible
15955 values for options @option{-march} and @option{-mcpu}.
15956 @item simd
15957 Enable Advanced SIMD instructions. This also enables floating-point
15958 instructions. This is on by default for all possible values for options
15959 @option{-march} and @option{-mcpu}.
15960 @item sve
15961 Enable Scalable Vector Extension instructions. This also enables Advanced
15962 SIMD and floating-point instructions.
15963 @item lse
15964 Enable Large System Extension instructions. This is on by default for
15965 @option{-march=armv8.1-a}.
15966 @item rdma
15967 Enable Round Double Multiply Accumulate instructions. This is on by default
15968 for @option{-march=armv8.1-a}.
15969 @item fp16
15970 Enable FP16 extension. This also enables floating-point instructions.
15971 @item fp16fml
15972 Enable FP16 fmla extension. This also enables FP16 extensions and
15973 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.
15974
15975 @item rcpc
15976 Enable the RcPc extension. This does not change code generation from GCC,
15977 but is passed on to the assembler, enabling inline asm statements to use
15978 instructions from the RcPc extension.
15979 @item dotprod
15980 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15981 @item aes
15982 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15983 SIMD instructions.
15984 @item sha2
15985 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15986 @item sha3
15987 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15988 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15989 @item sm4
15990 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15991 Use of this option with architectures prior to Armv8.2-A is not supported.
15992 @item profile
15993 Enable the Statistical Profiling extension. This option is only to enable the
15994 extension at the assembler level and does not affect code generation.
15995 @item rng
15996 Enable the Armv8.5-a Random Number instructions. This option is only to
15997 enable the extension at the assembler level and does not affect code
15998 generation.
15999 @item memtag
16000 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16001 enable the extension at the assembler level and does not affect code
16002 generation.
16003 @item sb
16004 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16005 enable the extension at the assembler level and does not affect code
16006 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16007 @item ssbs
16008 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16009 is only to enable the extension at the assembler level and does not affect code
16010 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16011 @item predres
16012 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16013 This option is only to enable the extension at the assembler level and does
16014 not affect code generation. This option is enabled by default for
16015 @item sve2
16016 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16017 instructions.
16018 @item bitperm
16019 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16020 @item sve2-sm4
16021 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16022 @item sve2-aes
16023 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16024 @item sve2-sha3
16025 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16026 @option{-march=armv8.5-a}.
16027
16028 @end table
16029
16030 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16031 which implies @option{fp}.
16032 Conversely, @option{nofp} implies @option{nosimd}, which implies
16033 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16034
16035 @node Adapteva Epiphany Options
16036 @subsection Adapteva Epiphany Options
16037
16038 These @samp{-m} options are defined for Adapteva Epiphany:
16039
16040 @table @gcctabopt
16041 @item -mhalf-reg-file
16042 @opindex mhalf-reg-file
16043 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16044 That allows code to run on hardware variants that lack these registers.
16045
16046 @item -mprefer-short-insn-regs
16047 @opindex mprefer-short-insn-regs
16048 Preferentially allocate registers that allow short instruction generation.
16049 This can result in increased instruction count, so this may either reduce or
16050 increase overall code size.
16051
16052 @item -mbranch-cost=@var{num}
16053 @opindex mbranch-cost
16054 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16055 This cost is only a heuristic and is not guaranteed to produce
16056 consistent results across releases.
16057
16058 @item -mcmove
16059 @opindex mcmove
16060 Enable the generation of conditional moves.
16061
16062 @item -mnops=@var{num}
16063 @opindex mnops
16064 Emit @var{num} NOPs before every other generated instruction.
16065
16066 @item -mno-soft-cmpsf
16067 @opindex mno-soft-cmpsf
16068 @opindex msoft-cmpsf
16069 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16070 and test the flags. This is faster than a software comparison, but can
16071 get incorrect results in the presence of NaNs, or when two different small
16072 numbers are compared such that their difference is calculated as zero.
16073 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16074 software comparisons.
16075
16076 @item -mstack-offset=@var{num}
16077 @opindex mstack-offset
16078 Set the offset between the top of the stack and the stack pointer.
16079 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16080 can be used by leaf functions without stack allocation.
16081 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16082 Note also that this option changes the ABI; compiling a program with a
16083 different stack offset than the libraries have been compiled with
16084 generally does not work.
16085 This option can be useful if you want to evaluate if a different stack
16086 offset would give you better code, but to actually use a different stack
16087 offset to build working programs, it is recommended to configure the
16088 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16089
16090 @item -mno-round-nearest
16091 @opindex mno-round-nearest
16092 @opindex mround-nearest
16093 Make the scheduler assume that the rounding mode has been set to
16094 truncating. The default is @option{-mround-nearest}.
16095
16096 @item -mlong-calls
16097 @opindex mlong-calls
16098 If not otherwise specified by an attribute, assume all calls might be beyond
16099 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16100 function address into a register before performing a (otherwise direct) call.
16101 This is the default.
16102
16103 @item -mshort-calls
16104 @opindex short-calls
16105 If not otherwise specified by an attribute, assume all direct calls are
16106 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16107 for direct calls. The default is @option{-mlong-calls}.
16108
16109 @item -msmall16
16110 @opindex msmall16
16111 Assume addresses can be loaded as 16-bit unsigned values. This does not
16112 apply to function addresses for which @option{-mlong-calls} semantics
16113 are in effect.
16114
16115 @item -mfp-mode=@var{mode}
16116 @opindex mfp-mode
16117 Set the prevailing mode of the floating-point unit.
16118 This determines the floating-point mode that is provided and expected
16119 at function call and return time. Making this mode match the mode you
16120 predominantly need at function start can make your programs smaller and
16121 faster by avoiding unnecessary mode switches.
16122
16123 @var{mode} can be set to one the following values:
16124
16125 @table @samp
16126 @item caller
16127 Any mode at function entry is valid, and retained or restored when
16128 the function returns, and when it calls other functions.
16129 This mode is useful for compiling libraries or other compilation units
16130 you might want to incorporate into different programs with different
16131 prevailing FPU modes, and the convenience of being able to use a single
16132 object file outweighs the size and speed overhead for any extra
16133 mode switching that might be needed, compared with what would be needed
16134 with a more specific choice of prevailing FPU mode.
16135
16136 @item truncate
16137 This is the mode used for floating-point calculations with
16138 truncating (i.e.@: round towards zero) rounding mode. That includes
16139 conversion from floating point to integer.
16140
16141 @item round-nearest
16142 This is the mode used for floating-point calculations with
16143 round-to-nearest-or-even rounding mode.
16144
16145 @item int
16146 This is the mode used to perform integer calculations in the FPU, e.g.@:
16147 integer multiply, or integer multiply-and-accumulate.
16148 @end table
16149
16150 The default is @option{-mfp-mode=caller}
16151
16152 @item -mno-split-lohi
16153 @itemx -mno-postinc
16154 @itemx -mno-postmodify
16155 @opindex mno-split-lohi
16156 @opindex msplit-lohi
16157 @opindex mno-postinc
16158 @opindex mpostinc
16159 @opindex mno-postmodify
16160 @opindex mpostmodify
16161 Code generation tweaks that disable, respectively, splitting of 32-bit
16162 loads, generation of post-increment addresses, and generation of
16163 post-modify addresses. The defaults are @option{msplit-lohi},
16164 @option{-mpost-inc}, and @option{-mpost-modify}.
16165
16166 @item -mnovect-double
16167 @opindex mno-vect-double
16168 @opindex mvect-double
16169 Change the preferred SIMD mode to SImode. The default is
16170 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16171
16172 @item -max-vect-align=@var{num}
16173 @opindex max-vect-align
16174 The maximum alignment for SIMD vector mode types.
16175 @var{num} may be 4 or 8. The default is 8.
16176 Note that this is an ABI change, even though many library function
16177 interfaces are unaffected if they don't use SIMD vector modes
16178 in places that affect size and/or alignment of relevant types.
16179
16180 @item -msplit-vecmove-early
16181 @opindex msplit-vecmove-early
16182 Split vector moves into single word moves before reload. In theory this
16183 can give better register allocation, but so far the reverse seems to be
16184 generally the case.
16185
16186 @item -m1reg-@var{reg}
16187 @opindex m1reg-
16188 Specify a register to hold the constant @minus{}1, which makes loading small negative
16189 constants and certain bitmasks faster.
16190 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16191 which specify use of that register as a fixed register,
16192 and @samp{none}, which means that no register is used for this
16193 purpose. The default is @option{-m1reg-none}.
16194
16195 @end table
16196
16197 @node AMD GCN Options
16198 @subsection AMD GCN Options
16199 @cindex AMD GCN Options
16200
16201 These options are defined specifically for the AMD GCN port.
16202
16203 @table @gcctabopt
16204
16205 @item -march=@var{gpu}
16206 @opindex march
16207 @itemx -mtune=@var{gpu}
16208 @opindex mtune
16209 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16210 are
16211
16212 @table @samp
16213 @opindex fiji
16214 @item fiji
16215 Compile for GCN3 Fiji devices (gfx803).
16216
16217 @item gfx900
16218 Compile for GCN5 Vega 10 devices (gfx900).
16219
16220 @end table
16221
16222 @item -mstack-size=@var{bytes}
16223 @opindex mstack-size
16224 Specify how many @var{bytes} of stack space will be requested for each GPU
16225 thread (wave-front). Beware that there may be many threads and limited memory
16226 available. The size of the stack allocation may also have an impact on
16227 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16228 1MB otherwise.
16229
16230 @end table
16231
16232 @node ARC Options
16233 @subsection ARC Options
16234 @cindex ARC options
16235
16236 The following options control the architecture variant for which code
16237 is being compiled:
16238
16239 @c architecture variants
16240 @table @gcctabopt
16241
16242 @item -mbarrel-shifter
16243 @opindex mbarrel-shifter
16244 Generate instructions supported by barrel shifter. This is the default
16245 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16246
16247 @item -mjli-always
16248 @opindex mjli-alawys
16249 Force to call a function using jli_s instruction. This option is
16250 valid only for ARCv2 architecture.
16251
16252 @item -mcpu=@var{cpu}
16253 @opindex mcpu
16254 Set architecture type, register usage, and instruction scheduling
16255 parameters for @var{cpu}. There are also shortcut alias options
16256 available for backward compatibility and convenience. Supported
16257 values for @var{cpu} are
16258
16259 @table @samp
16260 @opindex mA6
16261 @opindex mARC600
16262 @item arc600
16263 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16264
16265 @item arc601
16266 @opindex mARC601
16267 Compile for ARC601. Alias: @option{-mARC601}.
16268
16269 @item arc700
16270 @opindex mA7
16271 @opindex mARC700
16272 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16273 This is the default when configured with @option{--with-cpu=arc700}@.
16274
16275 @item arcem
16276 Compile for ARC EM.
16277
16278 @item archs
16279 Compile for ARC HS.
16280
16281 @item em
16282 Compile for ARC EM CPU with no hardware extensions.
16283
16284 @item em4
16285 Compile for ARC EM4 CPU.
16286
16287 @item em4_dmips
16288 Compile for ARC EM4 DMIPS CPU.
16289
16290 @item em4_fpus
16291 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16292 extension.
16293
16294 @item em4_fpuda
16295 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16296 double assist instructions.
16297
16298 @item hs
16299 Compile for ARC HS CPU with no hardware extensions except the atomic
16300 instructions.
16301
16302 @item hs34
16303 Compile for ARC HS34 CPU.
16304
16305 @item hs38
16306 Compile for ARC HS38 CPU.
16307
16308 @item hs38_linux
16309 Compile for ARC HS38 CPU with all hardware extensions on.
16310
16311 @item arc600_norm
16312 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16313
16314 @item arc600_mul32x16
16315 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16316 instructions enabled.
16317
16318 @item arc600_mul64
16319 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16320 instructions enabled.
16321
16322 @item arc601_norm
16323 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16324
16325 @item arc601_mul32x16
16326 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16327 instructions enabled.
16328
16329 @item arc601_mul64
16330 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16331 instructions enabled.
16332
16333 @item nps400
16334 Compile for ARC 700 on NPS400 chip.
16335
16336 @item em_mini
16337 Compile for ARC EM minimalist configuration featuring reduced register
16338 set.
16339
16340 @end table
16341
16342 @item -mdpfp
16343 @opindex mdpfp
16344 @itemx -mdpfp-compact
16345 @opindex mdpfp-compact
16346 Generate double-precision FPX instructions, tuned for the compact
16347 implementation.
16348
16349 @item -mdpfp-fast
16350 @opindex mdpfp-fast
16351 Generate double-precision FPX instructions, tuned for the fast
16352 implementation.
16353
16354 @item -mno-dpfp-lrsr
16355 @opindex mno-dpfp-lrsr
16356 Disable @code{lr} and @code{sr} instructions from using FPX extension
16357 aux registers.
16358
16359 @item -mea
16360 @opindex mea
16361 Generate extended arithmetic instructions. Currently only
16362 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16363 supported. This is always enabled for @option{-mcpu=ARC700}.
16364
16365 @item -mno-mpy
16366 @opindex mno-mpy
16367 @opindex mmpy
16368 Do not generate @code{mpy}-family instructions for ARC700. This option is
16369 deprecated.
16370
16371 @item -mmul32x16
16372 @opindex mmul32x16
16373 Generate 32x16-bit multiply and multiply-accumulate instructions.
16374
16375 @item -mmul64
16376 @opindex mmul64
16377 Generate @code{mul64} and @code{mulu64} instructions.
16378 Only valid for @option{-mcpu=ARC600}.
16379
16380 @item -mnorm
16381 @opindex mnorm
16382 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16383 is in effect.
16384
16385 @item -mspfp
16386 @opindex mspfp
16387 @itemx -mspfp-compact
16388 @opindex mspfp-compact
16389 Generate single-precision FPX instructions, tuned for the compact
16390 implementation.
16391
16392 @item -mspfp-fast
16393 @opindex mspfp-fast
16394 Generate single-precision FPX instructions, tuned for the fast
16395 implementation.
16396
16397 @item -msimd
16398 @opindex msimd
16399 Enable generation of ARC SIMD instructions via target-specific
16400 builtins. Only valid for @option{-mcpu=ARC700}.
16401
16402 @item -msoft-float
16403 @opindex msoft-float
16404 This option ignored; it is provided for compatibility purposes only.
16405 Software floating-point code is emitted by default, and this default
16406 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16407 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16408 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16409
16410 @item -mswap
16411 @opindex mswap
16412 Generate @code{swap} instructions.
16413
16414 @item -matomic
16415 @opindex matomic
16416 This enables use of the locked load/store conditional extension to implement
16417 atomic memory built-in functions. Not available for ARC 6xx or ARC
16418 EM cores.
16419
16420 @item -mdiv-rem
16421 @opindex mdiv-rem
16422 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16423
16424 @item -mcode-density
16425 @opindex mcode-density
16426 Enable code density instructions for ARC EM.
16427 This option is on by default for ARC HS.
16428
16429 @item -mll64
16430 @opindex mll64
16431 Enable double load/store operations for ARC HS cores.
16432
16433 @item -mtp-regno=@var{regno}
16434 @opindex mtp-regno
16435 Specify thread pointer register number.
16436
16437 @item -mmpy-option=@var{multo}
16438 @opindex mmpy-option
16439 Compile ARCv2 code with a multiplier design option. You can specify
16440 the option using either a string or numeric value for @var{multo}.
16441 @samp{wlh1} is the default value. The recognized values are:
16442
16443 @table @samp
16444 @item 0
16445 @itemx none
16446 No multiplier available.
16447
16448 @item 1
16449 @itemx w
16450 16x16 multiplier, fully pipelined.
16451 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16452
16453 @item 2
16454 @itemx wlh1
16455 32x32 multiplier, fully
16456 pipelined (1 stage). The following instructions are additionally
16457 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16458
16459 @item 3
16460 @itemx wlh2
16461 32x32 multiplier, fully pipelined
16462 (2 stages). The following instructions are additionally enabled: @code{mpy},
16463 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16464
16465 @item 4
16466 @itemx wlh3
16467 Two 16x16 multipliers, blocking,
16468 sequential. The following instructions are additionally enabled: @code{mpy},
16469 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16470
16471 @item 5
16472 @itemx wlh4
16473 One 16x16 multiplier, blocking,
16474 sequential. The following instructions are additionally enabled: @code{mpy},
16475 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16476
16477 @item 6
16478 @itemx wlh5
16479 One 32x4 multiplier, blocking,
16480 sequential. The following instructions are additionally enabled: @code{mpy},
16481 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16482
16483 @item 7
16484 @itemx plus_dmpy
16485 ARC HS SIMD support.
16486
16487 @item 8
16488 @itemx plus_macd
16489 ARC HS SIMD support.
16490
16491 @item 9
16492 @itemx plus_qmacw
16493 ARC HS SIMD support.
16494
16495 @end table
16496
16497 This option is only available for ARCv2 cores@.
16498
16499 @item -mfpu=@var{fpu}
16500 @opindex mfpu
16501 Enables support for specific floating-point hardware extensions for ARCv2
16502 cores. Supported values for @var{fpu} are:
16503
16504 @table @samp
16505
16506 @item fpus
16507 Enables support for single-precision floating-point hardware
16508 extensions@.
16509
16510 @item fpud
16511 Enables support for double-precision floating-point hardware
16512 extensions. The single-precision floating-point extension is also
16513 enabled. Not available for ARC EM@.
16514
16515 @item fpuda
16516 Enables support for double-precision floating-point hardware
16517 extensions using double-precision assist instructions. The single-precision
16518 floating-point extension is also enabled. This option is
16519 only available for ARC EM@.
16520
16521 @item fpuda_div
16522 Enables support for double-precision floating-point hardware
16523 extensions using double-precision assist instructions.
16524 The single-precision floating-point, square-root, and divide
16525 extensions are also enabled. This option is
16526 only available for ARC EM@.
16527
16528 @item fpuda_fma
16529 Enables support for double-precision floating-point hardware
16530 extensions using double-precision assist instructions.
16531 The single-precision floating-point and fused multiply and add
16532 hardware extensions are also enabled. This option is
16533 only available for ARC EM@.
16534
16535 @item fpuda_all
16536 Enables support for double-precision floating-point hardware
16537 extensions using double-precision assist instructions.
16538 All single-precision floating-point hardware extensions are also
16539 enabled. This option is only available for ARC EM@.
16540
16541 @item fpus_div
16542 Enables support for single-precision floating-point, square-root and divide
16543 hardware extensions@.
16544
16545 @item fpud_div
16546 Enables support for double-precision floating-point, square-root and divide
16547 hardware extensions. This option
16548 includes option @samp{fpus_div}. Not available for ARC EM@.
16549
16550 @item fpus_fma
16551 Enables support for single-precision floating-point and
16552 fused multiply and add hardware extensions@.
16553
16554 @item fpud_fma
16555 Enables support for double-precision floating-point and
16556 fused multiply and add hardware extensions. This option
16557 includes option @samp{fpus_fma}. Not available for ARC EM@.
16558
16559 @item fpus_all
16560 Enables support for all single-precision floating-point hardware
16561 extensions@.
16562
16563 @item fpud_all
16564 Enables support for all single- and double-precision floating-point
16565 hardware extensions. Not available for ARC EM@.
16566
16567 @end table
16568
16569 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16570 @opindex mirq-ctrl-saved
16571 Specifies general-purposes registers that the processor automatically
16572 saves/restores on interrupt entry and exit. @var{register-range} is
16573 specified as two registers separated by a dash. The register range
16574 always starts with @code{r0}, the upper limit is @code{fp} register.
16575 @var{blink} and @var{lp_count} are optional. This option is only
16576 valid for ARC EM and ARC HS cores.
16577
16578 @item -mrgf-banked-regs=@var{number}
16579 @opindex mrgf-banked-regs
16580 Specifies the number of registers replicated in second register bank
16581 on entry to fast interrupt. Fast interrupts are interrupts with the
16582 highest priority level P0. These interrupts save only PC and STATUS32
16583 registers to avoid memory transactions during interrupt entry and exit
16584 sequences. Use this option when you are using fast interrupts in an
16585 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16586
16587 @item -mlpc-width=@var{width}
16588 @opindex mlpc-width
16589 Specify the width of the @code{lp_count} register. Valid values for
16590 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16591 fixed to 32 bits. If the width is less than 32, the compiler does not
16592 attempt to transform loops in your program to use the zero-delay loop
16593 mechanism unless it is known that the @code{lp_count} register can
16594 hold the required loop-counter value. Depending on the width
16595 specified, the compiler and run-time library might continue to use the
16596 loop mechanism for various needs. This option defines macro
16597 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16598
16599 @item -mrf16
16600 @opindex mrf16
16601 This option instructs the compiler to generate code for a 16-entry
16602 register file. This option defines the @code{__ARC_RF16__}
16603 preprocessor macro.
16604
16605 @item -mbranch-index
16606 @opindex mbranch-index
16607 Enable use of @code{bi} or @code{bih} instructions to implement jump
16608 tables.
16609
16610 @end table
16611
16612 The following options are passed through to the assembler, and also
16613 define preprocessor macro symbols.
16614
16615 @c Flags used by the assembler, but for which we define preprocessor
16616 @c macro symbols as well.
16617 @table @gcctabopt
16618 @item -mdsp-packa
16619 @opindex mdsp-packa
16620 Passed down to the assembler to enable the DSP Pack A extensions.
16621 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16622 deprecated.
16623
16624 @item -mdvbf
16625 @opindex mdvbf
16626 Passed down to the assembler to enable the dual Viterbi butterfly
16627 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16628 option is deprecated.
16629
16630 @c ARC700 4.10 extension instruction
16631 @item -mlock
16632 @opindex mlock
16633 Passed down to the assembler to enable the locked load/store
16634 conditional extension. Also sets the preprocessor symbol
16635 @code{__Xlock}.
16636
16637 @item -mmac-d16
16638 @opindex mmac-d16
16639 Passed down to the assembler. Also sets the preprocessor symbol
16640 @code{__Xxmac_d16}. This option is deprecated.
16641
16642 @item -mmac-24
16643 @opindex mmac-24
16644 Passed down to the assembler. Also sets the preprocessor symbol
16645 @code{__Xxmac_24}. This option is deprecated.
16646
16647 @c ARC700 4.10 extension instruction
16648 @item -mrtsc
16649 @opindex mrtsc
16650 Passed down to the assembler to enable the 64-bit time-stamp counter
16651 extension instruction. Also sets the preprocessor symbol
16652 @code{__Xrtsc}. This option is deprecated.
16653
16654 @c ARC700 4.10 extension instruction
16655 @item -mswape
16656 @opindex mswape
16657 Passed down to the assembler to enable the swap byte ordering
16658 extension instruction. Also sets the preprocessor symbol
16659 @code{__Xswape}.
16660
16661 @item -mtelephony
16662 @opindex mtelephony
16663 Passed down to the assembler to enable dual- and single-operand
16664 instructions for telephony. Also sets the preprocessor symbol
16665 @code{__Xtelephony}. This option is deprecated.
16666
16667 @item -mxy
16668 @opindex mxy
16669 Passed down to the assembler to enable the XY memory extension. Also
16670 sets the preprocessor symbol @code{__Xxy}.
16671
16672 @end table
16673
16674 The following options control how the assembly code is annotated:
16675
16676 @c Assembly annotation options
16677 @table @gcctabopt
16678 @item -misize
16679 @opindex misize
16680 Annotate assembler instructions with estimated addresses.
16681
16682 @item -mannotate-align
16683 @opindex mannotate-align
16684 Explain what alignment considerations lead to the decision to make an
16685 instruction short or long.
16686
16687 @end table
16688
16689 The following options are passed through to the linker:
16690
16691 @c options passed through to the linker
16692 @table @gcctabopt
16693 @item -marclinux
16694 @opindex marclinux
16695 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16696 This option is enabled by default in tool chains built for
16697 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16698 when profiling is not requested.
16699
16700 @item -marclinux_prof
16701 @opindex marclinux_prof
16702 Passed through to the linker, to specify use of the
16703 @code{arclinux_prof} emulation. This option is enabled by default in
16704 tool chains built for @w{@code{arc-linux-uclibc}} and
16705 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16706
16707 @end table
16708
16709 The following options control the semantics of generated code:
16710
16711 @c semantically relevant code generation options
16712 @table @gcctabopt
16713 @item -mlong-calls
16714 @opindex mlong-calls
16715 Generate calls as register indirect calls, thus providing access
16716 to the full 32-bit address range.
16717
16718 @item -mmedium-calls
16719 @opindex mmedium-calls
16720 Don't use less than 25-bit addressing range for calls, which is the
16721 offset available for an unconditional branch-and-link
16722 instruction. Conditional execution of function calls is suppressed, to
16723 allow use of the 25-bit range, rather than the 21-bit range with
16724 conditional branch-and-link. This is the default for tool chains built
16725 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16726
16727 @item -G @var{num}
16728 @opindex G
16729 Put definitions of externally-visible data in a small data section if
16730 that data is no bigger than @var{num} bytes. The default value of
16731 @var{num} is 4 for any ARC configuration, or 8 when we have double
16732 load/store operations.
16733
16734 @item -mno-sdata
16735 @opindex mno-sdata
16736 @opindex msdata
16737 Do not generate sdata references. This is the default for tool chains
16738 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16739 targets.
16740
16741 @item -mvolatile-cache
16742 @opindex mvolatile-cache
16743 Use ordinarily cached memory accesses for volatile references. This is the
16744 default.
16745
16746 @item -mno-volatile-cache
16747 @opindex mno-volatile-cache
16748 @opindex mvolatile-cache
16749 Enable cache bypass for volatile references.
16750
16751 @end table
16752
16753 The following options fine tune code generation:
16754 @c code generation tuning options
16755 @table @gcctabopt
16756 @item -malign-call
16757 @opindex malign-call
16758 Do alignment optimizations for call instructions.
16759
16760 @item -mauto-modify-reg
16761 @opindex mauto-modify-reg
16762 Enable the use of pre/post modify with register displacement.
16763
16764 @item -mbbit-peephole
16765 @opindex mbbit-peephole
16766 Enable bbit peephole2.
16767
16768 @item -mno-brcc
16769 @opindex mno-brcc
16770 This option disables a target-specific pass in @file{arc_reorg} to
16771 generate compare-and-branch (@code{br@var{cc}}) instructions.
16772 It has no effect on
16773 generation of these instructions driven by the combiner pass.
16774
16775 @item -mcase-vector-pcrel
16776 @opindex mcase-vector-pcrel
16777 Use PC-relative switch case tables to enable case table shortening.
16778 This is the default for @option{-Os}.
16779
16780 @item -mcompact-casesi
16781 @opindex mcompact-casesi
16782 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16783 and only available for ARCv1 cores. This option is deprecated.
16784
16785 @item -mno-cond-exec
16786 @opindex mno-cond-exec
16787 Disable the ARCompact-specific pass to generate conditional
16788 execution instructions.
16789
16790 Due to delay slot scheduling and interactions between operand numbers,
16791 literal sizes, instruction lengths, and the support for conditional execution,
16792 the target-independent pass to generate conditional execution is often lacking,
16793 so the ARC port has kept a special pass around that tries to find more
16794 conditional execution generation opportunities after register allocation,
16795 branch shortening, and delay slot scheduling have been done. This pass
16796 generally, but not always, improves performance and code size, at the cost of
16797 extra compilation time, which is why there is an option to switch it off.
16798 If you have a problem with call instructions exceeding their allowable
16799 offset range because they are conditionalized, you should consider using
16800 @option{-mmedium-calls} instead.
16801
16802 @item -mearly-cbranchsi
16803 @opindex mearly-cbranchsi
16804 Enable pre-reload use of the @code{cbranchsi} pattern.
16805
16806 @item -mexpand-adddi
16807 @opindex mexpand-adddi
16808 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16809 @code{add.f}, @code{adc} etc. This option is deprecated.
16810
16811 @item -mindexed-loads
16812 @opindex mindexed-loads
16813 Enable the use of indexed loads. This can be problematic because some
16814 optimizers then assume that indexed stores exist, which is not
16815 the case.
16816
16817 @item -mlra
16818 @opindex mlra
16819 Enable Local Register Allocation. This is still experimental for ARC,
16820 so by default the compiler uses standard reload
16821 (i.e.@: @option{-mno-lra}).
16822
16823 @item -mlra-priority-none
16824 @opindex mlra-priority-none
16825 Don't indicate any priority for target registers.
16826
16827 @item -mlra-priority-compact
16828 @opindex mlra-priority-compact
16829 Indicate target register priority for r0..r3 / r12..r15.
16830
16831 @item -mlra-priority-noncompact
16832 @opindex mlra-priority-noncompact
16833 Reduce target register priority for r0..r3 / r12..r15.
16834
16835 @item -mmillicode
16836 @opindex mmillicode
16837 When optimizing for size (using @option{-Os}), prologues and epilogues
16838 that have to save or restore a large number of registers are often
16839 shortened by using call to a special function in libgcc; this is
16840 referred to as a @emph{millicode} call. As these calls can pose
16841 performance issues, and/or cause linking issues when linking in a
16842 nonstandard way, this option is provided to turn on or off millicode
16843 call generation.
16844
16845 @item -mcode-density-frame
16846 @opindex mcode-density-frame
16847 This option enable the compiler to emit @code{enter} and @code{leave}
16848 instructions. These instructions are only valid for CPUs with
16849 code-density feature.
16850
16851 @item -mmixed-code
16852 @opindex mmixed-code
16853 Tweak register allocation to help 16-bit instruction generation.
16854 This generally has the effect of decreasing the average instruction size
16855 while increasing the instruction count.
16856
16857 @item -mq-class
16858 @opindex mq-class
16859 Enable @samp{q} instruction alternatives.
16860 This is the default for @option{-Os}.
16861
16862 @item -mRcq
16863 @opindex mRcq
16864 Enable @samp{Rcq} constraint handling.
16865 Most short code generation depends on this.
16866 This is the default.
16867
16868 @item -mRcw
16869 @opindex mRcw
16870 Enable @samp{Rcw} constraint handling.
16871 Most ccfsm condexec mostly depends on this.
16872 This is the default.
16873
16874 @item -msize-level=@var{level}
16875 @opindex msize-level
16876 Fine-tune size optimization with regards to instruction lengths and alignment.
16877 The recognized values for @var{level} are:
16878 @table @samp
16879 @item 0
16880 No size optimization. This level is deprecated and treated like @samp{1}.
16881
16882 @item 1
16883 Short instructions are used opportunistically.
16884
16885 @item 2
16886 In addition, alignment of loops and of code after barriers are dropped.
16887
16888 @item 3
16889 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16890
16891 @end table
16892
16893 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16894 the behavior when this is not set is equivalent to level @samp{1}.
16895
16896 @item -mtune=@var{cpu}
16897 @opindex mtune
16898 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16899 by @option{-mcpu=}.
16900
16901 Supported values for @var{cpu} are
16902
16903 @table @samp
16904 @item ARC600
16905 Tune for ARC600 CPU.
16906
16907 @item ARC601
16908 Tune for ARC601 CPU.
16909
16910 @item ARC700
16911 Tune for ARC700 CPU with standard multiplier block.
16912
16913 @item ARC700-xmac
16914 Tune for ARC700 CPU with XMAC block.
16915
16916 @item ARC725D
16917 Tune for ARC725D CPU.
16918
16919 @item ARC750D
16920 Tune for ARC750D CPU.
16921
16922 @end table
16923
16924 @item -mmultcost=@var{num}
16925 @opindex mmultcost
16926 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16927 normal instruction.
16928
16929 @item -munalign-prob-threshold=@var{probability}
16930 @opindex munalign-prob-threshold
16931 Set probability threshold for unaligning branches.
16932 When tuning for @samp{ARC700} and optimizing for speed, branches without
16933 filled delay slot are preferably emitted unaligned and long, unless
16934 profiling indicates that the probability for the branch to be taken
16935 is below @var{probability}. @xref{Cross-profiling}.
16936 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16937
16938 @end table
16939
16940 The following options are maintained for backward compatibility, but
16941 are now deprecated and will be removed in a future release:
16942
16943 @c Deprecated options
16944 @table @gcctabopt
16945
16946 @item -margonaut
16947 @opindex margonaut
16948 Obsolete FPX.
16949
16950 @item -mbig-endian
16951 @opindex mbig-endian
16952 @itemx -EB
16953 @opindex EB
16954 Compile code for big-endian targets. Use of these options is now
16955 deprecated. Big-endian code is supported by configuring GCC to build
16956 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16957 for which big endian is the default.
16958
16959 @item -mlittle-endian
16960 @opindex mlittle-endian
16961 @itemx -EL
16962 @opindex EL
16963 Compile code for little-endian targets. Use of these options is now
16964 deprecated. Little-endian code is supported by configuring GCC to build
16965 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16966 for which little endian is the default.
16967
16968 @item -mbarrel_shifter
16969 @opindex mbarrel_shifter
16970 Replaced by @option{-mbarrel-shifter}.
16971
16972 @item -mdpfp_compact
16973 @opindex mdpfp_compact
16974 Replaced by @option{-mdpfp-compact}.
16975
16976 @item -mdpfp_fast
16977 @opindex mdpfp_fast
16978 Replaced by @option{-mdpfp-fast}.
16979
16980 @item -mdsp_packa
16981 @opindex mdsp_packa
16982 Replaced by @option{-mdsp-packa}.
16983
16984 @item -mEA
16985 @opindex mEA
16986 Replaced by @option{-mea}.
16987
16988 @item -mmac_24
16989 @opindex mmac_24
16990 Replaced by @option{-mmac-24}.
16991
16992 @item -mmac_d16
16993 @opindex mmac_d16
16994 Replaced by @option{-mmac-d16}.
16995
16996 @item -mspfp_compact
16997 @opindex mspfp_compact
16998 Replaced by @option{-mspfp-compact}.
16999
17000 @item -mspfp_fast
17001 @opindex mspfp_fast
17002 Replaced by @option{-mspfp-fast}.
17003
17004 @item -mtune=@var{cpu}
17005 @opindex mtune
17006 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17007 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17008 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17009
17010 @item -multcost=@var{num}
17011 @opindex multcost
17012 Replaced by @option{-mmultcost}.
17013
17014 @end table
17015
17016 @node ARM Options
17017 @subsection ARM Options
17018 @cindex ARM options
17019
17020 These @samp{-m} options are defined for the ARM port:
17021
17022 @table @gcctabopt
17023 @item -mabi=@var{name}
17024 @opindex mabi
17025 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17026 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17027
17028 @item -mapcs-frame
17029 @opindex mapcs-frame
17030 Generate a stack frame that is compliant with the ARM Procedure Call
17031 Standard for all functions, even if this is not strictly necessary for
17032 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17033 with this option causes the stack frames not to be generated for
17034 leaf functions. The default is @option{-mno-apcs-frame}.
17035 This option is deprecated.
17036
17037 @item -mapcs
17038 @opindex mapcs
17039 This is a synonym for @option{-mapcs-frame} and is deprecated.
17040
17041 @ignore
17042 @c not currently implemented
17043 @item -mapcs-stack-check
17044 @opindex mapcs-stack-check
17045 Generate code to check the amount of stack space available upon entry to
17046 every function (that actually uses some stack space). If there is
17047 insufficient space available then either the function
17048 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17049 called, depending upon the amount of stack space required. The runtime
17050 system is required to provide these functions. The default is
17051 @option{-mno-apcs-stack-check}, since this produces smaller code.
17052
17053 @c not currently implemented
17054 @item -mapcs-reentrant
17055 @opindex mapcs-reentrant
17056 Generate reentrant, position-independent code. The default is
17057 @option{-mno-apcs-reentrant}.
17058 @end ignore
17059
17060 @item -mthumb-interwork
17061 @opindex mthumb-interwork
17062 Generate code that supports calling between the ARM and Thumb
17063 instruction sets. Without this option, on pre-v5 architectures, the
17064 two instruction sets cannot be reliably used inside one program. The
17065 default is @option{-mno-thumb-interwork}, since slightly larger code
17066 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17067 configurations this option is meaningless.
17068
17069 @item -mno-sched-prolog
17070 @opindex mno-sched-prolog
17071 @opindex msched-prolog
17072 Prevent the reordering of instructions in the function prologue, or the
17073 merging of those instruction with the instructions in the function's
17074 body. This means that all functions start with a recognizable set
17075 of instructions (or in fact one of a choice from a small set of
17076 different function prologues), and this information can be used to
17077 locate the start of functions inside an executable piece of code. The
17078 default is @option{-msched-prolog}.
17079
17080 @item -mfloat-abi=@var{name}
17081 @opindex mfloat-abi
17082 Specifies which floating-point ABI to use. Permissible values
17083 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17084
17085 Specifying @samp{soft} causes GCC to generate output containing
17086 library calls for floating-point operations.
17087 @samp{softfp} allows the generation of code using hardware floating-point
17088 instructions, but still uses the soft-float calling conventions.
17089 @samp{hard} allows generation of floating-point instructions
17090 and uses FPU-specific calling conventions.
17091
17092 The default depends on the specific target configuration. Note that
17093 the hard-float and soft-float ABIs are not link-compatible; you must
17094 compile your entire program with the same ABI, and link with a
17095 compatible set of libraries.
17096
17097 @item -mgeneral-regs-only
17098 @opindex mgeneral-regs-only
17099 Generate code which uses only the general-purpose registers. This will prevent
17100 the compiler from using floating-point and Advanced SIMD registers but will not
17101 impose any restrictions on the assembler.
17102
17103 @item -mlittle-endian
17104 @opindex mlittle-endian
17105 Generate code for a processor running in little-endian mode. This is
17106 the default for all standard configurations.
17107
17108 @item -mbig-endian
17109 @opindex mbig-endian
17110 Generate code for a processor running in big-endian mode; the default is
17111 to compile code for a little-endian processor.
17112
17113 @item -mbe8
17114 @itemx -mbe32
17115 @opindex mbe8
17116 When linking a big-endian image select between BE8 and BE32 formats.
17117 The option has no effect for little-endian images and is ignored. The
17118 default is dependent on the selected target architecture. For ARMv6
17119 and later architectures the default is BE8, for older architectures
17120 the default is BE32. BE32 format has been deprecated by ARM.
17121
17122 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17123 @opindex march
17124 This specifies the name of the target ARM architecture. GCC uses this
17125 name to determine what kind of instructions it can emit when generating
17126 assembly code. This option can be used in conjunction with or instead
17127 of the @option{-mcpu=} option.
17128
17129 Permissible names are:
17130 @samp{armv4t},
17131 @samp{armv5t}, @samp{armv5te},
17132 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17133 @samp{armv6z}, @samp{armv6zk},
17134 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17135 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17136 @samp{armv8.4-a},
17137 @samp{armv8.5-a},
17138 @samp{armv7-r},
17139 @samp{armv8-r},
17140 @samp{armv6-m}, @samp{armv6s-m},
17141 @samp{armv7-m}, @samp{armv7e-m},
17142 @samp{armv8-m.base}, @samp{armv8-m.main},
17143 @samp{iwmmxt} and @samp{iwmmxt2}.
17144
17145 Additionally, the following architectures, which lack support for the
17146 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17147
17148 Many of the architectures support extensions. These can be added by
17149 appending @samp{+@var{extension}} to the architecture name. Extension
17150 options are processed in order and capabilities accumulate. An extension
17151 will also enable any necessary base extensions
17152 upon which it depends. For example, the @samp{+crypto} extension
17153 will always enable the @samp{+simd} extension. The exception to the
17154 additive construction is for extensions that are prefixed with
17155 @samp{+no@dots{}}: these extensions disable the specified option and
17156 any other extensions that may depend on the presence of that
17157 extension.
17158
17159 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17160 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17161 entirely disabled by the @samp{+nofp} option that follows it.
17162
17163 Most extension names are generically named, but have an effect that is
17164 dependent upon the architecture to which it is applied. For example,
17165 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17166 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17167 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17168 variant for @samp{armv8-a}.
17169
17170 The table below lists the supported extensions for each architecture.
17171 Architectures not mentioned do not support any extensions.
17172
17173 @table @samp
17174 @item armv5te
17175 @itemx armv6
17176 @itemx armv6j
17177 @itemx armv6k
17178 @itemx armv6kz
17179 @itemx armv6t2
17180 @itemx armv6z
17181 @itemx armv6zk
17182 @table @samp
17183 @item +fp
17184 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17185 used as an alias for this extension.
17186
17187 @item +nofp
17188 Disable the floating-point instructions.
17189 @end table
17190
17191 @item armv7
17192 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17193 @table @samp
17194 @item +fp
17195 The VFPv3 floating-point instructions, with 16 double-precision
17196 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17197 for this extension. Note that floating-point is not supported by the
17198 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17199 ARMv7-R architectures.
17200
17201 @item +nofp
17202 Disable the floating-point instructions.
17203 @end table
17204
17205 @item armv7-a
17206 @table @samp
17207 @item +mp
17208 The multiprocessing extension.
17209
17210 @item +sec
17211 The security extension.
17212
17213 @item +fp
17214 The VFPv3 floating-point instructions, with 16 double-precision
17215 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17216 for this extension.
17217
17218 @item +simd
17219 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17220 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17221 for this extension.
17222
17223 @item +vfpv3
17224 The VFPv3 floating-point instructions, with 32 double-precision
17225 registers.
17226
17227 @item +vfpv3-d16-fp16
17228 The VFPv3 floating-point instructions, with 16 double-precision
17229 registers and the half-precision floating-point conversion operations.
17230
17231 @item +vfpv3-fp16
17232 The VFPv3 floating-point instructions, with 32 double-precision
17233 registers and the half-precision floating-point conversion operations.
17234
17235 @item +vfpv4-d16
17236 The VFPv4 floating-point instructions, with 16 double-precision
17237 registers.
17238
17239 @item +vfpv4
17240 The VFPv4 floating-point instructions, with 32 double-precision
17241 registers.
17242
17243 @item +neon-fp16
17244 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17245 the half-precision floating-point conversion operations.
17246
17247 @item +neon-vfpv4
17248 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17249
17250 @item +nosimd
17251 Disable the Advanced SIMD instructions (does not disable floating point).
17252
17253 @item +nofp
17254 Disable the floating-point and Advanced SIMD instructions.
17255 @end table
17256
17257 @item armv7ve
17258 The extended version of the ARMv7-A architecture with support for
17259 virtualization.
17260 @table @samp
17261 @item +fp
17262 The VFPv4 floating-point instructions, with 16 double-precision registers.
17263 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17264
17265 @item +simd
17266 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17267 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17268
17269 @item +vfpv3-d16
17270 The VFPv3 floating-point instructions, with 16 double-precision
17271 registers.
17272
17273 @item +vfpv3
17274 The VFPv3 floating-point instructions, with 32 double-precision
17275 registers.
17276
17277 @item +vfpv3-d16-fp16
17278 The VFPv3 floating-point instructions, with 16 double-precision
17279 registers and the half-precision floating-point conversion operations.
17280
17281 @item +vfpv3-fp16
17282 The VFPv3 floating-point instructions, with 32 double-precision
17283 registers and the half-precision floating-point conversion operations.
17284
17285 @item +vfpv4-d16
17286 The VFPv4 floating-point instructions, with 16 double-precision
17287 registers.
17288
17289 @item +vfpv4
17290 The VFPv4 floating-point instructions, with 32 double-precision
17291 registers.
17292
17293 @item +neon
17294 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17295 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
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 +nosimd
17302 Disable the Advanced SIMD instructions (does not disable floating point).
17303
17304 @item +nofp
17305 Disable the floating-point and Advanced SIMD instructions.
17306 @end table
17307
17308 @item armv8-a
17309 @table @samp
17310 @item +crc
17311 The Cyclic Redundancy Check (CRC) instructions.
17312 @item +simd
17313 The ARMv8-A Advanced SIMD and floating-point instructions.
17314 @item +crypto
17315 The cryptographic instructions.
17316 @item +nocrypto
17317 Disable the cryptographic instructions.
17318 @item +nofp
17319 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17320 @item +sb
17321 Speculation Barrier Instruction.
17322 @item +predres
17323 Execution and Data Prediction Restriction Instructions.
17324 @end table
17325
17326 @item armv8.1-a
17327 @table @samp
17328 @item +simd
17329 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17330
17331 @item +crypto
17332 The cryptographic instructions. This also enables the Advanced SIMD and
17333 floating-point instructions.
17334
17335 @item +nocrypto
17336 Disable the cryptographic instructions.
17337
17338 @item +nofp
17339 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17340
17341 @item +sb
17342 Speculation Barrier Instruction.
17343
17344 @item +predres
17345 Execution and Data Prediction Restriction Instructions.
17346 @end table
17347
17348 @item armv8.2-a
17349 @itemx armv8.3-a
17350 @table @samp
17351 @item +fp16
17352 The half-precision floating-point data processing instructions.
17353 This also enables the Advanced SIMD and floating-point instructions.
17354
17355 @item +fp16fml
17356 The half-precision floating-point fmla extension. This also enables
17357 the half-precision floating-point extension and Advanced SIMD and
17358 floating-point instructions.
17359
17360 @item +simd
17361 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17362
17363 @item +crypto
17364 The cryptographic instructions. This also enables the Advanced SIMD and
17365 floating-point instructions.
17366
17367 @item +dotprod
17368 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17369
17370 @item +nocrypto
17371 Disable the cryptographic extension.
17372
17373 @item +nofp
17374 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17375
17376 @item +sb
17377 Speculation Barrier Instruction.
17378
17379 @item +predres
17380 Execution and Data Prediction Restriction Instructions.
17381 @end table
17382
17383 @item armv8.4-a
17384 @table @samp
17385 @item +fp16
17386 The half-precision floating-point data processing instructions.
17387 This also enables the Advanced SIMD and floating-point instructions as well
17388 as the Dot Product extension and the half-precision floating-point fmla
17389 extension.
17390
17391 @item +simd
17392 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17393 Dot Product extension.
17394
17395 @item +crypto
17396 The cryptographic instructions. This also enables the Advanced SIMD and
17397 floating-point instructions as well as the Dot Product extension.
17398
17399 @item +nocrypto
17400 Disable the cryptographic extension.
17401
17402 @item +nofp
17403 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17404
17405 @item +sb
17406 Speculation Barrier Instruction.
17407
17408 @item +predres
17409 Execution and Data Prediction Restriction Instructions.
17410 @end table
17411
17412 @item armv8.5-a
17413 @table @samp
17414 @item +fp16
17415 The half-precision floating-point data processing instructions.
17416 This also enables the Advanced SIMD and floating-point instructions as well
17417 as the Dot Product extension and the half-precision floating-point fmla
17418 extension.
17419
17420 @item +simd
17421 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17422 Dot Product extension.
17423
17424 @item +crypto
17425 The cryptographic instructions. This also enables the Advanced SIMD and
17426 floating-point instructions as well as the Dot Product extension.
17427
17428 @item +nocrypto
17429 Disable the cryptographic extension.
17430
17431 @item +nofp
17432 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17433 @end table
17434
17435 @item armv7-r
17436 @table @samp
17437 @item +fp.sp
17438 The single-precision VFPv3 floating-point instructions. The extension
17439 @samp{+vfpv3xd} can be used as an alias for this extension.
17440
17441 @item +fp
17442 The VFPv3 floating-point instructions with 16 double-precision registers.
17443 The extension +vfpv3-d16 can be used as an alias for this extension.
17444
17445 @item +vfpv3xd-d16-fp16
17446 The single-precision VFPv3 floating-point instructions with 16 double-precision
17447 registers and the half-precision floating-point conversion operations.
17448
17449 @item +vfpv3-d16-fp16
17450 The VFPv3 floating-point instructions with 16 double-precision
17451 registers and the half-precision floating-point conversion operations.
17452
17453 @item +nofp
17454 Disable the floating-point extension.
17455
17456 @item +idiv
17457 The ARM-state integer division instructions.
17458
17459 @item +noidiv
17460 Disable the ARM-state integer division extension.
17461 @end table
17462
17463 @item armv7e-m
17464 @table @samp
17465 @item +fp
17466 The single-precision VFPv4 floating-point instructions.
17467
17468 @item +fpv5
17469 The single-precision FPv5 floating-point instructions.
17470
17471 @item +fp.dp
17472 The single- and double-precision FPv5 floating-point instructions.
17473
17474 @item +nofp
17475 Disable the floating-point extensions.
17476 @end table
17477
17478 @item armv8-m.main
17479 @table @samp
17480 @item +dsp
17481 The DSP instructions.
17482
17483 @item +nodsp
17484 Disable the DSP extension.
17485
17486 @item +fp
17487 The single-precision floating-point instructions.
17488
17489 @item +fp.dp
17490 The single- and double-precision floating-point instructions.
17491
17492 @item +nofp
17493 Disable the floating-point extension.
17494 @end table
17495
17496 @item armv8-r
17497 @table @samp
17498 @item +crc
17499 The Cyclic Redundancy Check (CRC) instructions.
17500 @item +fp.sp
17501 The single-precision FPv5 floating-point instructions.
17502 @item +simd
17503 The ARMv8-A Advanced SIMD and floating-point instructions.
17504 @item +crypto
17505 The cryptographic instructions.
17506 @item +nocrypto
17507 Disable the cryptographic instructions.
17508 @item +nofp
17509 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17510 @end table
17511
17512 @end table
17513
17514 @option{-march=native} causes the compiler to auto-detect the architecture
17515 of the build computer. At present, this feature is only supported on
17516 GNU/Linux, and not all architectures are recognized. If the auto-detect
17517 is unsuccessful the option has no effect.
17518
17519 @item -mtune=@var{name}
17520 @opindex mtune
17521 This option specifies the name of the target ARM processor for
17522 which GCC should tune the performance of the code.
17523 For some ARM implementations better performance can be obtained by using
17524 this option.
17525 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17526 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17527 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17528 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17529 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17530 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17531 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17532 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17533 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17534 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17535 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17536 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17537 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17538 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17539 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17540 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17541 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17542 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17543 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17544 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17545 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17546 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17547
17548 Additionally, this option can specify that GCC should tune the performance
17549 of the code for a big.LITTLE system. Permissible names are:
17550 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17551 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17552 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17553 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17554
17555 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17556 performance for a blend of processors within architecture @var{arch}.
17557 The aim is to generate code that run well on the current most popular
17558 processors, balancing between optimizations that benefit some CPUs in the
17559 range, and avoiding performance pitfalls of other CPUs. The effects of
17560 this option may change in future GCC versions as CPU models come and go.
17561
17562 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17563 the extension options do not affect the tuning of the generated code.
17564
17565 @option{-mtune=native} causes the compiler to auto-detect the CPU
17566 of the build computer. At present, this feature is only supported on
17567 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17568 unsuccessful the option has no effect.
17569
17570 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17571 @opindex mcpu
17572 This specifies the name of the target ARM processor. GCC uses this name
17573 to derive the name of the target ARM architecture (as if specified
17574 by @option{-march}) and the ARM processor type for which to tune for
17575 performance (as if specified by @option{-mtune}). Where this option
17576 is used in conjunction with @option{-march} or @option{-mtune},
17577 those options take precedence over the appropriate part of this option.
17578
17579 Many of the supported CPUs implement optional architectural
17580 extensions. Where this is so the architectural extensions are
17581 normally enabled by default. If implementations that lack the
17582 extension exist, then the extension syntax can be used to disable
17583 those extensions that have been omitted. For floating-point and
17584 Advanced SIMD (Neon) instructions, the settings of the options
17585 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17586 floating-point and Advanced SIMD instructions will only be used if
17587 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17588 @option{-mfpu} other than @samp{auto} will override the available
17589 floating-point and SIMD extension instructions.
17590
17591 For example, @samp{cortex-a9} can be found in three major
17592 configurations: integer only, with just a floating-point unit or with
17593 floating-point and Advanced SIMD. The default is to enable all the
17594 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17595 be used to disable just the SIMD or both the SIMD and floating-point
17596 instructions respectively.
17597
17598 Permissible names for this option are the same as those for
17599 @option{-mtune}.
17600
17601 The following extension options are common to the listed CPUs:
17602
17603 @table @samp
17604 @item +nodsp
17605 Disable the DSP instructions on @samp{cortex-m33}.
17606
17607 @item +nofp
17608 Disables the floating-point instructions on @samp{arm9e},
17609 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17610 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17611 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17612 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17613 Disables the floating-point and SIMD instructions on
17614 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17615 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17616 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17617 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17618 @samp{cortex-a53} and @samp{cortex-a55}.
17619
17620 @item +nofp.dp
17621 Disables the double-precision component of the floating-point instructions
17622 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17623 @samp{cortex-m7}.
17624
17625 @item +nosimd
17626 Disables the SIMD (but not floating-point) instructions on
17627 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17628 and @samp{cortex-a9}.
17629
17630 @item +crypto
17631 Enables the cryptographic instructions on @samp{cortex-a32},
17632 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17633 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17634 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17635 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17636 @samp{cortex-a75.cortex-a55}.
17637 @end table
17638
17639 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17640 VFPv3 with 16 double-precision registers. It supports the following
17641 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17642 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17643 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17644 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17645 the extensions to @option{-march=armv7-a}.
17646
17647 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17648 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17649 See @option{-mtune} for more information.
17650
17651 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17652 of the build computer. At present, this feature is only supported on
17653 GNU/Linux, and not all architectures are recognized. If the auto-detect
17654 is unsuccessful the option has no effect.
17655
17656 @item -mfpu=@var{name}
17657 @opindex mfpu
17658 This specifies what floating-point hardware (or hardware emulation) is
17659 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17660 @samp{vfpv3},
17661 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17662 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17663 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17664 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17665 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17666 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17667 is an alias for @samp{vfpv2}.
17668
17669 The setting @samp{auto} is the default and is special. It causes the
17670 compiler to select the floating-point and Advanced SIMD instructions
17671 based on the settings of @option{-mcpu} and @option{-march}.
17672
17673 If the selected floating-point hardware includes the NEON extension
17674 (e.g.@: @option{-mfpu=neon}), note that floating-point
17675 operations are not generated by GCC's auto-vectorization pass unless
17676 @option{-funsafe-math-optimizations} is also specified. This is
17677 because NEON hardware does not fully implement the IEEE 754 standard for
17678 floating-point arithmetic (in particular denormal values are treated as
17679 zero), so the use of NEON instructions may lead to a loss of precision.
17680
17681 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}).
17682
17683 @item -mfp16-format=@var{name}
17684 @opindex mfp16-format
17685 Specify the format of the @code{__fp16} half-precision floating-point type.
17686 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17687 the default is @samp{none}, in which case the @code{__fp16} type is not
17688 defined. @xref{Half-Precision}, for more information.
17689
17690 @item -mstructure-size-boundary=@var{n}
17691 @opindex mstructure-size-boundary
17692 The sizes of all structures and unions are rounded up to a multiple
17693 of the number of bits set by this option. Permissible values are 8, 32
17694 and 64. The default value varies for different toolchains. For the COFF
17695 targeted toolchain the default value is 8. A value of 64 is only allowed
17696 if the underlying ABI supports it.
17697
17698 Specifying a larger number can produce faster, more efficient code, but
17699 can also increase the size of the program. Different values are potentially
17700 incompatible. Code compiled with one value cannot necessarily expect to
17701 work with code or libraries compiled with another value, if they exchange
17702 information using structures or unions.
17703
17704 This option is deprecated.
17705
17706 @item -mabort-on-noreturn
17707 @opindex mabort-on-noreturn
17708 Generate a call to the function @code{abort} at the end of a
17709 @code{noreturn} function. It is executed if the function tries to
17710 return.
17711
17712 @item -mlong-calls
17713 @itemx -mno-long-calls
17714 @opindex mlong-calls
17715 @opindex mno-long-calls
17716 Tells the compiler to perform function calls by first loading the
17717 address of the function into a register and then performing a subroutine
17718 call on this register. This switch is needed if the target function
17719 lies outside of the 64-megabyte addressing range of the offset-based
17720 version of subroutine call instruction.
17721
17722 Even if this switch is enabled, not all function calls are turned
17723 into long calls. The heuristic is that static functions, functions
17724 that have the @code{short_call} attribute, functions that are inside
17725 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17726 definitions have already been compiled within the current compilation
17727 unit are not turned into long calls. The exceptions to this rule are
17728 that weak function definitions, functions with the @code{long_call}
17729 attribute or the @code{section} attribute, and functions that are within
17730 the scope of a @code{#pragma long_calls} directive are always
17731 turned into long calls.
17732
17733 This feature is not enabled by default. Specifying
17734 @option{-mno-long-calls} restores the default behavior, as does
17735 placing the function calls within the scope of a @code{#pragma
17736 long_calls_off} directive. Note these switches have no effect on how
17737 the compiler generates code to handle function calls via function
17738 pointers.
17739
17740 @item -msingle-pic-base
17741 @opindex msingle-pic-base
17742 Treat the register used for PIC addressing as read-only, rather than
17743 loading it in the prologue for each function. The runtime system is
17744 responsible for initializing this register with an appropriate value
17745 before execution begins.
17746
17747 @item -mpic-register=@var{reg}
17748 @opindex mpic-register
17749 Specify the register to be used for PIC addressing.
17750 For standard PIC base case, the default is any suitable register
17751 determined by compiler. For single PIC base case, the default is
17752 @samp{R9} if target is EABI based or stack-checking is enabled,
17753 otherwise the default is @samp{R10}.
17754
17755 @item -mpic-data-is-text-relative
17756 @opindex mpic-data-is-text-relative
17757 Assume that the displacement between the text and data segments is fixed
17758 at static link time. This permits using PC-relative addressing
17759 operations to access data known to be in the data segment. For
17760 non-VxWorks RTP targets, this option is enabled by default. When
17761 disabled on such targets, it will enable @option{-msingle-pic-base} by
17762 default.
17763
17764 @item -mpoke-function-name
17765 @opindex mpoke-function-name
17766 Write the name of each function into the text section, directly
17767 preceding the function prologue. The generated code is similar to this:
17768
17769 @smallexample
17770 t0
17771 .ascii "arm_poke_function_name", 0
17772 .align
17773 t1
17774 .word 0xff000000 + (t1 - t0)
17775 arm_poke_function_name
17776 mov ip, sp
17777 stmfd sp!, @{fp, ip, lr, pc@}
17778 sub fp, ip, #4
17779 @end smallexample
17780
17781 When performing a stack backtrace, code can inspect the value of
17782 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17783 location @code{pc - 12} and the top 8 bits are set, then we know that
17784 there is a function name embedded immediately preceding this location
17785 and has length @code{((pc[-3]) & 0xff000000)}.
17786
17787 @item -mthumb
17788 @itemx -marm
17789 @opindex marm
17790 @opindex mthumb
17791
17792 Select between generating code that executes in ARM and Thumb
17793 states. The default for most configurations is to generate code
17794 that executes in ARM state, but the default can be changed by
17795 configuring GCC with the @option{--with-mode=}@var{state}
17796 configure option.
17797
17798 You can also override the ARM and Thumb mode for each function
17799 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17800 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17801
17802 @item -mflip-thumb
17803 @opindex mflip-thumb
17804 Switch ARM/Thumb modes on alternating functions.
17805 This option is provided for regression testing of mixed Thumb/ARM code
17806 generation, and is not intended for ordinary use in compiling code.
17807
17808 @item -mtpcs-frame
17809 @opindex mtpcs-frame
17810 Generate a stack frame that is compliant with the Thumb Procedure Call
17811 Standard for all non-leaf functions. (A leaf function is one that does
17812 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17813
17814 @item -mtpcs-leaf-frame
17815 @opindex mtpcs-leaf-frame
17816 Generate a stack frame that is compliant with the Thumb Procedure Call
17817 Standard for all leaf functions. (A leaf function is one that does
17818 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17819
17820 @item -mcallee-super-interworking
17821 @opindex mcallee-super-interworking
17822 Gives all externally visible functions in the file being compiled an ARM
17823 instruction set header which switches to Thumb mode before executing the
17824 rest of the function. This allows these functions to be called from
17825 non-interworking code. This option is not valid in AAPCS configurations
17826 because interworking is enabled by default.
17827
17828 @item -mcaller-super-interworking
17829 @opindex mcaller-super-interworking
17830 Allows calls via function pointers (including virtual functions) to
17831 execute correctly regardless of whether the target code has been
17832 compiled for interworking or not. There is a small overhead in the cost
17833 of executing a function pointer if this option is enabled. This option
17834 is not valid in AAPCS configurations because interworking is enabled
17835 by default.
17836
17837 @item -mtp=@var{name}
17838 @opindex mtp
17839 Specify the access model for the thread local storage pointer. The valid
17840 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17841 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17842 (supported in the arm6k architecture), and @samp{auto}, which uses the
17843 best available method for the selected processor. The default setting is
17844 @samp{auto}.
17845
17846 @item -mtls-dialect=@var{dialect}
17847 @opindex mtls-dialect
17848 Specify the dialect to use for accessing thread local storage. Two
17849 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17850 @samp{gnu} dialect selects the original GNU scheme for supporting
17851 local and global dynamic TLS models. The @samp{gnu2} dialect
17852 selects the GNU descriptor scheme, which provides better performance
17853 for shared libraries. The GNU descriptor scheme is compatible with
17854 the original scheme, but does require new assembler, linker and
17855 library support. Initial and local exec TLS models are unaffected by
17856 this option and always use the original scheme.
17857
17858 @item -mword-relocations
17859 @opindex mword-relocations
17860 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17861 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17862 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17863 is specified. This option conflicts with @option{-mslow-flash-data}.
17864
17865 @item -mfix-cortex-m3-ldrd
17866 @opindex mfix-cortex-m3-ldrd
17867 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17868 with overlapping destination and base registers are used. This option avoids
17869 generating these instructions. This option is enabled by default when
17870 @option{-mcpu=cortex-m3} is specified.
17871
17872 @item -munaligned-access
17873 @itemx -mno-unaligned-access
17874 @opindex munaligned-access
17875 @opindex mno-unaligned-access
17876 Enables (or disables) reading and writing of 16- and 32- bit values
17877 from addresses that are not 16- or 32- bit aligned. By default
17878 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17879 ARMv8-M Baseline architectures, and enabled for all other
17880 architectures. If unaligned access is not enabled then words in packed
17881 data structures are accessed a byte at a time.
17882
17883 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17884 generated object file to either true or false, depending upon the
17885 setting of this option. If unaligned access is enabled then the
17886 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17887 defined.
17888
17889 @item -mneon-for-64bits
17890 @opindex mneon-for-64bits
17891 Enables using Neon to handle scalar 64-bits operations. This is
17892 disabled by default since the cost of moving data from core registers
17893 to Neon is high.
17894
17895 @item -mslow-flash-data
17896 @opindex mslow-flash-data
17897 Assume loading data from flash is slower than fetching instruction.
17898 Therefore literal load is minimized for better performance.
17899 This option is only supported when compiling for ARMv7 M-profile and
17900 off by default. It conflicts with @option{-mword-relocations}.
17901
17902 @item -masm-syntax-unified
17903 @opindex masm-syntax-unified
17904 Assume inline assembler is using unified asm syntax. The default is
17905 currently off which implies divided syntax. This option has no impact
17906 on Thumb2. However, this may change in future releases of GCC.
17907 Divided syntax should be considered deprecated.
17908
17909 @item -mrestrict-it
17910 @opindex mrestrict-it
17911 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17912 IT blocks can only contain a single 16-bit instruction from a select
17913 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17914
17915 @item -mprint-tune-info
17916 @opindex mprint-tune-info
17917 Print CPU tuning information as comment in assembler file. This is
17918 an option used only for regression testing of the compiler and not
17919 intended for ordinary use in compiling code. This option is disabled
17920 by default.
17921
17922 @item -mverbose-cost-dump
17923 @opindex mverbose-cost-dump
17924 Enable verbose cost model dumping in the debug dump files. This option is
17925 provided for use in debugging the compiler.
17926
17927 @item -mpure-code
17928 @opindex mpure-code
17929 Do not allow constant data to be placed in code sections.
17930 Additionally, when compiling for ELF object format give all text sections the
17931 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17932 is only available when generating non-pic code for M-profile targets with the
17933 MOVT instruction.
17934
17935 @item -mcmse
17936 @opindex mcmse
17937 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17938 Development Tools Engineering Specification", which can be found on
17939 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17940 @end table
17941
17942 @node AVR Options
17943 @subsection AVR Options
17944 @cindex AVR Options
17945
17946 These options are defined for AVR implementations:
17947
17948 @table @gcctabopt
17949 @item -mmcu=@var{mcu}
17950 @opindex mmcu
17951 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17952
17953 The default for this option is@tie{}@samp{avr2}.
17954
17955 GCC supports the following AVR devices and ISAs:
17956
17957 @include avr-mmcu.texi
17958
17959 @item -mabsdata
17960 @opindex mabsdata
17961
17962 Assume that all data in static storage can be accessed by LDS / STS
17963 instructions. This option has only an effect on reduced Tiny devices like
17964 ATtiny40. See also the @code{absdata}
17965 @ref{AVR Variable Attributes,variable attribute}.
17966
17967 @item -maccumulate-args
17968 @opindex maccumulate-args
17969 Accumulate outgoing function arguments and acquire/release the needed
17970 stack space for outgoing function arguments once in function
17971 prologue/epilogue. Without this option, outgoing arguments are pushed
17972 before calling a function and popped afterwards.
17973
17974 Popping the arguments after the function call can be expensive on
17975 AVR so that accumulating the stack space might lead to smaller
17976 executables because arguments need not be removed from the
17977 stack after such a function call.
17978
17979 This option can lead to reduced code size for functions that perform
17980 several calls to functions that get their arguments on the stack like
17981 calls to printf-like functions.
17982
17983 @item -mbranch-cost=@var{cost}
17984 @opindex mbranch-cost
17985 Set the branch costs for conditional branch instructions to
17986 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17987 integers. The default branch cost is 0.
17988
17989 @item -mcall-prologues
17990 @opindex mcall-prologues
17991 Functions prologues/epilogues are expanded as calls to appropriate
17992 subroutines. Code size is smaller.
17993
17994 @item -mgas-isr-prologues
17995 @opindex mgas-isr-prologues
17996 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17997 instruction supported by GNU Binutils.
17998 If this option is on, the feature can still be disabled for individual
17999 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18000 function attribute. This feature is activated per default
18001 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18002 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18003
18004 @item -mint8
18005 @opindex mint8
18006 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18007 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18008 and @code{long long} is 4 bytes. Please note that this option does not
18009 conform to the C standards, but it results in smaller code
18010 size.
18011
18012 @item -mmain-is-OS_task
18013 @opindex mmain-is-OS_task
18014 Do not save registers in @code{main}. The effect is the same like
18015 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18016 to @code{main}. It is activated per default if optimization is on.
18017
18018 @item -mn-flash=@var{num}
18019 @opindex mn-flash
18020 Assume that the flash memory has a size of
18021 @var{num} times 64@tie{}KiB.
18022
18023 @item -mno-interrupts
18024 @opindex mno-interrupts
18025 Generated code is not compatible with hardware interrupts.
18026 Code size is smaller.
18027
18028 @item -mrelax
18029 @opindex mrelax
18030 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18031 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18032 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18033 the assembler's command line and the @option{--relax} option to the
18034 linker's command line.
18035
18036 Jump relaxing is performed by the linker because jump offsets are not
18037 known before code is located. Therefore, the assembler code generated by the
18038 compiler is the same, but the instructions in the executable may
18039 differ from instructions in the assembler code.
18040
18041 Relaxing must be turned on if linker stubs are needed, see the
18042 section on @code{EIND} and linker stubs below.
18043
18044 @item -mrmw
18045 @opindex mrmw
18046 Assume that the device supports the Read-Modify-Write
18047 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18048
18049 @item -mshort-calls
18050 @opindex mshort-calls
18051
18052 Assume that @code{RJMP} and @code{RCALL} can target the whole
18053 program memory.
18054
18055 This option is used internally for multilib selection. It is
18056 not an optimization option, and you don't need to set it by hand.
18057
18058 @item -msp8
18059 @opindex msp8
18060 Treat the stack pointer register as an 8-bit register,
18061 i.e.@: assume the high byte of the stack pointer is zero.
18062 In general, you don't need to set this option by hand.
18063
18064 This option is used internally by the compiler to select and
18065 build multilibs for architectures @code{avr2} and @code{avr25}.
18066 These architectures mix devices with and without @code{SPH}.
18067 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18068 the compiler driver adds or removes this option from the compiler
18069 proper's command line, because the compiler then knows if the device
18070 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18071 register or not.
18072
18073 @item -mstrict-X
18074 @opindex mstrict-X
18075 Use address register @code{X} in a way proposed by the hardware. This means
18076 that @code{X} is only used in indirect, post-increment or
18077 pre-decrement addressing.
18078
18079 Without this option, the @code{X} register may be used in the same way
18080 as @code{Y} or @code{Z} which then is emulated by additional
18081 instructions.
18082 For example, loading a value with @code{X+const} addressing with a
18083 small non-negative @code{const < 64} to a register @var{Rn} is
18084 performed as
18085
18086 @example
18087 adiw r26, const ; X += const
18088 ld @var{Rn}, X ; @var{Rn} = *X
18089 sbiw r26, const ; X -= const
18090 @end example
18091
18092 @item -mtiny-stack
18093 @opindex mtiny-stack
18094 Only change the lower 8@tie{}bits of the stack pointer.
18095
18096 @item -mfract-convert-truncate
18097 @opindex mfract-convert-truncate
18098 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18099
18100 @item -nodevicelib
18101 @opindex nodevicelib
18102 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18103
18104 @item -Waddr-space-convert
18105 @opindex Waddr-space-convert
18106 @opindex Wno-addr-space-convert
18107 Warn about conversions between address spaces in the case where the
18108 resulting address space is not contained in the incoming address space.
18109
18110 @item -Wmisspelled-isr
18111 @opindex Wmisspelled-isr
18112 @opindex Wno-misspelled-isr
18113 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18114 Enabled by default.
18115 @end table
18116
18117 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18118 @cindex @code{EIND}
18119 Pointers in the implementation are 16@tie{}bits wide.
18120 The address of a function or label is represented as word address so
18121 that indirect jumps and calls can target any code address in the
18122 range of 64@tie{}Ki words.
18123
18124 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18125 bytes of program memory space, there is a special function register called
18126 @code{EIND} that serves as most significant part of the target address
18127 when @code{EICALL} or @code{EIJMP} instructions are used.
18128
18129 Indirect jumps and calls on these devices are handled as follows by
18130 the compiler and are subject to some limitations:
18131
18132 @itemize @bullet
18133
18134 @item
18135 The compiler never sets @code{EIND}.
18136
18137 @item
18138 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18139 instructions or might read @code{EIND} directly in order to emulate an
18140 indirect call/jump by means of a @code{RET} instruction.
18141
18142 @item
18143 The compiler assumes that @code{EIND} never changes during the startup
18144 code or during the application. In particular, @code{EIND} is not
18145 saved/restored in function or interrupt service routine
18146 prologue/epilogue.
18147
18148 @item
18149 For indirect calls to functions and computed goto, the linker
18150 generates @emph{stubs}. Stubs are jump pads sometimes also called
18151 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18152 The stub contains a direct jump to the desired address.
18153
18154 @item
18155 Linker relaxation must be turned on so that the linker generates
18156 the stubs correctly in all situations. See the compiler option
18157 @option{-mrelax} and the linker option @option{--relax}.
18158 There are corner cases where the linker is supposed to generate stubs
18159 but aborts without relaxation and without a helpful error message.
18160
18161 @item
18162 The default linker script is arranged for code with @code{EIND = 0}.
18163 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18164 linker script has to be used in order to place the sections whose
18165 name start with @code{.trampolines} into the segment where @code{EIND}
18166 points to.
18167
18168 @item
18169 The startup code from libgcc never sets @code{EIND}.
18170 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18171 For the impact of AVR-LibC on @code{EIND}, see the
18172 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18173
18174 @item
18175 It is legitimate for user-specific startup code to set up @code{EIND}
18176 early, for example by means of initialization code located in
18177 section @code{.init3}. Such code runs prior to general startup code
18178 that initializes RAM and calls constructors, but after the bit
18179 of startup code from AVR-LibC that sets @code{EIND} to the segment
18180 where the vector table is located.
18181 @example
18182 #include <avr/io.h>
18183
18184 static void
18185 __attribute__((section(".init3"),naked,used,no_instrument_function))
18186 init3_set_eind (void)
18187 @{
18188 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18189 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18190 @}
18191 @end example
18192
18193 @noindent
18194 The @code{__trampolines_start} symbol is defined in the linker script.
18195
18196 @item
18197 Stubs are generated automatically by the linker if
18198 the following two conditions are met:
18199 @itemize @minus
18200
18201 @item The address of a label is taken by means of the @code{gs} modifier
18202 (short for @emph{generate stubs}) like so:
18203 @example
18204 LDI r24, lo8(gs(@var{func}))
18205 LDI r25, hi8(gs(@var{func}))
18206 @end example
18207 @item The final location of that label is in a code segment
18208 @emph{outside} the segment where the stubs are located.
18209 @end itemize
18210
18211 @item
18212 The compiler emits such @code{gs} modifiers for code labels in the
18213 following situations:
18214 @itemize @minus
18215 @item Taking address of a function or code label.
18216 @item Computed goto.
18217 @item If prologue-save function is used, see @option{-mcall-prologues}
18218 command-line option.
18219 @item Switch/case dispatch tables. If you do not want such dispatch
18220 tables you can specify the @option{-fno-jump-tables} command-line option.
18221 @item C and C++ constructors/destructors called during startup/shutdown.
18222 @item If the tools hit a @code{gs()} modifier explained above.
18223 @end itemize
18224
18225 @item
18226 Jumping to non-symbolic addresses like so is @emph{not} supported:
18227
18228 @example
18229 int main (void)
18230 @{
18231 /* Call function at word address 0x2 */
18232 return ((int(*)(void)) 0x2)();
18233 @}
18234 @end example
18235
18236 Instead, a stub has to be set up, i.e.@: the function has to be called
18237 through a symbol (@code{func_4} in the example):
18238
18239 @example
18240 int main (void)
18241 @{
18242 extern int func_4 (void);
18243
18244 /* Call function at byte address 0x4 */
18245 return func_4();
18246 @}
18247 @end example
18248
18249 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18250 Alternatively, @code{func_4} can be defined in the linker script.
18251 @end itemize
18252
18253 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18254 @cindex @code{RAMPD}
18255 @cindex @code{RAMPX}
18256 @cindex @code{RAMPY}
18257 @cindex @code{RAMPZ}
18258 Some AVR devices support memories larger than the 64@tie{}KiB range
18259 that can be accessed with 16-bit pointers. To access memory locations
18260 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18261 register is used as high part of the address:
18262 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18263 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18264 register, respectively, to get a wide address. Similarly,
18265 @code{RAMPD} is used together with direct addressing.
18266
18267 @itemize
18268 @item
18269 The startup code initializes the @code{RAMP} special function
18270 registers with zero.
18271
18272 @item
18273 If a @ref{AVR Named Address Spaces,named address space} other than
18274 generic or @code{__flash} is used, then @code{RAMPZ} is set
18275 as needed before the operation.
18276
18277 @item
18278 If the device supports RAM larger than 64@tie{}KiB and the compiler
18279 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18280 is reset to zero after the operation.
18281
18282 @item
18283 If the device comes with a specific @code{RAMP} register, the ISR
18284 prologue/epilogue saves/restores that SFR and initializes it with
18285 zero in case the ISR code might (implicitly) use it.
18286
18287 @item
18288 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18289 If you use inline assembler to read from locations outside the
18290 16-bit address range and change one of the @code{RAMP} registers,
18291 you must reset it to zero after the access.
18292
18293 @end itemize
18294
18295 @subsubsection AVR Built-in Macros
18296
18297 GCC defines several built-in macros so that the user code can test
18298 for the presence or absence of features. Almost any of the following
18299 built-in macros are deduced from device capabilities and thus
18300 triggered by the @option{-mmcu=} command-line option.
18301
18302 For even more AVR-specific built-in macros see
18303 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18304
18305 @table @code
18306
18307 @item __AVR_ARCH__
18308 Build-in macro that resolves to a decimal number that identifies the
18309 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18310 Possible values are:
18311
18312 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18313 @code{4}, @code{5}, @code{51}, @code{6}
18314
18315 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18316 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18317
18318 respectively and
18319
18320 @code{100},
18321 @code{102}, @code{103}, @code{104},
18322 @code{105}, @code{106}, @code{107}
18323
18324 for @var{mcu}=@code{avrtiny},
18325 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18326 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18327 If @var{mcu} specifies a device, this built-in macro is set
18328 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18329 defined to @code{4}.
18330
18331 @item __AVR_@var{Device}__
18332 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18333 the device's name. For example, @option{-mmcu=atmega8} defines the
18334 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18335 @code{__AVR_ATtiny261A__}, etc.
18336
18337 The built-in macros' names follow
18338 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18339 the device name as from the AVR user manual. The difference between
18340 @var{Device} in the built-in macro and @var{device} in
18341 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18342
18343 If @var{device} is not a device but only a core architecture like
18344 @samp{avr51}, this macro is not defined.
18345
18346 @item __AVR_DEVICE_NAME__
18347 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18348 the device's name. For example, with @option{-mmcu=atmega8} the macro
18349 is defined to @code{atmega8}.
18350
18351 If @var{device} is not a device but only a core architecture like
18352 @samp{avr51}, this macro is not defined.
18353
18354 @item __AVR_XMEGA__
18355 The device / architecture belongs to the XMEGA family of devices.
18356
18357 @item __AVR_HAVE_ELPM__
18358 The device has the @code{ELPM} instruction.
18359
18360 @item __AVR_HAVE_ELPMX__
18361 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18362 R@var{n},Z+} instructions.
18363
18364 @item __AVR_HAVE_MOVW__
18365 The device has the @code{MOVW} instruction to perform 16-bit
18366 register-register moves.
18367
18368 @item __AVR_HAVE_LPMX__
18369 The device has the @code{LPM R@var{n},Z} and
18370 @code{LPM R@var{n},Z+} instructions.
18371
18372 @item __AVR_HAVE_MUL__
18373 The device has a hardware multiplier.
18374
18375 @item __AVR_HAVE_JMP_CALL__
18376 The device has the @code{JMP} and @code{CALL} instructions.
18377 This is the case for devices with more than 8@tie{}KiB of program
18378 memory.
18379
18380 @item __AVR_HAVE_EIJMP_EICALL__
18381 @itemx __AVR_3_BYTE_PC__
18382 The device has the @code{EIJMP} and @code{EICALL} instructions.
18383 This is the case for devices with more than 128@tie{}KiB of program memory.
18384 This also means that the program counter
18385 (PC) is 3@tie{}bytes wide.
18386
18387 @item __AVR_2_BYTE_PC__
18388 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18389 with up to 128@tie{}KiB of program memory.
18390
18391 @item __AVR_HAVE_8BIT_SP__
18392 @itemx __AVR_HAVE_16BIT_SP__
18393 The stack pointer (SP) register is treated as 8-bit respectively
18394 16-bit register by the compiler.
18395 The definition of these macros is affected by @option{-mtiny-stack}.
18396
18397 @item __AVR_HAVE_SPH__
18398 @itemx __AVR_SP8__
18399 The device has the SPH (high part of stack pointer) special function
18400 register or has an 8-bit stack pointer, respectively.
18401 The definition of these macros is affected by @option{-mmcu=} and
18402 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18403 by @option{-msp8}.
18404
18405 @item __AVR_HAVE_RAMPD__
18406 @itemx __AVR_HAVE_RAMPX__
18407 @itemx __AVR_HAVE_RAMPY__
18408 @itemx __AVR_HAVE_RAMPZ__
18409 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18410 @code{RAMPZ} special function register, respectively.
18411
18412 @item __NO_INTERRUPTS__
18413 This macro reflects the @option{-mno-interrupts} command-line option.
18414
18415 @item __AVR_ERRATA_SKIP__
18416 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18417 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18418 instructions because of a hardware erratum. Skip instructions are
18419 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18420 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18421 set.
18422
18423 @item __AVR_ISA_RMW__
18424 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18425
18426 @item __AVR_SFR_OFFSET__=@var{offset}
18427 Instructions that can address I/O special function registers directly
18428 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18429 address as if addressed by an instruction to access RAM like @code{LD}
18430 or @code{STS}. This offset depends on the device architecture and has
18431 to be subtracted from the RAM address in order to get the
18432 respective I/O@tie{}address.
18433
18434 @item __AVR_SHORT_CALLS__
18435 The @option{-mshort-calls} command line option is set.
18436
18437 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18438 Some devices support reading from flash memory by means of @code{LD*}
18439 instructions. The flash memory is seen in the data address space
18440 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18441 is not defined, this feature is not available. If defined,
18442 the address space is linear and there is no need to put
18443 @code{.rodata} into RAM. This is handled by the default linker
18444 description file, and is currently available for
18445 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18446 there is no need to use address spaces like @code{__flash} or
18447 features like attribute @code{progmem} and @code{pgm_read_*}.
18448
18449 @item __WITH_AVRLIBC__
18450 The compiler is configured to be used together with AVR-Libc.
18451 See the @option{--with-avrlibc} configure option.
18452
18453 @end table
18454
18455 @node Blackfin Options
18456 @subsection Blackfin Options
18457 @cindex Blackfin Options
18458
18459 @table @gcctabopt
18460 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18461 @opindex mcpu=
18462 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18463 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18464 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18465 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18466 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18467 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18468 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18469 @samp{bf561}, @samp{bf592}.
18470
18471 The optional @var{sirevision} specifies the silicon revision of the target
18472 Blackfin processor. Any workarounds available for the targeted silicon revision
18473 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18474 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18475 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18476 hexadecimal digits representing the major and minor numbers in the silicon
18477 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18478 is not defined. If @var{sirevision} is @samp{any}, the
18479 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18480 If this optional @var{sirevision} is not used, GCC assumes the latest known
18481 silicon revision of the targeted Blackfin processor.
18482
18483 GCC defines a preprocessor macro for the specified @var{cpu}.
18484 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18485 provided by libgloss to be linked in if @option{-msim} is not given.
18486
18487 Without this option, @samp{bf532} is used as the processor by default.
18488
18489 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18490 only the preprocessor macro is defined.
18491
18492 @item -msim
18493 @opindex msim
18494 Specifies that the program will be run on the simulator. This causes
18495 the simulator BSP provided by libgloss to be linked in. This option
18496 has effect only for @samp{bfin-elf} toolchain.
18497 Certain other options, such as @option{-mid-shared-library} and
18498 @option{-mfdpic}, imply @option{-msim}.
18499
18500 @item -momit-leaf-frame-pointer
18501 @opindex momit-leaf-frame-pointer
18502 Don't keep the frame pointer in a register for leaf functions. This
18503 avoids the instructions to save, set up and restore frame pointers and
18504 makes an extra register available in leaf functions.
18505
18506 @item -mspecld-anomaly
18507 @opindex mspecld-anomaly
18508 When enabled, the compiler ensures that the generated code does not
18509 contain speculative loads after jump instructions. If this option is used,
18510 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18511
18512 @item -mno-specld-anomaly
18513 @opindex mno-specld-anomaly
18514 @opindex mspecld-anomaly
18515 Don't generate extra code to prevent speculative loads from occurring.
18516
18517 @item -mcsync-anomaly
18518 @opindex mcsync-anomaly
18519 When enabled, the compiler ensures that the generated code does not
18520 contain CSYNC or SSYNC instructions too soon after conditional branches.
18521 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18522
18523 @item -mno-csync-anomaly
18524 @opindex mno-csync-anomaly
18525 @opindex mcsync-anomaly
18526 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18527 occurring too soon after a conditional branch.
18528
18529 @item -mlow64k
18530 @opindex mlow64k
18531 When enabled, the compiler is free to take advantage of the knowledge that
18532 the entire program fits into the low 64k of memory.
18533
18534 @item -mno-low64k
18535 @opindex mno-low64k
18536 Assume that the program is arbitrarily large. This is the default.
18537
18538 @item -mstack-check-l1
18539 @opindex mstack-check-l1
18540 Do stack checking using information placed into L1 scratchpad memory by the
18541 uClinux kernel.
18542
18543 @item -mid-shared-library
18544 @opindex mid-shared-library
18545 Generate code that supports shared libraries via the library ID method.
18546 This allows for execute in place and shared libraries in an environment
18547 without virtual memory management. This option implies @option{-fPIC}.
18548 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18549
18550 @item -mno-id-shared-library
18551 @opindex mno-id-shared-library
18552 @opindex mid-shared-library
18553 Generate code that doesn't assume ID-based shared libraries are being used.
18554 This is the default.
18555
18556 @item -mleaf-id-shared-library
18557 @opindex mleaf-id-shared-library
18558 Generate code that supports shared libraries via the library ID method,
18559 but assumes that this library or executable won't link against any other
18560 ID shared libraries. That allows the compiler to use faster code for jumps
18561 and calls.
18562
18563 @item -mno-leaf-id-shared-library
18564 @opindex mno-leaf-id-shared-library
18565 @opindex mleaf-id-shared-library
18566 Do not assume that the code being compiled won't link against any ID shared
18567 libraries. Slower code is generated for jump and call insns.
18568
18569 @item -mshared-library-id=n
18570 @opindex mshared-library-id
18571 Specifies the identification number of the ID-based shared library being
18572 compiled. Specifying a value of 0 generates more compact code; specifying
18573 other values forces the allocation of that number to the current
18574 library but is no more space- or time-efficient than omitting this option.
18575
18576 @item -msep-data
18577 @opindex msep-data
18578 Generate code that allows the data segment to be located in a different
18579 area of memory from the text segment. This allows for execute in place in
18580 an environment without virtual memory management by eliminating relocations
18581 against the text section.
18582
18583 @item -mno-sep-data
18584 @opindex mno-sep-data
18585 @opindex msep-data
18586 Generate code that assumes that the data segment follows the text segment.
18587 This is the default.
18588
18589 @item -mlong-calls
18590 @itemx -mno-long-calls
18591 @opindex mlong-calls
18592 @opindex mno-long-calls
18593 Tells the compiler to perform function calls by first loading the
18594 address of the function into a register and then performing a subroutine
18595 call on this register. This switch is needed if the target function
18596 lies outside of the 24-bit addressing range of the offset-based
18597 version of subroutine call instruction.
18598
18599 This feature is not enabled by default. Specifying
18600 @option{-mno-long-calls} restores the default behavior. Note these
18601 switches have no effect on how the compiler generates code to handle
18602 function calls via function pointers.
18603
18604 @item -mfast-fp
18605 @opindex mfast-fp
18606 Link with the fast floating-point library. This library relaxes some of
18607 the IEEE floating-point standard's rules for checking inputs against
18608 Not-a-Number (NAN), in the interest of performance.
18609
18610 @item -minline-plt
18611 @opindex minline-plt
18612 Enable inlining of PLT entries in function calls to functions that are
18613 not known to bind locally. It has no effect without @option{-mfdpic}.
18614
18615 @item -mmulticore
18616 @opindex mmulticore
18617 Build a standalone application for multicore Blackfin processors.
18618 This option causes proper start files and link scripts supporting
18619 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18620 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18621
18622 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18623 selects the one-application-per-core programming model. Without
18624 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18625 programming model is used. In this model, the main function of Core B
18626 should be named as @code{coreb_main}.
18627
18628 If this option is not used, the single-core application programming
18629 model is used.
18630
18631 @item -mcorea
18632 @opindex mcorea
18633 Build a standalone application for Core A of BF561 when using
18634 the one-application-per-core programming model. Proper start files
18635 and link scripts are used to support Core A, and the macro
18636 @code{__BFIN_COREA} is defined.
18637 This option can only be used in conjunction with @option{-mmulticore}.
18638
18639 @item -mcoreb
18640 @opindex mcoreb
18641 Build a standalone application for Core B of BF561 when using
18642 the one-application-per-core programming model. Proper start files
18643 and link scripts are used to support Core B, and the macro
18644 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18645 should be used instead of @code{main}.
18646 This option can only be used in conjunction with @option{-mmulticore}.
18647
18648 @item -msdram
18649 @opindex msdram
18650 Build a standalone application for SDRAM. Proper start files and
18651 link scripts are used to put the application into SDRAM, and the macro
18652 @code{__BFIN_SDRAM} is defined.
18653 The loader should initialize SDRAM before loading the application.
18654
18655 @item -micplb
18656 @opindex micplb
18657 Assume that ICPLBs are enabled at run time. This has an effect on certain
18658 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18659 are enabled; for standalone applications the default is off.
18660 @end table
18661
18662 @node C6X Options
18663 @subsection C6X Options
18664 @cindex C6X Options
18665
18666 @table @gcctabopt
18667 @item -march=@var{name}
18668 @opindex march
18669 This specifies the name of the target architecture. GCC uses this
18670 name to determine what kind of instructions it can emit when generating
18671 assembly code. Permissible names are: @samp{c62x},
18672 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18673
18674 @item -mbig-endian
18675 @opindex mbig-endian
18676 Generate code for a big-endian target.
18677
18678 @item -mlittle-endian
18679 @opindex mlittle-endian
18680 Generate code for a little-endian target. This is the default.
18681
18682 @item -msim
18683 @opindex msim
18684 Choose startup files and linker script suitable for the simulator.
18685
18686 @item -msdata=default
18687 @opindex msdata=default
18688 Put small global and static data in the @code{.neardata} section,
18689 which is pointed to by register @code{B14}. Put small uninitialized
18690 global and static data in the @code{.bss} section, which is adjacent
18691 to the @code{.neardata} section. Put small read-only data into the
18692 @code{.rodata} section. The corresponding sections used for large
18693 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18694
18695 @item -msdata=all
18696 @opindex msdata=all
18697 Put all data, not just small objects, into the sections reserved for
18698 small data, and use addressing relative to the @code{B14} register to
18699 access them.
18700
18701 @item -msdata=none
18702 @opindex msdata=none
18703 Make no use of the sections reserved for small data, and use absolute
18704 addresses to access all data. Put all initialized global and static
18705 data in the @code{.fardata} section, and all uninitialized data in the
18706 @code{.far} section. Put all constant data into the @code{.const}
18707 section.
18708 @end table
18709
18710 @node CRIS Options
18711 @subsection CRIS Options
18712 @cindex CRIS Options
18713
18714 These options are defined specifically for the CRIS ports.
18715
18716 @table @gcctabopt
18717 @item -march=@var{architecture-type}
18718 @itemx -mcpu=@var{architecture-type}
18719 @opindex march
18720 @opindex mcpu
18721 Generate code for the specified architecture. The choices for
18722 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18723 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18724 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18725 @samp{v10}.
18726
18727 @item -mtune=@var{architecture-type}
18728 @opindex mtune
18729 Tune to @var{architecture-type} everything applicable about the generated
18730 code, except for the ABI and the set of available instructions. The
18731 choices for @var{architecture-type} are the same as for
18732 @option{-march=@var{architecture-type}}.
18733
18734 @item -mmax-stack-frame=@var{n}
18735 @opindex mmax-stack-frame
18736 Warn when the stack frame of a function exceeds @var{n} bytes.
18737
18738 @item -metrax4
18739 @itemx -metrax100
18740 @opindex metrax4
18741 @opindex metrax100
18742 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18743 @option{-march=v3} and @option{-march=v8} respectively.
18744
18745 @item -mmul-bug-workaround
18746 @itemx -mno-mul-bug-workaround
18747 @opindex mmul-bug-workaround
18748 @opindex mno-mul-bug-workaround
18749 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18750 models where it applies. This option is active by default.
18751
18752 @item -mpdebug
18753 @opindex mpdebug
18754 Enable CRIS-specific verbose debug-related information in the assembly
18755 code. This option also has the effect of turning off the @samp{#NO_APP}
18756 formatted-code indicator to the assembler at the beginning of the
18757 assembly file.
18758
18759 @item -mcc-init
18760 @opindex mcc-init
18761 Do not use condition-code results from previous instruction; always emit
18762 compare and test instructions before use of condition codes.
18763
18764 @item -mno-side-effects
18765 @opindex mno-side-effects
18766 @opindex mside-effects
18767 Do not emit instructions with side effects in addressing modes other than
18768 post-increment.
18769
18770 @item -mstack-align
18771 @itemx -mno-stack-align
18772 @itemx -mdata-align
18773 @itemx -mno-data-align
18774 @itemx -mconst-align
18775 @itemx -mno-const-align
18776 @opindex mstack-align
18777 @opindex mno-stack-align
18778 @opindex mdata-align
18779 @opindex mno-data-align
18780 @opindex mconst-align
18781 @opindex mno-const-align
18782 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18783 stack frame, individual data and constants to be aligned for the maximum
18784 single data access size for the chosen CPU model. The default is to
18785 arrange for 32-bit alignment. ABI details such as structure layout are
18786 not affected by these options.
18787
18788 @item -m32-bit
18789 @itemx -m16-bit
18790 @itemx -m8-bit
18791 @opindex m32-bit
18792 @opindex m16-bit
18793 @opindex m8-bit
18794 Similar to the stack- data- and const-align options above, these options
18795 arrange for stack frame, writable data and constants to all be 32-bit,
18796 16-bit or 8-bit aligned. The default is 32-bit alignment.
18797
18798 @item -mno-prologue-epilogue
18799 @itemx -mprologue-epilogue
18800 @opindex mno-prologue-epilogue
18801 @opindex mprologue-epilogue
18802 With @option{-mno-prologue-epilogue}, the normal function prologue and
18803 epilogue which set up the stack frame are omitted and no return
18804 instructions or return sequences are generated in the code. Use this
18805 option only together with visual inspection of the compiled code: no
18806 warnings or errors are generated when call-saved registers must be saved,
18807 or storage for local variables needs to be allocated.
18808
18809 @item -mno-gotplt
18810 @itemx -mgotplt
18811 @opindex mno-gotplt
18812 @opindex mgotplt
18813 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18814 instruction sequences that load addresses for functions from the PLT part
18815 of the GOT rather than (traditional on other architectures) calls to the
18816 PLT@. The default is @option{-mgotplt}.
18817
18818 @item -melf
18819 @opindex melf
18820 Legacy no-op option only recognized with the cris-axis-elf and
18821 cris-axis-linux-gnu targets.
18822
18823 @item -mlinux
18824 @opindex mlinux
18825 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18826
18827 @item -sim
18828 @opindex sim
18829 This option, recognized for the cris-axis-elf, arranges
18830 to link with input-output functions from a simulator library. Code,
18831 initialized data and zero-initialized data are allocated consecutively.
18832
18833 @item -sim2
18834 @opindex sim2
18835 Like @option{-sim}, but pass linker options to locate initialized data at
18836 0x40000000 and zero-initialized data at 0x80000000.
18837 @end table
18838
18839 @node CR16 Options
18840 @subsection CR16 Options
18841 @cindex CR16 Options
18842
18843 These options are defined specifically for the CR16 ports.
18844
18845 @table @gcctabopt
18846
18847 @item -mmac
18848 @opindex mmac
18849 Enable the use of multiply-accumulate instructions. Disabled by default.
18850
18851 @item -mcr16cplus
18852 @itemx -mcr16c
18853 @opindex mcr16cplus
18854 @opindex mcr16c
18855 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18856 is default.
18857
18858 @item -msim
18859 @opindex msim
18860 Links the library libsim.a which is in compatible with simulator. Applicable
18861 to ELF compiler only.
18862
18863 @item -mint32
18864 @opindex mint32
18865 Choose integer type as 32-bit wide.
18866
18867 @item -mbit-ops
18868 @opindex mbit-ops
18869 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18870
18871 @item -mdata-model=@var{model}
18872 @opindex mdata-model
18873 Choose a data model. The choices for @var{model} are @samp{near},
18874 @samp{far} or @samp{medium}. @samp{medium} is default.
18875 However, @samp{far} is not valid with @option{-mcr16c}, as the
18876 CR16C architecture does not support the far data model.
18877 @end table
18878
18879 @node C-SKY Options
18880 @subsection C-SKY Options
18881 @cindex C-SKY Options
18882
18883 GCC supports these options when compiling for C-SKY V2 processors.
18884
18885 @table @gcctabopt
18886
18887 @item -march=@var{arch}
18888 @opindex march=
18889 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18890 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18891 The default is @samp{ck810}.
18892
18893 @item -mcpu=@var{cpu}
18894 @opindex mcpu=
18895 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18896 @samp{ck801}, @samp{ck801t},
18897 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18898 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18899 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18900 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18901 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18902 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18903 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18904 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18905 @samp{ck803eftr1}, @samp{ck803efhtr1},
18906 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18907 @samp{ck803sef}, @samp{ck803seft},
18908 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18909 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18910 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18911 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18912
18913 @item -mbig-endian
18914 @opindex mbig-endian
18915 @itemx -EB
18916 @opindex EB
18917 @itemx -mlittle-endian
18918 @opindex mlittle-endian
18919 @itemx -EL
18920 @opindex EL
18921
18922 Select big- or little-endian code. The default is little-endian.
18923
18924 @item -mhard-float
18925 @opindex mhard-float
18926 @itemx -msoft-float
18927 @opindex msoft-float
18928
18929 Select hardware or software floating-point implementations.
18930 The default is soft float.
18931
18932 @item -mdouble-float
18933 @itemx -mno-double-float
18934 @opindex mdouble-float
18935 When @option{-mhard-float} is in effect, enable generation of
18936 double-precision float instructions. This is the default except
18937 when compiling for CK803.
18938
18939 @item -mfdivdu
18940 @itemx -mno-fdivdu
18941 @opindex mfdivdu
18942 When @option{-mhard-float} is in effect, enable generation of
18943 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18944 This is the default except when compiling for CK803.
18945
18946 @item -mfpu=@var{fpu}
18947 @opindex mfpu=
18948 Select the floating-point processor. This option can only be used with
18949 @option{-mhard-float}.
18950 Values for @var{fpu} are
18951 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18952 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18953 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18954
18955 @item -melrw
18956 @itemx -mno-elrw
18957 @opindex melrw
18958 Enable the extended @code{lrw} instruction. This option defaults to on
18959 for CK801 and off otherwise.
18960
18961 @item -mistack
18962 @itemx -mno-istack
18963 @opindex mistack
18964 Enable interrupt stack instructions; the default is off.
18965
18966 The @option{-mistack} option is required to handle the
18967 @code{interrupt} and @code{isr} function attributes
18968 (@pxref{C-SKY Function Attributes}).
18969
18970 @item -mmp
18971 @opindex mmp
18972 Enable multiprocessor instructions; the default is off.
18973
18974 @item -mcp
18975 @opindex mcp
18976 Enable coprocessor instructions; the default is off.
18977
18978 @item -mcache
18979 @opindex mcache
18980 Enable coprocessor instructions; the default is off.
18981
18982 @item -msecurity
18983 @opindex msecurity
18984 Enable C-SKY security instructions; the default is off.
18985
18986 @item -mtrust
18987 @opindex mtrust
18988 Enable C-SKY trust instructions; the default is off.
18989
18990 @item -mdsp
18991 @opindex mdsp
18992 @itemx -medsp
18993 @opindex medsp
18994 @itemx -mvdsp
18995 @opindex mvdsp
18996 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18997 All of these options default to off.
18998
18999 @item -mdiv
19000 @itemx -mno-div
19001 @opindex mdiv
19002 Generate divide instructions. Default is off.
19003
19004 @item -msmart
19005 @itemx -mno-smart
19006 @opindex msmart
19007 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19008 use of 16-bit instructions. This option is ignored for CK801 where this
19009 is the required behavior, and it defaults to on for CK802.
19010 For other targets, the default is off.
19011
19012 @item -mhigh-registers
19013 @itemx -mno-high-registers
19014 @opindex mhigh-registers
19015 Generate code using the high registers numbered 16-31. This option
19016 is not supported on CK801, CK802, or CK803, and is enabled by default
19017 for other processors.
19018
19019 @item -manchor
19020 @itemx -mno-anchor
19021 @opindex manchor
19022 Generate code using global anchor symbol addresses.
19023
19024 @item -mpushpop
19025 @itemx -mno-pushpop
19026 @opindex mpushpop
19027 Generate code using @code{push} and @code{pop} instructions. This option
19028 defaults to on.
19029
19030 @item -mmultiple-stld
19031 @itemx -mstm
19032 @itemx -mno-multiple-stld
19033 @itemx -mno-stm
19034 @opindex mmultiple-stld
19035 Generate code using @code{stm} and @code{ldm} instructions. This option
19036 isn't supported on CK801 but is enabled by default on other processors.
19037
19038 @item -mconstpool
19039 @itemx -mno-constpool
19040 @opindex mconstpool
19041 Create constant pools in the compiler instead of deferring it to the
19042 assembler. This option is the default and required for correct code
19043 generation on CK801 and CK802, and is optional on other processors.
19044
19045 @item -mstack-size
19046 @item -mno-stack-size
19047 @opindex mstack-size
19048 Emit @code{.stack_size} directives for each function in the assembly
19049 output. This option defaults to off.
19050
19051 @item -mccrt
19052 @itemx -mno-ccrt
19053 @opindex mccrt
19054 Generate code for the C-SKY compiler runtime instead of libgcc. This
19055 option defaults to off.
19056
19057 @item -mbranch-cost=@var{n}
19058 @opindex mbranch-cost=
19059 Set the branch costs to roughly @code{n} instructions. The default is 1.
19060
19061 @item -msched-prolog
19062 @itemx -mno-sched-prolog
19063 @opindex msched-prolog
19064 Permit scheduling of function prologue and epilogue sequences. Using
19065 this option can result in code that is not compliant with the C-SKY V2 ABI
19066 prologue requirements and that cannot be debugged or backtraced.
19067 It is disabled by default.
19068
19069 @end table
19070
19071 @node Darwin Options
19072 @subsection Darwin Options
19073 @cindex Darwin options
19074
19075 These options are defined for all architectures running the Darwin operating
19076 system.
19077
19078 FSF GCC on Darwin does not create ``fat'' object files; it creates
19079 an object file for the single architecture that GCC was built to
19080 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19081 @option{-arch} options are used; it does so by running the compiler or
19082 linker multiple times and joining the results together with
19083 @file{lipo}.
19084
19085 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19086 @samp{i686}) is determined by the flags that specify the ISA
19087 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19088 @option{-force_cpusubtype_ALL} option can be used to override this.
19089
19090 The Darwin tools vary in their behavior when presented with an ISA
19091 mismatch. The assembler, @file{as}, only permits instructions to
19092 be used that are valid for the subtype of the file it is generating,
19093 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19094 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19095 and prints an error if asked to create a shared library with a less
19096 restrictive subtype than its input files (for instance, trying to put
19097 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19098 for executables, @command{ld}, quietly gives the executable the most
19099 restrictive subtype of any of its input files.
19100
19101 @table @gcctabopt
19102 @item -F@var{dir}
19103 @opindex F
19104 Add the framework directory @var{dir} to the head of the list of
19105 directories to be searched for header files. These directories are
19106 interleaved with those specified by @option{-I} options and are
19107 scanned in a left-to-right order.
19108
19109 A framework directory is a directory with frameworks in it. A
19110 framework is a directory with a @file{Headers} and/or
19111 @file{PrivateHeaders} directory contained directly in it that ends
19112 in @file{.framework}. The name of a framework is the name of this
19113 directory excluding the @file{.framework}. Headers associated with
19114 the framework are found in one of those two directories, with
19115 @file{Headers} being searched first. A subframework is a framework
19116 directory that is in a framework's @file{Frameworks} directory.
19117 Includes of subframework headers can only appear in a header of a
19118 framework that contains the subframework, or in a sibling subframework
19119 header. Two subframeworks are siblings if they occur in the same
19120 framework. A subframework should not have the same name as a
19121 framework; a warning is issued if this is violated. Currently a
19122 subframework cannot have subframeworks; in the future, the mechanism
19123 may be extended to support this. The standard frameworks can be found
19124 in @file{/System/Library/Frameworks} and
19125 @file{/Library/Frameworks}. An example include looks like
19126 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19127 the name of the framework and @file{header.h} is found in the
19128 @file{PrivateHeaders} or @file{Headers} directory.
19129
19130 @item -iframework@var{dir}
19131 @opindex iframework
19132 Like @option{-F} except the directory is a treated as a system
19133 directory. The main difference between this @option{-iframework} and
19134 @option{-F} is that with @option{-iframework} the compiler does not
19135 warn about constructs contained within header files found via
19136 @var{dir}. This option is valid only for the C family of languages.
19137
19138 @item -gused
19139 @opindex gused
19140 Emit debugging information for symbols that are used. For stabs
19141 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19142 This is by default ON@.
19143
19144 @item -gfull
19145 @opindex gfull
19146 Emit debugging information for all symbols and types.
19147
19148 @item -mmacosx-version-min=@var{version}
19149 The earliest version of MacOS X that this executable will run on
19150 is @var{version}. Typical values of @var{version} include @code{10.1},
19151 @code{10.2}, and @code{10.3.9}.
19152
19153 If the compiler was built to use the system's headers by default,
19154 then the default for this option is the system version on which the
19155 compiler is running, otherwise the default is to make choices that
19156 are compatible with as many systems and code bases as possible.
19157
19158 @item -mkernel
19159 @opindex mkernel
19160 Enable kernel development mode. The @option{-mkernel} option sets
19161 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19162 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19163 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19164 applicable. This mode also sets @option{-mno-altivec},
19165 @option{-msoft-float}, @option{-fno-builtin} and
19166 @option{-mlong-branch} for PowerPC targets.
19167
19168 @item -mone-byte-bool
19169 @opindex mone-byte-bool
19170 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19171 By default @code{sizeof(bool)} is @code{4} when compiling for
19172 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19173 option has no effect on x86.
19174
19175 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19176 to generate code that is not binary compatible with code generated
19177 without that switch. Using this switch may require recompiling all
19178 other modules in a program, including system libraries. Use this
19179 switch to conform to a non-default data model.
19180
19181 @item -mfix-and-continue
19182 @itemx -ffix-and-continue
19183 @itemx -findirect-data
19184 @opindex mfix-and-continue
19185 @opindex ffix-and-continue
19186 @opindex findirect-data
19187 Generate code suitable for fast turnaround development, such as to
19188 allow GDB to dynamically load @file{.o} files into already-running
19189 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19190 are provided for backwards compatibility.
19191
19192 @item -all_load
19193 @opindex all_load
19194 Loads all members of static archive libraries.
19195 See man ld(1) for more information.
19196
19197 @item -arch_errors_fatal
19198 @opindex arch_errors_fatal
19199 Cause the errors having to do with files that have the wrong architecture
19200 to be fatal.
19201
19202 @item -bind_at_load
19203 @opindex bind_at_load
19204 Causes the output file to be marked such that the dynamic linker will
19205 bind all undefined references when the file is loaded or launched.
19206
19207 @item -bundle
19208 @opindex bundle
19209 Produce a Mach-o bundle format file.
19210 See man ld(1) for more information.
19211
19212 @item -bundle_loader @var{executable}
19213 @opindex bundle_loader
19214 This option specifies the @var{executable} that will load the build
19215 output file being linked. See man ld(1) for more information.
19216
19217 @item -dynamiclib
19218 @opindex dynamiclib
19219 When passed this option, GCC produces a dynamic library instead of
19220 an executable when linking, using the Darwin @file{libtool} command.
19221
19222 @item -force_cpusubtype_ALL
19223 @opindex force_cpusubtype_ALL
19224 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19225 one controlled by the @option{-mcpu} or @option{-march} option.
19226
19227 @item -allowable_client @var{client_name}
19228 @itemx -client_name
19229 @itemx -compatibility_version
19230 @itemx -current_version
19231 @itemx -dead_strip
19232 @itemx -dependency-file
19233 @itemx -dylib_file
19234 @itemx -dylinker_install_name
19235 @itemx -dynamic
19236 @itemx -exported_symbols_list
19237 @itemx -filelist
19238 @need 800
19239 @itemx -flat_namespace
19240 @itemx -force_flat_namespace
19241 @itemx -headerpad_max_install_names
19242 @itemx -image_base
19243 @itemx -init
19244 @itemx -install_name
19245 @itemx -keep_private_externs
19246 @itemx -multi_module
19247 @itemx -multiply_defined
19248 @itemx -multiply_defined_unused
19249 @need 800
19250 @itemx -noall_load
19251 @itemx -no_dead_strip_inits_and_terms
19252 @itemx -nofixprebinding
19253 @itemx -nomultidefs
19254 @itemx -noprebind
19255 @itemx -noseglinkedit
19256 @itemx -pagezero_size
19257 @itemx -prebind
19258 @itemx -prebind_all_twolevel_modules
19259 @itemx -private_bundle
19260 @need 800
19261 @itemx -read_only_relocs
19262 @itemx -sectalign
19263 @itemx -sectobjectsymbols
19264 @itemx -whyload
19265 @itemx -seg1addr
19266 @itemx -sectcreate
19267 @itemx -sectobjectsymbols
19268 @itemx -sectorder
19269 @itemx -segaddr
19270 @itemx -segs_read_only_addr
19271 @need 800
19272 @itemx -segs_read_write_addr
19273 @itemx -seg_addr_table
19274 @itemx -seg_addr_table_filename
19275 @itemx -seglinkedit
19276 @itemx -segprot
19277 @itemx -segs_read_only_addr
19278 @itemx -segs_read_write_addr
19279 @itemx -single_module
19280 @itemx -static
19281 @itemx -sub_library
19282 @need 800
19283 @itemx -sub_umbrella
19284 @itemx -twolevel_namespace
19285 @itemx -umbrella
19286 @itemx -undefined
19287 @itemx -unexported_symbols_list
19288 @itemx -weak_reference_mismatches
19289 @itemx -whatsloaded
19290 @opindex allowable_client
19291 @opindex client_name
19292 @opindex compatibility_version
19293 @opindex current_version
19294 @opindex dead_strip
19295 @opindex dependency-file
19296 @opindex dylib_file
19297 @opindex dylinker_install_name
19298 @opindex dynamic
19299 @opindex exported_symbols_list
19300 @opindex filelist
19301 @opindex flat_namespace
19302 @opindex force_flat_namespace
19303 @opindex headerpad_max_install_names
19304 @opindex image_base
19305 @opindex init
19306 @opindex install_name
19307 @opindex keep_private_externs
19308 @opindex multi_module
19309 @opindex multiply_defined
19310 @opindex multiply_defined_unused
19311 @opindex noall_load
19312 @opindex no_dead_strip_inits_and_terms
19313 @opindex nofixprebinding
19314 @opindex nomultidefs
19315 @opindex noprebind
19316 @opindex noseglinkedit
19317 @opindex pagezero_size
19318 @opindex prebind
19319 @opindex prebind_all_twolevel_modules
19320 @opindex private_bundle
19321 @opindex read_only_relocs
19322 @opindex sectalign
19323 @opindex sectobjectsymbols
19324 @opindex whyload
19325 @opindex seg1addr
19326 @opindex sectcreate
19327 @opindex sectobjectsymbols
19328 @opindex sectorder
19329 @opindex segaddr
19330 @opindex segs_read_only_addr
19331 @opindex segs_read_write_addr
19332 @opindex seg_addr_table
19333 @opindex seg_addr_table_filename
19334 @opindex seglinkedit
19335 @opindex segprot
19336 @opindex segs_read_only_addr
19337 @opindex segs_read_write_addr
19338 @opindex single_module
19339 @opindex static
19340 @opindex sub_library
19341 @opindex sub_umbrella
19342 @opindex twolevel_namespace
19343 @opindex umbrella
19344 @opindex undefined
19345 @opindex unexported_symbols_list
19346 @opindex weak_reference_mismatches
19347 @opindex whatsloaded
19348 These options are passed to the Darwin linker. The Darwin linker man page
19349 describes them in detail.
19350 @end table
19351
19352 @node DEC Alpha Options
19353 @subsection DEC Alpha Options
19354
19355 These @samp{-m} options are defined for the DEC Alpha implementations:
19356
19357 @table @gcctabopt
19358 @item -mno-soft-float
19359 @itemx -msoft-float
19360 @opindex mno-soft-float
19361 @opindex msoft-float
19362 Use (do not use) the hardware floating-point instructions for
19363 floating-point operations. When @option{-msoft-float} is specified,
19364 functions in @file{libgcc.a} are used to perform floating-point
19365 operations. Unless they are replaced by routines that emulate the
19366 floating-point operations, or compiled in such a way as to call such
19367 emulations routines, these routines issue floating-point
19368 operations. If you are compiling for an Alpha without floating-point
19369 operations, you must ensure that the library is built so as not to call
19370 them.
19371
19372 Note that Alpha implementations without floating-point operations are
19373 required to have floating-point registers.
19374
19375 @item -mfp-reg
19376 @itemx -mno-fp-regs
19377 @opindex mfp-reg
19378 @opindex mno-fp-regs
19379 Generate code that uses (does not use) the floating-point register set.
19380 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19381 register set is not used, floating-point operands are passed in integer
19382 registers as if they were integers and floating-point results are passed
19383 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19384 so any function with a floating-point argument or return value called by code
19385 compiled with @option{-mno-fp-regs} must also be compiled with that
19386 option.
19387
19388 A typical use of this option is building a kernel that does not use,
19389 and hence need not save and restore, any floating-point registers.
19390
19391 @item -mieee
19392 @opindex mieee
19393 The Alpha architecture implements floating-point hardware optimized for
19394 maximum performance. It is mostly compliant with the IEEE floating-point
19395 standard. However, for full compliance, software assistance is
19396 required. This option generates code fully IEEE-compliant code
19397 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19398 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19399 defined during compilation. The resulting code is less efficient but is
19400 able to correctly support denormalized numbers and exceptional IEEE
19401 values such as not-a-number and plus/minus infinity. Other Alpha
19402 compilers call this option @option{-ieee_with_no_inexact}.
19403
19404 @item -mieee-with-inexact
19405 @opindex mieee-with-inexact
19406 This is like @option{-mieee} except the generated code also maintains
19407 the IEEE @var{inexact-flag}. Turning on this option causes the
19408 generated code to implement fully-compliant IEEE math. In addition to
19409 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19410 macro. On some Alpha implementations the resulting code may execute
19411 significantly slower than the code generated by default. Since there is
19412 very little code that depends on the @var{inexact-flag}, you should
19413 normally not specify this option. Other Alpha compilers call this
19414 option @option{-ieee_with_inexact}.
19415
19416 @item -mfp-trap-mode=@var{trap-mode}
19417 @opindex mfp-trap-mode
19418 This option controls what floating-point related traps are enabled.
19419 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19420 The trap mode can be set to one of four values:
19421
19422 @table @samp
19423 @item n
19424 This is the default (normal) setting. The only traps that are enabled
19425 are the ones that cannot be disabled in software (e.g., division by zero
19426 trap).
19427
19428 @item u
19429 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19430 as well.
19431
19432 @item su
19433 Like @samp{u}, but the instructions are marked to be safe for software
19434 completion (see Alpha architecture manual for details).
19435
19436 @item sui
19437 Like @samp{su}, but inexact traps are enabled as well.
19438 @end table
19439
19440 @item -mfp-rounding-mode=@var{rounding-mode}
19441 @opindex mfp-rounding-mode
19442 Selects the IEEE rounding mode. Other Alpha compilers call this option
19443 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19444 of:
19445
19446 @table @samp
19447 @item n
19448 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19449 the nearest machine number or towards the even machine number in case
19450 of a tie.
19451
19452 @item m
19453 Round towards minus infinity.
19454
19455 @item c
19456 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19457
19458 @item d
19459 Dynamic rounding mode. A field in the floating-point control register
19460 (@var{fpcr}, see Alpha architecture reference manual) controls the
19461 rounding mode in effect. The C library initializes this register for
19462 rounding towards plus infinity. Thus, unless your program modifies the
19463 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19464 @end table
19465
19466 @item -mtrap-precision=@var{trap-precision}
19467 @opindex mtrap-precision
19468 In the Alpha architecture, floating-point traps are imprecise. This
19469 means without software assistance it is impossible to recover from a
19470 floating trap and program execution normally needs to be terminated.
19471 GCC can generate code that can assist operating system trap handlers
19472 in determining the exact location that caused a floating-point trap.
19473 Depending on the requirements of an application, different levels of
19474 precisions can be selected:
19475
19476 @table @samp
19477 @item p
19478 Program precision. This option is the default and means a trap handler
19479 can only identify which program caused a floating-point exception.
19480
19481 @item f
19482 Function precision. The trap handler can determine the function that
19483 caused a floating-point exception.
19484
19485 @item i
19486 Instruction precision. The trap handler can determine the exact
19487 instruction that caused a floating-point exception.
19488 @end table
19489
19490 Other Alpha compilers provide the equivalent options called
19491 @option{-scope_safe} and @option{-resumption_safe}.
19492
19493 @item -mieee-conformant
19494 @opindex mieee-conformant
19495 This option marks the generated code as IEEE conformant. You must not
19496 use this option unless you also specify @option{-mtrap-precision=i} and either
19497 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19498 is to emit the line @samp{.eflag 48} in the function prologue of the
19499 generated assembly file.
19500
19501 @item -mbuild-constants
19502 @opindex mbuild-constants
19503 Normally GCC examines a 32- or 64-bit integer constant to
19504 see if it can construct it from smaller constants in two or three
19505 instructions. If it cannot, it outputs the constant as a literal and
19506 generates code to load it from the data segment at run time.
19507
19508 Use this option to require GCC to construct @emph{all} integer constants
19509 using code, even if it takes more instructions (the maximum is six).
19510
19511 You typically use this option to build a shared library dynamic
19512 loader. Itself a shared library, it must relocate itself in memory
19513 before it can find the variables and constants in its own data segment.
19514
19515 @item -mbwx
19516 @itemx -mno-bwx
19517 @itemx -mcix
19518 @itemx -mno-cix
19519 @itemx -mfix
19520 @itemx -mno-fix
19521 @itemx -mmax
19522 @itemx -mno-max
19523 @opindex mbwx
19524 @opindex mno-bwx
19525 @opindex mcix
19526 @opindex mno-cix
19527 @opindex mfix
19528 @opindex mno-fix
19529 @opindex mmax
19530 @opindex mno-max
19531 Indicate whether GCC should generate code to use the optional BWX,
19532 CIX, FIX and MAX instruction sets. The default is to use the instruction
19533 sets supported by the CPU type specified via @option{-mcpu=} option or that
19534 of the CPU on which GCC was built if none is specified.
19535
19536 @item -mfloat-vax
19537 @itemx -mfloat-ieee
19538 @opindex mfloat-vax
19539 @opindex mfloat-ieee
19540 Generate code that uses (does not use) VAX F and G floating-point
19541 arithmetic instead of IEEE single and double precision.
19542
19543 @item -mexplicit-relocs
19544 @itemx -mno-explicit-relocs
19545 @opindex mexplicit-relocs
19546 @opindex mno-explicit-relocs
19547 Older Alpha assemblers provided no way to generate symbol relocations
19548 except via assembler macros. Use of these macros does not allow
19549 optimal instruction scheduling. GNU binutils as of version 2.12
19550 supports a new syntax that allows the compiler to explicitly mark
19551 which relocations should apply to which instructions. This option
19552 is mostly useful for debugging, as GCC detects the capabilities of
19553 the assembler when it is built and sets the default accordingly.
19554
19555 @item -msmall-data
19556 @itemx -mlarge-data
19557 @opindex msmall-data
19558 @opindex mlarge-data
19559 When @option{-mexplicit-relocs} is in effect, static data is
19560 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19561 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19562 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19563 16-bit relocations off of the @code{$gp} register. This limits the
19564 size of the small data area to 64KB, but allows the variables to be
19565 directly accessed via a single instruction.
19566
19567 The default is @option{-mlarge-data}. With this option the data area
19568 is limited to just below 2GB@. Programs that require more than 2GB of
19569 data must use @code{malloc} or @code{mmap} to allocate the data in the
19570 heap instead of in the program's data segment.
19571
19572 When generating code for shared libraries, @option{-fpic} implies
19573 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19574
19575 @item -msmall-text
19576 @itemx -mlarge-text
19577 @opindex msmall-text
19578 @opindex mlarge-text
19579 When @option{-msmall-text} is used, the compiler assumes that the
19580 code of the entire program (or shared library) fits in 4MB, and is
19581 thus reachable with a branch instruction. When @option{-msmall-data}
19582 is used, the compiler can assume that all local symbols share the
19583 same @code{$gp} value, and thus reduce the number of instructions
19584 required for a function call from 4 to 1.
19585
19586 The default is @option{-mlarge-text}.
19587
19588 @item -mcpu=@var{cpu_type}
19589 @opindex mcpu
19590 Set the instruction set and instruction scheduling parameters for
19591 machine type @var{cpu_type}. You can specify either the @samp{EV}
19592 style name or the corresponding chip number. GCC supports scheduling
19593 parameters for the EV4, EV5 and EV6 family of processors and
19594 chooses the default values for the instruction set from the processor
19595 you specify. If you do not specify a processor type, GCC defaults
19596 to the processor on which the compiler was built.
19597
19598 Supported values for @var{cpu_type} are
19599
19600 @table @samp
19601 @item ev4
19602 @itemx ev45
19603 @itemx 21064
19604 Schedules as an EV4 and has no instruction set extensions.
19605
19606 @item ev5
19607 @itemx 21164
19608 Schedules as an EV5 and has no instruction set extensions.
19609
19610 @item ev56
19611 @itemx 21164a
19612 Schedules as an EV5 and supports the BWX extension.
19613
19614 @item pca56
19615 @itemx 21164pc
19616 @itemx 21164PC
19617 Schedules as an EV5 and supports the BWX and MAX extensions.
19618
19619 @item ev6
19620 @itemx 21264
19621 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19622
19623 @item ev67
19624 @itemx 21264a
19625 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19626 @end table
19627
19628 Native toolchains also support the value @samp{native},
19629 which selects the best architecture option for the host processor.
19630 @option{-mcpu=native} has no effect if GCC does not recognize
19631 the processor.
19632
19633 @item -mtune=@var{cpu_type}
19634 @opindex mtune
19635 Set only the instruction scheduling parameters for machine type
19636 @var{cpu_type}. The instruction set is not changed.
19637
19638 Native toolchains also support the value @samp{native},
19639 which selects the best architecture option for the host processor.
19640 @option{-mtune=native} has no effect if GCC does not recognize
19641 the processor.
19642
19643 @item -mmemory-latency=@var{time}
19644 @opindex mmemory-latency
19645 Sets the latency the scheduler should assume for typical memory
19646 references as seen by the application. This number is highly
19647 dependent on the memory access patterns used by the application
19648 and the size of the external cache on the machine.
19649
19650 Valid options for @var{time} are
19651
19652 @table @samp
19653 @item @var{number}
19654 A decimal number representing clock cycles.
19655
19656 @item L1
19657 @itemx L2
19658 @itemx L3
19659 @itemx main
19660 The compiler contains estimates of the number of clock cycles for
19661 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19662 (also called Dcache, Scache, and Bcache), as well as to main memory.
19663 Note that L3 is only valid for EV5.
19664
19665 @end table
19666 @end table
19667
19668 @node FR30 Options
19669 @subsection FR30 Options
19670 @cindex FR30 Options
19671
19672 These options are defined specifically for the FR30 port.
19673
19674 @table @gcctabopt
19675
19676 @item -msmall-model
19677 @opindex msmall-model
19678 Use the small address space model. This can produce smaller code, but
19679 it does assume that all symbolic values and addresses fit into a
19680 20-bit range.
19681
19682 @item -mno-lsim
19683 @opindex mno-lsim
19684 Assume that runtime support has been provided and so there is no need
19685 to include the simulator library (@file{libsim.a}) on the linker
19686 command line.
19687
19688 @end table
19689
19690 @node FT32 Options
19691 @subsection FT32 Options
19692 @cindex FT32 Options
19693
19694 These options are defined specifically for the FT32 port.
19695
19696 @table @gcctabopt
19697
19698 @item -msim
19699 @opindex msim
19700 Specifies that the program will be run on the simulator. This causes
19701 an alternate runtime startup and library to be linked.
19702 You must not use this option when generating programs that will run on
19703 real hardware; you must provide your own runtime library for whatever
19704 I/O functions are needed.
19705
19706 @item -mlra
19707 @opindex mlra
19708 Enable Local Register Allocation. This is still experimental for FT32,
19709 so by default the compiler uses standard reload.
19710
19711 @item -mnodiv
19712 @opindex mnodiv
19713 Do not use div and mod instructions.
19714
19715 @item -mft32b
19716 @opindex mft32b
19717 Enable use of the extended instructions of the FT32B processor.
19718
19719 @item -mcompress
19720 @opindex mcompress
19721 Compress all code using the Ft32B code compression scheme.
19722
19723 @item -mnopm
19724 @opindex mnopm
19725 Do not generate code that reads program memory.
19726
19727 @end table
19728
19729 @node FRV Options
19730 @subsection FRV Options
19731 @cindex FRV Options
19732
19733 @table @gcctabopt
19734 @item -mgpr-32
19735 @opindex mgpr-32
19736
19737 Only use the first 32 general-purpose registers.
19738
19739 @item -mgpr-64
19740 @opindex mgpr-64
19741
19742 Use all 64 general-purpose registers.
19743
19744 @item -mfpr-32
19745 @opindex mfpr-32
19746
19747 Use only the first 32 floating-point registers.
19748
19749 @item -mfpr-64
19750 @opindex mfpr-64
19751
19752 Use all 64 floating-point registers.
19753
19754 @item -mhard-float
19755 @opindex mhard-float
19756
19757 Use hardware instructions for floating-point operations.
19758
19759 @item -msoft-float
19760 @opindex msoft-float
19761
19762 Use library routines for floating-point operations.
19763
19764 @item -malloc-cc
19765 @opindex malloc-cc
19766
19767 Dynamically allocate condition code registers.
19768
19769 @item -mfixed-cc
19770 @opindex mfixed-cc
19771
19772 Do not try to dynamically allocate condition code registers, only
19773 use @code{icc0} and @code{fcc0}.
19774
19775 @item -mdword
19776 @opindex mdword
19777
19778 Change ABI to use double word insns.
19779
19780 @item -mno-dword
19781 @opindex mno-dword
19782 @opindex mdword
19783
19784 Do not use double word instructions.
19785
19786 @item -mdouble
19787 @opindex mdouble
19788
19789 Use floating-point double instructions.
19790
19791 @item -mno-double
19792 @opindex mno-double
19793
19794 Do not use floating-point double instructions.
19795
19796 @item -mmedia
19797 @opindex mmedia
19798
19799 Use media instructions.
19800
19801 @item -mno-media
19802 @opindex mno-media
19803
19804 Do not use media instructions.
19805
19806 @item -mmuladd
19807 @opindex mmuladd
19808
19809 Use multiply and add/subtract instructions.
19810
19811 @item -mno-muladd
19812 @opindex mno-muladd
19813
19814 Do not use multiply and add/subtract instructions.
19815
19816 @item -mfdpic
19817 @opindex mfdpic
19818
19819 Select the FDPIC ABI, which uses function descriptors to represent
19820 pointers to functions. Without any PIC/PIE-related options, it
19821 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19822 assumes GOT entries and small data are within a 12-bit range from the
19823 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19824 are computed with 32 bits.
19825 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19826
19827 @item -minline-plt
19828 @opindex minline-plt
19829
19830 Enable inlining of PLT entries in function calls to functions that are
19831 not known to bind locally. It has no effect without @option{-mfdpic}.
19832 It's enabled by default if optimizing for speed and compiling for
19833 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19834 optimization option such as @option{-O3} or above is present in the
19835 command line.
19836
19837 @item -mTLS
19838 @opindex mTLS
19839
19840 Assume a large TLS segment when generating thread-local code.
19841
19842 @item -mtls
19843 @opindex mtls
19844
19845 Do not assume a large TLS segment when generating thread-local code.
19846
19847 @item -mgprel-ro
19848 @opindex mgprel-ro
19849
19850 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19851 that is known to be in read-only sections. It's enabled by default,
19852 except for @option{-fpic} or @option{-fpie}: even though it may help
19853 make the global offset table smaller, it trades 1 instruction for 4.
19854 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19855 one of which may be shared by multiple symbols, and it avoids the need
19856 for a GOT entry for the referenced symbol, so it's more likely to be a
19857 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19858
19859 @item -multilib-library-pic
19860 @opindex multilib-library-pic
19861
19862 Link with the (library, not FD) pic libraries. It's implied by
19863 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19864 @option{-fpic} without @option{-mfdpic}. You should never have to use
19865 it explicitly.
19866
19867 @item -mlinked-fp
19868 @opindex mlinked-fp
19869
19870 Follow the EABI requirement of always creating a frame pointer whenever
19871 a stack frame is allocated. This option is enabled by default and can
19872 be disabled with @option{-mno-linked-fp}.
19873
19874 @item -mlong-calls
19875 @opindex mlong-calls
19876
19877 Use indirect addressing to call functions outside the current
19878 compilation unit. This allows the functions to be placed anywhere
19879 within the 32-bit address space.
19880
19881 @item -malign-labels
19882 @opindex malign-labels
19883
19884 Try to align labels to an 8-byte boundary by inserting NOPs into the
19885 previous packet. This option only has an effect when VLIW packing
19886 is enabled. It doesn't create new packets; it merely adds NOPs to
19887 existing ones.
19888
19889 @item -mlibrary-pic
19890 @opindex mlibrary-pic
19891
19892 Generate position-independent EABI code.
19893
19894 @item -macc-4
19895 @opindex macc-4
19896
19897 Use only the first four media accumulator registers.
19898
19899 @item -macc-8
19900 @opindex macc-8
19901
19902 Use all eight media accumulator registers.
19903
19904 @item -mpack
19905 @opindex mpack
19906
19907 Pack VLIW instructions.
19908
19909 @item -mno-pack
19910 @opindex mno-pack
19911
19912 Do not pack VLIW instructions.
19913
19914 @item -mno-eflags
19915 @opindex mno-eflags
19916
19917 Do not mark ABI switches in e_flags.
19918
19919 @item -mcond-move
19920 @opindex mcond-move
19921
19922 Enable the use of conditional-move instructions (default).
19923
19924 This switch is mainly for debugging the compiler and will likely be removed
19925 in a future version.
19926
19927 @item -mno-cond-move
19928 @opindex mno-cond-move
19929
19930 Disable the use of conditional-move instructions.
19931
19932 This switch is mainly for debugging the compiler and will likely be removed
19933 in a future version.
19934
19935 @item -mscc
19936 @opindex mscc
19937
19938 Enable the use of conditional set instructions (default).
19939
19940 This switch is mainly for debugging the compiler and will likely be removed
19941 in a future version.
19942
19943 @item -mno-scc
19944 @opindex mno-scc
19945
19946 Disable the use of conditional set instructions.
19947
19948 This switch is mainly for debugging the compiler and will likely be removed
19949 in a future version.
19950
19951 @item -mcond-exec
19952 @opindex mcond-exec
19953
19954 Enable the use of conditional execution (default).
19955
19956 This switch is mainly for debugging the compiler and will likely be removed
19957 in a future version.
19958
19959 @item -mno-cond-exec
19960 @opindex mno-cond-exec
19961
19962 Disable the use of conditional execution.
19963
19964 This switch is mainly for debugging the compiler and will likely be removed
19965 in a future version.
19966
19967 @item -mvliw-branch
19968 @opindex mvliw-branch
19969
19970 Run a pass to pack branches into VLIW instructions (default).
19971
19972 This switch is mainly for debugging the compiler and will likely be removed
19973 in a future version.
19974
19975 @item -mno-vliw-branch
19976 @opindex mno-vliw-branch
19977
19978 Do not run a pass to pack branches into VLIW instructions.
19979
19980 This switch is mainly for debugging the compiler and will likely be removed
19981 in a future version.
19982
19983 @item -mmulti-cond-exec
19984 @opindex mmulti-cond-exec
19985
19986 Enable optimization of @code{&&} and @code{||} in conditional execution
19987 (default).
19988
19989 This switch is mainly for debugging the compiler and will likely be removed
19990 in a future version.
19991
19992 @item -mno-multi-cond-exec
19993 @opindex mno-multi-cond-exec
19994
19995 Disable optimization of @code{&&} and @code{||} in conditional execution.
19996
19997 This switch is mainly for debugging the compiler and will likely be removed
19998 in a future version.
19999
20000 @item -mnested-cond-exec
20001 @opindex mnested-cond-exec
20002
20003 Enable nested conditional execution optimizations (default).
20004
20005 This switch is mainly for debugging the compiler and will likely be removed
20006 in a future version.
20007
20008 @item -mno-nested-cond-exec
20009 @opindex mno-nested-cond-exec
20010
20011 Disable nested conditional execution optimizations.
20012
20013 This switch is mainly for debugging the compiler and will likely be removed
20014 in a future version.
20015
20016 @item -moptimize-membar
20017 @opindex moptimize-membar
20018
20019 This switch removes redundant @code{membar} instructions from the
20020 compiler-generated code. It is enabled by default.
20021
20022 @item -mno-optimize-membar
20023 @opindex mno-optimize-membar
20024 @opindex moptimize-membar
20025
20026 This switch disables the automatic removal of redundant @code{membar}
20027 instructions from the generated code.
20028
20029 @item -mtomcat-stats
20030 @opindex mtomcat-stats
20031
20032 Cause gas to print out tomcat statistics.
20033
20034 @item -mcpu=@var{cpu}
20035 @opindex mcpu
20036
20037 Select the processor type for which to generate code. Possible values are
20038 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20039 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20040
20041 @end table
20042
20043 @node GNU/Linux Options
20044 @subsection GNU/Linux Options
20045
20046 These @samp{-m} options are defined for GNU/Linux targets:
20047
20048 @table @gcctabopt
20049 @item -mglibc
20050 @opindex mglibc
20051 Use the GNU C library. This is the default except
20052 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20053 @samp{*-*-linux-*android*} targets.
20054
20055 @item -muclibc
20056 @opindex muclibc
20057 Use uClibc C library. This is the default on
20058 @samp{*-*-linux-*uclibc*} targets.
20059
20060 @item -mmusl
20061 @opindex mmusl
20062 Use the musl C library. This is the default on
20063 @samp{*-*-linux-*musl*} targets.
20064
20065 @item -mbionic
20066 @opindex mbionic
20067 Use Bionic C library. This is the default on
20068 @samp{*-*-linux-*android*} targets.
20069
20070 @item -mandroid
20071 @opindex mandroid
20072 Compile code compatible with Android platform. This is the default on
20073 @samp{*-*-linux-*android*} targets.
20074
20075 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20076 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20077 this option makes the GCC driver pass Android-specific options to the linker.
20078 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20079 to be defined.
20080
20081 @item -tno-android-cc
20082 @opindex tno-android-cc
20083 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20084 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20085 @option{-fno-rtti} by default.
20086
20087 @item -tno-android-ld
20088 @opindex tno-android-ld
20089 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20090 linking options to the linker.
20091
20092 @end table
20093
20094 @node H8/300 Options
20095 @subsection H8/300 Options
20096
20097 These @samp{-m} options are defined for the H8/300 implementations:
20098
20099 @table @gcctabopt
20100 @item -mrelax
20101 @opindex mrelax
20102 Shorten some address references at link time, when possible; uses the
20103 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20104 ld, Using ld}, for a fuller description.
20105
20106 @item -mh
20107 @opindex mh
20108 Generate code for the H8/300H@.
20109
20110 @item -ms
20111 @opindex ms
20112 Generate code for the H8S@.
20113
20114 @item -mn
20115 @opindex mn
20116 Generate code for the H8S and H8/300H in the normal mode. This switch
20117 must be used either with @option{-mh} or @option{-ms}.
20118
20119 @item -ms2600
20120 @opindex ms2600
20121 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20122
20123 @item -mexr
20124 @opindex mexr
20125 Extended registers are stored on stack before execution of function
20126 with monitor attribute. Default option is @option{-mexr}.
20127 This option is valid only for H8S targets.
20128
20129 @item -mno-exr
20130 @opindex mno-exr
20131 @opindex mexr
20132 Extended registers are not stored on stack before execution of function
20133 with monitor attribute. Default option is @option{-mno-exr}.
20134 This option is valid only for H8S targets.
20135
20136 @item -mint32
20137 @opindex mint32
20138 Make @code{int} data 32 bits by default.
20139
20140 @item -malign-300
20141 @opindex malign-300
20142 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20143 The default for the H8/300H and H8S is to align longs and floats on
20144 4-byte boundaries.
20145 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20146 This option has no effect on the H8/300.
20147 @end table
20148
20149 @node HPPA Options
20150 @subsection HPPA Options
20151 @cindex HPPA Options
20152
20153 These @samp{-m} options are defined for the HPPA family of computers:
20154
20155 @table @gcctabopt
20156 @item -march=@var{architecture-type}
20157 @opindex march
20158 Generate code for the specified architecture. The choices for
20159 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20160 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20161 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20162 architecture option for your machine. Code compiled for lower numbered
20163 architectures runs on higher numbered architectures, but not the
20164 other way around.
20165
20166 @item -mpa-risc-1-0
20167 @itemx -mpa-risc-1-1
20168 @itemx -mpa-risc-2-0
20169 @opindex mpa-risc-1-0
20170 @opindex mpa-risc-1-1
20171 @opindex mpa-risc-2-0
20172 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20173
20174 @item -mcaller-copies
20175 @opindex mcaller-copies
20176 The caller copies function arguments passed by hidden reference. This
20177 option should be used with care as it is not compatible with the default
20178 32-bit runtime. However, only aggregates larger than eight bytes are
20179 passed by hidden reference and the option provides better compatibility
20180 with OpenMP.
20181
20182 @item -mjump-in-delay
20183 @opindex mjump-in-delay
20184 This option is ignored and provided for compatibility purposes only.
20185
20186 @item -mdisable-fpregs
20187 @opindex mdisable-fpregs
20188 Prevent floating-point registers from being used in any manner. This is
20189 necessary for compiling kernels that perform lazy context switching of
20190 floating-point registers. If you use this option and attempt to perform
20191 floating-point operations, the compiler aborts.
20192
20193 @item -mdisable-indexing
20194 @opindex mdisable-indexing
20195 Prevent the compiler from using indexing address modes. This avoids some
20196 rather obscure problems when compiling MIG generated code under MACH@.
20197
20198 @item -mno-space-regs
20199 @opindex mno-space-regs
20200 @opindex mspace-regs
20201 Generate code that assumes the target has no space registers. This allows
20202 GCC to generate faster indirect calls and use unscaled index address modes.
20203
20204 Such code is suitable for level 0 PA systems and kernels.
20205
20206 @item -mfast-indirect-calls
20207 @opindex mfast-indirect-calls
20208 Generate code that assumes calls never cross space boundaries. This
20209 allows GCC to emit code that performs faster indirect calls.
20210
20211 This option does not work in the presence of shared libraries or nested
20212 functions.
20213
20214 @item -mfixed-range=@var{register-range}
20215 @opindex mfixed-range
20216 Generate code treating the given register range as fixed registers.
20217 A fixed register is one that the register allocator cannot use. This is
20218 useful when compiling kernel code. A register range is specified as
20219 two registers separated by a dash. Multiple register ranges can be
20220 specified separated by a comma.
20221
20222 @item -mlong-load-store
20223 @opindex mlong-load-store
20224 Generate 3-instruction load and store sequences as sometimes required by
20225 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20226 the HP compilers.
20227
20228 @item -mportable-runtime
20229 @opindex mportable-runtime
20230 Use the portable calling conventions proposed by HP for ELF systems.
20231
20232 @item -mgas
20233 @opindex mgas
20234 Enable the use of assembler directives only GAS understands.
20235
20236 @item -mschedule=@var{cpu-type}
20237 @opindex mschedule
20238 Schedule code according to the constraints for the machine type
20239 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20240 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20241 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20242 proper scheduling option for your machine. The default scheduling is
20243 @samp{8000}.
20244
20245 @item -mlinker-opt
20246 @opindex mlinker-opt
20247 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20248 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20249 linkers in which they give bogus error messages when linking some programs.
20250
20251 @item -msoft-float
20252 @opindex msoft-float
20253 Generate output containing library calls for floating point.
20254 @strong{Warning:} the requisite libraries are not available for all HPPA
20255 targets. Normally the facilities of the machine's usual C compiler are
20256 used, but this cannot be done directly in cross-compilation. You must make
20257 your own arrangements to provide suitable library functions for
20258 cross-compilation.
20259
20260 @option{-msoft-float} changes the calling convention in the output file;
20261 therefore, it is only useful if you compile @emph{all} of a program with
20262 this option. In particular, you need to compile @file{libgcc.a}, the
20263 library that comes with GCC, with @option{-msoft-float} in order for
20264 this to work.
20265
20266 @item -msio
20267 @opindex msio
20268 Generate the predefine, @code{_SIO}, for server IO@. The default is
20269 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20270 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20271 options are available under HP-UX and HI-UX@.
20272
20273 @item -mgnu-ld
20274 @opindex mgnu-ld
20275 Use options specific to GNU @command{ld}.
20276 This passes @option{-shared} to @command{ld} when
20277 building a shared library. It is the default when GCC is configured,
20278 explicitly or implicitly, with the GNU linker. This option does not
20279 affect which @command{ld} is called; it only changes what parameters
20280 are passed to that @command{ld}.
20281 The @command{ld} that is called is determined by the
20282 @option{--with-ld} configure option, GCC's program search path, and
20283 finally by the user's @env{PATH}. The linker used by GCC can be printed
20284 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20285 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20286
20287 @item -mhp-ld
20288 @opindex mhp-ld
20289 Use options specific to HP @command{ld}.
20290 This passes @option{-b} to @command{ld} when building
20291 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20292 links. It is the default when GCC is configured, explicitly or
20293 implicitly, with the HP linker. This option does not affect
20294 which @command{ld} is called; it only changes what parameters are passed to that
20295 @command{ld}.
20296 The @command{ld} that is called is determined by the @option{--with-ld}
20297 configure option, GCC's program search path, and finally by the user's
20298 @env{PATH}. The linker used by GCC can be printed using @samp{which
20299 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20300 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20301
20302 @item -mlong-calls
20303 @opindex mno-long-calls
20304 @opindex mlong-calls
20305 Generate code that uses long call sequences. This ensures that a call
20306 is always able to reach linker generated stubs. The default is to generate
20307 long calls only when the distance from the call site to the beginning
20308 of the function or translation unit, as the case may be, exceeds a
20309 predefined limit set by the branch type being used. The limits for
20310 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20311 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20312 240,000 bytes.
20313
20314 Distances are measured from the beginning of functions when using the
20315 @option{-ffunction-sections} option, or when using the @option{-mgas}
20316 and @option{-mno-portable-runtime} options together under HP-UX with
20317 the SOM linker.
20318
20319 It is normally not desirable to use this option as it degrades
20320 performance. However, it may be useful in large applications,
20321 particularly when partial linking is used to build the application.
20322
20323 The types of long calls used depends on the capabilities of the
20324 assembler and linker, and the type of code being generated. The
20325 impact on systems that support long absolute calls, and long pic
20326 symbol-difference or pc-relative calls should be relatively small.
20327 However, an indirect call is used on 32-bit ELF systems in pic code
20328 and it is quite long.
20329
20330 @item -munix=@var{unix-std}
20331 @opindex march
20332 Generate compiler predefines and select a startfile for the specified
20333 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20334 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20335 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20336 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20337 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20338 and later.
20339
20340 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20341 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20342 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20343 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20344 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20345 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20346
20347 It is @emph{important} to note that this option changes the interfaces
20348 for various library routines. It also affects the operational behavior
20349 of the C library. Thus, @emph{extreme} care is needed in using this
20350 option.
20351
20352 Library code that is intended to operate with more than one UNIX
20353 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20354 as appropriate. Most GNU software doesn't provide this capability.
20355
20356 @item -nolibdld
20357 @opindex nolibdld
20358 Suppress the generation of link options to search libdld.sl when the
20359 @option{-static} option is specified on HP-UX 10 and later.
20360
20361 @item -static
20362 @opindex static
20363 The HP-UX implementation of setlocale in libc has a dependency on
20364 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20365 when the @option{-static} option is specified, special link options
20366 are needed to resolve this dependency.
20367
20368 On HP-UX 10 and later, the GCC driver adds the necessary options to
20369 link with libdld.sl when the @option{-static} option is specified.
20370 This causes the resulting binary to be dynamic. On the 64-bit port,
20371 the linkers generate dynamic binaries by default in any case. The
20372 @option{-nolibdld} option can be used to prevent the GCC driver from
20373 adding these link options.
20374
20375 @item -threads
20376 @opindex threads
20377 Add support for multithreading with the @dfn{dce thread} library
20378 under HP-UX@. This option sets flags for both the preprocessor and
20379 linker.
20380 @end table
20381
20382 @node IA-64 Options
20383 @subsection IA-64 Options
20384 @cindex IA-64 Options
20385
20386 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20387
20388 @table @gcctabopt
20389 @item -mbig-endian
20390 @opindex mbig-endian
20391 Generate code for a big-endian target. This is the default for HP-UX@.
20392
20393 @item -mlittle-endian
20394 @opindex mlittle-endian
20395 Generate code for a little-endian target. This is the default for AIX5
20396 and GNU/Linux.
20397
20398 @item -mgnu-as
20399 @itemx -mno-gnu-as
20400 @opindex mgnu-as
20401 @opindex mno-gnu-as
20402 Generate (or don't) code for the GNU assembler. This is the default.
20403 @c Also, this is the default if the configure option @option{--with-gnu-as}
20404 @c is used.
20405
20406 @item -mgnu-ld
20407 @itemx -mno-gnu-ld
20408 @opindex mgnu-ld
20409 @opindex mno-gnu-ld
20410 Generate (or don't) code for the GNU linker. This is the default.
20411 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20412 @c is used.
20413
20414 @item -mno-pic
20415 @opindex mno-pic
20416 Generate code that does not use a global pointer register. The result
20417 is not position independent code, and violates the IA-64 ABI@.
20418
20419 @item -mvolatile-asm-stop
20420 @itemx -mno-volatile-asm-stop
20421 @opindex mvolatile-asm-stop
20422 @opindex mno-volatile-asm-stop
20423 Generate (or don't) a stop bit immediately before and after volatile asm
20424 statements.
20425
20426 @item -mregister-names
20427 @itemx -mno-register-names
20428 @opindex mregister-names
20429 @opindex mno-register-names
20430 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20431 the stacked registers. This may make assembler output more readable.
20432
20433 @item -mno-sdata
20434 @itemx -msdata
20435 @opindex mno-sdata
20436 @opindex msdata
20437 Disable (or enable) optimizations that use the small data section. This may
20438 be useful for working around optimizer bugs.
20439
20440 @item -mconstant-gp
20441 @opindex mconstant-gp
20442 Generate code that uses a single constant global pointer value. This is
20443 useful when compiling kernel code.
20444
20445 @item -mauto-pic
20446 @opindex mauto-pic
20447 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20448 This is useful when compiling firmware code.
20449
20450 @item -minline-float-divide-min-latency
20451 @opindex minline-float-divide-min-latency
20452 Generate code for inline divides of floating-point values
20453 using the minimum latency algorithm.
20454
20455 @item -minline-float-divide-max-throughput
20456 @opindex minline-float-divide-max-throughput
20457 Generate code for inline divides of floating-point values
20458 using the maximum throughput algorithm.
20459
20460 @item -mno-inline-float-divide
20461 @opindex mno-inline-float-divide
20462 Do not generate inline code for divides of floating-point values.
20463
20464 @item -minline-int-divide-min-latency
20465 @opindex minline-int-divide-min-latency
20466 Generate code for inline divides of integer values
20467 using the minimum latency algorithm.
20468
20469 @item -minline-int-divide-max-throughput
20470 @opindex minline-int-divide-max-throughput
20471 Generate code for inline divides of integer values
20472 using the maximum throughput algorithm.
20473
20474 @item -mno-inline-int-divide
20475 @opindex mno-inline-int-divide
20476 @opindex minline-int-divide
20477 Do not generate inline code for divides of integer values.
20478
20479 @item -minline-sqrt-min-latency
20480 @opindex minline-sqrt-min-latency
20481 Generate code for inline square roots
20482 using the minimum latency algorithm.
20483
20484 @item -minline-sqrt-max-throughput
20485 @opindex minline-sqrt-max-throughput
20486 Generate code for inline square roots
20487 using the maximum throughput algorithm.
20488
20489 @item -mno-inline-sqrt
20490 @opindex mno-inline-sqrt
20491 Do not generate inline code for @code{sqrt}.
20492
20493 @item -mfused-madd
20494 @itemx -mno-fused-madd
20495 @opindex mfused-madd
20496 @opindex mno-fused-madd
20497 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20498 instructions. The default is to use these instructions.
20499
20500 @item -mno-dwarf2-asm
20501 @itemx -mdwarf2-asm
20502 @opindex mno-dwarf2-asm
20503 @opindex mdwarf2-asm
20504 Don't (or do) generate assembler code for the DWARF line number debugging
20505 info. This may be useful when not using the GNU assembler.
20506
20507 @item -mearly-stop-bits
20508 @itemx -mno-early-stop-bits
20509 @opindex mearly-stop-bits
20510 @opindex mno-early-stop-bits
20511 Allow stop bits to be placed earlier than immediately preceding the
20512 instruction that triggered the stop bit. This can improve instruction
20513 scheduling, but does not always do so.
20514
20515 @item -mfixed-range=@var{register-range}
20516 @opindex mfixed-range
20517 Generate code treating the given register range as fixed registers.
20518 A fixed register is one that the register allocator cannot use. This is
20519 useful when compiling kernel code. A register range is specified as
20520 two registers separated by a dash. Multiple register ranges can be
20521 specified separated by a comma.
20522
20523 @item -mtls-size=@var{tls-size}
20524 @opindex mtls-size
20525 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20526 64.
20527
20528 @item -mtune=@var{cpu-type}
20529 @opindex mtune
20530 Tune the instruction scheduling for a particular CPU, Valid values are
20531 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20532 and @samp{mckinley}.
20533
20534 @item -milp32
20535 @itemx -mlp64
20536 @opindex milp32
20537 @opindex mlp64
20538 Generate code for a 32-bit or 64-bit environment.
20539 The 32-bit environment sets int, long and pointer to 32 bits.
20540 The 64-bit environment sets int to 32 bits and long and pointer
20541 to 64 bits. These are HP-UX specific flags.
20542
20543 @item -mno-sched-br-data-spec
20544 @itemx -msched-br-data-spec
20545 @opindex mno-sched-br-data-spec
20546 @opindex msched-br-data-spec
20547 (Dis/En)able data speculative scheduling before reload.
20548 This results in generation of @code{ld.a} instructions and
20549 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20550 The default setting is disabled.
20551
20552 @item -msched-ar-data-spec
20553 @itemx -mno-sched-ar-data-spec
20554 @opindex msched-ar-data-spec
20555 @opindex mno-sched-ar-data-spec
20556 (En/Dis)able data speculative scheduling after reload.
20557 This results in generation of @code{ld.a} instructions and
20558 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20559 The default setting is enabled.
20560
20561 @item -mno-sched-control-spec
20562 @itemx -msched-control-spec
20563 @opindex mno-sched-control-spec
20564 @opindex msched-control-spec
20565 (Dis/En)able control speculative scheduling. This feature is
20566 available only during region scheduling (i.e.@: before reload).
20567 This results in generation of the @code{ld.s} instructions and
20568 the corresponding check instructions @code{chk.s}.
20569 The default setting is disabled.
20570
20571 @item -msched-br-in-data-spec
20572 @itemx -mno-sched-br-in-data-spec
20573 @opindex msched-br-in-data-spec
20574 @opindex mno-sched-br-in-data-spec
20575 (En/Dis)able speculative scheduling of the instructions that
20576 are dependent on the data speculative loads before reload.
20577 This is effective only with @option{-msched-br-data-spec} enabled.
20578 The default setting is enabled.
20579
20580 @item -msched-ar-in-data-spec
20581 @itemx -mno-sched-ar-in-data-spec
20582 @opindex msched-ar-in-data-spec
20583 @opindex mno-sched-ar-in-data-spec
20584 (En/Dis)able speculative scheduling of the instructions that
20585 are dependent on the data speculative loads after reload.
20586 This is effective only with @option{-msched-ar-data-spec} enabled.
20587 The default setting is enabled.
20588
20589 @item -msched-in-control-spec
20590 @itemx -mno-sched-in-control-spec
20591 @opindex msched-in-control-spec
20592 @opindex mno-sched-in-control-spec
20593 (En/Dis)able speculative scheduling of the instructions that
20594 are dependent on the control speculative loads.
20595 This is effective only with @option{-msched-control-spec} enabled.
20596 The default setting is enabled.
20597
20598 @item -mno-sched-prefer-non-data-spec-insns
20599 @itemx -msched-prefer-non-data-spec-insns
20600 @opindex mno-sched-prefer-non-data-spec-insns
20601 @opindex msched-prefer-non-data-spec-insns
20602 If enabled, data-speculative instructions are chosen for schedule
20603 only if there are no other choices at the moment. This makes
20604 the use of the data speculation much more conservative.
20605 The default setting is disabled.
20606
20607 @item -mno-sched-prefer-non-control-spec-insns
20608 @itemx -msched-prefer-non-control-spec-insns
20609 @opindex mno-sched-prefer-non-control-spec-insns
20610 @opindex msched-prefer-non-control-spec-insns
20611 If enabled, control-speculative instructions are chosen for schedule
20612 only if there are no other choices at the moment. This makes
20613 the use of the control speculation much more conservative.
20614 The default setting is disabled.
20615
20616 @item -mno-sched-count-spec-in-critical-path
20617 @itemx -msched-count-spec-in-critical-path
20618 @opindex mno-sched-count-spec-in-critical-path
20619 @opindex msched-count-spec-in-critical-path
20620 If enabled, speculative dependencies are considered during
20621 computation of the instructions priorities. This makes the use of the
20622 speculation a bit more conservative.
20623 The default setting is disabled.
20624
20625 @item -msched-spec-ldc
20626 @opindex msched-spec-ldc
20627 Use a simple data speculation check. This option is on by default.
20628
20629 @item -msched-control-spec-ldc
20630 @opindex msched-spec-ldc
20631 Use a simple check for control speculation. This option is on by default.
20632
20633 @item -msched-stop-bits-after-every-cycle
20634 @opindex msched-stop-bits-after-every-cycle
20635 Place a stop bit after every cycle when scheduling. This option is on
20636 by default.
20637
20638 @item -msched-fp-mem-deps-zero-cost
20639 @opindex msched-fp-mem-deps-zero-cost
20640 Assume that floating-point stores and loads are not likely to cause a conflict
20641 when placed into the same instruction group. This option is disabled by
20642 default.
20643
20644 @item -msel-sched-dont-check-control-spec
20645 @opindex msel-sched-dont-check-control-spec
20646 Generate checks for control speculation in selective scheduling.
20647 This flag is disabled by default.
20648
20649 @item -msched-max-memory-insns=@var{max-insns}
20650 @opindex msched-max-memory-insns
20651 Limit on the number of memory insns per instruction group, giving lower
20652 priority to subsequent memory insns attempting to schedule in the same
20653 instruction group. Frequently useful to prevent cache bank conflicts.
20654 The default value is 1.
20655
20656 @item -msched-max-memory-insns-hard-limit
20657 @opindex msched-max-memory-insns-hard-limit
20658 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20659 disallowing more than that number in an instruction group.
20660 Otherwise, the limit is ``soft'', meaning that non-memory operations
20661 are preferred when the limit is reached, but memory operations may still
20662 be scheduled.
20663
20664 @end table
20665
20666 @node LM32 Options
20667 @subsection LM32 Options
20668 @cindex LM32 options
20669
20670 These @option{-m} options are defined for the LatticeMico32 architecture:
20671
20672 @table @gcctabopt
20673 @item -mbarrel-shift-enabled
20674 @opindex mbarrel-shift-enabled
20675 Enable barrel-shift instructions.
20676
20677 @item -mdivide-enabled
20678 @opindex mdivide-enabled
20679 Enable divide and modulus instructions.
20680
20681 @item -mmultiply-enabled
20682 @opindex multiply-enabled
20683 Enable multiply instructions.
20684
20685 @item -msign-extend-enabled
20686 @opindex msign-extend-enabled
20687 Enable sign extend instructions.
20688
20689 @item -muser-enabled
20690 @opindex muser-enabled
20691 Enable user-defined instructions.
20692
20693 @end table
20694
20695 @node M32C Options
20696 @subsection M32C Options
20697 @cindex M32C options
20698
20699 @table @gcctabopt
20700 @item -mcpu=@var{name}
20701 @opindex mcpu=
20702 Select the CPU for which code is generated. @var{name} may be one of
20703 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20704 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20705 the M32C/80 series.
20706
20707 @item -msim
20708 @opindex msim
20709 Specifies that the program will be run on the simulator. This causes
20710 an alternate runtime library to be linked in which supports, for
20711 example, file I/O@. You must not use this option when generating
20712 programs that will run on real hardware; you must provide your own
20713 runtime library for whatever I/O functions are needed.
20714
20715 @item -memregs=@var{number}
20716 @opindex memregs=
20717 Specifies the number of memory-based pseudo-registers GCC uses
20718 during code generation. These pseudo-registers are used like real
20719 registers, so there is a tradeoff between GCC's ability to fit the
20720 code into available registers, and the performance penalty of using
20721 memory instead of registers. Note that all modules in a program must
20722 be compiled with the same value for this option. Because of that, you
20723 must not use this option with GCC's default runtime libraries.
20724
20725 @end table
20726
20727 @node M32R/D Options
20728 @subsection M32R/D Options
20729 @cindex M32R/D options
20730
20731 These @option{-m} options are defined for Renesas M32R/D architectures:
20732
20733 @table @gcctabopt
20734 @item -m32r2
20735 @opindex m32r2
20736 Generate code for the M32R/2@.
20737
20738 @item -m32rx
20739 @opindex m32rx
20740 Generate code for the M32R/X@.
20741
20742 @item -m32r
20743 @opindex m32r
20744 Generate code for the M32R@. This is the default.
20745
20746 @item -mmodel=small
20747 @opindex mmodel=small
20748 Assume all objects live in the lower 16MB of memory (so that their addresses
20749 can be loaded with the @code{ld24} instruction), and assume all subroutines
20750 are reachable with the @code{bl} instruction.
20751 This is the default.
20752
20753 The addressability of a particular object can be set with the
20754 @code{model} attribute.
20755
20756 @item -mmodel=medium
20757 @opindex mmodel=medium
20758 Assume objects may be anywhere in the 32-bit address space (the compiler
20759 generates @code{seth/add3} instructions to load their addresses), and
20760 assume all subroutines are reachable with the @code{bl} instruction.
20761
20762 @item -mmodel=large
20763 @opindex mmodel=large
20764 Assume objects may be anywhere in the 32-bit address space (the compiler
20765 generates @code{seth/add3} instructions to load their addresses), and
20766 assume subroutines may not be reachable with the @code{bl} instruction
20767 (the compiler generates the much slower @code{seth/add3/jl}
20768 instruction sequence).
20769
20770 @item -msdata=none
20771 @opindex msdata=none
20772 Disable use of the small data area. Variables are put into
20773 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20774 @code{section} attribute has been specified).
20775 This is the default.
20776
20777 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20778 Objects may be explicitly put in the small data area with the
20779 @code{section} attribute using one of these sections.
20780
20781 @item -msdata=sdata
20782 @opindex msdata=sdata
20783 Put small global and static data in the small data area, but do not
20784 generate special code to reference them.
20785
20786 @item -msdata=use
20787 @opindex msdata=use
20788 Put small global and static data in the small data area, and generate
20789 special instructions to reference them.
20790
20791 @item -G @var{num}
20792 @opindex G
20793 @cindex smaller data references
20794 Put global and static objects less than or equal to @var{num} bytes
20795 into the small data or BSS sections instead of the normal data or BSS
20796 sections. The default value of @var{num} is 8.
20797 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20798 for this option to have any effect.
20799
20800 All modules should be compiled with the same @option{-G @var{num}} value.
20801 Compiling with different values of @var{num} may or may not work; if it
20802 doesn't the linker gives an error message---incorrect code is not
20803 generated.
20804
20805 @item -mdebug
20806 @opindex mdebug
20807 Makes the M32R-specific code in the compiler display some statistics
20808 that might help in debugging programs.
20809
20810 @item -malign-loops
20811 @opindex malign-loops
20812 Align all loops to a 32-byte boundary.
20813
20814 @item -mno-align-loops
20815 @opindex mno-align-loops
20816 Do not enforce a 32-byte alignment for loops. This is the default.
20817
20818 @item -missue-rate=@var{number}
20819 @opindex missue-rate=@var{number}
20820 Issue @var{number} instructions per cycle. @var{number} can only be 1
20821 or 2.
20822
20823 @item -mbranch-cost=@var{number}
20824 @opindex mbranch-cost=@var{number}
20825 @var{number} can only be 1 or 2. If it is 1 then branches are
20826 preferred over conditional code, if it is 2, then the opposite applies.
20827
20828 @item -mflush-trap=@var{number}
20829 @opindex mflush-trap=@var{number}
20830 Specifies the trap number to use to flush the cache. The default is
20831 12. Valid numbers are between 0 and 15 inclusive.
20832
20833 @item -mno-flush-trap
20834 @opindex mno-flush-trap
20835 Specifies that the cache cannot be flushed by using a trap.
20836
20837 @item -mflush-func=@var{name}
20838 @opindex mflush-func=@var{name}
20839 Specifies the name of the operating system function to call to flush
20840 the cache. The default is @samp{_flush_cache}, but a function call
20841 is only used if a trap is not available.
20842
20843 @item -mno-flush-func
20844 @opindex mno-flush-func
20845 Indicates that there is no OS function for flushing the cache.
20846
20847 @end table
20848
20849 @node M680x0 Options
20850 @subsection M680x0 Options
20851 @cindex M680x0 options
20852
20853 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20854 The default settings depend on which architecture was selected when
20855 the compiler was configured; the defaults for the most common choices
20856 are given below.
20857
20858 @table @gcctabopt
20859 @item -march=@var{arch}
20860 @opindex march
20861 Generate code for a specific M680x0 or ColdFire instruction set
20862 architecture. Permissible values of @var{arch} for M680x0
20863 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20864 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20865 architectures are selected according to Freescale's ISA classification
20866 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20867 @samp{isab} and @samp{isac}.
20868
20869 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20870 code for a ColdFire target. The @var{arch} in this macro is one of the
20871 @option{-march} arguments given above.
20872
20873 When used together, @option{-march} and @option{-mtune} select code
20874 that runs on a family of similar processors but that is optimized
20875 for a particular microarchitecture.
20876
20877 @item -mcpu=@var{cpu}
20878 @opindex mcpu
20879 Generate code for a specific M680x0 or ColdFire processor.
20880 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20881 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20882 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20883 below, which also classifies the CPUs into families:
20884
20885 @multitable @columnfractions 0.20 0.80
20886 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20887 @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}
20888 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20889 @item @samp{5206e} @tab @samp{5206e}
20890 @item @samp{5208} @tab @samp{5207} @samp{5208}
20891 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20892 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20893 @item @samp{5216} @tab @samp{5214} @samp{5216}
20894 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20895 @item @samp{5225} @tab @samp{5224} @samp{5225}
20896 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20897 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20898 @item @samp{5249} @tab @samp{5249}
20899 @item @samp{5250} @tab @samp{5250}
20900 @item @samp{5271} @tab @samp{5270} @samp{5271}
20901 @item @samp{5272} @tab @samp{5272}
20902 @item @samp{5275} @tab @samp{5274} @samp{5275}
20903 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20904 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20905 @item @samp{5307} @tab @samp{5307}
20906 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20907 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20908 @item @samp{5407} @tab @samp{5407}
20909 @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}
20910 @end multitable
20911
20912 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20913 @var{arch} is compatible with @var{cpu}. Other combinations of
20914 @option{-mcpu} and @option{-march} are rejected.
20915
20916 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20917 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20918 where the value of @var{family} is given by the table above.
20919
20920 @item -mtune=@var{tune}
20921 @opindex mtune
20922 Tune the code for a particular microarchitecture within the
20923 constraints set by @option{-march} and @option{-mcpu}.
20924 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20925 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20926 and @samp{cpu32}. The ColdFire microarchitectures
20927 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20928
20929 You can also use @option{-mtune=68020-40} for code that needs
20930 to run relatively well on 68020, 68030 and 68040 targets.
20931 @option{-mtune=68020-60} is similar but includes 68060 targets
20932 as well. These two options select the same tuning decisions as
20933 @option{-m68020-40} and @option{-m68020-60} respectively.
20934
20935 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20936 when tuning for 680x0 architecture @var{arch}. It also defines
20937 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20938 option is used. If GCC is tuning for a range of architectures,
20939 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20940 it defines the macros for every architecture in the range.
20941
20942 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20943 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20944 of the arguments given above.
20945
20946 @item -m68000
20947 @itemx -mc68000
20948 @opindex m68000
20949 @opindex mc68000
20950 Generate output for a 68000. This is the default
20951 when the compiler is configured for 68000-based systems.
20952 It is equivalent to @option{-march=68000}.
20953
20954 Use this option for microcontrollers with a 68000 or EC000 core,
20955 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20956
20957 @item -m68010
20958 @opindex m68010
20959 Generate output for a 68010. This is the default
20960 when the compiler is configured for 68010-based systems.
20961 It is equivalent to @option{-march=68010}.
20962
20963 @item -m68020
20964 @itemx -mc68020
20965 @opindex m68020
20966 @opindex mc68020
20967 Generate output for a 68020. This is the default
20968 when the compiler is configured for 68020-based systems.
20969 It is equivalent to @option{-march=68020}.
20970
20971 @item -m68030
20972 @opindex m68030
20973 Generate output for a 68030. This is the default when the compiler is
20974 configured for 68030-based systems. It is equivalent to
20975 @option{-march=68030}.
20976
20977 @item -m68040
20978 @opindex m68040
20979 Generate output for a 68040. This is the default when the compiler is
20980 configured for 68040-based systems. It is equivalent to
20981 @option{-march=68040}.
20982
20983 This option inhibits the use of 68881/68882 instructions that have to be
20984 emulated by software on the 68040. Use this option if your 68040 does not
20985 have code to emulate those instructions.
20986
20987 @item -m68060
20988 @opindex m68060
20989 Generate output for a 68060. This is the default when the compiler is
20990 configured for 68060-based systems. It is equivalent to
20991 @option{-march=68060}.
20992
20993 This option inhibits the use of 68020 and 68881/68882 instructions that
20994 have to be emulated by software on the 68060. Use this option if your 68060
20995 does not have code to emulate those instructions.
20996
20997 @item -mcpu32
20998 @opindex mcpu32
20999 Generate output for a CPU32. This is the default
21000 when the compiler is configured for CPU32-based systems.
21001 It is equivalent to @option{-march=cpu32}.
21002
21003 Use this option for microcontrollers with a
21004 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21005 68336, 68340, 68341, 68349 and 68360.
21006
21007 @item -m5200
21008 @opindex m5200
21009 Generate output for a 520X ColdFire CPU@. This is the default
21010 when the compiler is configured for 520X-based systems.
21011 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21012 in favor of that option.
21013
21014 Use this option for microcontroller with a 5200 core, including
21015 the MCF5202, MCF5203, MCF5204 and MCF5206.
21016
21017 @item -m5206e
21018 @opindex m5206e
21019 Generate output for a 5206e ColdFire CPU@. The option is now
21020 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21021
21022 @item -m528x
21023 @opindex m528x
21024 Generate output for a member of the ColdFire 528X family.
21025 The option is now deprecated in favor of the equivalent
21026 @option{-mcpu=528x}.
21027
21028 @item -m5307
21029 @opindex m5307
21030 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21031 in favor of the equivalent @option{-mcpu=5307}.
21032
21033 @item -m5407
21034 @opindex m5407
21035 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21036 in favor of the equivalent @option{-mcpu=5407}.
21037
21038 @item -mcfv4e
21039 @opindex mcfv4e
21040 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21041 This includes use of hardware floating-point instructions.
21042 The option is equivalent to @option{-mcpu=547x}, and is now
21043 deprecated in favor of that option.
21044
21045 @item -m68020-40
21046 @opindex m68020-40
21047 Generate output for a 68040, without using any of the new instructions.
21048 This results in code that can run relatively efficiently on either a
21049 68020/68881 or a 68030 or a 68040. The generated code does use the
21050 68881 instructions that are emulated on the 68040.
21051
21052 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21053
21054 @item -m68020-60
21055 @opindex m68020-60
21056 Generate output for a 68060, without using any of the new instructions.
21057 This results in code that can run relatively efficiently on either a
21058 68020/68881 or a 68030 or a 68040. The generated code does use the
21059 68881 instructions that are emulated on the 68060.
21060
21061 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21062
21063 @item -mhard-float
21064 @itemx -m68881
21065 @opindex mhard-float
21066 @opindex m68881
21067 Generate floating-point instructions. This is the default for 68020
21068 and above, and for ColdFire devices that have an FPU@. It defines the
21069 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21070 on ColdFire targets.
21071
21072 @item -msoft-float
21073 @opindex msoft-float
21074 Do not generate floating-point instructions; use library calls instead.
21075 This is the default for 68000, 68010, and 68832 targets. It is also
21076 the default for ColdFire devices that have no FPU.
21077
21078 @item -mdiv
21079 @itemx -mno-div
21080 @opindex mdiv
21081 @opindex mno-div
21082 Generate (do not generate) ColdFire hardware divide and remainder
21083 instructions. If @option{-march} is used without @option{-mcpu},
21084 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21085 architectures. Otherwise, the default is taken from the target CPU
21086 (either the default CPU, or the one specified by @option{-mcpu}). For
21087 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21088 @option{-mcpu=5206e}.
21089
21090 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21091
21092 @item -mshort
21093 @opindex mshort
21094 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21095 Additionally, parameters passed on the stack are also aligned to a
21096 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21097
21098 @item -mno-short
21099 @opindex mno-short
21100 Do not consider type @code{int} to be 16 bits wide. This is the default.
21101
21102 @item -mnobitfield
21103 @itemx -mno-bitfield
21104 @opindex mnobitfield
21105 @opindex mno-bitfield
21106 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21107 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21108
21109 @item -mbitfield
21110 @opindex mbitfield
21111 Do use the bit-field instructions. The @option{-m68020} option implies
21112 @option{-mbitfield}. This is the default if you use a configuration
21113 designed for a 68020.
21114
21115 @item -mrtd
21116 @opindex mrtd
21117 Use a different function-calling convention, in which functions
21118 that take a fixed number of arguments return with the @code{rtd}
21119 instruction, which pops their arguments while returning. This
21120 saves one instruction in the caller since there is no need to pop
21121 the arguments there.
21122
21123 This calling convention is incompatible with the one normally
21124 used on Unix, so you cannot use it if you need to call libraries
21125 compiled with the Unix compiler.
21126
21127 Also, you must provide function prototypes for all functions that
21128 take variable numbers of arguments (including @code{printf});
21129 otherwise incorrect code is generated for calls to those
21130 functions.
21131
21132 In addition, seriously incorrect code results if you call a
21133 function with too many arguments. (Normally, extra arguments are
21134 harmlessly ignored.)
21135
21136 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21137 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21138
21139 The default is @option{-mno-rtd}.
21140
21141 @item -malign-int
21142 @itemx -mno-align-int
21143 @opindex malign-int
21144 @opindex mno-align-int
21145 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21146 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21147 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21148 Aligning variables on 32-bit boundaries produces code that runs somewhat
21149 faster on processors with 32-bit busses at the expense of more memory.
21150
21151 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21152 aligns structures containing the above types differently than
21153 most published application binary interface specifications for the m68k.
21154
21155 @item -mpcrel
21156 @opindex mpcrel
21157 Use the pc-relative addressing mode of the 68000 directly, instead of
21158 using a global offset table. At present, this option implies @option{-fpic},
21159 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21160 not presently supported with @option{-mpcrel}, though this could be supported for
21161 68020 and higher processors.
21162
21163 @item -mno-strict-align
21164 @itemx -mstrict-align
21165 @opindex mno-strict-align
21166 @opindex mstrict-align
21167 Do not (do) assume that unaligned memory references are handled by
21168 the system.
21169
21170 @item -msep-data
21171 Generate code that allows the data segment to be located in a different
21172 area of memory from the text segment. This allows for execute-in-place in
21173 an environment without virtual memory management. This option implies
21174 @option{-fPIC}.
21175
21176 @item -mno-sep-data
21177 Generate code that assumes that the data segment follows the text segment.
21178 This is the default.
21179
21180 @item -mid-shared-library
21181 Generate code that supports shared libraries via the library ID method.
21182 This allows for execute-in-place and shared libraries in an environment
21183 without virtual memory management. This option implies @option{-fPIC}.
21184
21185 @item -mno-id-shared-library
21186 Generate code that doesn't assume ID-based shared libraries are being used.
21187 This is the default.
21188
21189 @item -mshared-library-id=n
21190 Specifies the identification number of the ID-based shared library being
21191 compiled. Specifying a value of 0 generates more compact code; specifying
21192 other values forces the allocation of that number to the current
21193 library, but is no more space- or time-efficient than omitting this option.
21194
21195 @item -mxgot
21196 @itemx -mno-xgot
21197 @opindex mxgot
21198 @opindex mno-xgot
21199 When generating position-independent code for ColdFire, generate code
21200 that works if the GOT has more than 8192 entries. This code is
21201 larger and slower than code generated without this option. On M680x0
21202 processors, this option is not needed; @option{-fPIC} suffices.
21203
21204 GCC normally uses a single instruction to load values from the GOT@.
21205 While this is relatively efficient, it only works if the GOT
21206 is smaller than about 64k. Anything larger causes the linker
21207 to report an error such as:
21208
21209 @cindex relocation truncated to fit (ColdFire)
21210 @smallexample
21211 relocation truncated to fit: R_68K_GOT16O foobar
21212 @end smallexample
21213
21214 If this happens, you should recompile your code with @option{-mxgot}.
21215 It should then work with very large GOTs. However, code generated with
21216 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21217 the value of a global symbol.
21218
21219 Note that some linkers, including newer versions of the GNU linker,
21220 can create multiple GOTs and sort GOT entries. If you have such a linker,
21221 you should only need to use @option{-mxgot} when compiling a single
21222 object file that accesses more than 8192 GOT entries. Very few do.
21223
21224 These options have no effect unless GCC is generating
21225 position-independent code.
21226
21227 @item -mlong-jump-table-offsets
21228 @opindex mlong-jump-table-offsets
21229 Use 32-bit offsets in @code{switch} tables. The default is to use
21230 16-bit offsets.
21231
21232 @end table
21233
21234 @node MCore Options
21235 @subsection MCore Options
21236 @cindex MCore options
21237
21238 These are the @samp{-m} options defined for the Motorola M*Core
21239 processors.
21240
21241 @table @gcctabopt
21242
21243 @item -mhardlit
21244 @itemx -mno-hardlit
21245 @opindex mhardlit
21246 @opindex mno-hardlit
21247 Inline constants into the code stream if it can be done in two
21248 instructions or less.
21249
21250 @item -mdiv
21251 @itemx -mno-div
21252 @opindex mdiv
21253 @opindex mno-div
21254 Use the divide instruction. (Enabled by default).
21255
21256 @item -mrelax-immediate
21257 @itemx -mno-relax-immediate
21258 @opindex mrelax-immediate
21259 @opindex mno-relax-immediate
21260 Allow arbitrary-sized immediates in bit operations.
21261
21262 @item -mwide-bitfields
21263 @itemx -mno-wide-bitfields
21264 @opindex mwide-bitfields
21265 @opindex mno-wide-bitfields
21266 Always treat bit-fields as @code{int}-sized.
21267
21268 @item -m4byte-functions
21269 @itemx -mno-4byte-functions
21270 @opindex m4byte-functions
21271 @opindex mno-4byte-functions
21272 Force all functions to be aligned to a 4-byte boundary.
21273
21274 @item -mcallgraph-data
21275 @itemx -mno-callgraph-data
21276 @opindex mcallgraph-data
21277 @opindex mno-callgraph-data
21278 Emit callgraph information.
21279
21280 @item -mslow-bytes
21281 @itemx -mno-slow-bytes
21282 @opindex mslow-bytes
21283 @opindex mno-slow-bytes
21284 Prefer word access when reading byte quantities.
21285
21286 @item -mlittle-endian
21287 @itemx -mbig-endian
21288 @opindex mlittle-endian
21289 @opindex mbig-endian
21290 Generate code for a little-endian target.
21291
21292 @item -m210
21293 @itemx -m340
21294 @opindex m210
21295 @opindex m340
21296 Generate code for the 210 processor.
21297
21298 @item -mno-lsim
21299 @opindex mno-lsim
21300 Assume that runtime support has been provided and so omit the
21301 simulator library (@file{libsim.a)} from the linker command line.
21302
21303 @item -mstack-increment=@var{size}
21304 @opindex mstack-increment
21305 Set the maximum amount for a single stack increment operation. Large
21306 values can increase the speed of programs that contain functions
21307 that need a large amount of stack space, but they can also trigger a
21308 segmentation fault if the stack is extended too much. The default
21309 value is 0x1000.
21310
21311 @end table
21312
21313 @node MeP Options
21314 @subsection MeP Options
21315 @cindex MeP options
21316
21317 @table @gcctabopt
21318
21319 @item -mabsdiff
21320 @opindex mabsdiff
21321 Enables the @code{abs} instruction, which is the absolute difference
21322 between two registers.
21323
21324 @item -mall-opts
21325 @opindex mall-opts
21326 Enables all the optional instructions---average, multiply, divide, bit
21327 operations, leading zero, absolute difference, min/max, clip, and
21328 saturation.
21329
21330
21331 @item -maverage
21332 @opindex maverage
21333 Enables the @code{ave} instruction, which computes the average of two
21334 registers.
21335
21336 @item -mbased=@var{n}
21337 @opindex mbased=
21338 Variables of size @var{n} bytes or smaller are placed in the
21339 @code{.based} section by default. Based variables use the @code{$tp}
21340 register as a base register, and there is a 128-byte limit to the
21341 @code{.based} section.
21342
21343 @item -mbitops
21344 @opindex mbitops
21345 Enables the bit operation instructions---bit test (@code{btstm}), set
21346 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21347 test-and-set (@code{tas}).
21348
21349 @item -mc=@var{name}
21350 @opindex mc=
21351 Selects which section constant data is placed in. @var{name} may
21352 be @samp{tiny}, @samp{near}, or @samp{far}.
21353
21354 @item -mclip
21355 @opindex mclip
21356 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21357 useful unless you also provide @option{-mminmax}.
21358
21359 @item -mconfig=@var{name}
21360 @opindex mconfig=
21361 Selects one of the built-in core configurations. Each MeP chip has
21362 one or more modules in it; each module has a core CPU and a variety of
21363 coprocessors, optional instructions, and peripherals. The
21364 @code{MeP-Integrator} tool, not part of GCC, provides these
21365 configurations through this option; using this option is the same as
21366 using all the corresponding command-line options. The default
21367 configuration is @samp{default}.
21368
21369 @item -mcop
21370 @opindex mcop
21371 Enables the coprocessor instructions. By default, this is a 32-bit
21372 coprocessor. Note that the coprocessor is normally enabled via the
21373 @option{-mconfig=} option.
21374
21375 @item -mcop32
21376 @opindex mcop32
21377 Enables the 32-bit coprocessor's instructions.
21378
21379 @item -mcop64
21380 @opindex mcop64
21381 Enables the 64-bit coprocessor's instructions.
21382
21383 @item -mivc2
21384 @opindex mivc2
21385 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21386
21387 @item -mdc
21388 @opindex mdc
21389 Causes constant variables to be placed in the @code{.near} section.
21390
21391 @item -mdiv
21392 @opindex mdiv
21393 Enables the @code{div} and @code{divu} instructions.
21394
21395 @item -meb
21396 @opindex meb
21397 Generate big-endian code.
21398
21399 @item -mel
21400 @opindex mel
21401 Generate little-endian code.
21402
21403 @item -mio-volatile
21404 @opindex mio-volatile
21405 Tells the compiler that any variable marked with the @code{io}
21406 attribute is to be considered volatile.
21407
21408 @item -ml
21409 @opindex ml
21410 Causes variables to be assigned to the @code{.far} section by default.
21411
21412 @item -mleadz
21413 @opindex mleadz
21414 Enables the @code{leadz} (leading zero) instruction.
21415
21416 @item -mm
21417 @opindex mm
21418 Causes variables to be assigned to the @code{.near} section by default.
21419
21420 @item -mminmax
21421 @opindex mminmax
21422 Enables the @code{min} and @code{max} instructions.
21423
21424 @item -mmult
21425 @opindex mmult
21426 Enables the multiplication and multiply-accumulate instructions.
21427
21428 @item -mno-opts
21429 @opindex mno-opts
21430 Disables all the optional instructions enabled by @option{-mall-opts}.
21431
21432 @item -mrepeat
21433 @opindex mrepeat
21434 Enables the @code{repeat} and @code{erepeat} instructions, used for
21435 low-overhead looping.
21436
21437 @item -ms
21438 @opindex ms
21439 Causes all variables to default to the @code{.tiny} section. Note
21440 that there is a 65536-byte limit to this section. Accesses to these
21441 variables use the @code{%gp} base register.
21442
21443 @item -msatur
21444 @opindex msatur
21445 Enables the saturation instructions. Note that the compiler does not
21446 currently generate these itself, but this option is included for
21447 compatibility with other tools, like @code{as}.
21448
21449 @item -msdram
21450 @opindex msdram
21451 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21452
21453 @item -msim
21454 @opindex msim
21455 Link the simulator run-time libraries.
21456
21457 @item -msimnovec
21458 @opindex msimnovec
21459 Link the simulator runtime libraries, excluding built-in support
21460 for reset and exception vectors and tables.
21461
21462 @item -mtf
21463 @opindex mtf
21464 Causes all functions to default to the @code{.far} section. Without
21465 this option, functions default to the @code{.near} section.
21466
21467 @item -mtiny=@var{n}
21468 @opindex mtiny=
21469 Variables that are @var{n} bytes or smaller are allocated to the
21470 @code{.tiny} section. These variables use the @code{$gp} base
21471 register. The default for this option is 4, but note that there's a
21472 65536-byte limit to the @code{.tiny} section.
21473
21474 @end table
21475
21476 @node MicroBlaze Options
21477 @subsection MicroBlaze Options
21478 @cindex MicroBlaze Options
21479
21480 @table @gcctabopt
21481
21482 @item -msoft-float
21483 @opindex msoft-float
21484 Use software emulation for floating point (default).
21485
21486 @item -mhard-float
21487 @opindex mhard-float
21488 Use hardware floating-point instructions.
21489
21490 @item -mmemcpy
21491 @opindex mmemcpy
21492 Do not optimize block moves, use @code{memcpy}.
21493
21494 @item -mno-clearbss
21495 @opindex mno-clearbss
21496 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21497
21498 @item -mcpu=@var{cpu-type}
21499 @opindex mcpu=
21500 Use features of, and schedule code for, the given CPU.
21501 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21502 where @var{X} is a major version, @var{YY} is the minor version, and
21503 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21504 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21505
21506 @item -mxl-soft-mul
21507 @opindex mxl-soft-mul
21508 Use software multiply emulation (default).
21509
21510 @item -mxl-soft-div
21511 @opindex mxl-soft-div
21512 Use software emulation for divides (default).
21513
21514 @item -mxl-barrel-shift
21515 @opindex mxl-barrel-shift
21516 Use the hardware barrel shifter.
21517
21518 @item -mxl-pattern-compare
21519 @opindex mxl-pattern-compare
21520 Use pattern compare instructions.
21521
21522 @item -msmall-divides
21523 @opindex msmall-divides
21524 Use table lookup optimization for small signed integer divisions.
21525
21526 @item -mxl-stack-check
21527 @opindex mxl-stack-check
21528 This option is deprecated. Use @option{-fstack-check} instead.
21529
21530 @item -mxl-gp-opt
21531 @opindex mxl-gp-opt
21532 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21533
21534 @item -mxl-multiply-high
21535 @opindex mxl-multiply-high
21536 Use multiply high instructions for high part of 32x32 multiply.
21537
21538 @item -mxl-float-convert
21539 @opindex mxl-float-convert
21540 Use hardware floating-point conversion instructions.
21541
21542 @item -mxl-float-sqrt
21543 @opindex mxl-float-sqrt
21544 Use hardware floating-point square root instruction.
21545
21546 @item -mbig-endian
21547 @opindex mbig-endian
21548 Generate code for a big-endian target.
21549
21550 @item -mlittle-endian
21551 @opindex mlittle-endian
21552 Generate code for a little-endian target.
21553
21554 @item -mxl-reorder
21555 @opindex mxl-reorder
21556 Use reorder instructions (swap and byte reversed load/store).
21557
21558 @item -mxl-mode-@var{app-model}
21559 Select application model @var{app-model}. Valid models are
21560 @table @samp
21561 @item executable
21562 normal executable (default), uses startup code @file{crt0.o}.
21563
21564 @item -mpic-data-is-text-relative
21565 @opindex mpic-data-is-text-relative
21566 Assume that the displacement between the text and data segments is fixed
21567 at static link time. This allows data to be referenced by offset from start of
21568 text address instead of GOT since PC-relative addressing is not supported.
21569
21570 @item xmdstub
21571 for use with Xilinx Microprocessor Debugger (XMD) based
21572 software intrusive debug agent called xmdstub. This uses startup file
21573 @file{crt1.o} and sets the start address of the program to 0x800.
21574
21575 @item bootstrap
21576 for applications that are loaded using a bootloader.
21577 This model uses startup file @file{crt2.o} which does not contain a processor
21578 reset vector handler. This is suitable for transferring control on a
21579 processor reset to the bootloader rather than the application.
21580
21581 @item novectors
21582 for applications that do not require any of the
21583 MicroBlaze vectors. This option may be useful for applications running
21584 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21585 @end table
21586
21587 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21588 @option{-mxl-mode-@var{app-model}}.
21589
21590 @end table
21591
21592 @node MIPS Options
21593 @subsection MIPS Options
21594 @cindex MIPS options
21595
21596 @table @gcctabopt
21597
21598 @item -EB
21599 @opindex EB
21600 Generate big-endian code.
21601
21602 @item -EL
21603 @opindex EL
21604 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21605 configurations.
21606
21607 @item -march=@var{arch}
21608 @opindex march
21609 Generate code that runs on @var{arch}, which can be the name of a
21610 generic MIPS ISA, or the name of a particular processor.
21611 The ISA names are:
21612 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21613 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21614 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21615 @samp{mips64r5} and @samp{mips64r6}.
21616 The processor names are:
21617 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21618 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21619 @samp{5kc}, @samp{5kf},
21620 @samp{20kc},
21621 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21622 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21623 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21624 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21625 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21626 @samp{i6400}, @samp{i6500},
21627 @samp{interaptiv},
21628 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21629 @samp{gs464e}, @samp{gs264e},
21630 @samp{m4k},
21631 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21632 @samp{m5100}, @samp{m5101},
21633 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21634 @samp{orion},
21635 @samp{p5600}, @samp{p6600},
21636 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21637 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21638 @samp{r6000}, @samp{r8000},
21639 @samp{rm7000}, @samp{rm9000},
21640 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21641 @samp{sb1},
21642 @samp{sr71000},
21643 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21644 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21645 @samp{xlr} and @samp{xlp}.
21646 The special value @samp{from-abi} selects the
21647 most compatible architecture for the selected ABI (that is,
21648 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21649
21650 The native Linux/GNU toolchain also supports the value @samp{native},
21651 which selects the best architecture option for the host processor.
21652 @option{-march=native} has no effect if GCC does not recognize
21653 the processor.
21654
21655 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21656 (for example, @option{-march=r2k}). Prefixes are optional, and
21657 @samp{vr} may be written @samp{r}.
21658
21659 Names of the form @samp{@var{n}f2_1} refer to processors with
21660 FPUs clocked at half the rate of the core, names of the form
21661 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21662 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21663 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21664 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21665 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21666 accepted as synonyms for @samp{@var{n}f1_1}.
21667
21668 GCC defines two macros based on the value of this option. The first
21669 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21670 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21671 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21672 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21673 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21674
21675 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21676 above. In other words, it has the full prefix and does not
21677 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21678 the macro names the resolved architecture (either @code{"mips1"} or
21679 @code{"mips3"}). It names the default architecture when no
21680 @option{-march} option is given.
21681
21682 @item -mtune=@var{arch}
21683 @opindex mtune
21684 Optimize for @var{arch}. Among other things, this option controls
21685 the way instructions are scheduled, and the perceived cost of arithmetic
21686 operations. The list of @var{arch} values is the same as for
21687 @option{-march}.
21688
21689 When this option is not used, GCC optimizes for the processor
21690 specified by @option{-march}. By using @option{-march} and
21691 @option{-mtune} together, it is possible to generate code that
21692 runs on a family of processors, but optimize the code for one
21693 particular member of that family.
21694
21695 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21696 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21697 @option{-march} ones described above.
21698
21699 @item -mips1
21700 @opindex mips1
21701 Equivalent to @option{-march=mips1}.
21702
21703 @item -mips2
21704 @opindex mips2
21705 Equivalent to @option{-march=mips2}.
21706
21707 @item -mips3
21708 @opindex mips3
21709 Equivalent to @option{-march=mips3}.
21710
21711 @item -mips4
21712 @opindex mips4
21713 Equivalent to @option{-march=mips4}.
21714
21715 @item -mips32
21716 @opindex mips32
21717 Equivalent to @option{-march=mips32}.
21718
21719 @item -mips32r3
21720 @opindex mips32r3
21721 Equivalent to @option{-march=mips32r3}.
21722
21723 @item -mips32r5
21724 @opindex mips32r5
21725 Equivalent to @option{-march=mips32r5}.
21726
21727 @item -mips32r6
21728 @opindex mips32r6
21729 Equivalent to @option{-march=mips32r6}.
21730
21731 @item -mips64
21732 @opindex mips64
21733 Equivalent to @option{-march=mips64}.
21734
21735 @item -mips64r2
21736 @opindex mips64r2
21737 Equivalent to @option{-march=mips64r2}.
21738
21739 @item -mips64r3
21740 @opindex mips64r3
21741 Equivalent to @option{-march=mips64r3}.
21742
21743 @item -mips64r5
21744 @opindex mips64r5
21745 Equivalent to @option{-march=mips64r5}.
21746
21747 @item -mips64r6
21748 @opindex mips64r6
21749 Equivalent to @option{-march=mips64r6}.
21750
21751 @item -mips16
21752 @itemx -mno-mips16
21753 @opindex mips16
21754 @opindex mno-mips16
21755 Generate (do not generate) MIPS16 code. If GCC is targeting a
21756 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21757
21758 MIPS16 code generation can also be controlled on a per-function basis
21759 by means of @code{mips16} and @code{nomips16} attributes.
21760 @xref{Function Attributes}, for more information.
21761
21762 @item -mflip-mips16
21763 @opindex mflip-mips16
21764 Generate MIPS16 code on alternating functions. This option is provided
21765 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21766 not intended for ordinary use in compiling user code.
21767
21768 @item -minterlink-compressed
21769 @itemx -mno-interlink-compressed
21770 @opindex minterlink-compressed
21771 @opindex mno-interlink-compressed
21772 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21773 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21774
21775 For example, code using the standard ISA encoding cannot jump directly
21776 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21777 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21778 knows that the target of the jump is not compressed.
21779
21780 @item -minterlink-mips16
21781 @itemx -mno-interlink-mips16
21782 @opindex minterlink-mips16
21783 @opindex mno-interlink-mips16
21784 Aliases of @option{-minterlink-compressed} and
21785 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21786 and are retained for backwards compatibility.
21787
21788 @item -mabi=32
21789 @itemx -mabi=o64
21790 @itemx -mabi=n32
21791 @itemx -mabi=64
21792 @itemx -mabi=eabi
21793 @opindex mabi=32
21794 @opindex mabi=o64
21795 @opindex mabi=n32
21796 @opindex mabi=64
21797 @opindex mabi=eabi
21798 Generate code for the given ABI@.
21799
21800 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21801 generates 64-bit code when you select a 64-bit architecture, but you
21802 can use @option{-mgp32} to get 32-bit code instead.
21803
21804 For information about the O64 ABI, see
21805 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21806
21807 GCC supports a variant of the o32 ABI in which floating-point registers
21808 are 64 rather than 32 bits wide. You can select this combination with
21809 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21810 and @code{mfhc1} instructions and is therefore only supported for
21811 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21812
21813 The register assignments for arguments and return values remain the
21814 same, but each scalar value is passed in a single 64-bit register
21815 rather than a pair of 32-bit registers. For example, scalar
21816 floating-point values are returned in @samp{$f0} only, not a
21817 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21818 remains the same in that the even-numbered double-precision registers
21819 are saved.
21820
21821 Two additional variants of the o32 ABI are supported to enable
21822 a transition from 32-bit to 64-bit registers. These are FPXX
21823 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21824 The FPXX extension mandates that all code must execute correctly
21825 when run using 32-bit or 64-bit registers. The code can be interlinked
21826 with either FP32 or FP64, but not both.
21827 The FP64A extension is similar to the FP64 extension but forbids the
21828 use of odd-numbered single-precision registers. This can be used
21829 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21830 processors and allows both FP32 and FP64A code to interlink and
21831 run in the same process without changing FPU modes.
21832
21833 @item -mabicalls
21834 @itemx -mno-abicalls
21835 @opindex mabicalls
21836 @opindex mno-abicalls
21837 Generate (do not generate) code that is suitable for SVR4-style
21838 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21839 systems.
21840
21841 @item -mshared
21842 @itemx -mno-shared
21843 Generate (do not generate) code that is fully position-independent,
21844 and that can therefore be linked into shared libraries. This option
21845 only affects @option{-mabicalls}.
21846
21847 All @option{-mabicalls} code has traditionally been position-independent,
21848 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21849 as an extension, the GNU toolchain allows executables to use absolute
21850 accesses for locally-binding symbols. It can also use shorter GP
21851 initialization sequences and generate direct calls to locally-defined
21852 functions. This mode is selected by @option{-mno-shared}.
21853
21854 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21855 objects that can only be linked by the GNU linker. However, the option
21856 does not affect the ABI of the final executable; it only affects the ABI
21857 of relocatable objects. Using @option{-mno-shared} generally makes
21858 executables both smaller and quicker.
21859
21860 @option{-mshared} is the default.
21861
21862 @item -mplt
21863 @itemx -mno-plt
21864 @opindex mplt
21865 @opindex mno-plt
21866 Assume (do not assume) that the static and dynamic linkers
21867 support PLTs and copy relocations. This option only affects
21868 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21869 has no effect without @option{-msym32}.
21870
21871 You can make @option{-mplt} the default by configuring
21872 GCC with @option{--with-mips-plt}. The default is
21873 @option{-mno-plt} otherwise.
21874
21875 @item -mxgot
21876 @itemx -mno-xgot
21877 @opindex mxgot
21878 @opindex mno-xgot
21879 Lift (do not lift) the usual restrictions on the size of the global
21880 offset table.
21881
21882 GCC normally uses a single instruction to load values from the GOT@.
21883 While this is relatively efficient, it only works if the GOT
21884 is smaller than about 64k. Anything larger causes the linker
21885 to report an error such as:
21886
21887 @cindex relocation truncated to fit (MIPS)
21888 @smallexample
21889 relocation truncated to fit: R_MIPS_GOT16 foobar
21890 @end smallexample
21891
21892 If this happens, you should recompile your code with @option{-mxgot}.
21893 This works with very large GOTs, although the code is also
21894 less efficient, since it takes three instructions to fetch the
21895 value of a global symbol.
21896
21897 Note that some linkers can create multiple GOTs. If you have such a
21898 linker, you should only need to use @option{-mxgot} when a single object
21899 file accesses more than 64k's worth of GOT entries. Very few do.
21900
21901 These options have no effect unless GCC is generating position
21902 independent code.
21903
21904 @item -mgp32
21905 @opindex mgp32
21906 Assume that general-purpose registers are 32 bits wide.
21907
21908 @item -mgp64
21909 @opindex mgp64
21910 Assume that general-purpose registers are 64 bits wide.
21911
21912 @item -mfp32
21913 @opindex mfp32
21914 Assume that floating-point registers are 32 bits wide.
21915
21916 @item -mfp64
21917 @opindex mfp64
21918 Assume that floating-point registers are 64 bits wide.
21919
21920 @item -mfpxx
21921 @opindex mfpxx
21922 Do not assume the width of floating-point registers.
21923
21924 @item -mhard-float
21925 @opindex mhard-float
21926 Use floating-point coprocessor instructions.
21927
21928 @item -msoft-float
21929 @opindex msoft-float
21930 Do not use floating-point coprocessor instructions. Implement
21931 floating-point calculations using library calls instead.
21932
21933 @item -mno-float
21934 @opindex mno-float
21935 Equivalent to @option{-msoft-float}, but additionally asserts that the
21936 program being compiled does not perform any floating-point operations.
21937 This option is presently supported only by some bare-metal MIPS
21938 configurations, where it may select a special set of libraries
21939 that lack all floating-point support (including, for example, the
21940 floating-point @code{printf} formats).
21941 If code compiled with @option{-mno-float} accidentally contains
21942 floating-point operations, it is likely to suffer a link-time
21943 or run-time failure.
21944
21945 @item -msingle-float
21946 @opindex msingle-float
21947 Assume that the floating-point coprocessor only supports single-precision
21948 operations.
21949
21950 @item -mdouble-float
21951 @opindex mdouble-float
21952 Assume that the floating-point coprocessor supports double-precision
21953 operations. This is the default.
21954
21955 @item -modd-spreg
21956 @itemx -mno-odd-spreg
21957 @opindex modd-spreg
21958 @opindex mno-odd-spreg
21959 Enable the use of odd-numbered single-precision floating-point registers
21960 for the o32 ABI. This is the default for processors that are known to
21961 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21962 is set by default.
21963
21964 @item -mabs=2008
21965 @itemx -mabs=legacy
21966 @opindex mabs=2008
21967 @opindex mabs=legacy
21968 These options control the treatment of the special not-a-number (NaN)
21969 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21970 @code{neg.@i{fmt}} machine instructions.
21971
21972 By default or when @option{-mabs=legacy} is used the legacy
21973 treatment is selected. In this case these instructions are considered
21974 arithmetic and avoided where correct operation is required and the
21975 input operand might be a NaN. A longer sequence of instructions that
21976 manipulate the sign bit of floating-point datum manually is used
21977 instead unless the @option{-ffinite-math-only} option has also been
21978 specified.
21979
21980 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21981 this case these instructions are considered non-arithmetic and therefore
21982 operating correctly in all cases, including in particular where the
21983 input operand is a NaN. These instructions are therefore always used
21984 for the respective operations.
21985
21986 @item -mnan=2008
21987 @itemx -mnan=legacy
21988 @opindex mnan=2008
21989 @opindex mnan=legacy
21990 These options control the encoding of the special not-a-number (NaN)
21991 IEEE 754 floating-point data.
21992
21993 The @option{-mnan=legacy} option selects the legacy encoding. In this
21994 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21995 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21996 by the first bit of their trailing significand field being 1.
21997
21998 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21999 this case qNaNs are denoted by the first bit of their trailing
22000 significand field being 1, whereas sNaNs are denoted by the first bit of
22001 their trailing significand field being 0.
22002
22003 The default is @option{-mnan=legacy} unless GCC has been configured with
22004 @option{--with-nan=2008}.
22005
22006 @item -mllsc
22007 @itemx -mno-llsc
22008 @opindex mllsc
22009 @opindex mno-llsc
22010 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22011 implement atomic memory built-in functions. When neither option is
22012 specified, GCC uses the instructions if the target architecture
22013 supports them.
22014
22015 @option{-mllsc} is useful if the runtime environment can emulate the
22016 instructions and @option{-mno-llsc} can be useful when compiling for
22017 nonstandard ISAs. You can make either option the default by
22018 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22019 respectively. @option{--with-llsc} is the default for some
22020 configurations; see the installation documentation for details.
22021
22022 @item -mdsp
22023 @itemx -mno-dsp
22024 @opindex mdsp
22025 @opindex mno-dsp
22026 Use (do not use) revision 1 of the MIPS DSP ASE@.
22027 @xref{MIPS DSP Built-in Functions}. This option defines the
22028 preprocessor macro @code{__mips_dsp}. It also defines
22029 @code{__mips_dsp_rev} to 1.
22030
22031 @item -mdspr2
22032 @itemx -mno-dspr2
22033 @opindex mdspr2
22034 @opindex mno-dspr2
22035 Use (do not use) revision 2 of the MIPS DSP ASE@.
22036 @xref{MIPS DSP Built-in Functions}. This option defines the
22037 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22038 It also defines @code{__mips_dsp_rev} to 2.
22039
22040 @item -msmartmips
22041 @itemx -mno-smartmips
22042 @opindex msmartmips
22043 @opindex mno-smartmips
22044 Use (do not use) the MIPS SmartMIPS ASE.
22045
22046 @item -mpaired-single
22047 @itemx -mno-paired-single
22048 @opindex mpaired-single
22049 @opindex mno-paired-single
22050 Use (do not use) paired-single floating-point instructions.
22051 @xref{MIPS Paired-Single Support}. This option requires
22052 hardware floating-point support to be enabled.
22053
22054 @item -mdmx
22055 @itemx -mno-mdmx
22056 @opindex mdmx
22057 @opindex mno-mdmx
22058 Use (do not use) MIPS Digital Media Extension instructions.
22059 This option can only be used when generating 64-bit code and requires
22060 hardware floating-point support to be enabled.
22061
22062 @item -mips3d
22063 @itemx -mno-mips3d
22064 @opindex mips3d
22065 @opindex mno-mips3d
22066 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22067 The option @option{-mips3d} implies @option{-mpaired-single}.
22068
22069 @item -mmicromips
22070 @itemx -mno-micromips
22071 @opindex mmicromips
22072 @opindex mno-mmicromips
22073 Generate (do not generate) microMIPS code.
22074
22075 MicroMIPS code generation can also be controlled on a per-function basis
22076 by means of @code{micromips} and @code{nomicromips} attributes.
22077 @xref{Function Attributes}, for more information.
22078
22079 @item -mmt
22080 @itemx -mno-mt
22081 @opindex mmt
22082 @opindex mno-mt
22083 Use (do not use) MT Multithreading instructions.
22084
22085 @item -mmcu
22086 @itemx -mno-mcu
22087 @opindex mmcu
22088 @opindex mno-mcu
22089 Use (do not use) the MIPS MCU ASE instructions.
22090
22091 @item -meva
22092 @itemx -mno-eva
22093 @opindex meva
22094 @opindex mno-eva
22095 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22096
22097 @item -mvirt
22098 @itemx -mno-virt
22099 @opindex mvirt
22100 @opindex mno-virt
22101 Use (do not use) the MIPS Virtualization (VZ) instructions.
22102
22103 @item -mxpa
22104 @itemx -mno-xpa
22105 @opindex mxpa
22106 @opindex mno-xpa
22107 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22108
22109 @item -mcrc
22110 @itemx -mno-crc
22111 @opindex mcrc
22112 @opindex mno-crc
22113 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22114
22115 @item -mginv
22116 @itemx -mno-ginv
22117 @opindex mginv
22118 @opindex mno-ginv
22119 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22120
22121 @item -mloongson-mmi
22122 @itemx -mno-loongson-mmi
22123 @opindex mloongson-mmi
22124 @opindex mno-loongson-mmi
22125 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22126
22127 @item -mloongson-ext
22128 @itemx -mno-loongson-ext
22129 @opindex mloongson-ext
22130 @opindex mno-loongson-ext
22131 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22132
22133 @item -mloongson-ext2
22134 @itemx -mno-loongson-ext2
22135 @opindex mloongson-ext2
22136 @opindex mno-loongson-ext2
22137 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22138
22139 @item -mlong64
22140 @opindex mlong64
22141 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22142 an explanation of the default and the way that the pointer size is
22143 determined.
22144
22145 @item -mlong32
22146 @opindex mlong32
22147 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22148
22149 The default size of @code{int}s, @code{long}s and pointers depends on
22150 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22151 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22152 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22153 or the same size as integer registers, whichever is smaller.
22154
22155 @item -msym32
22156 @itemx -mno-sym32
22157 @opindex msym32
22158 @opindex mno-sym32
22159 Assume (do not assume) that all symbols have 32-bit values, regardless
22160 of the selected ABI@. This option is useful in combination with
22161 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22162 to generate shorter and faster references to symbolic addresses.
22163
22164 @item -G @var{num}
22165 @opindex G
22166 Put definitions of externally-visible data in a small data section
22167 if that data is no bigger than @var{num} bytes. GCC can then generate
22168 more efficient accesses to the data; see @option{-mgpopt} for details.
22169
22170 The default @option{-G} option depends on the configuration.
22171
22172 @item -mlocal-sdata
22173 @itemx -mno-local-sdata
22174 @opindex mlocal-sdata
22175 @opindex mno-local-sdata
22176 Extend (do not extend) the @option{-G} behavior to local data too,
22177 such as to static variables in C@. @option{-mlocal-sdata} is the
22178 default for all configurations.
22179
22180 If the linker complains that an application is using too much small data,
22181 you might want to try rebuilding the less performance-critical parts with
22182 @option{-mno-local-sdata}. You might also want to build large
22183 libraries with @option{-mno-local-sdata}, so that the libraries leave
22184 more room for the main program.
22185
22186 @item -mextern-sdata
22187 @itemx -mno-extern-sdata
22188 @opindex mextern-sdata
22189 @opindex mno-extern-sdata
22190 Assume (do not assume) that externally-defined data is in
22191 a small data section if the size of that data is within the @option{-G} limit.
22192 @option{-mextern-sdata} is the default for all configurations.
22193
22194 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22195 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22196 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22197 is placed in a small data section. If @var{Var} is defined by another
22198 module, you must either compile that module with a high-enough
22199 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22200 definition. If @var{Var} is common, you must link the application
22201 with a high-enough @option{-G} setting.
22202
22203 The easiest way of satisfying these restrictions is to compile
22204 and link every module with the same @option{-G} option. However,
22205 you may wish to build a library that supports several different
22206 small data limits. You can do this by compiling the library with
22207 the highest supported @option{-G} setting and additionally using
22208 @option{-mno-extern-sdata} to stop the library from making assumptions
22209 about externally-defined data.
22210
22211 @item -mgpopt
22212 @itemx -mno-gpopt
22213 @opindex mgpopt
22214 @opindex mno-gpopt
22215 Use (do not use) GP-relative accesses for symbols that are known to be
22216 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22217 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22218 configurations.
22219
22220 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22221 might not hold the value of @code{_gp}. For example, if the code is
22222 part of a library that might be used in a boot monitor, programs that
22223 call boot monitor routines pass an unknown value in @code{$gp}.
22224 (In such situations, the boot monitor itself is usually compiled
22225 with @option{-G0}.)
22226
22227 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22228 @option{-mno-extern-sdata}.
22229
22230 @item -membedded-data
22231 @itemx -mno-embedded-data
22232 @opindex membedded-data
22233 @opindex mno-embedded-data
22234 Allocate variables to the read-only data section first if possible, then
22235 next in the small data section if possible, otherwise in data. This gives
22236 slightly slower code than the default, but reduces the amount of RAM required
22237 when executing, and thus may be preferred for some embedded systems.
22238
22239 @item -muninit-const-in-rodata
22240 @itemx -mno-uninit-const-in-rodata
22241 @opindex muninit-const-in-rodata
22242 @opindex mno-uninit-const-in-rodata
22243 Put uninitialized @code{const} variables in the read-only data section.
22244 This option is only meaningful in conjunction with @option{-membedded-data}.
22245
22246 @item -mcode-readable=@var{setting}
22247 @opindex mcode-readable
22248 Specify whether GCC may generate code that reads from executable sections.
22249 There are three possible settings:
22250
22251 @table @gcctabopt
22252 @item -mcode-readable=yes
22253 Instructions may freely access executable sections. This is the
22254 default setting.
22255
22256 @item -mcode-readable=pcrel
22257 MIPS16 PC-relative load instructions can access executable sections,
22258 but other instructions must not do so. This option is useful on 4KSc
22259 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22260 It is also useful on processors that can be configured to have a dual
22261 instruction/data SRAM interface and that, like the M4K, automatically
22262 redirect PC-relative loads to the instruction RAM.
22263
22264 @item -mcode-readable=no
22265 Instructions must not access executable sections. This option can be
22266 useful on targets that are configured to have a dual instruction/data
22267 SRAM interface but that (unlike the M4K) do not automatically redirect
22268 PC-relative loads to the instruction RAM.
22269 @end table
22270
22271 @item -msplit-addresses
22272 @itemx -mno-split-addresses
22273 @opindex msplit-addresses
22274 @opindex mno-split-addresses
22275 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22276 relocation operators. This option has been superseded by
22277 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22278
22279 @item -mexplicit-relocs
22280 @itemx -mno-explicit-relocs
22281 @opindex mexplicit-relocs
22282 @opindex mno-explicit-relocs
22283 Use (do not use) assembler relocation operators when dealing with symbolic
22284 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22285 is to use assembler macros instead.
22286
22287 @option{-mexplicit-relocs} is the default if GCC was configured
22288 to use an assembler that supports relocation operators.
22289
22290 @item -mcheck-zero-division
22291 @itemx -mno-check-zero-division
22292 @opindex mcheck-zero-division
22293 @opindex mno-check-zero-division
22294 Trap (do not trap) on integer division by zero.
22295
22296 The default is @option{-mcheck-zero-division}.
22297
22298 @item -mdivide-traps
22299 @itemx -mdivide-breaks
22300 @opindex mdivide-traps
22301 @opindex mdivide-breaks
22302 MIPS systems check for division by zero by generating either a
22303 conditional trap or a break instruction. Using traps results in
22304 smaller code, but is only supported on MIPS II and later. Also, some
22305 versions of the Linux kernel have a bug that prevents trap from
22306 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22307 allow conditional traps on architectures that support them and
22308 @option{-mdivide-breaks} to force the use of breaks.
22309
22310 The default is usually @option{-mdivide-traps}, but this can be
22311 overridden at configure time using @option{--with-divide=breaks}.
22312 Divide-by-zero checks can be completely disabled using
22313 @option{-mno-check-zero-division}.
22314
22315 @item -mload-store-pairs
22316 @itemx -mno-load-store-pairs
22317 @opindex mload-store-pairs
22318 @opindex mno-load-store-pairs
22319 Enable (disable) an optimization that pairs consecutive load or store
22320 instructions to enable load/store bonding. This option is enabled by
22321 default but only takes effect when the selected architecture is known
22322 to support bonding.
22323
22324 @item -mmemcpy
22325 @itemx -mno-memcpy
22326 @opindex mmemcpy
22327 @opindex mno-memcpy
22328 Force (do not force) the use of @code{memcpy} for non-trivial block
22329 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22330 most constant-sized copies.
22331
22332 @item -mlong-calls
22333 @itemx -mno-long-calls
22334 @opindex mlong-calls
22335 @opindex mno-long-calls
22336 Disable (do not disable) use of the @code{jal} instruction. Calling
22337 functions using @code{jal} is more efficient but requires the caller
22338 and callee to be in the same 256 megabyte segment.
22339
22340 This option has no effect on abicalls code. The default is
22341 @option{-mno-long-calls}.
22342
22343 @item -mmad
22344 @itemx -mno-mad
22345 @opindex mmad
22346 @opindex mno-mad
22347 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22348 instructions, as provided by the R4650 ISA@.
22349
22350 @item -mimadd
22351 @itemx -mno-imadd
22352 @opindex mimadd
22353 @opindex mno-imadd
22354 Enable (disable) use of the @code{madd} and @code{msub} integer
22355 instructions. The default is @option{-mimadd} on architectures
22356 that support @code{madd} and @code{msub} except for the 74k
22357 architecture where it was found to generate slower code.
22358
22359 @item -mfused-madd
22360 @itemx -mno-fused-madd
22361 @opindex mfused-madd
22362 @opindex mno-fused-madd
22363 Enable (disable) use of the floating-point multiply-accumulate
22364 instructions, when they are available. The default is
22365 @option{-mfused-madd}.
22366
22367 On the R8000 CPU when multiply-accumulate instructions are used,
22368 the intermediate product is calculated to infinite precision
22369 and is not subject to the FCSR Flush to Zero bit. This may be
22370 undesirable in some circumstances. On other processors the result
22371 is numerically identical to the equivalent computation using
22372 separate multiply, add, subtract and negate instructions.
22373
22374 @item -nocpp
22375 @opindex nocpp
22376 Tell the MIPS assembler to not run its preprocessor over user
22377 assembler files (with a @samp{.s} suffix) when assembling them.
22378
22379 @item -mfix-24k
22380 @itemx -mno-fix-24k
22381 @opindex mfix-24k
22382 @opindex mno-fix-24k
22383 Work around the 24K E48 (lost data on stores during refill) errata.
22384 The workarounds are implemented by the assembler rather than by GCC@.
22385
22386 @item -mfix-r4000
22387 @itemx -mno-fix-r4000
22388 @opindex mfix-r4000
22389 @opindex mno-fix-r4000
22390 Work around certain R4000 CPU errata:
22391 @itemize @minus
22392 @item
22393 A double-word or a variable shift may give an incorrect result if executed
22394 immediately after starting an integer division.
22395 @item
22396 A double-word or a variable shift may give an incorrect result if executed
22397 while an integer multiplication is in progress.
22398 @item
22399 An integer division may give an incorrect result if started in a delay slot
22400 of a taken branch or a jump.
22401 @end itemize
22402
22403 @item -mfix-r4400
22404 @itemx -mno-fix-r4400
22405 @opindex mfix-r4400
22406 @opindex mno-fix-r4400
22407 Work around certain R4400 CPU errata:
22408 @itemize @minus
22409 @item
22410 A double-word or a variable shift may give an incorrect result if executed
22411 immediately after starting an integer division.
22412 @end itemize
22413
22414 @item -mfix-r10000
22415 @itemx -mno-fix-r10000
22416 @opindex mfix-r10000
22417 @opindex mno-fix-r10000
22418 Work around certain R10000 errata:
22419 @itemize @minus
22420 @item
22421 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22422 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22423 @end itemize
22424
22425 This option can only be used if the target architecture supports
22426 branch-likely instructions. @option{-mfix-r10000} is the default when
22427 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22428 otherwise.
22429
22430 @item -mfix-r5900
22431 @itemx -mno-fix-r5900
22432 @opindex mfix-r5900
22433 Do not attempt to schedule the preceding instruction into the delay slot
22434 of a branch instruction placed at the end of a short loop of six
22435 instructions or fewer and always schedule a @code{nop} instruction there
22436 instead. The short loop bug under certain conditions causes loops to
22437 execute only once or twice, due to a hardware bug in the R5900 chip. The
22438 workaround is implemented by the assembler rather than by GCC@.
22439
22440 @item -mfix-rm7000
22441 @itemx -mno-fix-rm7000
22442 @opindex mfix-rm7000
22443 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22444 workarounds are implemented by the assembler rather than by GCC@.
22445
22446 @item -mfix-vr4120
22447 @itemx -mno-fix-vr4120
22448 @opindex mfix-vr4120
22449 Work around certain VR4120 errata:
22450 @itemize @minus
22451 @item
22452 @code{dmultu} does not always produce the correct result.
22453 @item
22454 @code{div} and @code{ddiv} do not always produce the correct result if one
22455 of the operands is negative.
22456 @end itemize
22457 The workarounds for the division errata rely on special functions in
22458 @file{libgcc.a}. At present, these functions are only provided by
22459 the @code{mips64vr*-elf} configurations.
22460
22461 Other VR4120 errata require a NOP to be inserted between certain pairs of
22462 instructions. These errata are handled by the assembler, not by GCC itself.
22463
22464 @item -mfix-vr4130
22465 @opindex mfix-vr4130
22466 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22467 workarounds are implemented by the assembler rather than by GCC,
22468 although GCC avoids using @code{mflo} and @code{mfhi} if the
22469 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22470 instructions are available instead.
22471
22472 @item -mfix-sb1
22473 @itemx -mno-fix-sb1
22474 @opindex mfix-sb1
22475 Work around certain SB-1 CPU core errata.
22476 (This flag currently works around the SB-1 revision 2
22477 ``F1'' and ``F2'' floating-point errata.)
22478
22479 @item -mr10k-cache-barrier=@var{setting}
22480 @opindex mr10k-cache-barrier
22481 Specify whether GCC should insert cache barriers to avoid the
22482 side effects of speculation on R10K processors.
22483
22484 In common with many processors, the R10K tries to predict the outcome
22485 of a conditional branch and speculatively executes instructions from
22486 the ``taken'' branch. It later aborts these instructions if the
22487 predicted outcome is wrong. However, on the R10K, even aborted
22488 instructions can have side effects.
22489
22490 This problem only affects kernel stores and, depending on the system,
22491 kernel loads. As an example, a speculatively-executed store may load
22492 the target memory into cache and mark the cache line as dirty, even if
22493 the store itself is later aborted. If a DMA operation writes to the
22494 same area of memory before the ``dirty'' line is flushed, the cached
22495 data overwrites the DMA-ed data. See the R10K processor manual
22496 for a full description, including other potential problems.
22497
22498 One workaround is to insert cache barrier instructions before every memory
22499 access that might be speculatively executed and that might have side
22500 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22501 controls GCC's implementation of this workaround. It assumes that
22502 aborted accesses to any byte in the following regions does not have
22503 side effects:
22504
22505 @enumerate
22506 @item
22507 the memory occupied by the current function's stack frame;
22508
22509 @item
22510 the memory occupied by an incoming stack argument;
22511
22512 @item
22513 the memory occupied by an object with a link-time-constant address.
22514 @end enumerate
22515
22516 It is the kernel's responsibility to ensure that speculative
22517 accesses to these regions are indeed safe.
22518
22519 If the input program contains a function declaration such as:
22520
22521 @smallexample
22522 void foo (void);
22523 @end smallexample
22524
22525 then the implementation of @code{foo} must allow @code{j foo} and
22526 @code{jal foo} to be executed speculatively. GCC honors this
22527 restriction for functions it compiles itself. It expects non-GCC
22528 functions (such as hand-written assembly code) to do the same.
22529
22530 The option has three forms:
22531
22532 @table @gcctabopt
22533 @item -mr10k-cache-barrier=load-store
22534 Insert a cache barrier before a load or store that might be
22535 speculatively executed and that might have side effects even
22536 if aborted.
22537
22538 @item -mr10k-cache-barrier=store
22539 Insert a cache barrier before a store that might be speculatively
22540 executed and that might have side effects even if aborted.
22541
22542 @item -mr10k-cache-barrier=none
22543 Disable the insertion of cache barriers. This is the default setting.
22544 @end table
22545
22546 @item -mflush-func=@var{func}
22547 @itemx -mno-flush-func
22548 @opindex mflush-func
22549 Specifies the function to call to flush the I and D caches, or to not
22550 call any such function. If called, the function must take the same
22551 arguments as the common @code{_flush_func}, that is, the address of the
22552 memory range for which the cache is being flushed, the size of the
22553 memory range, and the number 3 (to flush both caches). The default
22554 depends on the target GCC was configured for, but commonly is either
22555 @code{_flush_func} or @code{__cpu_flush}.
22556
22557 @item mbranch-cost=@var{num}
22558 @opindex mbranch-cost
22559 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22560 This cost is only a heuristic and is not guaranteed to produce
22561 consistent results across releases. A zero cost redundantly selects
22562 the default, which is based on the @option{-mtune} setting.
22563
22564 @item -mbranch-likely
22565 @itemx -mno-branch-likely
22566 @opindex mbranch-likely
22567 @opindex mno-branch-likely
22568 Enable or disable use of Branch Likely instructions, regardless of the
22569 default for the selected architecture. By default, Branch Likely
22570 instructions may be generated if they are supported by the selected
22571 architecture. An exception is for the MIPS32 and MIPS64 architectures
22572 and processors that implement those architectures; for those, Branch
22573 Likely instructions are not be generated by default because the MIPS32
22574 and MIPS64 architectures specifically deprecate their use.
22575
22576 @item -mcompact-branches=never
22577 @itemx -mcompact-branches=optimal
22578 @itemx -mcompact-branches=always
22579 @opindex mcompact-branches=never
22580 @opindex mcompact-branches=optimal
22581 @opindex mcompact-branches=always
22582 These options control which form of branches will be generated. The
22583 default is @option{-mcompact-branches=optimal}.
22584
22585 The @option{-mcompact-branches=never} option ensures that compact branch
22586 instructions will never be generated.
22587
22588 The @option{-mcompact-branches=always} option ensures that a compact
22589 branch instruction will be generated if available. If a compact branch
22590 instruction is not available, a delay slot form of the branch will be
22591 used instead.
22592
22593 This option is supported from MIPS Release 6 onwards.
22594
22595 The @option{-mcompact-branches=optimal} option will cause a delay slot
22596 branch to be used if one is available in the current ISA and the delay
22597 slot is successfully filled. If the delay slot is not filled, a compact
22598 branch will be chosen if one is available.
22599
22600 @item -mfp-exceptions
22601 @itemx -mno-fp-exceptions
22602 @opindex mfp-exceptions
22603 Specifies whether FP exceptions are enabled. This affects how
22604 FP instructions are scheduled for some processors.
22605 The default is that FP exceptions are
22606 enabled.
22607
22608 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22609 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22610 FP pipe.
22611
22612 @item -mvr4130-align
22613 @itemx -mno-vr4130-align
22614 @opindex mvr4130-align
22615 The VR4130 pipeline is two-way superscalar, but can only issue two
22616 instructions together if the first one is 8-byte aligned. When this
22617 option is enabled, GCC aligns pairs of instructions that it
22618 thinks should execute in parallel.
22619
22620 This option only has an effect when optimizing for the VR4130.
22621 It normally makes code faster, but at the expense of making it bigger.
22622 It is enabled by default at optimization level @option{-O3}.
22623
22624 @item -msynci
22625 @itemx -mno-synci
22626 @opindex msynci
22627 Enable (disable) generation of @code{synci} instructions on
22628 architectures that support it. The @code{synci} instructions (if
22629 enabled) are generated when @code{__builtin___clear_cache} is
22630 compiled.
22631
22632 This option defaults to @option{-mno-synci}, but the default can be
22633 overridden by configuring GCC with @option{--with-synci}.
22634
22635 When compiling code for single processor systems, it is generally safe
22636 to use @code{synci}. However, on many multi-core (SMP) systems, it
22637 does not invalidate the instruction caches on all cores and may lead
22638 to undefined behavior.
22639
22640 @item -mrelax-pic-calls
22641 @itemx -mno-relax-pic-calls
22642 @opindex mrelax-pic-calls
22643 Try to turn PIC calls that are normally dispatched via register
22644 @code{$25} into direct calls. This is only possible if the linker can
22645 resolve the destination at link time and if the destination is within
22646 range for a direct call.
22647
22648 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22649 an assembler and a linker that support the @code{.reloc} assembly
22650 directive and @option{-mexplicit-relocs} is in effect. With
22651 @option{-mno-explicit-relocs}, this optimization can be performed by the
22652 assembler and the linker alone without help from the compiler.
22653
22654 @item -mmcount-ra-address
22655 @itemx -mno-mcount-ra-address
22656 @opindex mmcount-ra-address
22657 @opindex mno-mcount-ra-address
22658 Emit (do not emit) code that allows @code{_mcount} to modify the
22659 calling function's return address. When enabled, this option extends
22660 the usual @code{_mcount} interface with a new @var{ra-address}
22661 parameter, which has type @code{intptr_t *} and is passed in register
22662 @code{$12}. @code{_mcount} can then modify the return address by
22663 doing both of the following:
22664 @itemize
22665 @item
22666 Returning the new address in register @code{$31}.
22667 @item
22668 Storing the new address in @code{*@var{ra-address}},
22669 if @var{ra-address} is nonnull.
22670 @end itemize
22671
22672 The default is @option{-mno-mcount-ra-address}.
22673
22674 @item -mframe-header-opt
22675 @itemx -mno-frame-header-opt
22676 @opindex mframe-header-opt
22677 Enable (disable) frame header optimization in the o32 ABI. When using the
22678 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22679 function to write out register arguments. When enabled, this optimization
22680 will suppress the allocation of the frame header if it can be determined that
22681 it is unused.
22682
22683 This optimization is off by default at all optimization levels.
22684
22685 @item -mlxc1-sxc1
22686 @itemx -mno-lxc1-sxc1
22687 @opindex mlxc1-sxc1
22688 When applicable, enable (disable) the generation of @code{lwxc1},
22689 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22690
22691 @item -mmadd4
22692 @itemx -mno-madd4
22693 @opindex mmadd4
22694 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22695 @code{madd.d} and related instructions. Enabled by default.
22696
22697 @end table
22698
22699 @node MMIX Options
22700 @subsection MMIX Options
22701 @cindex MMIX Options
22702
22703 These options are defined for the MMIX:
22704
22705 @table @gcctabopt
22706 @item -mlibfuncs
22707 @itemx -mno-libfuncs
22708 @opindex mlibfuncs
22709 @opindex mno-libfuncs
22710 Specify that intrinsic library functions are being compiled, passing all
22711 values in registers, no matter the size.
22712
22713 @item -mepsilon
22714 @itemx -mno-epsilon
22715 @opindex mepsilon
22716 @opindex mno-epsilon
22717 Generate floating-point comparison instructions that compare with respect
22718 to the @code{rE} epsilon register.
22719
22720 @item -mabi=mmixware
22721 @itemx -mabi=gnu
22722 @opindex mabi=mmixware
22723 @opindex mabi=gnu
22724 Generate code that passes function parameters and return values that (in
22725 the called function) are seen as registers @code{$0} and up, as opposed to
22726 the GNU ABI which uses global registers @code{$231} and up.
22727
22728 @item -mzero-extend
22729 @itemx -mno-zero-extend
22730 @opindex mzero-extend
22731 @opindex mno-zero-extend
22732 When reading data from memory in sizes shorter than 64 bits, use (do not
22733 use) zero-extending load instructions by default, rather than
22734 sign-extending ones.
22735
22736 @item -mknuthdiv
22737 @itemx -mno-knuthdiv
22738 @opindex mknuthdiv
22739 @opindex mno-knuthdiv
22740 Make the result of a division yielding a remainder have the same sign as
22741 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22742 remainder follows the sign of the dividend. Both methods are
22743 arithmetically valid, the latter being almost exclusively used.
22744
22745 @item -mtoplevel-symbols
22746 @itemx -mno-toplevel-symbols
22747 @opindex mtoplevel-symbols
22748 @opindex mno-toplevel-symbols
22749 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22750 code can be used with the @code{PREFIX} assembly directive.
22751
22752 @item -melf
22753 @opindex melf
22754 Generate an executable in the ELF format, rather than the default
22755 @samp{mmo} format used by the @command{mmix} simulator.
22756
22757 @item -mbranch-predict
22758 @itemx -mno-branch-predict
22759 @opindex mbranch-predict
22760 @opindex mno-branch-predict
22761 Use (do not use) the probable-branch instructions, when static branch
22762 prediction indicates a probable branch.
22763
22764 @item -mbase-addresses
22765 @itemx -mno-base-addresses
22766 @opindex mbase-addresses
22767 @opindex mno-base-addresses
22768 Generate (do not generate) code that uses @emph{base addresses}. Using a
22769 base address automatically generates a request (handled by the assembler
22770 and the linker) for a constant to be set up in a global register. The
22771 register is used for one or more base address requests within the range 0
22772 to 255 from the value held in the register. The generally leads to short
22773 and fast code, but the number of different data items that can be
22774 addressed is limited. This means that a program that uses lots of static
22775 data may require @option{-mno-base-addresses}.
22776
22777 @item -msingle-exit
22778 @itemx -mno-single-exit
22779 @opindex msingle-exit
22780 @opindex mno-single-exit
22781 Force (do not force) generated code to have a single exit point in each
22782 function.
22783 @end table
22784
22785 @node MN10300 Options
22786 @subsection MN10300 Options
22787 @cindex MN10300 options
22788
22789 These @option{-m} options are defined for Matsushita MN10300 architectures:
22790
22791 @table @gcctabopt
22792 @item -mmult-bug
22793 @opindex mmult-bug
22794 Generate code to avoid bugs in the multiply instructions for the MN10300
22795 processors. This is the default.
22796
22797 @item -mno-mult-bug
22798 @opindex mno-mult-bug
22799 Do not generate code to avoid bugs in the multiply instructions for the
22800 MN10300 processors.
22801
22802 @item -mam33
22803 @opindex mam33
22804 Generate code using features specific to the AM33 processor.
22805
22806 @item -mno-am33
22807 @opindex mno-am33
22808 Do not generate code using features specific to the AM33 processor. This
22809 is the default.
22810
22811 @item -mam33-2
22812 @opindex mam33-2
22813 Generate code using features specific to the AM33/2.0 processor.
22814
22815 @item -mam34
22816 @opindex mam34
22817 Generate code using features specific to the AM34 processor.
22818
22819 @item -mtune=@var{cpu-type}
22820 @opindex mtune
22821 Use the timing characteristics of the indicated CPU type when
22822 scheduling instructions. This does not change the targeted processor
22823 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22824 @samp{am33-2} or @samp{am34}.
22825
22826 @item -mreturn-pointer-on-d0
22827 @opindex mreturn-pointer-on-d0
22828 When generating a function that returns a pointer, return the pointer
22829 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22830 only in @code{a0}, and attempts to call such functions without a prototype
22831 result in errors. Note that this option is on by default; use
22832 @option{-mno-return-pointer-on-d0} to disable it.
22833
22834 @item -mno-crt0
22835 @opindex mno-crt0
22836 Do not link in the C run-time initialization object file.
22837
22838 @item -mrelax
22839 @opindex mrelax
22840 Indicate to the linker that it should perform a relaxation optimization pass
22841 to shorten branches, calls and absolute memory addresses. This option only
22842 has an effect when used on the command line for the final link step.
22843
22844 This option makes symbolic debugging impossible.
22845
22846 @item -mliw
22847 @opindex mliw
22848 Allow the compiler to generate @emph{Long Instruction Word}
22849 instructions if the target is the @samp{AM33} or later. This is the
22850 default. This option defines the preprocessor macro @code{__LIW__}.
22851
22852 @item -mno-liw
22853 @opindex mno-liw
22854 Do not allow the compiler to generate @emph{Long Instruction Word}
22855 instructions. This option defines the preprocessor macro
22856 @code{__NO_LIW__}.
22857
22858 @item -msetlb
22859 @opindex msetlb
22860 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22861 instructions if the target is the @samp{AM33} or later. This is the
22862 default. This option defines the preprocessor macro @code{__SETLB__}.
22863
22864 @item -mno-setlb
22865 @opindex mno-setlb
22866 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22867 instructions. This option defines the preprocessor macro
22868 @code{__NO_SETLB__}.
22869
22870 @end table
22871
22872 @node Moxie Options
22873 @subsection Moxie Options
22874 @cindex Moxie Options
22875
22876 @table @gcctabopt
22877
22878 @item -meb
22879 @opindex meb
22880 Generate big-endian code. This is the default for @samp{moxie-*-*}
22881 configurations.
22882
22883 @item -mel
22884 @opindex mel
22885 Generate little-endian code.
22886
22887 @item -mmul.x
22888 @opindex mmul.x
22889 Generate mul.x and umul.x instructions. This is the default for
22890 @samp{moxiebox-*-*} configurations.
22891
22892 @item -mno-crt0
22893 @opindex mno-crt0
22894 Do not link in the C run-time initialization object file.
22895
22896 @end table
22897
22898 @node MSP430 Options
22899 @subsection MSP430 Options
22900 @cindex MSP430 Options
22901
22902 These options are defined for the MSP430:
22903
22904 @table @gcctabopt
22905
22906 @item -masm-hex
22907 @opindex masm-hex
22908 Force assembly output to always use hex constants. Normally such
22909 constants are signed decimals, but this option is available for
22910 testsuite and/or aesthetic purposes.
22911
22912 @item -mmcu=
22913 @opindex mmcu=
22914 Select the MCU to target. This is used to create a C preprocessor
22915 symbol based upon the MCU name, converted to upper case and pre- and
22916 post-fixed with @samp{__}. This in turn is used by the
22917 @file{msp430.h} header file to select an MCU-specific supplementary
22918 header file.
22919
22920 The option also sets the ISA to use. If the MCU name is one that is
22921 known to only support the 430 ISA then that is selected, otherwise the
22922 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22923 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22924 name selects the 430X ISA.
22925
22926 In addition an MCU-specific linker script is added to the linker
22927 command line. The script's name is the name of the MCU with
22928 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22929 command line defines the C preprocessor symbol @code{__XXX__} and
22930 cause the linker to search for a script called @file{xxx.ld}.
22931
22932 This option is also passed on to the assembler.
22933
22934 @item -mwarn-mcu
22935 @itemx -mno-warn-mcu
22936 @opindex mwarn-mcu
22937 @opindex mno-warn-mcu
22938 This option enables or disables warnings about conflicts between the
22939 MCU name specified by the @option{-mmcu} option and the ISA set by the
22940 @option{-mcpu} option and/or the hardware multiply support set by the
22941 @option{-mhwmult} option. It also toggles warnings about unrecognized
22942 MCU names. This option is on by default.
22943
22944 @item -mcpu=
22945 @opindex mcpu=
22946 Specifies the ISA to use. Accepted values are @samp{msp430},
22947 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22948 @option{-mmcu=} option should be used to select the ISA.
22949
22950 @item -msim
22951 @opindex msim
22952 Link to the simulator runtime libraries and linker script. Overrides
22953 any scripts that would be selected by the @option{-mmcu=} option.
22954
22955 @item -mlarge
22956 @opindex mlarge
22957 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22958
22959 @item -msmall
22960 @opindex msmall
22961 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22962
22963 @item -mrelax
22964 @opindex mrelax
22965 This option is passed to the assembler and linker, and allows the
22966 linker to perform certain optimizations that cannot be done until
22967 the final link.
22968
22969 @item mhwmult=
22970 @opindex mhwmult=
22971 Describes the type of hardware multiply supported by the target.
22972 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22973 for the original 16-bit-only multiply supported by early MCUs.
22974 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22975 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22976 A value of @samp{auto} can also be given. This tells GCC to deduce
22977 the hardware multiply support based upon the MCU name provided by the
22978 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22979 the MCU name is not recognized then no hardware multiply support is
22980 assumed. @code{auto} is the default setting.
22981
22982 Hardware multiplies are normally performed by calling a library
22983 routine. This saves space in the generated code. When compiling at
22984 @option{-O3} or higher however the hardware multiplier is invoked
22985 inline. This makes for bigger, but faster code.
22986
22987 The hardware multiply routines disable interrupts whilst running and
22988 restore the previous interrupt state when they finish. This makes
22989 them safe to use inside interrupt handlers as well as in normal code.
22990
22991 @item -minrt
22992 @opindex minrt
22993 Enable the use of a minimum runtime environment - no static
22994 initializers or constructors. This is intended for memory-constrained
22995 devices. The compiler includes special symbols in some objects
22996 that tell the linker and runtime which code fragments are required.
22997
22998 @item -mcode-region=
22999 @itemx -mdata-region=
23000 @opindex mcode-region
23001 @opindex mdata-region
23002 These options tell the compiler where to place functions and data that
23003 do not have one of the @code{lower}, @code{upper}, @code{either} or
23004 @code{section} attributes. Possible values are @code{lower},
23005 @code{upper}, @code{either} or @code{any}. The first three behave
23006 like the corresponding attribute. The fourth possible value -
23007 @code{any} - is the default. It leaves placement entirely up to the
23008 linker script and how it assigns the standard sections
23009 (@code{.text}, @code{.data}, etc) to the memory regions.
23010
23011 @item -msilicon-errata=
23012 @opindex msilicon-errata
23013 This option passes on a request to assembler to enable the fixes for
23014 the named silicon errata.
23015
23016 @item -msilicon-errata-warn=
23017 @opindex msilicon-errata-warn
23018 This option passes on a request to the assembler to enable warning
23019 messages when a silicon errata might need to be applied.
23020
23021 @end table
23022
23023 @node NDS32 Options
23024 @subsection NDS32 Options
23025 @cindex NDS32 Options
23026
23027 These options are defined for NDS32 implementations:
23028
23029 @table @gcctabopt
23030
23031 @item -mbig-endian
23032 @opindex mbig-endian
23033 Generate code in big-endian mode.
23034
23035 @item -mlittle-endian
23036 @opindex mlittle-endian
23037 Generate code in little-endian mode.
23038
23039 @item -mreduced-regs
23040 @opindex mreduced-regs
23041 Use reduced-set registers for register allocation.
23042
23043 @item -mfull-regs
23044 @opindex mfull-regs
23045 Use full-set registers for register allocation.
23046
23047 @item -mcmov
23048 @opindex mcmov
23049 Generate conditional move instructions.
23050
23051 @item -mno-cmov
23052 @opindex mno-cmov
23053 Do not generate conditional move instructions.
23054
23055 @item -mext-perf
23056 @opindex mext-perf
23057 Generate performance extension instructions.
23058
23059 @item -mno-ext-perf
23060 @opindex mno-ext-perf
23061 Do not generate performance extension instructions.
23062
23063 @item -mext-perf2
23064 @opindex mext-perf2
23065 Generate performance extension 2 instructions.
23066
23067 @item -mno-ext-perf2
23068 @opindex mno-ext-perf2
23069 Do not generate performance extension 2 instructions.
23070
23071 @item -mext-string
23072 @opindex mext-string
23073 Generate string extension instructions.
23074
23075 @item -mno-ext-string
23076 @opindex mno-ext-string
23077 Do not generate string extension instructions.
23078
23079 @item -mv3push
23080 @opindex mv3push
23081 Generate v3 push25/pop25 instructions.
23082
23083 @item -mno-v3push
23084 @opindex mno-v3push
23085 Do not generate v3 push25/pop25 instructions.
23086
23087 @item -m16-bit
23088 @opindex m16-bit
23089 Generate 16-bit instructions.
23090
23091 @item -mno-16-bit
23092 @opindex mno-16-bit
23093 Do not generate 16-bit instructions.
23094
23095 @item -misr-vector-size=@var{num}
23096 @opindex misr-vector-size
23097 Specify the size of each interrupt vector, which must be 4 or 16.
23098
23099 @item -mcache-block-size=@var{num}
23100 @opindex mcache-block-size
23101 Specify the size of each cache block,
23102 which must be a power of 2 between 4 and 512.
23103
23104 @item -march=@var{arch}
23105 @opindex march
23106 Specify the name of the target architecture.
23107
23108 @item -mcmodel=@var{code-model}
23109 @opindex mcmodel
23110 Set the code model to one of
23111 @table @asis
23112 @item @samp{small}
23113 All the data and read-only data segments must be within 512KB addressing space.
23114 The text segment must be within 16MB addressing space.
23115 @item @samp{medium}
23116 The data segment must be within 512KB while the read-only data segment can be
23117 within 4GB addressing space. The text segment should be still within 16MB
23118 addressing space.
23119 @item @samp{large}
23120 All the text and data segments can be within 4GB addressing space.
23121 @end table
23122
23123 @item -mctor-dtor
23124 @opindex mctor-dtor
23125 Enable constructor/destructor feature.
23126
23127 @item -mrelax
23128 @opindex mrelax
23129 Guide linker to relax instructions.
23130
23131 @end table
23132
23133 @node Nios II Options
23134 @subsection Nios II Options
23135 @cindex Nios II options
23136 @cindex Altera Nios II options
23137
23138 These are the options defined for the Altera Nios II processor.
23139
23140 @table @gcctabopt
23141
23142 @item -G @var{num}
23143 @opindex G
23144 @cindex smaller data references
23145 Put global and static objects less than or equal to @var{num} bytes
23146 into the small data or BSS sections instead of the normal data or BSS
23147 sections. The default value of @var{num} is 8.
23148
23149 @item -mgpopt=@var{option}
23150 @itemx -mgpopt
23151 @itemx -mno-gpopt
23152 @opindex mgpopt
23153 @opindex mno-gpopt
23154 Generate (do not generate) GP-relative accesses. The following
23155 @var{option} names are recognized:
23156
23157 @table @samp
23158
23159 @item none
23160 Do not generate GP-relative accesses.
23161
23162 @item local
23163 Generate GP-relative accesses for small data objects that are not
23164 external, weak, or uninitialized common symbols.
23165 Also use GP-relative addressing for objects that
23166 have been explicitly placed in a small data section via a @code{section}
23167 attribute.
23168
23169 @item global
23170 As for @samp{local}, but also generate GP-relative accesses for
23171 small data objects that are external, weak, or common. If you use this option,
23172 you must ensure that all parts of your program (including libraries) are
23173 compiled with the same @option{-G} setting.
23174
23175 @item data
23176 Generate GP-relative accesses for all data objects in the program. If you
23177 use this option, the entire data and BSS segments
23178 of your program must fit in 64K of memory and you must use an appropriate
23179 linker script to allocate them within the addressable range of the
23180 global pointer.
23181
23182 @item all
23183 Generate GP-relative addresses for function pointers as well as data
23184 pointers. If you use this option, the entire text, data, and BSS segments
23185 of your program must fit in 64K of memory and you must use an appropriate
23186 linker script to allocate them within the addressable range of the
23187 global pointer.
23188
23189 @end table
23190
23191 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23192 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23193
23194 The default is @option{-mgpopt} except when @option{-fpic} or
23195 @option{-fPIC} is specified to generate position-independent code.
23196 Note that the Nios II ABI does not permit GP-relative accesses from
23197 shared libraries.
23198
23199 You may need to specify @option{-mno-gpopt} explicitly when building
23200 programs that include large amounts of small data, including large
23201 GOT data sections. In this case, the 16-bit offset for GP-relative
23202 addressing may not be large enough to allow access to the entire
23203 small data section.
23204
23205 @item -mgprel-sec=@var{regexp}
23206 @opindex mgprel-sec
23207 This option specifies additional section names that can be accessed via
23208 GP-relative addressing. It is most useful in conjunction with
23209 @code{section} attributes on variable declarations
23210 (@pxref{Common Variable Attributes}) and a custom linker script.
23211 The @var{regexp} is a POSIX Extended Regular Expression.
23212
23213 This option does not affect the behavior of the @option{-G} option, and
23214 the specified sections are in addition to the standard @code{.sdata}
23215 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23216
23217 @item -mr0rel-sec=@var{regexp}
23218 @opindex mr0rel-sec
23219 This option specifies names of sections that can be accessed via a
23220 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23221 of the 32-bit address space. It is most useful in conjunction with
23222 @code{section} attributes on variable declarations
23223 (@pxref{Common Variable Attributes}) and a custom linker script.
23224 The @var{regexp} is a POSIX Extended Regular Expression.
23225
23226 In contrast to the use of GP-relative addressing for small data,
23227 zero-based addressing is never generated by default and there are no
23228 conventional section names used in standard linker scripts for sections
23229 in the low or high areas of memory.
23230
23231 @item -mel
23232 @itemx -meb
23233 @opindex mel
23234 @opindex meb
23235 Generate little-endian (default) or big-endian (experimental) code,
23236 respectively.
23237
23238 @item -march=@var{arch}
23239 @opindex march
23240 This specifies the name of the target Nios II architecture. GCC uses this
23241 name to determine what kind of instructions it can emit when generating
23242 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23243
23244 The preprocessor macro @code{__nios2_arch__} is available to programs,
23245 with value 1 or 2, indicating the targeted ISA level.
23246
23247 @item -mbypass-cache
23248 @itemx -mno-bypass-cache
23249 @opindex mno-bypass-cache
23250 @opindex mbypass-cache
23251 Force all load and store instructions to always bypass cache by
23252 using I/O variants of the instructions. The default is not to
23253 bypass the cache.
23254
23255 @item -mno-cache-volatile
23256 @itemx -mcache-volatile
23257 @opindex mcache-volatile
23258 @opindex mno-cache-volatile
23259 Volatile memory access bypass the cache using the I/O variants of
23260 the load and store instructions. The default is not to bypass the cache.
23261
23262 @item -mno-fast-sw-div
23263 @itemx -mfast-sw-div
23264 @opindex mno-fast-sw-div
23265 @opindex mfast-sw-div
23266 Do not use table-based fast divide for small numbers. The default
23267 is to use the fast divide at @option{-O3} and above.
23268
23269 @item -mno-hw-mul
23270 @itemx -mhw-mul
23271 @itemx -mno-hw-mulx
23272 @itemx -mhw-mulx
23273 @itemx -mno-hw-div
23274 @itemx -mhw-div
23275 @opindex mno-hw-mul
23276 @opindex mhw-mul
23277 @opindex mno-hw-mulx
23278 @opindex mhw-mulx
23279 @opindex mno-hw-div
23280 @opindex mhw-div
23281 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23282 instructions by the compiler. The default is to emit @code{mul}
23283 and not emit @code{div} and @code{mulx}.
23284
23285 @item -mbmx
23286 @itemx -mno-bmx
23287 @itemx -mcdx
23288 @itemx -mno-cdx
23289 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23290 CDX (code density) instructions. Enabling these instructions also
23291 requires @option{-march=r2}. Since these instructions are optional
23292 extensions to the R2 architecture, the default is not to emit them.
23293
23294 @item -mcustom-@var{insn}=@var{N}
23295 @itemx -mno-custom-@var{insn}
23296 @opindex mcustom-@var{insn}
23297 @opindex mno-custom-@var{insn}
23298 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23299 custom instruction with encoding @var{N} when generating code that uses
23300 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23301 instruction 253 for single-precision floating-point add operations instead
23302 of the default behavior of using a library call.
23303
23304 The following values of @var{insn} are supported. Except as otherwise
23305 noted, floating-point operations are expected to be implemented with
23306 normal IEEE 754 semantics and correspond directly to the C operators or the
23307 equivalent GCC built-in functions (@pxref{Other Builtins}).
23308
23309 Single-precision floating point:
23310 @table @asis
23311
23312 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23313 Binary arithmetic operations.
23314
23315 @item @samp{fnegs}
23316 Unary negation.
23317
23318 @item @samp{fabss}
23319 Unary absolute value.
23320
23321 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23322 Comparison operations.
23323
23324 @item @samp{fmins}, @samp{fmaxs}
23325 Floating-point minimum and maximum. These instructions are only
23326 generated if @option{-ffinite-math-only} is specified.
23327
23328 @item @samp{fsqrts}
23329 Unary square root operation.
23330
23331 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23332 Floating-point trigonometric and exponential functions. These instructions
23333 are only generated if @option{-funsafe-math-optimizations} is also specified.
23334
23335 @end table
23336
23337 Double-precision floating point:
23338 @table @asis
23339
23340 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23341 Binary arithmetic operations.
23342
23343 @item @samp{fnegd}
23344 Unary negation.
23345
23346 @item @samp{fabsd}
23347 Unary absolute value.
23348
23349 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23350 Comparison operations.
23351
23352 @item @samp{fmind}, @samp{fmaxd}
23353 Double-precision minimum and maximum. These instructions are only
23354 generated if @option{-ffinite-math-only} is specified.
23355
23356 @item @samp{fsqrtd}
23357 Unary square root operation.
23358
23359 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23360 Double-precision trigonometric and exponential functions. These instructions
23361 are only generated if @option{-funsafe-math-optimizations} is also specified.
23362
23363 @end table
23364
23365 Conversions:
23366 @table @asis
23367 @item @samp{fextsd}
23368 Conversion from single precision to double precision.
23369
23370 @item @samp{ftruncds}
23371 Conversion from double precision to single precision.
23372
23373 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23374 Conversion from floating point to signed or unsigned integer types, with
23375 truncation towards zero.
23376
23377 @item @samp{round}
23378 Conversion from single-precision floating point to signed integer,
23379 rounding to the nearest integer and ties away from zero.
23380 This corresponds to the @code{__builtin_lroundf} function when
23381 @option{-fno-math-errno} is used.
23382
23383 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23384 Conversion from signed or unsigned integer types to floating-point types.
23385
23386 @end table
23387
23388 In addition, all of the following transfer instructions for internal
23389 registers X and Y must be provided to use any of the double-precision
23390 floating-point instructions. Custom instructions taking two
23391 double-precision source operands expect the first operand in the
23392 64-bit register X. The other operand (or only operand of a unary
23393 operation) is given to the custom arithmetic instruction with the
23394 least significant half in source register @var{src1} and the most
23395 significant half in @var{src2}. A custom instruction that returns a
23396 double-precision result returns the most significant 32 bits in the
23397 destination register and the other half in 32-bit register Y.
23398 GCC automatically generates the necessary code sequences to write
23399 register X and/or read register Y when double-precision floating-point
23400 instructions are used.
23401
23402 @table @asis
23403
23404 @item @samp{fwrx}
23405 Write @var{src1} into the least significant half of X and @var{src2} into
23406 the most significant half of X.
23407
23408 @item @samp{fwry}
23409 Write @var{src1} into Y.
23410
23411 @item @samp{frdxhi}, @samp{frdxlo}
23412 Read the most or least (respectively) significant half of X and store it in
23413 @var{dest}.
23414
23415 @item @samp{frdy}
23416 Read the value of Y and store it into @var{dest}.
23417 @end table
23418
23419 Note that you can gain more local control over generation of Nios II custom
23420 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23421 and @code{target("no-custom-@var{insn}")} function attributes
23422 (@pxref{Function Attributes})
23423 or pragmas (@pxref{Function Specific Option Pragmas}).
23424
23425 @item -mcustom-fpu-cfg=@var{name}
23426 @opindex mcustom-fpu-cfg
23427
23428 This option enables a predefined, named set of custom instruction encodings
23429 (see @option{-mcustom-@var{insn}} above).
23430 Currently, the following sets are defined:
23431
23432 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23433 @gccoptlist{-mcustom-fmuls=252 @gol
23434 -mcustom-fadds=253 @gol
23435 -mcustom-fsubs=254 @gol
23436 -fsingle-precision-constant}
23437
23438 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23439 @gccoptlist{-mcustom-fmuls=252 @gol
23440 -mcustom-fadds=253 @gol
23441 -mcustom-fsubs=254 @gol
23442 -mcustom-fdivs=255 @gol
23443 -fsingle-precision-constant}
23444
23445 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23446 @gccoptlist{-mcustom-floatus=243 @gol
23447 -mcustom-fixsi=244 @gol
23448 -mcustom-floatis=245 @gol
23449 -mcustom-fcmpgts=246 @gol
23450 -mcustom-fcmples=249 @gol
23451 -mcustom-fcmpeqs=250 @gol
23452 -mcustom-fcmpnes=251 @gol
23453 -mcustom-fmuls=252 @gol
23454 -mcustom-fadds=253 @gol
23455 -mcustom-fsubs=254 @gol
23456 -mcustom-fdivs=255 @gol
23457 -fsingle-precision-constant}
23458
23459 Custom instruction assignments given by individual
23460 @option{-mcustom-@var{insn}=} options override those given by
23461 @option{-mcustom-fpu-cfg=}, regardless of the
23462 order of the options on the command line.
23463
23464 Note that you can gain more local control over selection of a FPU
23465 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23466 function attribute (@pxref{Function Attributes})
23467 or pragma (@pxref{Function Specific Option Pragmas}).
23468
23469 @end table
23470
23471 These additional @samp{-m} options are available for the Altera Nios II
23472 ELF (bare-metal) target:
23473
23474 @table @gcctabopt
23475
23476 @item -mhal
23477 @opindex mhal
23478 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23479 startup and termination code, and is typically used in conjunction with
23480 @option{-msys-crt0=} to specify the location of the alternate startup code
23481 provided by the HAL BSP.
23482
23483 @item -msmallc
23484 @opindex msmallc
23485 Link with a limited version of the C library, @option{-lsmallc}, rather than
23486 Newlib.
23487
23488 @item -msys-crt0=@var{startfile}
23489 @opindex msys-crt0
23490 @var{startfile} is the file name of the startfile (crt0) to use
23491 when linking. This option is only useful in conjunction with @option{-mhal}.
23492
23493 @item -msys-lib=@var{systemlib}
23494 @opindex msys-lib
23495 @var{systemlib} is the library name of the library that provides
23496 low-level system calls required by the C library,
23497 e.g.@: @code{read} and @code{write}.
23498 This option is typically used to link with a library provided by a HAL BSP.
23499
23500 @end table
23501
23502 @node Nvidia PTX Options
23503 @subsection Nvidia PTX Options
23504 @cindex Nvidia PTX options
23505 @cindex nvptx options
23506
23507 These options are defined for Nvidia PTX:
23508
23509 @table @gcctabopt
23510
23511 @item -m32
23512 @itemx -m64
23513 @opindex m32
23514 @opindex m64
23515 Generate code for 32-bit or 64-bit ABI.
23516
23517 @item -misa=@var{ISA-string}
23518 @opindex march
23519 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23520 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23521 @samp{sm_35}. The default ISA is sm_30.
23522
23523 @item -mmainkernel
23524 @opindex mmainkernel
23525 Link in code for a __main kernel. This is for stand-alone instead of
23526 offloading execution.
23527
23528 @item -moptimize
23529 @opindex moptimize
23530 Apply partitioned execution optimizations. This is the default when any
23531 level of optimization is selected.
23532
23533 @item -msoft-stack
23534 @opindex msoft-stack
23535 Generate code that does not use @code{.local} memory
23536 directly for stack storage. Instead, a per-warp stack pointer is
23537 maintained explicitly. This enables variable-length stack allocation (with
23538 variable-length arrays or @code{alloca}), and when global memory is used for
23539 underlying storage, makes it possible to access automatic variables from other
23540 threads, or with atomic instructions. This code generation variant is used
23541 for OpenMP offloading, but the option is exposed on its own for the purpose
23542 of testing the compiler; to generate code suitable for linking into programs
23543 using OpenMP offloading, use option @option{-mgomp}.
23544
23545 @item -muniform-simt
23546 @opindex muniform-simt
23547 Switch to code generation variant that allows to execute all threads in each
23548 warp, while maintaining memory state and side effects as if only one thread
23549 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23550 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23551 current lane index equals the master lane index), and the register being
23552 assigned is copied via a shuffle instruction from the master lane. Outside of
23553 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23554 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23555 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23556 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23557 with current lane index to compute the master lane index.
23558
23559 @item -mgomp
23560 @opindex mgomp
23561 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23562 @option{-muniform-simt} options, and selects corresponding multilib variant.
23563
23564 @end table
23565
23566 @node OpenRISC Options
23567 @subsection OpenRISC Options
23568 @cindex OpenRISC Options
23569
23570 These options are defined for OpenRISC:
23571
23572 @table @gcctabopt
23573
23574 @item -mboard=@var{name}
23575 @opindex mboard
23576 Configure a board specific runtime. This will be passed to the linker for
23577 newlib board library linking. The default is @code{or1ksim}.
23578
23579 @item -mnewlib
23580 @opindex mnewlib
23581 For compatibility, it's always newlib for elf now.
23582
23583 @item -mhard-div
23584 @opindex mhard-div
23585 Generate code for hardware which supports divide instructions. This is the
23586 default.
23587
23588 @item -mhard-mul
23589 @opindex mhard-mul
23590 Generate code for hardware which supports multiply instructions. This is the
23591 default.
23592
23593 @item -mcmov
23594 @opindex mcmov
23595 Generate code for hardware which supports the conditional move (@code{l.cmov})
23596 instruction.
23597
23598 @item -mror
23599 @opindex mror
23600 Generate code for hardware which supports rotate right instructions.
23601
23602 @item -msext
23603 @opindex msext
23604 Generate code for hardware which supports sign-extension instructions.
23605
23606 @item -msfimm
23607 @opindex msfimm
23608 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23609 instructions.
23610
23611 @item -mshftimm
23612 @opindex mshftimm
23613 Generate code for hardware which supports shift immediate related instructions
23614 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23615 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23616 also be specified.
23617
23618 @item -msoft-div
23619 @opindex msoft-div
23620 Generate code for hardware which requires divide instruction emulation.
23621
23622 @item -msoft-mul
23623 @opindex msoft-mul
23624 Generate code for hardware which requires multiply instruction emulation.
23625
23626 @end table
23627
23628 @node PDP-11 Options
23629 @subsection PDP-11 Options
23630 @cindex PDP-11 Options
23631
23632 These options are defined for the PDP-11:
23633
23634 @table @gcctabopt
23635 @item -mfpu
23636 @opindex mfpu
23637 Use hardware FPP floating point. This is the default. (FIS floating
23638 point on the PDP-11/40 is not supported.) Implies -m45.
23639
23640 @item -msoft-float
23641 @opindex msoft-float
23642 Do not use hardware floating point.
23643
23644 @item -mac0
23645 @opindex mac0
23646 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23647
23648 @item -mno-ac0
23649 @opindex mno-ac0
23650 Return floating-point results in memory. This is the default.
23651
23652 @item -m40
23653 @opindex m40
23654 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23655
23656 @item -m45
23657 @opindex m45
23658 Generate code for a PDP-11/45. This is the default.
23659
23660 @item -m10
23661 @opindex m10
23662 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23663
23664 @item -mint16
23665 @itemx -mno-int32
23666 @opindex mint16
23667 @opindex mno-int32
23668 Use 16-bit @code{int}. This is the default.
23669
23670 @item -mint32
23671 @itemx -mno-int16
23672 @opindex mint32
23673 @opindex mno-int16
23674 Use 32-bit @code{int}.
23675
23676 @item -msplit
23677 @opindex msplit
23678 Target has split instruction and data space. Implies -m45.
23679
23680 @item -munix-asm
23681 @opindex munix-asm
23682 Use Unix assembler syntax.
23683
23684 @item -mdec-asm
23685 @opindex mdec-asm
23686 Use DEC assembler syntax.
23687
23688 @item -mgnu-asm
23689 @opindex mgnu-asm
23690 Use GNU assembler syntax. This is the default.
23691
23692 @item -mlra
23693 @opindex mlra
23694 Use the new LRA register allocator. By default, the old ``reload''
23695 allocator is used.
23696 @end table
23697
23698 @node picoChip Options
23699 @subsection picoChip Options
23700 @cindex picoChip options
23701
23702 These @samp{-m} options are defined for picoChip implementations:
23703
23704 @table @gcctabopt
23705
23706 @item -mae=@var{ae_type}
23707 @opindex mcpu
23708 Set the instruction set, register set, and instruction scheduling
23709 parameters for array element type @var{ae_type}. Supported values
23710 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23711
23712 @option{-mae=ANY} selects a completely generic AE type. Code
23713 generated with this option runs on any of the other AE types. The
23714 code is not as efficient as it would be if compiled for a specific
23715 AE type, and some types of operation (e.g., multiplication) do not
23716 work properly on all types of AE.
23717
23718 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23719 for compiled code, and is the default.
23720
23721 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23722 option may suffer from poor performance of byte (char) manipulation,
23723 since the DSP AE does not provide hardware support for byte load/stores.
23724
23725 @item -msymbol-as-address
23726 Enable the compiler to directly use a symbol name as an address in a
23727 load/store instruction, without first loading it into a
23728 register. Typically, the use of this option generates larger
23729 programs, which run faster than when the option isn't used. However, the
23730 results vary from program to program, so it is left as a user option,
23731 rather than being permanently enabled.
23732
23733 @item -mno-inefficient-warnings
23734 Disables warnings about the generation of inefficient code. These
23735 warnings can be generated, for example, when compiling code that
23736 performs byte-level memory operations on the MAC AE type. The MAC AE has
23737 no hardware support for byte-level memory operations, so all byte
23738 load/stores must be synthesized from word load/store operations. This is
23739 inefficient and a warning is generated to indicate
23740 that you should rewrite the code to avoid byte operations, or to target
23741 an AE type that has the necessary hardware support. This option disables
23742 these warnings.
23743
23744 @end table
23745
23746 @node PowerPC Options
23747 @subsection PowerPC Options
23748 @cindex PowerPC options
23749
23750 These are listed under @xref{RS/6000 and PowerPC Options}.
23751
23752 @node RISC-V Options
23753 @subsection RISC-V Options
23754 @cindex RISC-V Options
23755
23756 These command-line options are defined for RISC-V targets:
23757
23758 @table @gcctabopt
23759 @item -mbranch-cost=@var{n}
23760 @opindex mbranch-cost
23761 Set the cost of branches to roughly @var{n} instructions.
23762
23763 @item -mplt
23764 @itemx -mno-plt
23765 @opindex plt
23766 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23767 non-PIC. The default is @option{-mplt}.
23768
23769 @item -mabi=@var{ABI-string}
23770 @opindex mabi
23771 Specify integer and floating-point calling convention. @var{ABI-string}
23772 contains two parts: the size of integer types and the registers used for
23773 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23774 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23775 32-bit), and that floating-point values up to 64 bits wide are passed in F
23776 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23777 allows the compiler to generate code that uses the F and D extensions but only
23778 allows floating-point values up to 32 bits long to be passed in registers; or
23779 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23780 passed in registers.
23781
23782 The default for this argument is system dependent, users who want a specific
23783 calling convention should specify one explicitly. The valid calling
23784 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23785 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23786 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23787 invalid because the ABI requires 64-bit values be passed in F registers, but F
23788 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23789 only be used with the @samp{rv32e} architecture. This ABI is not well
23790 specified at present, and is subject to change.
23791
23792 @item -mfdiv
23793 @itemx -mno-fdiv
23794 @opindex mfdiv
23795 Do or don't use hardware floating-point divide and square root instructions.
23796 This requires the F or D extensions for floating-point registers. The default
23797 is to use them if the specified architecture has these instructions.
23798
23799 @item -mdiv
23800 @itemx -mno-div
23801 @opindex mdiv
23802 Do or don't use hardware instructions for integer division. This requires the
23803 M extension. The default is to use them if the specified architecture has
23804 these instructions.
23805
23806 @item -march=@var{ISA-string}
23807 @opindex march
23808 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23809 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23810 @samp{rv32imaf}.
23811
23812 @item -mtune=@var{processor-string}
23813 @opindex mtune
23814 Optimize the output for the given processor, specified by microarchitecture
23815 name. Permissible values for this option are: @samp{rocket},
23816 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23817 and @samp{size}.
23818
23819 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23820
23821 The @samp{size} choice is not intended for use by end-users. This is used
23822 when @option{-Os} is specified. It overrides the instruction cost info
23823 provided by @option{-mtune=}, but does not override the pipeline info. This
23824 helps reduce code size while still giving good performance.
23825
23826 @item -mpreferred-stack-boundary=@var{num}
23827 @opindex mpreferred-stack-boundary
23828 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23829 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23830 the default is 4 (16 bytes or 128-bits).
23831
23832 @strong{Warning:} If you use this switch, then you must build all modules with
23833 the same value, including any libraries. This includes the system libraries
23834 and startup modules.
23835
23836 @item -msmall-data-limit=@var{n}
23837 @opindex msmall-data-limit
23838 Put global and static data smaller than @var{n} bytes into a special section
23839 (on some targets).
23840
23841 @item -msave-restore
23842 @itemx -mno-save-restore
23843 @opindex msave-restore
23844 Do or don't use smaller but slower prologue and epilogue code that uses
23845 library function calls. The default is to use fast inline prologues and
23846 epilogues.
23847
23848 @item -mstrict-align
23849 @itemx -mno-strict-align
23850 @opindex mstrict-align
23851 Do not or do generate unaligned memory accesses. The default is set depending
23852 on whether the processor we are optimizing for supports fast unaligned access
23853 or not.
23854
23855 @item -mcmodel=medlow
23856 @opindex mcmodel=medlow
23857 Generate code for the medium-low code model. The program and its statically
23858 defined symbols must lie within a single 2 GiB address range and must lie
23859 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23860 statically or dynamically linked. This is the default code model.
23861
23862 @item -mcmodel=medany
23863 @opindex mcmodel=medany
23864 Generate code for the medium-any code model. The program and its statically
23865 defined symbols must be within any single 2 GiB address range. Programs can be
23866 statically or dynamically linked.
23867
23868 @item -mexplicit-relocs
23869 @itemx -mno-exlicit-relocs
23870 Use or do not use assembler relocation operators when dealing with symbolic
23871 addresses. The alternative is to use assembler macros instead, which may
23872 limit optimization.
23873
23874 @item -mrelax
23875 @itemx -mno-relax
23876 Take advantage of linker relaxations to reduce the number of instructions
23877 required to materialize symbol addresses. The default is to take advantage of
23878 linker relaxations.
23879
23880 @item -memit-attribute
23881 @itemx -mno-emit-attribute
23882 Emit (do not emit) RISC-V attribute to record extra information into ELF
23883 objects. This feature requires at least binutils 2.32.
23884 @end table
23885
23886 @node RL78 Options
23887 @subsection RL78 Options
23888 @cindex RL78 Options
23889
23890 @table @gcctabopt
23891
23892 @item -msim
23893 @opindex msim
23894 Links in additional target libraries to support operation within a
23895 simulator.
23896
23897 @item -mmul=none
23898 @itemx -mmul=g10
23899 @itemx -mmul=g13
23900 @itemx -mmul=g14
23901 @itemx -mmul=rl78
23902 @opindex mmul
23903 Specifies the type of hardware multiplication and division support to
23904 be used. The simplest is @code{none}, which uses software for both
23905 multiplication and division. This is the default. The @code{g13}
23906 value is for the hardware multiply/divide peripheral found on the
23907 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23908 the multiplication and division instructions supported by the RL78/G14
23909 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23910 the value @code{mg10} is an alias for @code{none}.
23911
23912 In addition a C preprocessor macro is defined, based upon the setting
23913 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23914 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23915
23916 @item -mcpu=g10
23917 @itemx -mcpu=g13
23918 @itemx -mcpu=g14
23919 @itemx -mcpu=rl78
23920 @opindex mcpu
23921 Specifies the RL78 core to target. The default is the G14 core, also
23922 known as an S3 core or just RL78. The G13 or S2 core does not have
23923 multiply or divide instructions, instead it uses a hardware peripheral
23924 for these operations. The G10 or S1 core does not have register
23925 banks, so it uses a different calling convention.
23926
23927 If this option is set it also selects the type of hardware multiply
23928 support to use, unless this is overridden by an explicit
23929 @option{-mmul=none} option on the command line. Thus specifying
23930 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23931 peripheral and specifying @option{-mcpu=g10} disables the use of
23932 hardware multiplications altogether.
23933
23934 Note, although the RL78/G14 core is the default target, specifying
23935 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23936 change the behavior of the toolchain since it also enables G14
23937 hardware multiply support. If these options are not specified on the
23938 command line then software multiplication routines will be used even
23939 though the code targets the RL78 core. This is for backwards
23940 compatibility with older toolchains which did not have hardware
23941 multiply and divide support.
23942
23943 In addition a C preprocessor macro is defined, based upon the setting
23944 of this option. Possible values are: @code{__RL78_G10__},
23945 @code{__RL78_G13__} or @code{__RL78_G14__}.
23946
23947 @item -mg10
23948 @itemx -mg13
23949 @itemx -mg14
23950 @itemx -mrl78
23951 @opindex mg10
23952 @opindex mg13
23953 @opindex mg14
23954 @opindex mrl78
23955 These are aliases for the corresponding @option{-mcpu=} option. They
23956 are provided for backwards compatibility.
23957
23958 @item -mallregs
23959 @opindex mallregs
23960 Allow the compiler to use all of the available registers. By default
23961 registers @code{r24..r31} are reserved for use in interrupt handlers.
23962 With this option enabled these registers can be used in ordinary
23963 functions as well.
23964
23965 @item -m64bit-doubles
23966 @itemx -m32bit-doubles
23967 @opindex m64bit-doubles
23968 @opindex m32bit-doubles
23969 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23970 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23971 @option{-m32bit-doubles}.
23972
23973 @item -msave-mduc-in-interrupts
23974 @itemx -mno-save-mduc-in-interrupts
23975 @opindex msave-mduc-in-interrupts
23976 @opindex mno-save-mduc-in-interrupts
23977 Specifies that interrupt handler functions should preserve the
23978 MDUC registers. This is only necessary if normal code might use
23979 the MDUC registers, for example because it performs multiplication
23980 and division operations. The default is to ignore the MDUC registers
23981 as this makes the interrupt handlers faster. The target option -mg13
23982 needs to be passed for this to work as this feature is only available
23983 on the G13 target (S2 core). The MDUC registers will only be saved
23984 if the interrupt handler performs a multiplication or division
23985 operation or it calls another function.
23986
23987 @end table
23988
23989 @node RS/6000 and PowerPC Options
23990 @subsection IBM RS/6000 and PowerPC Options
23991 @cindex RS/6000 and PowerPC Options
23992 @cindex IBM RS/6000 and PowerPC Options
23993
23994 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23995 @table @gcctabopt
23996 @item -mpowerpc-gpopt
23997 @itemx -mno-powerpc-gpopt
23998 @itemx -mpowerpc-gfxopt
23999 @itemx -mno-powerpc-gfxopt
24000 @need 800
24001 @itemx -mpowerpc64
24002 @itemx -mno-powerpc64
24003 @itemx -mmfcrf
24004 @itemx -mno-mfcrf
24005 @itemx -mpopcntb
24006 @itemx -mno-popcntb
24007 @itemx -mpopcntd
24008 @itemx -mno-popcntd
24009 @itemx -mfprnd
24010 @itemx -mno-fprnd
24011 @need 800
24012 @itemx -mcmpb
24013 @itemx -mno-cmpb
24014 @itemx -mhard-dfp
24015 @itemx -mno-hard-dfp
24016 @opindex mpowerpc-gpopt
24017 @opindex mno-powerpc-gpopt
24018 @opindex mpowerpc-gfxopt
24019 @opindex mno-powerpc-gfxopt
24020 @opindex mpowerpc64
24021 @opindex mno-powerpc64
24022 @opindex mmfcrf
24023 @opindex mno-mfcrf
24024 @opindex mpopcntb
24025 @opindex mno-popcntb
24026 @opindex mpopcntd
24027 @opindex mno-popcntd
24028 @opindex mfprnd
24029 @opindex mno-fprnd
24030 @opindex mcmpb
24031 @opindex mno-cmpb
24032 @opindex mhard-dfp
24033 @opindex mno-hard-dfp
24034 You use these options to specify which instructions are available on the
24035 processor you are using. The default value of these options is
24036 determined when configuring GCC@. Specifying the
24037 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24038 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24039 rather than the options listed above.
24040
24041 Specifying @option{-mpowerpc-gpopt} allows
24042 GCC to use the optional PowerPC architecture instructions in the
24043 General Purpose group, including floating-point square root. Specifying
24044 @option{-mpowerpc-gfxopt} allows GCC to
24045 use the optional PowerPC architecture instructions in the Graphics
24046 group, including floating-point select.
24047
24048 The @option{-mmfcrf} option allows GCC to generate the move from
24049 condition register field instruction implemented on the POWER4
24050 processor and other processors that support the PowerPC V2.01
24051 architecture.
24052 The @option{-mpopcntb} option allows GCC to generate the popcount and
24053 double-precision FP reciprocal estimate instruction implemented on the
24054 POWER5 processor and other processors that support the PowerPC V2.02
24055 architecture.
24056 The @option{-mpopcntd} option allows GCC to generate the popcount
24057 instruction implemented on the POWER7 processor and other processors
24058 that support the PowerPC V2.06 architecture.
24059 The @option{-mfprnd} option allows GCC to generate the FP round to
24060 integer instructions implemented on the POWER5+ processor and other
24061 processors that support the PowerPC V2.03 architecture.
24062 The @option{-mcmpb} option allows GCC to generate the compare bytes
24063 instruction implemented on the POWER6 processor and other processors
24064 that support the PowerPC V2.05 architecture.
24065 The @option{-mhard-dfp} option allows GCC to generate the decimal
24066 floating-point instructions implemented on some POWER processors.
24067
24068 The @option{-mpowerpc64} option allows GCC to generate the additional
24069 64-bit instructions that are found in the full PowerPC64 architecture
24070 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24071 @option{-mno-powerpc64}.
24072
24073 @item -mcpu=@var{cpu_type}
24074 @opindex mcpu
24075 Set architecture type, register usage, and
24076 instruction scheduling parameters for machine type @var{cpu_type}.
24077 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24078 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24079 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24080 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24081 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24082 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24083 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24084 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24085 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24086 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24087 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24088 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24089
24090 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24091 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24092 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24093 architecture machine types, with an appropriate, generic processor
24094 model assumed for scheduling purposes.
24095
24096 Specifying @samp{native} as cpu type detects and selects the
24097 architecture option that corresponds to the host processor of the
24098 system performing the compilation.
24099 @option{-mcpu=native} has no effect if GCC does not recognize the
24100 processor.
24101
24102 The other options specify a specific processor. Code generated under
24103 those options runs best on that processor, and may not run at all on
24104 others.
24105
24106 The @option{-mcpu} options automatically enable or disable the
24107 following options:
24108
24109 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24110 -mpopcntb -mpopcntd -mpowerpc64 @gol
24111 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24112 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24113 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24114 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24115
24116 The particular options set for any particular CPU varies between
24117 compiler versions, depending on what setting seems to produce optimal
24118 code for that CPU; it doesn't necessarily reflect the actual hardware's
24119 capabilities. If you wish to set an individual option to a particular
24120 value, you may specify it after the @option{-mcpu} option, like
24121 @option{-mcpu=970 -mno-altivec}.
24122
24123 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24124 not enabled or disabled by the @option{-mcpu} option at present because
24125 AIX does not have full support for these options. You may still
24126 enable or disable them individually if you're sure it'll work in your
24127 environment.
24128
24129 @item -mtune=@var{cpu_type}
24130 @opindex mtune
24131 Set the instruction scheduling parameters for machine type
24132 @var{cpu_type}, but do not set the architecture type or register usage,
24133 as @option{-mcpu=@var{cpu_type}} does. The same
24134 values for @var{cpu_type} are used for @option{-mtune} as for
24135 @option{-mcpu}. If both are specified, the code generated uses the
24136 architecture and registers set by @option{-mcpu}, but the
24137 scheduling parameters set by @option{-mtune}.
24138
24139 @item -mcmodel=small
24140 @opindex mcmodel=small
24141 Generate PowerPC64 code for the small model: The TOC is limited to
24142 64k.
24143
24144 @item -mcmodel=medium
24145 @opindex mcmodel=medium
24146 Generate PowerPC64 code for the medium model: The TOC and other static
24147 data may be up to a total of 4G in size. This is the default for 64-bit
24148 Linux.
24149
24150 @item -mcmodel=large
24151 @opindex mcmodel=large
24152 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24153 in size. Other data and code is only limited by the 64-bit address
24154 space.
24155
24156 @item -maltivec
24157 @itemx -mno-altivec
24158 @opindex maltivec
24159 @opindex mno-altivec
24160 Generate code that uses (does not use) AltiVec instructions, and also
24161 enable the use of built-in functions that allow more direct access to
24162 the AltiVec instruction set. You may also need to set
24163 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24164 enhancements.
24165
24166 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24167 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24168 match array element order corresponding to the endianness of the
24169 target. That is, element zero identifies the leftmost element in a
24170 vector register when targeting a big-endian platform, and identifies
24171 the rightmost element in a vector register when targeting a
24172 little-endian platform.
24173
24174 @item -mvrsave
24175 @itemx -mno-vrsave
24176 @opindex mvrsave
24177 @opindex mno-vrsave
24178 Generate VRSAVE instructions when generating AltiVec code.
24179
24180 @item -msecure-plt
24181 @opindex msecure-plt
24182 Generate code that allows @command{ld} and @command{ld.so}
24183 to build executables and shared
24184 libraries with non-executable @code{.plt} and @code{.got} sections.
24185 This is a PowerPC
24186 32-bit SYSV ABI option.
24187
24188 @item -mbss-plt
24189 @opindex mbss-plt
24190 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24191 fills in, and
24192 requires @code{.plt} and @code{.got}
24193 sections that are both writable and executable.
24194 This is a PowerPC 32-bit SYSV ABI option.
24195
24196 @item -misel
24197 @itemx -mno-isel
24198 @opindex misel
24199 @opindex mno-isel
24200 This switch enables or disables the generation of ISEL instructions.
24201
24202 @item -mvsx
24203 @itemx -mno-vsx
24204 @opindex mvsx
24205 @opindex mno-vsx
24206 Generate code that uses (does not use) vector/scalar (VSX)
24207 instructions, and also enable the use of built-in functions that allow
24208 more direct access to the VSX instruction set.
24209
24210 @item -mcrypto
24211 @itemx -mno-crypto
24212 @opindex mcrypto
24213 @opindex mno-crypto
24214 Enable the use (disable) of the built-in functions that allow direct
24215 access to the cryptographic instructions that were added in version
24216 2.07 of the PowerPC ISA.
24217
24218 @item -mhtm
24219 @itemx -mno-htm
24220 @opindex mhtm
24221 @opindex mno-htm
24222 Enable (disable) the use of the built-in functions that allow direct
24223 access to the Hardware Transactional Memory (HTM) instructions that
24224 were added in version 2.07 of the PowerPC ISA.
24225
24226 @item -mpower8-fusion
24227 @itemx -mno-power8-fusion
24228 @opindex mpower8-fusion
24229 @opindex mno-power8-fusion
24230 Generate code that keeps (does not keeps) some integer operations
24231 adjacent so that the instructions can be fused together on power8 and
24232 later processors.
24233
24234 @item -mpower8-vector
24235 @itemx -mno-power8-vector
24236 @opindex mpower8-vector
24237 @opindex mno-power8-vector
24238 Generate code that uses (does not use) the vector and scalar
24239 instructions that were added in version 2.07 of the PowerPC ISA. Also
24240 enable the use of built-in functions that allow more direct access to
24241 the vector instructions.
24242
24243 @item -mquad-memory
24244 @itemx -mno-quad-memory
24245 @opindex mquad-memory
24246 @opindex mno-quad-memory
24247 Generate code that uses (does not use) the non-atomic quad word memory
24248 instructions. The @option{-mquad-memory} option requires use of
24249 64-bit mode.
24250
24251 @item -mquad-memory-atomic
24252 @itemx -mno-quad-memory-atomic
24253 @opindex mquad-memory-atomic
24254 @opindex mno-quad-memory-atomic
24255 Generate code that uses (does not use) the atomic quad word memory
24256 instructions. The @option{-mquad-memory-atomic} option requires use of
24257 64-bit mode.
24258
24259 @item -mfloat128
24260 @itemx -mno-float128
24261 @opindex mfloat128
24262 @opindex mno-float128
24263 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24264 and use either software emulation for IEEE 128-bit floating point or
24265 hardware instructions.
24266
24267 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24268 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24269 use the IEEE 128-bit floating point support. The IEEE 128-bit
24270 floating point support only works on PowerPC Linux systems.
24271
24272 The default for @option{-mfloat128} is enabled on PowerPC Linux
24273 systems using the VSX instruction set, and disabled on other systems.
24274
24275 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24276 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24277 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24278 floating point instructions. Otherwise, if you do not specify to
24279 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24280 system, IEEE 128-bit floating point will be done with software
24281 emulation.
24282
24283 @item -mfloat128-hardware
24284 @itemx -mno-float128-hardware
24285 @opindex mfloat128-hardware
24286 @opindex mno-float128-hardware
24287 Enable/disable using ISA 3.0 hardware instructions to support the
24288 @var{__float128} data type.
24289
24290 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24291 Linux systems using the ISA 3.0 instruction set, and disabled on other
24292 systems.
24293
24294 @item -m32
24295 @itemx -m64
24296 @opindex m32
24297 @opindex m64
24298 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24299 targets (including GNU/Linux). The 32-bit environment sets int, long
24300 and pointer to 32 bits and generates code that runs on any PowerPC
24301 variant. The 64-bit environment sets int to 32 bits and long and
24302 pointer to 64 bits, and generates code for PowerPC64, as for
24303 @option{-mpowerpc64}.
24304
24305 @item -mfull-toc
24306 @itemx -mno-fp-in-toc
24307 @itemx -mno-sum-in-toc
24308 @itemx -mminimal-toc
24309 @opindex mfull-toc
24310 @opindex mno-fp-in-toc
24311 @opindex mno-sum-in-toc
24312 @opindex mminimal-toc
24313 Modify generation of the TOC (Table Of Contents), which is created for
24314 every executable file. The @option{-mfull-toc} option is selected by
24315 default. In that case, GCC allocates at least one TOC entry for
24316 each unique non-automatic variable reference in your program. GCC
24317 also places floating-point constants in the TOC@. However, only
24318 16,384 entries are available in the TOC@.
24319
24320 If you receive a linker error message that saying you have overflowed
24321 the available TOC space, you can reduce the amount of TOC space used
24322 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24323 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24324 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24325 generate code to calculate the sum of an address and a constant at
24326 run time instead of putting that sum into the TOC@. You may specify one
24327 or both of these options. Each causes GCC to produce very slightly
24328 slower and larger code at the expense of conserving TOC space.
24329
24330 If you still run out of space in the TOC even when you specify both of
24331 these options, specify @option{-mminimal-toc} instead. This option causes
24332 GCC to make only one TOC entry for every file. When you specify this
24333 option, GCC produces code that is slower and larger but which
24334 uses extremely little TOC space. You may wish to use this option
24335 only on files that contain less frequently-executed code.
24336
24337 @item -maix64
24338 @itemx -maix32
24339 @opindex maix64
24340 @opindex maix32
24341 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24342 @code{long} type, and the infrastructure needed to support them.
24343 Specifying @option{-maix64} implies @option{-mpowerpc64},
24344 while @option{-maix32} disables the 64-bit ABI and
24345 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24346
24347 @item -mxl-compat
24348 @itemx -mno-xl-compat
24349 @opindex mxl-compat
24350 @opindex mno-xl-compat
24351 Produce code that conforms more closely to IBM XL compiler semantics
24352 when using AIX-compatible ABI@. Pass floating-point arguments to
24353 prototyped functions beyond the register save area (RSA) on the stack
24354 in addition to argument FPRs. Do not assume that most significant
24355 double in 128-bit long double value is properly rounded when comparing
24356 values and converting to double. Use XL symbol names for long double
24357 support routines.
24358
24359 The AIX calling convention was extended but not initially documented to
24360 handle an obscure K&R C case of calling a function that takes the
24361 address of its arguments with fewer arguments than declared. IBM XL
24362 compilers access floating-point arguments that do not fit in the
24363 RSA from the stack when a subroutine is compiled without
24364 optimization. Because always storing floating-point arguments on the
24365 stack is inefficient and rarely needed, this option is not enabled by
24366 default and only is necessary when calling subroutines compiled by IBM
24367 XL compilers without optimization.
24368
24369 @item -mpe
24370 @opindex mpe
24371 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24372 application written to use message passing with special startup code to
24373 enable the application to run. The system must have PE installed in the
24374 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24375 must be overridden with the @option{-specs=} option to specify the
24376 appropriate directory location. The Parallel Environment does not
24377 support threads, so the @option{-mpe} option and the @option{-pthread}
24378 option are incompatible.
24379
24380 @item -malign-natural
24381 @itemx -malign-power
24382 @opindex malign-natural
24383 @opindex malign-power
24384 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24385 @option{-malign-natural} overrides the ABI-defined alignment of larger
24386 types, such as floating-point doubles, on their natural size-based boundary.
24387 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24388 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24389
24390 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24391 is not supported.
24392
24393 @item -msoft-float
24394 @itemx -mhard-float
24395 @opindex msoft-float
24396 @opindex mhard-float
24397 Generate code that does not use (uses) the floating-point register set.
24398 Software floating-point emulation is provided if you use the
24399 @option{-msoft-float} option, and pass the option to GCC when linking.
24400
24401 @item -mmultiple
24402 @itemx -mno-multiple
24403 @opindex mmultiple
24404 @opindex mno-multiple
24405 Generate code that uses (does not use) the load multiple word
24406 instructions and the store multiple word instructions. These
24407 instructions are generated by default on POWER systems, and not
24408 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24409 PowerPC systems, since those instructions do not work when the
24410 processor is in little-endian mode. The exceptions are PPC740 and
24411 PPC750 which permit these instructions in little-endian mode.
24412
24413 @item -mupdate
24414 @itemx -mno-update
24415 @opindex mupdate
24416 @opindex mno-update
24417 Generate code that uses (does not use) the load or store instructions
24418 that update the base register to the address of the calculated memory
24419 location. These instructions are generated by default. If you use
24420 @option{-mno-update}, there is a small window between the time that the
24421 stack pointer is updated and the address of the previous frame is
24422 stored, which means code that walks the stack frame across interrupts or
24423 signals may get corrupted data.
24424
24425 @item -mavoid-indexed-addresses
24426 @itemx -mno-avoid-indexed-addresses
24427 @opindex mavoid-indexed-addresses
24428 @opindex mno-avoid-indexed-addresses
24429 Generate code that tries to avoid (not avoid) the use of indexed load
24430 or store instructions. These instructions can incur a performance
24431 penalty on Power6 processors in certain situations, such as when
24432 stepping through large arrays that cross a 16M boundary. This option
24433 is enabled by default when targeting Power6 and disabled otherwise.
24434
24435 @item -mfused-madd
24436 @itemx -mno-fused-madd
24437 @opindex mfused-madd
24438 @opindex mno-fused-madd
24439 Generate code that uses (does not use) the floating-point multiply and
24440 accumulate instructions. These instructions are generated by default
24441 if hardware floating point is used. The machine-dependent
24442 @option{-mfused-madd} option is now mapped to the machine-independent
24443 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24444 mapped to @option{-ffp-contract=off}.
24445
24446 @item -mmulhw
24447 @itemx -mno-mulhw
24448 @opindex mmulhw
24449 @opindex mno-mulhw
24450 Generate code that uses (does not use) the half-word multiply and
24451 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24452 These instructions are generated by default when targeting those
24453 processors.
24454
24455 @item -mdlmzb
24456 @itemx -mno-dlmzb
24457 @opindex mdlmzb
24458 @opindex mno-dlmzb
24459 Generate code that uses (does not use) the string-search @samp{dlmzb}
24460 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24461 generated by default when targeting those processors.
24462
24463 @item -mno-bit-align
24464 @itemx -mbit-align
24465 @opindex mno-bit-align
24466 @opindex mbit-align
24467 On System V.4 and embedded PowerPC systems do not (do) force structures
24468 and unions that contain bit-fields to be aligned to the base type of the
24469 bit-field.
24470
24471 For example, by default a structure containing nothing but 8
24472 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24473 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24474 the structure is aligned to a 1-byte boundary and is 1 byte in
24475 size.
24476
24477 @item -mno-strict-align
24478 @itemx -mstrict-align
24479 @opindex mno-strict-align
24480 @opindex mstrict-align
24481 On System V.4 and embedded PowerPC systems do not (do) assume that
24482 unaligned memory references are handled by the system.
24483
24484 @item -mrelocatable
24485 @itemx -mno-relocatable
24486 @opindex mrelocatable
24487 @opindex mno-relocatable
24488 Generate code that allows (does not allow) a static executable to be
24489 relocated to a different address at run time. A simple embedded
24490 PowerPC system loader should relocate the entire contents of
24491 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24492 a table of 32-bit addresses generated by this option. For this to
24493 work, all objects linked together must be compiled with
24494 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24495 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24496
24497 @item -mrelocatable-lib
24498 @itemx -mno-relocatable-lib
24499 @opindex mrelocatable-lib
24500 @opindex mno-relocatable-lib
24501 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24502 @code{.fixup} section to allow static executables to be relocated at
24503 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24504 alignment of @option{-mrelocatable}. Objects compiled with
24505 @option{-mrelocatable-lib} may be linked with objects compiled with
24506 any combination of the @option{-mrelocatable} options.
24507
24508 @item -mno-toc
24509 @itemx -mtoc
24510 @opindex mno-toc
24511 @opindex mtoc
24512 On System V.4 and embedded PowerPC systems do not (do) assume that
24513 register 2 contains a pointer to a global area pointing to the addresses
24514 used in the program.
24515
24516 @item -mlittle
24517 @itemx -mlittle-endian
24518 @opindex mlittle
24519 @opindex mlittle-endian
24520 On System V.4 and embedded PowerPC systems compile code for the
24521 processor in little-endian mode. The @option{-mlittle-endian} option is
24522 the same as @option{-mlittle}.
24523
24524 @item -mbig
24525 @itemx -mbig-endian
24526 @opindex mbig
24527 @opindex mbig-endian
24528 On System V.4 and embedded PowerPC systems compile code for the
24529 processor in big-endian mode. The @option{-mbig-endian} option is
24530 the same as @option{-mbig}.
24531
24532 @item -mdynamic-no-pic
24533 @opindex mdynamic-no-pic
24534 On Darwin and Mac OS X systems, compile code so that it is not
24535 relocatable, but that its external references are relocatable. The
24536 resulting code is suitable for applications, but not shared
24537 libraries.
24538
24539 @item -msingle-pic-base
24540 @opindex msingle-pic-base
24541 Treat the register used for PIC addressing as read-only, rather than
24542 loading it in the prologue for each function. The runtime system is
24543 responsible for initializing this register with an appropriate value
24544 before execution begins.
24545
24546 @item -mprioritize-restricted-insns=@var{priority}
24547 @opindex mprioritize-restricted-insns
24548 This option controls the priority that is assigned to
24549 dispatch-slot restricted instructions during the second scheduling
24550 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24551 or @samp{2} to assign no, highest, or second-highest (respectively)
24552 priority to dispatch-slot restricted
24553 instructions.
24554
24555 @item -msched-costly-dep=@var{dependence_type}
24556 @opindex msched-costly-dep
24557 This option controls which dependences are considered costly
24558 by the target during instruction scheduling. The argument
24559 @var{dependence_type} takes one of the following values:
24560
24561 @table @asis
24562 @item @samp{no}
24563 No dependence is costly.
24564
24565 @item @samp{all}
24566 All dependences are costly.
24567
24568 @item @samp{true_store_to_load}
24569 A true dependence from store to load is costly.
24570
24571 @item @samp{store_to_load}
24572 Any dependence from store to load is costly.
24573
24574 @item @var{number}
24575 Any dependence for which the latency is greater than or equal to
24576 @var{number} is costly.
24577 @end table
24578
24579 @item -minsert-sched-nops=@var{scheme}
24580 @opindex minsert-sched-nops
24581 This option controls which NOP insertion scheme is used during
24582 the second scheduling pass. The argument @var{scheme} takes one of the
24583 following values:
24584
24585 @table @asis
24586 @item @samp{no}
24587 Don't insert NOPs.
24588
24589 @item @samp{pad}
24590 Pad with NOPs any dispatch group that has vacant issue slots,
24591 according to the scheduler's grouping.
24592
24593 @item @samp{regroup_exact}
24594 Insert NOPs to force costly dependent insns into
24595 separate groups. Insert exactly as many NOPs as needed to force an insn
24596 to a new group, according to the estimated processor grouping.
24597
24598 @item @var{number}
24599 Insert NOPs to force costly dependent insns into
24600 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24601 @end table
24602
24603 @item -mcall-sysv
24604 @opindex mcall-sysv
24605 On System V.4 and embedded PowerPC systems compile code using calling
24606 conventions that adhere to the March 1995 draft of the System V
24607 Application Binary Interface, PowerPC processor supplement. This is the
24608 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24609
24610 @item -mcall-sysv-eabi
24611 @itemx -mcall-eabi
24612 @opindex mcall-sysv-eabi
24613 @opindex mcall-eabi
24614 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24615
24616 @item -mcall-sysv-noeabi
24617 @opindex mcall-sysv-noeabi
24618 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24619
24620 @item -mcall-aixdesc
24621 @opindex m
24622 On System V.4 and embedded PowerPC systems compile code for the AIX
24623 operating system.
24624
24625 @item -mcall-linux
24626 @opindex mcall-linux
24627 On System V.4 and embedded PowerPC systems compile code for the
24628 Linux-based GNU system.
24629
24630 @item -mcall-freebsd
24631 @opindex mcall-freebsd
24632 On System V.4 and embedded PowerPC systems compile code for the
24633 FreeBSD operating system.
24634
24635 @item -mcall-netbsd
24636 @opindex mcall-netbsd
24637 On System V.4 and embedded PowerPC systems compile code for the
24638 NetBSD operating system.
24639
24640 @item -mcall-openbsd
24641 @opindex mcall-netbsd
24642 On System V.4 and embedded PowerPC systems compile code for the
24643 OpenBSD operating system.
24644
24645 @item -mtraceback=@var{traceback_type}
24646 @opindex mtraceback
24647 Select the type of traceback table. Valid values for @var{traceback_type}
24648 are @samp{full}, @samp{part}, and @samp{no}.
24649
24650 @item -maix-struct-return
24651 @opindex maix-struct-return
24652 Return all structures in memory (as specified by the AIX ABI)@.
24653
24654 @item -msvr4-struct-return
24655 @opindex msvr4-struct-return
24656 Return structures smaller than 8 bytes in registers (as specified by the
24657 SVR4 ABI)@.
24658
24659 @item -mabi=@var{abi-type}
24660 @opindex mabi
24661 Extend the current ABI with a particular extension, or remove such extension.
24662 Valid values are @samp{altivec}, @samp{no-altivec},
24663 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24664 @samp{elfv1}, @samp{elfv2}@.
24665
24666 @item -mabi=ibmlongdouble
24667 @opindex mabi=ibmlongdouble
24668 Change the current ABI to use IBM extended-precision long double.
24669 This is not likely to work if your system defaults to using IEEE
24670 extended-precision long double. If you change the long double type
24671 from IEEE extended-precision, the compiler will issue a warning unless
24672 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24673 to be enabled.
24674
24675 @item -mabi=ieeelongdouble
24676 @opindex mabi=ieeelongdouble
24677 Change the current ABI to use IEEE extended-precision long double.
24678 This is not likely to work if your system defaults to using IBM
24679 extended-precision long double. If you change the long double type
24680 from IBM extended-precision, the compiler will issue a warning unless
24681 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24682 to be enabled.
24683
24684 @item -mabi=elfv1
24685 @opindex mabi=elfv1
24686 Change the current ABI to use the ELFv1 ABI.
24687 This is the default ABI for big-endian PowerPC 64-bit Linux.
24688 Overriding the default ABI requires special system support and is
24689 likely to fail in spectacular ways.
24690
24691 @item -mabi=elfv2
24692 @opindex mabi=elfv2
24693 Change the current ABI to use the ELFv2 ABI.
24694 This is the default ABI for little-endian PowerPC 64-bit Linux.
24695 Overriding the default ABI requires special system support and is
24696 likely to fail in spectacular ways.
24697
24698 @item -mgnu-attribute
24699 @itemx -mno-gnu-attribute
24700 @opindex mgnu-attribute
24701 @opindex mno-gnu-attribute
24702 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24703 .gnu.attributes section that specify ABI variations in function
24704 parameters or return values.
24705
24706 @item -mprototype
24707 @itemx -mno-prototype
24708 @opindex mprototype
24709 @opindex mno-prototype
24710 On System V.4 and embedded PowerPC systems assume that all calls to
24711 variable argument functions are properly prototyped. Otherwise, the
24712 compiler must insert an instruction before every non-prototyped call to
24713 set or clear bit 6 of the condition code register (@code{CR}) to
24714 indicate whether floating-point values are passed in the floating-point
24715 registers in case the function takes variable arguments. With
24716 @option{-mprototype}, only calls to prototyped variable argument functions
24717 set or clear the bit.
24718
24719 @item -msim
24720 @opindex msim
24721 On embedded PowerPC systems, assume that the startup module is called
24722 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24723 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24724 configurations.
24725
24726 @item -mmvme
24727 @opindex mmvme
24728 On embedded PowerPC systems, assume that the startup module is called
24729 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24730 @file{libc.a}.
24731
24732 @item -mads
24733 @opindex mads
24734 On embedded PowerPC systems, assume that the startup module is called
24735 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24736 @file{libc.a}.
24737
24738 @item -myellowknife
24739 @opindex myellowknife
24740 On embedded PowerPC systems, assume that the startup module is called
24741 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24742 @file{libc.a}.
24743
24744 @item -mvxworks
24745 @opindex mvxworks
24746 On System V.4 and embedded PowerPC systems, specify that you are
24747 compiling for a VxWorks system.
24748
24749 @item -memb
24750 @opindex memb
24751 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24752 header to indicate that @samp{eabi} extended relocations are used.
24753
24754 @item -meabi
24755 @itemx -mno-eabi
24756 @opindex meabi
24757 @opindex mno-eabi
24758 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24759 Embedded Applications Binary Interface (EABI), which is a set of
24760 modifications to the System V.4 specifications. Selecting @option{-meabi}
24761 means that the stack is aligned to an 8-byte boundary, a function
24762 @code{__eabi} is called from @code{main} to set up the EABI
24763 environment, and the @option{-msdata} option can use both @code{r2} and
24764 @code{r13} to point to two separate small data areas. Selecting
24765 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24766 no EABI initialization function is called from @code{main}, and the
24767 @option{-msdata} option only uses @code{r13} to point to a single
24768 small data area. The @option{-meabi} option is on by default if you
24769 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24770
24771 @item -msdata=eabi
24772 @opindex msdata=eabi
24773 On System V.4 and embedded PowerPC systems, put small initialized
24774 @code{const} global and static data in the @code{.sdata2} section, which
24775 is pointed to by register @code{r2}. Put small initialized
24776 non-@code{const} global and static data in the @code{.sdata} section,
24777 which is pointed to by register @code{r13}. Put small uninitialized
24778 global and static data in the @code{.sbss} section, which is adjacent to
24779 the @code{.sdata} section. The @option{-msdata=eabi} option is
24780 incompatible with the @option{-mrelocatable} option. The
24781 @option{-msdata=eabi} option also sets the @option{-memb} option.
24782
24783 @item -msdata=sysv
24784 @opindex msdata=sysv
24785 On System V.4 and embedded PowerPC systems, put small global and static
24786 data in the @code{.sdata} section, which is pointed to by register
24787 @code{r13}. Put small uninitialized global and static data in the
24788 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24789 The @option{-msdata=sysv} option is incompatible with the
24790 @option{-mrelocatable} option.
24791
24792 @item -msdata=default
24793 @itemx -msdata
24794 @opindex msdata=default
24795 @opindex msdata
24796 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24797 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24798 same as @option{-msdata=sysv}.
24799
24800 @item -msdata=data
24801 @opindex msdata=data
24802 On System V.4 and embedded PowerPC systems, put small global
24803 data in the @code{.sdata} section. Put small uninitialized global
24804 data in the @code{.sbss} section. Do not use register @code{r13}
24805 to address small data however. This is the default behavior unless
24806 other @option{-msdata} options are used.
24807
24808 @item -msdata=none
24809 @itemx -mno-sdata
24810 @opindex msdata=none
24811 @opindex mno-sdata
24812 On embedded PowerPC systems, put all initialized global and static data
24813 in the @code{.data} section, and all uninitialized data in the
24814 @code{.bss} section.
24815
24816 @item -mreadonly-in-sdata
24817 @opindex mreadonly-in-sdata
24818 @opindex mno-readonly-in-sdata
24819 Put read-only objects in the @code{.sdata} section as well. This is the
24820 default.
24821
24822 @item -mblock-move-inline-limit=@var{num}
24823 @opindex mblock-move-inline-limit
24824 Inline all block moves (such as calls to @code{memcpy} or structure
24825 copies) less than or equal to @var{num} bytes. The minimum value for
24826 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24827 targets. The default value is target-specific.
24828
24829 @item -mblock-compare-inline-limit=@var{num}
24830 @opindex mblock-compare-inline-limit
24831 Generate non-looping inline code for all block compares (such as calls
24832 to @code{memcmp} or structure compares) less than or equal to @var{num}
24833 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24834 block compare is disabled. The default value is target-specific.
24835
24836 @item -mblock-compare-inline-loop-limit=@var{num}
24837 @opindex mblock-compare-inline-loop-limit
24838 Generate an inline expansion using loop code for all block compares that
24839 are less than or equal to @var{num} bytes, but greater than the limit
24840 for non-loop inline block compare expansion. If the block length is not
24841 constant, at most @var{num} bytes will be compared before @code{memcmp}
24842 is called to compare the remainder of the block. The default value is
24843 target-specific.
24844
24845 @item -mstring-compare-inline-limit=@var{num}
24846 @opindex mstring-compare-inline-limit
24847 Compare at most @var{num} string bytes with inline code.
24848 If the difference or end of string is not found at the
24849 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24850 take care of the rest of the comparison. The default is 64 bytes.
24851
24852 @item -G @var{num}
24853 @opindex G
24854 @cindex smaller data references (PowerPC)
24855 @cindex .sdata/.sdata2 references (PowerPC)
24856 On embedded PowerPC systems, put global and static items less than or
24857 equal to @var{num} bytes into the small data or BSS sections instead of
24858 the normal data or BSS section. By default, @var{num} is 8. The
24859 @option{-G @var{num}} switch is also passed to the linker.
24860 All modules should be compiled with the same @option{-G @var{num}} value.
24861
24862 @item -mregnames
24863 @itemx -mno-regnames
24864 @opindex mregnames
24865 @opindex mno-regnames
24866 On System V.4 and embedded PowerPC systems do (do not) emit register
24867 names in the assembly language output using symbolic forms.
24868
24869 @item -mlongcall
24870 @itemx -mno-longcall
24871 @opindex mlongcall
24872 @opindex mno-longcall
24873 By default assume that all calls are far away so that a longer and more
24874 expensive calling sequence is required. This is required for calls
24875 farther than 32 megabytes (33,554,432 bytes) from the current location.
24876 A short call is generated if the compiler knows
24877 the call cannot be that far away. This setting can be overridden by
24878 the @code{shortcall} function attribute, or by @code{#pragma
24879 longcall(0)}.
24880
24881 Some linkers are capable of detecting out-of-range calls and generating
24882 glue code on the fly. On these systems, long calls are unnecessary and
24883 generate slower code. As of this writing, the AIX linker can do this,
24884 as can the GNU linker for PowerPC/64. It is planned to add this feature
24885 to the GNU linker for 32-bit PowerPC systems as well.
24886
24887 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
24888 GCC can generate long calls using an inline PLT call sequence (see
24889 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
24890 ELFv1 (big-endian) do not support inline PLT calls.
24891
24892 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24893 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24894 addresses represent the callee and the branch island. The
24895 Darwin/PPC linker prefers the first address and generates a @code{bl
24896 callee} if the PPC @code{bl} instruction reaches the callee directly;
24897 otherwise, the linker generates @code{bl L42} to call the branch
24898 island. The branch island is appended to the body of the
24899 calling function; it computes the full 32-bit address of the callee
24900 and jumps to it.
24901
24902 On Mach-O (Darwin) systems, this option directs the compiler emit to
24903 the glue for every direct call, and the Darwin linker decides whether
24904 to use or discard it.
24905
24906 In the future, GCC may ignore all longcall specifications
24907 when the linker is known to generate glue.
24908
24909 @item -mpltseq
24910 @itemx -mno-pltseq
24911 @opindex mpltseq
24912 @opindex mno-pltseq
24913 Implement (do not implement) -fno-plt and long calls using an inline
24914 PLT call sequence that supports lazy linking and long calls to
24915 functions in dlopen'd shared libraries. Inline PLT calls are only
24916 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24917 linkers, and are enabled by default if the support is detected when
24918 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
24919 configured with @option{--enable-secureplt}. @option{-mpltseq} code
24920 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
24921 linked together.
24922
24923 @item -mtls-markers
24924 @itemx -mno-tls-markers
24925 @opindex mtls-markers
24926 @opindex mno-tls-markers
24927 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24928 specifying the function argument. The relocation allows the linker to
24929 reliably associate function call with argument setup instructions for
24930 TLS optimization, which in turn allows GCC to better schedule the
24931 sequence.
24932
24933 @item -mrecip
24934 @itemx -mno-recip
24935 @opindex mrecip
24936 This option enables use of the reciprocal estimate and
24937 reciprocal square root estimate instructions with additional
24938 Newton-Raphson steps to increase precision instead of doing a divide or
24939 square root and divide for floating-point arguments. You should use
24940 the @option{-ffast-math} option when using @option{-mrecip} (or at
24941 least @option{-funsafe-math-optimizations},
24942 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24943 @option{-fno-trapping-math}). Note that while the throughput of the
24944 sequence is generally higher than the throughput of the non-reciprocal
24945 instruction, the precision of the sequence can be decreased by up to 2
24946 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24947 roots.
24948
24949 @item -mrecip=@var{opt}
24950 @opindex mrecip=opt
24951 This option controls which reciprocal estimate instructions
24952 may be used. @var{opt} is a comma-separated list of options, which may
24953 be preceded by a @code{!} to invert the option:
24954
24955 @table @samp
24956
24957 @item all
24958 Enable all estimate instructions.
24959
24960 @item default
24961 Enable the default instructions, equivalent to @option{-mrecip}.
24962
24963 @item none
24964 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24965
24966 @item div
24967 Enable the reciprocal approximation instructions for both
24968 single and double precision.
24969
24970 @item divf
24971 Enable the single-precision reciprocal approximation instructions.
24972
24973 @item divd
24974 Enable the double-precision reciprocal approximation instructions.
24975
24976 @item rsqrt
24977 Enable the reciprocal square root approximation instructions for both
24978 single and double precision.
24979
24980 @item rsqrtf
24981 Enable the single-precision reciprocal square root approximation instructions.
24982
24983 @item rsqrtd
24984 Enable the double-precision reciprocal square root approximation instructions.
24985
24986 @end table
24987
24988 So, for example, @option{-mrecip=all,!rsqrtd} enables
24989 all of the reciprocal estimate instructions, except for the
24990 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24991 which handle the double-precision reciprocal square root calculations.
24992
24993 @item -mrecip-precision
24994 @itemx -mno-recip-precision
24995 @opindex mrecip-precision
24996 Assume (do not assume) that the reciprocal estimate instructions
24997 provide higher-precision estimates than is mandated by the PowerPC
24998 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24999 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25000 The double-precision square root estimate instructions are not generated by
25001 default on low-precision machines, since they do not provide an
25002 estimate that converges after three steps.
25003
25004 @item -mveclibabi=@var{type}
25005 @opindex mveclibabi
25006 Specifies the ABI type to use for vectorizing intrinsics using an
25007 external library. The only type supported at present is @samp{mass},
25008 which specifies to use IBM's Mathematical Acceleration Subsystem
25009 (MASS) libraries for vectorizing intrinsics using external libraries.
25010 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25011 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25012 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25013 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25014 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25015 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25016 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25017 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25018 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25019 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25020 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25021 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25022 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25023 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25024 for power7. Both @option{-ftree-vectorize} and
25025 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25026 libraries must be specified at link time.
25027
25028 @item -mfriz
25029 @itemx -mno-friz
25030 @opindex mfriz
25031 Generate (do not generate) the @code{friz} instruction when the
25032 @option{-funsafe-math-optimizations} option is used to optimize
25033 rounding of floating-point values to 64-bit integer and back to floating
25034 point. The @code{friz} instruction does not return the same value if
25035 the floating-point number is too large to fit in an integer.
25036
25037 @item -mpointers-to-nested-functions
25038 @itemx -mno-pointers-to-nested-functions
25039 @opindex mpointers-to-nested-functions
25040 Generate (do not generate) code to load up the static chain register
25041 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25042 systems where a function pointer points to a 3-word descriptor giving
25043 the function address, TOC value to be loaded in register @code{r2}, and
25044 static chain value to be loaded in register @code{r11}. The
25045 @option{-mpointers-to-nested-functions} is on by default. You cannot
25046 call through pointers to nested functions or pointers
25047 to functions compiled in other languages that use the static chain if
25048 you use @option{-mno-pointers-to-nested-functions}.
25049
25050 @item -msave-toc-indirect
25051 @itemx -mno-save-toc-indirect
25052 @opindex msave-toc-indirect
25053 Generate (do not generate) code to save the TOC value in the reserved
25054 stack location in the function prologue if the function calls through
25055 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25056 saved in the prologue, it is saved just before the call through the
25057 pointer. The @option{-mno-save-toc-indirect} option is the default.
25058
25059 @item -mcompat-align-parm
25060 @itemx -mno-compat-align-parm
25061 @opindex mcompat-align-parm
25062 Generate (do not generate) code to pass structure parameters with a
25063 maximum alignment of 64 bits, for compatibility with older versions
25064 of GCC.
25065
25066 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25067 structure parameter on a 128-bit boundary when that structure contained
25068 a member requiring 128-bit alignment. This is corrected in more
25069 recent versions of GCC. This option may be used to generate code
25070 that is compatible with functions compiled with older versions of
25071 GCC.
25072
25073 The @option{-mno-compat-align-parm} option is the default.
25074
25075 @item -mstack-protector-guard=@var{guard}
25076 @itemx -mstack-protector-guard-reg=@var{reg}
25077 @itemx -mstack-protector-guard-offset=@var{offset}
25078 @itemx -mstack-protector-guard-symbol=@var{symbol}
25079 @opindex mstack-protector-guard
25080 @opindex mstack-protector-guard-reg
25081 @opindex mstack-protector-guard-offset
25082 @opindex mstack-protector-guard-symbol
25083 Generate stack protection code using canary at @var{guard}. Supported
25084 locations are @samp{global} for global canary or @samp{tls} for per-thread
25085 canary in the TLS block (the default with GNU libc version 2.4 or later).
25086
25087 With the latter choice the options
25088 @option{-mstack-protector-guard-reg=@var{reg}} and
25089 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25090 which register to use as base register for reading the canary, and from what
25091 offset from that base register. The default for those is as specified in the
25092 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25093 the offset with a symbol reference to a canary in the TLS block.
25094
25095 @item -mpcrel
25096 @itemx -mno-pcrel
25097 @opindex mpcrel
25098 @opindex mno-pcrel
25099 Generate (do not generate) pc-relative addressing when the option
25100 @option{-mcpu=future} is used.
25101 @end table
25102
25103 @node RX Options
25104 @subsection RX Options
25105 @cindex RX Options
25106
25107 These command-line options are defined for RX targets:
25108
25109 @table @gcctabopt
25110 @item -m64bit-doubles
25111 @itemx -m32bit-doubles
25112 @opindex m64bit-doubles
25113 @opindex m32bit-doubles
25114 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25115 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25116 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25117 works on 32-bit values, which is why the default is
25118 @option{-m32bit-doubles}.
25119
25120 @item -fpu
25121 @itemx -nofpu
25122 @opindex fpu
25123 @opindex nofpu
25124 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25125 floating-point hardware. The default is enabled for the RX600
25126 series and disabled for the RX200 series.
25127
25128 Floating-point instructions are only generated for 32-bit floating-point
25129 values, however, so the FPU hardware is not used for doubles if the
25130 @option{-m64bit-doubles} option is used.
25131
25132 @emph{Note} If the @option{-fpu} option is enabled then
25133 @option{-funsafe-math-optimizations} is also enabled automatically.
25134 This is because the RX FPU instructions are themselves unsafe.
25135
25136 @item -mcpu=@var{name}
25137 @opindex mcpu
25138 Selects the type of RX CPU to be targeted. Currently three types are
25139 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25140 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25141
25142 The only difference between @samp{RX600} and @samp{RX610} is that the
25143 @samp{RX610} does not support the @code{MVTIPL} instruction.
25144
25145 The @samp{RX200} series does not have a hardware floating-point unit
25146 and so @option{-nofpu} is enabled by default when this type is
25147 selected.
25148
25149 @item -mbig-endian-data
25150 @itemx -mlittle-endian-data
25151 @opindex mbig-endian-data
25152 @opindex mlittle-endian-data
25153 Store data (but not code) in the big-endian format. The default is
25154 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25155 format.
25156
25157 @item -msmall-data-limit=@var{N}
25158 @opindex msmall-data-limit
25159 Specifies the maximum size in bytes of global and static variables
25160 which can be placed into the small data area. Using the small data
25161 area can lead to smaller and faster code, but the size of area is
25162 limited and it is up to the programmer to ensure that the area does
25163 not overflow. Also when the small data area is used one of the RX's
25164 registers (usually @code{r13}) is reserved for use pointing to this
25165 area, so it is no longer available for use by the compiler. This
25166 could result in slower and/or larger code if variables are pushed onto
25167 the stack instead of being held in this register.
25168
25169 Note, common variables (variables that have not been initialized) and
25170 constants are not placed into the small data area as they are assigned
25171 to other sections in the output executable.
25172
25173 The default value is zero, which disables this feature. Note, this
25174 feature is not enabled by default with higher optimization levels
25175 (@option{-O2} etc) because of the potentially detrimental effects of
25176 reserving a register. It is up to the programmer to experiment and
25177 discover whether this feature is of benefit to their program. See the
25178 description of the @option{-mpid} option for a description of how the
25179 actual register to hold the small data area pointer is chosen.
25180
25181 @item -msim
25182 @itemx -mno-sim
25183 @opindex msim
25184 @opindex mno-sim
25185 Use the simulator runtime. The default is to use the libgloss
25186 board-specific runtime.
25187
25188 @item -mas100-syntax
25189 @itemx -mno-as100-syntax
25190 @opindex mas100-syntax
25191 @opindex mno-as100-syntax
25192 When generating assembler output use a syntax that is compatible with
25193 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25194 assembler, but it has some restrictions so it is not generated by default.
25195
25196 @item -mmax-constant-size=@var{N}
25197 @opindex mmax-constant-size
25198 Specifies the maximum size, in bytes, of a constant that can be used as
25199 an operand in a RX instruction. Although the RX instruction set does
25200 allow constants of up to 4 bytes in length to be used in instructions,
25201 a longer value equates to a longer instruction. Thus in some
25202 circumstances it can be beneficial to restrict the size of constants
25203 that are used in instructions. Constants that are too big are instead
25204 placed into a constant pool and referenced via register indirection.
25205
25206 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25207 or 4 means that constants of any size are allowed.
25208
25209 @item -mrelax
25210 @opindex mrelax
25211 Enable linker relaxation. Linker relaxation is a process whereby the
25212 linker attempts to reduce the size of a program by finding shorter
25213 versions of various instructions. Disabled by default.
25214
25215 @item -mint-register=@var{N}
25216 @opindex mint-register
25217 Specify the number of registers to reserve for fast interrupt handler
25218 functions. The value @var{N} can be between 0 and 4. A value of 1
25219 means that register @code{r13} is reserved for the exclusive use
25220 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25221 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25222 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25223 A value of 0, the default, does not reserve any registers.
25224
25225 @item -msave-acc-in-interrupts
25226 @opindex msave-acc-in-interrupts
25227 Specifies that interrupt handler functions should preserve the
25228 accumulator register. This is only necessary if normal code might use
25229 the accumulator register, for example because it performs 64-bit
25230 multiplications. The default is to ignore the accumulator as this
25231 makes the interrupt handlers faster.
25232
25233 @item -mpid
25234 @itemx -mno-pid
25235 @opindex mpid
25236 @opindex mno-pid
25237 Enables the generation of position independent data. When enabled any
25238 access to constant data is done via an offset from a base address
25239 held in a register. This allows the location of constant data to be
25240 determined at run time without requiring the executable to be
25241 relocated, which is a benefit to embedded applications with tight
25242 memory constraints. Data that can be modified is not affected by this
25243 option.
25244
25245 Note, using this feature reserves a register, usually @code{r13}, for
25246 the constant data base address. This can result in slower and/or
25247 larger code, especially in complicated functions.
25248
25249 The actual register chosen to hold the constant data base address
25250 depends upon whether the @option{-msmall-data-limit} and/or the
25251 @option{-mint-register} command-line options are enabled. Starting
25252 with register @code{r13} and proceeding downwards, registers are
25253 allocated first to satisfy the requirements of @option{-mint-register},
25254 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25255 is possible for the small data area register to be @code{r8} if both
25256 @option{-mint-register=4} and @option{-mpid} are specified on the
25257 command line.
25258
25259 By default this feature is not enabled. The default can be restored
25260 via the @option{-mno-pid} command-line option.
25261
25262 @item -mno-warn-multiple-fast-interrupts
25263 @itemx -mwarn-multiple-fast-interrupts
25264 @opindex mno-warn-multiple-fast-interrupts
25265 @opindex mwarn-multiple-fast-interrupts
25266 Prevents GCC from issuing a warning message if it finds more than one
25267 fast interrupt handler when it is compiling a file. The default is to
25268 issue a warning for each extra fast interrupt handler found, as the RX
25269 only supports one such interrupt.
25270
25271 @item -mallow-string-insns
25272 @itemx -mno-allow-string-insns
25273 @opindex mallow-string-insns
25274 @opindex mno-allow-string-insns
25275 Enables or disables the use of the string manipulation instructions
25276 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25277 @code{SWHILE} and also the @code{RMPA} instruction. These
25278 instructions may prefetch data, which is not safe to do if accessing
25279 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25280 for more information).
25281
25282 The default is to allow these instructions, but it is not possible for
25283 GCC to reliably detect all circumstances where a string instruction
25284 might be used to access an I/O register, so their use cannot be
25285 disabled automatically. Instead it is reliant upon the programmer to
25286 use the @option{-mno-allow-string-insns} option if their program
25287 accesses I/O space.
25288
25289 When the instructions are enabled GCC defines the C preprocessor
25290 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25291 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25292
25293 @item -mjsr
25294 @itemx -mno-jsr
25295 @opindex mjsr
25296 @opindex mno-jsr
25297 Use only (or not only) @code{JSR} instructions to access functions.
25298 This option can be used when code size exceeds the range of @code{BSR}
25299 instructions. Note that @option{-mno-jsr} does not mean to not use
25300 @code{JSR} but instead means that any type of branch may be used.
25301 @end table
25302
25303 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25304 has special significance to the RX port when used with the
25305 @code{interrupt} function attribute. This attribute indicates a
25306 function intended to process fast interrupts. GCC ensures
25307 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25308 and/or @code{r13} and only provided that the normal use of the
25309 corresponding registers have been restricted via the
25310 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25311 options.
25312
25313 @node S/390 and zSeries Options
25314 @subsection S/390 and zSeries Options
25315 @cindex S/390 and zSeries Options
25316
25317 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25318
25319 @table @gcctabopt
25320 @item -mhard-float
25321 @itemx -msoft-float
25322 @opindex mhard-float
25323 @opindex msoft-float
25324 Use (do not use) the hardware floating-point instructions and registers
25325 for floating-point operations. When @option{-msoft-float} is specified,
25326 functions in @file{libgcc.a} are used to perform floating-point
25327 operations. When @option{-mhard-float} is specified, the compiler
25328 generates IEEE floating-point instructions. This is the default.
25329
25330 @item -mhard-dfp
25331 @itemx -mno-hard-dfp
25332 @opindex mhard-dfp
25333 @opindex mno-hard-dfp
25334 Use (do not use) the hardware decimal-floating-point instructions for
25335 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25336 specified, functions in @file{libgcc.a} are used to perform
25337 decimal-floating-point operations. When @option{-mhard-dfp} is
25338 specified, the compiler generates decimal-floating-point hardware
25339 instructions. This is the default for @option{-march=z9-ec} or higher.
25340
25341 @item -mlong-double-64
25342 @itemx -mlong-double-128
25343 @opindex mlong-double-64
25344 @opindex mlong-double-128
25345 These switches control the size of @code{long double} type. A size
25346 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25347 type. This is the default.
25348
25349 @item -mbackchain
25350 @itemx -mno-backchain
25351 @opindex mbackchain
25352 @opindex mno-backchain
25353 Store (do not store) the address of the caller's frame as backchain pointer
25354 into the callee's stack frame.
25355 A backchain may be needed to allow debugging using tools that do not understand
25356 DWARF call frame information.
25357 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25358 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25359 the backchain is placed into the topmost word of the 96/160 byte register
25360 save area.
25361
25362 In general, code compiled with @option{-mbackchain} is call-compatible with
25363 code compiled with @option{-mmo-backchain}; however, use of the backchain
25364 for debugging purposes usually requires that the whole binary is built with
25365 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25366 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25367 to build a linux kernel use @option{-msoft-float}.
25368
25369 The default is to not maintain the backchain.
25370
25371 @item -mpacked-stack
25372 @itemx -mno-packed-stack
25373 @opindex mpacked-stack
25374 @opindex mno-packed-stack
25375 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25376 specified, the compiler uses the all fields of the 96/160 byte register save
25377 area only for their default purpose; unused fields still take up stack space.
25378 When @option{-mpacked-stack} is specified, register save slots are densely
25379 packed at the top of the register save area; unused space is reused for other
25380 purposes, allowing for more efficient use of the available stack space.
25381 However, when @option{-mbackchain} is also in effect, the topmost word of
25382 the save area is always used to store the backchain, and the return address
25383 register is always saved two words below the backchain.
25384
25385 As long as the stack frame backchain is not used, code generated with
25386 @option{-mpacked-stack} is call-compatible with code generated with
25387 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25388 S/390 or zSeries generated code that uses the stack frame backchain at run
25389 time, not just for debugging purposes. Such code is not call-compatible
25390 with code compiled with @option{-mpacked-stack}. Also, note that the
25391 combination of @option{-mbackchain},
25392 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25393 to build a linux kernel use @option{-msoft-float}.
25394
25395 The default is to not use the packed stack layout.
25396
25397 @item -msmall-exec
25398 @itemx -mno-small-exec
25399 @opindex msmall-exec
25400 @opindex mno-small-exec
25401 Generate (or do not generate) code using the @code{bras} instruction
25402 to do subroutine calls.
25403 This only works reliably if the total executable size does not
25404 exceed 64k. The default is to use the @code{basr} instruction instead,
25405 which does not have this limitation.
25406
25407 @item -m64
25408 @itemx -m31
25409 @opindex m64
25410 @opindex m31
25411 When @option{-m31} is specified, generate code compliant to the
25412 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25413 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25414 particular to generate 64-bit instructions. For the @samp{s390}
25415 targets, the default is @option{-m31}, while the @samp{s390x}
25416 targets default to @option{-m64}.
25417
25418 @item -mzarch
25419 @itemx -mesa
25420 @opindex mzarch
25421 @opindex mesa
25422 When @option{-mzarch} is specified, generate code using the
25423 instructions available on z/Architecture.
25424 When @option{-mesa} is specified, generate code using the
25425 instructions available on ESA/390. Note that @option{-mesa} is
25426 not possible with @option{-m64}.
25427 When generating code compliant to the GNU/Linux for S/390 ABI,
25428 the default is @option{-mesa}. When generating code compliant
25429 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25430
25431 @item -mhtm
25432 @itemx -mno-htm
25433 @opindex mhtm
25434 @opindex mno-htm
25435 The @option{-mhtm} option enables a set of builtins making use of
25436 instructions available with the transactional execution facility
25437 introduced with the IBM zEnterprise EC12 machine generation
25438 @ref{S/390 System z Built-in Functions}.
25439 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25440
25441 @item -mvx
25442 @itemx -mno-vx
25443 @opindex mvx
25444 @opindex mno-vx
25445 When @option{-mvx} is specified, generate code using the instructions
25446 available with the vector extension facility introduced with the IBM
25447 z13 machine generation.
25448 This option changes the ABI for some vector type values with regard to
25449 alignment and calling conventions. In case vector type values are
25450 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25451 command will be added to mark the resulting binary with the ABI used.
25452 @option{-mvx} is enabled by default when using @option{-march=z13}.
25453
25454 @item -mzvector
25455 @itemx -mno-zvector
25456 @opindex mzvector
25457 @opindex mno-zvector
25458 The @option{-mzvector} option enables vector language extensions and
25459 builtins using instructions available with the vector extension
25460 facility introduced with the IBM z13 machine generation.
25461 This option adds support for @samp{vector} to be used as a keyword to
25462 define vector type variables and arguments. @samp{vector} is only
25463 available when GNU extensions are enabled. It will not be expanded
25464 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25465 In addition to the GCC low-level builtins @option{-mzvector} enables
25466 a set of builtins added for compatibility with AltiVec-style
25467 implementations like Power and Cell. In order to make use of these
25468 builtins the header file @file{vecintrin.h} needs to be included.
25469 @option{-mzvector} is disabled by default.
25470
25471 @item -mmvcle
25472 @itemx -mno-mvcle
25473 @opindex mmvcle
25474 @opindex mno-mvcle
25475 Generate (or do not generate) code using the @code{mvcle} instruction
25476 to perform block moves. When @option{-mno-mvcle} is specified,
25477 use a @code{mvc} loop instead. This is the default unless optimizing for
25478 size.
25479
25480 @item -mdebug
25481 @itemx -mno-debug
25482 @opindex mdebug
25483 @opindex mno-debug
25484 Print (or do not print) additional debug information when compiling.
25485 The default is to not print debug information.
25486
25487 @item -march=@var{cpu-type}
25488 @opindex march
25489 Generate code that runs on @var{cpu-type}, which is the name of a
25490 system representing a certain processor type. Possible values for
25491 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25492 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25493 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25494 @samp{z14}/@samp{arch12}, and @samp{native}.
25495
25496 The default is @option{-march=z900}.
25497
25498 Specifying @samp{native} as cpu type can be used to select the best
25499 architecture option for the host processor.
25500 @option{-march=native} has no effect if GCC does not recognize the
25501 processor.
25502
25503 @item -mtune=@var{cpu-type}
25504 @opindex mtune
25505 Tune to @var{cpu-type} everything applicable about the generated code,
25506 except for the ABI and the set of available instructions.
25507 The list of @var{cpu-type} values is the same as for @option{-march}.
25508 The default is the value used for @option{-march}.
25509
25510 @item -mtpf-trace
25511 @itemx -mno-tpf-trace
25512 @opindex mtpf-trace
25513 @opindex mno-tpf-trace
25514 Generate code that adds (does not add) in TPF OS specific branches to trace
25515 routines in the operating system. This option is off by default, even
25516 when compiling for the TPF OS@.
25517
25518 @item -mfused-madd
25519 @itemx -mno-fused-madd
25520 @opindex mfused-madd
25521 @opindex mno-fused-madd
25522 Generate code that uses (does not use) the floating-point multiply and
25523 accumulate instructions. These instructions are generated by default if
25524 hardware floating point is used.
25525
25526 @item -mwarn-framesize=@var{framesize}
25527 @opindex mwarn-framesize
25528 Emit a warning if the current function exceeds the given frame size. Because
25529 this is a compile-time check it doesn't need to be a real problem when the program
25530 runs. It is intended to identify functions that most probably cause
25531 a stack overflow. It is useful to be used in an environment with limited stack
25532 size e.g.@: the linux kernel.
25533
25534 @item -mwarn-dynamicstack
25535 @opindex mwarn-dynamicstack
25536 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25537 arrays. This is generally a bad idea with a limited stack size.
25538
25539 @item -mstack-guard=@var{stack-guard}
25540 @itemx -mstack-size=@var{stack-size}
25541 @opindex mstack-guard
25542 @opindex mstack-size
25543 If these options are provided the S/390 back end emits additional instructions in
25544 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25545 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25546 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25547 the frame size of the compiled function is chosen.
25548 These options are intended to be used to help debugging stack overflow problems.
25549 The additionally emitted code causes only little overhead and hence can also be
25550 used in production-like systems without greater performance degradation. The given
25551 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25552 @var{stack-guard} without exceeding 64k.
25553 In order to be efficient the extra code makes the assumption that the stack starts
25554 at an address aligned to the value given by @var{stack-size}.
25555 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25556
25557 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25558 @opindex mhotpatch
25559 If the hotpatch option is enabled, a ``hot-patching'' function
25560 prologue is generated for all functions in the compilation unit.
25561 The funtion label is prepended with the given number of two-byte
25562 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25563 the label, 2 * @var{post-halfwords} bytes are appended, using the
25564 largest NOP like instructions the architecture allows (maximum
25565 1000000).
25566
25567 If both arguments are zero, hotpatching is disabled.
25568
25569 This option can be overridden for individual functions with the
25570 @code{hotpatch} attribute.
25571 @end table
25572
25573 @node Score Options
25574 @subsection Score Options
25575 @cindex Score Options
25576
25577 These options are defined for Score implementations:
25578
25579 @table @gcctabopt
25580 @item -meb
25581 @opindex meb
25582 Compile code for big-endian mode. This is the default.
25583
25584 @item -mel
25585 @opindex mel
25586 Compile code for little-endian mode.
25587
25588 @item -mnhwloop
25589 @opindex mnhwloop
25590 Disable generation of @code{bcnz} instructions.
25591
25592 @item -muls
25593 @opindex muls
25594 Enable generation of unaligned load and store instructions.
25595
25596 @item -mmac
25597 @opindex mmac
25598 Enable the use of multiply-accumulate instructions. Disabled by default.
25599
25600 @item -mscore5
25601 @opindex mscore5
25602 Specify the SCORE5 as the target architecture.
25603
25604 @item -mscore5u
25605 @opindex mscore5u
25606 Specify the SCORE5U of the target architecture.
25607
25608 @item -mscore7
25609 @opindex mscore7
25610 Specify the SCORE7 as the target architecture. This is the default.
25611
25612 @item -mscore7d
25613 @opindex mscore7d
25614 Specify the SCORE7D as the target architecture.
25615 @end table
25616
25617 @node SH Options
25618 @subsection SH Options
25619
25620 These @samp{-m} options are defined for the SH implementations:
25621
25622 @table @gcctabopt
25623 @item -m1
25624 @opindex m1
25625 Generate code for the SH1.
25626
25627 @item -m2
25628 @opindex m2
25629 Generate code for the SH2.
25630
25631 @item -m2e
25632 Generate code for the SH2e.
25633
25634 @item -m2a-nofpu
25635 @opindex m2a-nofpu
25636 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25637 that the floating-point unit is not used.
25638
25639 @item -m2a-single-only
25640 @opindex m2a-single-only
25641 Generate code for the SH2a-FPU, in such a way that no double-precision
25642 floating-point operations are used.
25643
25644 @item -m2a-single
25645 @opindex m2a-single
25646 Generate code for the SH2a-FPU assuming the floating-point unit is in
25647 single-precision mode by default.
25648
25649 @item -m2a
25650 @opindex m2a
25651 Generate code for the SH2a-FPU assuming the floating-point unit is in
25652 double-precision mode by default.
25653
25654 @item -m3
25655 @opindex m3
25656 Generate code for the SH3.
25657
25658 @item -m3e
25659 @opindex m3e
25660 Generate code for the SH3e.
25661
25662 @item -m4-nofpu
25663 @opindex m4-nofpu
25664 Generate code for the SH4 without a floating-point unit.
25665
25666 @item -m4-single-only
25667 @opindex m4-single-only
25668 Generate code for the SH4 with a floating-point unit that only
25669 supports single-precision arithmetic.
25670
25671 @item -m4-single
25672 @opindex m4-single
25673 Generate code for the SH4 assuming the floating-point unit is in
25674 single-precision mode by default.
25675
25676 @item -m4
25677 @opindex m4
25678 Generate code for the SH4.
25679
25680 @item -m4-100
25681 @opindex m4-100
25682 Generate code for SH4-100.
25683
25684 @item -m4-100-nofpu
25685 @opindex m4-100-nofpu
25686 Generate code for SH4-100 in such a way that the
25687 floating-point unit is not used.
25688
25689 @item -m4-100-single
25690 @opindex m4-100-single
25691 Generate code for SH4-100 assuming the floating-point unit is in
25692 single-precision mode by default.
25693
25694 @item -m4-100-single-only
25695 @opindex m4-100-single-only
25696 Generate code for SH4-100 in such a way that no double-precision
25697 floating-point operations are used.
25698
25699 @item -m4-200
25700 @opindex m4-200
25701 Generate code for SH4-200.
25702
25703 @item -m4-200-nofpu
25704 @opindex m4-200-nofpu
25705 Generate code for SH4-200 without in such a way that the
25706 floating-point unit is not used.
25707
25708 @item -m4-200-single
25709 @opindex m4-200-single
25710 Generate code for SH4-200 assuming the floating-point unit is in
25711 single-precision mode by default.
25712
25713 @item -m4-200-single-only
25714 @opindex m4-200-single-only
25715 Generate code for SH4-200 in such a way that no double-precision
25716 floating-point operations are used.
25717
25718 @item -m4-300
25719 @opindex m4-300
25720 Generate code for SH4-300.
25721
25722 @item -m4-300-nofpu
25723 @opindex m4-300-nofpu
25724 Generate code for SH4-300 without in such a way that the
25725 floating-point unit is not used.
25726
25727 @item -m4-300-single
25728 @opindex m4-300-single
25729 Generate code for SH4-300 in such a way that no double-precision
25730 floating-point operations are used.
25731
25732 @item -m4-300-single-only
25733 @opindex m4-300-single-only
25734 Generate code for SH4-300 in such a way that no double-precision
25735 floating-point operations are used.
25736
25737 @item -m4-340
25738 @opindex m4-340
25739 Generate code for SH4-340 (no MMU, no FPU).
25740
25741 @item -m4-500
25742 @opindex m4-500
25743 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25744 assembler.
25745
25746 @item -m4a-nofpu
25747 @opindex m4a-nofpu
25748 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25749 floating-point unit is not used.
25750
25751 @item -m4a-single-only
25752 @opindex m4a-single-only
25753 Generate code for the SH4a, in such a way that no double-precision
25754 floating-point operations are used.
25755
25756 @item -m4a-single
25757 @opindex m4a-single
25758 Generate code for the SH4a assuming the floating-point unit is in
25759 single-precision mode by default.
25760
25761 @item -m4a
25762 @opindex m4a
25763 Generate code for the SH4a.
25764
25765 @item -m4al
25766 @opindex m4al
25767 Same as @option{-m4a-nofpu}, except that it implicitly passes
25768 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25769 instructions at the moment.
25770
25771 @item -mb
25772 @opindex mb
25773 Compile code for the processor in big-endian mode.
25774
25775 @item -ml
25776 @opindex ml
25777 Compile code for the processor in little-endian mode.
25778
25779 @item -mdalign
25780 @opindex mdalign
25781 Align doubles at 64-bit boundaries. Note that this changes the calling
25782 conventions, and thus some functions from the standard C library do
25783 not work unless you recompile it first with @option{-mdalign}.
25784
25785 @item -mrelax
25786 @opindex mrelax
25787 Shorten some address references at link time, when possible; uses the
25788 linker option @option{-relax}.
25789
25790 @item -mbigtable
25791 @opindex mbigtable
25792 Use 32-bit offsets in @code{switch} tables. The default is to use
25793 16-bit offsets.
25794
25795 @item -mbitops
25796 @opindex mbitops
25797 Enable the use of bit manipulation instructions on SH2A.
25798
25799 @item -mfmovd
25800 @opindex mfmovd
25801 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25802 alignment constraints.
25803
25804 @item -mrenesas
25805 @opindex mrenesas
25806 Comply with the calling conventions defined by Renesas.
25807
25808 @item -mno-renesas
25809 @opindex mno-renesas
25810 Comply with the calling conventions defined for GCC before the Renesas
25811 conventions were available. This option is the default for all
25812 targets of the SH toolchain.
25813
25814 @item -mnomacsave
25815 @opindex mnomacsave
25816 Mark the @code{MAC} register as call-clobbered, even if
25817 @option{-mrenesas} is given.
25818
25819 @item -mieee
25820 @itemx -mno-ieee
25821 @opindex mieee
25822 @opindex mno-ieee
25823 Control the IEEE compliance of floating-point comparisons, which affects the
25824 handling of cases where the result of a comparison is unordered. By default
25825 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25826 enabled @option{-mno-ieee} is implicitly set, which results in faster
25827 floating-point greater-equal and less-equal comparisons. The implicit settings
25828 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25829
25830 @item -minline-ic_invalidate
25831 @opindex minline-ic_invalidate
25832 Inline code to invalidate instruction cache entries after setting up
25833 nested function trampolines.
25834 This option has no effect if @option{-musermode} is in effect and the selected
25835 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25836 instruction.
25837 If the selected code generation option does not allow the use of the @code{icbi}
25838 instruction, and @option{-musermode} is not in effect, the inlined code
25839 manipulates the instruction cache address array directly with an associative
25840 write. This not only requires privileged mode at run time, but it also
25841 fails if the cache line had been mapped via the TLB and has become unmapped.
25842
25843 @item -misize
25844 @opindex misize
25845 Dump instruction size and location in the assembly code.
25846
25847 @item -mpadstruct
25848 @opindex mpadstruct
25849 This option is deprecated. It pads structures to multiple of 4 bytes,
25850 which is incompatible with the SH ABI@.
25851
25852 @item -matomic-model=@var{model}
25853 @opindex matomic-model=@var{model}
25854 Sets the model of atomic operations and additional parameters as a comma
25855 separated list. For details on the atomic built-in functions see
25856 @ref{__atomic Builtins}. The following models and parameters are supported:
25857
25858 @table @samp
25859
25860 @item none
25861 Disable compiler generated atomic sequences and emit library calls for atomic
25862 operations. This is the default if the target is not @code{sh*-*-linux*}.
25863
25864 @item soft-gusa
25865 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25866 built-in functions. The generated atomic sequences require additional support
25867 from the interrupt/exception handling code of the system and are only suitable
25868 for SH3* and SH4* single-core systems. This option is enabled by default when
25869 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25870 this option also partially utilizes the hardware atomic instructions
25871 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25872 @samp{strict} is specified.
25873
25874 @item soft-tcb
25875 Generate software atomic sequences that use a variable in the thread control
25876 block. This is a variation of the gUSA sequences which can also be used on
25877 SH1* and SH2* targets. The generated atomic sequences require additional
25878 support from the interrupt/exception handling code of the system and are only
25879 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25880 parameter has to be specified as well.
25881
25882 @item soft-imask
25883 Generate software atomic sequences that temporarily disable interrupts by
25884 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25885 in privileged mode and is only suitable for single-core systems. Additional
25886 support from the interrupt/exception handling code of the system is not
25887 required. This model is enabled by default when the target is
25888 @code{sh*-*-linux*} and SH1* or SH2*.
25889
25890 @item hard-llcs
25891 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25892 instructions only. This is only available on SH4A and is suitable for
25893 multi-core systems. Since the hardware instructions support only 32 bit atomic
25894 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25895 Code compiled with this option is also compatible with other software
25896 atomic model interrupt/exception handling systems if executed on an SH4A
25897 system. Additional support from the interrupt/exception handling code of the
25898 system is not required for this model.
25899
25900 @item gbr-offset=
25901 This parameter specifies the offset in bytes of the variable in the thread
25902 control block structure that should be used by the generated atomic sequences
25903 when the @samp{soft-tcb} model has been selected. For other models this
25904 parameter is ignored. The specified value must be an integer multiple of four
25905 and in the range 0-1020.
25906
25907 @item strict
25908 This parameter prevents mixed usage of multiple atomic models, even if they
25909 are compatible, and makes the compiler generate atomic sequences of the
25910 specified model only.
25911
25912 @end table
25913
25914 @item -mtas
25915 @opindex mtas
25916 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25917 Notice that depending on the particular hardware and software configuration
25918 this can degrade overall performance due to the operand cache line flushes
25919 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25920 processors the @code{tas.b} instruction must be used with caution since it
25921 can result in data corruption for certain cache configurations.
25922
25923 @item -mprefergot
25924 @opindex mprefergot
25925 When generating position-independent code, emit function calls using
25926 the Global Offset Table instead of the Procedure Linkage Table.
25927
25928 @item -musermode
25929 @itemx -mno-usermode
25930 @opindex musermode
25931 @opindex mno-usermode
25932 Don't allow (allow) the compiler generating privileged mode code. Specifying
25933 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25934 inlined code would not work in user mode. @option{-musermode} is the default
25935 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25936 @option{-musermode} has no effect, since there is no user mode.
25937
25938 @item -multcost=@var{number}
25939 @opindex multcost=@var{number}
25940 Set the cost to assume for a multiply insn.
25941
25942 @item -mdiv=@var{strategy}
25943 @opindex mdiv=@var{strategy}
25944 Set the division strategy to be used for integer division operations.
25945 @var{strategy} can be one of:
25946
25947 @table @samp
25948
25949 @item call-div1
25950 Calls a library function that uses the single-step division instruction
25951 @code{div1} to perform the operation. Division by zero calculates an
25952 unspecified result and does not trap. This is the default except for SH4,
25953 SH2A and SHcompact.
25954
25955 @item call-fp
25956 Calls a library function that performs the operation in double precision
25957 floating point. Division by zero causes a floating-point exception. This is
25958 the default for SHcompact with FPU. Specifying this for targets that do not
25959 have a double precision FPU defaults to @code{call-div1}.
25960
25961 @item call-table
25962 Calls a library function that uses a lookup table for small divisors and
25963 the @code{div1} instruction with case distinction for larger divisors. Division
25964 by zero calculates an unspecified result and does not trap. This is the default
25965 for SH4. Specifying this for targets that do not have dynamic shift
25966 instructions defaults to @code{call-div1}.
25967
25968 @end table
25969
25970 When a division strategy has not been specified the default strategy is
25971 selected based on the current target. For SH2A the default strategy is to
25972 use the @code{divs} and @code{divu} instructions instead of library function
25973 calls.
25974
25975 @item -maccumulate-outgoing-args
25976 @opindex maccumulate-outgoing-args
25977 Reserve space once for outgoing arguments in the function prologue rather
25978 than around each call. Generally beneficial for performance and size. Also
25979 needed for unwinding to avoid changing the stack frame around conditional code.
25980
25981 @item -mdivsi3_libfunc=@var{name}
25982 @opindex mdivsi3_libfunc=@var{name}
25983 Set the name of the library function used for 32-bit signed division to
25984 @var{name}.
25985 This only affects the name used in the @samp{call} division strategies, and
25986 the compiler still expects the same sets of input/output/clobbered registers as
25987 if this option were not present.
25988
25989 @item -mfixed-range=@var{register-range}
25990 @opindex mfixed-range
25991 Generate code treating the given register range as fixed registers.
25992 A fixed register is one that the register allocator cannot use. This is
25993 useful when compiling kernel code. A register range is specified as
25994 two registers separated by a dash. Multiple register ranges can be
25995 specified separated by a comma.
25996
25997 @item -mbranch-cost=@var{num}
25998 @opindex mbranch-cost=@var{num}
25999 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26000 make the compiler try to generate more branch-free code if possible.
26001 If not specified the value is selected depending on the processor type that
26002 is being compiled for.
26003
26004 @item -mzdcbranch
26005 @itemx -mno-zdcbranch
26006 @opindex mzdcbranch
26007 @opindex mno-zdcbranch
26008 Assume (do not assume) that zero displacement conditional branch instructions
26009 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26010 compiler prefers zero displacement branch code sequences. This is
26011 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26012 disabled by specifying @option{-mno-zdcbranch}.
26013
26014 @item -mcbranch-force-delay-slot
26015 @opindex mcbranch-force-delay-slot
26016 Force the usage of delay slots for conditional branches, which stuffs the delay
26017 slot with a @code{nop} if a suitable instruction cannot be found. By default
26018 this option is disabled. It can be enabled to work around hardware bugs as
26019 found in the original SH7055.
26020
26021 @item -mfused-madd
26022 @itemx -mno-fused-madd
26023 @opindex mfused-madd
26024 @opindex mno-fused-madd
26025 Generate code that uses (does not use) the floating-point multiply and
26026 accumulate instructions. These instructions are generated by default
26027 if hardware floating point is used. The machine-dependent
26028 @option{-mfused-madd} option is now mapped to the machine-independent
26029 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26030 mapped to @option{-ffp-contract=off}.
26031
26032 @item -mfsca
26033 @itemx -mno-fsca
26034 @opindex mfsca
26035 @opindex mno-fsca
26036 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26037 and cosine approximations. The option @option{-mfsca} must be used in
26038 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26039 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26040 approximations even if @option{-funsafe-math-optimizations} is in effect.
26041
26042 @item -mfsrra
26043 @itemx -mno-fsrra
26044 @opindex mfsrra
26045 @opindex mno-fsrra
26046 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26047 reciprocal square root approximations. The option @option{-mfsrra} must be used
26048 in combination with @option{-funsafe-math-optimizations} and
26049 @option{-ffinite-math-only}. It is enabled by default when generating code for
26050 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26051 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26052 in effect.
26053
26054 @item -mpretend-cmove
26055 @opindex mpretend-cmove
26056 Prefer zero-displacement conditional branches for conditional move instruction
26057 patterns. This can result in faster code on the SH4 processor.
26058
26059 @item -mfdpic
26060 @opindex fdpic
26061 Generate code using the FDPIC ABI.
26062
26063 @end table
26064
26065 @node Solaris 2 Options
26066 @subsection Solaris 2 Options
26067 @cindex Solaris 2 options
26068
26069 These @samp{-m} options are supported on Solaris 2:
26070
26071 @table @gcctabopt
26072 @item -mclear-hwcap
26073 @opindex mclear-hwcap
26074 @option{-mclear-hwcap} tells the compiler to remove the hardware
26075 capabilities generated by the Solaris assembler. This is only necessary
26076 when object files use ISA extensions not supported by the current
26077 machine, but check at runtime whether or not to use them.
26078
26079 @item -mimpure-text
26080 @opindex mimpure-text
26081 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26082 the compiler to not pass @option{-z text} to the linker when linking a
26083 shared object. Using this option, you can link position-dependent
26084 code into a shared object.
26085
26086 @option{-mimpure-text} suppresses the ``relocations remain against
26087 allocatable but non-writable sections'' linker error message.
26088 However, the necessary relocations trigger copy-on-write, and the
26089 shared object is not actually shared across processes. Instead of
26090 using @option{-mimpure-text}, you should compile all source code with
26091 @option{-fpic} or @option{-fPIC}.
26092
26093 @end table
26094
26095 These switches are supported in addition to the above on Solaris 2:
26096
26097 @table @gcctabopt
26098 @item -pthreads
26099 @opindex pthreads
26100 This is a synonym for @option{-pthread}.
26101 @end table
26102
26103 @node SPARC Options
26104 @subsection SPARC Options
26105 @cindex SPARC options
26106
26107 These @samp{-m} options are supported on the SPARC:
26108
26109 @table @gcctabopt
26110 @item -mno-app-regs
26111 @itemx -mapp-regs
26112 @opindex mno-app-regs
26113 @opindex mapp-regs
26114 Specify @option{-mapp-regs} to generate output using the global registers
26115 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26116 global register 1, each global register 2 through 4 is then treated as an
26117 allocable register that is clobbered by function calls. This is the default.
26118
26119 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26120 specify @option{-mno-app-regs}. You should compile libraries and system
26121 software with this option.
26122
26123 @item -mflat
26124 @itemx -mno-flat
26125 @opindex mflat
26126 @opindex mno-flat
26127 With @option{-mflat}, the compiler does not generate save/restore instructions
26128 and uses a ``flat'' or single register window model. This model is compatible
26129 with the regular register window model. The local registers and the input
26130 registers (0--5) are still treated as ``call-saved'' registers and are
26131 saved on the stack as needed.
26132
26133 With @option{-mno-flat} (the default), the compiler generates save/restore
26134 instructions (except for leaf functions). This is the normal operating mode.
26135
26136 @item -mfpu
26137 @itemx -mhard-float
26138 @opindex mfpu
26139 @opindex mhard-float
26140 Generate output containing floating-point instructions. This is the
26141 default.
26142
26143 @item -mno-fpu
26144 @itemx -msoft-float
26145 @opindex mno-fpu
26146 @opindex msoft-float
26147 Generate output containing library calls for floating point.
26148 @strong{Warning:} the requisite libraries are not available for all SPARC
26149 targets. Normally the facilities of the machine's usual C compiler are
26150 used, but this cannot be done directly in cross-compilation. You must make
26151 your own arrangements to provide suitable library functions for
26152 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26153 @samp{sparclite-*-*} do provide software floating-point support.
26154
26155 @option{-msoft-float} changes the calling convention in the output file;
26156 therefore, it is only useful if you compile @emph{all} of a program with
26157 this option. In particular, you need to compile @file{libgcc.a}, the
26158 library that comes with GCC, with @option{-msoft-float} in order for
26159 this to work.
26160
26161 @item -mhard-quad-float
26162 @opindex mhard-quad-float
26163 Generate output containing quad-word (long double) floating-point
26164 instructions.
26165
26166 @item -msoft-quad-float
26167 @opindex msoft-quad-float
26168 Generate output containing library calls for quad-word (long double)
26169 floating-point instructions. The functions called are those specified
26170 in the SPARC ABI@. This is the default.
26171
26172 As of this writing, there are no SPARC implementations that have hardware
26173 support for the quad-word floating-point instructions. They all invoke
26174 a trap handler for one of these instructions, and then the trap handler
26175 emulates the effect of the instruction. Because of the trap handler overhead,
26176 this is much slower than calling the ABI library routines. Thus the
26177 @option{-msoft-quad-float} option is the default.
26178
26179 @item -mno-unaligned-doubles
26180 @itemx -munaligned-doubles
26181 @opindex mno-unaligned-doubles
26182 @opindex munaligned-doubles
26183 Assume that doubles have 8-byte alignment. This is the default.
26184
26185 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26186 alignment only if they are contained in another type, or if they have an
26187 absolute address. Otherwise, it assumes they have 4-byte alignment.
26188 Specifying this option avoids some rare compatibility problems with code
26189 generated by other compilers. It is not the default because it results
26190 in a performance loss, especially for floating-point code.
26191
26192 @item -muser-mode
26193 @itemx -mno-user-mode
26194 @opindex muser-mode
26195 @opindex mno-user-mode
26196 Do not generate code that can only run in supervisor mode. This is relevant
26197 only for the @code{casa} instruction emitted for the LEON3 processor. This
26198 is the default.
26199
26200 @item -mfaster-structs
26201 @itemx -mno-faster-structs
26202 @opindex mfaster-structs
26203 @opindex mno-faster-structs
26204 With @option{-mfaster-structs}, the compiler assumes that structures
26205 should have 8-byte alignment. This enables the use of pairs of
26206 @code{ldd} and @code{std} instructions for copies in structure
26207 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26208 However, the use of this changed alignment directly violates the SPARC
26209 ABI@. Thus, it's intended only for use on targets where the developer
26210 acknowledges that their resulting code is not directly in line with
26211 the rules of the ABI@.
26212
26213 @item -mstd-struct-return
26214 @itemx -mno-std-struct-return
26215 @opindex mstd-struct-return
26216 @opindex mno-std-struct-return
26217 With @option{-mstd-struct-return}, the compiler generates checking code
26218 in functions returning structures or unions to detect size mismatches
26219 between the two sides of function calls, as per the 32-bit ABI@.
26220
26221 The default is @option{-mno-std-struct-return}. This option has no effect
26222 in 64-bit mode.
26223
26224 @item -mlra
26225 @itemx -mno-lra
26226 @opindex mlra
26227 @opindex mno-lra
26228 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26229 so @option{-mno-lra} needs to be passed to get old Reload.
26230
26231 @item -mcpu=@var{cpu_type}
26232 @opindex mcpu
26233 Set the instruction set, register set, and instruction scheduling parameters
26234 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26235 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26236 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26237 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26238 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26239 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26240
26241 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26242 which selects the best architecture option for the host processor.
26243 @option{-mcpu=native} has no effect if GCC does not recognize
26244 the processor.
26245
26246 Default instruction scheduling parameters are used for values that select
26247 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26248 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26249
26250 Here is a list of each supported architecture and their supported
26251 implementations.
26252
26253 @table @asis
26254 @item v7
26255 cypress, leon3v7
26256
26257 @item v8
26258 supersparc, hypersparc, leon, leon3
26259
26260 @item sparclite
26261 f930, f934, sparclite86x
26262
26263 @item sparclet
26264 tsc701
26265
26266 @item v9
26267 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26268 niagara7, m8
26269 @end table
26270
26271 By default (unless configured otherwise), GCC generates code for the V7
26272 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26273 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26274 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26275 SPARCStation 1, 2, IPX etc.
26276
26277 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26278 architecture. The only difference from V7 code is that the compiler emits
26279 the integer multiply and integer divide instructions which exist in SPARC-V8
26280 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26281 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26282 2000 series.
26283
26284 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26285 the SPARC architecture. This adds the integer multiply, integer divide step
26286 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26287 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26288 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26289 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26290 MB86934 chip, which is the more recent SPARClite with FPU@.
26291
26292 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26293 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26294 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26295 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26296 optimizes it for the TEMIC SPARClet chip.
26297
26298 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26299 architecture. This adds 64-bit integer and floating-point move instructions,
26300 3 additional floating-point condition code registers and conditional move
26301 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26302 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26303 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26304 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26305 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26306 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26307 additionally optimizes it for Sun UltraSPARC T2 chips. With
26308 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26309 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26310 additionally optimizes it for Sun UltraSPARC T4 chips. With
26311 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26312 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26313 additionally optimizes it for Oracle M8 chips.
26314
26315 @item -mtune=@var{cpu_type}
26316 @opindex mtune
26317 Set the instruction scheduling parameters for machine type
26318 @var{cpu_type}, but do not set the instruction set or register set that the
26319 option @option{-mcpu=@var{cpu_type}} does.
26320
26321 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26322 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26323 that select a particular CPU implementation. Those are
26324 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26325 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26326 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26327 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26328 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26329 and GNU/Linux toolchains, @samp{native} can also be used.
26330
26331 @item -mv8plus
26332 @itemx -mno-v8plus
26333 @opindex mv8plus
26334 @opindex mno-v8plus
26335 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26336 difference from the V8 ABI is that the global and out registers are
26337 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26338 mode for all SPARC-V9 processors.
26339
26340 @item -mvis
26341 @itemx -mno-vis
26342 @opindex mvis
26343 @opindex mno-vis
26344 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26345 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26346
26347 @item -mvis2
26348 @itemx -mno-vis2
26349 @opindex mvis2
26350 @opindex mno-vis2
26351 With @option{-mvis2}, GCC generates code that takes advantage of
26352 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26353 default is @option{-mvis2} when targeting a cpu that supports such
26354 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26355 also sets @option{-mvis}.
26356
26357 @item -mvis3
26358 @itemx -mno-vis3
26359 @opindex mvis3
26360 @opindex mno-vis3
26361 With @option{-mvis3}, GCC generates code that takes advantage of
26362 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26363 default is @option{-mvis3} when targeting a cpu that supports such
26364 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26365 also sets @option{-mvis2} and @option{-mvis}.
26366
26367 @item -mvis4
26368 @itemx -mno-vis4
26369 @opindex mvis4
26370 @opindex mno-vis4
26371 With @option{-mvis4}, GCC generates code that takes advantage of
26372 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26373 default is @option{-mvis4} when targeting a cpu that supports such
26374 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26375 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26376
26377 @item -mvis4b
26378 @itemx -mno-vis4b
26379 @opindex mvis4b
26380 @opindex mno-vis4b
26381 With @option{-mvis4b}, GCC generates code that takes advantage of
26382 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26383 the additional VIS instructions introduced in the Oracle SPARC
26384 Architecture 2017. The default is @option{-mvis4b} when targeting a
26385 cpu that supports such instructions, such as m8 and later. Setting
26386 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26387 @option{-mvis2} and @option{-mvis}.
26388
26389 @item -mcbcond
26390 @itemx -mno-cbcond
26391 @opindex mcbcond
26392 @opindex mno-cbcond
26393 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26394 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26395 when targeting a CPU that supports such instructions, such as Niagara-4 and
26396 later.
26397
26398 @item -mfmaf
26399 @itemx -mno-fmaf
26400 @opindex mfmaf
26401 @opindex mno-fmaf
26402 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26403 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26404 when targeting a CPU that supports such instructions, such as Niagara-3 and
26405 later.
26406
26407 @item -mfsmuld
26408 @itemx -mno-fsmuld
26409 @opindex mfsmuld
26410 @opindex mno-fsmuld
26411 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26412 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26413 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26414 or V9 with FPU except @option{-mcpu=leon}.
26415
26416 @item -mpopc
26417 @itemx -mno-popc
26418 @opindex mpopc
26419 @opindex mno-popc
26420 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26421 Population Count instruction. The default is @option{-mpopc}
26422 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26423 later.
26424
26425 @item -msubxc
26426 @itemx -mno-subxc
26427 @opindex msubxc
26428 @opindex mno-subxc
26429 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26430 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26431 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26432 later.
26433
26434 @item -mfix-at697f
26435 @opindex mfix-at697f
26436 Enable the documented workaround for the single erratum of the Atmel AT697F
26437 processor (which corresponds to erratum #13 of the AT697E processor).
26438
26439 @item -mfix-ut699
26440 @opindex mfix-ut699
26441 Enable the documented workarounds for the floating-point errata and the data
26442 cache nullify errata of the UT699 processor.
26443
26444 @item -mfix-ut700
26445 @opindex mfix-ut700
26446 Enable the documented workaround for the back-to-back store errata of
26447 the UT699E/UT700 processor.
26448
26449 @item -mfix-gr712rc
26450 @opindex mfix-gr712rc
26451 Enable the documented workaround for the back-to-back store errata of
26452 the GR712RC processor.
26453 @end table
26454
26455 These @samp{-m} options are supported in addition to the above
26456 on SPARC-V9 processors in 64-bit environments:
26457
26458 @table @gcctabopt
26459 @item -m32
26460 @itemx -m64
26461 @opindex m32
26462 @opindex m64
26463 Generate code for a 32-bit or 64-bit environment.
26464 The 32-bit environment sets int, long and pointer to 32 bits.
26465 The 64-bit environment sets int to 32 bits and long and pointer
26466 to 64 bits.
26467
26468 @item -mcmodel=@var{which}
26469 @opindex mcmodel
26470 Set the code model to one of
26471
26472 @table @samp
26473 @item medlow
26474 The Medium/Low code model: 64-bit addresses, programs
26475 must be linked in the low 32 bits of memory. Programs can be statically
26476 or dynamically linked.
26477
26478 @item medmid
26479 The Medium/Middle code model: 64-bit addresses, programs
26480 must be linked in the low 44 bits of memory, the text and data segments must
26481 be less than 2GB in size and the data segment must be located within 2GB of
26482 the text segment.
26483
26484 @item medany
26485 The Medium/Anywhere code model: 64-bit addresses, programs
26486 may be linked anywhere in memory, the text and data segments must be less
26487 than 2GB in size and the data segment must be located within 2GB of the
26488 text segment.
26489
26490 @item embmedany
26491 The Medium/Anywhere code model for embedded systems:
26492 64-bit addresses, the text and data segments must be less than 2GB in
26493 size, both starting anywhere in memory (determined at link time). The
26494 global register %g4 points to the base of the data segment. Programs
26495 are statically linked and PIC is not supported.
26496 @end table
26497
26498 @item -mmemory-model=@var{mem-model}
26499 @opindex mmemory-model
26500 Set the memory model in force on the processor to one of
26501
26502 @table @samp
26503 @item default
26504 The default memory model for the processor and operating system.
26505
26506 @item rmo
26507 Relaxed Memory Order
26508
26509 @item pso
26510 Partial Store Order
26511
26512 @item tso
26513 Total Store Order
26514
26515 @item sc
26516 Sequential Consistency
26517 @end table
26518
26519 These memory models are formally defined in Appendix D of the SPARC-V9
26520 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26521
26522 @item -mstack-bias
26523 @itemx -mno-stack-bias
26524 @opindex mstack-bias
26525 @opindex mno-stack-bias
26526 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26527 frame pointer if present, are offset by @minus{}2047 which must be added back
26528 when making stack frame references. This is the default in 64-bit mode.
26529 Otherwise, assume no such offset is present.
26530 @end table
26531
26532 @node SPU Options
26533 @subsection SPU Options
26534 @cindex SPU options
26535
26536 These @samp{-m} options are supported on the SPU:
26537
26538 @table @gcctabopt
26539 @item -mwarn-reloc
26540 @itemx -merror-reloc
26541 @opindex mwarn-reloc
26542 @opindex merror-reloc
26543
26544 The loader for SPU does not handle dynamic relocations. By default, GCC
26545 gives an error when it generates code that requires a dynamic
26546 relocation. @option{-mno-error-reloc} disables the error,
26547 @option{-mwarn-reloc} generates a warning instead.
26548
26549 @item -msafe-dma
26550 @itemx -munsafe-dma
26551 @opindex msafe-dma
26552 @opindex munsafe-dma
26553
26554 Instructions that initiate or test completion of DMA must not be
26555 reordered with respect to loads and stores of the memory that is being
26556 accessed.
26557 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26558 memory accesses, but that can lead to inefficient code in places where the
26559 memory is known to not change. Rather than mark the memory as volatile,
26560 you can use @option{-msafe-dma} to tell the compiler to treat
26561 the DMA instructions as potentially affecting all memory.
26562
26563 @item -mbranch-hints
26564 @opindex mbranch-hints
26565
26566 By default, GCC generates a branch hint instruction to avoid
26567 pipeline stalls for always-taken or probably-taken branches. A hint
26568 is not generated closer than 8 instructions away from its branch.
26569 There is little reason to disable them, except for debugging purposes,
26570 or to make an object a little bit smaller.
26571
26572 @item -msmall-mem
26573 @itemx -mlarge-mem
26574 @opindex msmall-mem
26575 @opindex mlarge-mem
26576
26577 By default, GCC generates code assuming that addresses are never larger
26578 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26579 a full 32-bit address.
26580
26581 @item -mstdmain
26582 @opindex mstdmain
26583
26584 By default, GCC links against startup code that assumes the SPU-style
26585 main function interface (which has an unconventional parameter list).
26586 With @option{-mstdmain}, GCC links your program against startup
26587 code that assumes a C99-style interface to @code{main}, including a
26588 local copy of @code{argv} strings.
26589
26590 @item -mfixed-range=@var{register-range}
26591 @opindex mfixed-range
26592 Generate code treating the given register range as fixed registers.
26593 A fixed register is one that the register allocator cannot use. This is
26594 useful when compiling kernel code. A register range is specified as
26595 two registers separated by a dash. Multiple register ranges can be
26596 specified separated by a comma.
26597
26598 @item -mea32
26599 @itemx -mea64
26600 @opindex mea32
26601 @opindex mea64
26602 Compile code assuming that pointers to the PPU address space accessed
26603 via the @code{__ea} named address space qualifier are either 32 or 64
26604 bits wide. The default is 32 bits. As this is an ABI-changing option,
26605 all object code in an executable must be compiled with the same setting.
26606
26607 @item -maddress-space-conversion
26608 @itemx -mno-address-space-conversion
26609 @opindex maddress-space-conversion
26610 @opindex mno-address-space-conversion
26611 Allow/disallow treating the @code{__ea} address space as superset
26612 of the generic address space. This enables explicit type casts
26613 between @code{__ea} and generic pointer as well as implicit
26614 conversions of generic pointers to @code{__ea} pointers. The
26615 default is to allow address space pointer conversions.
26616
26617 @item -mcache-size=@var{cache-size}
26618 @opindex mcache-size
26619 This option controls the version of libgcc that the compiler links to an
26620 executable and selects a software-managed cache for accessing variables
26621 in the @code{__ea} address space with a particular cache size. Possible
26622 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26623 and @samp{128}. The default cache size is 64KB.
26624
26625 @item -matomic-updates
26626 @itemx -mno-atomic-updates
26627 @opindex matomic-updates
26628 @opindex mno-atomic-updates
26629 This option controls the version of libgcc that the compiler links to an
26630 executable and selects whether atomic updates to the software-managed
26631 cache of PPU-side variables are used. If you use atomic updates, changes
26632 to a PPU variable from SPU code using the @code{__ea} named address space
26633 qualifier do not interfere with changes to other PPU variables residing
26634 in the same cache line from PPU code. If you do not use atomic updates,
26635 such interference may occur; however, writing back cache lines is
26636 more efficient. The default behavior is to use atomic updates.
26637
26638 @item -mdual-nops
26639 @itemx -mdual-nops=@var{n}
26640 @opindex mdual-nops
26641 By default, GCC inserts NOPs to increase dual issue when it expects
26642 it to increase performance. @var{n} can be a value from 0 to 10. A
26643 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26644 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26645
26646 @item -mhint-max-nops=@var{n}
26647 @opindex mhint-max-nops
26648 Maximum number of NOPs to insert for a branch hint. A branch hint must
26649 be at least 8 instructions away from the branch it is affecting. GCC
26650 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26651 generate the branch hint.
26652
26653 @item -mhint-max-distance=@var{n}
26654 @opindex mhint-max-distance
26655 The encoding of the branch hint instruction limits the hint to be within
26656 256 instructions of the branch it is affecting. By default, GCC makes
26657 sure it is within 125.
26658
26659 @item -msafe-hints
26660 @opindex msafe-hints
26661 Work around a hardware bug that causes the SPU to stall indefinitely.
26662 By default, GCC inserts the @code{hbrp} instruction to make sure
26663 this stall won't happen.
26664
26665 @end table
26666
26667 @node System V Options
26668 @subsection Options for System V
26669
26670 These additional options are available on System V Release 4 for
26671 compatibility with other compilers on those systems:
26672
26673 @table @gcctabopt
26674 @item -G
26675 @opindex G
26676 Create a shared object.
26677 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26678
26679 @item -Qy
26680 @opindex Qy
26681 Identify the versions of each tool used by the compiler, in a
26682 @code{.ident} assembler directive in the output.
26683
26684 @item -Qn
26685 @opindex Qn
26686 Refrain from adding @code{.ident} directives to the output file (this is
26687 the default).
26688
26689 @item -YP,@var{dirs}
26690 @opindex YP
26691 Search the directories @var{dirs}, and no others, for libraries
26692 specified with @option{-l}.
26693
26694 @item -Ym,@var{dir}
26695 @opindex Ym
26696 Look in the directory @var{dir} to find the M4 preprocessor.
26697 The assembler uses this option.
26698 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26699 @c the generic assembler that comes with Solaris takes just -Ym.
26700 @end table
26701
26702 @node TILE-Gx Options
26703 @subsection TILE-Gx Options
26704 @cindex TILE-Gx options
26705
26706 These @samp{-m} options are supported on the TILE-Gx:
26707
26708 @table @gcctabopt
26709 @item -mcmodel=small
26710 @opindex mcmodel=small
26711 Generate code for the small model. The distance for direct calls is
26712 limited to 500M in either direction. PC-relative addresses are 32
26713 bits. Absolute addresses support the full address range.
26714
26715 @item -mcmodel=large
26716 @opindex mcmodel=large
26717 Generate code for the large model. There is no limitation on call
26718 distance, pc-relative addresses, or absolute addresses.
26719
26720 @item -mcpu=@var{name}
26721 @opindex mcpu
26722 Selects the type of CPU to be targeted. Currently the only supported
26723 type is @samp{tilegx}.
26724
26725 @item -m32
26726 @itemx -m64
26727 @opindex m32
26728 @opindex m64
26729 Generate code for a 32-bit or 64-bit environment. The 32-bit
26730 environment sets int, long, and pointer to 32 bits. The 64-bit
26731 environment sets int to 32 bits and long and pointer to 64 bits.
26732
26733 @item -mbig-endian
26734 @itemx -mlittle-endian
26735 @opindex mbig-endian
26736 @opindex mlittle-endian
26737 Generate code in big/little endian mode, respectively.
26738 @end table
26739
26740 @node TILEPro Options
26741 @subsection TILEPro Options
26742 @cindex TILEPro options
26743
26744 These @samp{-m} options are supported on the TILEPro:
26745
26746 @table @gcctabopt
26747 @item -mcpu=@var{name}
26748 @opindex mcpu
26749 Selects the type of CPU to be targeted. Currently the only supported
26750 type is @samp{tilepro}.
26751
26752 @item -m32
26753 @opindex m32
26754 Generate code for a 32-bit environment, which sets int, long, and
26755 pointer to 32 bits. This is the only supported behavior so the flag
26756 is essentially ignored.
26757 @end table
26758
26759 @node V850 Options
26760 @subsection V850 Options
26761 @cindex V850 Options
26762
26763 These @samp{-m} options are defined for V850 implementations:
26764
26765 @table @gcctabopt
26766 @item -mlong-calls
26767 @itemx -mno-long-calls
26768 @opindex mlong-calls
26769 @opindex mno-long-calls
26770 Treat all calls as being far away (near). If calls are assumed to be
26771 far away, the compiler always loads the function's address into a
26772 register, and calls indirect through the pointer.
26773
26774 @item -mno-ep
26775 @itemx -mep
26776 @opindex mno-ep
26777 @opindex mep
26778 Do not optimize (do optimize) basic blocks that use the same index
26779 pointer 4 or more times to copy pointer into the @code{ep} register, and
26780 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26781 option is on by default if you optimize.
26782
26783 @item -mno-prolog-function
26784 @itemx -mprolog-function
26785 @opindex mno-prolog-function
26786 @opindex mprolog-function
26787 Do not use (do use) external functions to save and restore registers
26788 at the prologue and epilogue of a function. The external functions
26789 are slower, but use less code space if more than one function saves
26790 the same number of registers. The @option{-mprolog-function} option
26791 is on by default if you optimize.
26792
26793 @item -mspace
26794 @opindex mspace
26795 Try to make the code as small as possible. At present, this just turns
26796 on the @option{-mep} and @option{-mprolog-function} options.
26797
26798 @item -mtda=@var{n}
26799 @opindex mtda
26800 Put static or global variables whose size is @var{n} bytes or less into
26801 the tiny data area that register @code{ep} points to. The tiny data
26802 area can hold up to 256 bytes in total (128 bytes for byte references).
26803
26804 @item -msda=@var{n}
26805 @opindex msda
26806 Put static or global variables whose size is @var{n} bytes or less into
26807 the small data area that register @code{gp} points to. The small data
26808 area can hold up to 64 kilobytes.
26809
26810 @item -mzda=@var{n}
26811 @opindex mzda
26812 Put static or global variables whose size is @var{n} bytes or less into
26813 the first 32 kilobytes of memory.
26814
26815 @item -mv850
26816 @opindex mv850
26817 Specify that the target processor is the V850.
26818
26819 @item -mv850e3v5
26820 @opindex mv850e3v5
26821 Specify that the target processor is the V850E3V5. The preprocessor
26822 constant @code{__v850e3v5__} is defined if this option is used.
26823
26824 @item -mv850e2v4
26825 @opindex mv850e2v4
26826 Specify that the target processor is the V850E3V5. This is an alias for
26827 the @option{-mv850e3v5} option.
26828
26829 @item -mv850e2v3
26830 @opindex mv850e2v3
26831 Specify that the target processor is the V850E2V3. The preprocessor
26832 constant @code{__v850e2v3__} is defined if this option is used.
26833
26834 @item -mv850e2
26835 @opindex mv850e2
26836 Specify that the target processor is the V850E2. The preprocessor
26837 constant @code{__v850e2__} is defined if this option is used.
26838
26839 @item -mv850e1
26840 @opindex mv850e1
26841 Specify that the target processor is the V850E1. The preprocessor
26842 constants @code{__v850e1__} and @code{__v850e__} are defined if
26843 this option is used.
26844
26845 @item -mv850es
26846 @opindex mv850es
26847 Specify that the target processor is the V850ES. This is an alias for
26848 the @option{-mv850e1} option.
26849
26850 @item -mv850e
26851 @opindex mv850e
26852 Specify that the target processor is the V850E@. The preprocessor
26853 constant @code{__v850e__} is defined if this option is used.
26854
26855 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26856 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26857 are defined then a default target processor is chosen and the
26858 relevant @samp{__v850*__} preprocessor constant is defined.
26859
26860 The preprocessor constants @code{__v850} and @code{__v851__} are always
26861 defined, regardless of which processor variant is the target.
26862
26863 @item -mdisable-callt
26864 @itemx -mno-disable-callt
26865 @opindex mdisable-callt
26866 @opindex mno-disable-callt
26867 This option suppresses generation of the @code{CALLT} instruction for the
26868 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26869 architecture.
26870
26871 This option is enabled by default when the RH850 ABI is
26872 in use (see @option{-mrh850-abi}), and disabled by default when the
26873 GCC ABI is in use. If @code{CALLT} instructions are being generated
26874 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26875
26876 @item -mrelax
26877 @itemx -mno-relax
26878 @opindex mrelax
26879 @opindex mno-relax
26880 Pass on (or do not pass on) the @option{-mrelax} command-line option
26881 to the assembler.
26882
26883 @item -mlong-jumps
26884 @itemx -mno-long-jumps
26885 @opindex mlong-jumps
26886 @opindex mno-long-jumps
26887 Disable (or re-enable) the generation of PC-relative jump instructions.
26888
26889 @item -msoft-float
26890 @itemx -mhard-float
26891 @opindex msoft-float
26892 @opindex mhard-float
26893 Disable (or re-enable) the generation of hardware floating point
26894 instructions. This option is only significant when the target
26895 architecture is @samp{V850E2V3} or higher. If hardware floating point
26896 instructions are being generated then the C preprocessor symbol
26897 @code{__FPU_OK__} is defined, otherwise the symbol
26898 @code{__NO_FPU__} is defined.
26899
26900 @item -mloop
26901 @opindex mloop
26902 Enables the use of the e3v5 LOOP instruction. The use of this
26903 instruction is not enabled by default when the e3v5 architecture is
26904 selected because its use is still experimental.
26905
26906 @item -mrh850-abi
26907 @itemx -mghs
26908 @opindex mrh850-abi
26909 @opindex mghs
26910 Enables support for the RH850 version of the V850 ABI. This is the
26911 default. With this version of the ABI the following rules apply:
26912
26913 @itemize
26914 @item
26915 Integer sized structures and unions are returned via a memory pointer
26916 rather than a register.
26917
26918 @item
26919 Large structures and unions (more than 8 bytes in size) are passed by
26920 value.
26921
26922 @item
26923 Functions are aligned to 16-bit boundaries.
26924
26925 @item
26926 The @option{-m8byte-align} command-line option is supported.
26927
26928 @item
26929 The @option{-mdisable-callt} command-line option is enabled by
26930 default. The @option{-mno-disable-callt} command-line option is not
26931 supported.
26932 @end itemize
26933
26934 When this version of the ABI is enabled the C preprocessor symbol
26935 @code{__V850_RH850_ABI__} is defined.
26936
26937 @item -mgcc-abi
26938 @opindex mgcc-abi
26939 Enables support for the old GCC version of the V850 ABI. With this
26940 version of the ABI the following rules apply:
26941
26942 @itemize
26943 @item
26944 Integer sized structures and unions are returned in register @code{r10}.
26945
26946 @item
26947 Large structures and unions (more than 8 bytes in size) are passed by
26948 reference.
26949
26950 @item
26951 Functions are aligned to 32-bit boundaries, unless optimizing for
26952 size.
26953
26954 @item
26955 The @option{-m8byte-align} command-line option is not supported.
26956
26957 @item
26958 The @option{-mdisable-callt} command-line option is supported but not
26959 enabled by default.
26960 @end itemize
26961
26962 When this version of the ABI is enabled the C preprocessor symbol
26963 @code{__V850_GCC_ABI__} is defined.
26964
26965 @item -m8byte-align
26966 @itemx -mno-8byte-align
26967 @opindex m8byte-align
26968 @opindex mno-8byte-align
26969 Enables support for @code{double} and @code{long long} types to be
26970 aligned on 8-byte boundaries. The default is to restrict the
26971 alignment of all objects to at most 4-bytes. When
26972 @option{-m8byte-align} is in effect the C preprocessor symbol
26973 @code{__V850_8BYTE_ALIGN__} is defined.
26974
26975 @item -mbig-switch
26976 @opindex mbig-switch
26977 Generate code suitable for big switch tables. Use this option only if
26978 the assembler/linker complain about out of range branches within a switch
26979 table.
26980
26981 @item -mapp-regs
26982 @opindex mapp-regs
26983 This option causes r2 and r5 to be used in the code generated by
26984 the compiler. This setting is the default.
26985
26986 @item -mno-app-regs
26987 @opindex mno-app-regs
26988 This option causes r2 and r5 to be treated as fixed registers.
26989
26990 @end table
26991
26992 @node VAX Options
26993 @subsection VAX Options
26994 @cindex VAX options
26995
26996 These @samp{-m} options are defined for the VAX:
26997
26998 @table @gcctabopt
26999 @item -munix
27000 @opindex munix
27001 Do not output certain jump instructions (@code{aobleq} and so on)
27002 that the Unix assembler for the VAX cannot handle across long
27003 ranges.
27004
27005 @item -mgnu
27006 @opindex mgnu
27007 Do output those jump instructions, on the assumption that the
27008 GNU assembler is being used.
27009
27010 @item -mg
27011 @opindex mg
27012 Output code for G-format floating-point numbers instead of D-format.
27013 @end table
27014
27015 @node Visium Options
27016 @subsection Visium Options
27017 @cindex Visium options
27018
27019 @table @gcctabopt
27020
27021 @item -mdebug
27022 @opindex mdebug
27023 A program which performs file I/O and is destined to run on an MCM target
27024 should be linked with this option. It causes the libraries libc.a and
27025 libdebug.a to be linked. The program should be run on the target under
27026 the control of the GDB remote debugging stub.
27027
27028 @item -msim
27029 @opindex msim
27030 A program which performs file I/O and is destined to run on the simulator
27031 should be linked with option. This causes libraries libc.a and libsim.a to
27032 be linked.
27033
27034 @item -mfpu
27035 @itemx -mhard-float
27036 @opindex mfpu
27037 @opindex mhard-float
27038 Generate code containing floating-point instructions. This is the
27039 default.
27040
27041 @item -mno-fpu
27042 @itemx -msoft-float
27043 @opindex mno-fpu
27044 @opindex msoft-float
27045 Generate code containing library calls for floating-point.
27046
27047 @option{-msoft-float} changes the calling convention in the output file;
27048 therefore, it is only useful if you compile @emph{all} of a program with
27049 this option. In particular, you need to compile @file{libgcc.a}, the
27050 library that comes with GCC, with @option{-msoft-float} in order for
27051 this to work.
27052
27053 @item -mcpu=@var{cpu_type}
27054 @opindex mcpu
27055 Set the instruction set, register set, and instruction scheduling parameters
27056 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27057 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27058
27059 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27060
27061 By default (unless configured otherwise), GCC generates code for the GR5
27062 variant of the Visium architecture.
27063
27064 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27065 architecture. The only difference from GR5 code is that the compiler will
27066 generate block move instructions.
27067
27068 @item -mtune=@var{cpu_type}
27069 @opindex mtune
27070 Set the instruction scheduling parameters for machine type @var{cpu_type},
27071 but do not set the instruction set or register set that the option
27072 @option{-mcpu=@var{cpu_type}} would.
27073
27074 @item -msv-mode
27075 @opindex msv-mode
27076 Generate code for the supervisor mode, where there are no restrictions on
27077 the access to general registers. This is the default.
27078
27079 @item -muser-mode
27080 @opindex muser-mode
27081 Generate code for the user mode, where the access to some general registers
27082 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27083 mode; on the GR6, only registers r29 to r31 are affected.
27084 @end table
27085
27086 @node VMS Options
27087 @subsection VMS Options
27088
27089 These @samp{-m} options are defined for the VMS implementations:
27090
27091 @table @gcctabopt
27092 @item -mvms-return-codes
27093 @opindex mvms-return-codes
27094 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27095 condition (e.g.@: error) codes.
27096
27097 @item -mdebug-main=@var{prefix}
27098 @opindex mdebug-main=@var{prefix}
27099 Flag the first routine whose name starts with @var{prefix} as the main
27100 routine for the debugger.
27101
27102 @item -mmalloc64
27103 @opindex mmalloc64
27104 Default to 64-bit memory allocation routines.
27105
27106 @item -mpointer-size=@var{size}
27107 @opindex mpointer-size=@var{size}
27108 Set the default size of pointers. Possible options for @var{size} are
27109 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27110 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27111 The later option disables @code{pragma pointer_size}.
27112 @end table
27113
27114 @node VxWorks Options
27115 @subsection VxWorks Options
27116 @cindex VxWorks Options
27117
27118 The options in this section are defined for all VxWorks targets.
27119 Options specific to the target hardware are listed with the other
27120 options for that target.
27121
27122 @table @gcctabopt
27123 @item -mrtp
27124 @opindex mrtp
27125 GCC can generate code for both VxWorks kernels and real time processes
27126 (RTPs). This option switches from the former to the latter. It also
27127 defines the preprocessor macro @code{__RTP__}.
27128
27129 @item -non-static
27130 @opindex non-static
27131 Link an RTP executable against shared libraries rather than static
27132 libraries. The options @option{-static} and @option{-shared} can
27133 also be used for RTPs (@pxref{Link Options}); @option{-static}
27134 is the default.
27135
27136 @item -Bstatic
27137 @itemx -Bdynamic
27138 @opindex Bstatic
27139 @opindex Bdynamic
27140 These options are passed down to the linker. They are defined for
27141 compatibility with Diab.
27142
27143 @item -Xbind-lazy
27144 @opindex Xbind-lazy
27145 Enable lazy binding of function calls. This option is equivalent to
27146 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27147
27148 @item -Xbind-now
27149 @opindex Xbind-now
27150 Disable lazy binding of function calls. This option is the default and
27151 is defined for compatibility with Diab.
27152 @end table
27153
27154 @node x86 Options
27155 @subsection x86 Options
27156 @cindex x86 Options
27157
27158 These @samp{-m} options are defined for the x86 family of computers.
27159
27160 @table @gcctabopt
27161
27162 @item -march=@var{cpu-type}
27163 @opindex march
27164 Generate instructions for the machine type @var{cpu-type}. In contrast to
27165 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27166 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27167 to generate code that may not run at all on processors other than the one
27168 indicated. Specifying @option{-march=@var{cpu-type}} implies
27169 @option{-mtune=@var{cpu-type}}.
27170
27171 The choices for @var{cpu-type} are:
27172
27173 @table @samp
27174 @item native
27175 This selects the CPU to generate code for at compilation time by determining
27176 the processor type of the compiling machine. Using @option{-march=native}
27177 enables all instruction subsets supported by the local machine (hence
27178 the result might not run on different machines). Using @option{-mtune=native}
27179 produces code optimized for the local machine under the constraints
27180 of the selected instruction set.
27181
27182 @item x86-64
27183 A generic CPU with 64-bit extensions.
27184
27185 @item i386
27186 Original Intel i386 CPU@.
27187
27188 @item i486
27189 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27190
27191 @item i586
27192 @itemx pentium
27193 Intel Pentium CPU with no MMX support.
27194
27195 @item lakemont
27196 Intel Lakemont MCU, based on Intel Pentium CPU.
27197
27198 @item pentium-mmx
27199 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27200
27201 @item pentiumpro
27202 Intel Pentium Pro CPU@.
27203
27204 @item i686
27205 When used with @option{-march}, the Pentium Pro
27206 instruction set is used, so the code runs on all i686 family chips.
27207 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27208
27209 @item pentium2
27210 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27211 support.
27212
27213 @item pentium3
27214 @itemx pentium3m
27215 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27216 set support.
27217
27218 @item pentium-m
27219 Intel Pentium M; low-power version of Intel Pentium III CPU
27220 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27221
27222 @item pentium4
27223 @itemx pentium4m
27224 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27225
27226 @item prescott
27227 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27228 set support.
27229
27230 @item nocona
27231 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27232 SSE2 and SSE3 instruction set support.
27233
27234 @item core2
27235 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27236 instruction set support.
27237
27238 @item nehalem
27239 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27240 SSE4.1, SSE4.2 and POPCNT instruction set support.
27241
27242 @item westmere
27243 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27244 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27245
27246 @item sandybridge
27247 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27248 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27249
27250 @item ivybridge
27251 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27252 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27253 instruction set support.
27254
27255 @item haswell
27256 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27257 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27258 BMI, BMI2 and F16C instruction set support.
27259
27260 @item broadwell
27261 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27262 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27263 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27264
27265 @item skylake
27266 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27267 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27268 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27269 XSAVES instruction set support.
27270
27271 @item bonnell
27272 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27273 instruction set support.
27274
27275 @item silvermont
27276 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27277 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27278
27279 @item goldmont
27280 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27281 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27282 instruction set support.
27283
27284 @item goldmont-plus
27285 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27286 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27287 PTWRITE, RDPID, SGX and UMIP instruction set support.
27288
27289 @item tremont
27290 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27291 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27292 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27293
27294 @item knl
27295 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27296 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27297 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27298 AVX512CD instruction set support.
27299
27300 @item knm
27301 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27302 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27303 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27304 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27305
27306 @item skylake-avx512
27307 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27308 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27309 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27310 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27311
27312 @item cannonlake
27313 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27314 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27315 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27316 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27317 AVX512IFMA, SHA and UMIP instruction set support.
27318
27319 @item icelake-client
27320 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27321 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27322 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27323 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27324 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27325 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27326
27327 @item icelake-server
27328 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27329 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27330 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27331 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27332 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27333 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27334 set support.
27335
27336 @item cascadelake
27337 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27338 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27339 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27340 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27341
27342 @item k6
27343 AMD K6 CPU with MMX instruction set support.
27344
27345 @item k6-2
27346 @itemx k6-3
27347 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27348
27349 @item athlon
27350 @itemx athlon-tbird
27351 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27352 support.
27353
27354 @item athlon-4
27355 @itemx athlon-xp
27356 @itemx athlon-mp
27357 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27358 instruction set support.
27359
27360 @item k8
27361 @itemx opteron
27362 @itemx athlon64
27363 @itemx athlon-fx
27364 Processors based on the AMD K8 core with x86-64 instruction set support,
27365 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27366 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27367 instruction set extensions.)
27368
27369 @item k8-sse3
27370 @itemx opteron-sse3
27371 @itemx athlon64-sse3
27372 Improved versions of AMD K8 cores with SSE3 instruction set support.
27373
27374 @item amdfam10
27375 @itemx barcelona
27376 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27377 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27378 instruction set extensions.)
27379
27380 @item bdver1
27381 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27382 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27383 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27384 @item bdver2
27385 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27386 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27387 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27388 extensions.)
27389 @item bdver3
27390 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27391 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27392 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27393 64-bit instruction set extensions.
27394 @item bdver4
27395 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27396 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27397 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27398 SSE4.2, ABM and 64-bit instruction set extensions.
27399
27400 @item znver1
27401 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27402 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27403 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27404 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27405 instruction set extensions.
27406 @item znver2
27407 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27408 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27409 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27410 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27411 instruction set extensions.)
27412
27413
27414 @item btver1
27415 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27416 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27417 instruction set extensions.)
27418
27419 @item btver2
27420 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27421 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27422 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27423
27424 @item winchip-c6
27425 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27426 set support.
27427
27428 @item winchip2
27429 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27430 instruction set support.
27431
27432 @item c3
27433 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27434 (No scheduling is implemented for this chip.)
27435
27436 @item c3-2
27437 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27438 (No scheduling is implemented for this chip.)
27439
27440 @item c7
27441 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27442 (No scheduling is implemented for this chip.)
27443
27444 @item samuel-2
27445 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27446 (No scheduling is implemented for this chip.)
27447
27448 @item nehemiah
27449 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27450 (No scheduling is implemented for this chip.)
27451
27452 @item esther
27453 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27454 (No scheduling is implemented for this chip.)
27455
27456 @item eden-x2
27457 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27458 (No scheduling is implemented for this chip.)
27459
27460 @item eden-x4
27461 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27462 AVX and AVX2 instruction set support.
27463 (No scheduling is implemented for this chip.)
27464
27465 @item nano
27466 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27467 instruction set support.
27468 (No scheduling is implemented for this chip.)
27469
27470 @item nano-1000
27471 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27472 instruction set support.
27473 (No scheduling is implemented for this chip.)
27474
27475 @item nano-2000
27476 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27477 instruction set support.
27478 (No scheduling is implemented for this chip.)
27479
27480 @item nano-3000
27481 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27482 instruction set support.
27483 (No scheduling is implemented for this chip.)
27484
27485 @item nano-x2
27486 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27487 instruction set support.
27488 (No scheduling is implemented for this chip.)
27489
27490 @item nano-x4
27491 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27492 instruction set support.
27493 (No scheduling is implemented for this chip.)
27494
27495 @item geode
27496 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27497 @end table
27498
27499 @item -mtune=@var{cpu-type}
27500 @opindex mtune
27501 Tune to @var{cpu-type} everything applicable about the generated code, except
27502 for the ABI and the set of available instructions.
27503 While picking a specific @var{cpu-type} schedules things appropriately
27504 for that particular chip, the compiler does not generate any code that
27505 cannot run on the default machine type unless you use a
27506 @option{-march=@var{cpu-type}} option.
27507 For example, if GCC is configured for i686-pc-linux-gnu
27508 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27509 but still runs on i686 machines.
27510
27511 The choices for @var{cpu-type} are the same as for @option{-march}.
27512 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27513
27514 @table @samp
27515 @item generic
27516 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27517 If you know the CPU on which your code will run, then you should use
27518 the corresponding @option{-mtune} or @option{-march} option instead of
27519 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27520 of your application will have, then you should use this option.
27521
27522 As new processors are deployed in the marketplace, the behavior of this
27523 option will change. Therefore, if you upgrade to a newer version of
27524 GCC, code generation controlled by this option will change to reflect
27525 the processors
27526 that are most common at the time that version of GCC is released.
27527
27528 There is no @option{-march=generic} option because @option{-march}
27529 indicates the instruction set the compiler can use, and there is no
27530 generic instruction set applicable to all processors. In contrast,
27531 @option{-mtune} indicates the processor (or, in this case, collection of
27532 processors) for which the code is optimized.
27533
27534 @item intel
27535 Produce code optimized for the most current Intel processors, which are
27536 Haswell and Silvermont for this version of GCC. If you know the CPU
27537 on which your code will run, then you should use the corresponding
27538 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27539 But, if you want your application performs better on both Haswell and
27540 Silvermont, then you should use this option.
27541
27542 As new Intel processors are deployed in the marketplace, the behavior of
27543 this option will change. Therefore, if you upgrade to a newer version of
27544 GCC, code generation controlled by this option will change to reflect
27545 the most current Intel processors at the time that version of GCC is
27546 released.
27547
27548 There is no @option{-march=intel} option because @option{-march} indicates
27549 the instruction set the compiler can use, and there is no common
27550 instruction set applicable to all processors. In contrast,
27551 @option{-mtune} indicates the processor (or, in this case, collection of
27552 processors) for which the code is optimized.
27553 @end table
27554
27555 @item -mcpu=@var{cpu-type}
27556 @opindex mcpu
27557 A deprecated synonym for @option{-mtune}.
27558
27559 @item -mfpmath=@var{unit}
27560 @opindex mfpmath
27561 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27562 for @var{unit} are:
27563
27564 @table @samp
27565 @item 387
27566 Use the standard 387 floating-point coprocessor present on the majority of chips and
27567 emulated otherwise. Code compiled with this option runs almost everywhere.
27568 The temporary results are computed in 80-bit precision instead of the precision
27569 specified by the type, resulting in slightly different results compared to most
27570 of other chips. See @option{-ffloat-store} for more detailed description.
27571
27572 This is the default choice for non-Darwin x86-32 targets.
27573
27574 @item sse
27575 Use scalar floating-point instructions present in the SSE instruction set.
27576 This instruction set is supported by Pentium III and newer chips,
27577 and in the AMD line
27578 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27579 instruction set supports only single-precision arithmetic, thus the double and
27580 extended-precision arithmetic are still done using 387. A later version, present
27581 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27582 arithmetic too.
27583
27584 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27585 or @option{-msse2} switches to enable SSE extensions and make this option
27586 effective. For the x86-64 compiler, these extensions are enabled by default.
27587
27588 The resulting code should be considerably faster in the majority of cases and avoid
27589 the numerical instability problems of 387 code, but may break some existing
27590 code that expects temporaries to be 80 bits.
27591
27592 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27593 and the default choice for x86-32 targets with the SSE2 instruction set
27594 when @option{-ffast-math} is enabled.
27595
27596 @item sse,387
27597 @itemx sse+387
27598 @itemx both
27599 Attempt to utilize both instruction sets at once. This effectively doubles the
27600 amount of available registers, and on chips with separate execution units for
27601 387 and SSE the execution resources too. Use this option with care, as it is
27602 still experimental, because the GCC register allocator does not model separate
27603 functional units well, resulting in unstable performance.
27604 @end table
27605
27606 @item -masm=@var{dialect}
27607 @opindex masm=@var{dialect}
27608 Output assembly instructions using selected @var{dialect}. Also affects
27609 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27610 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27611 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27612 not support @samp{intel}.
27613
27614 @item -mieee-fp
27615 @itemx -mno-ieee-fp
27616 @opindex mieee-fp
27617 @opindex mno-ieee-fp
27618 Control whether or not the compiler uses IEEE floating-point
27619 comparisons. These correctly handle the case where the result of a
27620 comparison is unordered.
27621
27622 @item -m80387
27623 @itemx -mhard-float
27624 @opindex 80387
27625 @opindex mhard-float
27626 Generate output containing 80387 instructions for floating point.
27627
27628 @item -mno-80387
27629 @itemx -msoft-float
27630 @opindex no-80387
27631 @opindex msoft-float
27632 Generate output containing library calls for floating point.
27633
27634 @strong{Warning:} the requisite libraries are not part of GCC@.
27635 Normally the facilities of the machine's usual C compiler are used, but
27636 this cannot be done directly in cross-compilation. You must make your
27637 own arrangements to provide suitable library functions for
27638 cross-compilation.
27639
27640 On machines where a function returns floating-point results in the 80387
27641 register stack, some floating-point opcodes may be emitted even if
27642 @option{-msoft-float} is used.
27643
27644 @item -mno-fp-ret-in-387
27645 @opindex mno-fp-ret-in-387
27646 @opindex mfp-ret-in-387
27647 Do not use the FPU registers for return values of functions.
27648
27649 The usual calling convention has functions return values of types
27650 @code{float} and @code{double} in an FPU register, even if there
27651 is no FPU@. The idea is that the operating system should emulate
27652 an FPU@.
27653
27654 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27655 in ordinary CPU registers instead.
27656
27657 @item -mno-fancy-math-387
27658 @opindex mno-fancy-math-387
27659 @opindex mfancy-math-387
27660 Some 387 emulators do not support the @code{sin}, @code{cos} and
27661 @code{sqrt} instructions for the 387. Specify this option to avoid
27662 generating those instructions.
27663 This option is overridden when @option{-march}
27664 indicates that the target CPU always has an FPU and so the
27665 instruction does not need emulation. These
27666 instructions are not generated unless you also use the
27667 @option{-funsafe-math-optimizations} switch.
27668
27669 @item -malign-double
27670 @itemx -mno-align-double
27671 @opindex malign-double
27672 @opindex mno-align-double
27673 Control whether GCC aligns @code{double}, @code{long double}, and
27674 @code{long long} variables on a two-word boundary or a one-word
27675 boundary. Aligning @code{double} variables on a two-word boundary
27676 produces code that runs somewhat faster on a Pentium at the
27677 expense of more memory.
27678
27679 On x86-64, @option{-malign-double} is enabled by default.
27680
27681 @strong{Warning:} if you use the @option{-malign-double} switch,
27682 structures containing the above types are aligned differently than
27683 the published application binary interface specifications for the x86-32
27684 and are not binary compatible with structures in code compiled
27685 without that switch.
27686
27687 @item -m96bit-long-double
27688 @itemx -m128bit-long-double
27689 @opindex m96bit-long-double
27690 @opindex m128bit-long-double
27691 These switches control the size of @code{long double} type. The x86-32
27692 application binary interface specifies the size to be 96 bits,
27693 so @option{-m96bit-long-double} is the default in 32-bit mode.
27694
27695 Modern architectures (Pentium and newer) prefer @code{long double}
27696 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27697 conforming to the ABI, this is not possible. So specifying
27698 @option{-m128bit-long-double} aligns @code{long double}
27699 to a 16-byte boundary by padding the @code{long double} with an additional
27700 32-bit zero.
27701
27702 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27703 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27704
27705 Notice that neither of these options enable any extra precision over the x87
27706 standard of 80 bits for a @code{long double}.
27707
27708 @strong{Warning:} if you override the default value for your target ABI, this
27709 changes the size of
27710 structures and arrays containing @code{long double} variables,
27711 as well as modifying the function calling convention for functions taking
27712 @code{long double}. Hence they are not binary-compatible
27713 with code compiled without that switch.
27714
27715 @item -mlong-double-64
27716 @itemx -mlong-double-80
27717 @itemx -mlong-double-128
27718 @opindex mlong-double-64
27719 @opindex mlong-double-80
27720 @opindex mlong-double-128
27721 These switches control the size of @code{long double} type. A size
27722 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27723 type. This is the default for 32-bit Bionic C library. A size
27724 of 128 bits makes the @code{long double} type equivalent to the
27725 @code{__float128} type. This is the default for 64-bit Bionic C library.
27726
27727 @strong{Warning:} if you override the default value for your target ABI, this
27728 changes the size of
27729 structures and arrays containing @code{long double} variables,
27730 as well as modifying the function calling convention for functions taking
27731 @code{long double}. Hence they are not binary-compatible
27732 with code compiled without that switch.
27733
27734 @item -malign-data=@var{type}
27735 @opindex malign-data
27736 Control how GCC aligns variables. Supported values for @var{type} are
27737 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27738 and earlier, @samp{abi} uses alignment value as specified by the
27739 psABI, and @samp{cacheline} uses increased alignment value to match
27740 the cache line size. @samp{compat} is the default.
27741
27742 @item -mlarge-data-threshold=@var{threshold}
27743 @opindex mlarge-data-threshold
27744 When @option{-mcmodel=medium} is specified, data objects larger than
27745 @var{threshold} are placed in the large data section. This value must be the
27746 same across all objects linked into the binary, and defaults to 65535.
27747
27748 @item -mrtd
27749 @opindex mrtd
27750 Use a different function-calling convention, in which functions that
27751 take a fixed number of arguments return with the @code{ret @var{num}}
27752 instruction, which pops their arguments while returning. This saves one
27753 instruction in the caller since there is no need to pop the arguments
27754 there.
27755
27756 You can specify that an individual function is called with this calling
27757 sequence with the function attribute @code{stdcall}. You can also
27758 override the @option{-mrtd} option by using the function attribute
27759 @code{cdecl}. @xref{Function Attributes}.
27760
27761 @strong{Warning:} this calling convention is incompatible with the one
27762 normally used on Unix, so you cannot use it if you need to call
27763 libraries compiled with the Unix compiler.
27764
27765 Also, you must provide function prototypes for all functions that
27766 take variable numbers of arguments (including @code{printf});
27767 otherwise incorrect code is generated for calls to those
27768 functions.
27769
27770 In addition, seriously incorrect code results if you call a
27771 function with too many arguments. (Normally, extra arguments are
27772 harmlessly ignored.)
27773
27774 @item -mregparm=@var{num}
27775 @opindex mregparm
27776 Control how many registers are used to pass integer arguments. By
27777 default, no registers are used to pass arguments, and at most 3
27778 registers can be used. You can control this behavior for a specific
27779 function by using the function attribute @code{regparm}.
27780 @xref{Function Attributes}.
27781
27782 @strong{Warning:} if you use this switch, and
27783 @var{num} is nonzero, then you must build all modules with the same
27784 value, including any libraries. This includes the system libraries and
27785 startup modules.
27786
27787 @item -msseregparm
27788 @opindex msseregparm
27789 Use SSE register passing conventions for float and double arguments
27790 and return values. You can control this behavior for a specific
27791 function by using the function attribute @code{sseregparm}.
27792 @xref{Function Attributes}.
27793
27794 @strong{Warning:} if you use this switch then you must build all
27795 modules with the same value, including any libraries. This includes
27796 the system libraries and startup modules.
27797
27798 @item -mvect8-ret-in-mem
27799 @opindex mvect8-ret-in-mem
27800 Return 8-byte vectors in memory instead of MMX registers. This is the
27801 default on VxWorks to match the ABI of the Sun Studio compilers until
27802 version 12. @emph{Only} use this option if you need to remain
27803 compatible with existing code produced by those previous compiler
27804 versions or older versions of GCC@.
27805
27806 @item -mpc32
27807 @itemx -mpc64
27808 @itemx -mpc80
27809 @opindex mpc32
27810 @opindex mpc64
27811 @opindex mpc80
27812
27813 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27814 is specified, the significands of results of floating-point operations are
27815 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27816 significands of results of floating-point operations to 53 bits (double
27817 precision) and @option{-mpc80} rounds the significands of results of
27818 floating-point operations to 64 bits (extended double precision), which is
27819 the default. When this option is used, floating-point operations in higher
27820 precisions are not available to the programmer without setting the FPU
27821 control word explicitly.
27822
27823 Setting the rounding of floating-point operations to less than the default
27824 80 bits can speed some programs by 2% or more. Note that some mathematical
27825 libraries assume that extended-precision (80-bit) floating-point operations
27826 are enabled by default; routines in such libraries could suffer significant
27827 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27828 when this option is used to set the precision to less than extended precision.
27829
27830 @item -mstackrealign
27831 @opindex mstackrealign
27832 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27833 option generates an alternate prologue and epilogue that realigns the
27834 run-time stack if necessary. This supports mixing legacy codes that keep
27835 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27836 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27837 applicable to individual functions.
27838
27839 @item -mpreferred-stack-boundary=@var{num}
27840 @opindex mpreferred-stack-boundary
27841 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27842 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27843 the default is 4 (16 bytes or 128 bits).
27844
27845 @strong{Warning:} When generating code for the x86-64 architecture with
27846 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27847 used to keep the stack boundary aligned to 8 byte boundary. Since
27848 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27849 intended to be used in controlled environment where stack space is
27850 important limitation. This option leads to wrong code when functions
27851 compiled with 16 byte stack alignment (such as functions from a standard
27852 library) are called with misaligned stack. In this case, SSE
27853 instructions may lead to misaligned memory access traps. In addition,
27854 variable arguments are handled incorrectly for 16 byte aligned
27855 objects (including x87 long double and __int128), leading to wrong
27856 results. You must build all modules with
27857 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27858 includes the system libraries and startup modules.
27859
27860 @item -mincoming-stack-boundary=@var{num}
27861 @opindex mincoming-stack-boundary
27862 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27863 boundary. If @option{-mincoming-stack-boundary} is not specified,
27864 the one specified by @option{-mpreferred-stack-boundary} is used.
27865
27866 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27867 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27868 suffer significant run time performance penalties. On Pentium III, the
27869 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27870 properly if it is not 16-byte aligned.
27871
27872 To ensure proper alignment of this values on the stack, the stack boundary
27873 must be as aligned as that required by any value stored on the stack.
27874 Further, every function must be generated such that it keeps the stack
27875 aligned. Thus calling a function compiled with a higher preferred
27876 stack boundary from a function compiled with a lower preferred stack
27877 boundary most likely misaligns the stack. It is recommended that
27878 libraries that use callbacks always use the default setting.
27879
27880 This extra alignment does consume extra stack space, and generally
27881 increases code size. Code that is sensitive to stack space usage, such
27882 as embedded systems and operating system kernels, may want to reduce the
27883 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27884
27885 @need 200
27886 @item -mmmx
27887 @opindex mmmx
27888 @need 200
27889 @itemx -msse
27890 @opindex msse
27891 @need 200
27892 @itemx -msse2
27893 @opindex msse2
27894 @need 200
27895 @itemx -msse3
27896 @opindex msse3
27897 @need 200
27898 @itemx -mssse3
27899 @opindex mssse3
27900 @need 200
27901 @itemx -msse4
27902 @opindex msse4
27903 @need 200
27904 @itemx -msse4a
27905 @opindex msse4a
27906 @need 200
27907 @itemx -msse4.1
27908 @opindex msse4.1
27909 @need 200
27910 @itemx -msse4.2
27911 @opindex msse4.2
27912 @need 200
27913 @itemx -mavx
27914 @opindex mavx
27915 @need 200
27916 @itemx -mavx2
27917 @opindex mavx2
27918 @need 200
27919 @itemx -mavx512f
27920 @opindex mavx512f
27921 @need 200
27922 @itemx -mavx512pf
27923 @opindex mavx512pf
27924 @need 200
27925 @itemx -mavx512er
27926 @opindex mavx512er
27927 @need 200
27928 @itemx -mavx512cd
27929 @opindex mavx512cd
27930 @need 200
27931 @itemx -mavx512vl
27932 @opindex mavx512vl
27933 @need 200
27934 @itemx -mavx512bw
27935 @opindex mavx512bw
27936 @need 200
27937 @itemx -mavx512dq
27938 @opindex mavx512dq
27939 @need 200
27940 @itemx -mavx512ifma
27941 @opindex mavx512ifma
27942 @need 200
27943 @itemx -mavx512vbmi
27944 @opindex mavx512vbmi
27945 @need 200
27946 @itemx -msha
27947 @opindex msha
27948 @need 200
27949 @itemx -maes
27950 @opindex maes
27951 @need 200
27952 @itemx -mpclmul
27953 @opindex mpclmul
27954 @need 200
27955 @itemx -mclflushopt
27956 @opindex mclflushopt
27957 @need 200
27958 @itemx -mclwb
27959 @opindex mclwb
27960 @need 200
27961 @itemx -mfsgsbase
27962 @opindex mfsgsbase
27963 @need 200
27964 @itemx -mptwrite
27965 @opindex mptwrite
27966 @need 200
27967 @itemx -mrdrnd
27968 @opindex mrdrnd
27969 @need 200
27970 @itemx -mf16c
27971 @opindex mf16c
27972 @need 200
27973 @itemx -mfma
27974 @opindex mfma
27975 @need 200
27976 @itemx -mpconfig
27977 @opindex mpconfig
27978 @need 200
27979 @itemx -mwbnoinvd
27980 @opindex mwbnoinvd
27981 @need 200
27982 @itemx -mfma4
27983 @opindex mfma4
27984 @need 200
27985 @itemx -mprfchw
27986 @opindex mprfchw
27987 @need 200
27988 @itemx -mrdpid
27989 @opindex mrdpid
27990 @need 200
27991 @itemx -mprefetchwt1
27992 @opindex mprefetchwt1
27993 @need 200
27994 @itemx -mrdseed
27995 @opindex mrdseed
27996 @need 200
27997 @itemx -msgx
27998 @opindex msgx
27999 @need 200
28000 @itemx -mxop
28001 @opindex mxop
28002 @need 200
28003 @itemx -mlwp
28004 @opindex mlwp
28005 @need 200
28006 @itemx -m3dnow
28007 @opindex m3dnow
28008 @need 200
28009 @itemx -m3dnowa
28010 @opindex m3dnowa
28011 @need 200
28012 @itemx -mpopcnt
28013 @opindex mpopcnt
28014 @need 200
28015 @itemx -mabm
28016 @opindex mabm
28017 @need 200
28018 @itemx -madx
28019 @opindex madx
28020 @need 200
28021 @itemx -mbmi
28022 @opindex mbmi
28023 @need 200
28024 @itemx -mbmi2
28025 @opindex mbmi2
28026 @need 200
28027 @itemx -mlzcnt
28028 @opindex mlzcnt
28029 @need 200
28030 @itemx -mfxsr
28031 @opindex mfxsr
28032 @need 200
28033 @itemx -mxsave
28034 @opindex mxsave
28035 @need 200
28036 @itemx -mxsaveopt
28037 @opindex mxsaveopt
28038 @need 200
28039 @itemx -mxsavec
28040 @opindex mxsavec
28041 @need 200
28042 @itemx -mxsaves
28043 @opindex mxsaves
28044 @need 200
28045 @itemx -mrtm
28046 @opindex mrtm
28047 @need 200
28048 @itemx -mhle
28049 @opindex mhle
28050 @need 200
28051 @itemx -mtbm
28052 @opindex mtbm
28053 @need 200
28054 @itemx -mmwaitx
28055 @opindex mmwaitx
28056 @need 200
28057 @itemx -mclzero
28058 @opindex mclzero
28059 @need 200
28060 @itemx -mpku
28061 @opindex mpku
28062 @need 200
28063 @itemx -mavx512vbmi2
28064 @opindex mavx512vbmi2
28065 @need 200
28066 @itemx -mavx512bf16
28067 @opindex mavx512bf16
28068 @need 200
28069 @itemx -mgfni
28070 @opindex mgfni
28071 @need 200
28072 @itemx -mvaes
28073 @opindex mvaes
28074 @need 200
28075 @itemx -mwaitpkg
28076 @opindex mwaitpkg
28077 @need 200
28078 @itemx -mvpclmulqdq
28079 @opindex mvpclmulqdq
28080 @need 200
28081 @itemx -mavx512bitalg
28082 @opindex mavx512bitalg
28083 @need 200
28084 @itemx -mmovdiri
28085 @opindex mmovdiri
28086 @need 200
28087 @itemx -mmovdir64b
28088 @opindex mmovdir64b
28089 @need 200
28090 @itemx -menqcmd
28091 @opindex menqcmd
28092 @need 200
28093 @itemx -mavx512vpopcntdq
28094 @opindex mavx512vpopcntdq
28095 @need 200
28096 @itemx -mavx5124fmaps
28097 @opindex mavx5124fmaps
28098 @need 200
28099 @itemx -mavx512vnni
28100 @opindex mavx512vnni
28101 @need 200
28102 @itemx -mavx5124vnniw
28103 @opindex mavx5124vnniw
28104 @need 200
28105 @itemx -mcldemote
28106 @opindex mcldemote
28107 These switches enable the use of instructions in the MMX, SSE,
28108 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28109 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28110 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28111 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28112 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28113 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28114 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28115 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28116 extended instruction sets. Each has a corresponding @option{-mno-} option to
28117 disable use of these instructions.
28118
28119 These extensions are also available as built-in functions: see
28120 @ref{x86 Built-in Functions}, for details of the functions enabled and
28121 disabled by these switches.
28122
28123 To generate SSE/SSE2 instructions automatically from floating-point
28124 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28125
28126 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28127 generates new AVX instructions or AVX equivalence for all SSEx instructions
28128 when needed.
28129
28130 These options enable GCC to use these extended instructions in
28131 generated code, even without @option{-mfpmath=sse}. Applications that
28132 perform run-time CPU detection must compile separate files for each
28133 supported architecture, using the appropriate flags. In particular,
28134 the file containing the CPU detection code should be compiled without
28135 these options.
28136
28137 @item -mdump-tune-features
28138 @opindex mdump-tune-features
28139 This option instructs GCC to dump the names of the x86 performance
28140 tuning features and default settings. The names can be used in
28141 @option{-mtune-ctrl=@var{feature-list}}.
28142
28143 @item -mtune-ctrl=@var{feature-list}
28144 @opindex mtune-ctrl=@var{feature-list}
28145 This option is used to do fine grain control of x86 code generation features.
28146 @var{feature-list} is a comma separated list of @var{feature} names. See also
28147 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28148 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28149 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28150 developers. Using it may lead to code paths not covered by testing and can
28151 potentially result in compiler ICEs or runtime errors.
28152
28153 @item -mno-default
28154 @opindex mno-default
28155 This option instructs GCC to turn off all tunable features. See also
28156 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28157
28158 @item -mcld
28159 @opindex mcld
28160 This option instructs GCC to emit a @code{cld} instruction in the prologue
28161 of functions that use string instructions. String instructions depend on
28162 the DF flag to select between autoincrement or autodecrement mode. While the
28163 ABI specifies the DF flag to be cleared on function entry, some operating
28164 systems violate this specification by not clearing the DF flag in their
28165 exception dispatchers. The exception handler can be invoked with the DF flag
28166 set, which leads to wrong direction mode when string instructions are used.
28167 This option can be enabled by default on 32-bit x86 targets by configuring
28168 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28169 instructions can be suppressed with the @option{-mno-cld} compiler option
28170 in this case.
28171
28172 @item -mvzeroupper
28173 @opindex mvzeroupper
28174 This option instructs GCC to emit a @code{vzeroupper} instruction
28175 before a transfer of control flow out of the function to minimize
28176 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28177 intrinsics.
28178
28179 @item -mprefer-avx128
28180 @opindex mprefer-avx128
28181 This option instructs GCC to use 128-bit AVX instructions instead of
28182 256-bit AVX instructions in the auto-vectorizer.
28183
28184 @item -mprefer-vector-width=@var{opt}
28185 @opindex mprefer-vector-width
28186 This option instructs GCC to use @var{opt}-bit vector width in instructions
28187 instead of default on the selected platform.
28188
28189 @table @samp
28190 @item none
28191 No extra limitations applied to GCC other than defined by the selected platform.
28192
28193 @item 128
28194 Prefer 128-bit vector width for instructions.
28195
28196 @item 256
28197 Prefer 256-bit vector width for instructions.
28198
28199 @item 512
28200 Prefer 512-bit vector width for instructions.
28201 @end table
28202
28203 @item -mcx16
28204 @opindex mcx16
28205 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28206 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28207 objects. This is useful for atomic updates of data structures exceeding one
28208 machine word in size. The compiler uses this instruction to implement
28209 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28210 128-bit integers, a library call is always used.
28211
28212 @item -msahf
28213 @opindex msahf
28214 This option enables generation of @code{SAHF} instructions in 64-bit code.
28215 Early Intel Pentium 4 CPUs with Intel 64 support,
28216 prior to the introduction of Pentium 4 G1 step in December 2005,
28217 lacked the @code{LAHF} and @code{SAHF} instructions
28218 which are supported by AMD64.
28219 These are load and store instructions, respectively, for certain status flags.
28220 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28221 @code{drem}, and @code{remainder} built-in functions;
28222 see @ref{Other Builtins} for details.
28223
28224 @item -mmovbe
28225 @opindex mmovbe
28226 This option enables use of the @code{movbe} instruction to implement
28227 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28228
28229 @item -mshstk
28230 @opindex mshstk
28231 The @option{-mshstk} option enables shadow stack built-in functions
28232 from x86 Control-flow Enforcement Technology (CET).
28233
28234 @item -mcrc32
28235 @opindex mcrc32
28236 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28237 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28238 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28239
28240 @item -mrecip
28241 @opindex mrecip
28242 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28243 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28244 with an additional Newton-Raphson step
28245 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28246 (and their vectorized
28247 variants) for single-precision floating-point arguments. These instructions
28248 are generated only when @option{-funsafe-math-optimizations} is enabled
28249 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28250 Note that while the throughput of the sequence is higher than the throughput
28251 of the non-reciprocal instruction, the precision of the sequence can be
28252 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28253
28254 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28255 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28256 combination), and doesn't need @option{-mrecip}.
28257
28258 Also note that GCC emits the above sequence with additional Newton-Raphson step
28259 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28260 already with @option{-ffast-math} (or the above option combination), and
28261 doesn't need @option{-mrecip}.
28262
28263 @item -mrecip=@var{opt}
28264 @opindex mrecip=opt
28265 This option controls which reciprocal estimate instructions
28266 may be used. @var{opt} is a comma-separated list of options, which may
28267 be preceded by a @samp{!} to invert the option:
28268
28269 @table @samp
28270 @item all
28271 Enable all estimate instructions.
28272
28273 @item default
28274 Enable the default instructions, equivalent to @option{-mrecip}.
28275
28276 @item none
28277 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28278
28279 @item div
28280 Enable the approximation for scalar division.
28281
28282 @item vec-div
28283 Enable the approximation for vectorized division.
28284
28285 @item sqrt
28286 Enable the approximation for scalar square root.
28287
28288 @item vec-sqrt
28289 Enable the approximation for vectorized square root.
28290 @end table
28291
28292 So, for example, @option{-mrecip=all,!sqrt} enables
28293 all of the reciprocal approximations, except for square root.
28294
28295 @item -mveclibabi=@var{type}
28296 @opindex mveclibabi
28297 Specifies the ABI type to use for vectorizing intrinsics using an
28298 external library. Supported values for @var{type} are @samp{svml}
28299 for the Intel short
28300 vector math library and @samp{acml} for the AMD math core library.
28301 To use this option, both @option{-ftree-vectorize} and
28302 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28303 ABI-compatible library must be specified at link time.
28304
28305 GCC currently emits calls to @code{vmldExp2},
28306 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28307 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28308 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28309 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28310 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28311 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28312 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28313 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28314 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28315 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28316 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28317 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28318 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28319 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28320 when @option{-mveclibabi=acml} is used.
28321
28322 @item -mabi=@var{name}
28323 @opindex mabi
28324 Generate code for the specified calling convention. Permissible values
28325 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28326 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28327 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28328 You can control this behavior for specific functions by
28329 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28330 @xref{Function Attributes}.
28331
28332 @item -mforce-indirect-call
28333 @opindex mforce-indirect-call
28334 Force all calls to functions to be indirect. This is useful
28335 when using Intel Processor Trace where it generates more precise timing
28336 information for function calls.
28337
28338 @item -mmanual-endbr
28339 @opindex mmanual-endbr
28340 Insert ENDBR instruction at function entry only via the @code{cf_check}
28341 function attribute. This is useful when used with the option
28342 @option{-fcf-protection=branch} to control ENDBR insertion at the
28343 function entry.
28344
28345 @item -mcall-ms2sysv-xlogues
28346 @opindex mcall-ms2sysv-xlogues
28347 @opindex mno-call-ms2sysv-xlogues
28348 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28349 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28350 default, the code for saving and restoring these registers is emitted inline,
28351 resulting in fairly lengthy prologues and epilogues. Using
28352 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28353 use stubs in the static portion of libgcc to perform these saves and restores,
28354 thus reducing function size at the cost of a few extra instructions.
28355
28356 @item -mtls-dialect=@var{type}
28357 @opindex mtls-dialect
28358 Generate code to access thread-local storage using the @samp{gnu} or
28359 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28360 @samp{gnu2} is more efficient, but it may add compile- and run-time
28361 requirements that cannot be satisfied on all systems.
28362
28363 @item -mpush-args
28364 @itemx -mno-push-args
28365 @opindex mpush-args
28366 @opindex mno-push-args
28367 Use PUSH operations to store outgoing parameters. This method is shorter
28368 and usually equally fast as method using SUB/MOV operations and is enabled
28369 by default. In some cases disabling it may improve performance because of
28370 improved scheduling and reduced dependencies.
28371
28372 @item -maccumulate-outgoing-args
28373 @opindex maccumulate-outgoing-args
28374 If enabled, the maximum amount of space required for outgoing arguments is
28375 computed in the function prologue. This is faster on most modern CPUs
28376 because of reduced dependencies, improved scheduling and reduced stack usage
28377 when the preferred stack boundary is not equal to 2. The drawback is a notable
28378 increase in code size. This switch implies @option{-mno-push-args}.
28379
28380 @item -mthreads
28381 @opindex mthreads
28382 Support thread-safe exception handling on MinGW. Programs that rely
28383 on thread-safe exception handling must compile and link all code with the
28384 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28385 @option{-D_MT}; when linking, it links in a special thread helper library
28386 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28387
28388 @item -mms-bitfields
28389 @itemx -mno-ms-bitfields
28390 @opindex mms-bitfields
28391 @opindex mno-ms-bitfields
28392
28393 Enable/disable bit-field layout compatible with the native Microsoft
28394 Windows compiler.
28395
28396 If @code{packed} is used on a structure, or if bit-fields are used,
28397 it may be that the Microsoft ABI lays out the structure differently
28398 than the way GCC normally does. Particularly when moving packed
28399 data between functions compiled with GCC and the native Microsoft compiler
28400 (either via function call or as data in a file), it may be necessary to access
28401 either format.
28402
28403 This option is enabled by default for Microsoft Windows
28404 targets. This behavior can also be controlled locally by use of variable
28405 or type attributes. For more information, see @ref{x86 Variable Attributes}
28406 and @ref{x86 Type Attributes}.
28407
28408 The Microsoft structure layout algorithm is fairly simple with the exception
28409 of the bit-field packing.
28410 The padding and alignment of members of structures and whether a bit-field
28411 can straddle a storage-unit boundary are determine by these rules:
28412
28413 @enumerate
28414 @item Structure members are stored sequentially in the order in which they are
28415 declared: the first member has the lowest memory address and the last member
28416 the highest.
28417
28418 @item Every data object has an alignment requirement. The alignment requirement
28419 for all data except structures, unions, and arrays is either the size of the
28420 object or the current packing size (specified with either the
28421 @code{aligned} attribute or the @code{pack} pragma),
28422 whichever is less. For structures, unions, and arrays,
28423 the alignment requirement is the largest alignment requirement of its members.
28424 Every object is allocated an offset so that:
28425
28426 @smallexample
28427 offset % alignment_requirement == 0
28428 @end smallexample
28429
28430 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28431 unit if the integral types are the same size and if the next bit-field fits
28432 into the current allocation unit without crossing the boundary imposed by the
28433 common alignment requirements of the bit-fields.
28434 @end enumerate
28435
28436 MSVC interprets zero-length bit-fields in the following ways:
28437
28438 @enumerate
28439 @item If a zero-length bit-field is inserted between two bit-fields that
28440 are normally coalesced, the bit-fields are not coalesced.
28441
28442 For example:
28443
28444 @smallexample
28445 struct
28446 @{
28447 unsigned long bf_1 : 12;
28448 unsigned long : 0;
28449 unsigned long bf_2 : 12;
28450 @} t1;
28451 @end smallexample
28452
28453 @noindent
28454 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28455 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28456
28457 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28458 alignment of the zero-length bit-field is greater than the member that follows it,
28459 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28460
28461 For example:
28462
28463 @smallexample
28464 struct
28465 @{
28466 char foo : 4;
28467 short : 0;
28468 char bar;
28469 @} t2;
28470
28471 struct
28472 @{
28473 char foo : 4;
28474 short : 0;
28475 double bar;
28476 @} t3;
28477 @end smallexample
28478
28479 @noindent
28480 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28481 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28482 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28483 of the structure.
28484
28485 Taking this into account, it is important to note the following:
28486
28487 @enumerate
28488 @item If a zero-length bit-field follows a normal bit-field, the type of the
28489 zero-length bit-field may affect the alignment of the structure as whole. For
28490 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28491 normal bit-field, and is of type short.
28492
28493 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28494 still affect the alignment of the structure:
28495
28496 @smallexample
28497 struct
28498 @{
28499 char foo : 6;
28500 long : 0;
28501 @} t4;
28502 @end smallexample
28503
28504 @noindent
28505 Here, @code{t4} takes up 4 bytes.
28506 @end enumerate
28507
28508 @item Zero-length bit-fields following non-bit-field members are ignored:
28509
28510 @smallexample
28511 struct
28512 @{
28513 char foo;
28514 long : 0;
28515 char bar;
28516 @} t5;
28517 @end smallexample
28518
28519 @noindent
28520 Here, @code{t5} takes up 2 bytes.
28521 @end enumerate
28522
28523
28524 @item -mno-align-stringops
28525 @opindex mno-align-stringops
28526 @opindex malign-stringops
28527 Do not align the destination of inlined string operations. This switch reduces
28528 code size and improves performance in case the destination is already aligned,
28529 but GCC doesn't know about it.
28530
28531 @item -minline-all-stringops
28532 @opindex minline-all-stringops
28533 By default GCC inlines string operations only when the destination is
28534 known to be aligned to least a 4-byte boundary.
28535 This enables more inlining and increases code
28536 size, but may improve performance of code that depends on fast
28537 @code{memcpy} and @code{memset} for short lengths.
28538 The option enables inline expansion of @code{strlen} for all
28539 pointer alignments.
28540
28541 @item -minline-stringops-dynamically
28542 @opindex minline-stringops-dynamically
28543 For string operations of unknown size, use run-time checks with
28544 inline code for small blocks and a library call for large blocks.
28545
28546 @item -mstringop-strategy=@var{alg}
28547 @opindex mstringop-strategy=@var{alg}
28548 Override the internal decision heuristic for the particular algorithm to use
28549 for inlining string operations. The allowed values for @var{alg} are:
28550
28551 @table @samp
28552 @item rep_byte
28553 @itemx rep_4byte
28554 @itemx rep_8byte
28555 Expand using i386 @code{rep} prefix of the specified size.
28556
28557 @item byte_loop
28558 @itemx loop
28559 @itemx unrolled_loop
28560 Expand into an inline loop.
28561
28562 @item libcall
28563 Always use a library call.
28564 @end table
28565
28566 @item -mmemcpy-strategy=@var{strategy}
28567 @opindex mmemcpy-strategy=@var{strategy}
28568 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28569 should be inlined and what inline algorithm to use when the expected size
28570 of the copy operation is known. @var{strategy}
28571 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28572 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28573 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28574 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28575 in the list must be specified in increasing order. The minimal byte size for
28576 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28577 preceding range.
28578
28579 @item -mmemset-strategy=@var{strategy}
28580 @opindex mmemset-strategy=@var{strategy}
28581 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28582 @code{__builtin_memset} expansion.
28583
28584 @item -momit-leaf-frame-pointer
28585 @opindex momit-leaf-frame-pointer
28586 Don't keep the frame pointer in a register for leaf functions. This
28587 avoids the instructions to save, set up, and restore frame pointers and
28588 makes an extra register available in leaf functions. The option
28589 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28590 which might make debugging harder.
28591
28592 @item -mtls-direct-seg-refs
28593 @itemx -mno-tls-direct-seg-refs
28594 @opindex mtls-direct-seg-refs
28595 Controls whether TLS variables may be accessed with offsets from the
28596 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28597 or whether the thread base pointer must be added. Whether or not this
28598 is valid depends on the operating system, and whether it maps the
28599 segment to cover the entire TLS area.
28600
28601 For systems that use the GNU C Library, the default is on.
28602
28603 @item -msse2avx
28604 @itemx -mno-sse2avx
28605 @opindex msse2avx
28606 Specify that the assembler should encode SSE instructions with VEX
28607 prefix. The option @option{-mavx} turns this on by default.
28608
28609 @item -mfentry
28610 @itemx -mno-fentry
28611 @opindex mfentry
28612 If profiling is active (@option{-pg}), put the profiling
28613 counter call before the prologue.
28614 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28615 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28616
28617 @item -mrecord-mcount
28618 @itemx -mno-record-mcount
28619 @opindex mrecord-mcount
28620 If profiling is active (@option{-pg}), generate a __mcount_loc section
28621 that contains pointers to each profiling call. This is useful for
28622 automatically patching and out calls.
28623
28624 @item -mnop-mcount
28625 @itemx -mno-nop-mcount
28626 @opindex mnop-mcount
28627 If profiling is active (@option{-pg}), generate the calls to
28628 the profiling functions as NOPs. This is useful when they
28629 should be patched in later dynamically. This is likely only
28630 useful together with @option{-mrecord-mcount}.
28631
28632 @item -minstrument-return=@var{type}
28633 @opindex minstrument-return
28634 Instrument function exit in -pg -mfentry instrumented functions with
28635 call to specified function. This only instruments true returns ending
28636 with ret, but not sibling calls ending with jump. Valid types
28637 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28638 or @var{nop5} to generate a 5 byte nop.
28639
28640 @item -mrecord-return
28641 @itemx -mno-record-return
28642 @opindex mrecord-return
28643 Generate a __return_loc section pointing to all return instrumentation code.
28644
28645 @item -mfentry-name=@var{name}
28646 @opindex mfentry-name
28647 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28648
28649 @item -mfentry-section=@var{name}
28650 @opindex mfentry-section
28651 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28652
28653 @item -mskip-rax-setup
28654 @itemx -mno-skip-rax-setup
28655 @opindex mskip-rax-setup
28656 When generating code for the x86-64 architecture with SSE extensions
28657 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28658 register when there are no variable arguments passed in vector registers.
28659
28660 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28661 saving vector registers on stack when passing variable arguments, the
28662 impacts of this option are callees may waste some stack space,
28663 misbehave or jump to a random location. GCC 4.4 or newer don't have
28664 those issues, regardless the RAX register value.
28665
28666 @item -m8bit-idiv
28667 @itemx -mno-8bit-idiv
28668 @opindex m8bit-idiv
28669 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28670 much faster than 32-bit/64-bit integer divide. This option generates a
28671 run-time check. If both dividend and divisor are within range of 0
28672 to 255, 8-bit unsigned integer divide is used instead of
28673 32-bit/64-bit integer divide.
28674
28675 @item -mavx256-split-unaligned-load
28676 @itemx -mavx256-split-unaligned-store
28677 @opindex mavx256-split-unaligned-load
28678 @opindex mavx256-split-unaligned-store
28679 Split 32-byte AVX unaligned load and store.
28680
28681 @item -mstack-protector-guard=@var{guard}
28682 @itemx -mstack-protector-guard-reg=@var{reg}
28683 @itemx -mstack-protector-guard-offset=@var{offset}
28684 @opindex mstack-protector-guard
28685 @opindex mstack-protector-guard-reg
28686 @opindex mstack-protector-guard-offset
28687 Generate stack protection code using canary at @var{guard}. Supported
28688 locations are @samp{global} for global canary or @samp{tls} for per-thread
28689 canary in the TLS block (the default). This option has effect only when
28690 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28691
28692 With the latter choice the options
28693 @option{-mstack-protector-guard-reg=@var{reg}} and
28694 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28695 which segment register (@code{%fs} or @code{%gs}) to use as base register
28696 for reading the canary, and from what offset from that base register.
28697 The default for those is as specified in the relevant ABI.
28698
28699 @item -mgeneral-regs-only
28700 @opindex mgeneral-regs-only
28701 Generate code that uses only the general-purpose registers. This
28702 prevents the compiler from using floating-point, vector, mask and bound
28703 registers.
28704
28705 @item -mindirect-branch=@var{choice}
28706 @opindex mindirect-branch
28707 Convert indirect call and jump with @var{choice}. The default is
28708 @samp{keep}, which keeps indirect call and jump unmodified.
28709 @samp{thunk} converts indirect call and jump to call and return thunk.
28710 @samp{thunk-inline} converts indirect call and jump to inlined call
28711 and return thunk. @samp{thunk-extern} converts indirect call and jump
28712 to external call and return thunk provided in a separate object file.
28713 You can control this behavior for a specific function by using the
28714 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28715
28716 Note that @option{-mcmodel=large} is incompatible with
28717 @option{-mindirect-branch=thunk} and
28718 @option{-mindirect-branch=thunk-extern} since the thunk function may
28719 not be reachable in the large code model.
28720
28721 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28722 @option{-fcf-protection=branch} since the external thunk cannot be modified
28723 to disable control-flow check.
28724
28725 @item -mfunction-return=@var{choice}
28726 @opindex mfunction-return
28727 Convert function return with @var{choice}. The default is @samp{keep},
28728 which keeps function return unmodified. @samp{thunk} converts function
28729 return to call and return thunk. @samp{thunk-inline} converts function
28730 return to inlined call and return thunk. @samp{thunk-extern} converts
28731 function return to external call and return thunk provided in a separate
28732 object file. You can control this behavior for a specific function by
28733 using the function attribute @code{function_return}.
28734 @xref{Function Attributes}.
28735
28736 Note that @option{-mcmodel=large} is incompatible with
28737 @option{-mfunction-return=thunk} and
28738 @option{-mfunction-return=thunk-extern} since the thunk function may
28739 not be reachable in the large code model.
28740
28741
28742 @item -mindirect-branch-register
28743 @opindex mindirect-branch-register
28744 Force indirect call and jump via register.
28745
28746 @end table
28747
28748 These @samp{-m} switches are supported in addition to the above
28749 on x86-64 processors in 64-bit environments.
28750
28751 @table @gcctabopt
28752 @item -m32
28753 @itemx -m64
28754 @itemx -mx32
28755 @itemx -m16
28756 @itemx -miamcu
28757 @opindex m32
28758 @opindex m64
28759 @opindex mx32
28760 @opindex m16
28761 @opindex miamcu
28762 Generate code for a 16-bit, 32-bit or 64-bit environment.
28763 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28764 to 32 bits, and
28765 generates code that runs on any i386 system.
28766
28767 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28768 types to 64 bits, and generates code for the x86-64 architecture.
28769 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28770 and @option{-mdynamic-no-pic} options.
28771
28772 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28773 to 32 bits, and
28774 generates code for the x86-64 architecture.
28775
28776 The @option{-m16} option is the same as @option{-m32}, except for that
28777 it outputs the @code{.code16gcc} assembly directive at the beginning of
28778 the assembly output so that the binary can run in 16-bit mode.
28779
28780 The @option{-miamcu} option generates code which conforms to Intel MCU
28781 psABI. It requires the @option{-m32} option to be turned on.
28782
28783 @item -mno-red-zone
28784 @opindex mno-red-zone
28785 @opindex mred-zone
28786 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28787 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28788 stack pointer that is not modified by signal or interrupt handlers
28789 and therefore can be used for temporary data without adjusting the stack
28790 pointer. The flag @option{-mno-red-zone} disables this red zone.
28791
28792 @item -mcmodel=small
28793 @opindex mcmodel=small
28794 Generate code for the small code model: the program and its symbols must
28795 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28796 Programs can be statically or dynamically linked. This is the default
28797 code model.
28798
28799 @item -mcmodel=kernel
28800 @opindex mcmodel=kernel
28801 Generate code for the kernel code model. The kernel runs in the
28802 negative 2 GB of the address space.
28803 This model has to be used for Linux kernel code.
28804
28805 @item -mcmodel=medium
28806 @opindex mcmodel=medium
28807 Generate code for the medium model: the program is linked in the lower 2
28808 GB of the address space. Small symbols are also placed there. Symbols
28809 with sizes larger than @option{-mlarge-data-threshold} are put into
28810 large data or BSS sections and can be located above 2GB. Programs can
28811 be statically or dynamically linked.
28812
28813 @item -mcmodel=large
28814 @opindex mcmodel=large
28815 Generate code for the large model. This model makes no assumptions
28816 about addresses and sizes of sections.
28817
28818 @item -maddress-mode=long
28819 @opindex maddress-mode=long
28820 Generate code for long address mode. This is only supported for 64-bit
28821 and x32 environments. It is the default address mode for 64-bit
28822 environments.
28823
28824 @item -maddress-mode=short
28825 @opindex maddress-mode=short
28826 Generate code for short address mode. This is only supported for 32-bit
28827 and x32 environments. It is the default address mode for 32-bit and
28828 x32 environments.
28829 @end table
28830
28831 @node x86 Windows Options
28832 @subsection x86 Windows Options
28833 @cindex x86 Windows Options
28834 @cindex Windows Options for x86
28835
28836 These additional options are available for Microsoft Windows targets:
28837
28838 @table @gcctabopt
28839 @item -mconsole
28840 @opindex mconsole
28841 This option
28842 specifies that a console application is to be generated, by
28843 instructing the linker to set the PE header subsystem type
28844 required for console applications.
28845 This option is available for Cygwin and MinGW targets and is
28846 enabled by default on those targets.
28847
28848 @item -mdll
28849 @opindex mdll
28850 This option is available for Cygwin and MinGW targets. It
28851 specifies that a DLL---a dynamic link library---is to be
28852 generated, enabling the selection of the required runtime
28853 startup object and entry point.
28854
28855 @item -mnop-fun-dllimport
28856 @opindex mnop-fun-dllimport
28857 This option is available for Cygwin and MinGW targets. It
28858 specifies that the @code{dllimport} attribute should be ignored.
28859
28860 @item -mthread
28861 @opindex mthread
28862 This option is available for MinGW targets. It specifies
28863 that MinGW-specific thread support is to be used.
28864
28865 @item -municode
28866 @opindex municode
28867 This option is available for MinGW-w64 targets. It causes
28868 the @code{UNICODE} preprocessor macro to be predefined, and
28869 chooses Unicode-capable runtime startup code.
28870
28871 @item -mwin32
28872 @opindex mwin32
28873 This option is available for Cygwin and MinGW targets. It
28874 specifies that the typical Microsoft Windows predefined macros are to
28875 be set in the pre-processor, but does not influence the choice
28876 of runtime library/startup code.
28877
28878 @item -mwindows
28879 @opindex mwindows
28880 This option is available for Cygwin and MinGW targets. It
28881 specifies that a GUI application is to be generated by
28882 instructing the linker to set the PE header subsystem type
28883 appropriately.
28884
28885 @item -fno-set-stack-executable
28886 @opindex fno-set-stack-executable
28887 @opindex fset-stack-executable
28888 This option is available for MinGW targets. It specifies that
28889 the executable flag for the stack used by nested functions isn't
28890 set. This is necessary for binaries running in kernel mode of
28891 Microsoft Windows, as there the User32 API, which is used to set executable
28892 privileges, isn't available.
28893
28894 @item -fwritable-relocated-rdata
28895 @opindex fno-writable-relocated-rdata
28896 @opindex fwritable-relocated-rdata
28897 This option is available for MinGW and Cygwin targets. It specifies
28898 that relocated-data in read-only section is put into the @code{.data}
28899 section. This is a necessary for older runtimes not supporting
28900 modification of @code{.rdata} sections for pseudo-relocation.
28901
28902 @item -mpe-aligned-commons
28903 @opindex mpe-aligned-commons
28904 This option is available for Cygwin and MinGW targets. It
28905 specifies that the GNU extension to the PE file format that
28906 permits the correct alignment of COMMON variables should be
28907 used when generating code. It is enabled by default if
28908 GCC detects that the target assembler found during configuration
28909 supports the feature.
28910 @end table
28911
28912 See also under @ref{x86 Options} for standard options.
28913
28914 @node Xstormy16 Options
28915 @subsection Xstormy16 Options
28916 @cindex Xstormy16 Options
28917
28918 These options are defined for Xstormy16:
28919
28920 @table @gcctabopt
28921 @item -msim
28922 @opindex msim
28923 Choose startup files and linker script suitable for the simulator.
28924 @end table
28925
28926 @node Xtensa Options
28927 @subsection Xtensa Options
28928 @cindex Xtensa Options
28929
28930 These options are supported for Xtensa targets:
28931
28932 @table @gcctabopt
28933 @item -mconst16
28934 @itemx -mno-const16
28935 @opindex mconst16
28936 @opindex mno-const16
28937 Enable or disable use of @code{CONST16} instructions for loading
28938 constant values. The @code{CONST16} instruction is currently not a
28939 standard option from Tensilica. When enabled, @code{CONST16}
28940 instructions are always used in place of the standard @code{L32R}
28941 instructions. The use of @code{CONST16} is enabled by default only if
28942 the @code{L32R} instruction is not available.
28943
28944 @item -mfused-madd
28945 @itemx -mno-fused-madd
28946 @opindex mfused-madd
28947 @opindex mno-fused-madd
28948 Enable or disable use of fused multiply/add and multiply/subtract
28949 instructions in the floating-point option. This has no effect if the
28950 floating-point option is not also enabled. Disabling fused multiply/add
28951 and multiply/subtract instructions forces the compiler to use separate
28952 instructions for the multiply and add/subtract operations. This may be
28953 desirable in some cases where strict IEEE 754-compliant results are
28954 required: the fused multiply add/subtract instructions do not round the
28955 intermediate result, thereby producing results with @emph{more} bits of
28956 precision than specified by the IEEE standard. Disabling fused multiply
28957 add/subtract instructions also ensures that the program output is not
28958 sensitive to the compiler's ability to combine multiply and add/subtract
28959 operations.
28960
28961 @item -mserialize-volatile
28962 @itemx -mno-serialize-volatile
28963 @opindex mserialize-volatile
28964 @opindex mno-serialize-volatile
28965 When this option is enabled, GCC inserts @code{MEMW} instructions before
28966 @code{volatile} memory references to guarantee sequential consistency.
28967 The default is @option{-mserialize-volatile}. Use
28968 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28969
28970 @item -mforce-no-pic
28971 @opindex mforce-no-pic
28972 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28973 position-independent code (PIC), this option disables PIC for compiling
28974 kernel code.
28975
28976 @item -mtext-section-literals
28977 @itemx -mno-text-section-literals
28978 @opindex mtext-section-literals
28979 @opindex mno-text-section-literals
28980 These options control the treatment of literal pools. The default is
28981 @option{-mno-text-section-literals}, which places literals in a separate
28982 section in the output file. This allows the literal pool to be placed
28983 in a data RAM/ROM, and it also allows the linker to combine literal
28984 pools from separate object files to remove redundant literals and
28985 improve code size. With @option{-mtext-section-literals}, the literals
28986 are interspersed in the text section in order to keep them as close as
28987 possible to their references. This may be necessary for large assembly
28988 files. Literals for each function are placed right before that function.
28989
28990 @item -mauto-litpools
28991 @itemx -mno-auto-litpools
28992 @opindex mauto-litpools
28993 @opindex mno-auto-litpools
28994 These options control the treatment of literal pools. The default is
28995 @option{-mno-auto-litpools}, which places literals in a separate
28996 section in the output file unless @option{-mtext-section-literals} is
28997 used. With @option{-mauto-litpools} the literals are interspersed in
28998 the text section by the assembler. Compiler does not produce explicit
28999 @code{.literal} directives and loads literals into registers with
29000 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29001 do relaxation and place literals as necessary. This option allows
29002 assembler to create several literal pools per function and assemble
29003 very big functions, which may not be possible with
29004 @option{-mtext-section-literals}.
29005
29006 @item -mtarget-align
29007 @itemx -mno-target-align
29008 @opindex mtarget-align
29009 @opindex mno-target-align
29010 When this option is enabled, GCC instructs the assembler to
29011 automatically align instructions to reduce branch penalties at the
29012 expense of some code density. The assembler attempts to widen density
29013 instructions to align branch targets and the instructions following call
29014 instructions. If there are not enough preceding safe density
29015 instructions to align a target, no widening is performed. The
29016 default is @option{-mtarget-align}. These options do not affect the
29017 treatment of auto-aligned instructions like @code{LOOP}, which the
29018 assembler always aligns, either by widening density instructions or
29019 by inserting NOP instructions.
29020
29021 @item -mlongcalls
29022 @itemx -mno-longcalls
29023 @opindex mlongcalls
29024 @opindex mno-longcalls
29025 When this option is enabled, GCC instructs the assembler to translate
29026 direct calls to indirect calls unless it can determine that the target
29027 of a direct call is in the range allowed by the call instruction. This
29028 translation typically occurs for calls to functions in other source
29029 files. Specifically, the assembler translates a direct @code{CALL}
29030 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29031 The default is @option{-mno-longcalls}. This option should be used in
29032 programs where the call target can potentially be out of range. This
29033 option is implemented in the assembler, not the compiler, so the
29034 assembly code generated by GCC still shows direct call
29035 instructions---look at the disassembled object code to see the actual
29036 instructions. Note that the assembler uses an indirect call for
29037 every cross-file call, not just those that really are out of range.
29038 @end table
29039
29040 @node zSeries Options
29041 @subsection zSeries Options
29042 @cindex zSeries options
29043
29044 These are listed under @xref{S/390 and zSeries Options}.
29045
29046
29047 @c man end
29048
29049 @node Spec Files
29050 @section Specifying Subprocesses and the Switches to Pass to Them
29051 @cindex Spec Files
29052
29053 @command{gcc} is a driver program. It performs its job by invoking a
29054 sequence of other programs to do the work of compiling, assembling and
29055 linking. GCC interprets its command-line parameters and uses these to
29056 deduce which programs it should invoke, and which command-line options
29057 it ought to place on their command lines. This behavior is controlled
29058 by @dfn{spec strings}. In most cases there is one spec string for each
29059 program that GCC can invoke, but a few programs have multiple spec
29060 strings to control their behavior. The spec strings built into GCC can
29061 be overridden by using the @option{-specs=} command-line switch to specify
29062 a spec file.
29063
29064 @dfn{Spec files} are plain-text files that are used to construct spec
29065 strings. They consist of a sequence of directives separated by blank
29066 lines. The type of directive is determined by the first non-whitespace
29067 character on the line, which can be one of the following:
29068
29069 @table @code
29070 @item %@var{command}
29071 Issues a @var{command} to the spec file processor. The commands that can
29072 appear here are:
29073
29074 @table @code
29075 @item %include <@var{file}>
29076 @cindex @code{%include}
29077 Search for @var{file} and insert its text at the current point in the
29078 specs file.
29079
29080 @item %include_noerr <@var{file}>
29081 @cindex @code{%include_noerr}
29082 Just like @samp{%include}, but do not generate an error message if the include
29083 file cannot be found.
29084
29085 @item %rename @var{old_name} @var{new_name}
29086 @cindex @code{%rename}
29087 Rename the spec string @var{old_name} to @var{new_name}.
29088
29089 @end table
29090
29091 @item *[@var{spec_name}]:
29092 This tells the compiler to create, override or delete the named spec
29093 string. All lines after this directive up to the next directive or
29094 blank line are considered to be the text for the spec string. If this
29095 results in an empty string then the spec is deleted. (Or, if the
29096 spec did not exist, then nothing happens.) Otherwise, if the spec
29097 does not currently exist a new spec is created. If the spec does
29098 exist then its contents are overridden by the text of this
29099 directive, unless the first character of that text is the @samp{+}
29100 character, in which case the text is appended to the spec.
29101
29102 @item [@var{suffix}]:
29103 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29104 and up to the next directive or blank line are considered to make up the
29105 spec string for the indicated suffix. When the compiler encounters an
29106 input file with the named suffix, it processes the spec string in
29107 order to work out how to compile that file. For example:
29108
29109 @smallexample
29110 .ZZ:
29111 z-compile -input %i
29112 @end smallexample
29113
29114 This says that any input file whose name ends in @samp{.ZZ} should be
29115 passed to the program @samp{z-compile}, which should be invoked with the
29116 command-line switch @option{-input} and with the result of performing the
29117 @samp{%i} substitution. (See below.)
29118
29119 As an alternative to providing a spec string, the text following a
29120 suffix directive can be one of the following:
29121
29122 @table @code
29123 @item @@@var{language}
29124 This says that the suffix is an alias for a known @var{language}. This is
29125 similar to using the @option{-x} command-line switch to GCC to specify a
29126 language explicitly. For example:
29127
29128 @smallexample
29129 .ZZ:
29130 @@c++
29131 @end smallexample
29132
29133 Says that .ZZ files are, in fact, C++ source files.
29134
29135 @item #@var{name}
29136 This causes an error messages saying:
29137
29138 @smallexample
29139 @var{name} compiler not installed on this system.
29140 @end smallexample
29141 @end table
29142
29143 GCC already has an extensive list of suffixes built into it.
29144 This directive adds an entry to the end of the list of suffixes, but
29145 since the list is searched from the end backwards, it is effectively
29146 possible to override earlier entries using this technique.
29147
29148 @end table
29149
29150 GCC has the following spec strings built into it. Spec files can
29151 override these strings or create their own. Note that individual
29152 targets can also add their own spec strings to this list.
29153
29154 @smallexample
29155 asm Options to pass to the assembler
29156 asm_final Options to pass to the assembler post-processor
29157 cpp Options to pass to the C preprocessor
29158 cc1 Options to pass to the C compiler
29159 cc1plus Options to pass to the C++ compiler
29160 endfile Object files to include at the end of the link
29161 link Options to pass to the linker
29162 lib Libraries to include on the command line to the linker
29163 libgcc Decides which GCC support library to pass to the linker
29164 linker Sets the name of the linker
29165 predefines Defines to be passed to the C preprocessor
29166 signed_char Defines to pass to CPP to say whether @code{char} is signed
29167 by default
29168 startfile Object files to include at the start of the link
29169 @end smallexample
29170
29171 Here is a small example of a spec file:
29172
29173 @smallexample
29174 %rename lib old_lib
29175
29176 *lib:
29177 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29178 @end smallexample
29179
29180 This example renames the spec called @samp{lib} to @samp{old_lib} and
29181 then overrides the previous definition of @samp{lib} with a new one.
29182 The new definition adds in some extra command-line options before
29183 including the text of the old definition.
29184
29185 @dfn{Spec strings} are a list of command-line options to be passed to their
29186 corresponding program. In addition, the spec strings can contain
29187 @samp{%}-prefixed sequences to substitute variable text or to
29188 conditionally insert text into the command line. Using these constructs
29189 it is possible to generate quite complex command lines.
29190
29191 Here is a table of all defined @samp{%}-sequences for spec
29192 strings. Note that spaces are not generated automatically around the
29193 results of expanding these sequences. Therefore you can concatenate them
29194 together or combine them with constant text in a single argument.
29195
29196 @table @code
29197 @item %%
29198 Substitute one @samp{%} into the program name or argument.
29199
29200 @item %i
29201 Substitute the name of the input file being processed.
29202
29203 @item %b
29204 Substitute the basename of the input file being processed.
29205 This is the substring up to (and not including) the last period
29206 and not including the directory.
29207
29208 @item %B
29209 This is the same as @samp{%b}, but include the file suffix (text after
29210 the last period).
29211
29212 @item %d
29213 Marks the argument containing or following the @samp{%d} as a
29214 temporary file name, so that that file is deleted if GCC exits
29215 successfully. Unlike @samp{%g}, this contributes no text to the
29216 argument.
29217
29218 @item %g@var{suffix}
29219 Substitute a file name that has suffix @var{suffix} and is chosen
29220 once per compilation, and mark the argument in the same way as
29221 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29222 name is now chosen in a way that is hard to predict even when previously
29223 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29224 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29225 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29226 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29227 was simply substituted with a file name chosen once per compilation,
29228 without regard to any appended suffix (which was therefore treated
29229 just like ordinary text), making such attacks more likely to succeed.
29230
29231 @item %u@var{suffix}
29232 Like @samp{%g}, but generates a new temporary file name
29233 each time it appears instead of once per compilation.
29234
29235 @item %U@var{suffix}
29236 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29237 new one if there is no such last file name. In the absence of any
29238 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29239 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29240 involves the generation of two distinct file names, one
29241 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29242 simply substituted with a file name chosen for the previous @samp{%u},
29243 without regard to any appended suffix.
29244
29245 @item %j@var{suffix}
29246 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29247 writable, and if @option{-save-temps} is not used;
29248 otherwise, substitute the name
29249 of a temporary file, just like @samp{%u}. This temporary file is not
29250 meant for communication between processes, but rather as a junk
29251 disposal mechanism.
29252
29253 @item %|@var{suffix}
29254 @itemx %m@var{suffix}
29255 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29256 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29257 all. These are the two most common ways to instruct a program that it
29258 should read from standard input or write to standard output. If you
29259 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29260 construct: see for example @file{f/lang-specs.h}.
29261
29262 @item %.@var{SUFFIX}
29263 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29264 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29265 terminated by the next space or %.
29266
29267 @item %w
29268 Marks the argument containing or following the @samp{%w} as the
29269 designated output file of this compilation. This puts the argument
29270 into the sequence of arguments that @samp{%o} substitutes.
29271
29272 @item %o
29273 Substitutes the names of all the output files, with spaces
29274 automatically placed around them. You should write spaces
29275 around the @samp{%o} as well or the results are undefined.
29276 @samp{%o} is for use in the specs for running the linker.
29277 Input files whose names have no recognized suffix are not compiled
29278 at all, but they are included among the output files, so they are
29279 linked.
29280
29281 @item %O
29282 Substitutes the suffix for object files. Note that this is
29283 handled specially when it immediately follows @samp{%g, %u, or %U},
29284 because of the need for those to form complete file names. The
29285 handling is such that @samp{%O} is treated exactly as if it had already
29286 been substituted, except that @samp{%g, %u, and %U} do not currently
29287 support additional @var{suffix} characters following @samp{%O} as they do
29288 following, for example, @samp{.o}.
29289
29290 @item %p
29291 Substitutes the standard macro predefinitions for the
29292 current target machine. Use this when running @command{cpp}.
29293
29294 @item %P
29295 Like @samp{%p}, but puts @samp{__} before and after the name of each
29296 predefined macro, except for macros that start with @samp{__} or with
29297 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29298 C@.
29299
29300 @item %I
29301 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29302 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29303 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29304 and @option{-imultilib} as necessary.
29305
29306 @item %s
29307 Current argument is the name of a library or startup file of some sort.
29308 Search for that file in a standard list of directories and substitute
29309 the full name found. The current working directory is included in the
29310 list of directories scanned.
29311
29312 @item %T
29313 Current argument is the name of a linker script. Search for that file
29314 in the current list of directories to scan for libraries. If the file
29315 is located insert a @option{--script} option into the command line
29316 followed by the full path name found. If the file is not found then
29317 generate an error message. Note: the current working directory is not
29318 searched.
29319
29320 @item %e@var{str}
29321 Print @var{str} as an error message. @var{str} is terminated by a newline.
29322 Use this when inconsistent options are detected.
29323
29324 @item %(@var{name})
29325 Substitute the contents of spec string @var{name} at this point.
29326
29327 @item %x@{@var{option}@}
29328 Accumulate an option for @samp{%X}.
29329
29330 @item %X
29331 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29332 spec string.
29333
29334 @item %Y
29335 Output the accumulated assembler options specified by @option{-Wa}.
29336
29337 @item %Z
29338 Output the accumulated preprocessor options specified by @option{-Wp}.
29339
29340 @item %a
29341 Process the @code{asm} spec. This is used to compute the
29342 switches to be passed to the assembler.
29343
29344 @item %A
29345 Process the @code{asm_final} spec. This is a spec string for
29346 passing switches to an assembler post-processor, if such a program is
29347 needed.
29348
29349 @item %l
29350 Process the @code{link} spec. This is the spec for computing the
29351 command line passed to the linker. Typically it makes use of the
29352 @samp{%L %G %S %D and %E} sequences.
29353
29354 @item %D
29355 Dump out a @option{-L} option for each directory that GCC believes might
29356 contain startup files. If the target supports multilibs then the
29357 current multilib directory is prepended to each of these paths.
29358
29359 @item %L
29360 Process the @code{lib} spec. This is a spec string for deciding which
29361 libraries are included on the command line to the linker.
29362
29363 @item %G
29364 Process the @code{libgcc} spec. This is a spec string for deciding
29365 which GCC support library is included on the command line to the linker.
29366
29367 @item %S
29368 Process the @code{startfile} spec. This is a spec for deciding which
29369 object files are the first ones passed to the linker. Typically
29370 this might be a file named @file{crt0.o}.
29371
29372 @item %E
29373 Process the @code{endfile} spec. This is a spec string that specifies
29374 the last object files that are passed to the linker.
29375
29376 @item %C
29377 Process the @code{cpp} spec. This is used to construct the arguments
29378 to be passed to the C preprocessor.
29379
29380 @item %1
29381 Process the @code{cc1} spec. This is used to construct the options to be
29382 passed to the actual C compiler (@command{cc1}).
29383
29384 @item %2
29385 Process the @code{cc1plus} spec. This is used to construct the options to be
29386 passed to the actual C++ compiler (@command{cc1plus}).
29387
29388 @item %*
29389 Substitute the variable part of a matched option. See below.
29390 Note that each comma in the substituted string is replaced by
29391 a single space.
29392
29393 @item %<S
29394 Remove all occurrences of @code{-S} from the command line. Note---this
29395 command is position dependent. @samp{%} commands in the spec string
29396 before this one see @code{-S}, @samp{%} commands in the spec string
29397 after this one do not.
29398
29399 @item %:@var{function}(@var{args})
29400 Call the named function @var{function}, passing it @var{args}.
29401 @var{args} is first processed as a nested spec string, then split
29402 into an argument vector in the usual fashion. The function returns
29403 a string which is processed as if it had appeared literally as part
29404 of the current spec.
29405
29406 The following built-in spec functions are provided:
29407
29408 @table @code
29409 @item @code{getenv}
29410 The @code{getenv} spec function takes two arguments: an environment
29411 variable name and a string. If the environment variable is not
29412 defined, a fatal error is issued. Otherwise, the return value is the
29413 value of the environment variable concatenated with the string. For
29414 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29415
29416 @smallexample
29417 %:getenv(TOPDIR /include)
29418 @end smallexample
29419
29420 expands to @file{/path/to/top/include}.
29421
29422 @item @code{if-exists}
29423 The @code{if-exists} spec function takes one argument, an absolute
29424 pathname to a file. If the file exists, @code{if-exists} returns the
29425 pathname. Here is a small example of its usage:
29426
29427 @smallexample
29428 *startfile:
29429 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29430 @end smallexample
29431
29432 @item @code{if-exists-else}
29433 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29434 spec function, except that it takes two arguments. The first argument is
29435 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29436 returns the pathname. If it does not exist, it returns the second argument.
29437 This way, @code{if-exists-else} can be used to select one file or another,
29438 based on the existence of the first. Here is a small example of its usage:
29439
29440 @smallexample
29441 *startfile:
29442 crt0%O%s %:if-exists(crti%O%s) \
29443 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29444 @end smallexample
29445
29446 @item @code{replace-outfile}
29447 The @code{replace-outfile} spec function takes two arguments. It looks for the
29448 first argument in the outfiles array and replaces it with the second argument. Here
29449 is a small example of its usage:
29450
29451 @smallexample
29452 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29453 @end smallexample
29454
29455 @item @code{remove-outfile}
29456 The @code{remove-outfile} spec function takes one argument. It looks for the
29457 first argument in the outfiles array and removes it. Here is a small example
29458 its usage:
29459
29460 @smallexample
29461 %:remove-outfile(-lm)
29462 @end smallexample
29463
29464 @item @code{pass-through-libs}
29465 The @code{pass-through-libs} spec function takes any number of arguments. It
29466 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29467 assumes are the names of linker input library archive files) and returns a
29468 result containing all the found arguments each prepended by
29469 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29470 intended to be passed to the LTO linker plugin.
29471
29472 @smallexample
29473 %:pass-through-libs(%G %L %G)
29474 @end smallexample
29475
29476 @item @code{print-asm-header}
29477 The @code{print-asm-header} function takes no arguments and simply
29478 prints a banner like:
29479
29480 @smallexample
29481 Assembler options
29482 =================
29483
29484 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29485 @end smallexample
29486
29487 It is used to separate compiler options from assembler options
29488 in the @option{--target-help} output.
29489 @end table
29490
29491 @item %@{S@}
29492 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29493 If that switch is not specified, this substitutes nothing. Note that
29494 the leading dash is omitted when specifying this option, and it is
29495 automatically inserted if the substitution is performed. Thus the spec
29496 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29497 and outputs the command-line option @option{-foo}.
29498
29499 @item %W@{S@}
29500 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29501 deleted on failure.
29502
29503 @item %@{S*@}
29504 Substitutes all the switches specified to GCC whose names start
29505 with @code{-S}, but which also take an argument. This is used for
29506 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29507 GCC considers @option{-o foo} as being
29508 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29509 text, including the space. Thus two arguments are generated.
29510
29511 @item %@{S*&T*@}
29512 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29513 (the order of @code{S} and @code{T} in the spec is not significant).
29514 There can be any number of ampersand-separated variables; for each the
29515 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29516
29517 @item %@{S:X@}
29518 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29519
29520 @item %@{!S:X@}
29521 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29522
29523 @item %@{S*:X@}
29524 Substitutes @code{X} if one or more switches whose names start with
29525 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29526 once, no matter how many such switches appeared. However, if @code{%*}
29527 appears somewhere in @code{X}, then @code{X} is substituted once
29528 for each matching switch, with the @code{%*} replaced by the part of
29529 that switch matching the @code{*}.
29530
29531 If @code{%*} appears as the last part of a spec sequence then a space
29532 is added after the end of the last substitution. If there is more
29533 text in the sequence, however, then a space is not generated. This
29534 allows the @code{%*} substitution to be used as part of a larger
29535 string. For example, a spec string like this:
29536
29537 @smallexample
29538 %@{mcu=*:--script=%*/memory.ld@}
29539 @end smallexample
29540
29541 @noindent
29542 when matching an option like @option{-mcu=newchip} produces:
29543
29544 @smallexample
29545 --script=newchip/memory.ld
29546 @end smallexample
29547
29548 @item %@{.S:X@}
29549 Substitutes @code{X}, if processing a file with suffix @code{S}.
29550
29551 @item %@{!.S:X@}
29552 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29553
29554 @item %@{,S:X@}
29555 Substitutes @code{X}, if processing a file for language @code{S}.
29556
29557 @item %@{!,S:X@}
29558 Substitutes @code{X}, if not processing a file for language @code{S}.
29559
29560 @item %@{S|P:X@}
29561 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29562 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29563 @code{*} sequences as well, although they have a stronger binding than
29564 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29565 alternatives must be starred, and only the first matching alternative
29566 is substituted.
29567
29568 For example, a spec string like this:
29569
29570 @smallexample
29571 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29572 @end smallexample
29573
29574 @noindent
29575 outputs the following command-line options from the following input
29576 command-line options:
29577
29578 @smallexample
29579 fred.c -foo -baz
29580 jim.d -bar -boggle
29581 -d fred.c -foo -baz -boggle
29582 -d jim.d -bar -baz -boggle
29583 @end smallexample
29584
29585 @item %@{S:X; T:Y; :D@}
29586
29587 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29588 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29589 be as many clauses as you need. This may be combined with @code{.},
29590 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29591
29592
29593 @end table
29594
29595 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29596 or similar construct can use a backslash to ignore the special meaning
29597 of the character following it, thus allowing literal matching of a
29598 character that is otherwise specially treated. For example,
29599 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29600 @option{-std=iso9899:1999} option is given.
29601
29602 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29603 construct may contain other nested @samp{%} constructs or spaces, or
29604 even newlines. They are processed as usual, as described above.
29605 Trailing white space in @code{X} is ignored. White space may also
29606 appear anywhere on the left side of the colon in these constructs,
29607 except between @code{.} or @code{*} and the corresponding word.
29608
29609 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29610 handled specifically in these constructs. If another value of
29611 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29612 @option{-W} switch is found later in the command line, the earlier
29613 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29614 just one letter, which passes all matching options.
29615
29616 The character @samp{|} at the beginning of the predicate text is used to
29617 indicate that a command should be piped to the following command, but
29618 only if @option{-pipe} is specified.
29619
29620 It is built into GCC which switches take arguments and which do not.
29621 (You might think it would be useful to generalize this to allow each
29622 compiler's spec to say which switches take arguments. But this cannot
29623 be done in a consistent fashion. GCC cannot even decide which input
29624 files have been specified without knowing which switches take arguments,
29625 and it must know which input files to compile in order to tell which
29626 compilers to run).
29627
29628 GCC also knows implicitly that arguments starting in @option{-l} are to be
29629 treated as compiler output files, and passed to the linker in their
29630 proper position among the other output files.
29631
29632 @node Environment Variables
29633 @section Environment Variables Affecting GCC
29634 @cindex environment variables
29635
29636 @c man begin ENVIRONMENT
29637 This section describes several environment variables that affect how GCC
29638 operates. Some of them work by specifying directories or prefixes to use
29639 when searching for various kinds of files. Some are used to specify other
29640 aspects of the compilation environment.
29641
29642 Note that you can also specify places to search using options such as
29643 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29644 take precedence over places specified using environment variables, which
29645 in turn take precedence over those specified by the configuration of GCC@.
29646 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29647 GNU Compiler Collection (GCC) Internals}.
29648
29649 @table @env
29650 @item LANG
29651 @itemx LC_CTYPE
29652 @c @itemx LC_COLLATE
29653 @itemx LC_MESSAGES
29654 @c @itemx LC_MONETARY
29655 @c @itemx LC_NUMERIC
29656 @c @itemx LC_TIME
29657 @itemx LC_ALL
29658 @findex LANG
29659 @findex LC_CTYPE
29660 @c @findex LC_COLLATE
29661 @findex LC_MESSAGES
29662 @c @findex LC_MONETARY
29663 @c @findex LC_NUMERIC
29664 @c @findex LC_TIME
29665 @findex LC_ALL
29666 @cindex locale
29667 These environment variables control the way that GCC uses
29668 localization information which allows GCC to work with different
29669 national conventions. GCC inspects the locale categories
29670 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29671 so. These locale categories can be set to any value supported by your
29672 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29673 Kingdom encoded in UTF-8.
29674
29675 The @env{LC_CTYPE} environment variable specifies character
29676 classification. GCC uses it to determine the character boundaries in
29677 a string; this is needed for some multibyte encodings that contain quote
29678 and escape characters that are otherwise interpreted as a string
29679 end or escape.
29680
29681 The @env{LC_MESSAGES} environment variable specifies the language to
29682 use in diagnostic messages.
29683
29684 If the @env{LC_ALL} environment variable is set, it overrides the value
29685 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29686 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29687 environment variable. If none of these variables are set, GCC
29688 defaults to traditional C English behavior.
29689
29690 @item TMPDIR
29691 @findex TMPDIR
29692 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29693 files. GCC uses temporary files to hold the output of one stage of
29694 compilation which is to be used as input to the next stage: for example,
29695 the output of the preprocessor, which is the input to the compiler
29696 proper.
29697
29698 @item GCC_COMPARE_DEBUG
29699 @findex GCC_COMPARE_DEBUG
29700 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29701 @option{-fcompare-debug} to the compiler driver. See the documentation
29702 of this option for more details.
29703
29704 @item GCC_EXEC_PREFIX
29705 @findex GCC_EXEC_PREFIX
29706 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29707 names of the subprograms executed by the compiler. No slash is added
29708 when this prefix is combined with the name of a subprogram, but you can
29709 specify a prefix that ends with a slash if you wish.
29710
29711 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29712 an appropriate prefix to use based on the pathname it is invoked with.
29713
29714 If GCC cannot find the subprogram using the specified prefix, it
29715 tries looking in the usual places for the subprogram.
29716
29717 The default value of @env{GCC_EXEC_PREFIX} is
29718 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29719 the installed compiler. In many cases @var{prefix} is the value
29720 of @code{prefix} when you ran the @file{configure} script.
29721
29722 Other prefixes specified with @option{-B} take precedence over this prefix.
29723
29724 This prefix is also used for finding files such as @file{crt0.o} that are
29725 used for linking.
29726
29727 In addition, the prefix is used in an unusual way in finding the
29728 directories to search for header files. For each of the standard
29729 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29730 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29731 replacing that beginning with the specified prefix to produce an
29732 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29733 @file{foo/bar} just before it searches the standard directory
29734 @file{/usr/local/lib/bar}.
29735 If a standard directory begins with the configured
29736 @var{prefix} then the value of @var{prefix} is replaced by
29737 @env{GCC_EXEC_PREFIX} when looking for header files.
29738
29739 @item COMPILER_PATH
29740 @findex COMPILER_PATH
29741 The value of @env{COMPILER_PATH} is a colon-separated list of
29742 directories, much like @env{PATH}. GCC tries the directories thus
29743 specified when searching for subprograms, if it cannot find the
29744 subprograms using @env{GCC_EXEC_PREFIX}.
29745
29746 @item LIBRARY_PATH
29747 @findex LIBRARY_PATH
29748 The value of @env{LIBRARY_PATH} is a colon-separated list of
29749 directories, much like @env{PATH}. When configured as a native compiler,
29750 GCC tries the directories thus specified when searching for special
29751 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29752 using GCC also uses these directories when searching for ordinary
29753 libraries for the @option{-l} option (but directories specified with
29754 @option{-L} come first).
29755
29756 @item LANG
29757 @findex LANG
29758 @cindex locale definition
29759 This variable is used to pass locale information to the compiler. One way in
29760 which this information is used is to determine the character set to be used
29761 when character literals, string literals and comments are parsed in C and C++.
29762 When the compiler is configured to allow multibyte characters,
29763 the following values for @env{LANG} are recognized:
29764
29765 @table @samp
29766 @item C-JIS
29767 Recognize JIS characters.
29768 @item C-SJIS
29769 Recognize SJIS characters.
29770 @item C-EUCJP
29771 Recognize EUCJP characters.
29772 @end table
29773
29774 If @env{LANG} is not defined, or if it has some other value, then the
29775 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29776 recognize and translate multibyte characters.
29777 @end table
29778
29779 @noindent
29780 Some additional environment variables affect the behavior of the
29781 preprocessor.
29782
29783 @include cppenv.texi
29784
29785 @c man end
29786
29787 @node Precompiled Headers
29788 @section Using Precompiled Headers
29789 @cindex precompiled headers
29790 @cindex speed of compilation
29791
29792 Often large projects have many header files that are included in every
29793 source file. The time the compiler takes to process these header files
29794 over and over again can account for nearly all of the time required to
29795 build the project. To make builds faster, GCC allows you to
29796 @dfn{precompile} a header file.
29797
29798 To create a precompiled header file, simply compile it as you would any
29799 other file, if necessary using the @option{-x} option to make the driver
29800 treat it as a C or C++ header file. You may want to use a
29801 tool like @command{make} to keep the precompiled header up-to-date when
29802 the headers it contains change.
29803
29804 A precompiled header file is searched for when @code{#include} is
29805 seen in the compilation. As it searches for the included file
29806 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29807 compiler looks for a precompiled header in each directory just before it
29808 looks for the include file in that directory. The name searched for is
29809 the name specified in the @code{#include} with @samp{.gch} appended. If
29810 the precompiled header file cannot be used, it is ignored.
29811
29812 For instance, if you have @code{#include "all.h"}, and you have
29813 @file{all.h.gch} in the same directory as @file{all.h}, then the
29814 precompiled header file is used if possible, and the original
29815 header is used otherwise.
29816
29817 Alternatively, you might decide to put the precompiled header file in a
29818 directory and use @option{-I} to ensure that directory is searched
29819 before (or instead of) the directory containing the original header.
29820 Then, if you want to check that the precompiled header file is always
29821 used, you can put a file of the same name as the original header in this
29822 directory containing an @code{#error} command.
29823
29824 This also works with @option{-include}. So yet another way to use
29825 precompiled headers, good for projects not designed with precompiled
29826 header files in mind, is to simply take most of the header files used by
29827 a project, include them from another header file, precompile that header
29828 file, and @option{-include} the precompiled header. If the header files
29829 have guards against multiple inclusion, they are skipped because
29830 they've already been included (in the precompiled header).
29831
29832 If you need to precompile the same header file for different
29833 languages, targets, or compiler options, you can instead make a
29834 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29835 header in the directory, perhaps using @option{-o}. It doesn't matter
29836 what you call the files in the directory; every precompiled header in
29837 the directory is considered. The first precompiled header
29838 encountered in the directory that is valid for this compilation is
29839 used; they're searched in no particular order.
29840
29841 There are many other possibilities, limited only by your imagination,
29842 good sense, and the constraints of your build system.
29843
29844 A precompiled header file can be used only when these conditions apply:
29845
29846 @itemize
29847 @item
29848 Only one precompiled header can be used in a particular compilation.
29849
29850 @item
29851 A precompiled header cannot be used once the first C token is seen. You
29852 can have preprocessor directives before a precompiled header; you cannot
29853 include a precompiled header from inside another header.
29854
29855 @item
29856 The precompiled header file must be produced for the same language as
29857 the current compilation. You cannot use a C precompiled header for a C++
29858 compilation.
29859
29860 @item
29861 The precompiled header file must have been produced by the same compiler
29862 binary as the current compilation is using.
29863
29864 @item
29865 Any macros defined before the precompiled header is included must
29866 either be defined in the same way as when the precompiled header was
29867 generated, or must not affect the precompiled header, which usually
29868 means that they don't appear in the precompiled header at all.
29869
29870 The @option{-D} option is one way to define a macro before a
29871 precompiled header is included; using a @code{#define} can also do it.
29872 There are also some options that define macros implicitly, like
29873 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29874 defined this way.
29875
29876 @item If debugging information is output when using the precompiled
29877 header, using @option{-g} or similar, the same kind of debugging information
29878 must have been output when building the precompiled header. However,
29879 a precompiled header built using @option{-g} can be used in a compilation
29880 when no debugging information is being output.
29881
29882 @item The same @option{-m} options must generally be used when building
29883 and using the precompiled header. @xref{Submodel Options},
29884 for any cases where this rule is relaxed.
29885
29886 @item Each of the following options must be the same when building and using
29887 the precompiled header:
29888
29889 @gccoptlist{-fexceptions}
29890
29891 @item
29892 Some other command-line options starting with @option{-f},
29893 @option{-p}, or @option{-O} must be defined in the same way as when
29894 the precompiled header was generated. At present, it's not clear
29895 which options are safe to change and which are not; the safest choice
29896 is to use exactly the same options when generating and using the
29897 precompiled header. The following are known to be safe:
29898
29899 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29900 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29901 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29902 -pedantic-errors}
29903
29904 @end itemize
29905
29906 For all of these except the last, the compiler automatically
29907 ignores the precompiled header if the conditions aren't met. If you
29908 find an option combination that doesn't work and doesn't cause the
29909 precompiled header to be ignored, please consider filing a bug report,
29910 see @ref{Bugs}.
29911
29912 If you do use differing options when generating and using the
29913 precompiled header, the actual behavior is a mixture of the
29914 behavior for the options. For instance, if you use @option{-g} to
29915 generate the precompiled header but not when using it, you may or may
29916 not get debugging information for routines in the precompiled header.