]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Change wording of -fipa-icf documentation
[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 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
392 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
393 -fvar-tracking -fvar-tracking-assignments}
394
395 @item Optimization Options
396 @xref{Optimize Options,,Options that Control Optimization}.
397 @gccoptlist{-faggressive-loop-optimizations @gol
398 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
399 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
400 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
403 -fauto-inc-dec -fbranch-probabilities @gol
404 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
405 -fbtr-bb-exclusive -fcaller-saves @gol
406 -fcombine-stack-adjustments -fconserve-stack @gol
407 -fcompare-elim -fcprop-registers -fcrossjumping @gol
408 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
409 -fcx-limited-range @gol
410 -fdata-sections -fdce -fdelayed-branch @gol
411 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
412 -fdevirtualize-at-ltrans -fdse @gol
413 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
414 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
415 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
416 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
417 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
418 -fif-conversion2 -findirect-inlining @gol
419 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
420 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
421 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
422 -fipa-reference -fipa-reference-addressable @gol
423 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
424 -flive-patching=@var{level} @gol
425 -fira-region=@var{region} -fira-hoist-pressure @gol
426 -fira-loop-pressure -fno-ira-share-save-slots @gol
427 -fno-ira-share-spill-slots @gol
428 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
429 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
430 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
431 -floop-block -floop-interchange -floop-strip-mine @gol
432 -floop-unroll-and-jam -floop-nest-optimize @gol
433 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
434 -flto-partition=@var{alg} -fmerge-all-constants @gol
435 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
436 -fmove-loop-invariants -fno-branch-count-reg @gol
437 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
438 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
439 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
440 -fno-sched-spec -fno-signed-zeros @gol
441 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
442 -fomit-frame-pointer -foptimize-sibling-calls @gol
443 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
444 -fprefetch-loop-arrays @gol
445 -fprofile-correction @gol
446 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
447 -fprofile-reorder-functions @gol
448 -freciprocal-math -free -frename-registers -freorder-blocks @gol
449 -freorder-blocks-algorithm=@var{algorithm} @gol
450 -freorder-blocks-and-partition -freorder-functions @gol
451 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
452 -frounding-math -fsave-optimization-record @gol
453 -fsched2-use-superblocks -fsched-pressure @gol
454 -fsched-spec-load -fsched-spec-load-dangerous @gol
455 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
456 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
457 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
458 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
459 -fschedule-fusion @gol
460 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
461 -fselective-scheduling -fselective-scheduling2 @gol
462 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
463 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
464 -fsignaling-nans @gol
465 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
466 -fsplit-paths @gol
467 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
468 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
469 -fthread-jumps -ftracer -ftree-bit-ccp @gol
470 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
471 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
472 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
473 -ftree-loop-if-convert -ftree-loop-im @gol
474 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
475 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
476 -ftree-loop-vectorize @gol
477 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
478 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
479 -ftree-switch-conversion -ftree-tail-merge @gol
480 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
481 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
482 -funsafe-math-optimizations -funswitch-loops @gol
483 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
484 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
485 --param @var{name}=@var{value}
486 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
487
488 @item Program Instrumentation Options
489 @xref{Instrumentation Options,,Program Instrumentation Options}.
490 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
491 -fprofile-abs-path @gol
492 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
493 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
494 -fprofile-exclude-files=@var{regex} @gol
495 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
496 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
497 -fsanitize-undefined-trap-on-error -fbounds-check @gol
498 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
499 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
500 -fstack-protector-explicit -fstack-check @gol
501 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
502 -fno-stack-limit -fsplit-stack @gol
503 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
504 -fvtv-counts -fvtv-debug @gol
505 -finstrument-functions @gol
506 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
507 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
508
509 @item Preprocessor Options
510 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
511 @gccoptlist{-A@var{question}=@var{answer} @gol
512 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
513 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
514 -dD -dI -dM -dN -dU @gol
515 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
516 -fexec-charset=@var{charset} -fextended-identifiers @gol
517 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
518 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
519 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
520 -fwide-exec-charset=@var{charset} -fworking-directory @gol
521 -H -imacros @var{file} -include @var{file} @gol
522 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
523 -no-integrated-cpp -P -pthread -remap @gol
524 -traditional -traditional-cpp -trigraphs @gol
525 -U@var{macro} -undef @gol
526 -Wp,@var{option} -Xpreprocessor @var{option}}
527
528 @item Assembler Options
529 @xref{Assembler Options,,Passing Options to the Assembler}.
530 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
531
532 @item Linker Options
533 @xref{Link Options,,Options for Linking}.
534 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
535 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
536 -e @var{entry} --entry=@var{entry} @gol
537 -pie -pthread -r -rdynamic @gol
538 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
539 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
540 -shared -shared-libgcc -symbolic @gol
541 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
542 -u @var{symbol} -z @var{keyword}}
543
544 @item Directory Options
545 @xref{Directory Options,,Options for Directory Search}.
546 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
547 -idirafter @var{dir} @gol
548 -imacros @var{file} -imultilib @var{dir} @gol
549 -iplugindir=@var{dir} -iprefix @var{file} @gol
550 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
551 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
552 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
553 -nostdinc -nostdinc++ --sysroot=@var{dir}}
554
555 @item Code Generation Options
556 @xref{Code Gen Options,,Options for Code Generation Conventions}.
557 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
558 -ffixed-@var{reg} -fexceptions @gol
559 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
560 -fasynchronous-unwind-tables @gol
561 -fno-gnu-unique @gol
562 -finhibit-size-directive -fno-common -fno-ident @gol
563 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
564 -fno-jump-tables @gol
565 -frecord-gcc-switches @gol
566 -freg-struct-return -fshort-enums -fshort-wchar @gol
567 -fverbose-asm -fpack-struct[=@var{n}] @gol
568 -fleading-underscore -ftls-model=@var{model} @gol
569 -fstack-reuse=@var{reuse_level} @gol
570 -ftrampolines -ftrapv -fwrapv @gol
571 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
572 -fstrict-volatile-bitfields -fsync-libcalls}
573
574 @item Developer Options
575 @xref{Developer Options,,GCC Developer Options}.
576 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
577 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
578 -fdbg-cnt=@var{counter-value-list} @gol
579 -fdisable-ipa-@var{pass_name} @gol
580 -fdisable-rtl-@var{pass_name} @gol
581 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
582 -fdisable-tree-@var{pass_name} @gol
583 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
584 -fdump-debug -fdump-earlydebug @gol
585 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
586 -fdump-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}]|@var{bti} @gol
636 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
637 -moverride=@var{string} -mverbose-cost-dump @gol
638 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
639 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
640
641 @emph{Adapteva Epiphany Options}
642 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
643 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
644 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
645 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
646 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
647 -msplit-vecmove-early -m1reg-@var{reg}}
648
649 @emph{AMD GCN Options}
650 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
651
652 @emph{ARC Options}
653 @gccoptlist{-mbarrel-shifter -mjli-always @gol
654 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
655 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
656 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
657 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
658 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
659 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
660 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
661 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
662 -mvolatile-cache -mtp-regno=@var{regno} @gol
663 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
664 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
665 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
666 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
667 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
668 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
669 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
670 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
671
672 @emph{ARM Options}
673 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
674 -mabi=@var{name} @gol
675 -mapcs-stack-check -mno-apcs-stack-check @gol
676 -mapcs-reentrant -mno-apcs-reentrant @gol
677 -msched-prolog -mno-sched-prolog @gol
678 -mlittle-endian -mbig-endian @gol
679 -mbe8 -mbe32 @gol
680 -mfloat-abi=@var{name} @gol
681 -mfp16-format=@var{name}
682 -mthumb-interwork -mno-thumb-interwork @gol
683 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
684 -mtune=@var{name} -mprint-tune-info @gol
685 -mstructure-size-boundary=@var{n} @gol
686 -mabort-on-noreturn @gol
687 -mlong-calls -mno-long-calls @gol
688 -msingle-pic-base -mno-single-pic-base @gol
689 -mpic-register=@var{reg} @gol
690 -mnop-fun-dllimport @gol
691 -mpoke-function-name @gol
692 -mthumb -marm -mflip-thumb @gol
693 -mtpcs-frame -mtpcs-leaf-frame @gol
694 -mcaller-super-interworking -mcallee-super-interworking @gol
695 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
696 -mword-relocations @gol
697 -mfix-cortex-m3-ldrd @gol
698 -munaligned-access @gol
699 -mneon-for-64bits @gol
700 -mslow-flash-data @gol
701 -masm-syntax-unified @gol
702 -mrestrict-it @gol
703 -mverbose-cost-dump @gol
704 -mpure-code @gol
705 -mcmse}
706
707 @emph{AVR Options}
708 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
709 -mbranch-cost=@var{cost} @gol
710 -mcall-prologues -mgas-isr-prologues -mint8 @gol
711 -mn_flash=@var{size} -mno-interrupts @gol
712 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
713 -mfract-convert-truncate @gol
714 -mshort-calls -nodevicelib @gol
715 -Waddr-space-convert -Wmisspelled-isr}
716
717 @emph{Blackfin Options}
718 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
719 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
720 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
721 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
722 -mno-id-shared-library -mshared-library-id=@var{n} @gol
723 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
724 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
725 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
726 -micplb}
727
728 @emph{C6X Options}
729 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
730 -msim -msdata=@var{sdata-type}}
731
732 @emph{CRIS Options}
733 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
734 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
735 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
736 -mstack-align -mdata-align -mconst-align @gol
737 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
738 -melf -maout -melinux -mlinux -sim -sim2 @gol
739 -mmul-bug-workaround -mno-mul-bug-workaround}
740
741 @emph{CR16 Options}
742 @gccoptlist{-mmac @gol
743 -mcr16cplus -mcr16c @gol
744 -msim -mint32 -mbit-ops
745 -mdata-model=@var{model}}
746
747 @emph{C-SKY Options}
748 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
749 -mbig-endian -EB -mlittle-endian -EL @gol
750 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
751 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
752 -mdsp -medsp -mvdsp @gol
753 -mdiv -msmart -mhigh-registers -manchor @gol
754 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
755 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
756
757 @emph{Darwin Options}
758 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
759 -arch_only -bind_at_load -bundle -bundle_loader @gol
760 -client_name -compatibility_version -current_version @gol
761 -dead_strip @gol
762 -dependency-file -dylib_file -dylinker_install_name @gol
763 -dynamic -dynamiclib -exported_symbols_list @gol
764 -filelist -flat_namespace -force_cpusubtype_ALL @gol
765 -force_flat_namespace -headerpad_max_install_names @gol
766 -iframework @gol
767 -image_base -init -install_name -keep_private_externs @gol
768 -multi_module -multiply_defined -multiply_defined_unused @gol
769 -noall_load -no_dead_strip_inits_and_terms @gol
770 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
771 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
772 -private_bundle -read_only_relocs -sectalign @gol
773 -sectobjectsymbols -whyload -seg1addr @gol
774 -sectcreate -sectobjectsymbols -sectorder @gol
775 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
776 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
777 -segprot -segs_read_only_addr -segs_read_write_addr @gol
778 -single_module -static -sub_library -sub_umbrella @gol
779 -twolevel_namespace -umbrella -undefined @gol
780 -unexported_symbols_list -weak_reference_mismatches @gol
781 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
782 -mkernel -mone-byte-bool}
783
784 @emph{DEC Alpha Options}
785 @gccoptlist{-mno-fp-regs -msoft-float @gol
786 -mieee -mieee-with-inexact -mieee-conformant @gol
787 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
788 -mtrap-precision=@var{mode} -mbuild-constants @gol
789 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
790 -mbwx -mmax -mfix -mcix @gol
791 -mfloat-vax -mfloat-ieee @gol
792 -mexplicit-relocs -msmall-data -mlarge-data @gol
793 -msmall-text -mlarge-text @gol
794 -mmemory-latency=@var{time}}
795
796 @emph{FR30 Options}
797 @gccoptlist{-msmall-model -mno-lsim}
798
799 @emph{FT32 Options}
800 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
801
802 @emph{FRV Options}
803 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
804 -mhard-float -msoft-float @gol
805 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
806 -mdouble -mno-double @gol
807 -mmedia -mno-media -mmuladd -mno-muladd @gol
808 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
809 -mlinked-fp -mlong-calls -malign-labels @gol
810 -mlibrary-pic -macc-4 -macc-8 @gol
811 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
812 -moptimize-membar -mno-optimize-membar @gol
813 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
814 -mvliw-branch -mno-vliw-branch @gol
815 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
816 -mno-nested-cond-exec -mtomcat-stats @gol
817 -mTLS -mtls @gol
818 -mcpu=@var{cpu}}
819
820 @emph{GNU/Linux Options}
821 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
822 -tno-android-cc -tno-android-ld}
823
824 @emph{H8/300 Options}
825 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
826
827 @emph{HPPA Options}
828 @gccoptlist{-march=@var{architecture-type} @gol
829 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
830 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
831 -mfixed-range=@var{register-range} @gol
832 -mjump-in-delay -mlinker-opt -mlong-calls @gol
833 -mlong-load-store -mno-disable-fpregs @gol
834 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
835 -mno-jump-in-delay -mno-long-load-store @gol
836 -mno-portable-runtime -mno-soft-float @gol
837 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
838 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
839 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
840 -munix=@var{unix-std} -nolibdld -static -threads}
841
842 @emph{IA-64 Options}
843 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
844 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
845 -mconstant-gp -mauto-pic -mfused-madd @gol
846 -minline-float-divide-min-latency @gol
847 -minline-float-divide-max-throughput @gol
848 -mno-inline-float-divide @gol
849 -minline-int-divide-min-latency @gol
850 -minline-int-divide-max-throughput @gol
851 -mno-inline-int-divide @gol
852 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
853 -mno-inline-sqrt @gol
854 -mdwarf2-asm -mearly-stop-bits @gol
855 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
856 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
857 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
858 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
859 -msched-spec-ldc -msched-spec-control-ldc @gol
860 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
861 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
862 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
863 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
864
865 @emph{LM32 Options}
866 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
867 -msign-extend-enabled -muser-enabled}
868
869 @emph{M32R/D Options}
870 @gccoptlist{-m32r2 -m32rx -m32r @gol
871 -mdebug @gol
872 -malign-loops -mno-align-loops @gol
873 -missue-rate=@var{number} @gol
874 -mbranch-cost=@var{number} @gol
875 -mmodel=@var{code-size-model-type} @gol
876 -msdata=@var{sdata-type} @gol
877 -mno-flush-func -mflush-func=@var{name} @gol
878 -mno-flush-trap -mflush-trap=@var{number} @gol
879 -G @var{num}}
880
881 @emph{M32C Options}
882 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
883
884 @emph{M680x0 Options}
885 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
886 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
887 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
888 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
889 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
890 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
891 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
892 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
893 -mxgot -mno-xgot -mlong-jump-table-offsets}
894
895 @emph{MCore Options}
896 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
897 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
898 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
899 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
900 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
901
902 @emph{MeP Options}
903 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
904 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
905 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
906 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
907 -mtiny=@var{n}}
908
909 @emph{MicroBlaze Options}
910 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
911 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
912 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
913 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
914 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
915 -mpic-data-is-text-relative}
916
917 @emph{MIPS Options}
918 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
919 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
920 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
921 -mips16 -mno-mips16 -mflip-mips16 @gol
922 -minterlink-compressed -mno-interlink-compressed @gol
923 -minterlink-mips16 -mno-interlink-mips16 @gol
924 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
925 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
926 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
927 -mno-float -msingle-float -mdouble-float @gol
928 -modd-spreg -mno-odd-spreg @gol
929 -mabs=@var{mode} -mnan=@var{encoding} @gol
930 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
931 -mmcu -mmno-mcu @gol
932 -meva -mno-eva @gol
933 -mvirt -mno-virt @gol
934 -mxpa -mno-xpa @gol
935 -mcrc -mno-crc @gol
936 -mginv -mno-ginv @gol
937 -mmicromips -mno-micromips @gol
938 -mmsa -mno-msa @gol
939 -mloongson-mmi -mno-loongson-mmi @gol
940 -mloongson-ext -mno-loongson-ext @gol
941 -mloongson-ext2 -mno-loongson-ext2 @gol
942 -mfpu=@var{fpu-type} @gol
943 -msmartmips -mno-smartmips @gol
944 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
945 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
946 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
947 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
948 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
949 -membedded-data -mno-embedded-data @gol
950 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
951 -mcode-readable=@var{setting} @gol
952 -msplit-addresses -mno-split-addresses @gol
953 -mexplicit-relocs -mno-explicit-relocs @gol
954 -mcheck-zero-division -mno-check-zero-division @gol
955 -mdivide-traps -mdivide-breaks @gol
956 -mload-store-pairs -mno-load-store-pairs @gol
957 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
958 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
959 -mfix-24k -mno-fix-24k @gol
960 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
961 -mfix-r5900 -mno-fix-r5900 @gol
962 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
963 -mfix-vr4120 -mno-fix-vr4120 @gol
964 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
965 -mflush-func=@var{func} -mno-flush-func @gol
966 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
967 -mcompact-branches=@var{policy} @gol
968 -mfp-exceptions -mno-fp-exceptions @gol
969 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
970 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
971 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
972 -mframe-header-opt -mno-frame-header-opt}
973
974 @emph{MMIX Options}
975 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
976 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
977 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
978 -mno-base-addresses -msingle-exit -mno-single-exit}
979
980 @emph{MN10300 Options}
981 @gccoptlist{-mmult-bug -mno-mult-bug @gol
982 -mno-am33 -mam33 -mam33-2 -mam34 @gol
983 -mtune=@var{cpu-type} @gol
984 -mreturn-pointer-on-d0 @gol
985 -mno-crt0 -mrelax -mliw -msetlb}
986
987 @emph{Moxie Options}
988 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
989
990 @emph{MSP430 Options}
991 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
992 -mwarn-mcu @gol
993 -mcode-region= -mdata-region= @gol
994 -msilicon-errata= -msilicon-errata-warn= @gol
995 -mhwmult= -minrt}
996
997 @emph{NDS32 Options}
998 @gccoptlist{-mbig-endian -mlittle-endian @gol
999 -mreduced-regs -mfull-regs @gol
1000 -mcmov -mno-cmov @gol
1001 -mext-perf -mno-ext-perf @gol
1002 -mext-perf2 -mno-ext-perf2 @gol
1003 -mext-string -mno-ext-string @gol
1004 -mv3push -mno-v3push @gol
1005 -m16bit -mno-16bit @gol
1006 -misr-vector-size=@var{num} @gol
1007 -mcache-block-size=@var{num} @gol
1008 -march=@var{arch} @gol
1009 -mcmodel=@var{code-model} @gol
1010 -mctor-dtor -mrelax}
1011
1012 @emph{Nios II Options}
1013 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1014 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1015 -mel -meb @gol
1016 -mno-bypass-cache -mbypass-cache @gol
1017 -mno-cache-volatile -mcache-volatile @gol
1018 -mno-fast-sw-div -mfast-sw-div @gol
1019 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1020 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1021 -mcustom-fpu-cfg=@var{name} @gol
1022 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1023 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1024
1025 @emph{Nvidia PTX Options}
1026 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1027
1028 @emph{OpenRISC Options}
1029 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1030 -msoft-mul -msoft-div @gol
1031 -mcmov -mror -msext -msfimm -mshftimm}
1032
1033 @emph{PDP-11 Options}
1034 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1035 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1036 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1037
1038 @emph{picoChip Options}
1039 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1040 -msymbol-as-address -mno-inefficient-warnings}
1041
1042 @emph{PowerPC Options}
1043 See RS/6000 and PowerPC Options.
1044
1045 @emph{RISC-V Options}
1046 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1047 -mplt -mno-plt @gol
1048 -mabi=@var{ABI-string} @gol
1049 -mfdiv -mno-fdiv @gol
1050 -mdiv -mno-div @gol
1051 -march=@var{ISA-string} @gol
1052 -mtune=@var{processor-string} @gol
1053 -mpreferred-stack-boundary=@var{num} @gol
1054 -msmall-data-limit=@var{N-bytes} @gol
1055 -msave-restore -mno-save-restore @gol
1056 -mstrict-align -mno-strict-align @gol
1057 -mcmodel=medlow -mcmodel=medany @gol
1058 -mexplicit-relocs -mno-explicit-relocs @gol
1059 -mrelax -mno-relax @gol
1060 -mriscv-attribute -mmo-riscv-attribute}
1061
1062 @emph{RL78 Options}
1063 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1064 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1065 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1066
1067 @emph{RS/6000 and PowerPC Options}
1068 @gccoptlist{-mcpu=@var{cpu-type} @gol
1069 -mtune=@var{cpu-type} @gol
1070 -mcmodel=@var{code-model} @gol
1071 -mpowerpc64 @gol
1072 -maltivec -mno-altivec @gol
1073 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1074 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1075 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1076 -mfprnd -mno-fprnd @gol
1077 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1078 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1079 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1080 -malign-power -malign-natural @gol
1081 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1082 -mupdate -mno-update @gol
1083 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1084 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1085 -mstrict-align -mno-strict-align -mrelocatable @gol
1086 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1087 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1088 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1089 -mprioritize-restricted-insns=@var{priority} @gol
1090 -msched-costly-dep=@var{dependence_type} @gol
1091 -minsert-sched-nops=@var{scheme} @gol
1092 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1093 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1094 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1095 -mtraceback=@var{traceback_type} @gol
1096 -maix-struct-return -msvr4-struct-return @gol
1097 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1098 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1099 -mblock-move-inline-limit=@var{num} @gol
1100 -mblock-compare-inline-limit=@var{num} @gol
1101 -mblock-compare-inline-loop-limit=@var{num} @gol
1102 -mstring-compare-inline-limit=@var{num} @gol
1103 -misel -mno-isel @gol
1104 -mvrsave -mno-vrsave @gol
1105 -mmulhw -mno-mulhw @gol
1106 -mdlmzb -mno-dlmzb @gol
1107 -mprototype -mno-prototype @gol
1108 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1109 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1110 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1111 -mno-recip-precision @gol
1112 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1113 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1114 -msave-toc-indirect -mno-save-toc-indirect @gol
1115 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1116 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1117 -mquad-memory -mno-quad-memory @gol
1118 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1119 -mcompat-align-parm -mno-compat-align-parm @gol
1120 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1121 -mgnu-attribute -mno-gnu-attribute @gol
1122 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1123 -mstack-protector-guard-offset=@var{offset}}
1124
1125 @emph{RX Options}
1126 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1127 -mcpu=@gol
1128 -mbig-endian-data -mlittle-endian-data @gol
1129 -msmall-data @gol
1130 -msim -mno-sim@gol
1131 -mas100-syntax -mno-as100-syntax@gol
1132 -mrelax@gol
1133 -mmax-constant-size=@gol
1134 -mint-register=@gol
1135 -mpid@gol
1136 -mallow-string-insns -mno-allow-string-insns@gol
1137 -mjsr@gol
1138 -mno-warn-multiple-fast-interrupts@gol
1139 -msave-acc-in-interrupts}
1140
1141 @emph{S/390 and zSeries Options}
1142 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1143 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1144 -mlong-double-64 -mlong-double-128 @gol
1145 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1146 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1147 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1148 -mhtm -mvx -mzvector @gol
1149 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1150 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1151 -mhotpatch=@var{halfwords},@var{halfwords}}
1152
1153 @emph{Score Options}
1154 @gccoptlist{-meb -mel @gol
1155 -mnhwloop @gol
1156 -muls @gol
1157 -mmac @gol
1158 -mscore5 -mscore5u -mscore7 -mscore7d}
1159
1160 @emph{SH Options}
1161 @gccoptlist{-m1 -m2 -m2e @gol
1162 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1163 -m3 -m3e @gol
1164 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1165 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1166 -mb -ml -mdalign -mrelax @gol
1167 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1168 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1169 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1170 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1171 -maccumulate-outgoing-args @gol
1172 -matomic-model=@var{atomic-model} @gol
1173 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1174 -mcbranch-force-delay-slot @gol
1175 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1176 -mpretend-cmove -mtas}
1177
1178 @emph{Solaris 2 Options}
1179 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1180 -pthreads}
1181
1182 @emph{SPARC Options}
1183 @gccoptlist{-mcpu=@var{cpu-type} @gol
1184 -mtune=@var{cpu-type} @gol
1185 -mcmodel=@var{code-model} @gol
1186 -mmemory-model=@var{mem-model} @gol
1187 -m32 -m64 -mapp-regs -mno-app-regs @gol
1188 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1189 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1190 -mhard-quad-float -msoft-quad-float @gol
1191 -mstack-bias -mno-stack-bias @gol
1192 -mstd-struct-return -mno-std-struct-return @gol
1193 -munaligned-doubles -mno-unaligned-doubles @gol
1194 -muser-mode -mno-user-mode @gol
1195 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1196 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1197 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1198 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1199 -mpopc -mno-popc -msubxc -mno-subxc @gol
1200 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1201 -mlra -mno-lra}
1202
1203 @emph{SPU Options}
1204 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1205 -msafe-dma -munsafe-dma @gol
1206 -mbranch-hints @gol
1207 -msmall-mem -mlarge-mem -mstdmain @gol
1208 -mfixed-range=@var{register-range} @gol
1209 -mea32 -mea64 @gol
1210 -maddress-space-conversion -mno-address-space-conversion @gol
1211 -mcache-size=@var{cache-size} @gol
1212 -matomic-updates -mno-atomic-updates}
1213
1214 @emph{System V Options}
1215 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1216
1217 @emph{TILE-Gx Options}
1218 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1219 -mcmodel=@var{code-model}}
1220
1221 @emph{TILEPro Options}
1222 @gccoptlist{-mcpu=@var{cpu} -m32}
1223
1224 @emph{V850 Options}
1225 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1226 -mprolog-function -mno-prolog-function -mspace @gol
1227 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1228 -mapp-regs -mno-app-regs @gol
1229 -mdisable-callt -mno-disable-callt @gol
1230 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1231 -mv850e -mv850 -mv850e3v5 @gol
1232 -mloop @gol
1233 -mrelax @gol
1234 -mlong-jumps @gol
1235 -msoft-float @gol
1236 -mhard-float @gol
1237 -mgcc-abi @gol
1238 -mrh850-abi @gol
1239 -mbig-switch}
1240
1241 @emph{VAX Options}
1242 @gccoptlist{-mg -mgnu -munix}
1243
1244 @emph{Visium Options}
1245 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1246 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1247
1248 @emph{VMS Options}
1249 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1250 -mpointer-size=@var{size}}
1251
1252 @emph{VxWorks Options}
1253 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1254 -Xbind-lazy -Xbind-now}
1255
1256 @emph{x86 Options}
1257 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1258 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1259 -mfpmath=@var{unit} @gol
1260 -masm=@var{dialect} -mno-fancy-math-387 @gol
1261 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1262 -mno-wide-multiply -mrtd -malign-double @gol
1263 -mpreferred-stack-boundary=@var{num} @gol
1264 -mincoming-stack-boundary=@var{num} @gol
1265 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1266 -mrecip -mrecip=@var{opt} @gol
1267 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1268 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1269 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1270 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1271 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1272 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1273 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1274 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1275 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1276 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 @gol
1277 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1278 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1279 -mrdseed -msgx @gol
1280 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1281 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1282 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1283 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1284 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1285 -mregparm=@var{num} -msseregparm @gol
1286 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1287 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1288 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1289 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1290 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1291 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1292 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1293 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1294 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1295 -mstack-protector-guard-reg=@var{reg} @gol
1296 -mstack-protector-guard-offset=@var{offset} @gol
1297 -mstack-protector-guard-symbol=@var{symbol} @gol
1298 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1299 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1300 -mindirect-branch-register}
1301
1302 @emph{x86 Windows Options}
1303 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1304 -mnop-fun-dllimport -mthread @gol
1305 -municode -mwin32 -mwindows -fno-set-stack-executable}
1306
1307 @emph{Xstormy16 Options}
1308 @gccoptlist{-msim}
1309
1310 @emph{Xtensa Options}
1311 @gccoptlist{-mconst16 -mno-const16 @gol
1312 -mfused-madd -mno-fused-madd @gol
1313 -mforce-no-pic @gol
1314 -mserialize-volatile -mno-serialize-volatile @gol
1315 -mtext-section-literals -mno-text-section-literals @gol
1316 -mauto-litpools -mno-auto-litpools @gol
1317 -mtarget-align -mno-target-align @gol
1318 -mlongcalls -mno-longcalls}
1319
1320 @emph{zSeries Options}
1321 See S/390 and zSeries Options.
1322 @end table
1323
1324
1325 @node Overall Options
1326 @section Options Controlling the Kind of Output
1327
1328 Compilation can involve up to four stages: preprocessing, compilation
1329 proper, assembly and linking, always in that order. GCC is capable of
1330 preprocessing and compiling several files either into several
1331 assembler input files, or into one assembler input file; then each
1332 assembler input file produces an object file, and linking combines all
1333 the object files (those newly compiled, and those specified as input)
1334 into an executable file.
1335
1336 @cindex file name suffix
1337 For any given input file, the file name suffix determines what kind of
1338 compilation is done:
1339
1340 @table @gcctabopt
1341 @item @var{file}.c
1342 C source code that must be preprocessed.
1343
1344 @item @var{file}.i
1345 C source code that should not be preprocessed.
1346
1347 @item @var{file}.ii
1348 C++ source code that should not be preprocessed.
1349
1350 @item @var{file}.m
1351 Objective-C source code. Note that you must link with the @file{libobjc}
1352 library to make an Objective-C program work.
1353
1354 @item @var{file}.mi
1355 Objective-C source code that should not be preprocessed.
1356
1357 @item @var{file}.mm
1358 @itemx @var{file}.M
1359 Objective-C++ source code. Note that you must link with the @file{libobjc}
1360 library to make an Objective-C++ program work. Note that @samp{.M} refers
1361 to a literal capital M@.
1362
1363 @item @var{file}.mii
1364 Objective-C++ source code that should not be preprocessed.
1365
1366 @item @var{file}.h
1367 C, C++, Objective-C or Objective-C++ header file to be turned into a
1368 precompiled header (default), or C, C++ header file to be turned into an
1369 Ada spec (via the @option{-fdump-ada-spec} switch).
1370
1371 @item @var{file}.cc
1372 @itemx @var{file}.cp
1373 @itemx @var{file}.cxx
1374 @itemx @var{file}.cpp
1375 @itemx @var{file}.CPP
1376 @itemx @var{file}.c++
1377 @itemx @var{file}.C
1378 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1379 the last two letters must both be literally @samp{x}. Likewise,
1380 @samp{.C} refers to a literal capital C@.
1381
1382 @item @var{file}.mm
1383 @itemx @var{file}.M
1384 Objective-C++ source code that must be preprocessed.
1385
1386 @item @var{file}.mii
1387 Objective-C++ source code that should not be preprocessed.
1388
1389 @item @var{file}.hh
1390 @itemx @var{file}.H
1391 @itemx @var{file}.hp
1392 @itemx @var{file}.hxx
1393 @itemx @var{file}.hpp
1394 @itemx @var{file}.HPP
1395 @itemx @var{file}.h++
1396 @itemx @var{file}.tcc
1397 C++ header file to be turned into a precompiled header or Ada spec.
1398
1399 @item @var{file}.f
1400 @itemx @var{file}.for
1401 @itemx @var{file}.ftn
1402 Fixed form Fortran source code that should not be preprocessed.
1403
1404 @item @var{file}.F
1405 @itemx @var{file}.FOR
1406 @itemx @var{file}.fpp
1407 @itemx @var{file}.FPP
1408 @itemx @var{file}.FTN
1409 Fixed form Fortran source code that must be preprocessed (with the traditional
1410 preprocessor).
1411
1412 @item @var{file}.f90
1413 @itemx @var{file}.f95
1414 @itemx @var{file}.f03
1415 @itemx @var{file}.f08
1416 Free form Fortran source code that should not be preprocessed.
1417
1418 @item @var{file}.F90
1419 @itemx @var{file}.F95
1420 @itemx @var{file}.F03
1421 @itemx @var{file}.F08
1422 Free form Fortran source code that must be preprocessed (with the
1423 traditional preprocessor).
1424
1425 @item @var{file}.go
1426 Go source code.
1427
1428 @item @var{file}.brig
1429 BRIG files (binary representation of HSAIL).
1430
1431 @item @var{file}.d
1432 D source code.
1433
1434 @item @var{file}.di
1435 D interface file.
1436
1437 @item @var{file}.dd
1438 D documentation code (Ddoc).
1439
1440 @item @var{file}.ads
1441 Ada source code file that contains a library unit declaration (a
1442 declaration of a package, subprogram, or generic, or a generic
1443 instantiation), or a library unit renaming declaration (a package,
1444 generic, or subprogram renaming declaration). Such files are also
1445 called @dfn{specs}.
1446
1447 @item @var{file}.adb
1448 Ada source code file containing a library unit body (a subprogram or
1449 package body). Such files are also called @dfn{bodies}.
1450
1451 @c GCC also knows about some suffixes for languages not yet included:
1452 @c Ratfor:
1453 @c @var{file}.r
1454
1455 @item @var{file}.s
1456 Assembler code.
1457
1458 @item @var{file}.S
1459 @itemx @var{file}.sx
1460 Assembler code that must be preprocessed.
1461
1462 @item @var{other}
1463 An object file to be fed straight into linking.
1464 Any file name with no recognized suffix is treated this way.
1465 @end table
1466
1467 @opindex x
1468 You can specify the input language explicitly with the @option{-x} option:
1469
1470 @table @gcctabopt
1471 @item -x @var{language}
1472 Specify explicitly the @var{language} for the following input files
1473 (rather than letting the compiler choose a default based on the file
1474 name suffix). This option applies to all following input files until
1475 the next @option{-x} option. Possible values for @var{language} are:
1476 @smallexample
1477 c c-header cpp-output
1478 c++ c++-header c++-cpp-output
1479 objective-c objective-c-header objective-c-cpp-output
1480 objective-c++ objective-c++-header objective-c++-cpp-output
1481 assembler assembler-with-cpp
1482 ada
1483 d
1484 f77 f77-cpp-input f95 f95-cpp-input
1485 go
1486 brig
1487 @end smallexample
1488
1489 @item -x none
1490 Turn off any specification of a language, so that subsequent files are
1491 handled according to their file name suffixes (as they are if @option{-x}
1492 has not been used at all).
1493 @end table
1494
1495 If you only want some of the stages of compilation, you can use
1496 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1497 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1498 @command{gcc} is to stop. Note that some combinations (for example,
1499 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1500
1501 @table @gcctabopt
1502 @item -c
1503 @opindex c
1504 Compile or assemble the source files, but do not link. The linking
1505 stage simply is not done. The ultimate output is in the form of an
1506 object file for each source file.
1507
1508 By default, the object file name for a source file is made by replacing
1509 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1510
1511 Unrecognized input files, not requiring compilation or assembly, are
1512 ignored.
1513
1514 @item -S
1515 @opindex S
1516 Stop after the stage of compilation proper; do not assemble. The output
1517 is in the form of an assembler code file for each non-assembler input
1518 file specified.
1519
1520 By default, the assembler file name for a source file is made by
1521 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1522
1523 Input files that don't require compilation are ignored.
1524
1525 @item -E
1526 @opindex E
1527 Stop after the preprocessing stage; do not run the compiler proper. The
1528 output is in the form of preprocessed source code, which is sent to the
1529 standard output.
1530
1531 Input files that don't require preprocessing are ignored.
1532
1533 @cindex output file option
1534 @item -o @var{file}
1535 @opindex o
1536 Place output in file @var{file}. This applies to whatever
1537 sort of output is being produced, whether it be an executable file,
1538 an object file, an assembler file or preprocessed C code.
1539
1540 If @option{-o} is not specified, the default is to put an executable
1541 file in @file{a.out}, the object file for
1542 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1543 assembler file in @file{@var{source}.s}, a precompiled header file in
1544 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1545 standard output.
1546
1547 @item -v
1548 @opindex v
1549 Print (on standard error output) the commands executed to run the stages
1550 of compilation. Also print the version number of the compiler driver
1551 program and of the preprocessor and the compiler proper.
1552
1553 @item -###
1554 @opindex ###
1555 Like @option{-v} except the commands are not executed and arguments
1556 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1557 This is useful for shell scripts to capture the driver-generated command lines.
1558
1559 @item --help
1560 @opindex help
1561 Print (on the standard output) a description of the command-line options
1562 understood by @command{gcc}. If the @option{-v} option is also specified
1563 then @option{--help} is also passed on to the various processes
1564 invoked by @command{gcc}, so that they can display the command-line options
1565 they accept. If the @option{-Wextra} option has also been specified
1566 (prior to the @option{--help} option), then command-line options that
1567 have no documentation associated with them are also displayed.
1568
1569 @item --target-help
1570 @opindex target-help
1571 Print (on the standard output) a description of target-specific command-line
1572 options for each tool. For some targets extra target-specific
1573 information may also be printed.
1574
1575 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1576 Print (on the standard output) a description of the command-line
1577 options understood by the compiler that fit into all specified classes
1578 and qualifiers. These are the supported classes:
1579
1580 @table @asis
1581 @item @samp{optimizers}
1582 Display all of the optimization options supported by the
1583 compiler.
1584
1585 @item @samp{warnings}
1586 Display all of the options controlling warning messages
1587 produced by the compiler.
1588
1589 @item @samp{target}
1590 Display target-specific options. Unlike the
1591 @option{--target-help} option however, target-specific options of the
1592 linker and assembler are not displayed. This is because those
1593 tools do not currently support the extended @option{--help=} syntax.
1594
1595 @item @samp{params}
1596 Display the values recognized by the @option{--param}
1597 option.
1598
1599 @item @var{language}
1600 Display the options supported for @var{language}, where
1601 @var{language} is the name of one of the languages supported in this
1602 version of GCC@.
1603
1604 @item @samp{common}
1605 Display the options that are common to all languages.
1606 @end table
1607
1608 These are the supported qualifiers:
1609
1610 @table @asis
1611 @item @samp{undocumented}
1612 Display only those options that are undocumented.
1613
1614 @item @samp{joined}
1615 Display options taking an argument that appears after an equal
1616 sign in the same continuous piece of text, such as:
1617 @samp{--help=target}.
1618
1619 @item @samp{separate}
1620 Display options taking an argument that appears as a separate word
1621 following the original option, such as: @samp{-o output-file}.
1622 @end table
1623
1624 Thus for example to display all the undocumented target-specific
1625 switches supported by the compiler, use:
1626
1627 @smallexample
1628 --help=target,undocumented
1629 @end smallexample
1630
1631 The sense of a qualifier can be inverted by prefixing it with the
1632 @samp{^} character, so for example to display all binary warning
1633 options (i.e., ones that are either on or off and that do not take an
1634 argument) that have a description, use:
1635
1636 @smallexample
1637 --help=warnings,^joined,^undocumented
1638 @end smallexample
1639
1640 The argument to @option{--help=} should not consist solely of inverted
1641 qualifiers.
1642
1643 Combining several classes is possible, although this usually
1644 restricts the output so much that there is nothing to display. One
1645 case where it does work, however, is when one of the classes is
1646 @var{target}. For example, to display all the target-specific
1647 optimization options, use:
1648
1649 @smallexample
1650 --help=target,optimizers
1651 @end smallexample
1652
1653 The @option{--help=} option can be repeated on the command line. Each
1654 successive use displays its requested class of options, skipping
1655 those that have already been displayed. If @option{--help} is also
1656 specified anywhere on the command line then this takes precedence
1657 over any @option{--help=} option.
1658
1659 If the @option{-Q} option appears on the command line before the
1660 @option{--help=} option, then the descriptive text displayed by
1661 @option{--help=} is changed. Instead of describing the displayed
1662 options, an indication is given as to whether the option is enabled,
1663 disabled or set to a specific value (assuming that the compiler
1664 knows this at the point where the @option{--help=} option is used).
1665
1666 Here is a truncated example from the ARM port of @command{gcc}:
1667
1668 @smallexample
1669 % gcc -Q -mabi=2 --help=target -c
1670 The following options are target specific:
1671 -mabi= 2
1672 -mabort-on-noreturn [disabled]
1673 -mapcs [disabled]
1674 @end smallexample
1675
1676 The output is sensitive to the effects of previous command-line
1677 options, so for example it is possible to find out which optimizations
1678 are enabled at @option{-O2} by using:
1679
1680 @smallexample
1681 -Q -O2 --help=optimizers
1682 @end smallexample
1683
1684 Alternatively you can discover which binary optimizations are enabled
1685 by @option{-O3} by using:
1686
1687 @smallexample
1688 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1689 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1690 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1691 @end smallexample
1692
1693 @item --version
1694 @opindex version
1695 Display the version number and copyrights of the invoked GCC@.
1696
1697 @item -pass-exit-codes
1698 @opindex pass-exit-codes
1699 Normally the @command{gcc} program exits with the code of 1 if any
1700 phase of the compiler returns a non-success return code. If you specify
1701 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1702 the numerically highest error produced by any phase returning an error
1703 indication. The C, C++, and Fortran front ends return 4 if an internal
1704 compiler error is encountered.
1705
1706 @item -pipe
1707 @opindex pipe
1708 Use pipes rather than temporary files for communication between the
1709 various stages of compilation. This fails to work on some systems where
1710 the assembler is unable to read from a pipe; but the GNU assembler has
1711 no trouble.
1712
1713 @item -specs=@var{file}
1714 @opindex specs
1715 Process @var{file} after the compiler reads in the standard @file{specs}
1716 file, in order to override the defaults which the @command{gcc} driver
1717 program uses when determining what switches to pass to @command{cc1},
1718 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1719 @option{-specs=@var{file}} can be specified on the command line, and they
1720 are processed in order, from left to right. @xref{Spec Files}, for
1721 information about the format of the @var{file}.
1722
1723 @item -wrapper
1724 @opindex wrapper
1725 Invoke all subcommands under a wrapper program. The name of the
1726 wrapper program and its parameters are passed as a comma separated
1727 list.
1728
1729 @smallexample
1730 gcc -c t.c -wrapper gdb,--args
1731 @end smallexample
1732
1733 @noindent
1734 This invokes all subprograms of @command{gcc} under
1735 @samp{gdb --args}, thus the invocation of @command{cc1} is
1736 @samp{gdb --args cc1 @dots{}}.
1737
1738 @item -ffile-prefix-map=@var{old}=@var{new}
1739 @opindex ffile-prefix-map
1740 When compiling files residing in directory @file{@var{old}}, record
1741 any references to them in the result of the compilation as if the
1742 files resided in directory @file{@var{new}} instead. Specifying this
1743 option is equivalent to specifying all the individual
1744 @option{-f*-prefix-map} options. This can be used to make reproducible
1745 builds that are location independent. See also
1746 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1747
1748 @item -fplugin=@var{name}.so
1749 @opindex fplugin
1750 Load the plugin code in file @var{name}.so, assumed to be a
1751 shared object to be dlopen'd by the compiler. The base name of
1752 the shared object file is used to identify the plugin for the
1753 purposes of argument parsing (See
1754 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1755 Each plugin should define the callback functions specified in the
1756 Plugins API.
1757
1758 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1759 @opindex fplugin-arg
1760 Define an argument called @var{key} with a value of @var{value}
1761 for the plugin called @var{name}.
1762
1763 @item -fdump-ada-spec@r{[}-slim@r{]}
1764 @opindex fdump-ada-spec
1765 For C and C++ source and include files, generate corresponding Ada specs.
1766 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1767 GNAT User's Guide}, which provides detailed documentation on this feature.
1768
1769 @item -fada-spec-parent=@var{unit}
1770 @opindex fada-spec-parent
1771 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1772 Ada specs as child units of parent @var{unit}.
1773
1774 @item -fdump-go-spec=@var{file}
1775 @opindex fdump-go-spec
1776 For input files in any language, generate corresponding Go
1777 declarations in @var{file}. This generates Go @code{const},
1778 @code{type}, @code{var}, and @code{func} declarations which may be a
1779 useful way to start writing a Go interface to code written in some
1780 other language.
1781
1782 @include @value{srcdir}/../libiberty/at-file.texi
1783 @end table
1784
1785 @node Invoking G++
1786 @section Compiling C++ Programs
1787
1788 @cindex suffixes for C++ source
1789 @cindex C++ source file suffixes
1790 C++ source files conventionally use one of the suffixes @samp{.C},
1791 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1792 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1793 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1794 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1795 files with these names and compiles them as C++ programs even if you
1796 call the compiler the same way as for compiling C programs (usually
1797 with the name @command{gcc}).
1798
1799 @findex g++
1800 @findex c++
1801 However, the use of @command{gcc} does not add the C++ library.
1802 @command{g++} is a program that calls GCC and automatically specifies linking
1803 against the C++ library. It treats @samp{.c},
1804 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1805 files unless @option{-x} is used. This program is also useful when
1806 precompiling a C header file with a @samp{.h} extension for use in C++
1807 compilations. On many systems, @command{g++} is also installed with
1808 the name @command{c++}.
1809
1810 @cindex invoking @command{g++}
1811 When you compile C++ programs, you may specify many of the same
1812 command-line options that you use for compiling programs in any
1813 language; or command-line options meaningful for C and related
1814 languages; or options that are meaningful only for C++ programs.
1815 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1816 explanations of options for languages related to C@.
1817 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1818 explanations of options that are meaningful only for C++ programs.
1819
1820 @node C Dialect Options
1821 @section Options Controlling C Dialect
1822 @cindex dialect options
1823 @cindex language dialect options
1824 @cindex options, dialect
1825
1826 The following options control the dialect of C (or languages derived
1827 from C, such as C++, Objective-C and Objective-C++) that the compiler
1828 accepts:
1829
1830 @table @gcctabopt
1831 @cindex ANSI support
1832 @cindex ISO support
1833 @item -ansi
1834 @opindex ansi
1835 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1836 equivalent to @option{-std=c++98}.
1837
1838 This turns off certain features of GCC that are incompatible with ISO
1839 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1840 such as the @code{asm} and @code{typeof} keywords, and
1841 predefined macros such as @code{unix} and @code{vax} that identify the
1842 type of system you are using. It also enables the undesirable and
1843 rarely used ISO trigraph feature. For the C compiler,
1844 it disables recognition of C++ style @samp{//} comments as well as
1845 the @code{inline} keyword.
1846
1847 The alternate keywords @code{__asm__}, @code{__extension__},
1848 @code{__inline__} and @code{__typeof__} continue to work despite
1849 @option{-ansi}. You would not want to use them in an ISO C program, of
1850 course, but it is useful to put them in header files that might be included
1851 in compilations done with @option{-ansi}. Alternate predefined macros
1852 such as @code{__unix__} and @code{__vax__} are also available, with or
1853 without @option{-ansi}.
1854
1855 The @option{-ansi} option does not cause non-ISO programs to be
1856 rejected gratuitously. For that, @option{-Wpedantic} is required in
1857 addition to @option{-ansi}. @xref{Warning Options}.
1858
1859 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1860 option is used. Some header files may notice this macro and refrain
1861 from declaring certain functions or defining certain macros that the
1862 ISO standard doesn't call for; this is to avoid interfering with any
1863 programs that might use these names for other things.
1864
1865 Functions that are normally built in but do not have semantics
1866 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1867 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1868 built-in functions provided by GCC}, for details of the functions
1869 affected.
1870
1871 @item -std=
1872 @opindex std
1873 Determine the language standard. @xref{Standards,,Language Standards
1874 Supported by GCC}, for details of these standard versions. This option
1875 is currently only supported when compiling C or C++.
1876
1877 The compiler can accept several base standards, such as @samp{c90} or
1878 @samp{c++98}, and GNU dialects of those standards, such as
1879 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1880 compiler accepts all programs following that standard plus those
1881 using GNU extensions that do not contradict it. For example,
1882 @option{-std=c90} turns off certain features of GCC that are
1883 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1884 keywords, but not other GNU extensions that do not have a meaning in
1885 ISO C90, such as omitting the middle term of a @code{?:}
1886 expression. On the other hand, when a GNU dialect of a standard is
1887 specified, all features supported by the compiler are enabled, even when
1888 those features change the meaning of the base standard. As a result, some
1889 strict-conforming programs may be rejected. The particular standard
1890 is used by @option{-Wpedantic} to identify which features are GNU
1891 extensions given that version of the standard. For example
1892 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1893 comments, while @option{-std=gnu99 -Wpedantic} does not.
1894
1895 A value for this option must be provided; possible values are
1896
1897 @table @samp
1898 @item c90
1899 @itemx c89
1900 @itemx iso9899:1990
1901 Support all ISO C90 programs (certain GNU extensions that conflict
1902 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1903
1904 @item iso9899:199409
1905 ISO C90 as modified in amendment 1.
1906
1907 @item c99
1908 @itemx c9x
1909 @itemx iso9899:1999
1910 @itemx iso9899:199x
1911 ISO C99. This standard is substantially completely supported, modulo
1912 bugs and floating-point issues
1913 (mainly but not entirely relating to optional C99 features from
1914 Annexes F and G). See
1915 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1916 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1917
1918 @item c11
1919 @itemx c1x
1920 @itemx iso9899:2011
1921 ISO C11, the 2011 revision of the ISO C standard. This standard is
1922 substantially completely supported, modulo bugs, floating-point issues
1923 (mainly but not entirely relating to optional C11 features from
1924 Annexes F and G) and the optional Annexes K (Bounds-checking
1925 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1926
1927 @item c17
1928 @itemx c18
1929 @itemx iso9899:2017
1930 @itemx iso9899:2018
1931 ISO C17, the 2017 revision of the ISO C standard
1932 (published in 2018). This standard is
1933 same as C11 except for corrections of defects (all of which are also
1934 applied with @option{-std=c11}) and a new value of
1935 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1936
1937 @item c2x
1938 The next version of the ISO C standard, still under development. The
1939 support for this version is experimental and incomplete.
1940
1941 @item gnu90
1942 @itemx gnu89
1943 GNU dialect of ISO C90 (including some C99 features).
1944
1945 @item gnu99
1946 @itemx gnu9x
1947 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1948
1949 @item gnu11
1950 @itemx gnu1x
1951 GNU dialect of ISO C11.
1952 The name @samp{gnu1x} is deprecated.
1953
1954 @item gnu17
1955 @itemx gnu18
1956 GNU dialect of ISO C17. This is the default for C code.
1957
1958 @item gnu2x
1959 The next version of the ISO C standard, still under development, plus
1960 GNU extensions. The support for this version is experimental and
1961 incomplete.
1962
1963 @item c++98
1964 @itemx c++03
1965 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1966 additional defect reports. Same as @option{-ansi} for C++ code.
1967
1968 @item gnu++98
1969 @itemx gnu++03
1970 GNU dialect of @option{-std=c++98}.
1971
1972 @item c++11
1973 @itemx c++0x
1974 The 2011 ISO C++ standard plus amendments.
1975 The name @samp{c++0x} is deprecated.
1976
1977 @item gnu++11
1978 @itemx gnu++0x
1979 GNU dialect of @option{-std=c++11}.
1980 The name @samp{gnu++0x} is deprecated.
1981
1982 @item c++14
1983 @itemx c++1y
1984 The 2014 ISO C++ standard plus amendments.
1985 The name @samp{c++1y} is deprecated.
1986
1987 @item gnu++14
1988 @itemx gnu++1y
1989 GNU dialect of @option{-std=c++14}.
1990 This is the default for C++ code.
1991 The name @samp{gnu++1y} is deprecated.
1992
1993 @item c++17
1994 @itemx c++1z
1995 The 2017 ISO C++ standard plus amendments.
1996 The name @samp{c++1z} is deprecated.
1997
1998 @item gnu++17
1999 @itemx gnu++1z
2000 GNU dialect of @option{-std=c++17}.
2001 The name @samp{gnu++1z} is deprecated.
2002
2003 @item c++2a
2004 The next revision of the ISO C++ standard, tentatively planned for
2005 2020. Support is highly experimental, and will almost certainly
2006 change in incompatible ways in future releases.
2007
2008 @item gnu++2a
2009 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2010 and will almost certainly change in incompatible ways in future
2011 releases.
2012 @end table
2013
2014 @item -fgnu89-inline
2015 @opindex fgnu89-inline
2016 The option @option{-fgnu89-inline} tells GCC to use the traditional
2017 GNU semantics for @code{inline} functions when in C99 mode.
2018 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2019 Using this option is roughly equivalent to adding the
2020 @code{gnu_inline} function attribute to all inline functions
2021 (@pxref{Function Attributes}).
2022
2023 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2024 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2025 specifies the default behavior).
2026 This option is not supported in @option{-std=c90} or
2027 @option{-std=gnu90} mode.
2028
2029 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2030 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2031 in effect for @code{inline} functions. @xref{Common Predefined
2032 Macros,,,cpp,The C Preprocessor}.
2033
2034 @item -fpermitted-flt-eval-methods=@var{style}
2035 @opindex fpermitted-flt-eval-methods
2036 @opindex fpermitted-flt-eval-methods=c11
2037 @opindex fpermitted-flt-eval-methods=ts-18661-3
2038 ISO/IEC TS 18661-3 defines new permissible values for
2039 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2040 a semantic type that is an interchange or extended format should be
2041 evaluated to the precision and range of that type. These new values are
2042 a superset of those permitted under C99/C11, which does not specify the
2043 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2044 conforming to C11 may not have been written expecting the possibility of
2045 the new values.
2046
2047 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2048 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2049 or the extended set of values specified in ISO/IEC TS 18661-3.
2050
2051 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2052
2053 The default when in a standards compliant mode (@option{-std=c11} or similar)
2054 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2055 dialect (@option{-std=gnu11} or similar) is
2056 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2057
2058 @item -aux-info @var{filename}
2059 @opindex aux-info
2060 Output to the given filename prototyped declarations for all functions
2061 declared and/or defined in a translation unit, including those in header
2062 files. This option is silently ignored in any language other than C@.
2063
2064 Besides declarations, the file indicates, in comments, the origin of
2065 each declaration (source file and line), whether the declaration was
2066 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2067 @samp{O} for old, respectively, in the first character after the line
2068 number and the colon), and whether it came from a declaration or a
2069 definition (@samp{C} or @samp{F}, respectively, in the following
2070 character). In the case of function definitions, a K&R-style list of
2071 arguments followed by their declarations is also provided, inside
2072 comments, after the declaration.
2073
2074 @item -fallow-parameterless-variadic-functions
2075 @opindex fallow-parameterless-variadic-functions
2076 Accept variadic functions without named parameters.
2077
2078 Although it is possible to define such a function, this is not very
2079 useful as it is not possible to read the arguments. This is only
2080 supported for C as this construct is allowed by C++.
2081
2082 @item -fno-asm
2083 @opindex fno-asm
2084 @opindex fasm
2085 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2086 keyword, so that code can use these words as identifiers. You can use
2087 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2088 instead. @option{-ansi} implies @option{-fno-asm}.
2089
2090 In C++, this switch only affects the @code{typeof} keyword, since
2091 @code{asm} and @code{inline} are standard keywords. You may want to
2092 use the @option{-fno-gnu-keywords} flag instead, which has the same
2093 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2094 switch only affects the @code{asm} and @code{typeof} keywords, since
2095 @code{inline} is a standard keyword in ISO C99.
2096
2097 @item -fno-builtin
2098 @itemx -fno-builtin-@var{function}
2099 @opindex fno-builtin
2100 @opindex fbuiltin
2101 @cindex built-in functions
2102 Don't recognize built-in functions that do not begin with
2103 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2104 functions provided by GCC}, for details of the functions affected,
2105 including those which are not built-in functions when @option{-ansi} or
2106 @option{-std} options for strict ISO C conformance are used because they
2107 do not have an ISO standard meaning.
2108
2109 GCC normally generates special code to handle certain built-in functions
2110 more efficiently; for instance, calls to @code{alloca} may become single
2111 instructions which adjust the stack directly, and calls to @code{memcpy}
2112 may become inline copy loops. The resulting code is often both smaller
2113 and faster, but since the function calls no longer appear as such, you
2114 cannot set a breakpoint on those calls, nor can you change the behavior
2115 of the functions by linking with a different library. In addition,
2116 when a function is recognized as a built-in function, GCC may use
2117 information about that function to warn about problems with calls to
2118 that function, or to generate more efficient code, even if the
2119 resulting code still contains calls to that function. For example,
2120 warnings are given with @option{-Wformat} for bad calls to
2121 @code{printf} when @code{printf} is built in and @code{strlen} is
2122 known not to modify global memory.
2123
2124 With the @option{-fno-builtin-@var{function}} option
2125 only the built-in function @var{function} is
2126 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2127 function is named that is not built-in in this version of GCC, this
2128 option is ignored. There is no corresponding
2129 @option{-fbuiltin-@var{function}} option; if you wish to enable
2130 built-in functions selectively when using @option{-fno-builtin} or
2131 @option{-ffreestanding}, you may define macros such as:
2132
2133 @smallexample
2134 #define abs(n) __builtin_abs ((n))
2135 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2136 @end smallexample
2137
2138 @item -fgimple
2139 @opindex fgimple
2140
2141 Enable parsing of function definitions marked with @code{__GIMPLE}.
2142 This is an experimental feature that allows unit testing of GIMPLE
2143 passes.
2144
2145 @item -fhosted
2146 @opindex fhosted
2147 @cindex hosted environment
2148
2149 Assert that compilation targets a hosted environment. This implies
2150 @option{-fbuiltin}. A hosted environment is one in which the
2151 entire standard library is available, and in which @code{main} has a return
2152 type of @code{int}. Examples are nearly everything except a kernel.
2153 This is equivalent to @option{-fno-freestanding}.
2154
2155 @item -ffreestanding
2156 @opindex ffreestanding
2157 @cindex hosted environment
2158
2159 Assert that compilation targets a freestanding environment. This
2160 implies @option{-fno-builtin}. A freestanding environment
2161 is one in which the standard library may not exist, and program startup may
2162 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2163 This is equivalent to @option{-fno-hosted}.
2164
2165 @xref{Standards,,Language Standards Supported by GCC}, for details of
2166 freestanding and hosted environments.
2167
2168 @item -fopenacc
2169 @opindex fopenacc
2170 @cindex OpenACC accelerator programming
2171 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2172 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2173 compiler generates accelerated code according to the OpenACC Application
2174 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2175 implies @option{-pthread}, and thus is only supported on targets that
2176 have support for @option{-pthread}.
2177
2178 @item -fopenacc-dim=@var{geom}
2179 @opindex fopenacc-dim
2180 @cindex OpenACC accelerator programming
2181 Specify default compute dimensions for parallel offload regions that do
2182 not explicitly specify. The @var{geom} value is a triple of
2183 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2184 can be omitted, to use a target-specific default value.
2185
2186 @item -fopenmp
2187 @opindex fopenmp
2188 @cindex OpenMP parallel
2189 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2190 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2191 compiler generates parallel code according to the OpenMP Application
2192 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2193 implies @option{-pthread}, and thus is only supported on targets that
2194 have support for @option{-pthread}. @option{-fopenmp} implies
2195 @option{-fopenmp-simd}.
2196
2197 @item -fopenmp-simd
2198 @opindex fopenmp-simd
2199 @cindex OpenMP SIMD
2200 @cindex SIMD
2201 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2202 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2203 are ignored.
2204
2205 @item -fgnu-tm
2206 @opindex fgnu-tm
2207 When the option @option{-fgnu-tm} is specified, the compiler
2208 generates code for the Linux variant of Intel's current Transactional
2209 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2210 an experimental feature whose interface may change in future versions
2211 of GCC, as the official specification changes. Please note that not
2212 all architectures are supported for this feature.
2213
2214 For more information on GCC's support for transactional memory,
2215 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2216 Transactional Memory Library}.
2217
2218 Note that the transactional memory feature is not supported with
2219 non-call exceptions (@option{-fnon-call-exceptions}).
2220
2221 @item -fms-extensions
2222 @opindex fms-extensions
2223 Accept some non-standard constructs used in Microsoft header files.
2224
2225 In C++ code, this allows member names in structures to be similar
2226 to previous types declarations.
2227
2228 @smallexample
2229 typedef int UOW;
2230 struct ABC @{
2231 UOW UOW;
2232 @};
2233 @end smallexample
2234
2235 Some cases of unnamed fields in structures and unions are only
2236 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2237 fields within structs/unions}, for details.
2238
2239 Note that this option is off for all targets but x86
2240 targets using ms-abi.
2241
2242 @item -fplan9-extensions
2243 @opindex fplan9-extensions
2244 Accept some non-standard constructs used in Plan 9 code.
2245
2246 This enables @option{-fms-extensions}, permits passing pointers to
2247 structures with anonymous fields to functions that expect pointers to
2248 elements of the type of the field, and permits referring to anonymous
2249 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2250 struct/union fields within structs/unions}, for details. This is only
2251 supported for C, not C++.
2252
2253 @item -fcond-mismatch
2254 @opindex fcond-mismatch
2255 Allow conditional expressions with mismatched types in the second and
2256 third arguments. The value of such an expression is void. This option
2257 is not supported for C++.
2258
2259 @item -flax-vector-conversions
2260 @opindex flax-vector-conversions
2261 Allow implicit conversions between vectors with differing numbers of
2262 elements and/or incompatible element types. This option should not be
2263 used for new code.
2264
2265 @item -funsigned-char
2266 @opindex funsigned-char
2267 Let the type @code{char} be unsigned, like @code{unsigned char}.
2268
2269 Each kind of machine has a default for what @code{char} should
2270 be. It is either like @code{unsigned char} by default or like
2271 @code{signed char} by default.
2272
2273 Ideally, a portable program should always use @code{signed char} or
2274 @code{unsigned char} when it depends on the signedness of an object.
2275 But many programs have been written to use plain @code{char} and
2276 expect it to be signed, or expect it to be unsigned, depending on the
2277 machines they were written for. This option, and its inverse, let you
2278 make such a program work with the opposite default.
2279
2280 The type @code{char} is always a distinct type from each of
2281 @code{signed char} or @code{unsigned char}, even though its behavior
2282 is always just like one of those two.
2283
2284 @item -fsigned-char
2285 @opindex fsigned-char
2286 Let the type @code{char} be signed, like @code{signed char}.
2287
2288 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2289 the negative form of @option{-funsigned-char}. Likewise, the option
2290 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2291
2292 @item -fsigned-bitfields
2293 @itemx -funsigned-bitfields
2294 @itemx -fno-signed-bitfields
2295 @itemx -fno-unsigned-bitfields
2296 @opindex fsigned-bitfields
2297 @opindex funsigned-bitfields
2298 @opindex fno-signed-bitfields
2299 @opindex fno-unsigned-bitfields
2300 These options control whether a bit-field is signed or unsigned, when the
2301 declaration does not use either @code{signed} or @code{unsigned}. By
2302 default, such a bit-field is signed, because this is consistent: the
2303 basic integer types such as @code{int} are signed types.
2304
2305 @item -fsso-struct=@var{endianness}
2306 @opindex fsso-struct
2307 Set the default scalar storage order of structures and unions to the
2308 specified endianness. The accepted values are @samp{big-endian},
2309 @samp{little-endian} and @samp{native} for the native endianness of
2310 the target (the default). This option is not supported for C++.
2311
2312 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2313 code that is not binary compatible with code generated without it if the
2314 specified endianness is not the native endianness of the target.
2315 @end table
2316
2317 @node C++ Dialect Options
2318 @section Options Controlling C++ Dialect
2319
2320 @cindex compiler options, C++
2321 @cindex C++ options, command-line
2322 @cindex options, C++
2323 This section describes the command-line options that are only meaningful
2324 for C++ programs. You can also use most of the GNU compiler options
2325 regardless of what language your program is in. For example, you
2326 might compile a file @file{firstClass.C} like this:
2327
2328 @smallexample
2329 g++ -g -fstrict-enums -O -c firstClass.C
2330 @end smallexample
2331
2332 @noindent
2333 In this example, only @option{-fstrict-enums} is an option meant
2334 only for C++ programs; you can use the other options with any
2335 language supported by GCC@.
2336
2337 Some options for compiling C programs, such as @option{-std}, are also
2338 relevant for C++ programs.
2339 @xref{C Dialect Options,,Options Controlling C Dialect}.
2340
2341 Here is a list of options that are @emph{only} for compiling C++ programs:
2342
2343 @table @gcctabopt
2344
2345 @item -fabi-version=@var{n}
2346 @opindex fabi-version
2347 Use version @var{n} of the C++ ABI@. The default is version 0.
2348
2349 Version 0 refers to the version conforming most closely to
2350 the C++ ABI specification. Therefore, the ABI obtained using version 0
2351 will change in different versions of G++ as ABI bugs are fixed.
2352
2353 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2354
2355 Version 2 is the version of the C++ ABI that first appeared in G++
2356 3.4, and was the default through G++ 4.9.
2357
2358 Version 3 corrects an error in mangling a constant address as a
2359 template argument.
2360
2361 Version 4, which first appeared in G++ 4.5, implements a standard
2362 mangling for vector types.
2363
2364 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2365 attribute const/volatile on function pointer types, decltype of a
2366 plain decl, and use of a function parameter in the declaration of
2367 another parameter.
2368
2369 Version 6, which first appeared in G++ 4.7, corrects the promotion
2370 behavior of C++11 scoped enums and the mangling of template argument
2371 packs, const/static_cast, prefix ++ and --, and a class scope function
2372 used as a template argument.
2373
2374 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2375 builtin type and corrects the mangling of lambdas in default argument
2376 scope.
2377
2378 Version 8, which first appeared in G++ 4.9, corrects the substitution
2379 behavior of function types with function-cv-qualifiers.
2380
2381 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2382 @code{nullptr_t}.
2383
2384 Version 10, which first appeared in G++ 6.1, adds mangling of
2385 attributes that affect type identity, such as ia32 calling convention
2386 attributes (e.g.@: @samp{stdcall}).
2387
2388 Version 11, which first appeared in G++ 7, corrects the mangling of
2389 sizeof... expressions and operator names. For multiple entities with
2390 the same name within a function, that are declared in different scopes,
2391 the mangling now changes starting with the twelfth occurrence. It also
2392 implies @option{-fnew-inheriting-ctors}.
2393
2394 Version 12, which first appeared in G++ 8, corrects the calling
2395 conventions for empty classes on the x86_64 target and for classes
2396 with only deleted copy/move constructors. It accidentally changes the
2397 calling convention for classes with a deleted copy constructor and a
2398 trivial move constructor.
2399
2400 Version 13, which first appeared in G++ 8.2, fixes the accidental
2401 change in version 12.
2402
2403 See also @option{-Wabi}.
2404
2405 @item -fabi-compat-version=@var{n}
2406 @opindex fabi-compat-version
2407 On targets that support strong aliases, G++
2408 works around mangling changes by creating an alias with the correct
2409 mangled name when defining a symbol with an incorrect mangled name.
2410 This switch specifies which ABI version to use for the alias.
2411
2412 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2413 compatibility). If another ABI version is explicitly selected, this
2414 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2415 use @option{-fabi-compat-version=2}.
2416
2417 If this option is not provided but @option{-Wabi=@var{n}} is, that
2418 version is used for compatibility aliases. If this option is provided
2419 along with @option{-Wabi} (without the version), the version from this
2420 option is used for the warning.
2421
2422 @item -fno-access-control
2423 @opindex fno-access-control
2424 @opindex faccess-control
2425 Turn off all access checking. This switch is mainly useful for working
2426 around bugs in the access control code.
2427
2428 @item -faligned-new
2429 @opindex faligned-new
2430 Enable support for C++17 @code{new} of types that require more
2431 alignment than @code{void* ::operator new(std::size_t)} provides. A
2432 numeric argument such as @code{-faligned-new=32} can be used to
2433 specify how much alignment (in bytes) is provided by that function,
2434 but few users will need to override the default of
2435 @code{alignof(std::max_align_t)}.
2436
2437 This flag is enabled by default for @option{-std=c++17}.
2438
2439 @item -fchar8_t
2440 @itemx -fno-char8_t
2441 @opindex fchar8_t
2442 @opindex fno-char8_t
2443 Enable support for @code{char8_t} as adopted for C++2a. This includes
2444 the addition of a new @code{char8_t} fundamental type, changes to the
2445 types of UTF-8 string and character literals, new signatures for
2446 user-defined literals, associated standard library updates, and new
2447 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2448
2449 This option enables functions to be overloaded for ordinary and UTF-8
2450 strings:
2451
2452 @smallexample
2453 int f(const char *); // #1
2454 int f(const char8_t *); // #2
2455 int v1 = f("text"); // Calls #1
2456 int v2 = f(u8"text"); // Calls #2
2457 @end smallexample
2458
2459 @noindent
2460 and introduces new signatures for user-defined literals:
2461
2462 @smallexample
2463 int operator""_udl1(char8_t);
2464 int v3 = u8'x'_udl1;
2465 int operator""_udl2(const char8_t*, std::size_t);
2466 int v4 = u8"text"_udl2;
2467 template<typename T, T...> int operator""_udl3();
2468 int v5 = u8"text"_udl3;
2469 @end smallexample
2470
2471 @noindent
2472 The change to the types of UTF-8 string and character literals introduces
2473 incompatibilities with ISO C++11 and later standards. For example, the
2474 following code is well-formed under ISO C++11, but is ill-formed when
2475 @option{-fchar8_t} is specified.
2476
2477 @smallexample
2478 char ca[] = u8"xx"; // error: char-array initialized from wide
2479 // string
2480 const char *cp = u8"xx";// error: invalid conversion from
2481 // `const char8_t*' to `const char*'
2482 int f(const char*);
2483 auto v = f(u8"xx"); // error: invalid conversion from
2484 // `const char8_t*' to `const char*'
2485 std::string s@{u8"xx"@}; // error: no matching function for call to
2486 // `std::basic_string<char>::basic_string()'
2487 using namespace std::literals;
2488 s = u8"xx"s; // error: conversion from
2489 // `basic_string<char8_t>' to non-scalar
2490 // type `basic_string<char>' requested
2491 @end smallexample
2492
2493 @item -fcheck-new
2494 @opindex fcheck-new
2495 Check that the pointer returned by @code{operator new} is non-null
2496 before attempting to modify the storage allocated. This check is
2497 normally unnecessary because the C++ standard specifies that
2498 @code{operator new} only returns @code{0} if it is declared
2499 @code{throw()}, in which case the compiler always checks the
2500 return value even without this option. In all other cases, when
2501 @code{operator new} has a non-empty exception specification, memory
2502 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2503 @samp{new (nothrow)}.
2504
2505 @item -fconcepts
2506 @opindex fconcepts
2507 Enable support for the C++ Extensions for Concepts Technical
2508 Specification, ISO 19217 (2015), which allows code like
2509
2510 @smallexample
2511 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2512 template <Addable T> T add (T a, T b) @{ return a + b; @}
2513 @end smallexample
2514
2515 @item -fconstexpr-depth=@var{n}
2516 @opindex fconstexpr-depth
2517 Set the maximum nested evaluation depth for C++11 constexpr functions
2518 to @var{n}. A limit is needed to detect endless recursion during
2519 constant expression evaluation. The minimum specified by the standard
2520 is 512.
2521
2522 @item -fconstexpr-loop-limit=@var{n}
2523 @opindex fconstexpr-loop-limit
2524 Set the maximum number of iterations for a loop in C++14 constexpr functions
2525 to @var{n}. A limit is needed to detect infinite loops during
2526 constant expression evaluation. The default is 262144 (1<<18).
2527
2528 @item -fconstexpr-ops-limit=@var{n}
2529 @opindex fconstexpr-ops-limit
2530 Set the maximum number of operations during a single constexpr evaluation.
2531 Even when number of iterations of a single loop is limited with the above limit,
2532 if there are several nested loops and each of them has many iterations but still
2533 smaller than the above limit, or if in a body of some loop or even outside
2534 of a loop too many expressions need to be evaluated, the resulting constexpr
2535 evaluation might take too long.
2536 The default is 33554432 (1<<25).
2537
2538 @item -fdeduce-init-list
2539 @opindex fdeduce-init-list
2540 Enable deduction of a template type parameter as
2541 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2542
2543 @smallexample
2544 template <class T> auto forward(T t) -> decltype (realfn (t))
2545 @{
2546 return realfn (t);
2547 @}
2548
2549 void f()
2550 @{
2551 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2552 @}
2553 @end smallexample
2554
2555 This deduction was implemented as a possible extension to the
2556 originally proposed semantics for the C++11 standard, but was not part
2557 of the final standard, so it is disabled by default. This option is
2558 deprecated, and may be removed in a future version of G++.
2559
2560 @item -fno-elide-constructors
2561 @opindex fno-elide-constructors
2562 @opindex felide-constructors
2563 The C++ standard allows an implementation to omit creating a temporary
2564 that is only used to initialize another object of the same type.
2565 Specifying this option disables that optimization, and forces G++ to
2566 call the copy constructor in all cases. This option also causes G++
2567 to call trivial member functions which otherwise would be expanded inline.
2568
2569 In C++17, the compiler is required to omit these temporaries, but this
2570 option still affects trivial member functions.
2571
2572 @item -fno-enforce-eh-specs
2573 @opindex fno-enforce-eh-specs
2574 @opindex fenforce-eh-specs
2575 Don't generate code to check for violation of exception specifications
2576 at run time. This option violates the C++ standard, but may be useful
2577 for reducing code size in production builds, much like defining
2578 @code{NDEBUG}. This does not give user code permission to throw
2579 exceptions in violation of the exception specifications; the compiler
2580 still optimizes based on the specifications, so throwing an
2581 unexpected exception results in undefined behavior at run time.
2582
2583 @item -fextern-tls-init
2584 @itemx -fno-extern-tls-init
2585 @opindex fextern-tls-init
2586 @opindex fno-extern-tls-init
2587 The C++11 and OpenMP standards allow @code{thread_local} and
2588 @code{threadprivate} variables to have dynamic (runtime)
2589 initialization. To support this, any use of such a variable goes
2590 through a wrapper function that performs any necessary initialization.
2591 When the use and definition of the variable are in the same
2592 translation unit, this overhead can be optimized away, but when the
2593 use is in a different translation unit there is significant overhead
2594 even if the variable doesn't actually need dynamic initialization. If
2595 the programmer can be sure that no use of the variable in a
2596 non-defining TU needs to trigger dynamic initialization (either
2597 because the variable is statically initialized, or a use of the
2598 variable in the defining TU will be executed before any uses in
2599 another TU), they can avoid this overhead with the
2600 @option{-fno-extern-tls-init} option.
2601
2602 On targets that support symbol aliases, the default is
2603 @option{-fextern-tls-init}. On targets that do not support symbol
2604 aliases, the default is @option{-fno-extern-tls-init}.
2605
2606 @item -fno-gnu-keywords
2607 @opindex fno-gnu-keywords
2608 @opindex fgnu-keywords
2609 Do not recognize @code{typeof} as a keyword, so that code can use this
2610 word as an identifier. You can use the keyword @code{__typeof__} instead.
2611 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2612 @option{-std=c++98}, @option{-std=c++11}, etc.
2613
2614 @item -fno-implicit-templates
2615 @opindex fno-implicit-templates
2616 @opindex fimplicit-templates
2617 Never emit code for non-inline templates that are instantiated
2618 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2619 If you use this option, you must take care to structure your code to
2620 include all the necessary explicit instantiations to avoid getting
2621 undefined symbols at link time.
2622 @xref{Template Instantiation}, for more information.
2623
2624 @item -fno-implicit-inline-templates
2625 @opindex fno-implicit-inline-templates
2626 @opindex fimplicit-inline-templates
2627 Don't emit code for implicit instantiations of inline templates, either.
2628 The default is to handle inlines differently so that compiles with and
2629 without optimization need the same set of explicit instantiations.
2630
2631 @item -fno-implement-inlines
2632 @opindex fno-implement-inlines
2633 @opindex fimplement-inlines
2634 To save space, do not emit out-of-line copies of inline functions
2635 controlled by @code{#pragma implementation}. This causes linker
2636 errors if these functions are not inlined everywhere they are called.
2637
2638 @item -fms-extensions
2639 @opindex fms-extensions
2640 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2641 int and getting a pointer to member function via non-standard syntax.
2642
2643 @item -fnew-inheriting-ctors
2644 @opindex fnew-inheriting-ctors
2645 Enable the P0136 adjustment to the semantics of C++11 constructor
2646 inheritance. This is part of C++17 but also considered to be a Defect
2647 Report against C++11 and C++14. This flag is enabled by default
2648 unless @option{-fabi-version=10} or lower is specified.
2649
2650 @item -fnew-ttp-matching
2651 @opindex fnew-ttp-matching
2652 Enable the P0522 resolution to Core issue 150, template template
2653 parameters and default arguments: this allows a template with default
2654 template arguments as an argument for a template template parameter
2655 with fewer template parameters. This flag is enabled by default for
2656 @option{-std=c++17}.
2657
2658 @item -fno-nonansi-builtins
2659 @opindex fno-nonansi-builtins
2660 @opindex fnonansi-builtins
2661 Disable built-in declarations of functions that are not mandated by
2662 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2663 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2664
2665 @item -fnothrow-opt
2666 @opindex fnothrow-opt
2667 Treat a @code{throw()} exception specification as if it were a
2668 @code{noexcept} specification to reduce or eliminate the text size
2669 overhead relative to a function with no exception specification. If
2670 the function has local variables of types with non-trivial
2671 destructors, the exception specification actually makes the
2672 function smaller because the EH cleanups for those variables can be
2673 optimized away. The semantic effect is that an exception thrown out of
2674 a function with such an exception specification results in a call
2675 to @code{terminate} rather than @code{unexpected}.
2676
2677 @item -fno-operator-names
2678 @opindex fno-operator-names
2679 @opindex foperator-names
2680 Do not treat the operator name keywords @code{and}, @code{bitand},
2681 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2682 synonyms as keywords.
2683
2684 @item -fno-optional-diags
2685 @opindex fno-optional-diags
2686 @opindex foptional-diags
2687 Disable diagnostics that the standard says a compiler does not need to
2688 issue. Currently, the only such diagnostic issued by G++ is the one for
2689 a name having multiple meanings within a class.
2690
2691 @item -fpermissive
2692 @opindex fpermissive
2693 Downgrade some diagnostics about nonconformant code from errors to
2694 warnings. Thus, using @option{-fpermissive} allows some
2695 nonconforming code to compile.
2696
2697 @item -fno-pretty-templates
2698 @opindex fno-pretty-templates
2699 @opindex fpretty-templates
2700 When an error message refers to a specialization of a function
2701 template, the compiler normally prints the signature of the
2702 template followed by the template arguments and any typedefs or
2703 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2704 rather than @code{void f(int)}) so that it's clear which template is
2705 involved. When an error message refers to a specialization of a class
2706 template, the compiler omits any template arguments that match
2707 the default template arguments for that template. If either of these
2708 behaviors make it harder to understand the error message rather than
2709 easier, you can use @option{-fno-pretty-templates} to disable them.
2710
2711 @item -frepo
2712 @opindex frepo
2713 Enable automatic template instantiation at link time. This option also
2714 implies @option{-fno-implicit-templates}. @xref{Template
2715 Instantiation}, for more information.
2716
2717 @item -fno-rtti
2718 @opindex fno-rtti
2719 @opindex frtti
2720 Disable generation of information about every class with virtual
2721 functions for use by the C++ run-time type identification features
2722 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2723 of the language, you can save some space by using this flag. Note that
2724 exception handling uses the same information, but G++ generates it as
2725 needed. The @code{dynamic_cast} operator can still be used for casts that
2726 do not require run-time type information, i.e.@: casts to @code{void *} or to
2727 unambiguous base classes.
2728
2729 Mixing code compiled with @option{-frtti} with that compiled with
2730 @option{-fno-rtti} may not work. For example, programs may
2731 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2732 for a class compiled with @option{-frtti}.
2733
2734 @item -fsized-deallocation
2735 @opindex fsized-deallocation
2736 Enable the built-in global declarations
2737 @smallexample
2738 void operator delete (void *, std::size_t) noexcept;
2739 void operator delete[] (void *, std::size_t) noexcept;
2740 @end smallexample
2741 as introduced in C++14. This is useful for user-defined replacement
2742 deallocation functions that, for example, use the size of the object
2743 to make deallocation faster. Enabled by default under
2744 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2745 warns about places that might want to add a definition.
2746
2747 @item -fstrict-enums
2748 @opindex fstrict-enums
2749 Allow the compiler to optimize using the assumption that a value of
2750 enumerated type can only be one of the values of the enumeration (as
2751 defined in the C++ standard; basically, a value that can be
2752 represented in the minimum number of bits needed to represent all the
2753 enumerators). This assumption may not be valid if the program uses a
2754 cast to convert an arbitrary integer value to the enumerated type.
2755
2756 @item -fstrong-eval-order
2757 @opindex fstrong-eval-order
2758 Evaluate member access, array subscripting, and shift expressions in
2759 left-to-right order, and evaluate assignment in right-to-left order,
2760 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2761 @option{-fstrong-eval-order=some} enables just the ordering of member
2762 access and shift expressions, and is the default without
2763 @option{-std=c++17}.
2764
2765 @item -ftemplate-backtrace-limit=@var{n}
2766 @opindex ftemplate-backtrace-limit
2767 Set the maximum number of template instantiation notes for a single
2768 warning or error to @var{n}. The default value is 10.
2769
2770 @item -ftemplate-depth=@var{n}
2771 @opindex ftemplate-depth
2772 Set the maximum instantiation depth for template classes to @var{n}.
2773 A limit on the template instantiation depth is needed to detect
2774 endless recursions during template class instantiation. ANSI/ISO C++
2775 conforming programs must not rely on a maximum depth greater than 17
2776 (changed to 1024 in C++11). The default value is 900, as the compiler
2777 can run out of stack space before hitting 1024 in some situations.
2778
2779 @item -fno-threadsafe-statics
2780 @opindex fno-threadsafe-statics
2781 @opindex fthreadsafe-statics
2782 Do not emit the extra code to use the routines specified in the C++
2783 ABI for thread-safe initialization of local statics. You can use this
2784 option to reduce code size slightly in code that doesn't need to be
2785 thread-safe.
2786
2787 @item -fuse-cxa-atexit
2788 @opindex fuse-cxa-atexit
2789 Register destructors for objects with static storage duration with the
2790 @code{__cxa_atexit} function rather than the @code{atexit} function.
2791 This option is required for fully standards-compliant handling of static
2792 destructors, but only works if your C library supports
2793 @code{__cxa_atexit}.
2794
2795 @item -fno-use-cxa-get-exception-ptr
2796 @opindex fno-use-cxa-get-exception-ptr
2797 @opindex fuse-cxa-get-exception-ptr
2798 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2799 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2800 if the runtime routine is not available.
2801
2802 @item -fvisibility-inlines-hidden
2803 @opindex fvisibility-inlines-hidden
2804 This switch declares that the user does not attempt to compare
2805 pointers to inline functions or methods where the addresses of the two functions
2806 are taken in different shared objects.
2807
2808 The effect of this is that GCC may, effectively, mark inline methods with
2809 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2810 appear in the export table of a DSO and do not require a PLT indirection
2811 when used within the DSO@. Enabling this option can have a dramatic effect
2812 on load and link times of a DSO as it massively reduces the size of the
2813 dynamic export table when the library makes heavy use of templates.
2814
2815 The behavior of this switch is not quite the same as marking the
2816 methods as hidden directly, because it does not affect static variables
2817 local to the function or cause the compiler to deduce that
2818 the function is defined in only one shared object.
2819
2820 You may mark a method as having a visibility explicitly to negate the
2821 effect of the switch for that method. For example, if you do want to
2822 compare pointers to a particular inline method, you might mark it as
2823 having default visibility. Marking the enclosing class with explicit
2824 visibility has no effect.
2825
2826 Explicitly instantiated inline methods are unaffected by this option
2827 as their linkage might otherwise cross a shared library boundary.
2828 @xref{Template Instantiation}.
2829
2830 @item -fvisibility-ms-compat
2831 @opindex fvisibility-ms-compat
2832 This flag attempts to use visibility settings to make GCC's C++
2833 linkage model compatible with that of Microsoft Visual Studio.
2834
2835 The flag makes these changes to GCC's linkage model:
2836
2837 @enumerate
2838 @item
2839 It sets the default visibility to @code{hidden}, like
2840 @option{-fvisibility=hidden}.
2841
2842 @item
2843 Types, but not their members, are not hidden by default.
2844
2845 @item
2846 The One Definition Rule is relaxed for types without explicit
2847 visibility specifications that are defined in more than one
2848 shared object: those declarations are permitted if they are
2849 permitted when this option is not used.
2850 @end enumerate
2851
2852 In new code it is better to use @option{-fvisibility=hidden} and
2853 export those classes that are intended to be externally visible.
2854 Unfortunately it is possible for code to rely, perhaps accidentally,
2855 on the Visual Studio behavior.
2856
2857 Among the consequences of these changes are that static data members
2858 of the same type with the same name but defined in different shared
2859 objects are different, so changing one does not change the other;
2860 and that pointers to function members defined in different shared
2861 objects may not compare equal. When this flag is given, it is a
2862 violation of the ODR to define types with the same name differently.
2863
2864 @item -fno-weak
2865 @opindex fno-weak
2866 @opindex fweak
2867 Do not use weak symbol support, even if it is provided by the linker.
2868 By default, G++ uses weak symbols if they are available. This
2869 option exists only for testing, and should not be used by end-users;
2870 it results in inferior code and has no benefits. This option may
2871 be removed in a future release of G++.
2872
2873 @item -nostdinc++
2874 @opindex nostdinc++
2875 Do not search for header files in the standard directories specific to
2876 C++, but do still search the other standard directories. (This option
2877 is used when building the C++ library.)
2878 @end table
2879
2880 In addition, these optimization, warning, and code generation options
2881 have meanings only for C++ programs:
2882
2883 @table @gcctabopt
2884 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2885 @opindex Wabi
2886 @opindex Wno-abi
2887 Warn when G++ it generates code that is probably not compatible with
2888 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2889 ABI with each major release, normally @option{-Wabi} will warn only if
2890 there is a check added later in a release series for an ABI issue
2891 discovered since the initial release. @option{-Wabi} will warn about
2892 more things if an older ABI version is selected (with
2893 @option{-fabi-version=@var{n}}).
2894
2895 @option{-Wabi} can also be used with an explicit version number to
2896 warn about compatibility with a particular @option{-fabi-version}
2897 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2898 @option{-fabi-version=2}.
2899
2900 If an explicit version number is provided and
2901 @option{-fabi-compat-version} is not specified, the version number
2902 from this option is used for compatibility aliases. If no explicit
2903 version number is provided with this option, but
2904 @option{-fabi-compat-version} is specified, that version number is
2905 used for ABI warnings.
2906
2907 Although an effort has been made to warn about
2908 all such cases, there are probably some cases that are not warned about,
2909 even though G++ is generating incompatible code. There may also be
2910 cases where warnings are emitted even though the code that is generated
2911 is compatible.
2912
2913 You should rewrite your code to avoid these warnings if you are
2914 concerned about the fact that code generated by G++ may not be binary
2915 compatible with code generated by other compilers.
2916
2917 Known incompatibilities in @option{-fabi-version=2} (which was the
2918 default from GCC 3.4 to 4.9) include:
2919
2920 @itemize @bullet
2921
2922 @item
2923 A template with a non-type template parameter of reference type was
2924 mangled incorrectly:
2925 @smallexample
2926 extern int N;
2927 template <int &> struct S @{@};
2928 void n (S<N>) @{2@}
2929 @end smallexample
2930
2931 This was fixed in @option{-fabi-version=3}.
2932
2933 @item
2934 SIMD vector types declared using @code{__attribute ((vector_size))} were
2935 mangled in a non-standard way that does not allow for overloading of
2936 functions taking vectors of different sizes.
2937
2938 The mangling was changed in @option{-fabi-version=4}.
2939
2940 @item
2941 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2942 qualifiers, and @code{decltype} of a plain declaration was folded away.
2943
2944 These mangling issues were fixed in @option{-fabi-version=5}.
2945
2946 @item
2947 Scoped enumerators passed as arguments to a variadic function are
2948 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2949 On most targets this does not actually affect the parameter passing
2950 ABI, as there is no way to pass an argument smaller than @code{int}.
2951
2952 Also, the ABI changed the mangling of template argument packs,
2953 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2954 a class scope function used as a template argument.
2955
2956 These issues were corrected in @option{-fabi-version=6}.
2957
2958 @item
2959 Lambdas in default argument scope were mangled incorrectly, and the
2960 ABI changed the mangling of @code{nullptr_t}.
2961
2962 These issues were corrected in @option{-fabi-version=7}.
2963
2964 @item
2965 When mangling a function type with function-cv-qualifiers, the
2966 un-qualified function type was incorrectly treated as a substitution
2967 candidate.
2968
2969 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2970
2971 @item
2972 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2973 unaligned accesses. Note that this did not affect the ABI of a
2974 function with a @code{nullptr_t} parameter, as parameters have a
2975 minimum alignment.
2976
2977 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2978
2979 @item
2980 Target-specific attributes that affect the identity of a type, such as
2981 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2982 did not affect the mangled name, leading to name collisions when
2983 function pointers were used as template arguments.
2984
2985 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2986
2987 @end itemize
2988
2989 It also warns about psABI-related changes. The known psABI changes at this
2990 point include:
2991
2992 @itemize @bullet
2993
2994 @item
2995 For SysV/x86-64, unions with @code{long double} members are
2996 passed in memory as specified in psABI. For example:
2997
2998 @smallexample
2999 union U @{
3000 long double ld;
3001 int i;
3002 @};
3003 @end smallexample
3004
3005 @noindent
3006 @code{union U} is always passed in memory.
3007
3008 @end itemize
3009
3010 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3011 @opindex Wabi-tag
3012 @opindex Wabi-tag
3013 Warn when a type with an ABI tag is used in a context that does not
3014 have that ABI tag. See @ref{C++ Attributes} for more information
3015 about ABI tags.
3016
3017 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3018 @opindex Wctor-dtor-privacy
3019 @opindex Wno-ctor-dtor-privacy
3020 Warn when a class seems unusable because all the constructors or
3021 destructors in that class are private, and it has neither friends nor
3022 public static member functions. Also warn if there are no non-private
3023 methods, and there's at least one private member function that isn't
3024 a constructor or destructor.
3025
3026 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3027 @opindex Wdelete-non-virtual-dtor
3028 @opindex Wno-delete-non-virtual-dtor
3029 Warn when @code{delete} is used to destroy an instance of a class that
3030 has virtual functions and non-virtual destructor. It is unsafe to delete
3031 an instance of a derived class through a pointer to a base class if the
3032 base class does not have a virtual destructor. This warning is enabled
3033 by @option{-Wall}.
3034
3035 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3036 @opindex Wdeprecated-copy
3037 @opindex Wno-deprecated-copy
3038 Warn that the implicit declaration of a copy constructor or copy
3039 assignment operator is deprecated if the class has a user-provided
3040 copy constructor or copy assignment operator, in C++11 and up. This
3041 warning is enabled by @option{-Wextra}. With
3042 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3043 user-provided destructor.
3044
3045 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3046 @opindex Winit-list-lifetime
3047 @opindex Wno-init-list-lifetime
3048 Do not warn about uses of @code{std::initializer_list} that are likely
3049 to result in dangling pointers. Since the underlying array for an
3050 @code{initializer_list} is handled like a normal C++ temporary object,
3051 it is easy to inadvertently keep a pointer to the array past the end
3052 of the array's lifetime. For example:
3053
3054 @itemize @bullet
3055 @item
3056 If a function returns a temporary @code{initializer_list}, or a local
3057 @code{initializer_list} variable, the array's lifetime ends at the end
3058 of the return statement, so the value returned has a dangling pointer.
3059
3060 @item
3061 If a new-expression creates an @code{initializer_list}, the array only
3062 lives until the end of the enclosing full-expression, so the
3063 @code{initializer_list} in the heap has a dangling pointer.
3064
3065 @item
3066 When an @code{initializer_list} variable is assigned from a
3067 brace-enclosed initializer list, the temporary array created for the
3068 right side of the assignment only lives until the end of the
3069 full-expression, so at the next statement the @code{initializer_list}
3070 variable has a dangling pointer.
3071
3072 @smallexample
3073 // li's initial underlying array lives as long as li
3074 std::initializer_list<int> li = @{ 1,2,3 @};
3075 // assignment changes li to point to a temporary array
3076 li = @{ 4, 5 @};
3077 // now the temporary is gone and li has a dangling pointer
3078 int i = li.begin()[0] // undefined behavior
3079 @end smallexample
3080
3081 @item
3082 When a list constructor stores the @code{begin} pointer from the
3083 @code{initializer_list} argument, this doesn't extend the lifetime of
3084 the array, so if a class variable is constructed from a temporary
3085 @code{initializer_list}, the pointer is left dangling by the end of
3086 the variable declaration statement.
3087
3088 @end itemize
3089
3090 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3091 @opindex Wliteral-suffix
3092 @opindex Wno-literal-suffix
3093 Warn when a string or character literal is followed by a ud-suffix which does
3094 not begin with an underscore. As a conforming extension, GCC treats such
3095 suffixes as separate preprocessing tokens in order to maintain backwards
3096 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3097 For example:
3098
3099 @smallexample
3100 #define __STDC_FORMAT_MACROS
3101 #include <inttypes.h>
3102 #include <stdio.h>
3103
3104 int main() @{
3105 int64_t i64 = 123;
3106 printf("My int64: %" PRId64"\n", i64);
3107 @}
3108 @end smallexample
3109
3110 In this case, @code{PRId64} is treated as a separate preprocessing token.
3111
3112 Additionally, warn when a user-defined literal operator is declared with
3113 a literal suffix identifier that doesn't begin with an underscore. Literal
3114 suffix identifiers that don't begin with an underscore are reserved for
3115 future standardization.
3116
3117 This warning is enabled by default.
3118
3119 @item -Wlto-type-mismatch
3120 @opindex Wlto-type-mismatch
3121 @opindex Wno-lto-type-mismatch
3122
3123 During the link-time optimization warn about type mismatches in
3124 global declarations from different compilation units.
3125 Requires @option{-flto} to be enabled. Enabled by default.
3126
3127 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3128 @opindex Wnarrowing
3129 @opindex Wno-narrowing
3130 For C++11 and later standards, narrowing conversions are diagnosed by default,
3131 as required by the standard. A narrowing conversion from a constant produces
3132 an error, and a narrowing conversion from a non-constant produces a warning,
3133 but @option{-Wno-narrowing} suppresses the diagnostic.
3134 Note that this does not affect the meaning of well-formed code;
3135 narrowing conversions are still considered ill-formed in SFINAE contexts.
3136
3137 With @option{-Wnarrowing} in C++98, warn when a narrowing
3138 conversion prohibited by C++11 occurs within
3139 @samp{@{ @}}, e.g.
3140
3141 @smallexample
3142 int i = @{ 2.2 @}; // error: narrowing from double to int
3143 @end smallexample
3144
3145 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3146
3147 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3148 @opindex Wnoexcept
3149 @opindex Wno-noexcept
3150 Warn when a noexcept-expression evaluates to false because of a call
3151 to a function that does not have a non-throwing exception
3152 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3153 the compiler to never throw an exception.
3154
3155 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3156 @opindex Wnoexcept-type
3157 @opindex Wno-noexcept-type
3158 Warn if the C++17 feature making @code{noexcept} part of a function
3159 type changes the mangled name of a symbol relative to C++14. Enabled
3160 by @option{-Wabi} and @option{-Wc++17-compat}.
3161
3162 As an example:
3163
3164 @smallexample
3165 template <class T> void f(T t) @{ t(); @};
3166 void g() noexcept;
3167 void h() @{ f(g); @}
3168 @end smallexample
3169
3170 @noindent
3171 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3172 C++17 it calls @code{f<void(*)()noexcept>}.
3173
3174 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3175 @opindex Wclass-memaccess
3176 @opindex Wno-class-memaccess
3177 Warn when the destination of a call to a raw memory function such as
3178 @code{memset} or @code{memcpy} is an object of class type, and when writing
3179 into such an object might bypass the class non-trivial or deleted constructor
3180 or copy assignment, violate const-correctness or encapsulation, or corrupt
3181 virtual table pointers. Modifying the representation of such objects may
3182 violate invariants maintained by member functions of the class. For example,
3183 the call to @code{memset} below is undefined because it modifies a non-trivial
3184 class object and is, therefore, diagnosed. The safe way to either initialize
3185 or clear the storage of objects of such types is by using the appropriate
3186 constructor or assignment operator, if one is available.
3187 @smallexample
3188 std::string str = "abc";
3189 memset (&str, 0, sizeof str);
3190 @end smallexample
3191 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3192 Explicitly casting the pointer to the class object to @code{void *} or
3193 to a type that can be safely accessed by the raw memory function suppresses
3194 the warning.
3195
3196 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3197 @opindex Wnon-virtual-dtor
3198 @opindex Wno-non-virtual-dtor
3199 Warn when a class has virtual functions and an accessible non-virtual
3200 destructor itself or in an accessible polymorphic base class, in which
3201 case it is possible but unsafe to delete an instance of a derived
3202 class through a pointer to the class itself or base class. This
3203 warning is automatically enabled if @option{-Weffc++} is specified.
3204
3205 @item -Wregister @r{(C++ and Objective-C++ only)}
3206 @opindex Wregister
3207 @opindex Wno-register
3208 Warn on uses of the @code{register} storage class specifier, except
3209 when it is part of the GNU @ref{Explicit Register Variables} extension.
3210 The use of the @code{register} keyword as storage class specifier has
3211 been deprecated in C++11 and removed in C++17.
3212 Enabled by default with @option{-std=c++17}.
3213
3214 @item -Wreorder @r{(C++ and Objective-C++ only)}
3215 @opindex Wreorder
3216 @opindex Wno-reorder
3217 @cindex reordering, warning
3218 @cindex warning for reordering of member initializers
3219 Warn when the order of member initializers given in the code does not
3220 match the order in which they must be executed. For instance:
3221
3222 @smallexample
3223 struct A @{
3224 int i;
3225 int j;
3226 A(): j (0), i (1) @{ @}
3227 @};
3228 @end smallexample
3229
3230 @noindent
3231 The compiler rearranges the member initializers for @code{i}
3232 and @code{j} to match the declaration order of the members, emitting
3233 a warning to that effect. This warning is enabled by @option{-Wall}.
3234
3235 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3236 @opindex Wpessimizing-move
3237 @opindex Wno-pessimizing-move
3238 This warning warns when a call to @code{std::move} prevents copy
3239 elision. A typical scenario when copy elision can occur is when returning in
3240 a function with a class return type, when the expression being returned is the
3241 name of a non-volatile automatic object, and is not a function parameter, and
3242 has the same type as the function return type.
3243
3244 @smallexample
3245 struct T @{
3246 @dots{}
3247 @};
3248 T fn()
3249 @{
3250 T t;
3251 @dots{}
3252 return std::move (t);
3253 @}
3254 @end smallexample
3255
3256 But in this example, the @code{std::move} call prevents copy elision.
3257
3258 This warning is enabled by @option{-Wall}.
3259
3260 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3261 @opindex Wredundant-move
3262 @opindex Wno-redundant-move
3263 This warning warns about redundant calls to @code{std::move}; that is, when
3264 a move operation would have been performed even without the @code{std::move}
3265 call. This happens because the compiler is forced to treat the object as if
3266 it were an rvalue in certain situations such as returning a local variable,
3267 where copy elision isn't applicable. Consider:
3268
3269 @smallexample
3270 struct T @{
3271 @dots{}
3272 @};
3273 T fn(T t)
3274 @{
3275 @dots{}
3276 return std::move (t);
3277 @}
3278 @end smallexample
3279
3280 Here, the @code{std::move} call is redundant. Because G++ implements Core
3281 Issue 1579, another example is:
3282
3283 @smallexample
3284 struct T @{ // convertible to U
3285 @dots{}
3286 @};
3287 struct U @{
3288 @dots{}
3289 @};
3290 U fn()
3291 @{
3292 T t;
3293 @dots{}
3294 return std::move (t);
3295 @}
3296 @end smallexample
3297 In this example, copy elision isn't applicable because the type of the
3298 expression being returned and the function return type differ, yet G++
3299 treats the return value as if it were designated by an rvalue.
3300
3301 This warning is enabled by @option{-Wextra}.
3302
3303 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3304 @opindex fext-numeric-literals
3305 @opindex fno-ext-numeric-literals
3306 Accept imaginary, fixed-point, or machine-defined
3307 literal number suffixes as GNU extensions.
3308 When this option is turned off these suffixes are treated
3309 as C++11 user-defined literal numeric suffixes.
3310 This is on by default for all pre-C++11 dialects and all GNU dialects:
3311 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3312 @option{-std=gnu++14}.
3313 This option is off by default
3314 for ISO C++11 onwards (@option{-std=c++11}, ...).
3315 @end table
3316
3317 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3318
3319 @table @gcctabopt
3320 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3321 @opindex Weffc++
3322 @opindex Wno-effc++
3323 Warn about violations of the following style guidelines from Scott Meyers'
3324 @cite{Effective C++} series of books:
3325
3326 @itemize @bullet
3327 @item
3328 Define a copy constructor and an assignment operator for classes
3329 with dynamically-allocated memory.
3330
3331 @item
3332 Prefer initialization to assignment in constructors.
3333
3334 @item
3335 Have @code{operator=} return a reference to @code{*this}.
3336
3337 @item
3338 Don't try to return a reference when you must return an object.
3339
3340 @item
3341 Distinguish between prefix and postfix forms of increment and
3342 decrement operators.
3343
3344 @item
3345 Never overload @code{&&}, @code{||}, or @code{,}.
3346
3347 @end itemize
3348
3349 This option also enables @option{-Wnon-virtual-dtor}, which is also
3350 one of the effective C++ recommendations. However, the check is
3351 extended to warn about the lack of virtual destructor in accessible
3352 non-polymorphic bases classes too.
3353
3354 When selecting this option, be aware that the standard library
3355 headers do not obey all of these guidelines; use @samp{grep -v}
3356 to filter out those warnings.
3357
3358 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3359 @opindex Wstrict-null-sentinel
3360 @opindex Wno-strict-null-sentinel
3361 Warn about the use of an uncasted @code{NULL} as sentinel. When
3362 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3363 to @code{__null}. Although it is a null pointer constant rather than a
3364 null pointer, it is guaranteed to be of the same size as a pointer.
3365 But this use is not portable across different compilers.
3366
3367 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3368 @opindex Wno-non-template-friend
3369 @opindex Wnon-template-friend
3370 Disable warnings when non-template friend functions are declared
3371 within a template. In very old versions of GCC that predate implementation
3372 of the ISO standard, declarations such as
3373 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3374 could be interpreted as a particular specialization of a template
3375 function; the warning exists to diagnose compatibility problems,
3376 and is enabled by default.
3377
3378 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3379 @opindex Wold-style-cast
3380 @opindex Wno-old-style-cast
3381 Warn if an old-style (C-style) cast to a non-void type is used within
3382 a C++ program. The new-style casts (@code{dynamic_cast},
3383 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3384 less vulnerable to unintended effects and much easier to search for.
3385
3386 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3387 @opindex Woverloaded-virtual
3388 @opindex Wno-overloaded-virtual
3389 @cindex overloaded virtual function, warning
3390 @cindex warning for overloaded virtual function
3391 Warn when a function declaration hides virtual functions from a
3392 base class. For example, in:
3393
3394 @smallexample
3395 struct A @{
3396 virtual void f();
3397 @};
3398
3399 struct B: public A @{
3400 void f(int);
3401 @};
3402 @end smallexample
3403
3404 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3405 like:
3406
3407 @smallexample
3408 B* b;
3409 b->f();
3410 @end smallexample
3411
3412 @noindent
3413 fails to compile.
3414
3415 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3416 @opindex Wno-pmf-conversions
3417 @opindex Wpmf-conversions
3418 Disable the diagnostic for converting a bound pointer to member function
3419 to a plain pointer.
3420
3421 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3422 @opindex Wsign-promo
3423 @opindex Wno-sign-promo
3424 Warn when overload resolution chooses a promotion from unsigned or
3425 enumerated type to a signed type, over a conversion to an unsigned type of
3426 the same size. Previous versions of G++ tried to preserve
3427 unsignedness, but the standard mandates the current behavior.
3428
3429 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3430 @opindex Wtemplates
3431 @opindex Wno-templates
3432 Warn when a primary template declaration is encountered. Some coding
3433 rules disallow templates, and this may be used to enforce that rule.
3434 The warning is inactive inside a system header file, such as the STL, so
3435 one can still use the STL. One may also instantiate or specialize
3436 templates.
3437
3438 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3439 @opindex Wmultiple-inheritance
3440 @opindex Wno-multiple-inheritance
3441 Warn when a class is defined with multiple direct base classes. Some
3442 coding rules disallow multiple inheritance, and this may be used to
3443 enforce that rule. The warning is inactive inside a system header file,
3444 such as the STL, so one can still use the STL. One may also define
3445 classes that indirectly use multiple inheritance.
3446
3447 @item -Wvirtual-inheritance
3448 @opindex Wvirtual-inheritance
3449 @opindex Wno-virtual-inheritance
3450 Warn when a class is defined with a virtual direct base class. Some
3451 coding rules disallow multiple inheritance, and this may be used to
3452 enforce that rule. The warning is inactive inside a system header file,
3453 such as the STL, so one can still use the STL. One may also define
3454 classes that indirectly use virtual inheritance.
3455
3456 @item -Wnamespaces
3457 @opindex Wnamespaces
3458 @opindex Wno-namespaces
3459 Warn when a namespace definition is opened. Some coding rules disallow
3460 namespaces, and this may be used to enforce that rule. The warning is
3461 inactive inside a system header file, such as the STL, so one can still
3462 use the STL. One may also use using directives and qualified names.
3463
3464 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3465 @opindex Wterminate
3466 @opindex Wno-terminate
3467 Disable the warning about a throw-expression that will immediately
3468 result in a call to @code{terminate}.
3469
3470 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3471 @opindex Wno-class-conversion
3472 @opindex Wclass-conversion
3473 Disable the warning about the case when a conversion function converts an
3474 object to the same type, to a base class of that type, or to void; such
3475 a conversion function will never be called.
3476 @end table
3477
3478 @node Objective-C and Objective-C++ Dialect Options
3479 @section Options Controlling Objective-C and Objective-C++ Dialects
3480
3481 @cindex compiler options, Objective-C and Objective-C++
3482 @cindex Objective-C and Objective-C++ options, command-line
3483 @cindex options, Objective-C and Objective-C++
3484 (NOTE: This manual does not describe the Objective-C and Objective-C++
3485 languages themselves. @xref{Standards,,Language Standards
3486 Supported by GCC}, for references.)
3487
3488 This section describes the command-line options that are only meaningful
3489 for Objective-C and Objective-C++ programs. You can also use most of
3490 the language-independent GNU compiler options.
3491 For example, you might compile a file @file{some_class.m} like this:
3492
3493 @smallexample
3494 gcc -g -fgnu-runtime -O -c some_class.m
3495 @end smallexample
3496
3497 @noindent
3498 In this example, @option{-fgnu-runtime} is an option meant only for
3499 Objective-C and Objective-C++ programs; you can use the other options with
3500 any language supported by GCC@.
3501
3502 Note that since Objective-C is an extension of the C language, Objective-C
3503 compilations may also use options specific to the C front-end (e.g.,
3504 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3505 C++-specific options (e.g., @option{-Wabi}).
3506
3507 Here is a list of options that are @emph{only} for compiling Objective-C
3508 and Objective-C++ programs:
3509
3510 @table @gcctabopt
3511 @item -fconstant-string-class=@var{class-name}
3512 @opindex fconstant-string-class
3513 Use @var{class-name} as the name of the class to instantiate for each
3514 literal string specified with the syntax @code{@@"@dots{}"}. The default
3515 class name is @code{NXConstantString} if the GNU runtime is being used, and
3516 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3517 @option{-fconstant-cfstrings} option, if also present, overrides the
3518 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3519 to be laid out as constant CoreFoundation strings.
3520
3521 @item -fgnu-runtime
3522 @opindex fgnu-runtime
3523 Generate object code compatible with the standard GNU Objective-C
3524 runtime. This is the default for most types of systems.
3525
3526 @item -fnext-runtime
3527 @opindex fnext-runtime
3528 Generate output compatible with the NeXT runtime. This is the default
3529 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3530 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3531 used.
3532
3533 @item -fno-nil-receivers
3534 @opindex fno-nil-receivers
3535 @opindex fnil-receivers
3536 Assume that all Objective-C message dispatches (@code{[receiver
3537 message:arg]}) in this translation unit ensure that the receiver is
3538 not @code{nil}. This allows for more efficient entry points in the
3539 runtime to be used. This option is only available in conjunction with
3540 the NeXT runtime and ABI version 0 or 1.
3541
3542 @item -fobjc-abi-version=@var{n}
3543 @opindex fobjc-abi-version
3544 Use version @var{n} of the Objective-C ABI for the selected runtime.
3545 This option is currently supported only for the NeXT runtime. In that
3546 case, Version 0 is the traditional (32-bit) ABI without support for
3547 properties and other Objective-C 2.0 additions. Version 1 is the
3548 traditional (32-bit) ABI with support for properties and other
3549 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3550 nothing is specified, the default is Version 0 on 32-bit target
3551 machines, and Version 2 on 64-bit target machines.
3552
3553 @item -fobjc-call-cxx-cdtors
3554 @opindex fobjc-call-cxx-cdtors
3555 For each Objective-C class, check if any of its instance variables is a
3556 C++ object with a non-trivial default constructor. If so, synthesize a
3557 special @code{- (id) .cxx_construct} instance method which runs
3558 non-trivial default constructors on any such instance variables, in order,
3559 and then return @code{self}. Similarly, check if any instance variable
3560 is a C++ object with a non-trivial destructor, and if so, synthesize a
3561 special @code{- (void) .cxx_destruct} method which runs
3562 all such default destructors, in reverse order.
3563
3564 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3565 methods thusly generated only operate on instance variables
3566 declared in the current Objective-C class, and not those inherited
3567 from superclasses. It is the responsibility of the Objective-C
3568 runtime to invoke all such methods in an object's inheritance
3569 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3570 by the runtime immediately after a new object instance is allocated;
3571 the @code{- (void) .cxx_destruct} methods are invoked immediately
3572 before the runtime deallocates an object instance.
3573
3574 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3575 support for invoking the @code{- (id) .cxx_construct} and
3576 @code{- (void) .cxx_destruct} methods.
3577
3578 @item -fobjc-direct-dispatch
3579 @opindex fobjc-direct-dispatch
3580 Allow fast jumps to the message dispatcher. On Darwin this is
3581 accomplished via the comm page.
3582
3583 @item -fobjc-exceptions
3584 @opindex fobjc-exceptions
3585 Enable syntactic support for structured exception handling in
3586 Objective-C, similar to what is offered by C++. This option
3587 is required to use the Objective-C keywords @code{@@try},
3588 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3589 @code{@@synchronized}. This option is available with both the GNU
3590 runtime and the NeXT runtime (but not available in conjunction with
3591 the NeXT runtime on Mac OS X 10.2 and earlier).
3592
3593 @item -fobjc-gc
3594 @opindex fobjc-gc
3595 Enable garbage collection (GC) in Objective-C and Objective-C++
3596 programs. This option is only available with the NeXT runtime; the
3597 GNU runtime has a different garbage collection implementation that
3598 does not require special compiler flags.
3599
3600 @item -fobjc-nilcheck
3601 @opindex fobjc-nilcheck
3602 For the NeXT runtime with version 2 of the ABI, check for a nil
3603 receiver in method invocations before doing the actual method call.
3604 This is the default and can be disabled using
3605 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3606 checked for nil in this way no matter what this flag is set to.
3607 Currently this flag does nothing when the GNU runtime, or an older
3608 version of the NeXT runtime ABI, is used.
3609
3610 @item -fobjc-std=objc1
3611 @opindex fobjc-std
3612 Conform to the language syntax of Objective-C 1.0, the language
3613 recognized by GCC 4.0. This only affects the Objective-C additions to
3614 the C/C++ language; it does not affect conformance to C/C++ standards,
3615 which is controlled by the separate C/C++ dialect option flags. When
3616 this option is used with the Objective-C or Objective-C++ compiler,
3617 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3618 This is useful if you need to make sure that your Objective-C code can
3619 be compiled with older versions of GCC@.
3620
3621 @item -freplace-objc-classes
3622 @opindex freplace-objc-classes
3623 Emit a special marker instructing @command{ld(1)} not to statically link in
3624 the resulting object file, and allow @command{dyld(1)} to load it in at
3625 run time instead. This is used in conjunction with the Fix-and-Continue
3626 debugging mode, where the object file in question may be recompiled and
3627 dynamically reloaded in the course of program execution, without the need
3628 to restart the program itself. Currently, Fix-and-Continue functionality
3629 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3630 and later.
3631
3632 @item -fzero-link
3633 @opindex fzero-link
3634 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3635 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3636 compile time) with static class references that get initialized at load time,
3637 which improves run-time performance. Specifying the @option{-fzero-link} flag
3638 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3639 to be retained. This is useful in Zero-Link debugging mode, since it allows
3640 for individual class implementations to be modified during program execution.
3641 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3642 regardless of command-line options.
3643
3644 @item -fno-local-ivars
3645 @opindex fno-local-ivars
3646 @opindex flocal-ivars
3647 By default instance variables in Objective-C can be accessed as if
3648 they were local variables from within the methods of the class they're
3649 declared in. This can lead to shadowing between instance variables
3650 and other variables declared either locally inside a class method or
3651 globally with the same name. Specifying the @option{-fno-local-ivars}
3652 flag disables this behavior thus avoiding variable shadowing issues.
3653
3654 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3655 @opindex fivar-visibility
3656 Set the default instance variable visibility to the specified option
3657 so that instance variables declared outside the scope of any access
3658 modifier directives default to the specified visibility.
3659
3660 @item -gen-decls
3661 @opindex gen-decls
3662 Dump interface declarations for all classes seen in the source file to a
3663 file named @file{@var{sourcename}.decl}.
3664
3665 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3666 @opindex Wassign-intercept
3667 @opindex Wno-assign-intercept
3668 Warn whenever an Objective-C assignment is being intercepted by the
3669 garbage collector.
3670
3671 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3672 @opindex Wno-protocol
3673 @opindex Wprotocol
3674 If a class is declared to implement a protocol, a warning is issued for
3675 every method in the protocol that is not implemented by the class. The
3676 default behavior is to issue a warning for every method not explicitly
3677 implemented in the class, even if a method implementation is inherited
3678 from the superclass. If you use the @option{-Wno-protocol} option, then
3679 methods inherited from the superclass are considered to be implemented,
3680 and no warning is issued for them.
3681
3682 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3683 @opindex Wselector
3684 @opindex Wno-selector
3685 Warn if multiple methods of different types for the same selector are
3686 found during compilation. The check is performed on the list of methods
3687 in the final stage of compilation. Additionally, a check is performed
3688 for each selector appearing in a @code{@@selector(@dots{})}
3689 expression, and a corresponding method for that selector has been found
3690 during compilation. Because these checks scan the method table only at
3691 the end of compilation, these warnings are not produced if the final
3692 stage of compilation is not reached, for example because an error is
3693 found during compilation, or because the @option{-fsyntax-only} option is
3694 being used.
3695
3696 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3697 @opindex Wstrict-selector-match
3698 @opindex Wno-strict-selector-match
3699 Warn if multiple methods with differing argument and/or return types are
3700 found for a given selector when attempting to send a message using this
3701 selector to a receiver of type @code{id} or @code{Class}. When this flag
3702 is off (which is the default behavior), the compiler omits such warnings
3703 if any differences found are confined to types that share the same size
3704 and alignment.
3705
3706 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3707 @opindex Wundeclared-selector
3708 @opindex Wno-undeclared-selector
3709 Warn if a @code{@@selector(@dots{})} expression referring to an
3710 undeclared selector is found. A selector is considered undeclared if no
3711 method with that name has been declared before the
3712 @code{@@selector(@dots{})} expression, either explicitly in an
3713 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3714 an @code{@@implementation} section. This option always performs its
3715 checks as soon as a @code{@@selector(@dots{})} expression is found,
3716 while @option{-Wselector} only performs its checks in the final stage of
3717 compilation. This also enforces the coding style convention
3718 that methods and selectors must be declared before being used.
3719
3720 @item -print-objc-runtime-info
3721 @opindex print-objc-runtime-info
3722 Generate C header describing the largest structure that is passed by
3723 value, if any.
3724
3725 @end table
3726
3727 @node Diagnostic Message Formatting Options
3728 @section Options to Control Diagnostic Messages Formatting
3729 @cindex options to control diagnostics formatting
3730 @cindex diagnostic messages
3731 @cindex message formatting
3732
3733 Traditionally, diagnostic messages have been formatted irrespective of
3734 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3735 options described below
3736 to control the formatting algorithm for diagnostic messages,
3737 e.g.@: how many characters per line, how often source location
3738 information should be reported. Note that some language front ends may not
3739 honor these options.
3740
3741 @table @gcctabopt
3742 @item -fmessage-length=@var{n}
3743 @opindex fmessage-length
3744 Try to format error messages so that they fit on lines of about
3745 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3746 done; each error message appears on a single line. This is the
3747 default for all front ends.
3748
3749 Note - this option also affects the display of the @samp{#error} and
3750 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3751 function/type/variable attribute. It does not however affect the
3752 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3753
3754 @item -fdiagnostics-show-location=once
3755 @opindex fdiagnostics-show-location
3756 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3757 reporter to emit source location information @emph{once}; that is, in
3758 case the message is too long to fit on a single physical line and has to
3759 be wrapped, the source location won't be emitted (as prefix) again,
3760 over and over, in subsequent continuation lines. This is the default
3761 behavior.
3762
3763 @item -fdiagnostics-show-location=every-line
3764 Only meaningful in line-wrapping mode. Instructs the diagnostic
3765 messages reporter to emit the same source location information (as
3766 prefix) for physical lines that result from the process of breaking
3767 a message which is too long to fit on a single line.
3768
3769 @item -fdiagnostics-color[=@var{WHEN}]
3770 @itemx -fno-diagnostics-color
3771 @opindex fdiagnostics-color
3772 @cindex highlight, color
3773 @vindex GCC_COLORS @r{environment variable}
3774 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3775 or @samp{auto}. The default depends on how the compiler has been configured,
3776 it can be any of the above @var{WHEN} options or also @samp{never}
3777 if @env{GCC_COLORS} environment variable isn't present in the environment,
3778 and @samp{auto} otherwise.
3779 @samp{auto} means to use color only when the standard error is a terminal.
3780 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3781 aliases for @option{-fdiagnostics-color=always} and
3782 @option{-fdiagnostics-color=never}, respectively.
3783
3784 The colors are defined by the environment variable @env{GCC_COLORS}.
3785 Its value is a colon-separated list of capabilities and Select Graphic
3786 Rendition (SGR) substrings. SGR commands are interpreted by the
3787 terminal or terminal emulator. (See the section in the documentation
3788 of your text terminal for permitted values and their meanings as
3789 character attributes.) These substring values are integers in decimal
3790 representation and can be concatenated with semicolons.
3791 Common values to concatenate include
3792 @samp{1} for bold,
3793 @samp{4} for underline,
3794 @samp{5} for blink,
3795 @samp{7} for inverse,
3796 @samp{39} for default foreground color,
3797 @samp{30} to @samp{37} for foreground colors,
3798 @samp{90} to @samp{97} for 16-color mode foreground colors,
3799 @samp{38;5;0} to @samp{38;5;255}
3800 for 88-color and 256-color modes foreground colors,
3801 @samp{49} for default background color,
3802 @samp{40} to @samp{47} for background colors,
3803 @samp{100} to @samp{107} for 16-color mode background colors,
3804 and @samp{48;5;0} to @samp{48;5;255}
3805 for 88-color and 256-color modes background colors.
3806
3807 The default @env{GCC_COLORS} is
3808 @smallexample
3809 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3810 quote=01:fixit-insert=32:fixit-delete=31:\
3811 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3812 type-diff=01;32
3813 @end smallexample
3814 @noindent
3815 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3816 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3817 @samp{01} is bold, and @samp{31} is red.
3818 Setting @env{GCC_COLORS} to the empty string disables colors.
3819 Supported capabilities are as follows.
3820
3821 @table @code
3822 @item error=
3823 @vindex error GCC_COLORS @r{capability}
3824 SGR substring for error: markers.
3825
3826 @item warning=
3827 @vindex warning GCC_COLORS @r{capability}
3828 SGR substring for warning: markers.
3829
3830 @item note=
3831 @vindex note GCC_COLORS @r{capability}
3832 SGR substring for note: markers.
3833
3834 @item range1=
3835 @vindex range1 GCC_COLORS @r{capability}
3836 SGR substring for first additional range.
3837
3838 @item range2=
3839 @vindex range2 GCC_COLORS @r{capability}
3840 SGR substring for second additional range.
3841
3842 @item locus=
3843 @vindex locus GCC_COLORS @r{capability}
3844 SGR substring for location information, @samp{file:line} or
3845 @samp{file:line:column} etc.
3846
3847 @item quote=
3848 @vindex quote GCC_COLORS @r{capability}
3849 SGR substring for information printed within quotes.
3850
3851 @item fixit-insert=
3852 @vindex fixit-insert GCC_COLORS @r{capability}
3853 SGR substring for fix-it hints suggesting text to
3854 be inserted or replaced.
3855
3856 @item fixit-delete=
3857 @vindex fixit-delete GCC_COLORS @r{capability}
3858 SGR substring for fix-it hints suggesting text to
3859 be deleted.
3860
3861 @item diff-filename=
3862 @vindex diff-filename GCC_COLORS @r{capability}
3863 SGR substring for filename headers within generated patches.
3864
3865 @item diff-hunk=
3866 @vindex diff-hunk GCC_COLORS @r{capability}
3867 SGR substring for the starts of hunks within generated patches.
3868
3869 @item diff-delete=
3870 @vindex diff-delete GCC_COLORS @r{capability}
3871 SGR substring for deleted lines within generated patches.
3872
3873 @item diff-insert=
3874 @vindex diff-insert GCC_COLORS @r{capability}
3875 SGR substring for inserted lines within generated patches.
3876
3877 @item type-diff=
3878 @vindex type-diff GCC_COLORS @r{capability}
3879 SGR substring for highlighting mismatching types within template
3880 arguments in the C++ frontend.
3881 @end table
3882
3883 @item -fno-diagnostics-show-option
3884 @opindex fno-diagnostics-show-option
3885 @opindex fdiagnostics-show-option
3886 By default, each diagnostic emitted includes text indicating the
3887 command-line option that directly controls the diagnostic (if such an
3888 option is known to the diagnostic machinery). Specifying the
3889 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3890
3891 @item -fno-diagnostics-show-caret
3892 @opindex fno-diagnostics-show-caret
3893 @opindex fdiagnostics-show-caret
3894 By default, each diagnostic emitted includes the original source line
3895 and a caret @samp{^} indicating the column. This option suppresses this
3896 information. The source line is truncated to @var{n} characters, if
3897 the @option{-fmessage-length=n} option is given. When the output is done
3898 to the terminal, the width is limited to the width given by the
3899 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3900
3901 @item -fno-diagnostics-show-labels
3902 @opindex fno-diagnostics-show-labels
3903 @opindex fdiagnostics-show-labels
3904 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3905 diagnostics can label ranges of source code with pertinent information, such
3906 as the types of expressions:
3907
3908 @smallexample
3909 printf ("foo %s bar", long_i + long_j);
3910 ~^ ~~~~~~~~~~~~~~~
3911 | |
3912 char * long int
3913 @end smallexample
3914
3915 This option suppresses the printing of these labels (in the example above,
3916 the vertical bars and the ``char *'' and ``long int'' text).
3917
3918 @item -fno-diagnostics-show-line-numbers
3919 @opindex fno-diagnostics-show-line-numbers
3920 @opindex fdiagnostics-show-line-numbers
3921 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3922 a left margin is printed, showing line numbers. This option suppresses this
3923 left margin.
3924
3925 @item -fdiagnostics-minimum-margin-width=@var{width}
3926 @opindex fdiagnostics-minimum-margin-width
3927 This option controls the minimum width of the left margin printed by
3928 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3929
3930 @item -fdiagnostics-parseable-fixits
3931 @opindex fdiagnostics-parseable-fixits
3932 Emit fix-it hints in a machine-parseable format, suitable for consumption
3933 by IDEs. For each fix-it, a line will be printed after the relevant
3934 diagnostic, starting with the string ``fix-it:''. For example:
3935
3936 @smallexample
3937 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3938 @end smallexample
3939
3940 The location is expressed as a half-open range, expressed as a count of
3941 bytes, starting at byte 1 for the initial column. In the above example,
3942 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3943 given string:
3944
3945 @smallexample
3946 00000000011111111112222222222
3947 12345678901234567890123456789
3948 gtk_widget_showall (dlg);
3949 ^^^^^^^^^^^^^^^^^^
3950 gtk_widget_show_all
3951 @end smallexample
3952
3953 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3954 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3955 (e.g. vertical tab as ``\013'').
3956
3957 An empty replacement string indicates that the given range is to be removed.
3958 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3959 be inserted at the given position.
3960
3961 @item -fdiagnostics-generate-patch
3962 @opindex fdiagnostics-generate-patch
3963 Print fix-it hints to stderr in unified diff format, after any diagnostics
3964 are printed. For example:
3965
3966 @smallexample
3967 --- test.c
3968 +++ test.c
3969 @@ -42,5 +42,5 @@
3970
3971 void show_cb(GtkDialog *dlg)
3972 @{
3973 - gtk_widget_showall(dlg);
3974 + gtk_widget_show_all(dlg);
3975 @}
3976
3977 @end smallexample
3978
3979 The diff may or may not be colorized, following the same rules
3980 as for diagnostics (see @option{-fdiagnostics-color}).
3981
3982 @item -fdiagnostics-show-template-tree
3983 @opindex fdiagnostics-show-template-tree
3984
3985 In the C++ frontend, when printing diagnostics showing mismatching
3986 template types, such as:
3987
3988 @smallexample
3989 could not convert 'std::map<int, std::vector<double> >()'
3990 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3991 @end smallexample
3992
3993 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3994 tree-like structure showing the common and differing parts of the types,
3995 such as:
3996
3997 @smallexample
3998 map<
3999 [...],
4000 vector<
4001 [double != float]>>
4002 @end smallexample
4003
4004 The parts that differ are highlighted with color (``double'' and
4005 ``float'' in this case).
4006
4007 @item -fno-elide-type
4008 @opindex fno-elide-type
4009 @opindex felide-type
4010 By default when the C++ frontend prints diagnostics showing mismatching
4011 template types, common parts of the types are printed as ``[...]'' to
4012 simplify the error message. For example:
4013
4014 @smallexample
4015 could not convert 'std::map<int, std::vector<double> >()'
4016 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4017 @end smallexample
4018
4019 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4020 This flag also affects the output of the
4021 @option{-fdiagnostics-show-template-tree} flag.
4022
4023 @item -fno-show-column
4024 @opindex fno-show-column
4025 @opindex fshow-column
4026 Do not print column numbers in diagnostics. This may be necessary if
4027 diagnostics are being scanned by a program that does not understand the
4028 column numbers, such as @command{dejagnu}.
4029
4030 @item -fdiagnostics-format=@var{FORMAT}
4031 @opindex fdiagnostics-format
4032 Select a different format for printing diagnostics.
4033 @var{FORMAT} is @samp{text} or @samp{json}.
4034 The default is @samp{text}.
4035
4036 The @samp{json} format consists of a top-level JSON array containing JSON
4037 objects representing the diagnostics.
4038
4039 The JSON is emitted as one line, without formatting; the examples below
4040 have been formatted for clarity.
4041
4042 Diagnostics can have child diagnostics. For example, this error and note:
4043
4044 @smallexample
4045 misleading-indentation.c:15:3: warning: this 'if' clause does not
4046 guard... [-Wmisleading-indentation]
4047 15 | if (flag)
4048 | ^~
4049 misleading-indentation.c:17:5: note: ...this statement, but the latter
4050 is misleadingly indented as if it were guarded by the 'if'
4051 17 | y = 2;
4052 | ^
4053 @end smallexample
4054
4055 @noindent
4056 might be printed in JSON form (after formatting) like this:
4057
4058 @smallexample
4059 [
4060 @{
4061 "kind": "warning",
4062 "locations": [
4063 @{
4064 "caret": @{
4065 "column": 3,
4066 "file": "misleading-indentation.c",
4067 "line": 15
4068 @},
4069 "finish": @{
4070 "column": 4,
4071 "file": "misleading-indentation.c",
4072 "line": 15
4073 @}
4074 @}
4075 ],
4076 "message": "this \u2018if\u2019 clause does not guard...",
4077 "option": "-Wmisleading-indentation",
4078 "children": [
4079 @{
4080 "kind": "note",
4081 "locations": [
4082 @{
4083 "caret": @{
4084 "column": 5,
4085 "file": "misleading-indentation.c",
4086 "line": 17
4087 @}
4088 @}
4089 ],
4090 "message": "...this statement, but the latter is @dots{}"
4091 @}
4092 ]
4093 @},
4094 @dots{}
4095 ]
4096 @end smallexample
4097
4098 @noindent
4099 where the @code{note} is a child of the @code{warning}.
4100
4101 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4102 an @code{option} key describing the command-line option controlling the
4103 warning.
4104
4105 A diagnostic can contain zero or more locations. Each location has up
4106 to three positions within it: a @code{caret} position and optional
4107 @code{start} and @code{finish} positions. A location can also have
4108 an optional @code{label} string. For example, this error:
4109
4110 @smallexample
4111 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4112 'struct s'@} and 'T' @{aka 'struct t'@})
4113 64 | return callee_4a () + callee_4b ();
4114 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4115 | | |
4116 | | T @{aka struct t@}
4117 | S @{aka struct s@}
4118 @end smallexample
4119
4120 @noindent
4121 has three locations. Its primary location is at the ``+'' token at column
4122 23. It has two secondary locations, describing the left and right-hand sides
4123 of the expression, which have labels. It might be printed in JSON form as:
4124
4125 @smallexample
4126 @{
4127 "children": [],
4128 "kind": "error",
4129 "locations": [
4130 @{
4131 "caret": @{
4132 "column": 23, "file": "bad-binary-ops.c", "line": 64
4133 @}
4134 @},
4135 @{
4136 "caret": @{
4137 "column": 10, "file": "bad-binary-ops.c", "line": 64
4138 @},
4139 "finish": @{
4140 "column": 21, "file": "bad-binary-ops.c", "line": 64
4141 @},
4142 "label": "S @{aka struct s@}"
4143 @},
4144 @{
4145 "caret": @{
4146 "column": 25, "file": "bad-binary-ops.c", "line": 64
4147 @},
4148 "finish": @{
4149 "column": 36, "file": "bad-binary-ops.c", "line": 64
4150 @},
4151 "label": "T @{aka struct t@}"
4152 @}
4153 ],
4154 "message": "invalid operands to binary + @dots{}"
4155 @}
4156 @end smallexample
4157
4158 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4159 consisting of half-open intervals, similar to the output of
4160 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4161 with a replacement fix-it hint:
4162
4163 @smallexample
4164 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4165 mean 'color'?
4166 8 | return ptr->colour;
4167 | ^~~~~~
4168 | color
4169 @end smallexample
4170
4171 @noindent
4172 might be printed in JSON form as:
4173
4174 @smallexample
4175 @{
4176 "children": [],
4177 "fixits": [
4178 @{
4179 "next": @{
4180 "column": 21,
4181 "file": "demo.c",
4182 "line": 8
4183 @},
4184 "start": @{
4185 "column": 15,
4186 "file": "demo.c",
4187 "line": 8
4188 @},
4189 "string": "color"
4190 @}
4191 ],
4192 "kind": "error",
4193 "locations": [
4194 @{
4195 "caret": @{
4196 "column": 15,
4197 "file": "demo.c",
4198 "line": 8
4199 @},
4200 "finish": @{
4201 "column": 20,
4202 "file": "demo.c",
4203 "line": 8
4204 @}
4205 @}
4206 ],
4207 "message": "\u2018struct s\u2019 has no member named @dots{}"
4208 @}
4209 @end smallexample
4210
4211 @noindent
4212 where the fix-it hint suggests replacing the text from @code{start} up
4213 to but not including @code{next} with @code{string}'s value. Deletions
4214 are expressed via an empty value for @code{string}, insertions by
4215 having @code{start} equal @code{next}.
4216
4217 @end table
4218
4219 @node Warning Options
4220 @section Options to Request or Suppress Warnings
4221 @cindex options to control warnings
4222 @cindex warning messages
4223 @cindex messages, warning
4224 @cindex suppressing warnings
4225
4226 Warnings are diagnostic messages that report constructions that
4227 are not inherently erroneous but that are risky or suggest there
4228 may have been an error.
4229
4230 The following language-independent options do not enable specific
4231 warnings but control the kinds of diagnostics produced by GCC@.
4232
4233 @table @gcctabopt
4234 @cindex syntax checking
4235 @item -fsyntax-only
4236 @opindex fsyntax-only
4237 Check the code for syntax errors, but don't do anything beyond that.
4238
4239 @item -fmax-errors=@var{n}
4240 @opindex fmax-errors
4241 Limits the maximum number of error messages to @var{n}, at which point
4242 GCC bails out rather than attempting to continue processing the source
4243 code. If @var{n} is 0 (the default), there is no limit on the number
4244 of error messages produced. If @option{-Wfatal-errors} is also
4245 specified, then @option{-Wfatal-errors} takes precedence over this
4246 option.
4247
4248 @item -w
4249 @opindex w
4250 Inhibit all warning messages.
4251
4252 @item -Werror
4253 @opindex Werror
4254 @opindex Wno-error
4255 Make all warnings into errors.
4256
4257 @item -Werror=
4258 @opindex Werror=
4259 @opindex Wno-error=
4260 Make the specified warning into an error. The specifier for a warning
4261 is appended; for example @option{-Werror=switch} turns the warnings
4262 controlled by @option{-Wswitch} into errors. This switch takes a
4263 negative form, to be used to negate @option{-Werror} for specific
4264 warnings; for example @option{-Wno-error=switch} makes
4265 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4266 is in effect.
4267
4268 The warning message for each controllable warning includes the
4269 option that controls the warning. That option can then be used with
4270 @option{-Werror=} and @option{-Wno-error=} as described above.
4271 (Printing of the option in the warning message can be disabled using the
4272 @option{-fno-diagnostics-show-option} flag.)
4273
4274 Note that specifying @option{-Werror=}@var{foo} automatically implies
4275 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4276 imply anything.
4277
4278 @item -Wfatal-errors
4279 @opindex Wfatal-errors
4280 @opindex Wno-fatal-errors
4281 This option causes the compiler to abort compilation on the first error
4282 occurred rather than trying to keep going and printing further error
4283 messages.
4284
4285 @end table
4286
4287 You can request many specific warnings with options beginning with
4288 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4289 implicit declarations. Each of these specific warning options also
4290 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4291 example, @option{-Wno-implicit}. This manual lists only one of the
4292 two forms, whichever is not the default. For further
4293 language-specific options also refer to @ref{C++ Dialect Options} and
4294 @ref{Objective-C and Objective-C++ Dialect Options}.
4295
4296 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4297 options, such as @option{-Wunused}, which may turn on further options,
4298 such as @option{-Wunused-value}. The combined effect of positive and
4299 negative forms is that more specific options have priority over less
4300 specific ones, independently of their position in the command-line. For
4301 options of the same specificity, the last one takes effect. Options
4302 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4303 as if they appeared at the end of the command-line.
4304
4305 When an unrecognized warning option is requested (e.g.,
4306 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4307 that the option is not recognized. However, if the @option{-Wno-} form
4308 is used, the behavior is slightly different: no diagnostic is
4309 produced for @option{-Wno-unknown-warning} unless other diagnostics
4310 are being produced. This allows the use of new @option{-Wno-} options
4311 with old compilers, but if something goes wrong, the compiler
4312 warns that an unrecognized option is present.
4313
4314 @table @gcctabopt
4315 @item -Wpedantic
4316 @itemx -pedantic
4317 @opindex pedantic
4318 @opindex Wpedantic
4319 @opindex Wno-pedantic
4320 Issue all the warnings demanded by strict ISO C and ISO C++;
4321 reject all programs that use forbidden extensions, and some other
4322 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4323 version of the ISO C standard specified by any @option{-std} option used.
4324
4325 Valid ISO C and ISO C++ programs should compile properly with or without
4326 this option (though a rare few require @option{-ansi} or a
4327 @option{-std} option specifying the required version of ISO C)@. However,
4328 without this option, certain GNU extensions and traditional C and C++
4329 features are supported as well. With this option, they are rejected.
4330
4331 @option{-Wpedantic} does not cause warning messages for use of the
4332 alternate keywords whose names begin and end with @samp{__}. Pedantic
4333 warnings are also disabled in the expression that follows
4334 @code{__extension__}. However, only system header files should use
4335 these escape routes; application programs should avoid them.
4336 @xref{Alternate Keywords}.
4337
4338 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4339 C conformance. They soon find that it does not do quite what they want:
4340 it finds some non-ISO practices, but not all---only those for which
4341 ISO C @emph{requires} a diagnostic, and some others for which
4342 diagnostics have been added.
4343
4344 A feature to report any failure to conform to ISO C might be useful in
4345 some instances, but would require considerable additional work and would
4346 be quite different from @option{-Wpedantic}. We don't have plans to
4347 support such a feature in the near future.
4348
4349 Where the standard specified with @option{-std} represents a GNU
4350 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4351 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4352 extended dialect is based. Warnings from @option{-Wpedantic} are given
4353 where they are required by the base standard. (It does not make sense
4354 for such warnings to be given only for features not in the specified GNU
4355 C dialect, since by definition the GNU dialects of C include all
4356 features the compiler supports with the given option, and there would be
4357 nothing to warn about.)
4358
4359 @item -pedantic-errors
4360 @opindex pedantic-errors
4361 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4362 requires a diagnostic, in some cases where there is undefined behavior
4363 at compile-time and in some other cases that do not prevent compilation
4364 of programs that are valid according to the standard. This is not
4365 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4366 by this option and not enabled by the latter and vice versa.
4367
4368 @item -Wall
4369 @opindex Wall
4370 @opindex Wno-all
4371 This enables all the warnings about constructions that some users
4372 consider questionable, and that are easy to avoid (or modify to
4373 prevent the warning), even in conjunction with macros. This also
4374 enables some language-specific warnings described in @ref{C++ Dialect
4375 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4376
4377 @option{-Wall} turns on the following warning flags:
4378
4379 @gccoptlist{-Waddress @gol
4380 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4381 -Wbool-compare @gol
4382 -Wbool-operation @gol
4383 -Wc++11-compat -Wc++14-compat @gol
4384 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4385 -Wchar-subscripts @gol
4386 -Wcomment @gol
4387 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4388 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4389 -Wformat @gol
4390 -Wint-in-bool-context @gol
4391 -Wimplicit @r{(C and Objective-C only)} @gol
4392 -Wimplicit-int @r{(C and Objective-C only)} @gol
4393 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4394 -Winit-self @r{(only for C++)} @gol
4395 -Wlogical-not-parentheses @gol
4396 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4397 -Wmaybe-uninitialized @gol
4398 -Wmemset-elt-size @gol
4399 -Wmemset-transposed-args @gol
4400 -Wmisleading-indentation @r{(only for C/C++)} @gol
4401 -Wmissing-attributes @gol
4402 -Wmissing-braces @r{(only for C/ObjC)} @gol
4403 -Wmultistatement-macros @gol
4404 -Wnarrowing @r{(only for C++)} @gol
4405 -Wnonnull @gol
4406 -Wnonnull-compare @gol
4407 -Wopenmp-simd @gol
4408 -Wparentheses @gol
4409 -Wpessimizing-move @r{(only for C++)} @gol
4410 -Wpointer-sign @gol
4411 -Wreorder @gol
4412 -Wrestrict @gol
4413 -Wreturn-type @gol
4414 -Wsequence-point @gol
4415 -Wsign-compare @r{(only in C++)} @gol
4416 -Wsizeof-pointer-div @gol
4417 -Wsizeof-pointer-memaccess @gol
4418 -Wstrict-aliasing @gol
4419 -Wstrict-overflow=1 @gol
4420 -Wswitch @gol
4421 -Wtautological-compare @gol
4422 -Wtrigraphs @gol
4423 -Wuninitialized @gol
4424 -Wunknown-pragmas @gol
4425 -Wunused-function @gol
4426 -Wunused-label @gol
4427 -Wunused-value @gol
4428 -Wunused-variable @gol
4429 -Wvolatile-register-var}
4430
4431 Note that some warning flags are not implied by @option{-Wall}. Some of
4432 them warn about constructions that users generally do not consider
4433 questionable, but which occasionally you might wish to check for;
4434 others warn about constructions that are necessary or hard to avoid in
4435 some cases, and there is no simple way to modify the code to suppress
4436 the warning. Some of them are enabled by @option{-Wextra} but many of
4437 them must be enabled individually.
4438
4439 @item -Wextra
4440 @opindex W
4441 @opindex Wextra
4442 @opindex Wno-extra
4443 This enables some extra warning flags that are not enabled by
4444 @option{-Wall}. (This option used to be called @option{-W}. The older
4445 name is still supported, but the newer name is more descriptive.)
4446
4447 @gccoptlist{-Wclobbered @gol
4448 -Wcast-function-type @gol
4449 -Wdeprecated-copy @r{(C++ only)} @gol
4450 -Wempty-body @gol
4451 -Wignored-qualifiers @gol
4452 -Wimplicit-fallthrough=3 @gol
4453 -Wmissing-field-initializers @gol
4454 -Wmissing-parameter-type @r{(C only)} @gol
4455 -Wold-style-declaration @r{(C only)} @gol
4456 -Woverride-init @gol
4457 -Wsign-compare @r{(C only)} @gol
4458 -Wredundant-move @r{(only for C++)} @gol
4459 -Wtype-limits @gol
4460 -Wuninitialized @gol
4461 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4462 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4463 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4464
4465
4466 The option @option{-Wextra} also prints warning messages for the
4467 following cases:
4468
4469 @itemize @bullet
4470
4471 @item
4472 A pointer is compared against integer zero with @code{<}, @code{<=},
4473 @code{>}, or @code{>=}.
4474
4475 @item
4476 (C++ only) An enumerator and a non-enumerator both appear in a
4477 conditional expression.
4478
4479 @item
4480 (C++ only) Ambiguous virtual bases.
4481
4482 @item
4483 (C++ only) Subscripting an array that has been declared @code{register}.
4484
4485 @item
4486 (C++ only) Taking the address of a variable that has been declared
4487 @code{register}.
4488
4489 @item
4490 (C++ only) A base class is not initialized in the copy constructor
4491 of a derived class.
4492
4493 @end itemize
4494
4495 @item -Wchar-subscripts
4496 @opindex Wchar-subscripts
4497 @opindex Wno-char-subscripts
4498 Warn if an array subscript has type @code{char}. This is a common cause
4499 of error, as programmers often forget that this type is signed on some
4500 machines.
4501 This warning is enabled by @option{-Wall}.
4502
4503 @item -Wno-coverage-mismatch
4504 @opindex Wno-coverage-mismatch
4505 @opindex Wcoverage-mismatch
4506 Warn if feedback profiles do not match when using the
4507 @option{-fprofile-use} option.
4508 If a source file is changed between compiling with @option{-fprofile-generate}
4509 and with @option{-fprofile-use}, the files with the profile feedback can fail
4510 to match the source file and GCC cannot use the profile feedback
4511 information. By default, this warning is enabled and is treated as an
4512 error. @option{-Wno-coverage-mismatch} can be used to disable the
4513 warning or @option{-Wno-error=coverage-mismatch} can be used to
4514 disable the error. Disabling the error for this warning can result in
4515 poorly optimized code and is useful only in the
4516 case of very minor changes such as bug fixes to an existing code-base.
4517 Completely disabling the warning is not recommended.
4518
4519 @item -Wno-cpp
4520 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4521
4522 Suppress warning messages emitted by @code{#warning} directives.
4523
4524 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4525 @opindex Wdouble-promotion
4526 @opindex Wno-double-promotion
4527 Give a warning when a value of type @code{float} is implicitly
4528 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4529 floating-point unit implement @code{float} in hardware, but emulate
4530 @code{double} in software. On such a machine, doing computations
4531 using @code{double} values is much more expensive because of the
4532 overhead required for software emulation.
4533
4534 It is easy to accidentally do computations with @code{double} because
4535 floating-point literals are implicitly of type @code{double}. For
4536 example, in:
4537 @smallexample
4538 @group
4539 float area(float radius)
4540 @{
4541 return 3.14159 * radius * radius;
4542 @}
4543 @end group
4544 @end smallexample
4545 the compiler performs the entire computation with @code{double}
4546 because the floating-point literal is a @code{double}.
4547
4548 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4549 @opindex Wduplicate-decl-specifier
4550 @opindex Wno-duplicate-decl-specifier
4551 Warn if a declaration has duplicate @code{const}, @code{volatile},
4552 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4553 @option{-Wall}.
4554
4555 @item -Wformat
4556 @itemx -Wformat=@var{n}
4557 @opindex Wformat
4558 @opindex Wno-format
4559 @opindex ffreestanding
4560 @opindex fno-builtin
4561 @opindex Wformat=
4562 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4563 the arguments supplied have types appropriate to the format string
4564 specified, and that the conversions specified in the format string make
4565 sense. This includes standard functions, and others specified by format
4566 attributes (@pxref{Function Attributes}), in the @code{printf},
4567 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4568 not in the C standard) families (or other target-specific families).
4569 Which functions are checked without format attributes having been
4570 specified depends on the standard version selected, and such checks of
4571 functions without the attribute specified are disabled by
4572 @option{-ffreestanding} or @option{-fno-builtin}.
4573
4574 The formats are checked against the format features supported by GNU
4575 libc version 2.2. These include all ISO C90 and C99 features, as well
4576 as features from the Single Unix Specification and some BSD and GNU
4577 extensions. Other library implementations may not support all these
4578 features; GCC does not support warning about features that go beyond a
4579 particular library's limitations. However, if @option{-Wpedantic} is used
4580 with @option{-Wformat}, warnings are given about format features not
4581 in the selected standard version (but not for @code{strfmon} formats,
4582 since those are not in any version of the C standard). @xref{C Dialect
4583 Options,,Options Controlling C Dialect}.
4584
4585 @table @gcctabopt
4586 @item -Wformat=1
4587 @itemx -Wformat
4588 @opindex Wformat
4589 @opindex Wformat=1
4590 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4591 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4592 @option{-Wformat} also checks for null format arguments for several
4593 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4594 aspects of this level of format checking can be disabled by the
4595 options: @option{-Wno-format-contains-nul},
4596 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4597 @option{-Wformat} is enabled by @option{-Wall}.
4598
4599 @item -Wno-format-contains-nul
4600 @opindex Wno-format-contains-nul
4601 @opindex Wformat-contains-nul
4602 If @option{-Wformat} is specified, do not warn about format strings that
4603 contain NUL bytes.
4604
4605 @item -Wno-format-extra-args
4606 @opindex Wno-format-extra-args
4607 @opindex Wformat-extra-args
4608 If @option{-Wformat} is specified, do not warn about excess arguments to a
4609 @code{printf} or @code{scanf} format function. The C standard specifies
4610 that such arguments are ignored.
4611
4612 Where the unused arguments lie between used arguments that are
4613 specified with @samp{$} operand number specifications, normally
4614 warnings are still given, since the implementation could not know what
4615 type to pass to @code{va_arg} to skip the unused arguments. However,
4616 in the case of @code{scanf} formats, this option suppresses the
4617 warning if the unused arguments are all pointers, since the Single
4618 Unix Specification says that such unused arguments are allowed.
4619
4620 @item -Wformat-overflow
4621 @itemx -Wformat-overflow=@var{level}
4622 @opindex Wformat-overflow
4623 @opindex Wno-format-overflow
4624 Warn about calls to formatted input/output functions such as @code{sprintf}
4625 and @code{vsprintf} that might overflow the destination buffer. When the
4626 exact number of bytes written by a format directive cannot be determined
4627 at compile-time it is estimated based on heuristics that depend on the
4628 @var{level} argument and on optimization. While enabling optimization
4629 will in most cases improve the accuracy of the warning, it may also
4630 result in false positives.
4631
4632 @table @gcctabopt
4633 @item -Wformat-overflow
4634 @itemx -Wformat-overflow=1
4635 @opindex Wformat-overflow
4636 @opindex Wno-format-overflow
4637 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4638 employs a conservative approach that warns only about calls that most
4639 likely overflow the buffer. At this level, numeric arguments to format
4640 directives with unknown values are assumed to have the value of one, and
4641 strings of unknown length to be empty. Numeric arguments that are known
4642 to be bounded to a subrange of their type, or string arguments whose output
4643 is bounded either by their directive's precision or by a finite set of
4644 string literals, are assumed to take on the value within the range that
4645 results in the most bytes on output. For example, the call to @code{sprintf}
4646 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4647 the terminating NUL character (@code{'\0'}) appended by the function
4648 to the destination buffer will be written past its end. Increasing
4649 the size of the buffer by a single byte is sufficient to avoid the
4650 warning, though it may not be sufficient to avoid the overflow.
4651
4652 @smallexample
4653 void f (int a, int b)
4654 @{
4655 char buf [13];
4656 sprintf (buf, "a = %i, b = %i\n", a, b);
4657 @}
4658 @end smallexample
4659
4660 @item -Wformat-overflow=2
4661 Level @var{2} warns also about calls that might overflow the destination
4662 buffer given an argument of sufficient length or magnitude. At level
4663 @var{2}, unknown numeric arguments are assumed to have the minimum
4664 representable value for signed types with a precision greater than 1, and
4665 the maximum representable value otherwise. Unknown string arguments whose
4666 length cannot be assumed to be bounded either by the directive's precision,
4667 or by a finite set of string literals they may evaluate to, or the character
4668 array they may point to, are assumed to be 1 character long.
4669
4670 At level @var{2}, the call in the example above is again diagnosed, but
4671 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4672 @code{%i} directive will write some of its digits beyond the end of
4673 the destination buffer. To make the call safe regardless of the values
4674 of the two variables, the size of the destination buffer must be increased
4675 to at least 34 bytes. GCC includes the minimum size of the buffer in
4676 an informational note following the warning.
4677
4678 An alternative to increasing the size of the destination buffer is to
4679 constrain the range of formatted values. The maximum length of string
4680 arguments can be bounded by specifying the precision in the format
4681 directive. When numeric arguments of format directives can be assumed
4682 to be bounded by less than the precision of their type, choosing
4683 an appropriate length modifier to the format specifier will reduce
4684 the required buffer size. For example, if @var{a} and @var{b} in the
4685 example above can be assumed to be within the precision of
4686 the @code{short int} type then using either the @code{%hi} format
4687 directive or casting the argument to @code{short} reduces the maximum
4688 required size of the buffer to 24 bytes.
4689
4690 @smallexample
4691 void f (int a, int b)
4692 @{
4693 char buf [23];
4694 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4695 @}
4696 @end smallexample
4697 @end table
4698
4699 @item -Wno-format-zero-length
4700 @opindex Wno-format-zero-length
4701 @opindex Wformat-zero-length
4702 If @option{-Wformat} is specified, do not warn about zero-length formats.
4703 The C standard specifies that zero-length formats are allowed.
4704
4705
4706 @item -Wformat=2
4707 @opindex Wformat=2
4708 Enable @option{-Wformat} plus additional format checks. Currently
4709 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4710 -Wformat-y2k}.
4711
4712 @item -Wformat-nonliteral
4713 @opindex Wformat-nonliteral
4714 @opindex Wno-format-nonliteral
4715 If @option{-Wformat} is specified, also warn if the format string is not a
4716 string literal and so cannot be checked, unless the format function
4717 takes its format arguments as a @code{va_list}.
4718
4719 @item -Wformat-security
4720 @opindex Wformat-security
4721 @opindex Wno-format-security
4722 If @option{-Wformat} is specified, also warn about uses of format
4723 functions that represent possible security problems. At present, this
4724 warns about calls to @code{printf} and @code{scanf} functions where the
4725 format string is not a string literal and there are no format arguments,
4726 as in @code{printf (foo);}. This may be a security hole if the format
4727 string came from untrusted input and contains @samp{%n}. (This is
4728 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4729 in future warnings may be added to @option{-Wformat-security} that are not
4730 included in @option{-Wformat-nonliteral}.)
4731
4732 @item -Wformat-signedness
4733 @opindex Wformat-signedness
4734 @opindex Wno-format-signedness
4735 If @option{-Wformat} is specified, also warn if the format string
4736 requires an unsigned argument and the argument is signed and vice versa.
4737
4738 @item -Wformat-truncation
4739 @itemx -Wformat-truncation=@var{level}
4740 @opindex Wformat-truncation
4741 @opindex Wno-format-truncation
4742 Warn about calls to formatted input/output functions such as @code{snprintf}
4743 and @code{vsnprintf} that might result in output truncation. When the exact
4744 number of bytes written by a format directive cannot be determined at
4745 compile-time it is estimated based on heuristics that depend on
4746 the @var{level} argument and on optimization. While enabling optimization
4747 will in most cases improve the accuracy of the warning, it may also result
4748 in false positives. Except as noted otherwise, the option uses the same
4749 logic @option{-Wformat-overflow}.
4750
4751 @table @gcctabopt
4752 @item -Wformat-truncation
4753 @itemx -Wformat-truncation=1
4754 @opindex Wformat-truncation
4755 @opindex Wno-format-truncation
4756 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4757 employs a conservative approach that warns only about calls to bounded
4758 functions whose return value is unused and that will most likely result
4759 in output truncation.
4760
4761 @item -Wformat-truncation=2
4762 Level @var{2} warns also about calls to bounded functions whose return
4763 value is used and that might result in truncation given an argument of
4764 sufficient length or magnitude.
4765 @end table
4766
4767 @item -Wformat-y2k
4768 @opindex Wformat-y2k
4769 @opindex Wno-format-y2k
4770 If @option{-Wformat} is specified, also warn about @code{strftime}
4771 formats that may yield only a two-digit year.
4772 @end table
4773
4774 @item -Wnonnull
4775 @opindex Wnonnull
4776 @opindex Wno-nonnull
4777 Warn about passing a null pointer for arguments marked as
4778 requiring a non-null value by the @code{nonnull} function attribute.
4779
4780 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4781 can be disabled with the @option{-Wno-nonnull} option.
4782
4783 @item -Wnonnull-compare
4784 @opindex Wnonnull-compare
4785 @opindex Wno-nonnull-compare
4786 Warn when comparing an argument marked with the @code{nonnull}
4787 function attribute against null inside the function.
4788
4789 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4790 can be disabled with the @option{-Wno-nonnull-compare} option.
4791
4792 @item -Wnull-dereference
4793 @opindex Wnull-dereference
4794 @opindex Wno-null-dereference
4795 Warn if the compiler detects paths that trigger erroneous or
4796 undefined behavior due to dereferencing a null pointer. This option
4797 is only active when @option{-fdelete-null-pointer-checks} is active,
4798 which is enabled by optimizations in most targets. The precision of
4799 the warnings depends on the optimization options used.
4800
4801 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4802 @opindex Winit-self
4803 @opindex Wno-init-self
4804 Warn about uninitialized variables that are initialized with themselves.
4805 Note this option can only be used with the @option{-Wuninitialized} option.
4806
4807 For example, GCC warns about @code{i} being uninitialized in the
4808 following snippet only when @option{-Winit-self} has been specified:
4809 @smallexample
4810 @group
4811 int f()
4812 @{
4813 int i = i;
4814 return i;
4815 @}
4816 @end group
4817 @end smallexample
4818
4819 This warning is enabled by @option{-Wall} in C++.
4820
4821 @item -Wimplicit-int @r{(C and Objective-C only)}
4822 @opindex Wimplicit-int
4823 @opindex Wno-implicit-int
4824 Warn when a declaration does not specify a type.
4825 This warning is enabled by @option{-Wall}.
4826
4827 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4828 @opindex Wimplicit-function-declaration
4829 @opindex Wno-implicit-function-declaration
4830 Give a warning whenever a function is used before being declared. In
4831 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4832 enabled by default and it is made into an error by
4833 @option{-pedantic-errors}. This warning is also enabled by
4834 @option{-Wall}.
4835
4836 @item -Wimplicit @r{(C and Objective-C only)}
4837 @opindex Wimplicit
4838 @opindex Wno-implicit
4839 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4840 This warning is enabled by @option{-Wall}.
4841
4842 @item -Wimplicit-fallthrough
4843 @opindex Wimplicit-fallthrough
4844 @opindex Wno-implicit-fallthrough
4845 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4846 and @option{-Wno-implicit-fallthrough} is the same as
4847 @option{-Wimplicit-fallthrough=0}.
4848
4849 @item -Wimplicit-fallthrough=@var{n}
4850 @opindex Wimplicit-fallthrough=
4851 Warn when a switch case falls through. For example:
4852
4853 @smallexample
4854 @group
4855 switch (cond)
4856 @{
4857 case 1:
4858 a = 1;
4859 break;
4860 case 2:
4861 a = 2;
4862 case 3:
4863 a = 3;
4864 break;
4865 @}
4866 @end group
4867 @end smallexample
4868
4869 This warning does not warn when the last statement of a case cannot
4870 fall through, e.g. when there is a return statement or a call to function
4871 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4872 also takes into account control flow statements, such as ifs, and only
4873 warns when appropriate. E.g.@:
4874
4875 @smallexample
4876 @group
4877 switch (cond)
4878 @{
4879 case 1:
4880 if (i > 3) @{
4881 bar (5);
4882 break;
4883 @} else if (i < 1) @{
4884 bar (0);
4885 @} else
4886 return;
4887 default:
4888 @dots{}
4889 @}
4890 @end group
4891 @end smallexample
4892
4893 Since there are occasions where a switch case fall through is desirable,
4894 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4895 to be used along with a null statement to suppress this warning that
4896 would normally occur:
4897
4898 @smallexample
4899 @group
4900 switch (cond)
4901 @{
4902 case 1:
4903 bar (0);
4904 __attribute__ ((fallthrough));
4905 default:
4906 @dots{}
4907 @}
4908 @end group
4909 @end smallexample
4910
4911 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4912 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4913 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4914 Instead of these attributes, it is also possible to add a fallthrough comment
4915 to silence the warning. The whole body of the C or C++ style comment should
4916 match the given regular expressions listed below. The option argument @var{n}
4917 specifies what kind of comments are accepted:
4918
4919 @itemize @bullet
4920
4921 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4922
4923 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4924 expression, any comment is used as fallthrough comment.
4925
4926 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4927 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4928
4929 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4930 following regular expressions:
4931
4932 @itemize @bullet
4933
4934 @item @code{-fallthrough}
4935
4936 @item @code{@@fallthrough@@}
4937
4938 @item @code{lint -fallthrough[ \t]*}
4939
4940 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4941
4942 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4943
4944 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4945
4946 @end itemize
4947
4948 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4949 following regular expressions:
4950
4951 @itemize @bullet
4952
4953 @item @code{-fallthrough}
4954
4955 @item @code{@@fallthrough@@}
4956
4957 @item @code{lint -fallthrough[ \t]*}
4958
4959 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4960
4961 @end itemize
4962
4963 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4964 fallthrough comments, only attributes disable the warning.
4965
4966 @end itemize
4967
4968 The comment needs to be followed after optional whitespace and other comments
4969 by @code{case} or @code{default} keywords or by a user label that precedes some
4970 @code{case} or @code{default} label.
4971
4972 @smallexample
4973 @group
4974 switch (cond)
4975 @{
4976 case 1:
4977 bar (0);
4978 /* FALLTHRU */
4979 default:
4980 @dots{}
4981 @}
4982 @end group
4983 @end smallexample
4984
4985 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4986
4987 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4988 @opindex Wif-not-aligned
4989 @opindex Wno-if-not-aligned
4990 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4991 should be issued. This is enabled by default.
4992 Use @option{-Wno-if-not-aligned} to disable it.
4993
4994 @item -Wignored-qualifiers @r{(C and C++ only)}
4995 @opindex Wignored-qualifiers
4996 @opindex Wno-ignored-qualifiers
4997 Warn if the return type of a function has a type qualifier
4998 such as @code{const}. For ISO C such a type qualifier has no effect,
4999 since the value returned by a function is not an lvalue.
5000 For C++, the warning is only emitted for scalar types or @code{void}.
5001 ISO C prohibits qualified @code{void} return types on function
5002 definitions, so such return types always receive a warning
5003 even without this option.
5004
5005 This warning is also enabled by @option{-Wextra}.
5006
5007 @item -Wignored-attributes @r{(C and C++ only)}
5008 @opindex Wignored-attributes
5009 @opindex Wno-ignored-attributes
5010 Warn when an attribute is ignored. This is different from the
5011 @option{-Wattributes} option in that it warns whenever the compiler decides
5012 to drop an attribute, not that the attribute is either unknown, used in a
5013 wrong place, etc. This warning is enabled by default.
5014
5015 @item -Wmain
5016 @opindex Wmain
5017 @opindex Wno-main
5018 Warn if the type of @code{main} is suspicious. @code{main} should be
5019 a function with external linkage, returning int, taking either zero
5020 arguments, two, or three arguments of appropriate types. This warning
5021 is enabled by default in C++ and is enabled by either @option{-Wall}
5022 or @option{-Wpedantic}.
5023
5024 @item -Wmisleading-indentation @r{(C and C++ only)}
5025 @opindex Wmisleading-indentation
5026 @opindex Wno-misleading-indentation
5027 Warn when the indentation of the code does not reflect the block structure.
5028 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5029 @code{for} clauses with a guarded statement that does not use braces,
5030 followed by an unguarded statement with the same indentation.
5031
5032 In the following example, the call to ``bar'' is misleadingly indented as
5033 if it were guarded by the ``if'' conditional.
5034
5035 @smallexample
5036 if (some_condition ())
5037 foo ();
5038 bar (); /* Gotcha: this is not guarded by the "if". */
5039 @end smallexample
5040
5041 In the case of mixed tabs and spaces, the warning uses the
5042 @option{-ftabstop=} option to determine if the statements line up
5043 (defaulting to 8).
5044
5045 The warning is not issued for code involving multiline preprocessor logic
5046 such as the following example.
5047
5048 @smallexample
5049 if (flagA)
5050 foo (0);
5051 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5052 if (flagB)
5053 #endif
5054 foo (1);
5055 @end smallexample
5056
5057 The warning is not issued after a @code{#line} directive, since this
5058 typically indicates autogenerated code, and no assumptions can be made
5059 about the layout of the file that the directive references.
5060
5061 This warning is enabled by @option{-Wall} in C and C++.
5062
5063 @item -Wmissing-attributes
5064 @opindex Wmissing-attributes
5065 @opindex Wno-missing-attributes
5066 Warn when a declaration of a function is missing one or more attributes
5067 that a related function is declared with and whose absence may adversely
5068 affect the correctness or efficiency of generated code. For example,
5069 the warning is issued for declarations of aliases that use attributes
5070 to specify less restrictive requirements than those of their targets.
5071 This typically represents a potential optimization opportunity.
5072 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5073 issued when the alias is more restrictive than the target, which could
5074 lead to incorrect code generation.
5075 Attributes considered include @code{alloc_align}, @code{alloc_size},
5076 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5077 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5078 @code{returns_nonnull}, and @code{returns_twice}.
5079
5080 In C++, the warning is issued when an explicit specialization of a primary
5081 template declared with attribute @code{alloc_align}, @code{alloc_size},
5082 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5083 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5084 @code{error}, and @code{warning} suppress the warning.
5085 (@pxref{Function Attributes}).
5086
5087 You can use the @code{copy} attribute to apply the same
5088 set of attributes to a declaration as that on another declaration without
5089 explicitly enumerating the attributes. This attribute can be applied
5090 to declarations of functions (@pxref{Common Function Attributes}),
5091 variables (@pxref{Common Variable Attributes}), or types
5092 (@pxref{Common Type Attributes}).
5093
5094 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5095
5096 For example, since the declaration of the primary function template
5097 below makes use of both attribute @code{malloc} and @code{alloc_size}
5098 the declaration of the explicit specialization of the template is
5099 diagnosed because it is missing one of the attributes.
5100
5101 @smallexample
5102 template <class T>
5103 T* __attribute__ ((malloc, alloc_size (1)))
5104 allocate (size_t);
5105
5106 template <>
5107 void* __attribute__ ((malloc)) // missing alloc_size
5108 allocate<void> (size_t);
5109 @end smallexample
5110
5111 @item -Wmissing-braces
5112 @opindex Wmissing-braces
5113 @opindex Wno-missing-braces
5114 Warn if an aggregate or union initializer is not fully bracketed. In
5115 the following example, the initializer for @code{a} is not fully
5116 bracketed, but that for @code{b} is fully bracketed. This warning is
5117 enabled by @option{-Wall} in C.
5118
5119 @smallexample
5120 int a[2][2] = @{ 0, 1, 2, 3 @};
5121 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5122 @end smallexample
5123
5124 This warning is enabled by @option{-Wall}.
5125
5126 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5127 @opindex Wmissing-include-dirs
5128 @opindex Wno-missing-include-dirs
5129 Warn if a user-supplied include directory does not exist.
5130
5131 @item -Wmissing-profile
5132 @opindex Wmissing-profile
5133 @opindex Wno-missing-profile
5134 Warn if feedback profiles are missing when using the
5135 @option{-fprofile-use} option.
5136 This option diagnoses those cases where a new function or a new file is added
5137 to the user code between compiling with @option{-fprofile-generate} and with
5138 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5139 profile feedback data files do not contain any profile feedback information for
5140 the newly added function or file respectively. Also, in the case when profile
5141 count data (.gcda) files are removed, GCC cannot use any profile feedback
5142 information. In all these cases, warnings are issued to inform the user that a
5143 profile generation step is due. @option{-Wno-missing-profile} can be used to
5144 disable the warning. Ignoring the warning can result in poorly optimized code.
5145 Completely disabling the warning is not recommended and should be done only
5146 when non-existent profile data is justified.
5147
5148 @item -Wmultistatement-macros
5149 @opindex Wmultistatement-macros
5150 @opindex Wno-multistatement-macros
5151 Warn about unsafe multiple statement macros that appear to be guarded
5152 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5153 @code{while}, in which only the first statement is actually guarded after
5154 the macro is expanded.
5155
5156 For example:
5157
5158 @smallexample
5159 #define DOIT x++; y++
5160 if (c)
5161 DOIT;
5162 @end smallexample
5163
5164 will increment @code{y} unconditionally, not just when @code{c} holds.
5165 The can usually be fixed by wrapping the macro in a do-while loop:
5166 @smallexample
5167 #define DOIT do @{ x++; y++; @} while (0)
5168 if (c)
5169 DOIT;
5170 @end smallexample
5171
5172 This warning is enabled by @option{-Wall} in C and C++.
5173
5174 @item -Wparentheses
5175 @opindex Wparentheses
5176 @opindex Wno-parentheses
5177 Warn if parentheses are omitted in certain contexts, such
5178 as when there is an assignment in a context where a truth value
5179 is expected, or when operators are nested whose precedence people
5180 often get confused about.
5181
5182 Also warn if a comparison like @code{x<=y<=z} appears; this is
5183 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5184 interpretation from that of ordinary mathematical notation.
5185
5186 Also warn for dangerous uses of the GNU extension to
5187 @code{?:} with omitted middle operand. When the condition
5188 in the @code{?}: operator is a boolean expression, the omitted value is
5189 always 1. Often programmers expect it to be a value computed
5190 inside the conditional expression instead.
5191
5192 For C++ this also warns for some cases of unnecessary parentheses in
5193 declarations, which can indicate an attempt at a function call instead
5194 of a declaration:
5195 @smallexample
5196 @{
5197 // Declares a local variable called mymutex.
5198 std::unique_lock<std::mutex> (mymutex);
5199 // User meant std::unique_lock<std::mutex> lock (mymutex);
5200 @}
5201 @end smallexample
5202
5203 This warning is enabled by @option{-Wall}.
5204
5205 @item -Wsequence-point
5206 @opindex Wsequence-point
5207 @opindex Wno-sequence-point
5208 Warn about code that may have undefined semantics because of violations
5209 of sequence point rules in the C and C++ standards.
5210
5211 The C and C++ standards define the order in which expressions in a C/C++
5212 program are evaluated in terms of @dfn{sequence points}, which represent
5213 a partial ordering between the execution of parts of the program: those
5214 executed before the sequence point, and those executed after it. These
5215 occur after the evaluation of a full expression (one which is not part
5216 of a larger expression), after the evaluation of the first operand of a
5217 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5218 function is called (but after the evaluation of its arguments and the
5219 expression denoting the called function), and in certain other places.
5220 Other than as expressed by the sequence point rules, the order of
5221 evaluation of subexpressions of an expression is not specified. All
5222 these rules describe only a partial order rather than a total order,
5223 since, for example, if two functions are called within one expression
5224 with no sequence point between them, the order in which the functions
5225 are called is not specified. However, the standards committee have
5226 ruled that function calls do not overlap.
5227
5228 It is not specified when between sequence points modifications to the
5229 values of objects take effect. Programs whose behavior depends on this
5230 have undefined behavior; the C and C++ standards specify that ``Between
5231 the previous and next sequence point an object shall have its stored
5232 value modified at most once by the evaluation of an expression.
5233 Furthermore, the prior value shall be read only to determine the value
5234 to be stored.''. If a program breaks these rules, the results on any
5235 particular implementation are entirely unpredictable.
5236
5237 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5238 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5239 diagnosed by this option, and it may give an occasional false positive
5240 result, but in general it has been found fairly effective at detecting
5241 this sort of problem in programs.
5242
5243 The C++17 standard will define the order of evaluation of operands in
5244 more cases: in particular it requires that the right-hand side of an
5245 assignment be evaluated before the left-hand side, so the above
5246 examples are no longer undefined. But this warning will still warn
5247 about them, to help people avoid writing code that is undefined in C
5248 and earlier revisions of C++.
5249
5250 The standard is worded confusingly, therefore there is some debate
5251 over the precise meaning of the sequence point rules in subtle cases.
5252 Links to discussions of the problem, including proposed formal
5253 definitions, may be found on the GCC readings page, at
5254 @uref{http://gcc.gnu.org/@/readings.html}.
5255
5256 This warning is enabled by @option{-Wall} for C and C++.
5257
5258 @item -Wno-return-local-addr
5259 @opindex Wno-return-local-addr
5260 @opindex Wreturn-local-addr
5261 Do not warn about returning a pointer (or in C++, a reference) to a
5262 variable that goes out of scope after the function returns.
5263
5264 @item -Wreturn-type
5265 @opindex Wreturn-type
5266 @opindex Wno-return-type
5267 Warn whenever a function is defined with a return type that defaults
5268 to @code{int}. Also warn about any @code{return} statement with no
5269 return value in a function whose return type is not @code{void}
5270 (falling off the end of the function body is considered returning
5271 without a value).
5272
5273 For C only, warn about a @code{return} statement with an expression in a
5274 function whose return type is @code{void}, unless the expression type is
5275 also @code{void}. As a GNU extension, the latter case is accepted
5276 without a warning unless @option{-Wpedantic} is used. Attempting
5277 to use the return value of a non-@code{void} function other than @code{main}
5278 that flows off the end by reaching the closing curly brace that terminates
5279 the function is undefined.
5280
5281 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5282 than @code{main} results in undefined behavior even when the value of
5283 the function is not used.
5284
5285 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5286
5287 @item -Wshift-count-negative
5288 @opindex Wshift-count-negative
5289 @opindex Wno-shift-count-negative
5290 Warn if shift count is negative. This warning is enabled by default.
5291
5292 @item -Wshift-count-overflow
5293 @opindex Wshift-count-overflow
5294 @opindex Wno-shift-count-overflow
5295 Warn if shift count >= width of type. This warning is enabled by default.
5296
5297 @item -Wshift-negative-value
5298 @opindex Wshift-negative-value
5299 @opindex Wno-shift-negative-value
5300 Warn if left shifting a negative value. This warning is enabled by
5301 @option{-Wextra} in C99 and C++11 modes (and newer).
5302
5303 @item -Wshift-overflow
5304 @itemx -Wshift-overflow=@var{n}
5305 @opindex Wshift-overflow
5306 @opindex Wno-shift-overflow
5307 Warn about left shift overflows. This warning is enabled by
5308 default in C99 and C++11 modes (and newer).
5309
5310 @table @gcctabopt
5311 @item -Wshift-overflow=1
5312 This is the warning level of @option{-Wshift-overflow} and is enabled
5313 by default in C99 and C++11 modes (and newer). This warning level does
5314 not warn about left-shifting 1 into the sign bit. (However, in C, such
5315 an overflow is still rejected in contexts where an integer constant expression
5316 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5317 shifts always wrap.
5318
5319 @item -Wshift-overflow=2
5320 This warning level also warns about left-shifting 1 into the sign bit,
5321 unless C++14 mode (or newer) is active.
5322 @end table
5323
5324 @item -Wswitch
5325 @opindex Wswitch
5326 @opindex Wno-switch
5327 Warn whenever a @code{switch} statement has an index of enumerated type
5328 and lacks a @code{case} for one or more of the named codes of that
5329 enumeration. (The presence of a @code{default} label prevents this
5330 warning.) @code{case} labels outside the enumeration range also
5331 provoke warnings when this option is used (even if there is a
5332 @code{default} label).
5333 This warning is enabled by @option{-Wall}.
5334
5335 @item -Wswitch-default
5336 @opindex Wswitch-default
5337 @opindex Wno-switch-default
5338 Warn whenever a @code{switch} statement does not have a @code{default}
5339 case.
5340
5341 @item -Wswitch-enum
5342 @opindex Wswitch-enum
5343 @opindex Wno-switch-enum
5344 Warn whenever a @code{switch} statement has an index of enumerated type
5345 and lacks a @code{case} for one or more of the named codes of that
5346 enumeration. @code{case} labels outside the enumeration range also
5347 provoke warnings when this option is used. The only difference
5348 between @option{-Wswitch} and this option is that this option gives a
5349 warning about an omitted enumeration code even if there is a
5350 @code{default} label.
5351
5352 @item -Wswitch-bool
5353 @opindex Wswitch-bool
5354 @opindex Wno-switch-bool
5355 Warn whenever a @code{switch} statement has an index of boolean type
5356 and the case values are outside the range of a boolean type.
5357 It is possible to suppress this warning by casting the controlling
5358 expression to a type other than @code{bool}. For example:
5359 @smallexample
5360 @group
5361 switch ((int) (a == 4))
5362 @{
5363 @dots{}
5364 @}
5365 @end group
5366 @end smallexample
5367 This warning is enabled by default for C and C++ programs.
5368
5369 @item -Wswitch-unreachable
5370 @opindex Wswitch-unreachable
5371 @opindex Wno-switch-unreachable
5372 Warn whenever a @code{switch} statement contains statements between the
5373 controlling expression and the first case label, which will never be
5374 executed. For example:
5375 @smallexample
5376 @group
5377 switch (cond)
5378 @{
5379 i = 15;
5380 @dots{}
5381 case 5:
5382 @dots{}
5383 @}
5384 @end group
5385 @end smallexample
5386 @option{-Wswitch-unreachable} does not warn if the statement between the
5387 controlling expression and the first case label is just a declaration:
5388 @smallexample
5389 @group
5390 switch (cond)
5391 @{
5392 int i;
5393 @dots{}
5394 case 5:
5395 i = 5;
5396 @dots{}
5397 @}
5398 @end group
5399 @end smallexample
5400 This warning is enabled by default for C and C++ programs.
5401
5402 @item -Wsync-nand @r{(C and C++ only)}
5403 @opindex Wsync-nand
5404 @opindex Wno-sync-nand
5405 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5406 built-in functions are used. These functions changed semantics in GCC 4.4.
5407
5408 @item -Wunused-but-set-parameter
5409 @opindex Wunused-but-set-parameter
5410 @opindex Wno-unused-but-set-parameter
5411 Warn whenever a function parameter is assigned to, but otherwise unused
5412 (aside from its declaration).
5413
5414 To suppress this warning use the @code{unused} attribute
5415 (@pxref{Variable Attributes}).
5416
5417 This warning is also enabled by @option{-Wunused} together with
5418 @option{-Wextra}.
5419
5420 @item -Wunused-but-set-variable
5421 @opindex Wunused-but-set-variable
5422 @opindex Wno-unused-but-set-variable
5423 Warn whenever a local variable is assigned to, but otherwise unused
5424 (aside from its declaration).
5425 This warning is enabled by @option{-Wall}.
5426
5427 To suppress this warning use the @code{unused} attribute
5428 (@pxref{Variable Attributes}).
5429
5430 This warning is also enabled by @option{-Wunused}, which is enabled
5431 by @option{-Wall}.
5432
5433 @item -Wunused-function
5434 @opindex Wunused-function
5435 @opindex Wno-unused-function
5436 Warn whenever a static function is declared but not defined or a
5437 non-inline static function is unused.
5438 This warning is enabled by @option{-Wall}.
5439
5440 @item -Wunused-label
5441 @opindex Wunused-label
5442 @opindex Wno-unused-label
5443 Warn whenever a label is declared but not used.
5444 This warning is enabled by @option{-Wall}.
5445
5446 To suppress this warning use the @code{unused} attribute
5447 (@pxref{Variable Attributes}).
5448
5449 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5450 @opindex Wunused-local-typedefs
5451 @opindex Wno-unused-local-typedefs
5452 Warn when a typedef locally defined in a function is not used.
5453 This warning is enabled by @option{-Wall}.
5454
5455 @item -Wunused-parameter
5456 @opindex Wunused-parameter
5457 @opindex Wno-unused-parameter
5458 Warn whenever a function parameter is unused aside from its declaration.
5459
5460 To suppress this warning use the @code{unused} attribute
5461 (@pxref{Variable Attributes}).
5462
5463 @item -Wno-unused-result
5464 @opindex Wunused-result
5465 @opindex Wno-unused-result
5466 Do not warn if a caller of a function marked with attribute
5467 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5468 its return value. The default is @option{-Wunused-result}.
5469
5470 @item -Wunused-variable
5471 @opindex Wunused-variable
5472 @opindex Wno-unused-variable
5473 Warn whenever a local or static variable is unused aside from its
5474 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5475 but not for C++. This warning is enabled by @option{-Wall}.
5476
5477 To suppress this warning use the @code{unused} attribute
5478 (@pxref{Variable Attributes}).
5479
5480 @item -Wunused-const-variable
5481 @itemx -Wunused-const-variable=@var{n}
5482 @opindex Wunused-const-variable
5483 @opindex Wno-unused-const-variable
5484 Warn whenever a constant static variable is unused aside from its declaration.
5485 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5486 for C, but not for C++. In C this declares variable storage, but in C++ this
5487 is not an error since const variables take the place of @code{#define}s.
5488
5489 To suppress this warning use the @code{unused} attribute
5490 (@pxref{Variable Attributes}).
5491
5492 @table @gcctabopt
5493 @item -Wunused-const-variable=1
5494 This is the warning level that is enabled by @option{-Wunused-variable} for
5495 C. It warns only about unused static const variables defined in the main
5496 compilation unit, but not about static const variables declared in any
5497 header included.
5498
5499 @item -Wunused-const-variable=2
5500 This warning level also warns for unused constant static variables in
5501 headers (excluding system headers). This is the warning level of
5502 @option{-Wunused-const-variable} and must be explicitly requested since
5503 in C++ this isn't an error and in C it might be harder to clean up all
5504 headers included.
5505 @end table
5506
5507 @item -Wunused-value
5508 @opindex Wunused-value
5509 @opindex Wno-unused-value
5510 Warn whenever a statement computes a result that is explicitly not
5511 used. To suppress this warning cast the unused expression to
5512 @code{void}. This includes an expression-statement or the left-hand
5513 side of a comma expression that contains no side effects. For example,
5514 an expression such as @code{x[i,j]} causes a warning, while
5515 @code{x[(void)i,j]} does not.
5516
5517 This warning is enabled by @option{-Wall}.
5518
5519 @item -Wunused
5520 @opindex Wunused
5521 @opindex Wno-unused
5522 All the above @option{-Wunused} options combined.
5523
5524 In order to get a warning about an unused function parameter, you must
5525 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5526 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5527
5528 @item -Wuninitialized
5529 @opindex Wuninitialized
5530 @opindex Wno-uninitialized
5531 Warn if an automatic variable is used without first being initialized
5532 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5533 warn if a non-static reference or non-static @code{const} member
5534 appears in a class without constructors.
5535
5536 If you want to warn about code that uses the uninitialized value of the
5537 variable in its own initializer, use the @option{-Winit-self} option.
5538
5539 These warnings occur for individual uninitialized or clobbered
5540 elements of structure, union or array variables as well as for
5541 variables that are uninitialized or clobbered as a whole. They do
5542 not occur for variables or elements declared @code{volatile}. Because
5543 these warnings depend on optimization, the exact variables or elements
5544 for which there are warnings depends on the precise optimization
5545 options and version of GCC used.
5546
5547 Note that there may be no warning about a variable that is used only
5548 to compute a value that itself is never used, because such
5549 computations may be deleted by data flow analysis before the warnings
5550 are printed.
5551
5552 @item -Winvalid-memory-model
5553 @opindex Winvalid-memory-model
5554 @opindex Wno-invalid-memory-model
5555 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5556 and the C11 atomic generic functions with a memory consistency argument
5557 that is either invalid for the operation or outside the range of values
5558 of the @code{memory_order} enumeration. For example, since the
5559 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5560 defined for the relaxed, release, and sequentially consistent memory
5561 orders the following code is diagnosed:
5562
5563 @smallexample
5564 void store (int *i)
5565 @{
5566 __atomic_store_n (i, 0, memory_order_consume);
5567 @}
5568 @end smallexample
5569
5570 @option{-Winvalid-memory-model} is enabled by default.
5571
5572 @item -Wmaybe-uninitialized
5573 @opindex Wmaybe-uninitialized
5574 @opindex Wno-maybe-uninitialized
5575 For an automatic (i.e.@: local) variable, if there exists a path from the
5576 function entry to a use of the variable that is initialized, but there exist
5577 some other paths for which the variable is not initialized, the compiler
5578 emits a warning if it cannot prove the uninitialized paths are not
5579 executed at run time.
5580
5581 These warnings are only possible in optimizing compilation, because otherwise
5582 GCC does not keep track of the state of variables.
5583
5584 These warnings are made optional because GCC may not be able to determine when
5585 the code is correct in spite of appearing to have an error. Here is one
5586 example of how this can happen:
5587
5588 @smallexample
5589 @group
5590 @{
5591 int x;
5592 switch (y)
5593 @{
5594 case 1: x = 1;
5595 break;
5596 case 2: x = 4;
5597 break;
5598 case 3: x = 5;
5599 @}
5600 foo (x);
5601 @}
5602 @end group
5603 @end smallexample
5604
5605 @noindent
5606 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5607 always initialized, but GCC doesn't know this. To suppress the
5608 warning, you need to provide a default case with assert(0) or
5609 similar code.
5610
5611 @cindex @code{longjmp} warnings
5612 This option also warns when a non-volatile automatic variable might be
5613 changed by a call to @code{longjmp}.
5614 The compiler sees only the calls to @code{setjmp}. It cannot know
5615 where @code{longjmp} will be called; in fact, a signal handler could
5616 call it at any point in the code. As a result, you may get a warning
5617 even when there is in fact no problem because @code{longjmp} cannot
5618 in fact be called at the place that would cause a problem.
5619
5620 Some spurious warnings can be avoided if you declare all the functions
5621 you use that never return as @code{noreturn}. @xref{Function
5622 Attributes}.
5623
5624 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5625
5626 @item -Wunknown-pragmas
5627 @opindex Wunknown-pragmas
5628 @opindex Wno-unknown-pragmas
5629 @cindex warning for unknown pragmas
5630 @cindex unknown pragmas, warning
5631 @cindex pragmas, warning of unknown
5632 Warn when a @code{#pragma} directive is encountered that is not understood by
5633 GCC@. If this command-line option is used, warnings are even issued
5634 for unknown pragmas in system header files. This is not the case if
5635 the warnings are only enabled by the @option{-Wall} command-line option.
5636
5637 @item -Wno-pragmas
5638 @opindex Wno-pragmas
5639 @opindex Wpragmas
5640 Do not warn about misuses of pragmas, such as incorrect parameters,
5641 invalid syntax, or conflicts between pragmas. See also
5642 @option{-Wunknown-pragmas}.
5643
5644 @item -Wno-prio-ctor-dtor
5645 @opindex Wno-prio-ctor-dtor
5646 @opindex Wprio-ctor-dtor
5647 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5648 The use of constructor and destructor attributes allow you to assign a
5649 priority to the constructor/destructor to control its order of execution
5650 before @code{main} is called or after it returns. The priority values must be
5651 greater than 100 as the compiler reserves priority values between 0--100 for
5652 the implementation.
5653
5654 @item -Wstrict-aliasing
5655 @opindex Wstrict-aliasing
5656 @opindex Wno-strict-aliasing
5657 This option is only active when @option{-fstrict-aliasing} is active.
5658 It warns about code that might break the strict aliasing rules that the
5659 compiler is using for optimization. The warning does not catch all
5660 cases, but does attempt to catch the more common pitfalls. It is
5661 included in @option{-Wall}.
5662 It is equivalent to @option{-Wstrict-aliasing=3}
5663
5664 @item -Wstrict-aliasing=n
5665 @opindex Wstrict-aliasing=n
5666 This option is only active when @option{-fstrict-aliasing} is active.
5667 It warns about code that might break the strict aliasing rules that the
5668 compiler is using for optimization.
5669 Higher levels correspond to higher accuracy (fewer false positives).
5670 Higher levels also correspond to more effort, similar to the way @option{-O}
5671 works.
5672 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5673
5674 Level 1: Most aggressive, quick, least accurate.
5675 Possibly useful when higher levels
5676 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5677 false negatives. However, it has many false positives.
5678 Warns for all pointer conversions between possibly incompatible types,
5679 even if never dereferenced. Runs in the front end only.
5680
5681 Level 2: Aggressive, quick, not too precise.
5682 May still have many false positives (not as many as level 1 though),
5683 and few false negatives (but possibly more than level 1).
5684 Unlike level 1, it only warns when an address is taken. Warns about
5685 incomplete types. Runs in the front end only.
5686
5687 Level 3 (default for @option{-Wstrict-aliasing}):
5688 Should have very few false positives and few false
5689 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5690 Takes care of the common pun+dereference pattern in the front end:
5691 @code{*(int*)&some_float}.
5692 If optimization is enabled, it also runs in the back end, where it deals
5693 with multiple statement cases using flow-sensitive points-to information.
5694 Only warns when the converted pointer is dereferenced.
5695 Does not warn about incomplete types.
5696
5697 @item -Wstrict-overflow
5698 @itemx -Wstrict-overflow=@var{n}
5699 @opindex Wstrict-overflow
5700 @opindex Wno-strict-overflow
5701 This option is only active when signed overflow is undefined.
5702 It warns about cases where the compiler optimizes based on the
5703 assumption that signed overflow does not occur. Note that it does not
5704 warn about all cases where the code might overflow: it only warns
5705 about cases where the compiler implements some optimization. Thus
5706 this warning depends on the optimization level.
5707
5708 An optimization that assumes that signed overflow does not occur is
5709 perfectly safe if the values of the variables involved are such that
5710 overflow never does, in fact, occur. Therefore this warning can
5711 easily give a false positive: a warning about code that is not
5712 actually a problem. To help focus on important issues, several
5713 warning levels are defined. No warnings are issued for the use of
5714 undefined signed overflow when estimating how many iterations a loop
5715 requires, in particular when determining whether a loop will be
5716 executed at all.
5717
5718 @table @gcctabopt
5719 @item -Wstrict-overflow=1
5720 Warn about cases that are both questionable and easy to avoid. For
5721 example the compiler simplifies
5722 @code{x + 1 > x} to @code{1}. This level of
5723 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5724 are not, and must be explicitly requested.
5725
5726 @item -Wstrict-overflow=2
5727 Also warn about other cases where a comparison is simplified to a
5728 constant. For example: @code{abs (x) >= 0}. This can only be
5729 simplified when signed integer overflow is undefined, because
5730 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5731 zero. @option{-Wstrict-overflow} (with no level) is the same as
5732 @option{-Wstrict-overflow=2}.
5733
5734 @item -Wstrict-overflow=3
5735 Also warn about other cases where a comparison is simplified. For
5736 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5737
5738 @item -Wstrict-overflow=4
5739 Also warn about other simplifications not covered by the above cases.
5740 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5741
5742 @item -Wstrict-overflow=5
5743 Also warn about cases where the compiler reduces the magnitude of a
5744 constant involved in a comparison. For example: @code{x + 2 > y} is
5745 simplified to @code{x + 1 >= y}. This is reported only at the
5746 highest warning level because this simplification applies to many
5747 comparisons, so this warning level gives a very large number of
5748 false positives.
5749 @end table
5750
5751 @item -Wstringop-overflow
5752 @itemx -Wstringop-overflow=@var{type}
5753 @opindex Wstringop-overflow
5754 @opindex Wno-stringop-overflow
5755 Warn for calls to string manipulation functions such as @code{memcpy} and
5756 @code{strcpy} that are determined to overflow the destination buffer. The
5757 optional argument is one greater than the type of Object Size Checking to
5758 perform to determine the size of the destination. @xref{Object Size Checking}.
5759 The argument is meaningful only for functions that operate on character arrays
5760 but not for raw memory functions like @code{memcpy} which always make use
5761 of Object Size type-0. The option also warns for calls that specify a size
5762 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5763 The option produces the best results with optimization enabled but can detect
5764 a small subset of simple buffer overflows even without optimization in
5765 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5766 correspond to the standard functions. In any case, the option warns about
5767 just a subset of buffer overflows detected by the corresponding overflow
5768 checking built-ins. For example, the option will issue a warning for
5769 the @code{strcpy} call below because it copies at least 5 characters
5770 (the string @code{"blue"} including the terminating NUL) into the buffer
5771 of size 4.
5772
5773 @smallexample
5774 enum Color @{ blue, purple, yellow @};
5775 const char* f (enum Color clr)
5776 @{
5777 static char buf [4];
5778 const char *str;
5779 switch (clr)
5780 @{
5781 case blue: str = "blue"; break;
5782 case purple: str = "purple"; break;
5783 case yellow: str = "yellow"; break;
5784 @}
5785
5786 return strcpy (buf, str); // warning here
5787 @}
5788 @end smallexample
5789
5790 Option @option{-Wstringop-overflow=2} is enabled by default.
5791
5792 @table @gcctabopt
5793 @item -Wstringop-overflow
5794 @itemx -Wstringop-overflow=1
5795 @opindex Wstringop-overflow
5796 @opindex Wno-stringop-overflow
5797 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5798 to determine the sizes of destination objects. This is the default setting
5799 of the option. At this setting the option will not warn for writes past
5800 the end of subobjects of larger objects accessed by pointers unless the
5801 size of the largest surrounding object is known. When the destination may
5802 be one of several objects it is assumed to be the largest one of them. On
5803 Linux systems, when optimization is enabled at this setting the option warns
5804 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5805 a non-zero value.
5806
5807 @item -Wstringop-overflow=2
5808 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5809 to determine the sizes of destination objects. At this setting the option
5810 will warn about overflows when writing to members of the largest complete
5811 objects whose exact size is known. It will, however, not warn for excessive
5812 writes to the same members of unknown objects referenced by pointers since
5813 they may point to arrays containing unknown numbers of elements.
5814
5815 @item -Wstringop-overflow=3
5816 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5817 to determine the sizes of destination objects. At this setting the option
5818 warns about overflowing the smallest object or data member. This is the
5819 most restrictive setting of the option that may result in warnings for safe
5820 code.
5821
5822 @item -Wstringop-overflow=4
5823 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5824 to determine the sizes of destination objects. At this setting the option
5825 will warn about overflowing any data members, and when the destination is
5826 one of several objects it uses the size of the largest of them to decide
5827 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5828 setting of the option may result in warnings for benign code.
5829 @end table
5830
5831 @item -Wstringop-truncation
5832 @opindex Wstringop-truncation
5833 @opindex Wno-stringop-truncation
5834 Warn for calls to bounded string manipulation functions such as @code{strncat},
5835 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5836 or leave the destination unchanged.
5837
5838 In the following example, the call to @code{strncat} specifies a bound that
5839 is less than the length of the source string. As a result, the copy of
5840 the source will be truncated and so the call is diagnosed. To avoid the
5841 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5842
5843 @smallexample
5844 void append (char *buf, size_t bufsize)
5845 @{
5846 strncat (buf, ".txt", 3);
5847 @}
5848 @end smallexample
5849
5850 As another example, the following call to @code{strncpy} results in copying
5851 to @code{d} just the characters preceding the terminating NUL, without
5852 appending the NUL to the end. Assuming the result of @code{strncpy} is
5853 necessarily a NUL-terminated string is a common mistake, and so the call
5854 is diagnosed. To avoid the warning when the result is not expected to be
5855 NUL-terminated, call @code{memcpy} instead.
5856
5857 @smallexample
5858 void copy (char *d, const char *s)
5859 @{
5860 strncpy (d, s, strlen (s));
5861 @}
5862 @end smallexample
5863
5864 In the following example, the call to @code{strncpy} specifies the size
5865 of the destination buffer as the bound. If the length of the source
5866 string is equal to or greater than this size the result of the copy will
5867 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5868 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5869 element of the buffer to @code{NUL}.
5870
5871 @smallexample
5872 void copy (const char *s)
5873 @{
5874 char buf[80];
5875 strncpy (buf, s, sizeof buf);
5876 @dots{}
5877 @}
5878 @end smallexample
5879
5880 In situations where a character array is intended to store a sequence
5881 of bytes with no terminating @code{NUL} such an array may be annotated
5882 with attribute @code{nonstring} to avoid this warning. Such arrays,
5883 however, are not suitable arguments to functions that expect
5884 @code{NUL}-terminated strings. To help detect accidental misuses of
5885 such arrays GCC issues warnings unless it can prove that the use is
5886 safe. @xref{Common Variable Attributes}.
5887
5888 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5889 @opindex Wsuggest-attribute=
5890 @opindex Wno-suggest-attribute=
5891 Warn for cases where adding an attribute may be beneficial. The
5892 attributes currently supported are listed below.
5893
5894 @table @gcctabopt
5895 @item -Wsuggest-attribute=pure
5896 @itemx -Wsuggest-attribute=const
5897 @itemx -Wsuggest-attribute=noreturn
5898 @itemx -Wmissing-noreturn
5899 @itemx -Wsuggest-attribute=malloc
5900 @opindex Wsuggest-attribute=pure
5901 @opindex Wno-suggest-attribute=pure
5902 @opindex Wsuggest-attribute=const
5903 @opindex Wno-suggest-attribute=const
5904 @opindex Wsuggest-attribute=noreturn
5905 @opindex Wno-suggest-attribute=noreturn
5906 @opindex Wmissing-noreturn
5907 @opindex Wno-missing-noreturn
5908 @opindex Wsuggest-attribute=malloc
5909 @opindex Wno-suggest-attribute=malloc
5910
5911 Warn about functions that might be candidates for attributes
5912 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5913 only warns for functions visible in other compilation units or (in the case of
5914 @code{pure} and @code{const}) if it cannot prove that the function returns
5915 normally. A function returns normally if it doesn't contain an infinite loop or
5916 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5917 requires option @option{-fipa-pure-const}, which is enabled by default at
5918 @option{-O} and higher. Higher optimization levels improve the accuracy
5919 of the analysis.
5920
5921 @item -Wsuggest-attribute=format
5922 @itemx -Wmissing-format-attribute
5923 @opindex Wsuggest-attribute=format
5924 @opindex Wmissing-format-attribute
5925 @opindex Wno-suggest-attribute=format
5926 @opindex Wno-missing-format-attribute
5927 @opindex Wformat
5928 @opindex Wno-format
5929
5930 Warn about function pointers that might be candidates for @code{format}
5931 attributes. Note these are only possible candidates, not absolute ones.
5932 GCC guesses that function pointers with @code{format} attributes that
5933 are used in assignment, initialization, parameter passing or return
5934 statements should have a corresponding @code{format} attribute in the
5935 resulting type. I.e.@: the left-hand side of the assignment or
5936 initialization, the type of the parameter variable, or the return type
5937 of the containing function respectively should also have a @code{format}
5938 attribute to avoid the warning.
5939
5940 GCC also warns about function definitions that might be
5941 candidates for @code{format} attributes. Again, these are only
5942 possible candidates. GCC guesses that @code{format} attributes
5943 might be appropriate for any function that calls a function like
5944 @code{vprintf} or @code{vscanf}, but this might not always be the
5945 case, and some functions for which @code{format} attributes are
5946 appropriate may not be detected.
5947
5948 @item -Wsuggest-attribute=cold
5949 @opindex Wsuggest-attribute=cold
5950 @opindex Wno-suggest-attribute=cold
5951
5952 Warn about functions that might be candidates for @code{cold} attribute. This
5953 is based on static detection and generally will only warn about functions which
5954 always leads to a call to another @code{cold} function such as wrappers of
5955 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5956 @end table
5957
5958 @item -Wsuggest-final-types
5959 @opindex Wno-suggest-final-types
5960 @opindex Wsuggest-final-types
5961 Warn about types with virtual methods where code quality would be improved
5962 if the type were declared with the C++11 @code{final} specifier,
5963 or, if possible,
5964 declared in an anonymous namespace. This allows GCC to more aggressively
5965 devirtualize the polymorphic calls. This warning is more effective with link
5966 time optimization, where the information about the class hierarchy graph is
5967 more complete.
5968
5969 @item -Wsuggest-final-methods
5970 @opindex Wno-suggest-final-methods
5971 @opindex Wsuggest-final-methods
5972 Warn about virtual methods where code quality would be improved if the method
5973 were declared with the C++11 @code{final} specifier,
5974 or, if possible, its type were
5975 declared in an anonymous namespace or with the @code{final} specifier.
5976 This warning is
5977 more effective with link-time optimization, where the information about the
5978 class hierarchy graph is more complete. It is recommended to first consider
5979 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5980 annotations.
5981
5982 @item -Wsuggest-override
5983 Warn about overriding virtual functions that are not marked with the override
5984 keyword.
5985
5986 @item -Walloc-zero
5987 @opindex Wno-alloc-zero
5988 @opindex Walloc-zero
5989 Warn about calls to allocation functions decorated with attribute
5990 @code{alloc_size} that specify zero bytes, including those to the built-in
5991 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5992 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5993 when called with a zero size differs among implementations (and in the case
5994 of @code{realloc} has been deprecated) relying on it may result in subtle
5995 portability bugs and should be avoided.
5996
5997 @item -Walloc-size-larger-than=@var{byte-size}
5998 @opindex Walloc-size-larger-than=
5999 @opindex Wno-alloc-size-larger-than
6000 Warn about calls to functions decorated with attribute @code{alloc_size}
6001 that attempt to allocate objects larger than the specified number of bytes,
6002 or where the result of the size computation in an integer type with infinite
6003 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6004 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6005 Warnings controlled by the option can be disabled either by specifying
6006 @var{byte-size} of @samp{SIZE_MAX} or more or by
6007 @option{-Wno-alloc-size-larger-than}.
6008 @xref{Function Attributes}.
6009
6010 @item -Wno-alloc-size-larger-than
6011 @opindex Wno-alloc-size-larger-than
6012 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6013 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6014 larger.
6015
6016 @item -Walloca
6017 @opindex Wno-alloca
6018 @opindex Walloca
6019 This option warns on all uses of @code{alloca} in the source.
6020
6021 @item -Walloca-larger-than=@var{byte-size}
6022 @opindex Walloca-larger-than=
6023 @opindex Wno-alloca-larger-than
6024 This option warns on calls to @code{alloca} with an integer argument whose
6025 value is either zero, or that is not bounded by a controlling predicate
6026 that limits its value to at most @var{byte-size}. It also warns for calls
6027 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6028 types are considered unbounded even if they appear to be constrained to
6029 the expected range.
6030
6031 For example, a bounded case of @code{alloca} could be:
6032
6033 @smallexample
6034 void func (size_t n)
6035 @{
6036 void *p;
6037 if (n <= 1000)
6038 p = alloca (n);
6039 else
6040 p = malloc (n);
6041 f (p);
6042 @}
6043 @end smallexample
6044
6045 In the above example, passing @code{-Walloca-larger-than=1000} would not
6046 issue a warning because the call to @code{alloca} is known to be at most
6047 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6048 the compiler would emit a warning.
6049
6050 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6051 controlling predicate constraining its integer argument. For example:
6052
6053 @smallexample
6054 void func ()
6055 @{
6056 void *p = alloca (n);
6057 f (p);
6058 @}
6059 @end smallexample
6060
6061 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6062 a warning, but this time because of the lack of bounds checking.
6063
6064 Note, that even seemingly correct code involving signed integers could
6065 cause a warning:
6066
6067 @smallexample
6068 void func (signed int n)
6069 @{
6070 if (n < 500)
6071 @{
6072 p = alloca (n);
6073 f (p);
6074 @}
6075 @}
6076 @end smallexample
6077
6078 In the above example, @var{n} could be negative, causing a larger than
6079 expected argument to be implicitly cast into the @code{alloca} call.
6080
6081 This option also warns when @code{alloca} is used in a loop.
6082
6083 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6084 but is usually only effective when @option{-ftree-vrp} is active (default
6085 for @option{-O2} and above).
6086
6087 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6088
6089 @item -Wno-alloca-larger-than
6090 @opindex Wno-alloca-larger-than
6091 Disable @option{-Walloca-larger-than=} warnings. The option is
6092 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6093
6094 @item -Warray-bounds
6095 @itemx -Warray-bounds=@var{n}
6096 @opindex Wno-array-bounds
6097 @opindex Warray-bounds
6098 This option is only active when @option{-ftree-vrp} is active
6099 (default for @option{-O2} and above). It warns about subscripts to arrays
6100 that are always out of bounds. This warning is enabled by @option{-Wall}.
6101
6102 @table @gcctabopt
6103 @item -Warray-bounds=1
6104 This is the warning level of @option{-Warray-bounds} and is enabled
6105 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6106
6107 @item -Warray-bounds=2
6108 This warning level also warns about out of bounds access for
6109 arrays at the end of a struct and for arrays accessed through
6110 pointers. This warning level may give a larger number of
6111 false positives and is deactivated by default.
6112 @end table
6113
6114 @item -Wattribute-alias=@var{n}
6115 @itemx -Wno-attribute-alias
6116 @opindex -Wattribute-alias
6117 @opindex -Wno-attribute-alias
6118 Warn about declarations using the @code{alias} and similar attributes whose
6119 target is incompatible with the type of the alias.
6120 @xref{Function Attributes,,Declaring Attributes of Functions}.
6121
6122 @table @gcctabopt
6123 @item -Wattribute-alias=1
6124 The default warning level of the @option{-Wattribute-alias} option diagnoses
6125 incompatibilities between the type of the alias declaration and that of its
6126 target. Such incompatibilities are typically indicative of bugs.
6127
6128 @item -Wattribute-alias=2
6129
6130 At this level @option{-Wattribute-alias} also diagnoses cases where
6131 the attributes of the alias declaration are more restrictive than the
6132 attributes applied to its target. These mismatches can potentially
6133 result in incorrect code generation. In other cases they may be
6134 benign and could be resolved simply by adding the missing attribute to
6135 the target. For comparison, see the @option{-Wmissing-attributes}
6136 option, which controls diagnostics when the alias declaration is less
6137 restrictive than the target, rather than more restrictive.
6138
6139 Attributes considered include @code{alloc_align}, @code{alloc_size},
6140 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6141 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6142 @code{returns_nonnull}, and @code{returns_twice}.
6143 @end table
6144
6145 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6146 This is the default. You can disable these warnings with either
6147 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6148
6149 @item -Wbool-compare
6150 @opindex Wno-bool-compare
6151 @opindex Wbool-compare
6152 Warn about boolean expression compared with an integer value different from
6153 @code{true}/@code{false}. For instance, the following comparison is
6154 always false:
6155 @smallexample
6156 int n = 5;
6157 @dots{}
6158 if ((n > 1) == 2) @{ @dots{} @}
6159 @end smallexample
6160 This warning is enabled by @option{-Wall}.
6161
6162 @item -Wbool-operation
6163 @opindex Wno-bool-operation
6164 @opindex Wbool-operation
6165 Warn about suspicious operations on expressions of a boolean type. For
6166 instance, bitwise negation of a boolean is very likely a bug in the program.
6167 For C, this warning also warns about incrementing or decrementing a boolean,
6168 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6169 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6170
6171 This warning is enabled by @option{-Wall}.
6172
6173 @item -Wduplicated-branches
6174 @opindex Wno-duplicated-branches
6175 @opindex Wduplicated-branches
6176 Warn when an if-else has identical branches. This warning detects cases like
6177 @smallexample
6178 if (p != NULL)
6179 return 0;
6180 else
6181 return 0;
6182 @end smallexample
6183 It doesn't warn when both branches contain just a null statement. This warning
6184 also warn for conditional operators:
6185 @smallexample
6186 int i = x ? *p : *p;
6187 @end smallexample
6188
6189 @item -Wduplicated-cond
6190 @opindex Wno-duplicated-cond
6191 @opindex Wduplicated-cond
6192 Warn about duplicated conditions in an if-else-if chain. For instance,
6193 warn for the following code:
6194 @smallexample
6195 if (p->q != NULL) @{ @dots{} @}
6196 else if (p->q != NULL) @{ @dots{} @}
6197 @end smallexample
6198
6199 @item -Wframe-address
6200 @opindex Wno-frame-address
6201 @opindex Wframe-address
6202 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6203 is called with an argument greater than 0. Such calls may return indeterminate
6204 values or crash the program. The warning is included in @option{-Wall}.
6205
6206 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6207 @opindex Wno-discarded-qualifiers
6208 @opindex Wdiscarded-qualifiers
6209 Do not warn if type qualifiers on pointers are being discarded.
6210 Typically, the compiler warns if a @code{const char *} variable is
6211 passed to a function that takes a @code{char *} parameter. This option
6212 can be used to suppress such a warning.
6213
6214 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6215 @opindex Wno-discarded-array-qualifiers
6216 @opindex Wdiscarded-array-qualifiers
6217 Do not warn if type qualifiers on arrays which are pointer targets
6218 are being discarded. Typically, the compiler warns if a
6219 @code{const int (*)[]} variable is passed to a function that
6220 takes a @code{int (*)[]} parameter. This option can be used to
6221 suppress such a warning.
6222
6223 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6224 @opindex Wno-incompatible-pointer-types
6225 @opindex Wincompatible-pointer-types
6226 Do not warn when there is a conversion between pointers that have incompatible
6227 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6228 which warns for pointer argument passing or assignment with different
6229 signedness.
6230
6231 @item -Wno-int-conversion @r{(C and Objective-C only)}
6232 @opindex Wno-int-conversion
6233 @opindex Wint-conversion
6234 Do not warn about incompatible integer to pointer and pointer to integer
6235 conversions. This warning is about implicit conversions; for explicit
6236 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6237 @option{-Wno-pointer-to-int-cast} may be used.
6238
6239 @item -Wno-div-by-zero
6240 @opindex Wno-div-by-zero
6241 @opindex Wdiv-by-zero
6242 Do not warn about compile-time integer division by zero. Floating-point
6243 division by zero is not warned about, as it can be a legitimate way of
6244 obtaining infinities and NaNs.
6245
6246 @item -Wsystem-headers
6247 @opindex Wsystem-headers
6248 @opindex Wno-system-headers
6249 @cindex warnings from system headers
6250 @cindex system headers, warnings from
6251 Print warning messages for constructs found in system header files.
6252 Warnings from system headers are normally suppressed, on the assumption
6253 that they usually do not indicate real problems and would only make the
6254 compiler output harder to read. Using this command-line option tells
6255 GCC to emit warnings from system headers as if they occurred in user
6256 code. However, note that using @option{-Wall} in conjunction with this
6257 option does @emph{not} warn about unknown pragmas in system
6258 headers---for that, @option{-Wunknown-pragmas} must also be used.
6259
6260 @item -Wtautological-compare
6261 @opindex Wtautological-compare
6262 @opindex Wno-tautological-compare
6263 Warn if a self-comparison always evaluates to true or false. This
6264 warning detects various mistakes such as:
6265 @smallexample
6266 int i = 1;
6267 @dots{}
6268 if (i > i) @{ @dots{} @}
6269 @end smallexample
6270
6271 This warning also warns about bitwise comparisons that always evaluate
6272 to true or false, for instance:
6273 @smallexample
6274 if ((a & 16) == 10) @{ @dots{} @}
6275 @end smallexample
6276 will always be false.
6277
6278 This warning is enabled by @option{-Wall}.
6279
6280 @item -Wtrampolines
6281 @opindex Wtrampolines
6282 @opindex Wno-trampolines
6283 Warn about trampolines generated for pointers to nested functions.
6284 A trampoline is a small piece of data or code that is created at run
6285 time on the stack when the address of a nested function is taken, and is
6286 used to call the nested function indirectly. For some targets, it is
6287 made up of data only and thus requires no special treatment. But, for
6288 most targets, it is made up of code and thus requires the stack to be
6289 made executable in order for the program to work properly.
6290
6291 @item -Wfloat-equal
6292 @opindex Wfloat-equal
6293 @opindex Wno-float-equal
6294 Warn if floating-point values are used in equality comparisons.
6295
6296 The idea behind this is that sometimes it is convenient (for the
6297 programmer) to consider floating-point values as approximations to
6298 infinitely precise real numbers. If you are doing this, then you need
6299 to compute (by analyzing the code, or in some other way) the maximum or
6300 likely maximum error that the computation introduces, and allow for it
6301 when performing comparisons (and when producing output, but that's a
6302 different problem). In particular, instead of testing for equality, you
6303 should check to see whether the two values have ranges that overlap; and
6304 this is done with the relational operators, so equality comparisons are
6305 probably mistaken.
6306
6307 @item -Wtraditional @r{(C and Objective-C only)}
6308 @opindex Wtraditional
6309 @opindex Wno-traditional
6310 Warn about certain constructs that behave differently in traditional and
6311 ISO C@. Also warn about ISO C constructs that have no traditional C
6312 equivalent, and/or problematic constructs that should be avoided.
6313
6314 @itemize @bullet
6315 @item
6316 Macro parameters that appear within string literals in the macro body.
6317 In traditional C macro replacement takes place within string literals,
6318 but in ISO C it does not.
6319
6320 @item
6321 In traditional C, some preprocessor directives did not exist.
6322 Traditional preprocessors only considered a line to be a directive
6323 if the @samp{#} appeared in column 1 on the line. Therefore
6324 @option{-Wtraditional} warns about directives that traditional C
6325 understands but ignores because the @samp{#} does not appear as the
6326 first character on the line. It also suggests you hide directives like
6327 @code{#pragma} not understood by traditional C by indenting them. Some
6328 traditional implementations do not recognize @code{#elif}, so this option
6329 suggests avoiding it altogether.
6330
6331 @item
6332 A function-like macro that appears without arguments.
6333
6334 @item
6335 The unary plus operator.
6336
6337 @item
6338 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6339 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6340 constants.) Note, these suffixes appear in macros defined in the system
6341 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6342 Use of these macros in user code might normally lead to spurious
6343 warnings, however GCC's integrated preprocessor has enough context to
6344 avoid warning in these cases.
6345
6346 @item
6347 A function declared external in one block and then used after the end of
6348 the block.
6349
6350 @item
6351 A @code{switch} statement has an operand of type @code{long}.
6352
6353 @item
6354 A non-@code{static} function declaration follows a @code{static} one.
6355 This construct is not accepted by some traditional C compilers.
6356
6357 @item
6358 The ISO type of an integer constant has a different width or
6359 signedness from its traditional type. This warning is only issued if
6360 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6361 typically represent bit patterns, are not warned about.
6362
6363 @item
6364 Usage of ISO string concatenation is detected.
6365
6366 @item
6367 Initialization of automatic aggregates.
6368
6369 @item
6370 Identifier conflicts with labels. Traditional C lacks a separate
6371 namespace for labels.
6372
6373 @item
6374 Initialization of unions. If the initializer is zero, the warning is
6375 omitted. This is done under the assumption that the zero initializer in
6376 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6377 initializer warnings and relies on default initialization to zero in the
6378 traditional C case.
6379
6380 @item
6381 Conversions by prototypes between fixed/floating-point values and vice
6382 versa. The absence of these prototypes when compiling with traditional
6383 C causes serious problems. This is a subset of the possible
6384 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6385
6386 @item
6387 Use of ISO C style function definitions. This warning intentionally is
6388 @emph{not} issued for prototype declarations or variadic functions
6389 because these ISO C features appear in your code when using
6390 libiberty's traditional C compatibility macros, @code{PARAMS} and
6391 @code{VPARAMS}. This warning is also bypassed for nested functions
6392 because that feature is already a GCC extension and thus not relevant to
6393 traditional C compatibility.
6394 @end itemize
6395
6396 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6397 @opindex Wtraditional-conversion
6398 @opindex Wno-traditional-conversion
6399 Warn if a prototype causes a type conversion that is different from what
6400 would happen to the same argument in the absence of a prototype. This
6401 includes conversions of fixed point to floating and vice versa, and
6402 conversions changing the width or signedness of a fixed-point argument
6403 except when the same as the default promotion.
6404
6405 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6406 @opindex Wdeclaration-after-statement
6407 @opindex Wno-declaration-after-statement
6408 Warn when a declaration is found after a statement in a block. This
6409 construct, known from C++, was introduced with ISO C99 and is by default
6410 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6411
6412 @item -Wshadow
6413 @opindex Wshadow
6414 @opindex Wno-shadow
6415 Warn whenever a local variable or type declaration shadows another
6416 variable, parameter, type, class member (in C++), or instance variable
6417 (in Objective-C) or whenever a built-in function is shadowed. Note
6418 that in C++, the compiler warns if a local variable shadows an
6419 explicit typedef, but not if it shadows a struct/class/enum.
6420 Same as @option{-Wshadow=global}.
6421
6422 @item -Wno-shadow-ivar @r{(Objective-C only)}
6423 @opindex Wno-shadow-ivar
6424 @opindex Wshadow-ivar
6425 Do not warn whenever a local variable shadows an instance variable in an
6426 Objective-C method.
6427
6428 @item -Wshadow=global
6429 @opindex Wshadow=local
6430 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6431
6432 @item -Wshadow=local
6433 @opindex Wshadow=local
6434 Warn when a local variable shadows another local variable or parameter.
6435 This warning is enabled by @option{-Wshadow=global}.
6436
6437 @item -Wshadow=compatible-local
6438 @opindex Wshadow=compatible-local
6439 Warn when a local variable shadows another local variable or parameter
6440 whose type is compatible with that of the shadowing variable. In C++,
6441 type compatibility here means the type of the shadowing variable can be
6442 converted to that of the shadowed variable. The creation of this flag
6443 (in addition to @option{-Wshadow=local}) is based on the idea that when
6444 a local variable shadows another one of incompatible type, it is most
6445 likely intentional, not a bug or typo, as shown in the following example:
6446
6447 @smallexample
6448 @group
6449 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6450 @{
6451 for (int i = 0; i < N; ++i)
6452 @{
6453 ...
6454 @}
6455 ...
6456 @}
6457 @end group
6458 @end smallexample
6459
6460 Since the two variable @code{i} in the example above have incompatible types,
6461 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6462 Because their types are incompatible, if a programmer accidentally uses one
6463 in place of the other, type checking will catch that and emit an error or
6464 warning. So not warning (about shadowing) in this case will not lead to
6465 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6466 possibly reduce the number of warnings triggered by intentional shadowing.
6467
6468 This warning is enabled by @option{-Wshadow=local}.
6469
6470 @item -Wlarger-than=@var{byte-size}
6471 @opindex Wlarger-than=
6472 @opindex Wlarger-than-@var{byte-size}
6473 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6474 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6475 Warnings controlled by the option can be disabled either by specifying
6476 @var{byte-size} of @samp{SIZE_MAX} or more or by
6477 @option{-Wno-larger-than}.
6478
6479 @item -Wno-larger-than
6480 @opindex Wno-larger-than
6481 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6482 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6483
6484 @item -Wframe-larger-than=@var{byte-size}
6485 @opindex Wframe-larger-than=
6486 @opindex Wno-frame-larger-than
6487 Warn if the size of a function frame exceeds @var{byte-size}.
6488 The computation done to determine the stack frame size is approximate
6489 and not conservative.
6490 The actual requirements may be somewhat greater than @var{byte-size}
6491 even if you do not get a warning. In addition, any space allocated
6492 via @code{alloca}, variable-length arrays, or related constructs
6493 is not included by the compiler when determining
6494 whether or not to issue a warning.
6495 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6496 Warnings controlled by the option can be disabled either by specifying
6497 @var{byte-size} of @samp{SIZE_MAX} or more or by
6498 @option{-Wno-frame-larger-than}.
6499
6500 @item -Wno-frame-larger-than
6501 @opindex Wno-frame-larger-than
6502 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6503 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6504
6505 @item -Wno-free-nonheap-object
6506 @opindex Wno-free-nonheap-object
6507 @opindex Wfree-nonheap-object
6508 Do not warn when attempting to free an object that was not allocated
6509 on the heap.
6510
6511 @item -Wstack-usage=@var{byte-size}
6512 @opindex Wstack-usage
6513 @opindex Wno-stack-usage
6514 Warn if the stack usage of a function might exceed @var{byte-size}.
6515 The computation done to determine the stack usage is conservative.
6516 Any space allocated via @code{alloca}, variable-length arrays, or related
6517 constructs is included by the compiler when determining whether or not to
6518 issue a warning.
6519
6520 The message is in keeping with the output of @option{-fstack-usage}.
6521
6522 @itemize
6523 @item
6524 If the stack usage is fully static but exceeds the specified amount, it's:
6525
6526 @smallexample
6527 warning: stack usage is 1120 bytes
6528 @end smallexample
6529 @item
6530 If the stack usage is (partly) dynamic but bounded, it's:
6531
6532 @smallexample
6533 warning: stack usage might be 1648 bytes
6534 @end smallexample
6535 @item
6536 If the stack usage is (partly) dynamic and not bounded, it's:
6537
6538 @smallexample
6539 warning: stack usage might be unbounded
6540 @end smallexample
6541 @end itemize
6542
6543 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6544 Warnings controlled by the option can be disabled either by specifying
6545 @var{byte-size} of @samp{SIZE_MAX} or more or by
6546 @option{-Wno-stack-usage}.
6547
6548 @item -Wno-stack-usage
6549 @opindex Wno-stack-usage
6550 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6551 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6552
6553 @item -Wunsafe-loop-optimizations
6554 @opindex Wunsafe-loop-optimizations
6555 @opindex Wno-unsafe-loop-optimizations
6556 Warn if the loop cannot be optimized because the compiler cannot
6557 assume anything on the bounds of the loop indices. With
6558 @option{-funsafe-loop-optimizations} warn if the compiler makes
6559 such assumptions.
6560
6561 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6562 @opindex Wno-pedantic-ms-format
6563 @opindex Wpedantic-ms-format
6564 When used in combination with @option{-Wformat}
6565 and @option{-pedantic} without GNU extensions, this option
6566 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6567 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6568 which depend on the MS runtime.
6569
6570 @item -Waligned-new
6571 @opindex Waligned-new
6572 @opindex Wno-aligned-new
6573 Warn about a new-expression of a type that requires greater alignment
6574 than the @code{alignof(std::max_align_t)} but uses an allocation
6575 function without an explicit alignment parameter. This option is
6576 enabled by @option{-Wall}.
6577
6578 Normally this only warns about global allocation functions, but
6579 @option{-Waligned-new=all} also warns about class member allocation
6580 functions.
6581
6582 @item -Wplacement-new
6583 @itemx -Wplacement-new=@var{n}
6584 @opindex Wplacement-new
6585 @opindex Wno-placement-new
6586 Warn about placement new expressions with undefined behavior, such as
6587 constructing an object in a buffer that is smaller than the type of
6588 the object. For example, the placement new expression below is diagnosed
6589 because it attempts to construct an array of 64 integers in a buffer only
6590 64 bytes large.
6591 @smallexample
6592 char buf [64];
6593 new (buf) int[64];
6594 @end smallexample
6595 This warning is enabled by default.
6596
6597 @table @gcctabopt
6598 @item -Wplacement-new=1
6599 This is the default warning level of @option{-Wplacement-new}. At this
6600 level the warning is not issued for some strictly undefined constructs that
6601 GCC allows as extensions for compatibility with legacy code. For example,
6602 the following @code{new} expression is not diagnosed at this level even
6603 though it has undefined behavior according to the C++ standard because
6604 it writes past the end of the one-element array.
6605 @smallexample
6606 struct S @{ int n, a[1]; @};
6607 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6608 new (s->a)int [32]();
6609 @end smallexample
6610
6611 @item -Wplacement-new=2
6612 At this level, in addition to diagnosing all the same constructs as at level
6613 1, a diagnostic is also issued for placement new expressions that construct
6614 an object in the last member of structure whose type is an array of a single
6615 element and whose size is less than the size of the object being constructed.
6616 While the previous example would be diagnosed, the following construct makes
6617 use of the flexible member array extension to avoid the warning at level 2.
6618 @smallexample
6619 struct S @{ int n, a[]; @};
6620 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6621 new (s->a)int [32]();
6622 @end smallexample
6623
6624 @end table
6625
6626 @item -Wpointer-arith
6627 @opindex Wpointer-arith
6628 @opindex Wno-pointer-arith
6629 Warn about anything that depends on the ``size of'' a function type or
6630 of @code{void}. GNU C assigns these types a size of 1, for
6631 convenience in calculations with @code{void *} pointers and pointers
6632 to functions. In C++, warn also when an arithmetic operation involves
6633 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6634
6635 @item -Wpointer-compare
6636 @opindex Wpointer-compare
6637 @opindex Wno-pointer-compare
6638 Warn if a pointer is compared with a zero character constant. This usually
6639 means that the pointer was meant to be dereferenced. For example:
6640
6641 @smallexample
6642 const char *p = foo ();
6643 if (p == '\0')
6644 return 42;
6645 @end smallexample
6646
6647 Note that the code above is invalid in C++11.
6648
6649 This warning is enabled by default.
6650
6651 @item -Wtype-limits
6652 @opindex Wtype-limits
6653 @opindex Wno-type-limits
6654 Warn if a comparison is always true or always false due to the limited
6655 range of the data type, but do not warn for constant expressions. For
6656 example, warn if an unsigned variable is compared against zero with
6657 @code{<} or @code{>=}. This warning is also enabled by
6658 @option{-Wextra}.
6659
6660 @item -Wabsolute-value @r{(C and Objective-C only)}
6661 @opindex Wabsolute-value
6662 @opindex Wno-absolute-value
6663 Warn for calls to standard functions that compute the absolute value
6664 of an argument when a more appropriate standard function is available.
6665 For example, calling @code{abs(3.14)} triggers the warning because the
6666 appropriate function to call to compute the absolute value of a double
6667 argument is @code{fabs}. The option also triggers warnings when the
6668 argument in a call to such a function has an unsigned type. This
6669 warning can be suppressed with an explicit type cast and it is also
6670 enabled by @option{-Wextra}.
6671
6672 @include cppwarnopts.texi
6673
6674 @item -Wbad-function-cast @r{(C and Objective-C only)}
6675 @opindex Wbad-function-cast
6676 @opindex Wno-bad-function-cast
6677 Warn when a function call is cast to a non-matching type.
6678 For example, warn if a call to a function returning an integer type
6679 is cast to a pointer type.
6680
6681 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6682 @opindex Wc90-c99-compat
6683 @opindex Wno-c90-c99-compat
6684 Warn about features not present in ISO C90, but present in ISO C99.
6685 For instance, warn about use of variable length arrays, @code{long long}
6686 type, @code{bool} type, compound literals, designated initializers, and so
6687 on. This option is independent of the standards mode. Warnings are disabled
6688 in the expression that follows @code{__extension__}.
6689
6690 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6691 @opindex Wc99-c11-compat
6692 @opindex Wno-c99-c11-compat
6693 Warn about features not present in ISO C99, but present in ISO C11.
6694 For instance, warn about use of anonymous structures and unions,
6695 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6696 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6697 and so on. This option is independent of the standards mode. Warnings are
6698 disabled in the expression that follows @code{__extension__}.
6699
6700 @item -Wc++-compat @r{(C and Objective-C only)}
6701 @opindex Wc++-compat
6702 @opindex Wno-c++-compat
6703 Warn about ISO C constructs that are outside of the common subset of
6704 ISO C and ISO C++, e.g.@: request for implicit conversion from
6705 @code{void *} to a pointer to non-@code{void} type.
6706
6707 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6708 @opindex Wc++11-compat
6709 @opindex Wno-c++11-compat
6710 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6711 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6712 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6713 enabled by @option{-Wall}.
6714
6715 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6716 @opindex Wc++14-compat
6717 @opindex Wno-c++14-compat
6718 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6719 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6720
6721 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6722 @opindex Wc++17-compat
6723 @opindex Wno-c++17-compat
6724 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6725 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6726
6727 @item -Wcast-qual
6728 @opindex Wcast-qual
6729 @opindex Wno-cast-qual
6730 Warn whenever a pointer is cast so as to remove a type qualifier from
6731 the target type. For example, warn if a @code{const char *} is cast
6732 to an ordinary @code{char *}.
6733
6734 Also warn when making a cast that introduces a type qualifier in an
6735 unsafe way. For example, casting @code{char **} to @code{const char **}
6736 is unsafe, as in this example:
6737
6738 @smallexample
6739 /* p is char ** value. */
6740 const char **q = (const char **) p;
6741 /* Assignment of readonly string to const char * is OK. */
6742 *q = "string";
6743 /* Now char** pointer points to read-only memory. */
6744 **p = 'b';
6745 @end smallexample
6746
6747 @item -Wcast-align
6748 @opindex Wcast-align
6749 @opindex Wno-cast-align
6750 Warn whenever a pointer is cast such that the required alignment of the
6751 target is increased. For example, warn if a @code{char *} is cast to
6752 an @code{int *} on machines where integers can only be accessed at
6753 two- or four-byte boundaries.
6754
6755 @item -Wcast-align=strict
6756 @opindex Wcast-align=strict
6757 Warn whenever a pointer is cast such that the required alignment of the
6758 target is increased. For example, warn if a @code{char *} is cast to
6759 an @code{int *} regardless of the target machine.
6760
6761 @item -Wcast-function-type
6762 @opindex Wcast-function-type
6763 @opindex Wno-cast-function-type
6764 Warn when a function pointer is cast to an incompatible function pointer.
6765 In a cast involving function types with a variable argument list only
6766 the types of initial arguments that are provided are considered.
6767 Any parameter of pointer-type matches any other pointer-type. Any benign
6768 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6769 on ILP32 targets. Likewise type qualifiers are ignored. The function
6770 type @code{void (*) (void)} is special and matches everything, which can
6771 be used to suppress this warning.
6772 In a cast involving pointer to member types this warning warns whenever
6773 the type cast is changing the pointer to member type.
6774 This warning is enabled by @option{-Wextra}.
6775
6776 @item -Wwrite-strings
6777 @opindex Wwrite-strings
6778 @opindex Wno-write-strings
6779 When compiling C, give string constants the type @code{const
6780 char[@var{length}]} so that copying the address of one into a
6781 non-@code{const} @code{char *} pointer produces a warning. These
6782 warnings help you find at compile time code that can try to write
6783 into a string constant, but only if you have been very careful about
6784 using @code{const} in declarations and prototypes. Otherwise, it is
6785 just a nuisance. This is why we did not make @option{-Wall} request
6786 these warnings.
6787
6788 When compiling C++, warn about the deprecated conversion from string
6789 literals to @code{char *}. This warning is enabled by default for C++
6790 programs.
6791
6792 @item -Wcatch-value
6793 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6794 @opindex Wcatch-value
6795 @opindex Wno-catch-value
6796 Warn about catch handlers that do not catch via reference.
6797 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6798 warn about polymorphic class types that are caught by value.
6799 With @option{-Wcatch-value=2} warn about all class types that are caught
6800 by value. With @option{-Wcatch-value=3} warn about all types that are
6801 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6802
6803 @item -Wclobbered
6804 @opindex Wclobbered
6805 @opindex Wno-clobbered
6806 Warn for variables that might be changed by @code{longjmp} or
6807 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6808
6809 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6810 @opindex Wconditionally-supported
6811 @opindex Wno-conditionally-supported
6812 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6813
6814 @item -Wconversion
6815 @opindex Wconversion
6816 @opindex Wno-conversion
6817 Warn for implicit conversions that may alter a value. This includes
6818 conversions between real and integer, like @code{abs (x)} when
6819 @code{x} is @code{double}; conversions between signed and unsigned,
6820 like @code{unsigned ui = -1}; and conversions to smaller types, like
6821 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6822 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6823 changed by the conversion like in @code{abs (2.0)}. Warnings about
6824 conversions between signed and unsigned integers can be disabled by
6825 using @option{-Wno-sign-conversion}.
6826
6827 For C++, also warn for confusing overload resolution for user-defined
6828 conversions; and conversions that never use a type conversion
6829 operator: conversions to @code{void}, the same type, a base class or a
6830 reference to them. Warnings about conversions between signed and
6831 unsigned integers are disabled by default in C++ unless
6832 @option{-Wsign-conversion} is explicitly enabled.
6833
6834 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6835 @opindex Wconversion-null
6836 @opindex Wno-conversion-null
6837 Do not warn for conversions between @code{NULL} and non-pointer
6838 types. @option{-Wconversion-null} is enabled by default.
6839
6840 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6841 @opindex Wzero-as-null-pointer-constant
6842 @opindex Wno-zero-as-null-pointer-constant
6843 Warn when a literal @samp{0} is used as null pointer constant. This can
6844 be useful to facilitate the conversion to @code{nullptr} in C++11.
6845
6846 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6847 @opindex Wsubobject-linkage
6848 @opindex Wno-subobject-linkage
6849 Warn if a class type has a base or a field whose type uses the anonymous
6850 namespace or depends on a type with no linkage. If a type A depends on
6851 a type B with no or internal linkage, defining it in multiple
6852 translation units would be an ODR violation because the meaning of B
6853 is different in each translation unit. If A only appears in a single
6854 translation unit, the best way to silence the warning is to give it
6855 internal linkage by putting it in an anonymous namespace as well. The
6856 compiler doesn't give this warning for types defined in the main .C
6857 file, as those are unlikely to have multiple definitions.
6858 @option{-Wsubobject-linkage} is enabled by default.
6859
6860 @item -Wdangling-else
6861 @opindex Wdangling-else
6862 @opindex Wno-dangling-else
6863 Warn about constructions where there may be confusion to which
6864 @code{if} statement an @code{else} branch belongs. Here is an example of
6865 such a case:
6866
6867 @smallexample
6868 @group
6869 @{
6870 if (a)
6871 if (b)
6872 foo ();
6873 else
6874 bar ();
6875 @}
6876 @end group
6877 @end smallexample
6878
6879 In C/C++, every @code{else} branch belongs to the innermost possible
6880 @code{if} statement, which in this example is @code{if (b)}. This is
6881 often not what the programmer expected, as illustrated in the above
6882 example by indentation the programmer chose. When there is the
6883 potential for this confusion, GCC issues a warning when this flag
6884 is specified. To eliminate the warning, add explicit braces around
6885 the innermost @code{if} statement so there is no way the @code{else}
6886 can belong to the enclosing @code{if}. The resulting code
6887 looks like this:
6888
6889 @smallexample
6890 @group
6891 @{
6892 if (a)
6893 @{
6894 if (b)
6895 foo ();
6896 else
6897 bar ();
6898 @}
6899 @}
6900 @end group
6901 @end smallexample
6902
6903 This warning is enabled by @option{-Wparentheses}.
6904
6905 @item -Wdate-time
6906 @opindex Wdate-time
6907 @opindex Wno-date-time
6908 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6909 are encountered as they might prevent bit-wise-identical reproducible
6910 compilations.
6911
6912 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6913 @opindex Wdelete-incomplete
6914 @opindex Wno-delete-incomplete
6915 Warn when deleting a pointer to incomplete type, which may cause
6916 undefined behavior at runtime. This warning is enabled by default.
6917
6918 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6919 @opindex Wuseless-cast
6920 @opindex Wno-useless-cast
6921 Warn when an expression is casted to its own type.
6922
6923 @item -Wempty-body
6924 @opindex Wempty-body
6925 @opindex Wno-empty-body
6926 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6927 while} statement. This warning is also enabled by @option{-Wextra}.
6928
6929 @item -Wenum-compare
6930 @opindex Wenum-compare
6931 @opindex Wno-enum-compare
6932 Warn about a comparison between values of different enumerated types.
6933 In C++ enumerated type mismatches in conditional expressions are also
6934 diagnosed and the warning is enabled by default. In C this warning is
6935 enabled by @option{-Wall}.
6936
6937 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6938 @opindex Wextra-semi
6939 @opindex Wno-extra-semi
6940 Warn about redundant semicolon after in-class function definition.
6941
6942 @item -Wjump-misses-init @r{(C, Objective-C only)}
6943 @opindex Wjump-misses-init
6944 @opindex Wno-jump-misses-init
6945 Warn if a @code{goto} statement or a @code{switch} statement jumps
6946 forward across the initialization of a variable, or jumps backward to a
6947 label after the variable has been initialized. This only warns about
6948 variables that are initialized when they are declared. This warning is
6949 only supported for C and Objective-C; in C++ this sort of branch is an
6950 error in any case.
6951
6952 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6953 can be disabled with the @option{-Wno-jump-misses-init} option.
6954
6955 @item -Wsign-compare
6956 @opindex Wsign-compare
6957 @opindex Wno-sign-compare
6958 @cindex warning for comparison of signed and unsigned values
6959 @cindex comparison of signed and unsigned values, warning
6960 @cindex signed and unsigned values, comparison warning
6961 Warn when a comparison between signed and unsigned values could produce
6962 an incorrect result when the signed value is converted to unsigned.
6963 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6964 also enabled by @option{-Wextra}.
6965
6966 @item -Wsign-conversion
6967 @opindex Wsign-conversion
6968 @opindex Wno-sign-conversion
6969 Warn for implicit conversions that may change the sign of an integer
6970 value, like assigning a signed integer expression to an unsigned
6971 integer variable. An explicit cast silences the warning. In C, this
6972 option is enabled also by @option{-Wconversion}.
6973
6974 @item -Wfloat-conversion
6975 @opindex Wfloat-conversion
6976 @opindex Wno-float-conversion
6977 Warn for implicit conversions that reduce the precision of a real value.
6978 This includes conversions from real to integer, and from higher precision
6979 real to lower precision real values. This option is also enabled by
6980 @option{-Wconversion}.
6981
6982 @item -Wno-scalar-storage-order
6983 @opindex Wno-scalar-storage-order
6984 @opindex Wscalar-storage-order
6985 Do not warn on suspicious constructs involving reverse scalar storage order.
6986
6987 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6988 @opindex Wsized-deallocation
6989 @opindex Wno-sized-deallocation
6990 Warn about a definition of an unsized deallocation function
6991 @smallexample
6992 void operator delete (void *) noexcept;
6993 void operator delete[] (void *) noexcept;
6994 @end smallexample
6995 without a definition of the corresponding sized deallocation function
6996 @smallexample
6997 void operator delete (void *, std::size_t) noexcept;
6998 void operator delete[] (void *, std::size_t) noexcept;
6999 @end smallexample
7000 or vice versa. Enabled by @option{-Wextra} along with
7001 @option{-fsized-deallocation}.
7002
7003 @item -Wsizeof-pointer-div
7004 @opindex Wsizeof-pointer-div
7005 @opindex Wno-sizeof-pointer-div
7006 Warn for suspicious divisions of two sizeof expressions that divide
7007 the pointer size by the element size, which is the usual way to compute
7008 the array size but won't work out correctly with pointers. This warning
7009 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7010 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7011
7012 @item -Wsizeof-pointer-memaccess
7013 @opindex Wsizeof-pointer-memaccess
7014 @opindex Wno-sizeof-pointer-memaccess
7015 Warn for suspicious length parameters to certain string and memory built-in
7016 functions if the argument uses @code{sizeof}. This warning triggers for
7017 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7018 an array, but a pointer, and suggests a possible fix, or about
7019 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7020 also warns about calls to bounded string copy functions like @code{strncat}
7021 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7022 the source array. For example, in the following function the call to
7023 @code{strncat} specifies the size of the source string as the bound. That
7024 is almost certainly a mistake and so the call is diagnosed.
7025 @smallexample
7026 void make_file (const char *name)
7027 @{
7028 char path[PATH_MAX];
7029 strncpy (path, name, sizeof path - 1);
7030 strncat (path, ".text", sizeof ".text");
7031 @dots{}
7032 @}
7033 @end smallexample
7034
7035 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7036
7037 @item -Wsizeof-array-argument
7038 @opindex Wsizeof-array-argument
7039 @opindex Wno-sizeof-array-argument
7040 Warn when the @code{sizeof} operator is applied to a parameter that is
7041 declared as an array in a function definition. This warning is enabled by
7042 default for C and C++ programs.
7043
7044 @item -Wmemset-elt-size
7045 @opindex Wmemset-elt-size
7046 @opindex Wno-memset-elt-size
7047 Warn for suspicious calls to the @code{memset} built-in function, if the
7048 first argument references an array, and the third argument is a number
7049 equal to the number of elements, but not equal to the size of the array
7050 in memory. This indicates that the user has omitted a multiplication by
7051 the element size. This warning is enabled by @option{-Wall}.
7052
7053 @item -Wmemset-transposed-args
7054 @opindex Wmemset-transposed-args
7055 @opindex Wno-memset-transposed-args
7056 Warn for suspicious calls to the @code{memset} built-in function where
7057 the second argument is not zero and the third argument is zero. For
7058 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7059 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7060 is only emitted if the third argument is a literal zero. Otherwise, if
7061 it is an expression that is folded to zero, or a cast of zero to some
7062 type, it is far less likely that the arguments have been mistakenly
7063 transposed and no warning is emitted. This warning is enabled
7064 by @option{-Wall}.
7065
7066 @item -Waddress
7067 @opindex Waddress
7068 @opindex Wno-address
7069 Warn about suspicious uses of memory addresses. These include using
7070 the address of a function in a conditional expression, such as
7071 @code{void func(void); if (func)}, and comparisons against the memory
7072 address of a string literal, such as @code{if (x == "abc")}. Such
7073 uses typically indicate a programmer error: the address of a function
7074 always evaluates to true, so their use in a conditional usually
7075 indicate that the programmer forgot the parentheses in a function
7076 call; and comparisons against string literals result in unspecified
7077 behavior and are not portable in C, so they usually indicate that the
7078 programmer intended to use @code{strcmp}. This warning is enabled by
7079 @option{-Wall}.
7080
7081 @item -Waddress-of-packed-member
7082 @opindex Waddress-of-packed-member
7083 @opindex Wno-address-of-packed-member
7084 Warn when the address of packed member of struct or union is taken,
7085 which usually results in an unaligned pointer value. This is
7086 enabled by default.
7087
7088 @item -Wlogical-op
7089 @opindex Wlogical-op
7090 @opindex Wno-logical-op
7091 Warn about suspicious uses of logical operators in expressions.
7092 This includes using logical operators in contexts where a
7093 bit-wise operator is likely to be expected. Also warns when
7094 the operands of a logical operator are the same:
7095 @smallexample
7096 extern int a;
7097 if (a < 0 && a < 0) @{ @dots{} @}
7098 @end smallexample
7099
7100 @item -Wlogical-not-parentheses
7101 @opindex Wlogical-not-parentheses
7102 @opindex Wno-logical-not-parentheses
7103 Warn about logical not used on the left hand side operand of a comparison.
7104 This option does not warn if the right operand is considered to be a boolean
7105 expression. Its purpose is to detect suspicious code like the following:
7106 @smallexample
7107 int a;
7108 @dots{}
7109 if (!a > 1) @{ @dots{} @}
7110 @end smallexample
7111
7112 It is possible to suppress the warning by wrapping the LHS into
7113 parentheses:
7114 @smallexample
7115 if ((!a) > 1) @{ @dots{} @}
7116 @end smallexample
7117
7118 This warning is enabled by @option{-Wall}.
7119
7120 @item -Waggregate-return
7121 @opindex Waggregate-return
7122 @opindex Wno-aggregate-return
7123 Warn if any functions that return structures or unions are defined or
7124 called. (In languages where you can return an array, this also elicits
7125 a warning.)
7126
7127 @item -Wno-aggressive-loop-optimizations
7128 @opindex Wno-aggressive-loop-optimizations
7129 @opindex Waggressive-loop-optimizations
7130 Warn if in a loop with constant number of iterations the compiler detects
7131 undefined behavior in some statement during one or more of the iterations.
7132
7133 @item -Wno-attributes
7134 @opindex Wno-attributes
7135 @opindex Wattributes
7136 Do not warn if an unexpected @code{__attribute__} is used, such as
7137 unrecognized attributes, function attributes applied to variables,
7138 etc. This does not stop errors for incorrect use of supported
7139 attributes.
7140
7141 @item -Wno-builtin-declaration-mismatch
7142 @opindex Wno-builtin-declaration-mismatch
7143 @opindex Wbuiltin-declaration-mismatch
7144 Warn if a built-in function is declared with an incompatible signature
7145 or as a non-function, or when a built-in function declared with a type
7146 that does not include a prototype is called with arguments whose promoted
7147 types do not match those expected by the function. When @option{-Wextra}
7148 is specified, also warn when a built-in function that takes arguments is
7149 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7150 warning is enabled by default. To avoid the warning include the appropriate
7151 header to bring the prototypes of built-in functions into scope.
7152
7153 For example, the call to @code{memset} below is diagnosed by the warning
7154 because the function expects a value of type @code{size_t} as its argument
7155 but the type of @code{32} is @code{int}. With @option{-Wextra},
7156 the declaration of the function is diagnosed as well.
7157 @smallexample
7158 extern void* memset ();
7159 void f (void *d)
7160 @{
7161 memset (d, '\0', 32);
7162 @}
7163 @end smallexample
7164
7165 @item -Wno-builtin-macro-redefined
7166 @opindex Wno-builtin-macro-redefined
7167 @opindex Wbuiltin-macro-redefined
7168 Do not warn if certain built-in macros are redefined. This suppresses
7169 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7170 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7171
7172 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7173 @opindex Wstrict-prototypes
7174 @opindex Wno-strict-prototypes
7175 Warn if a function is declared or defined without specifying the
7176 argument types. (An old-style function definition is permitted without
7177 a warning if preceded by a declaration that specifies the argument
7178 types.)
7179
7180 @item -Wold-style-declaration @r{(C and Objective-C only)}
7181 @opindex Wold-style-declaration
7182 @opindex Wno-old-style-declaration
7183 Warn for obsolescent usages, according to the C Standard, in a
7184 declaration. For example, warn if storage-class specifiers like
7185 @code{static} are not the first things in a declaration. This warning
7186 is also enabled by @option{-Wextra}.
7187
7188 @item -Wold-style-definition @r{(C and Objective-C only)}
7189 @opindex Wold-style-definition
7190 @opindex Wno-old-style-definition
7191 Warn if an old-style function definition is used. A warning is given
7192 even if there is a previous prototype.
7193
7194 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7195 @opindex Wmissing-parameter-type
7196 @opindex Wno-missing-parameter-type
7197 A function parameter is declared without a type specifier in K&R-style
7198 functions:
7199
7200 @smallexample
7201 void foo(bar) @{ @}
7202 @end smallexample
7203
7204 This warning is also enabled by @option{-Wextra}.
7205
7206 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7207 @opindex Wmissing-prototypes
7208 @opindex Wno-missing-prototypes
7209 Warn if a global function is defined without a previous prototype
7210 declaration. This warning is issued even if the definition itself
7211 provides a prototype. Use this option to detect global functions
7212 that do not have a matching prototype declaration in a header file.
7213 This option is not valid for C++ because all function declarations
7214 provide prototypes and a non-matching declaration declares an
7215 overload rather than conflict with an earlier declaration.
7216 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7217
7218 @item -Wmissing-declarations
7219 @opindex Wmissing-declarations
7220 @opindex Wno-missing-declarations
7221 Warn if a global function is defined without a previous declaration.
7222 Do so even if the definition itself provides a prototype.
7223 Use this option to detect global functions that are not declared in
7224 header files. In C, no warnings are issued for functions with previous
7225 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7226 missing prototypes. In C++, no warnings are issued for function templates,
7227 or for inline functions, or for functions in anonymous namespaces.
7228
7229 @item -Wmissing-field-initializers
7230 @opindex Wmissing-field-initializers
7231 @opindex Wno-missing-field-initializers
7232 @opindex W
7233 @opindex Wextra
7234 @opindex Wno-extra
7235 Warn if a structure's initializer has some fields missing. For
7236 example, the following code causes such a warning, because
7237 @code{x.h} is implicitly zero:
7238
7239 @smallexample
7240 struct s @{ int f, g, h; @};
7241 struct s x = @{ 3, 4 @};
7242 @end smallexample
7243
7244 This option does not warn about designated initializers, so the following
7245 modification does not trigger a warning:
7246
7247 @smallexample
7248 struct s @{ int f, g, h; @};
7249 struct s x = @{ .f = 3, .g = 4 @};
7250 @end smallexample
7251
7252 In C this option does not warn about the universal zero initializer
7253 @samp{@{ 0 @}}:
7254
7255 @smallexample
7256 struct s @{ int f, g, h; @};
7257 struct s x = @{ 0 @};
7258 @end smallexample
7259
7260 Likewise, in C++ this option does not warn about the empty @{ @}
7261 initializer, for example:
7262
7263 @smallexample
7264 struct s @{ int f, g, h; @};
7265 s x = @{ @};
7266 @end smallexample
7267
7268 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7269 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7270
7271 @item -Wno-multichar
7272 @opindex Wno-multichar
7273 @opindex Wmultichar
7274 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7275 Usually they indicate a typo in the user's code, as they have
7276 implementation-defined values, and should not be used in portable code.
7277
7278 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7279 @opindex Wnormalized=
7280 @opindex Wnormalized
7281 @opindex Wno-normalized
7282 @cindex NFC
7283 @cindex NFKC
7284 @cindex character set, input normalization
7285 In ISO C and ISO C++, two identifiers are different if they are
7286 different sequences of characters. However, sometimes when characters
7287 outside the basic ASCII character set are used, you can have two
7288 different character sequences that look the same. To avoid confusion,
7289 the ISO 10646 standard sets out some @dfn{normalization rules} which
7290 when applied ensure that two sequences that look the same are turned into
7291 the same sequence. GCC can warn you if you are using identifiers that
7292 have not been normalized; this option controls that warning.
7293
7294 There are four levels of warning supported by GCC@. The default is
7295 @option{-Wnormalized=nfc}, which warns about any identifier that is
7296 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7297 recommended form for most uses. It is equivalent to
7298 @option{-Wnormalized}.
7299
7300 Unfortunately, there are some characters allowed in identifiers by
7301 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7302 identifiers. That is, there's no way to use these symbols in portable
7303 ISO C or C++ and have all your identifiers in NFC@.
7304 @option{-Wnormalized=id} suppresses the warning for these characters.
7305 It is hoped that future versions of the standards involved will correct
7306 this, which is why this option is not the default.
7307
7308 You can switch the warning off for all characters by writing
7309 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7310 only do this if you are using some other normalization scheme (like
7311 ``D''), because otherwise you can easily create bugs that are
7312 literally impossible to see.
7313
7314 Some characters in ISO 10646 have distinct meanings but look identical
7315 in some fonts or display methodologies, especially once formatting has
7316 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7317 LETTER N'', displays just like a regular @code{n} that has been
7318 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7319 normalization scheme to convert all these into a standard form as
7320 well, and GCC warns if your code is not in NFKC if you use
7321 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7322 about every identifier that contains the letter O because it might be
7323 confused with the digit 0, and so is not the default, but may be
7324 useful as a local coding convention if the programming environment
7325 cannot be fixed to display these characters distinctly.
7326
7327 @item -Wno-attribute-warning
7328 @opindex Wno-attribute-warning
7329 @opindex Wattribute-warning
7330 Do not warn about usage of functions (@pxref{Function Attributes})
7331 declared with @code{warning} attribute. By default, this warning is
7332 enabled. @option{-Wno-attribute-warning} can be used to disable the
7333 warning or @option{-Wno-error=attribute-warning} can be used to
7334 disable the error when compiled with @option{-Werror} flag.
7335
7336 @item -Wno-deprecated
7337 @opindex Wno-deprecated
7338 @opindex Wdeprecated
7339 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7340
7341 @item -Wno-deprecated-declarations
7342 @opindex Wno-deprecated-declarations
7343 @opindex Wdeprecated-declarations
7344 Do not warn about uses of functions (@pxref{Function Attributes}),
7345 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7346 Attributes}) marked as deprecated by using the @code{deprecated}
7347 attribute.
7348
7349 @item -Wno-overflow
7350 @opindex Wno-overflow
7351 @opindex Woverflow
7352 Do not warn about compile-time overflow in constant expressions.
7353
7354 @item -Wno-odr
7355 @opindex Wno-odr
7356 @opindex Wodr
7357 Warn about One Definition Rule violations during link-time optimization.
7358 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7359
7360 @item -Wopenmp-simd
7361 @opindex Wopenmp-simd
7362 @opindex Wno-openmp-simd
7363 Warn if the vectorizer cost model overrides the OpenMP
7364 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7365 option can be used to relax the cost model.
7366
7367 @item -Woverride-init @r{(C and Objective-C only)}
7368 @opindex Woverride-init
7369 @opindex Wno-override-init
7370 @opindex W
7371 @opindex Wextra
7372 @opindex Wno-extra
7373 Warn if an initialized field without side effects is overridden when
7374 using designated initializers (@pxref{Designated Inits, , Designated
7375 Initializers}).
7376
7377 This warning is included in @option{-Wextra}. To get other
7378 @option{-Wextra} warnings without this one, use @option{-Wextra
7379 -Wno-override-init}.
7380
7381 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7382 @opindex Woverride-init-side-effects
7383 @opindex Wno-override-init-side-effects
7384 Warn if an initialized field with side effects is overridden when
7385 using designated initializers (@pxref{Designated Inits, , Designated
7386 Initializers}). This warning is enabled by default.
7387
7388 @item -Wpacked
7389 @opindex Wpacked
7390 @opindex Wno-packed
7391 Warn if a structure is given the packed attribute, but the packed
7392 attribute has no effect on the layout or size of the structure.
7393 Such structures may be mis-aligned for little benefit. For
7394 instance, in this code, the variable @code{f.x} in @code{struct bar}
7395 is misaligned even though @code{struct bar} does not itself
7396 have the packed attribute:
7397
7398 @smallexample
7399 @group
7400 struct foo @{
7401 int x;
7402 char a, b, c, d;
7403 @} __attribute__((packed));
7404 struct bar @{
7405 char z;
7406 struct foo f;
7407 @};
7408 @end group
7409 @end smallexample
7410
7411 @item -Wpacked-bitfield-compat
7412 @opindex Wpacked-bitfield-compat
7413 @opindex Wno-packed-bitfield-compat
7414 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7415 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7416 the change can lead to differences in the structure layout. GCC
7417 informs you when the offset of such a field has changed in GCC 4.4.
7418 For example there is no longer a 4-bit padding between field @code{a}
7419 and @code{b} in this structure:
7420
7421 @smallexample
7422 struct foo
7423 @{
7424 char a:4;
7425 char b:8;
7426 @} __attribute__ ((packed));
7427 @end smallexample
7428
7429 This warning is enabled by default. Use
7430 @option{-Wno-packed-bitfield-compat} to disable this warning.
7431
7432 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7433 @opindex Wpacked-not-aligned
7434 @opindex Wno-packed-not-aligned
7435 Warn if a structure field with explicitly specified alignment in a
7436 packed struct or union is misaligned. For example, a warning will
7437 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7438 'struct S' is less than 8}, in this code:
7439
7440 @smallexample
7441 @group
7442 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7443 struct __attribute__ ((packed)) S @{
7444 struct S8 s8;
7445 @};
7446 @end group
7447 @end smallexample
7448
7449 This warning is enabled by @option{-Wall}.
7450
7451 @item -Wpadded
7452 @opindex Wpadded
7453 @opindex Wno-padded
7454 Warn if padding is included in a structure, either to align an element
7455 of the structure or to align the whole structure. Sometimes when this
7456 happens it is possible to rearrange the fields of the structure to
7457 reduce the padding and so make the structure smaller.
7458
7459 @item -Wredundant-decls
7460 @opindex Wredundant-decls
7461 @opindex Wno-redundant-decls
7462 Warn if anything is declared more than once in the same scope, even in
7463 cases where multiple declaration is valid and changes nothing.
7464
7465 @item -Wno-restrict
7466 @opindex Wrestrict
7467 @opindex Wno-restrict
7468 Warn when an object referenced by a @code{restrict}-qualified parameter
7469 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7470 argument, or when copies between such objects overlap. For example,
7471 the call to the @code{strcpy} function below attempts to truncate the string
7472 by replacing its initial characters with the last four. However, because
7473 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7474 the call is diagnosed.
7475
7476 @smallexample
7477 void foo (void)
7478 @{
7479 char a[] = "abcd1234";
7480 strcpy (a, a + 4);
7481 @dots{}
7482 @}
7483 @end smallexample
7484 The @option{-Wrestrict} option detects some instances of simple overlap
7485 even without optimization but works best at @option{-O2} and above. It
7486 is included in @option{-Wall}.
7487
7488 @item -Wnested-externs @r{(C and Objective-C only)}
7489 @opindex Wnested-externs
7490 @opindex Wno-nested-externs
7491 Warn if an @code{extern} declaration is encountered within a function.
7492
7493 @item -Wno-inherited-variadic-ctor
7494 @opindex Winherited-variadic-ctor
7495 @opindex Wno-inherited-variadic-ctor
7496 Suppress warnings about use of C++11 inheriting constructors when the
7497 base class inherited from has a C variadic constructor; the warning is
7498 on by default because the ellipsis is not inherited.
7499
7500 @item -Winline
7501 @opindex Winline
7502 @opindex Wno-inline
7503 Warn if a function that is declared as inline cannot be inlined.
7504 Even with this option, the compiler does not warn about failures to
7505 inline functions declared in system headers.
7506
7507 The compiler uses a variety of heuristics to determine whether or not
7508 to inline a function. For example, the compiler takes into account
7509 the size of the function being inlined and the amount of inlining
7510 that has already been done in the current function. Therefore,
7511 seemingly insignificant changes in the source program can cause the
7512 warnings produced by @option{-Winline} to appear or disappear.
7513
7514 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7515 @opindex Wno-invalid-offsetof
7516 @opindex Winvalid-offsetof
7517 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7518 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7519 to a non-standard-layout type is undefined. In existing C++ implementations,
7520 however, @code{offsetof} typically gives meaningful results.
7521 This flag is for users who are aware that they are
7522 writing nonportable code and who have deliberately chosen to ignore the
7523 warning about it.
7524
7525 The restrictions on @code{offsetof} may be relaxed in a future version
7526 of the C++ standard.
7527
7528 @item -Wint-in-bool-context
7529 @opindex Wint-in-bool-context
7530 @opindex Wno-int-in-bool-context
7531 Warn for suspicious use of integer values where boolean values are expected,
7532 such as conditional expressions (?:) using non-boolean integer constants in
7533 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7534 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7535 for all kinds of multiplications regardless of the data type.
7536 This warning is enabled by @option{-Wall}.
7537
7538 @item -Wno-int-to-pointer-cast
7539 @opindex Wno-int-to-pointer-cast
7540 @opindex Wint-to-pointer-cast
7541 Suppress warnings from casts to pointer type of an integer of a
7542 different size. In C++, casting to a pointer type of smaller size is
7543 an error. @option{Wint-to-pointer-cast} is enabled by default.
7544
7545
7546 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7547 @opindex Wno-pointer-to-int-cast
7548 @opindex Wpointer-to-int-cast
7549 Suppress warnings from casts from a pointer to an integer type of a
7550 different size.
7551
7552 @item -Winvalid-pch
7553 @opindex Winvalid-pch
7554 @opindex Wno-invalid-pch
7555 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7556 the search path but cannot be used.
7557
7558 @item -Wlong-long
7559 @opindex Wlong-long
7560 @opindex Wno-long-long
7561 Warn if @code{long long} type is used. This is enabled by either
7562 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7563 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7564
7565 @item -Wvariadic-macros
7566 @opindex Wvariadic-macros
7567 @opindex Wno-variadic-macros
7568 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7569 alternate syntax is used in ISO C99 mode. This is enabled by either
7570 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7571 messages, use @option{-Wno-variadic-macros}.
7572
7573 @item -Wvarargs
7574 @opindex Wvarargs
7575 @opindex Wno-varargs
7576 Warn upon questionable usage of the macros used to handle variable
7577 arguments like @code{va_start}. This is default. To inhibit the
7578 warning messages, use @option{-Wno-varargs}.
7579
7580 @item -Wvector-operation-performance
7581 @opindex Wvector-operation-performance
7582 @opindex Wno-vector-operation-performance
7583 Warn if vector operation is not implemented via SIMD capabilities of the
7584 architecture. Mainly useful for the performance tuning.
7585 Vector operation can be implemented @code{piecewise}, which means that the
7586 scalar operation is performed on every vector element;
7587 @code{in parallel}, which means that the vector operation is implemented
7588 using scalars of wider type, which normally is more performance efficient;
7589 and @code{as a single scalar}, which means that vector fits into a
7590 scalar type.
7591
7592 @item -Wno-virtual-move-assign
7593 @opindex Wvirtual-move-assign
7594 @opindex Wno-virtual-move-assign
7595 Suppress warnings about inheriting from a virtual base with a
7596 non-trivial C++11 move assignment operator. This is dangerous because
7597 if the virtual base is reachable along more than one path, it is
7598 moved multiple times, which can mean both objects end up in the
7599 moved-from state. If the move assignment operator is written to avoid
7600 moving from a moved-from object, this warning can be disabled.
7601
7602 @item -Wvla
7603 @opindex Wvla
7604 @opindex Wno-vla
7605 Warn if a variable-length array is used in the code.
7606 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7607 the variable-length array.
7608
7609 @item -Wvla-larger-than=@var{byte-size}
7610 @opindex Wvla-larger-than=
7611 @opindex Wno-vla-larger-than
7612 If this option is used, the compiler will warn for declarations of
7613 variable-length arrays whose size is either unbounded, or bounded
7614 by an argument that allows the array size to exceed @var{byte-size}
7615 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7616 works, but with variable-length arrays.
7617
7618 Note that GCC may optimize small variable-length arrays of a known
7619 value into plain arrays, so this warning may not get triggered for
7620 such arrays.
7621
7622 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7623 is typically only effective when @option{-ftree-vrp} is active (default
7624 for @option{-O2} and above).
7625
7626 See also @option{-Walloca-larger-than=@var{byte-size}}.
7627
7628 @item -Wno-vla-larger-than
7629 @opindex Wno-vla-larger-than
7630 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7631 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7632
7633 @item -Wvolatile-register-var
7634 @opindex Wvolatile-register-var
7635 @opindex Wno-volatile-register-var
7636 Warn if a register variable is declared volatile. The volatile
7637 modifier does not inhibit all optimizations that may eliminate reads
7638 and/or writes to register variables. This warning is enabled by
7639 @option{-Wall}.
7640
7641 @item -Wdisabled-optimization
7642 @opindex Wdisabled-optimization
7643 @opindex Wno-disabled-optimization
7644 Warn if a requested optimization pass is disabled. This warning does
7645 not generally indicate that there is anything wrong with your code; it
7646 merely indicates that GCC's optimizers are unable to handle the code
7647 effectively. Often, the problem is that your code is too big or too
7648 complex; GCC refuses to optimize programs when the optimization
7649 itself is likely to take inordinate amounts of time.
7650
7651 @item -Wpointer-sign @r{(C and Objective-C only)}
7652 @opindex Wpointer-sign
7653 @opindex Wno-pointer-sign
7654 Warn for pointer argument passing or assignment with different signedness.
7655 This option is only supported for C and Objective-C@. It is implied by
7656 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7657 @option{-Wno-pointer-sign}.
7658
7659 @item -Wstack-protector
7660 @opindex Wstack-protector
7661 @opindex Wno-stack-protector
7662 This option is only active when @option{-fstack-protector} is active. It
7663 warns about functions that are not protected against stack smashing.
7664
7665 @item -Woverlength-strings
7666 @opindex Woverlength-strings
7667 @opindex Wno-overlength-strings
7668 Warn about string constants that are longer than the ``minimum
7669 maximum'' length specified in the C standard. Modern compilers
7670 generally allow string constants that are much longer than the
7671 standard's minimum limit, but very portable programs should avoid
7672 using longer strings.
7673
7674 The limit applies @emph{after} string constant concatenation, and does
7675 not count the trailing NUL@. In C90, the limit was 509 characters; in
7676 C99, it was raised to 4095. C++98 does not specify a normative
7677 minimum maximum, so we do not diagnose overlength strings in C++@.
7678
7679 This option is implied by @option{-Wpedantic}, and can be disabled with
7680 @option{-Wno-overlength-strings}.
7681
7682 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7683 @opindex Wunsuffixed-float-constants
7684 @opindex Wno-unsuffixed-float-constants
7685
7686 Issue a warning for any floating constant that does not have
7687 a suffix. When used together with @option{-Wsystem-headers} it
7688 warns about such constants in system header files. This can be useful
7689 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7690 from the decimal floating-point extension to C99.
7691
7692 @item -Wno-designated-init @r{(C and Objective-C only)}
7693 Suppress warnings when a positional initializer is used to initialize
7694 a structure that has been marked with the @code{designated_init}
7695 attribute.
7696
7697 @item -Whsa
7698 Issue a warning when HSAIL cannot be emitted for the compiled function or
7699 OpenMP construct.
7700
7701 @end table
7702
7703 @node Debugging Options
7704 @section Options for Debugging Your Program
7705 @cindex options, debugging
7706 @cindex debugging information options
7707
7708 To tell GCC to emit extra information for use by a debugger, in almost
7709 all cases you need only to add @option{-g} to your other options.
7710
7711 GCC allows you to use @option{-g} with
7712 @option{-O}. The shortcuts taken by optimized code may occasionally
7713 be surprising: some variables you declared may not exist
7714 at all; flow of control may briefly move where you did not expect it;
7715 some statements may not be executed because they compute constant
7716 results or their values are already at hand; some statements may
7717 execute in different places because they have been moved out of loops.
7718 Nevertheless it is possible to debug optimized output. This makes
7719 it reasonable to use the optimizer for programs that might have bugs.
7720
7721 If you are not using some other optimization option, consider
7722 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7723 With no @option{-O} option at all, some compiler passes that collect
7724 information useful for debugging do not run at all, so that
7725 @option{-Og} may result in a better debugging experience.
7726
7727 @table @gcctabopt
7728 @item -g
7729 @opindex g
7730 Produce debugging information in the operating system's native format
7731 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7732 information.
7733
7734 On most systems that use stabs format, @option{-g} enables use of extra
7735 debugging information that only GDB can use; this extra information
7736 makes debugging work better in GDB but probably makes other debuggers
7737 crash or
7738 refuse to read the program. If you want to control for certain whether
7739 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7740 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7741
7742 @item -ggdb
7743 @opindex ggdb
7744 Produce debugging information for use by GDB@. This means to use the
7745 most expressive format available (DWARF, stabs, or the native format
7746 if neither of those are supported), including GDB extensions if at all
7747 possible.
7748
7749 @item -gdwarf
7750 @itemx -gdwarf-@var{version}
7751 @opindex gdwarf
7752 Produce debugging information in DWARF format (if that is supported).
7753 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7754 for most targets is 4. DWARF Version 5 is only experimental.
7755
7756 Note that with DWARF Version 2, some ports require and always
7757 use some non-conflicting DWARF 3 extensions in the unwind tables.
7758
7759 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7760 for maximum benefit.
7761
7762 GCC no longer supports DWARF Version 1, which is substantially
7763 different than Version 2 and later. For historical reasons, some
7764 other DWARF-related options such as
7765 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7766 in their names, but apply to all currently-supported versions of DWARF.
7767
7768 @item -gstabs
7769 @opindex gstabs
7770 Produce debugging information in stabs format (if that is supported),
7771 without GDB extensions. This is the format used by DBX on most BSD
7772 systems. On MIPS, Alpha and System V Release 4 systems this option
7773 produces stabs debugging output that is not understood by DBX@.
7774 On System V Release 4 systems this option requires the GNU assembler.
7775
7776 @item -gstabs+
7777 @opindex gstabs+
7778 Produce debugging information in stabs format (if that is supported),
7779 using GNU extensions understood only by the GNU debugger (GDB)@. The
7780 use of these extensions is likely to make other debuggers crash or
7781 refuse to read the program.
7782
7783 @item -gxcoff
7784 @opindex gxcoff
7785 Produce debugging information in XCOFF format (if that is supported).
7786 This is the format used by the DBX debugger on IBM RS/6000 systems.
7787
7788 @item -gxcoff+
7789 @opindex gxcoff+
7790 Produce debugging information in XCOFF format (if that is supported),
7791 using GNU extensions understood only by the GNU debugger (GDB)@. The
7792 use of these extensions is likely to make other debuggers crash or
7793 refuse to read the program, and may cause assemblers other than the GNU
7794 assembler (GAS) to fail with an error.
7795
7796 @item -gvms
7797 @opindex gvms
7798 Produce debugging information in Alpha/VMS debug format (if that is
7799 supported). This is the format used by DEBUG on Alpha/VMS systems.
7800
7801 @item -g@var{level}
7802 @itemx -ggdb@var{level}
7803 @itemx -gstabs@var{level}
7804 @itemx -gxcoff@var{level}
7805 @itemx -gvms@var{level}
7806 Request debugging information and also use @var{level} to specify how
7807 much information. The default level is 2.
7808
7809 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7810 @option{-g}.
7811
7812 Level 1 produces minimal information, enough for making backtraces in
7813 parts of the program that you don't plan to debug. This includes
7814 descriptions of functions and external variables, and line number
7815 tables, but no information about local variables.
7816
7817 Level 3 includes extra information, such as all the macro definitions
7818 present in the program. Some debuggers support macro expansion when
7819 you use @option{-g3}.
7820
7821 If you use multiple @option{-g} options, with or without level numbers,
7822 the last such option is the one that is effective.
7823
7824 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7825 confusion with @option{-gdwarf-@var{level}}.
7826 Instead use an additional @option{-g@var{level}} option to change the
7827 debug level for DWARF.
7828
7829 @item -feliminate-unused-debug-symbols
7830 @opindex feliminate-unused-debug-symbols
7831 Produce debugging information in stabs format (if that is supported),
7832 for only symbols that are actually used.
7833
7834 @item -femit-class-debug-always
7835 @opindex femit-class-debug-always
7836 Instead of emitting debugging information for a C++ class in only one
7837 object file, emit it in all object files using the class. This option
7838 should be used only with debuggers that are unable to handle the way GCC
7839 normally emits debugging information for classes because using this
7840 option increases the size of debugging information by as much as a
7841 factor of two.
7842
7843 @item -fno-merge-debug-strings
7844 @opindex fmerge-debug-strings
7845 @opindex fno-merge-debug-strings
7846 Direct the linker to not merge together strings in the debugging
7847 information that are identical in different object files. Merging is
7848 not supported by all assemblers or linkers. Merging decreases the size
7849 of the debug information in the output file at the cost of increasing
7850 link processing time. Merging is enabled by default.
7851
7852 @item -fdebug-prefix-map=@var{old}=@var{new}
7853 @opindex fdebug-prefix-map
7854 When compiling files residing in directory @file{@var{old}}, record
7855 debugging information describing them as if the files resided in
7856 directory @file{@var{new}} instead. This can be used to replace a
7857 build-time path with an install-time path in the debug info. It can
7858 also be used to change an absolute path to a relative path by using
7859 @file{.} for @var{new}. This can give more reproducible builds, which
7860 are location independent, but may require an extra command to tell GDB
7861 where to find the source files. See also @option{-ffile-prefix-map}.
7862
7863 @item -fvar-tracking
7864 @opindex fvar-tracking
7865 Run variable tracking pass. It computes where variables are stored at each
7866 position in code. Better debugging information is then generated
7867 (if the debugging information format supports this information).
7868
7869 It is enabled by default when compiling with optimization (@option{-Os},
7870 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7871 the debug info format supports it.
7872
7873 @item -fvar-tracking-assignments
7874 @opindex fvar-tracking-assignments
7875 @opindex fno-var-tracking-assignments
7876 Annotate assignments to user variables early in the compilation and
7877 attempt to carry the annotations over throughout the compilation all the
7878 way to the end, in an attempt to improve debug information while
7879 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7880
7881 It can be enabled even if var-tracking is disabled, in which case
7882 annotations are created and maintained, but discarded at the end.
7883 By default, this flag is enabled together with @option{-fvar-tracking},
7884 except when selective scheduling is enabled.
7885
7886 @item -gsplit-dwarf
7887 @opindex gsplit-dwarf
7888 Separate as much DWARF debugging information as possible into a
7889 separate output file with the extension @file{.dwo}. This option allows
7890 the build system to avoid linking files with debug information. To
7891 be useful, this option requires a debugger capable of reading @file{.dwo}
7892 files.
7893
7894 @item -gdescribe-dies
7895 @opindex gdescribe-dies
7896 Add description attributes to some DWARF DIEs that have no name attribute,
7897 such as artificial variables, external references and call site
7898 parameter DIEs.
7899
7900 @item -gpubnames
7901 @opindex gpubnames
7902 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7903
7904 @item -ggnu-pubnames
7905 @opindex ggnu-pubnames
7906 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7907 suitable for conversion into a GDB@ index. This option is only useful
7908 with a linker that can produce GDB@ index version 7.
7909
7910 @item -fdebug-types-section
7911 @opindex fdebug-types-section
7912 @opindex fno-debug-types-section
7913 When using DWARF Version 4 or higher, type DIEs can be put into
7914 their own @code{.debug_types} section instead of making them part of the
7915 @code{.debug_info} section. It is more efficient to put them in a separate
7916 comdat section since the linker can then remove duplicates.
7917 But not all DWARF consumers support @code{.debug_types} sections yet
7918 and on some objects @code{.debug_types} produces larger instead of smaller
7919 debugging information.
7920
7921 @item -grecord-gcc-switches
7922 @itemx -gno-record-gcc-switches
7923 @opindex grecord-gcc-switches
7924 @opindex gno-record-gcc-switches
7925 This switch causes the command-line options used to invoke the
7926 compiler that may affect code generation to be appended to the
7927 DW_AT_producer attribute in DWARF debugging information. The options
7928 are concatenated with spaces separating them from each other and from
7929 the compiler version.
7930 It is enabled by default.
7931 See also @option{-frecord-gcc-switches} for another
7932 way of storing compiler options into the object file.
7933
7934 @item -gstrict-dwarf
7935 @opindex gstrict-dwarf
7936 Disallow using extensions of later DWARF standard version than selected
7937 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7938 DWARF extensions from later standard versions is allowed.
7939
7940 @item -gno-strict-dwarf
7941 @opindex gno-strict-dwarf
7942 Allow using extensions of later DWARF standard version than selected with
7943 @option{-gdwarf-@var{version}}.
7944
7945 @item -gas-loc-support
7946 @opindex gas-loc-support
7947 Inform the compiler that the assembler supports @code{.loc} directives.
7948 It may then use them for the assembler to generate DWARF2+ line number
7949 tables.
7950
7951 This is generally desirable, because assembler-generated line-number
7952 tables are a lot more compact than those the compiler can generate
7953 itself.
7954
7955 This option will be enabled by default if, at GCC configure time, the
7956 assembler was found to support such directives.
7957
7958 @item -gno-as-loc-support
7959 @opindex gno-as-loc-support
7960 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7961 line number tables are to be generated.
7962
7963 @item gas-locview-support
7964 @opindex gas-locview-support
7965 Inform the compiler that the assembler supports @code{view} assignment
7966 and reset assertion checking in @code{.loc} directives.
7967
7968 This option will be enabled by default if, at GCC configure time, the
7969 assembler was found to support them.
7970
7971 @item gno-as-locview-support
7972 Force GCC to assign view numbers internally, if
7973 @option{-gvariable-location-views} are explicitly requested.
7974
7975 @item -gcolumn-info
7976 @itemx -gno-column-info
7977 @opindex gcolumn-info
7978 @opindex gno-column-info
7979 Emit location column information into DWARF debugging information, rather
7980 than just file and line.
7981 This option is enabled by default.
7982
7983 @item -gstatement-frontiers
7984 @itemx -gno-statement-frontiers
7985 @opindex gstatement-frontiers
7986 @opindex gno-statement-frontiers
7987 This option causes GCC to create markers in the internal representation
7988 at the beginning of statements, and to keep them roughly in place
7989 throughout compilation, using them to guide the output of @code{is_stmt}
7990 markers in the line number table. This is enabled by default when
7991 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7992 @dots{}), and outputting DWARF 2 debug information at the normal level.
7993
7994 @item -gvariable-location-views
7995 @itemx -gvariable-location-views=incompat5
7996 @itemx -gno-variable-location-views
7997 @opindex gvariable-location-views
7998 @opindex gvariable-location-views=incompat5
7999 @opindex gno-variable-location-views
8000 Augment variable location lists with progressive view numbers implied
8001 from the line number table. This enables debug information consumers to
8002 inspect state at certain points of the program, even if no instructions
8003 associated with the corresponding source locations are present at that
8004 point. If the assembler lacks support for view numbers in line number
8005 tables, this will cause the compiler to emit the line number table,
8006 which generally makes them somewhat less compact. The augmented line
8007 number tables and location lists are fully backward-compatible, so they
8008 can be consumed by debug information consumers that are not aware of
8009 these augmentations, but they won't derive any benefit from them either.
8010
8011 This is enabled by default when outputting DWARF 2 debug information at
8012 the normal level, as long as there is assembler support,
8013 @option{-fvar-tracking-assignments} is enabled and
8014 @option{-gstrict-dwarf} is not. When assembler support is not
8015 available, this may still be enabled, but it will force GCC to output
8016 internal line number tables, and if
8017 @option{-ginternal-reset-location-views} is not enabled, that will most
8018 certainly lead to silently mismatching location views.
8019
8020 There is a proposed representation for view numbers that is not backward
8021 compatible with the location list format introduced in DWARF 5, that can
8022 be enabled with @option{-gvariable-location-views=incompat5}. This
8023 option may be removed in the future, is only provided as a reference
8024 implementation of the proposed representation. Debug information
8025 consumers are not expected to support this extended format, and they
8026 would be rendered unable to decode location lists using it.
8027
8028 @item -ginternal-reset-location-views
8029 @itemx -gnointernal-reset-location-views
8030 @opindex ginternal-reset-location-views
8031 @opindex gno-internal-reset-location-views
8032 Attempt to determine location views that can be omitted from location
8033 view lists. This requires the compiler to have very accurate insn
8034 length estimates, which isn't always the case, and it may cause
8035 incorrect view lists to be generated silently when using an assembler
8036 that does not support location view lists. The GNU assembler will flag
8037 any such error as a @code{view number mismatch}. This is only enabled
8038 on ports that define a reliable estimation function.
8039
8040 @item -ginline-points
8041 @itemx -gno-inline-points
8042 @opindex ginline-points
8043 @opindex gno-inline-points
8044 Generate extended debug information for inlined functions. Location
8045 view tracking markers are inserted at inlined entry points, so that
8046 address and view numbers can be computed and output in debug
8047 information. This can be enabled independently of location views, in
8048 which case the view numbers won't be output, but it can only be enabled
8049 along with statement frontiers, and it is only enabled by default if
8050 location views are enabled.
8051
8052 @item -gz@r{[}=@var{type}@r{]}
8053 @opindex gz
8054 Produce compressed debug sections in DWARF format, if that is supported.
8055 If @var{type} is not given, the default type depends on the capabilities
8056 of the assembler and linker used. @var{type} may be one of
8057 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8058 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8059 compression in traditional GNU format). If the linker doesn't support
8060 writing compressed debug sections, the option is rejected. Otherwise,
8061 if the assembler does not support them, @option{-gz} is silently ignored
8062 when producing object files.
8063
8064 @item -femit-struct-debug-baseonly
8065 @opindex femit-struct-debug-baseonly
8066 Emit debug information for struct-like types
8067 only when the base name of the compilation source file
8068 matches the base name of file in which the struct is defined.
8069
8070 This option substantially reduces the size of debugging information,
8071 but at significant potential loss in type information to the debugger.
8072 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8073 See @option{-femit-struct-debug-detailed} for more detailed control.
8074
8075 This option works only with DWARF debug output.
8076
8077 @item -femit-struct-debug-reduced
8078 @opindex femit-struct-debug-reduced
8079 Emit debug information for struct-like types
8080 only when the base name of the compilation source file
8081 matches the base name of file in which the type is defined,
8082 unless the struct is a template or defined in a system header.
8083
8084 This option significantly reduces the size of debugging information,
8085 with some potential loss in type information to the debugger.
8086 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8087 See @option{-femit-struct-debug-detailed} for more detailed control.
8088
8089 This option works only with DWARF debug output.
8090
8091 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8092 @opindex femit-struct-debug-detailed
8093 Specify the struct-like types
8094 for which the compiler generates debug information.
8095 The intent is to reduce duplicate struct debug information
8096 between different object files within the same program.
8097
8098 This option is a detailed version of
8099 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8100 which serves for most needs.
8101
8102 A specification has the syntax@*
8103 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8104
8105 The optional first word limits the specification to
8106 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8107 A struct type is used directly when it is the type of a variable, member.
8108 Indirect uses arise through pointers to structs.
8109 That is, when use of an incomplete struct is valid, the use is indirect.
8110 An example is
8111 @samp{struct one direct; struct two * indirect;}.
8112
8113 The optional second word limits the specification to
8114 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8115 Generic structs are a bit complicated to explain.
8116 For C++, these are non-explicit specializations of template classes,
8117 or non-template classes within the above.
8118 Other programming languages have generics,
8119 but @option{-femit-struct-debug-detailed} does not yet implement them.
8120
8121 The third word specifies the source files for those
8122 structs for which the compiler should emit debug information.
8123 The values @samp{none} and @samp{any} have the normal meaning.
8124 The value @samp{base} means that
8125 the base of name of the file in which the type declaration appears
8126 must match the base of the name of the main compilation file.
8127 In practice, this means that when compiling @file{foo.c}, debug information
8128 is generated for types declared in that file and @file{foo.h},
8129 but not other header files.
8130 The value @samp{sys} means those types satisfying @samp{base}
8131 or declared in system or compiler headers.
8132
8133 You may need to experiment to determine the best settings for your application.
8134
8135 The default is @option{-femit-struct-debug-detailed=all}.
8136
8137 This option works only with DWARF debug output.
8138
8139 @item -fno-dwarf2-cfi-asm
8140 @opindex fdwarf2-cfi-asm
8141 @opindex fno-dwarf2-cfi-asm
8142 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8143 instead of using GAS @code{.cfi_*} directives.
8144
8145 @item -fno-eliminate-unused-debug-types
8146 @opindex feliminate-unused-debug-types
8147 @opindex fno-eliminate-unused-debug-types
8148 Normally, when producing DWARF output, GCC avoids producing debug symbol
8149 output for types that are nowhere used in the source file being compiled.
8150 Sometimes it is useful to have GCC emit debugging
8151 information for all types declared in a compilation
8152 unit, regardless of whether or not they are actually used
8153 in that compilation unit, for example
8154 if, in the debugger, you want to cast a value to a type that is
8155 not actually used in your program (but is declared). More often,
8156 however, this results in a significant amount of wasted space.
8157 @end table
8158
8159 @node Optimize Options
8160 @section Options That Control Optimization
8161 @cindex optimize options
8162 @cindex options, optimization
8163
8164 These options control various sorts of optimizations.
8165
8166 Without any optimization option, the compiler's goal is to reduce the
8167 cost of compilation and to make debugging produce the expected
8168 results. Statements are independent: if you stop the program with a
8169 breakpoint between statements, you can then assign a new value to any
8170 variable or change the program counter to any other statement in the
8171 function and get exactly the results you expect from the source
8172 code.
8173
8174 Turning on optimization flags makes the compiler attempt to improve
8175 the performance and/or code size at the expense of compilation time
8176 and possibly the ability to debug the program.
8177
8178 The compiler performs optimization based on the knowledge it has of the
8179 program. Compiling multiple files at once to a single output file mode allows
8180 the compiler to use information gained from all of the files when compiling
8181 each of them.
8182
8183 Not all optimizations are controlled directly by a flag. Only
8184 optimizations that have a flag are listed in this section.
8185
8186 Most optimizations are completely disabled at @option{-O0} or if an
8187 @option{-O} level is not set on the command line, even if individual
8188 optimization flags are specified. Similarly, @option{-Og} suppresses
8189 many optimization passes.
8190
8191 Depending on the target and how GCC was configured, a slightly different
8192 set of optimizations may be enabled at each @option{-O} level than
8193 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8194 to find out the exact set of optimizations that are enabled at each level.
8195 @xref{Overall Options}, for examples.
8196
8197 @table @gcctabopt
8198 @item -O
8199 @itemx -O1
8200 @opindex O
8201 @opindex O1
8202 Optimize. Optimizing compilation takes somewhat more time, and a lot
8203 more memory for a large function.
8204
8205 With @option{-O}, the compiler tries to reduce code size and execution
8206 time, without performing any optimizations that take a great deal of
8207 compilation time.
8208
8209 @c Note that in addition to the default_options_table list in opts.c,
8210 @c several optimization flags default to true but control optimization
8211 @c passes that are explicitly disabled at -O0.
8212
8213 @option{-O} turns on the following optimization flags:
8214
8215 @c Please keep the following list alphabetized.
8216 @gccoptlist{-fauto-inc-dec @gol
8217 -fbranch-count-reg @gol
8218 -fcombine-stack-adjustments @gol
8219 -fcompare-elim @gol
8220 -fcprop-registers @gol
8221 -fdce @gol
8222 -fdefer-pop @gol
8223 -fdelayed-branch @gol
8224 -fdse @gol
8225 -fforward-propagate @gol
8226 -fguess-branch-probability @gol
8227 -fif-conversion @gol
8228 -fif-conversion2 @gol
8229 -finline-functions-called-once @gol
8230 -fipa-profile @gol
8231 -fipa-pure-const @gol
8232 -fipa-reference @gol
8233 -fipa-reference-addressable @gol
8234 -fmerge-constants @gol
8235 -fmove-loop-invariants @gol
8236 -fomit-frame-pointer @gol
8237 -freorder-blocks @gol
8238 -fshrink-wrap @gol
8239 -fshrink-wrap-separate @gol
8240 -fsplit-wide-types @gol
8241 -fssa-backprop @gol
8242 -fssa-phiopt @gol
8243 -ftree-bit-ccp @gol
8244 -ftree-ccp @gol
8245 -ftree-ch @gol
8246 -ftree-coalesce-vars @gol
8247 -ftree-copy-prop @gol
8248 -ftree-dce @gol
8249 -ftree-dominator-opts @gol
8250 -ftree-dse @gol
8251 -ftree-forwprop @gol
8252 -ftree-fre @gol
8253 -ftree-phiprop @gol
8254 -ftree-pta @gol
8255 -ftree-scev-cprop @gol
8256 -ftree-sink @gol
8257 -ftree-slsr @gol
8258 -ftree-sra @gol
8259 -ftree-ter @gol
8260 -funit-at-a-time}
8261
8262 @item -O2
8263 @opindex O2
8264 Optimize even more. GCC performs nearly all supported optimizations
8265 that do not involve a space-speed tradeoff.
8266 As compared to @option{-O}, this option increases both compilation time
8267 and the performance of the generated code.
8268
8269 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8270 also turns on the following optimization flags:
8271
8272 @c Please keep the following list alphabetized!
8273 @gccoptlist{-falign-functions -falign-jumps @gol
8274 -falign-labels -falign-loops @gol
8275 -fcaller-saves @gol
8276 -fcode-hoisting @gol
8277 -fcrossjumping @gol
8278 -fcse-follow-jumps -fcse-skip-blocks @gol
8279 -fdelete-null-pointer-checks @gol
8280 -fdevirtualize -fdevirtualize-speculatively @gol
8281 -fexpensive-optimizations @gol
8282 -fgcse -fgcse-lm @gol
8283 -fhoist-adjacent-loads @gol
8284 -finline-small-functions @gol
8285 -findirect-inlining @gol
8286 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8287 -fipa-ra -fipa-sra -fipa-vrp @gol
8288 -fisolate-erroneous-paths-dereference @gol
8289 -flra-remat @gol
8290 -foptimize-sibling-calls @gol
8291 -foptimize-strlen @gol
8292 -fpartial-inlining @gol
8293 -fpeephole2 @gol
8294 -freorder-blocks-algorithm=stc @gol
8295 -freorder-blocks-and-partition -freorder-functions @gol
8296 -frerun-cse-after-loop @gol
8297 -fschedule-insns -fschedule-insns2 @gol
8298 -fsched-interblock -fsched-spec @gol
8299 -fstore-merging @gol
8300 -fstrict-aliasing @gol
8301 -fthread-jumps @gol
8302 -ftree-builtin-call-dce @gol
8303 -ftree-pre @gol
8304 -ftree-switch-conversion -ftree-tail-merge @gol
8305 -ftree-vrp}
8306
8307 Please note the warning under @option{-fgcse} about
8308 invoking @option{-O2} on programs that use computed gotos.
8309
8310 @item -O3
8311 @opindex O3
8312 Optimize yet more. @option{-O3} turns on all optimizations specified
8313 by @option{-O2} and also turns on the following optimization flags:
8314
8315 @c Please keep the following list alphabetized!
8316 @gccoptlist{-fgcse-after-reload @gol
8317 -finline-functions @gol
8318 -fipa-cp-clone
8319 -floop-interchange @gol
8320 -floop-unroll-and-jam @gol
8321 -fpeel-loops @gol
8322 -fpredictive-commoning @gol
8323 -fsplit-paths @gol
8324 -ftree-loop-distribute-patterns @gol
8325 -ftree-loop-distribution @gol
8326 -ftree-loop-vectorize @gol
8327 -ftree-partial-pre @gol
8328 -ftree-slp-vectorize @gol
8329 -funswitch-loops @gol
8330 -fvect-cost-model @gol
8331 -fversion-loops-for-strides}
8332
8333 @item -O0
8334 @opindex O0
8335 Reduce compilation time and make debugging produce the expected
8336 results. This is the default.
8337
8338 @item -Os
8339 @opindex Os
8340 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8341 except those that often increase code size:
8342
8343 @gccoptlist{-falign-functions -falign-jumps @gol
8344 -falign-labels -falign-loops @gol
8345 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8346
8347 It also enables @option{-finline-functions}, causes the compiler to tune for
8348 code size rather than execution speed, and performs further optimizations
8349 designed to reduce code size.
8350
8351 @item -Ofast
8352 @opindex Ofast
8353 Disregard strict standards compliance. @option{-Ofast} enables all
8354 @option{-O3} optimizations. It also enables optimizations that are not
8355 valid for all standard-compliant programs.
8356 It turns on @option{-ffast-math} and the Fortran-specific
8357 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8358 specified, and @option{-fno-protect-parens}.
8359
8360 @item -Og
8361 @opindex Og
8362 Optimize debugging experience. @option{-Og} should be the optimization
8363 level of choice for the standard edit-compile-debug cycle, offering
8364 a reasonable level of optimization while maintaining fast compilation
8365 and a good debugging experience. It is a better choice than @option{-O0}
8366 for producing debuggable code because some compiler passes
8367 that collect debug information are disabled at @option{-O0}.
8368
8369 Like @option{-O0}, @option{-Og} completely disables a number of
8370 optimization passes so that individual options controlling them have
8371 no effect. Otherwise @option{-Og} enables all @option{-O1}
8372 optimization flags except for those that may interfere with debugging:
8373
8374 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8375 -fif-conversion -fif-conversion2 @gol
8376 -finline-functions-called-once @gol
8377 -fmove-loop-invariants -fssa-phiopt @gol
8378 -ftree-bit-ccp -ftree-pta -ftree-sra}
8379
8380 @end table
8381
8382 If you use multiple @option{-O} options, with or without level numbers,
8383 the last such option is the one that is effective.
8384
8385 Options of the form @option{-f@var{flag}} specify machine-independent
8386 flags. Most flags have both positive and negative forms; the negative
8387 form of @option{-ffoo} is @option{-fno-foo}. In the table
8388 below, only one of the forms is listed---the one you typically
8389 use. You can figure out the other form by either removing @samp{no-}
8390 or adding it.
8391
8392 The following options control specific optimizations. They are either
8393 activated by @option{-O} options or are related to ones that are. You
8394 can use the following flags in the rare cases when ``fine-tuning'' of
8395 optimizations to be performed is desired.
8396
8397 @table @gcctabopt
8398 @item -fno-defer-pop
8399 @opindex fno-defer-pop
8400 @opindex fdefer-pop
8401 For machines that must pop arguments after a function call, always pop
8402 the arguments as soon as each function returns.
8403 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8404 this allows the compiler to let arguments accumulate on the stack for several
8405 function calls and pop them all at once.
8406
8407 @item -fforward-propagate
8408 @opindex fforward-propagate
8409 Perform a forward propagation pass on RTL@. The pass tries to combine two
8410 instructions and checks if the result can be simplified. If loop unrolling
8411 is active, two passes are performed and the second is scheduled after
8412 loop unrolling.
8413
8414 This option is enabled by default at optimization levels @option{-O},
8415 @option{-O2}, @option{-O3}, @option{-Os}.
8416
8417 @item -ffp-contract=@var{style}
8418 @opindex ffp-contract
8419 @option{-ffp-contract=off} disables floating-point expression contraction.
8420 @option{-ffp-contract=fast} enables floating-point expression contraction
8421 such as forming of fused multiply-add operations if the target has
8422 native support for them.
8423 @option{-ffp-contract=on} enables floating-point expression contraction
8424 if allowed by the language standard. This is currently not implemented
8425 and treated equal to @option{-ffp-contract=off}.
8426
8427 The default is @option{-ffp-contract=fast}.
8428
8429 @item -fomit-frame-pointer
8430 @opindex fomit-frame-pointer
8431 Omit the frame pointer in functions that don't need one. This avoids the
8432 instructions to save, set up and restore the frame pointer; on many targets
8433 it also makes an extra register available.
8434
8435 On some targets this flag has no effect because the standard calling sequence
8436 always uses a frame pointer, so it cannot be omitted.
8437
8438 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8439 is used in all functions. Several targets always omit the frame pointer in
8440 leaf functions.
8441
8442 Enabled by default at @option{-O} and higher.
8443
8444 @item -foptimize-sibling-calls
8445 @opindex foptimize-sibling-calls
8446 Optimize sibling and tail recursive calls.
8447
8448 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8449
8450 @item -foptimize-strlen
8451 @opindex foptimize-strlen
8452 Optimize various standard C string functions (e.g.@: @code{strlen},
8453 @code{strchr} or @code{strcpy}) and
8454 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8455
8456 Enabled at levels @option{-O2}, @option{-O3}.
8457
8458 @item -fno-inline
8459 @opindex fno-inline
8460 @opindex finline
8461 Do not expand any functions inline apart from those marked with
8462 the @code{always_inline} attribute. This is the default when not
8463 optimizing.
8464
8465 Single functions can be exempted from inlining by marking them
8466 with the @code{noinline} attribute.
8467
8468 @item -finline-small-functions
8469 @opindex finline-small-functions
8470 Integrate functions into their callers when their body is smaller than expected
8471 function call code (so overall size of program gets smaller). The compiler
8472 heuristically decides which functions are simple enough to be worth integrating
8473 in this way. This inlining applies to all functions, even those not declared
8474 inline.
8475
8476 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8477
8478 @item -findirect-inlining
8479 @opindex findirect-inlining
8480 Inline also indirect calls that are discovered to be known at compile
8481 time thanks to previous inlining. This option has any effect only
8482 when inlining itself is turned on by the @option{-finline-functions}
8483 or @option{-finline-small-functions} options.
8484
8485 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8486
8487 @item -finline-functions
8488 @opindex finline-functions
8489 Consider all functions for inlining, even if they are not declared inline.
8490 The compiler heuristically decides which functions are worth integrating
8491 in this way.
8492
8493 If all calls to a given function are integrated, and the function is
8494 declared @code{static}, then the function is normally not output as
8495 assembler code in its own right.
8496
8497 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8498 by @option{-fprofile-use} and @option{-fauto-profile}.
8499
8500 @item -finline-functions-called-once
8501 @opindex finline-functions-called-once
8502 Consider all @code{static} functions called once for inlining into their
8503 caller even if they are not marked @code{inline}. If a call to a given
8504 function is integrated, then the function is not output as assembler code
8505 in its own right.
8506
8507 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8508 but not @option{-Og}.
8509
8510 @item -fearly-inlining
8511 @opindex fearly-inlining
8512 Inline functions marked by @code{always_inline} and functions whose body seems
8513 smaller than the function call overhead early before doing
8514 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8515 makes profiling significantly cheaper and usually inlining faster on programs
8516 having large chains of nested wrapper functions.
8517
8518 Enabled by default.
8519
8520 @item -fipa-sra
8521 @opindex fipa-sra
8522 Perform interprocedural scalar replacement of aggregates, removal of
8523 unused parameters and replacement of parameters passed by reference
8524 by parameters passed by value.
8525
8526 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8527
8528 @item -finline-limit=@var{n}
8529 @opindex finline-limit
8530 By default, GCC limits the size of functions that can be inlined. This flag
8531 allows coarse control of this limit. @var{n} is the size of functions that
8532 can be inlined in number of pseudo instructions.
8533
8534 Inlining is actually controlled by a number of parameters, which may be
8535 specified individually by using @option{--param @var{name}=@var{value}}.
8536 The @option{-finline-limit=@var{n}} option sets some of these parameters
8537 as follows:
8538
8539 @table @gcctabopt
8540 @item max-inline-insns-single
8541 is set to @var{n}/2.
8542 @item max-inline-insns-auto
8543 is set to @var{n}/2.
8544 @end table
8545
8546 See below for a documentation of the individual
8547 parameters controlling inlining and for the defaults of these parameters.
8548
8549 @emph{Note:} there may be no value to @option{-finline-limit} that results
8550 in default behavior.
8551
8552 @emph{Note:} pseudo instruction represents, in this particular context, an
8553 abstract measurement of function's size. In no way does it represent a count
8554 of assembly instructions and as such its exact meaning might change from one
8555 release to an another.
8556
8557 @item -fno-keep-inline-dllexport
8558 @opindex fno-keep-inline-dllexport
8559 @opindex fkeep-inline-dllexport
8560 This is a more fine-grained version of @option{-fkeep-inline-functions},
8561 which applies only to functions that are declared using the @code{dllexport}
8562 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8563 Functions}.
8564
8565 @item -fkeep-inline-functions
8566 @opindex fkeep-inline-functions
8567 In C, emit @code{static} functions that are declared @code{inline}
8568 into the object file, even if the function has been inlined into all
8569 of its callers. This switch does not affect functions using the
8570 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8571 inline functions into the object file.
8572
8573 @item -fkeep-static-functions
8574 @opindex fkeep-static-functions
8575 Emit @code{static} functions into the object file, even if the function
8576 is never used.
8577
8578 @item -fkeep-static-consts
8579 @opindex fkeep-static-consts
8580 Emit variables declared @code{static const} when optimization isn't turned
8581 on, even if the variables aren't referenced.
8582
8583 GCC enables this option by default. If you want to force the compiler to
8584 check if a variable is referenced, regardless of whether or not
8585 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8586
8587 @item -fmerge-constants
8588 @opindex fmerge-constants
8589 Attempt to merge identical constants (string constants and floating-point
8590 constants) across compilation units.
8591
8592 This option is the default for optimized compilation if the assembler and
8593 linker support it. Use @option{-fno-merge-constants} to inhibit this
8594 behavior.
8595
8596 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8597
8598 @item -fmerge-all-constants
8599 @opindex fmerge-all-constants
8600 Attempt to merge identical constants and identical variables.
8601
8602 This option implies @option{-fmerge-constants}. In addition to
8603 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8604 arrays or initialized constant variables with integral or floating-point
8605 types. Languages like C or C++ require each variable, including multiple
8606 instances of the same variable in recursive calls, to have distinct locations,
8607 so using this option results in non-conforming
8608 behavior.
8609
8610 @item -fmodulo-sched
8611 @opindex fmodulo-sched
8612 Perform swing modulo scheduling immediately before the first scheduling
8613 pass. This pass looks at innermost loops and reorders their
8614 instructions by overlapping different iterations.
8615
8616 @item -fmodulo-sched-allow-regmoves
8617 @opindex fmodulo-sched-allow-regmoves
8618 Perform more aggressive SMS-based modulo scheduling with register moves
8619 allowed. By setting this flag certain anti-dependences edges are
8620 deleted, which triggers the generation of reg-moves based on the
8621 life-range analysis. This option is effective only with
8622 @option{-fmodulo-sched} enabled.
8623
8624 @item -fno-branch-count-reg
8625 @opindex fno-branch-count-reg
8626 @opindex fbranch-count-reg
8627 Disable the optimization pass that scans for opportunities to use
8628 ``decrement and branch'' instructions on a count register instead of
8629 instruction sequences that decrement a register, compare it against zero, and
8630 then branch based upon the result. This option is only meaningful on
8631 architectures that support such instructions, which include x86, PowerPC,
8632 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8633 doesn't remove the decrement and branch instructions from the generated
8634 instruction stream introduced by other optimization passes.
8635
8636 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8637 except for @option{-Og}.
8638
8639 @item -fno-function-cse
8640 @opindex fno-function-cse
8641 @opindex ffunction-cse
8642 Do not put function addresses in registers; make each instruction that
8643 calls a constant function contain the function's address explicitly.
8644
8645 This option results in less efficient code, but some strange hacks
8646 that alter the assembler output may be confused by the optimizations
8647 performed when this option is not used.
8648
8649 The default is @option{-ffunction-cse}
8650
8651 @item -fno-zero-initialized-in-bss
8652 @opindex fno-zero-initialized-in-bss
8653 @opindex fzero-initialized-in-bss
8654 If the target supports a BSS section, GCC by default puts variables that
8655 are initialized to zero into BSS@. This can save space in the resulting
8656 code.
8657
8658 This option turns off this behavior because some programs explicitly
8659 rely on variables going to the data section---e.g., so that the
8660 resulting executable can find the beginning of that section and/or make
8661 assumptions based on that.
8662
8663 The default is @option{-fzero-initialized-in-bss}.
8664
8665 @item -fthread-jumps
8666 @opindex fthread-jumps
8667 Perform optimizations that check to see if a jump branches to a
8668 location where another comparison subsumed by the first is found. If
8669 so, the first branch is redirected to either the destination of the
8670 second branch or a point immediately following it, depending on whether
8671 the condition is known to be true or false.
8672
8673 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8674
8675 @item -fsplit-wide-types
8676 @opindex fsplit-wide-types
8677 When using a type that occupies multiple registers, such as @code{long
8678 long} on a 32-bit system, split the registers apart and allocate them
8679 independently. This normally generates better code for those types,
8680 but may make debugging more difficult.
8681
8682 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8683 @option{-Os}.
8684
8685 @item -fcse-follow-jumps
8686 @opindex fcse-follow-jumps
8687 In common subexpression elimination (CSE), scan through jump instructions
8688 when the target of the jump is not reached by any other path. For
8689 example, when CSE encounters an @code{if} statement with an
8690 @code{else} clause, CSE follows the jump when the condition
8691 tested is false.
8692
8693 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8694
8695 @item -fcse-skip-blocks
8696 @opindex fcse-skip-blocks
8697 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8698 follow jumps that conditionally skip over blocks. When CSE
8699 encounters a simple @code{if} statement with no else clause,
8700 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8701 body of the @code{if}.
8702
8703 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8704
8705 @item -frerun-cse-after-loop
8706 @opindex frerun-cse-after-loop
8707 Re-run common subexpression elimination after loop optimizations are
8708 performed.
8709
8710 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8711
8712 @item -fgcse
8713 @opindex fgcse
8714 Perform a global common subexpression elimination pass.
8715 This pass also performs global constant and copy propagation.
8716
8717 @emph{Note:} When compiling a program using computed gotos, a GCC
8718 extension, you may get better run-time performance if you disable
8719 the global common subexpression elimination pass by adding
8720 @option{-fno-gcse} to the command line.
8721
8722 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8723
8724 @item -fgcse-lm
8725 @opindex fgcse-lm
8726 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8727 attempts to move loads that are only killed by stores into themselves. This
8728 allows a loop containing a load/store sequence to be changed to a load outside
8729 the loop, and a copy/store within the loop.
8730
8731 Enabled by default when @option{-fgcse} is enabled.
8732
8733 @item -fgcse-sm
8734 @opindex fgcse-sm
8735 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8736 global common subexpression elimination. This pass attempts to move
8737 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8738 loops containing a load/store sequence can be changed to a load before
8739 the loop and a store after the loop.
8740
8741 Not enabled at any optimization level.
8742
8743 @item -fgcse-las
8744 @opindex fgcse-las
8745 When @option{-fgcse-las} is enabled, the global common subexpression
8746 elimination pass eliminates redundant loads that come after stores to the
8747 same memory location (both partial and full redundancies).
8748
8749 Not enabled at any optimization level.
8750
8751 @item -fgcse-after-reload
8752 @opindex fgcse-after-reload
8753 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8754 pass is performed after reload. The purpose of this pass is to clean up
8755 redundant spilling.
8756
8757 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8758
8759 @item -faggressive-loop-optimizations
8760 @opindex faggressive-loop-optimizations
8761 This option tells the loop optimizer to use language constraints to
8762 derive bounds for the number of iterations of a loop. This assumes that
8763 loop code does not invoke undefined behavior by for example causing signed
8764 integer overflows or out-of-bound array accesses. The bounds for the
8765 number of iterations of a loop are used to guide loop unrolling and peeling
8766 and loop exit test optimizations.
8767 This option is enabled by default.
8768
8769 @item -funconstrained-commons
8770 @opindex funconstrained-commons
8771 This option tells the compiler that variables declared in common blocks
8772 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8773 prevents certain optimizations that depend on knowing the array bounds.
8774
8775 @item -fcrossjumping
8776 @opindex fcrossjumping
8777 Perform cross-jumping transformation.
8778 This transformation unifies equivalent code and saves code size. The
8779 resulting code may or may not perform better than without cross-jumping.
8780
8781 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8782
8783 @item -fauto-inc-dec
8784 @opindex fauto-inc-dec
8785 Combine increments or decrements of addresses with memory accesses.
8786 This pass is always skipped on architectures that do not have
8787 instructions to support this. Enabled by default at @option{-O} and
8788 higher on architectures that support this.
8789
8790 @item -fdce
8791 @opindex fdce
8792 Perform dead code elimination (DCE) on RTL@.
8793 Enabled by default at @option{-O} and higher.
8794
8795 @item -fdse
8796 @opindex fdse
8797 Perform dead store elimination (DSE) on RTL@.
8798 Enabled by default at @option{-O} and higher.
8799
8800 @item -fif-conversion
8801 @opindex fif-conversion
8802 Attempt to transform conditional jumps into branch-less equivalents. This
8803 includes use of conditional moves, min, max, set flags and abs instructions, and
8804 some tricks doable by standard arithmetics. The use of conditional execution
8805 on chips where it is available is controlled by @option{-fif-conversion2}.
8806
8807 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8808 not with @option{-Og}.
8809
8810 @item -fif-conversion2
8811 @opindex fif-conversion2
8812 Use conditional execution (where available) to transform conditional jumps into
8813 branch-less equivalents.
8814
8815 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8816 not with @option{-Og}.
8817
8818 @item -fdeclone-ctor-dtor
8819 @opindex fdeclone-ctor-dtor
8820 The C++ ABI requires multiple entry points for constructors and
8821 destructors: one for a base subobject, one for a complete object, and
8822 one for a virtual destructor that calls operator delete afterwards.
8823 For a hierarchy with virtual bases, the base and complete variants are
8824 clones, which means two copies of the function. With this option, the
8825 base and complete variants are changed to be thunks that call a common
8826 implementation.
8827
8828 Enabled by @option{-Os}.
8829
8830 @item -fdelete-null-pointer-checks
8831 @opindex fdelete-null-pointer-checks
8832 Assume that programs cannot safely dereference null pointers, and that
8833 no code or data element resides at address zero.
8834 This option enables simple constant
8835 folding optimizations at all optimization levels. In addition, other
8836 optimization passes in GCC use this flag to control global dataflow
8837 analyses that eliminate useless checks for null pointers; these assume
8838 that a memory access to address zero always results in a trap, so
8839 that if a pointer is checked after it has already been dereferenced,
8840 it cannot be null.
8841
8842 Note however that in some environments this assumption is not true.
8843 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8844 for programs that depend on that behavior.
8845
8846 This option is enabled by default on most targets. On Nios II ELF, it
8847 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8848
8849 Passes that use the dataflow information
8850 are enabled independently at different optimization levels.
8851
8852 @item -fdevirtualize
8853 @opindex fdevirtualize
8854 Attempt to convert calls to virtual functions to direct calls. This
8855 is done both within a procedure and interprocedurally as part of
8856 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8857 propagation (@option{-fipa-cp}).
8858 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8859
8860 @item -fdevirtualize-speculatively
8861 @opindex fdevirtualize-speculatively
8862 Attempt to convert calls to virtual functions to speculative direct calls.
8863 Based on the analysis of the type inheritance graph, determine for a given call
8864 the set of likely targets. If the set is small, preferably of size 1, change
8865 the call into a conditional deciding between direct and indirect calls. The
8866 speculative calls enable more optimizations, such as inlining. When they seem
8867 useless after further optimization, they are converted back into original form.
8868
8869 @item -fdevirtualize-at-ltrans
8870 @opindex fdevirtualize-at-ltrans
8871 Stream extra information needed for aggressive devirtualization when running
8872 the link-time optimizer in local transformation mode.
8873 This option enables more devirtualization but
8874 significantly increases the size of streamed data. For this reason it is
8875 disabled by default.
8876
8877 @item -fexpensive-optimizations
8878 @opindex fexpensive-optimizations
8879 Perform a number of minor optimizations that are relatively expensive.
8880
8881 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8882
8883 @item -free
8884 @opindex free
8885 Attempt to remove redundant extension instructions. This is especially
8886 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8887 registers after writing to their lower 32-bit half.
8888
8889 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8890 @option{-O3}, @option{-Os}.
8891
8892 @item -fno-lifetime-dse
8893 @opindex fno-lifetime-dse
8894 @opindex flifetime-dse
8895 In C++ the value of an object is only affected by changes within its
8896 lifetime: when the constructor begins, the object has an indeterminate
8897 value, and any changes during the lifetime of the object are dead when
8898 the object is destroyed. Normally dead store elimination will take
8899 advantage of this; if your code relies on the value of the object
8900 storage persisting beyond the lifetime of the object, you can use this
8901 flag to disable this optimization. To preserve stores before the
8902 constructor starts (e.g.@: because your operator new clears the object
8903 storage) but still treat the object as dead after the destructor you,
8904 can use @option{-flifetime-dse=1}. The default behavior can be
8905 explicitly selected with @option{-flifetime-dse=2}.
8906 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8907
8908 @item -flive-range-shrinkage
8909 @opindex flive-range-shrinkage
8910 Attempt to decrease register pressure through register live range
8911 shrinkage. This is helpful for fast processors with small or moderate
8912 size register sets.
8913
8914 @item -fira-algorithm=@var{algorithm}
8915 @opindex fira-algorithm
8916 Use the specified coloring algorithm for the integrated register
8917 allocator. The @var{algorithm} argument can be @samp{priority}, which
8918 specifies Chow's priority coloring, or @samp{CB}, which specifies
8919 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8920 for all architectures, but for those targets that do support it, it is
8921 the default because it generates better code.
8922
8923 @item -fira-region=@var{region}
8924 @opindex fira-region
8925 Use specified regions for the integrated register allocator. The
8926 @var{region} argument should be one of the following:
8927
8928 @table @samp
8929
8930 @item all
8931 Use all loops as register allocation regions.
8932 This can give the best results for machines with a small and/or
8933 irregular register set.
8934
8935 @item mixed
8936 Use all loops except for loops with small register pressure
8937 as the regions. This value usually gives
8938 the best results in most cases and for most architectures,
8939 and is enabled by default when compiling with optimization for speed
8940 (@option{-O}, @option{-O2}, @dots{}).
8941
8942 @item one
8943 Use all functions as a single region.
8944 This typically results in the smallest code size, and is enabled by default for
8945 @option{-Os} or @option{-O0}.
8946
8947 @end table
8948
8949 @item -fira-hoist-pressure
8950 @opindex fira-hoist-pressure
8951 Use IRA to evaluate register pressure in the code hoisting pass for
8952 decisions to hoist expressions. This option usually results in smaller
8953 code, but it can slow the compiler down.
8954
8955 This option is enabled at level @option{-Os} for all targets.
8956
8957 @item -fira-loop-pressure
8958 @opindex fira-loop-pressure
8959 Use IRA to evaluate register pressure in loops for decisions to move
8960 loop invariants. This option usually results in generation
8961 of faster and smaller code on machines with large register files (>= 32
8962 registers), but it can slow the compiler down.
8963
8964 This option is enabled at level @option{-O3} for some targets.
8965
8966 @item -fno-ira-share-save-slots
8967 @opindex fno-ira-share-save-slots
8968 @opindex fira-share-save-slots
8969 Disable sharing of stack slots used for saving call-used hard
8970 registers living through a call. Each hard register gets a
8971 separate stack slot, and as a result function stack frames are
8972 larger.
8973
8974 @item -fno-ira-share-spill-slots
8975 @opindex fno-ira-share-spill-slots
8976 @opindex fira-share-spill-slots
8977 Disable sharing of stack slots allocated for pseudo-registers. Each
8978 pseudo-register that does not get a hard register gets a separate
8979 stack slot, and as a result function stack frames are larger.
8980
8981 @item -flra-remat
8982 @opindex flra-remat
8983 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8984 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8985 values if it is profitable.
8986
8987 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8988
8989 @item -fdelayed-branch
8990 @opindex fdelayed-branch
8991 If supported for the target machine, attempt to reorder instructions
8992 to exploit instruction slots available after delayed branch
8993 instructions.
8994
8995 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8996 but not at @option{-Og}.
8997
8998 @item -fschedule-insns
8999 @opindex fschedule-insns
9000 If supported for the target machine, attempt to reorder instructions to
9001 eliminate execution stalls due to required data being unavailable. This
9002 helps machines that have slow floating point or memory load instructions
9003 by allowing other instructions to be issued until the result of the load
9004 or floating-point instruction is required.
9005
9006 Enabled at levels @option{-O2}, @option{-O3}.
9007
9008 @item -fschedule-insns2
9009 @opindex fschedule-insns2
9010 Similar to @option{-fschedule-insns}, but requests an additional pass of
9011 instruction scheduling after register allocation has been done. This is
9012 especially useful on machines with a relatively small number of
9013 registers and where memory load instructions take more than one cycle.
9014
9015 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9016
9017 @item -fno-sched-interblock
9018 @opindex fno-sched-interblock
9019 @opindex fsched-interblock
9020 Disable instruction scheduling across basic blocks, which
9021 is normally enabled when scheduling before register allocation, i.e.@:
9022 with @option{-fschedule-insns} or at @option{-O2} or higher.
9023
9024 @item -fno-sched-spec
9025 @opindex fno-sched-spec
9026 @opindex fsched-spec
9027 Disable speculative motion of non-load instructions, which
9028 is normally enabled when scheduling before register allocation, i.e.@:
9029 with @option{-fschedule-insns} or at @option{-O2} or higher.
9030
9031 @item -fsched-pressure
9032 @opindex fsched-pressure
9033 Enable register pressure sensitive insn scheduling before register
9034 allocation. This only makes sense when scheduling before register
9035 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9036 @option{-O2} or higher. Usage of this option can improve the
9037 generated code and decrease its size by preventing register pressure
9038 increase above the number of available hard registers and subsequent
9039 spills in register allocation.
9040
9041 @item -fsched-spec-load
9042 @opindex fsched-spec-load
9043 Allow speculative motion of some load instructions. This only makes
9044 sense when scheduling before register allocation, i.e.@: with
9045 @option{-fschedule-insns} or at @option{-O2} or higher.
9046
9047 @item -fsched-spec-load-dangerous
9048 @opindex fsched-spec-load-dangerous
9049 Allow speculative motion of more load instructions. This only makes
9050 sense when scheduling before register allocation, i.e.@: with
9051 @option{-fschedule-insns} or at @option{-O2} or higher.
9052
9053 @item -fsched-stalled-insns
9054 @itemx -fsched-stalled-insns=@var{n}
9055 @opindex fsched-stalled-insns
9056 Define how many insns (if any) can be moved prematurely from the queue
9057 of stalled insns into the ready list during the second scheduling pass.
9058 @option{-fno-sched-stalled-insns} means that no insns are moved
9059 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9060 on how many queued insns can be moved prematurely.
9061 @option{-fsched-stalled-insns} without a value is equivalent to
9062 @option{-fsched-stalled-insns=1}.
9063
9064 @item -fsched-stalled-insns-dep
9065 @itemx -fsched-stalled-insns-dep=@var{n}
9066 @opindex fsched-stalled-insns-dep
9067 Define how many insn groups (cycles) are examined for a dependency
9068 on a stalled insn that is a candidate for premature removal from the queue
9069 of stalled insns. This has an effect only during the second scheduling pass,
9070 and only if @option{-fsched-stalled-insns} is used.
9071 @option{-fno-sched-stalled-insns-dep} is equivalent to
9072 @option{-fsched-stalled-insns-dep=0}.
9073 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9074 @option{-fsched-stalled-insns-dep=1}.
9075
9076 @item -fsched2-use-superblocks
9077 @opindex fsched2-use-superblocks
9078 When scheduling after register allocation, use superblock scheduling.
9079 This allows motion across basic block boundaries,
9080 resulting in faster schedules. This option is experimental, as not all machine
9081 descriptions used by GCC model the CPU closely enough to avoid unreliable
9082 results from the algorithm.
9083
9084 This only makes sense when scheduling after register allocation, i.e.@: with
9085 @option{-fschedule-insns2} or at @option{-O2} or higher.
9086
9087 @item -fsched-group-heuristic
9088 @opindex fsched-group-heuristic
9089 Enable the group heuristic in the scheduler. This heuristic favors
9090 the instruction that belongs to a schedule group. This is enabled
9091 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9092 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9093
9094 @item -fsched-critical-path-heuristic
9095 @opindex fsched-critical-path-heuristic
9096 Enable the critical-path heuristic in the scheduler. This heuristic favors
9097 instructions on the critical path. This is enabled by default when
9098 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9099 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9100
9101 @item -fsched-spec-insn-heuristic
9102 @opindex fsched-spec-insn-heuristic
9103 Enable the speculative instruction heuristic in the scheduler. This
9104 heuristic favors speculative instructions with greater dependency weakness.
9105 This is enabled by default when scheduling is enabled, i.e.@:
9106 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9107 or at @option{-O2} or higher.
9108
9109 @item -fsched-rank-heuristic
9110 @opindex fsched-rank-heuristic
9111 Enable the rank heuristic in the scheduler. This heuristic favors
9112 the instruction belonging to a basic block with greater size or frequency.
9113 This is enabled by default when scheduling is enabled, i.e.@:
9114 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9115 at @option{-O2} or higher.
9116
9117 @item -fsched-last-insn-heuristic
9118 @opindex fsched-last-insn-heuristic
9119 Enable the last-instruction heuristic in the scheduler. This heuristic
9120 favors the instruction that is less dependent on the last instruction
9121 scheduled. This is enabled by default when scheduling is enabled,
9122 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9123 at @option{-O2} or higher.
9124
9125 @item -fsched-dep-count-heuristic
9126 @opindex fsched-dep-count-heuristic
9127 Enable the dependent-count heuristic in the scheduler. This heuristic
9128 favors the instruction that has more instructions depending on it.
9129 This is enabled by default when scheduling is enabled, i.e.@:
9130 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9131 at @option{-O2} or higher.
9132
9133 @item -freschedule-modulo-scheduled-loops
9134 @opindex freschedule-modulo-scheduled-loops
9135 Modulo scheduling is performed before traditional scheduling. If a loop
9136 is modulo scheduled, later scheduling passes may change its schedule.
9137 Use this option to control that behavior.
9138
9139 @item -fselective-scheduling
9140 @opindex fselective-scheduling
9141 Schedule instructions using selective scheduling algorithm. Selective
9142 scheduling runs instead of the first scheduler pass.
9143
9144 @item -fselective-scheduling2
9145 @opindex fselective-scheduling2
9146 Schedule instructions using selective scheduling algorithm. Selective
9147 scheduling runs instead of the second scheduler pass.
9148
9149 @item -fsel-sched-pipelining
9150 @opindex fsel-sched-pipelining
9151 Enable software pipelining of innermost loops during selective scheduling.
9152 This option has no effect unless one of @option{-fselective-scheduling} or
9153 @option{-fselective-scheduling2} is turned on.
9154
9155 @item -fsel-sched-pipelining-outer-loops
9156 @opindex fsel-sched-pipelining-outer-loops
9157 When pipelining loops during selective scheduling, also pipeline outer loops.
9158 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9159
9160 @item -fsemantic-interposition
9161 @opindex fsemantic-interposition
9162 Some object formats, like ELF, allow interposing of symbols by the
9163 dynamic linker.
9164 This means that for symbols exported from the DSO, the compiler cannot perform
9165 interprocedural propagation, inlining and other optimizations in anticipation
9166 that the function or variable in question may change. While this feature is
9167 useful, for example, to rewrite memory allocation functions by a debugging
9168 implementation, it is expensive in the terms of code quality.
9169 With @option{-fno-semantic-interposition} the compiler assumes that
9170 if interposition happens for functions the overwriting function will have
9171 precisely the same semantics (and side effects).
9172 Similarly if interposition happens
9173 for variables, the constructor of the variable will be the same. The flag
9174 has no effect for functions explicitly declared inline
9175 (where it is never allowed for interposition to change semantics)
9176 and for symbols explicitly declared weak.
9177
9178 @item -fshrink-wrap
9179 @opindex fshrink-wrap
9180 Emit function prologues only before parts of the function that need it,
9181 rather than at the top of the function. This flag is enabled by default at
9182 @option{-O} and higher.
9183
9184 @item -fshrink-wrap-separate
9185 @opindex fshrink-wrap-separate
9186 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9187 those parts are only executed when needed.
9188 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9189 is also turned on and the target supports this.
9190
9191 @item -fcaller-saves
9192 @opindex fcaller-saves
9193 Enable allocation of values to registers that are clobbered by
9194 function calls, by emitting extra instructions to save and restore the
9195 registers around such calls. Such allocation is done only when it
9196 seems to result in better code.
9197
9198 This option is always enabled by default on certain machines, usually
9199 those which have no call-preserved registers to use instead.
9200
9201 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9202
9203 @item -fcombine-stack-adjustments
9204 @opindex fcombine-stack-adjustments
9205 Tracks stack adjustments (pushes and pops) and stack memory references
9206 and then tries to find ways to combine them.
9207
9208 Enabled by default at @option{-O1} and higher.
9209
9210 @item -fipa-ra
9211 @opindex fipa-ra
9212 Use caller save registers for allocation if those registers are not used by
9213 any called function. In that case it is not necessary to save and restore
9214 them around calls. This is only possible if called functions are part of
9215 same compilation unit as current function and they are compiled before it.
9216
9217 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9218 is disabled if generated code will be instrumented for profiling
9219 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9220 exactly (this happens on targets that do not expose prologues
9221 and epilogues in RTL).
9222
9223 @item -fconserve-stack
9224 @opindex fconserve-stack
9225 Attempt to minimize stack usage. The compiler attempts to use less
9226 stack space, even if that makes the program slower. This option
9227 implies setting the @option{large-stack-frame} parameter to 100
9228 and the @option{large-stack-frame-growth} parameter to 400.
9229
9230 @item -ftree-reassoc
9231 @opindex ftree-reassoc
9232 Perform reassociation on trees. This flag is enabled by default
9233 at @option{-O} and higher.
9234
9235 @item -fcode-hoisting
9236 @opindex fcode-hoisting
9237 Perform code hoisting. Code hoisting tries to move the
9238 evaluation of expressions executed on all paths to the function exit
9239 as early as possible. This is especially useful as a code size
9240 optimization, but it often helps for code speed as well.
9241 This flag is enabled by default at @option{-O2} and higher.
9242
9243 @item -ftree-pre
9244 @opindex ftree-pre
9245 Perform partial redundancy elimination (PRE) on trees. This flag is
9246 enabled by default at @option{-O2} and @option{-O3}.
9247
9248 @item -ftree-partial-pre
9249 @opindex ftree-partial-pre
9250 Make partial redundancy elimination (PRE) more aggressive. This flag is
9251 enabled by default at @option{-O3}.
9252
9253 @item -ftree-forwprop
9254 @opindex ftree-forwprop
9255 Perform forward propagation on trees. This flag is enabled by default
9256 at @option{-O} and higher.
9257
9258 @item -ftree-fre
9259 @opindex ftree-fre
9260 Perform full redundancy elimination (FRE) on trees. The difference
9261 between FRE and PRE is that FRE only considers expressions
9262 that are computed on all paths leading to the redundant computation.
9263 This analysis is faster than PRE, though it exposes fewer redundancies.
9264 This flag is enabled by default at @option{-O} and higher.
9265
9266 @item -ftree-phiprop
9267 @opindex ftree-phiprop
9268 Perform hoisting of loads from conditional pointers on trees. This
9269 pass is enabled by default at @option{-O} and higher.
9270
9271 @item -fhoist-adjacent-loads
9272 @opindex fhoist-adjacent-loads
9273 Speculatively hoist loads from both branches of an if-then-else if the
9274 loads are from adjacent locations in the same structure and the target
9275 architecture has a conditional move instruction. This flag is enabled
9276 by default at @option{-O2} and higher.
9277
9278 @item -ftree-copy-prop
9279 @opindex ftree-copy-prop
9280 Perform copy propagation on trees. This pass eliminates unnecessary
9281 copy operations. This flag is enabled by default at @option{-O} and
9282 higher.
9283
9284 @item -fipa-pure-const
9285 @opindex fipa-pure-const
9286 Discover which functions are pure or constant.
9287 Enabled by default at @option{-O} and higher.
9288
9289 @item -fipa-reference
9290 @opindex fipa-reference
9291 Discover which static variables do not escape the
9292 compilation unit.
9293 Enabled by default at @option{-O} and higher.
9294
9295 @item -fipa-reference-addressable
9296 @opindex fipa-reference-addressable
9297 Discover read-only, write-only and non-addressable static variables.
9298 Enabled by default at @option{-O} and higher.
9299
9300 @item -fipa-stack-alignment
9301 @opindex fipa-stack-alignment
9302 Reduce stack alignment on call sites if possible.
9303 Enabled by default.
9304
9305 @item -fipa-pta
9306 @opindex fipa-pta
9307 Perform interprocedural pointer analysis and interprocedural modification
9308 and reference analysis. This option can cause excessive memory and
9309 compile-time usage on large compilation units. It is not enabled by
9310 default at any optimization level.
9311
9312 @item -fipa-profile
9313 @opindex fipa-profile
9314 Perform interprocedural profile propagation. The functions called only from
9315 cold functions are marked as cold. Also functions executed once (such as
9316 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9317 functions and loop less parts of functions executed once are then optimized for
9318 size.
9319 Enabled by default at @option{-O} and higher.
9320
9321 @item -fipa-cp
9322 @opindex fipa-cp
9323 Perform interprocedural constant propagation.
9324 This optimization analyzes the program to determine when values passed
9325 to functions are constants and then optimizes accordingly.
9326 This optimization can substantially increase performance
9327 if the application has constants passed to functions.
9328 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9329 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9330
9331 @item -fipa-cp-clone
9332 @opindex fipa-cp-clone
9333 Perform function cloning to make interprocedural constant propagation stronger.
9334 When enabled, interprocedural constant propagation performs function cloning
9335 when externally visible function can be called with constant arguments.
9336 Because this optimization can create multiple copies of functions,
9337 it may significantly increase code size
9338 (see @option{--param ipcp-unit-growth=@var{value}}).
9339 This flag is enabled by default at @option{-O3}.
9340 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9341
9342 @item -fipa-bit-cp
9343 @opindex fipa-bit-cp
9344 When enabled, perform interprocedural bitwise constant
9345 propagation. This flag is enabled by default at @option{-O2} and
9346 by @option{-fprofile-use} and @option{-fauto-profile}.
9347 It requires that @option{-fipa-cp} is enabled.
9348
9349 @item -fipa-vrp
9350 @opindex fipa-vrp
9351 When enabled, perform interprocedural propagation of value
9352 ranges. This flag is enabled by default at @option{-O2}. It requires
9353 that @option{-fipa-cp} is enabled.
9354
9355 @item -fipa-icf
9356 @opindex fipa-icf
9357 Perform Identical Code Folding for functions and read-only variables.
9358 The optimization reduces code size and may disturb unwind stacks by replacing
9359 a function by equivalent one with a different name. The optimization works
9360 more effectively with link-time optimization enabled.
9361
9362 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9363 works on different levels and thus the optimizations are not same - there are
9364 equivalences that are found only by GCC and equivalences found only by Gold.
9365
9366 This flag is enabled by default at @option{-O2} and @option{-Os}.
9367
9368 @item -flive-patching=@var{level}
9369 @opindex flive-patching
9370 Control GCC's optimizations to provide a safe compilation for live-patching.
9371
9372 If the compiler's optimization uses a function's body or information extracted
9373 from its body to optimize/change another function, the latter is called an
9374 impacted function of the former. If a function is patched, its impacted
9375 functions should be patched too.
9376
9377 The impacted functions are decided by the compiler's interprocedural
9378 optimizations. For example, inlining a function into its caller, cloning
9379 a function and changing its caller to call this new clone, or extracting
9380 a function's pureness/constness information to optimize its direct or
9381 indirect callers, etc.
9382
9383 Usually, the more IPA optimizations enabled, the larger the number of
9384 impacted functions for each function. In order to control the number of
9385 impacted functions and computed the list of impacted function easily,
9386 we provide control to partially enable IPA optimizations on two different
9387 levels.
9388
9389 The @var{level} argument should be one of the following:
9390
9391 @table @samp
9392
9393 @item inline-clone
9394
9395 Only enable inlining and cloning optimizations, which includes inlining,
9396 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9397 As a result, when patching a function, all its callers and its clones'
9398 callers need to be patched as well.
9399
9400 @option{-flive-patching=inline-clone} disables the following optimization flags:
9401 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9402 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9403 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9404 -fipa-stack-alignment}
9405
9406 @item inline-only-static
9407
9408 Only enable inlining of static functions.
9409 As a result, when patching a static function, all its callers need to be
9410 patches as well.
9411
9412 In addition to all the flags that -flive-patching=inline-clone disables,
9413 @option{-flive-patching=inline-only-static} disables the following additional
9414 optimization flags:
9415 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9416
9417 @end table
9418
9419 When -flive-patching specified without any value, the default value
9420 is "inline-clone".
9421
9422 This flag is disabled by default.
9423
9424 Note that -flive-patching is not supported with link-time optimizer.
9425 (@option{-flto}).
9426
9427 @item -fisolate-erroneous-paths-dereference
9428 @opindex fisolate-erroneous-paths-dereference
9429 Detect paths that trigger erroneous or undefined behavior due to
9430 dereferencing a null pointer. Isolate those paths from the main control
9431 flow and turn the statement with erroneous or undefined behavior into a trap.
9432 This flag is enabled by default at @option{-O2} and higher and depends on
9433 @option{-fdelete-null-pointer-checks} also being enabled.
9434
9435 @item -fisolate-erroneous-paths-attribute
9436 @opindex fisolate-erroneous-paths-attribute
9437 Detect paths that trigger erroneous or undefined behavior due to a null value
9438 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9439 attribute. Isolate those paths from the main control flow and turn the
9440 statement with erroneous or undefined behavior into a trap. This is not
9441 currently enabled, but may be enabled by @option{-O2} in the future.
9442
9443 @item -ftree-sink
9444 @opindex ftree-sink
9445 Perform forward store motion on trees. This flag is
9446 enabled by default at @option{-O} and higher.
9447
9448 @item -ftree-bit-ccp
9449 @opindex ftree-bit-ccp
9450 Perform sparse conditional bit constant propagation on trees and propagate
9451 pointer alignment information.
9452 This pass only operates on local scalar variables and is enabled by default
9453 at @option{-O1} and higher, except for @option{-Og}.
9454 It requires that @option{-ftree-ccp} is enabled.
9455
9456 @item -ftree-ccp
9457 @opindex ftree-ccp
9458 Perform sparse conditional constant propagation (CCP) on trees. This
9459 pass only operates on local scalar variables and is enabled by default
9460 at @option{-O} and higher.
9461
9462 @item -fssa-backprop
9463 @opindex fssa-backprop
9464 Propagate information about uses of a value up the definition chain
9465 in order to simplify the definitions. For example, this pass strips
9466 sign operations if the sign of a value never matters. The flag is
9467 enabled by default at @option{-O} and higher.
9468
9469 @item -fssa-phiopt
9470 @opindex fssa-phiopt
9471 Perform pattern matching on SSA PHI nodes to optimize conditional
9472 code. This pass is enabled by default at @option{-O1} and higher,
9473 except for @option{-Og}.
9474
9475 @item -ftree-switch-conversion
9476 @opindex ftree-switch-conversion
9477 Perform conversion of simple initializations in a switch to
9478 initializations from a scalar array. This flag is enabled by default
9479 at @option{-O2} and higher.
9480
9481 @item -ftree-tail-merge
9482 @opindex ftree-tail-merge
9483 Look for identical code sequences. When found, replace one with a jump to the
9484 other. This optimization is known as tail merging or cross jumping. This flag
9485 is enabled by default at @option{-O2} and higher. The compilation time
9486 in this pass can
9487 be limited using @option{max-tail-merge-comparisons} parameter and
9488 @option{max-tail-merge-iterations} parameter.
9489
9490 @item -ftree-dce
9491 @opindex ftree-dce
9492 Perform dead code elimination (DCE) on trees. This flag is enabled by
9493 default at @option{-O} and higher.
9494
9495 @item -ftree-builtin-call-dce
9496 @opindex ftree-builtin-call-dce
9497 Perform conditional dead code elimination (DCE) for calls to built-in functions
9498 that may set @code{errno} but are otherwise free of side effects. This flag is
9499 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9500 specified.
9501
9502 @item -ftree-dominator-opts
9503 @opindex ftree-dominator-opts
9504 Perform a variety of simple scalar cleanups (constant/copy
9505 propagation, redundancy elimination, range propagation and expression
9506 simplification) based on a dominator tree traversal. This also
9507 performs jump threading (to reduce jumps to jumps). This flag is
9508 enabled by default at @option{-O} and higher.
9509
9510 @item -ftree-dse
9511 @opindex ftree-dse
9512 Perform dead store elimination (DSE) on trees. A dead store is a store into
9513 a memory location that is later overwritten by another store without
9514 any intervening loads. In this case the earlier store can be deleted. This
9515 flag is enabled by default at @option{-O} and higher.
9516
9517 @item -ftree-ch
9518 @opindex ftree-ch
9519 Perform loop header copying on trees. This is beneficial since it increases
9520 effectiveness of code motion optimizations. It also saves one jump. This flag
9521 is enabled by default at @option{-O} and higher. It is not enabled
9522 for @option{-Os}, since it usually increases code size.
9523
9524 @item -ftree-loop-optimize
9525 @opindex ftree-loop-optimize
9526 Perform loop optimizations on trees. This flag is enabled by default
9527 at @option{-O} and higher.
9528
9529 @item -ftree-loop-linear
9530 @itemx -floop-strip-mine
9531 @itemx -floop-block
9532 @opindex ftree-loop-linear
9533 @opindex floop-strip-mine
9534 @opindex floop-block
9535 Perform loop nest optimizations. Same as
9536 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9537 to be configured with @option{--with-isl} to enable the Graphite loop
9538 transformation infrastructure.
9539
9540 @item -fgraphite-identity
9541 @opindex fgraphite-identity
9542 Enable the identity transformation for graphite. For every SCoP we generate
9543 the polyhedral representation and transform it back to gimple. Using
9544 @option{-fgraphite-identity} we can check the costs or benefits of the
9545 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9546 are also performed by the code generator isl, like index splitting and
9547 dead code elimination in loops.
9548
9549 @item -floop-nest-optimize
9550 @opindex floop-nest-optimize
9551 Enable the isl based loop nest optimizer. This is a generic loop nest
9552 optimizer based on the Pluto optimization algorithms. It calculates a loop
9553 structure optimized for data-locality and parallelism. This option
9554 is experimental.
9555
9556 @item -floop-parallelize-all
9557 @opindex floop-parallelize-all
9558 Use the Graphite data dependence analysis to identify loops that can
9559 be parallelized. Parallelize all the loops that can be analyzed to
9560 not contain loop carried dependences without checking that it is
9561 profitable to parallelize the loops.
9562
9563 @item -ftree-coalesce-vars
9564 @opindex ftree-coalesce-vars
9565 While transforming the program out of the SSA representation, attempt to
9566 reduce copying by coalescing versions of different user-defined
9567 variables, instead of just compiler temporaries. This may severely
9568 limit the ability to debug an optimized program compiled with
9569 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9570 prevents SSA coalescing of user variables. This option is enabled by
9571 default if optimization is enabled, and it does very little otherwise.
9572
9573 @item -ftree-loop-if-convert
9574 @opindex ftree-loop-if-convert
9575 Attempt to transform conditional jumps in the innermost loops to
9576 branch-less equivalents. The intent is to remove control-flow from
9577 the innermost loops in order to improve the ability of the
9578 vectorization pass to handle these loops. This is enabled by default
9579 if vectorization is enabled.
9580
9581 @item -ftree-loop-distribution
9582 @opindex ftree-loop-distribution
9583 Perform loop distribution. This flag can improve cache performance on
9584 big loop bodies and allow further loop optimizations, like
9585 parallelization or vectorization, to take place. For example, the loop
9586 @smallexample
9587 DO I = 1, N
9588 A(I) = B(I) + C
9589 D(I) = E(I) * F
9590 ENDDO
9591 @end smallexample
9592 is transformed to
9593 @smallexample
9594 DO I = 1, N
9595 A(I) = B(I) + C
9596 ENDDO
9597 DO I = 1, N
9598 D(I) = E(I) * F
9599 ENDDO
9600 @end smallexample
9601 This flag is enabled by default at @option{-O3}.
9602 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9603
9604 @item -ftree-loop-distribute-patterns
9605 @opindex ftree-loop-distribute-patterns
9606 Perform loop distribution of patterns that can be code generated with
9607 calls to a library. This flag is enabled by default at @option{-O3}, and
9608 by @option{-fprofile-use} and @option{-fauto-profile}.
9609
9610 This pass distributes the initialization loops and generates a call to
9611 memset zero. For example, the loop
9612 @smallexample
9613 DO I = 1, N
9614 A(I) = 0
9615 B(I) = A(I) + I
9616 ENDDO
9617 @end smallexample
9618 is transformed to
9619 @smallexample
9620 DO I = 1, N
9621 A(I) = 0
9622 ENDDO
9623 DO I = 1, N
9624 B(I) = A(I) + I
9625 ENDDO
9626 @end smallexample
9627 and the initialization loop is transformed into a call to memset zero.
9628 This flag is enabled by default at @option{-O3}.
9629 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9630
9631 @item -floop-interchange
9632 @opindex floop-interchange
9633 Perform loop interchange outside of graphite. This flag can improve cache
9634 performance on loop nest and allow further loop optimizations, like
9635 vectorization, to take place. For example, the loop
9636 @smallexample
9637 for (int i = 0; i < N; i++)
9638 for (int j = 0; j < N; j++)
9639 for (int k = 0; k < N; k++)
9640 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9641 @end smallexample
9642 is transformed to
9643 @smallexample
9644 for (int i = 0; i < N; i++)
9645 for (int k = 0; k < N; k++)
9646 for (int j = 0; j < N; j++)
9647 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9648 @end smallexample
9649 This flag is enabled by default at @option{-O3}.
9650 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9651
9652 @item -floop-unroll-and-jam
9653 @opindex floop-unroll-and-jam
9654 Apply unroll and jam transformations on feasible loops. In a loop
9655 nest this unrolls the outer loop by some factor and fuses the resulting
9656 multiple inner loops. This flag is enabled by default at @option{-O3}.
9657 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9658
9659 @item -ftree-loop-im
9660 @opindex ftree-loop-im
9661 Perform loop invariant motion on trees. This pass moves only invariants that
9662 are hard to handle at RTL level (function calls, operations that expand to
9663 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9664 operands of conditions that are invariant out of the loop, so that we can use
9665 just trivial invariantness analysis in loop unswitching. The pass also includes
9666 store motion.
9667
9668 @item -ftree-loop-ivcanon
9669 @opindex ftree-loop-ivcanon
9670 Create a canonical counter for number of iterations in loops for which
9671 determining number of iterations requires complicated analysis. Later
9672 optimizations then may determine the number easily. Useful especially
9673 in connection with unrolling.
9674
9675 @item -ftree-scev-cprop
9676 @opindex ftree-scev-cprop
9677 Perform final value replacement. If a variable is modified in a loop
9678 in such a way that its value when exiting the loop can be determined using
9679 only its initial value and the number of loop iterations, replace uses of
9680 the final value by such a computation, provided it is sufficiently cheap.
9681 This reduces data dependencies and may allow further simplifications.
9682 Enabled by default at @option{-O} and higher.
9683
9684 @item -fivopts
9685 @opindex fivopts
9686 Perform induction variable optimizations (strength reduction, induction
9687 variable merging and induction variable elimination) on trees.
9688
9689 @item -ftree-parallelize-loops=n
9690 @opindex ftree-parallelize-loops
9691 Parallelize loops, i.e., split their iteration space to run in n threads.
9692 This is only possible for loops whose iterations are independent
9693 and can be arbitrarily reordered. The optimization is only
9694 profitable on multiprocessor machines, for loops that are CPU-intensive,
9695 rather than constrained e.g.@: by memory bandwidth. This option
9696 implies @option{-pthread}, and thus is only supported on targets
9697 that have support for @option{-pthread}.
9698
9699 @item -ftree-pta
9700 @opindex ftree-pta
9701 Perform function-local points-to analysis on trees. This flag is
9702 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9703
9704 @item -ftree-sra
9705 @opindex ftree-sra
9706 Perform scalar replacement of aggregates. This pass replaces structure
9707 references with scalars to prevent committing structures to memory too
9708 early. This flag is enabled by default at @option{-O1} and higher,
9709 except for @option{-Og}.
9710
9711 @item -fstore-merging
9712 @opindex fstore-merging
9713 Perform merging of narrow stores to consecutive memory addresses. This pass
9714 merges contiguous stores of immediate values narrower than a word into fewer
9715 wider stores to reduce the number of instructions. This is enabled by default
9716 at @option{-O2} and higher as well as @option{-Os}.
9717
9718 @item -ftree-ter
9719 @opindex ftree-ter
9720 Perform temporary expression replacement during the SSA->normal phase. Single
9721 use/single def temporaries are replaced at their use location with their
9722 defining expression. This results in non-GIMPLE code, but gives the expanders
9723 much more complex trees to work on resulting in better RTL generation. This is
9724 enabled by default at @option{-O} and higher.
9725
9726 @item -ftree-slsr
9727 @opindex ftree-slsr
9728 Perform straight-line strength reduction on trees. This recognizes related
9729 expressions involving multiplications and replaces them by less expensive
9730 calculations when possible. This is enabled by default at @option{-O} and
9731 higher.
9732
9733 @item -ftree-vectorize
9734 @opindex ftree-vectorize
9735 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9736 and @option{-ftree-slp-vectorize} if not explicitly specified.
9737
9738 @item -ftree-loop-vectorize
9739 @opindex ftree-loop-vectorize
9740 Perform loop vectorization on trees. This flag is enabled by default at
9741 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9742 and @option{-fauto-profile}.
9743
9744 @item -ftree-slp-vectorize
9745 @opindex ftree-slp-vectorize
9746 Perform basic block vectorization on trees. This flag is enabled by default at
9747 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9748 and @option{-fauto-profile}.
9749
9750 @item -fvect-cost-model=@var{model}
9751 @opindex fvect-cost-model
9752 Alter the cost model used for vectorization. The @var{model} argument
9753 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9754 With the @samp{unlimited} model the vectorized code-path is assumed
9755 to be profitable while with the @samp{dynamic} model a runtime check
9756 guards the vectorized code-path to enable it only for iteration
9757 counts that will likely execute faster than when executing the original
9758 scalar loop. The @samp{cheap} model disables vectorization of
9759 loops where doing so would be cost prohibitive for example due to
9760 required runtime checks for data dependence or alignment but otherwise
9761 is equal to the @samp{dynamic} model.
9762 The default cost model depends on other optimization flags and is
9763 either @samp{dynamic} or @samp{cheap}.
9764
9765 @item -fsimd-cost-model=@var{model}
9766 @opindex fsimd-cost-model
9767 Alter the cost model used for vectorization of loops marked with the OpenMP
9768 simd directive. The @var{model} argument should be one of
9769 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9770 have the same meaning as described in @option{-fvect-cost-model} and by
9771 default a cost model defined with @option{-fvect-cost-model} is used.
9772
9773 @item -ftree-vrp
9774 @opindex ftree-vrp
9775 Perform Value Range Propagation on trees. This is similar to the
9776 constant propagation pass, but instead of values, ranges of values are
9777 propagated. This allows the optimizers to remove unnecessary range
9778 checks like array bound checks and null pointer checks. This is
9779 enabled by default at @option{-O2} and higher. Null pointer check
9780 elimination is only done if @option{-fdelete-null-pointer-checks} is
9781 enabled.
9782
9783 @item -fsplit-paths
9784 @opindex fsplit-paths
9785 Split paths leading to loop backedges. This can improve dead code
9786 elimination and common subexpression elimination. This is enabled by
9787 default at @option{-O3} and above.
9788
9789 @item -fsplit-ivs-in-unroller
9790 @opindex fsplit-ivs-in-unroller
9791 Enables expression of values of induction variables in later iterations
9792 of the unrolled loop using the value in the first iteration. This breaks
9793 long dependency chains, thus improving efficiency of the scheduling passes.
9794
9795 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9796 same effect. However, that is not reliable in cases where the loop body
9797 is more complicated than a single basic block. It also does not work at all
9798 on some architectures due to restrictions in the CSE pass.
9799
9800 This optimization is enabled by default.
9801
9802 @item -fvariable-expansion-in-unroller
9803 @opindex fvariable-expansion-in-unroller
9804 With this option, the compiler creates multiple copies of some
9805 local variables when unrolling a loop, which can result in superior code.
9806
9807 @item -fpartial-inlining
9808 @opindex fpartial-inlining
9809 Inline parts of functions. This option has any effect only
9810 when inlining itself is turned on by the @option{-finline-functions}
9811 or @option{-finline-small-functions} options.
9812
9813 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9814
9815 @item -fpredictive-commoning
9816 @opindex fpredictive-commoning
9817 Perform predictive commoning optimization, i.e., reusing computations
9818 (especially memory loads and stores) performed in previous
9819 iterations of loops.
9820
9821 This option is enabled at level @option{-O3}.
9822 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9823
9824 @item -fprefetch-loop-arrays
9825 @opindex fprefetch-loop-arrays
9826 If supported by the target machine, generate instructions to prefetch
9827 memory to improve the performance of loops that access large arrays.
9828
9829 This option may generate better or worse code; results are highly
9830 dependent on the structure of loops within the source code.
9831
9832 Disabled at level @option{-Os}.
9833
9834 @item -fno-printf-return-value
9835 @opindex fno-printf-return-value
9836 @opindex fprintf-return-value
9837 Do not substitute constants for known return value of formatted output
9838 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9839 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9840 transformation allows GCC to optimize or even eliminate branches based
9841 on the known return value of these functions called with arguments that
9842 are either constant, or whose values are known to be in a range that
9843 makes determining the exact return value possible. For example, when
9844 @option{-fprintf-return-value} is in effect, both the branch and the
9845 body of the @code{if} statement (but not the call to @code{snprint})
9846 can be optimized away when @code{i} is a 32-bit or smaller integer
9847 because the return value is guaranteed to be at most 8.
9848
9849 @smallexample
9850 char buf[9];
9851 if (snprintf (buf, "%08x", i) >= sizeof buf)
9852 @dots{}
9853 @end smallexample
9854
9855 The @option{-fprintf-return-value} option relies on other optimizations
9856 and yields best results with @option{-O2} and above. It works in tandem
9857 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9858 options. The @option{-fprintf-return-value} option is enabled by default.
9859
9860 @item -fno-peephole
9861 @itemx -fno-peephole2
9862 @opindex fno-peephole
9863 @opindex fpeephole
9864 @opindex fno-peephole2
9865 @opindex fpeephole2
9866 Disable any machine-specific peephole optimizations. The difference
9867 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9868 are implemented in the compiler; some targets use one, some use the
9869 other, a few use both.
9870
9871 @option{-fpeephole} is enabled by default.
9872 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9873
9874 @item -fno-guess-branch-probability
9875 @opindex fno-guess-branch-probability
9876 @opindex fguess-branch-probability
9877 Do not guess branch probabilities using heuristics.
9878
9879 GCC uses heuristics to guess branch probabilities if they are
9880 not provided by profiling feedback (@option{-fprofile-arcs}). These
9881 heuristics are based on the control flow graph. If some branch probabilities
9882 are specified by @code{__builtin_expect}, then the heuristics are
9883 used to guess branch probabilities for the rest of the control flow graph,
9884 taking the @code{__builtin_expect} info into account. The interactions
9885 between the heuristics and @code{__builtin_expect} can be complex, and in
9886 some cases, it may be useful to disable the heuristics so that the effects
9887 of @code{__builtin_expect} are easier to understand.
9888
9889 It is also possible to specify expected probability of the expression
9890 with @code{__builtin_expect_with_probability} built-in function.
9891
9892 The default is @option{-fguess-branch-probability} at levels
9893 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9894
9895 @item -freorder-blocks
9896 @opindex freorder-blocks
9897 Reorder basic blocks in the compiled function in order to reduce number of
9898 taken branches and improve code locality.
9899
9900 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9901
9902 @item -freorder-blocks-algorithm=@var{algorithm}
9903 @opindex freorder-blocks-algorithm
9904 Use the specified algorithm for basic block reordering. The
9905 @var{algorithm} argument can be @samp{simple}, which does not increase
9906 code size (except sometimes due to secondary effects like alignment),
9907 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9908 put all often executed code together, minimizing the number of branches
9909 executed by making extra copies of code.
9910
9911 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9912 @samp{stc} at levels @option{-O2}, @option{-O3}.
9913
9914 @item -freorder-blocks-and-partition
9915 @opindex freorder-blocks-and-partition
9916 In addition to reordering basic blocks in the compiled function, in order
9917 to reduce number of taken branches, partitions hot and cold basic blocks
9918 into separate sections of the assembly and @file{.o} files, to improve
9919 paging and cache locality performance.
9920
9921 This optimization is automatically turned off in the presence of
9922 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9923 section attribute and on any architecture that does not support named
9924 sections. When @option{-fsplit-stack} is used this option is not
9925 enabled by default (to avoid linker errors), but may be enabled
9926 explicitly (if using a working linker).
9927
9928 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9929
9930 @item -freorder-functions
9931 @opindex freorder-functions
9932 Reorder functions in the object file in order to
9933 improve code locality. This is implemented by using special
9934 subsections @code{.text.hot} for most frequently executed functions and
9935 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9936 the linker so object file format must support named sections and linker must
9937 place them in a reasonable way.
9938
9939 This option isn't effective unless you either provide profile feedback
9940 (see @option{-fprofile-arcs} for details) or manually annotate functions with
9941 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9942
9943 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9944
9945 @item -fstrict-aliasing
9946 @opindex fstrict-aliasing
9947 Allow the compiler to assume the strictest aliasing rules applicable to
9948 the language being compiled. For C (and C++), this activates
9949 optimizations based on the type of expressions. In particular, an
9950 object of one type is assumed never to reside at the same address as an
9951 object of a different type, unless the types are almost the same. For
9952 example, an @code{unsigned int} can alias an @code{int}, but not a
9953 @code{void*} or a @code{double}. A character type may alias any other
9954 type.
9955
9956 @anchor{Type-punning}Pay special attention to code like this:
9957 @smallexample
9958 union a_union @{
9959 int i;
9960 double d;
9961 @};
9962
9963 int f() @{
9964 union a_union t;
9965 t.d = 3.0;
9966 return t.i;
9967 @}
9968 @end smallexample
9969 The practice of reading from a different union member than the one most
9970 recently written to (called ``type-punning'') is common. Even with
9971 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9972 is accessed through the union type. So, the code above works as
9973 expected. @xref{Structures unions enumerations and bit-fields
9974 implementation}. However, this code might not:
9975 @smallexample
9976 int f() @{
9977 union a_union t;
9978 int* ip;
9979 t.d = 3.0;
9980 ip = &t.i;
9981 return *ip;
9982 @}
9983 @end smallexample
9984
9985 Similarly, access by taking the address, casting the resulting pointer
9986 and dereferencing the result has undefined behavior, even if the cast
9987 uses a union type, e.g.:
9988 @smallexample
9989 int f() @{
9990 double d = 3.0;
9991 return ((union a_union *) &d)->i;
9992 @}
9993 @end smallexample
9994
9995 The @option{-fstrict-aliasing} option is enabled at levels
9996 @option{-O2}, @option{-O3}, @option{-Os}.
9997
9998 @item -falign-functions
9999 @itemx -falign-functions=@var{n}
10000 @itemx -falign-functions=@var{n}:@var{m}
10001 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10002 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10003 @opindex falign-functions
10004 Align the start of functions to the next power-of-two greater than
10005 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10006 the first @var{m} bytes of the function can be fetched by the CPU
10007 without crossing an @var{n}-byte alignment boundary.
10008
10009 If @var{m} is not specified, it defaults to @var{n}.
10010
10011 Examples: @option{-falign-functions=32} aligns functions to the next
10012 32-byte boundary, @option{-falign-functions=24} aligns to the next
10013 32-byte boundary only if this can be done by skipping 23 bytes or less,
10014 @option{-falign-functions=32:7} aligns to the next
10015 32-byte boundary only if this can be done by skipping 6 bytes or less.
10016
10017 The second pair of @var{n2}:@var{m2} values allows you to specify
10018 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10019 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10020 otherwise aligns to the next 32-byte boundary if this can be done
10021 by skipping 2 bytes or less.
10022 If @var{m2} is not specified, it defaults to @var{n2}.
10023
10024 Some assemblers only support this flag when @var{n} is a power of two;
10025 in that case, it is rounded up.
10026
10027 @option{-fno-align-functions} and @option{-falign-functions=1} are
10028 equivalent and mean that functions are not aligned.
10029
10030 If @var{n} is not specified or is zero, use a machine-dependent default.
10031 The maximum allowed @var{n} option value is 65536.
10032
10033 Enabled at levels @option{-O2}, @option{-O3}.
10034
10035 @item -flimit-function-alignment
10036 If this option is enabled, the compiler tries to avoid unnecessarily
10037 overaligning functions. It attempts to instruct the assembler to align
10038 by the amount specified by @option{-falign-functions}, but not to
10039 skip more bytes than the size of the function.
10040
10041 @item -falign-labels
10042 @itemx -falign-labels=@var{n}
10043 @itemx -falign-labels=@var{n}:@var{m}
10044 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10045 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10046 @opindex falign-labels
10047 Align all branch targets to a power-of-two boundary.
10048
10049 Parameters of this option are analogous to the @option{-falign-functions} option.
10050 @option{-fno-align-labels} and @option{-falign-labels=1} are
10051 equivalent and mean that labels are not aligned.
10052
10053 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10054 are greater than this value, then their values are used instead.
10055
10056 If @var{n} is not specified or is zero, use a machine-dependent default
10057 which is very likely to be @samp{1}, meaning no alignment.
10058 The maximum allowed @var{n} option value is 65536.
10059
10060 Enabled at levels @option{-O2}, @option{-O3}.
10061
10062 @item -falign-loops
10063 @itemx -falign-loops=@var{n}
10064 @itemx -falign-loops=@var{n}:@var{m}
10065 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10066 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10067 @opindex falign-loops
10068 Align loops to a power-of-two boundary. If the loops are executed
10069 many times, this makes up for any execution of the dummy padding
10070 instructions.
10071
10072 Parameters of this option are analogous to the @option{-falign-functions} option.
10073 @option{-fno-align-loops} and @option{-falign-loops=1} are
10074 equivalent and mean that loops are not aligned.
10075 The maximum allowed @var{n} option value is 65536.
10076
10077 If @var{n} is not specified or is zero, use a machine-dependent default.
10078
10079 Enabled at levels @option{-O2}, @option{-O3}.
10080
10081 @item -falign-jumps
10082 @itemx -falign-jumps=@var{n}
10083 @itemx -falign-jumps=@var{n}:@var{m}
10084 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10085 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10086 @opindex falign-jumps
10087 Align branch targets to a power-of-two boundary, for branch targets
10088 where the targets can only be reached by jumping. In this case,
10089 no dummy operations need be executed.
10090
10091 Parameters of this option are analogous to the @option{-falign-functions} option.
10092 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10093 equivalent and mean that loops are not aligned.
10094
10095 If @var{n} is not specified or is zero, use a machine-dependent default.
10096 The maximum allowed @var{n} option value is 65536.
10097
10098 Enabled at levels @option{-O2}, @option{-O3}.
10099
10100 @item -funit-at-a-time
10101 @opindex funit-at-a-time
10102 This option is left for compatibility reasons. @option{-funit-at-a-time}
10103 has no effect, while @option{-fno-unit-at-a-time} implies
10104 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10105
10106 Enabled by default.
10107
10108 @item -fno-toplevel-reorder
10109 @opindex fno-toplevel-reorder
10110 @opindex ftoplevel-reorder
10111 Do not reorder top-level functions, variables, and @code{asm}
10112 statements. Output them in the same order that they appear in the
10113 input file. When this option is used, unreferenced static variables
10114 are not removed. This option is intended to support existing code
10115 that relies on a particular ordering. For new code, it is better to
10116 use attributes when possible.
10117
10118 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10119 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10120 Additionally @option{-fno-toplevel-reorder} implies
10121 @option{-fno-section-anchors}.
10122
10123 @item -fweb
10124 @opindex fweb
10125 Constructs webs as commonly used for register allocation purposes and assign
10126 each web individual pseudo register. This allows the register allocation pass
10127 to operate on pseudos directly, but also strengthens several other optimization
10128 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10129 however, make debugging impossible, since variables no longer stay in a
10130 ``home register''.
10131
10132 Enabled by default with @option{-funroll-loops}.
10133
10134 @item -fwhole-program
10135 @opindex fwhole-program
10136 Assume that the current compilation unit represents the whole program being
10137 compiled. All public functions and variables with the exception of @code{main}
10138 and those merged by attribute @code{externally_visible} become static functions
10139 and in effect are optimized more aggressively by interprocedural optimizers.
10140
10141 This option should not be used in combination with @option{-flto}.
10142 Instead relying on a linker plugin should provide safer and more precise
10143 information.
10144
10145 @item -flto[=@var{n}]
10146 @opindex flto
10147 This option runs the standard link-time optimizer. When invoked
10148 with source code, it generates GIMPLE (one of GCC's internal
10149 representations) and writes it to special ELF sections in the object
10150 file. When the object files are linked together, all the function
10151 bodies are read from these ELF sections and instantiated as if they
10152 had been part of the same translation unit.
10153
10154 To use the link-time optimizer, @option{-flto} and optimization
10155 options should be specified at compile time and during the final link.
10156 It is recommended that you compile all the files participating in the
10157 same link with the same options and also specify those options at
10158 link time.
10159 For example:
10160
10161 @smallexample
10162 gcc -c -O2 -flto foo.c
10163 gcc -c -O2 -flto bar.c
10164 gcc -o myprog -flto -O2 foo.o bar.o
10165 @end smallexample
10166
10167 The first two invocations to GCC save a bytecode representation
10168 of GIMPLE into special ELF sections inside @file{foo.o} and
10169 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10170 @file{foo.o} and @file{bar.o}, merges the two files into a single
10171 internal image, and compiles the result as usual. Since both
10172 @file{foo.o} and @file{bar.o} are merged into a single image, this
10173 causes all the interprocedural analyses and optimizations in GCC to
10174 work across the two files as if they were a single one. This means,
10175 for example, that the inliner is able to inline functions in
10176 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10177
10178 Another (simpler) way to enable link-time optimization is:
10179
10180 @smallexample
10181 gcc -o myprog -flto -O2 foo.c bar.c
10182 @end smallexample
10183
10184 The above generates bytecode for @file{foo.c} and @file{bar.c},
10185 merges them together into a single GIMPLE representation and optimizes
10186 them as usual to produce @file{myprog}.
10187
10188 The important thing to keep in mind is that to enable link-time
10189 optimizations you need to use the GCC driver to perform the link step.
10190 GCC automatically performs link-time optimization if any of the
10191 objects involved were compiled with the @option{-flto} command-line option.
10192 You can always override
10193 the automatic decision to do link-time optimization
10194 by passing @option{-fno-lto} to the link command.
10195
10196 To make whole program optimization effective, it is necessary to make
10197 certain whole program assumptions. The compiler needs to know
10198 what functions and variables can be accessed by libraries and runtime
10199 outside of the link-time optimized unit. When supported by the linker,
10200 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10201 to the compiler about used and externally visible symbols. When
10202 the linker plugin is not available, @option{-fwhole-program} should be
10203 used to allow the compiler to make these assumptions, which leads
10204 to more aggressive optimization decisions.
10205
10206 When a file is compiled with @option{-flto} without
10207 @option{-fuse-linker-plugin}, the generated object file is larger than
10208 a regular object file because it contains GIMPLE bytecodes and the usual
10209 final code (see @option{-ffat-lto-objects}. This means that
10210 object files with LTO information can be linked as normal object
10211 files; if @option{-fno-lto} is passed to the linker, no
10212 interprocedural optimizations are applied. Note that when
10213 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10214 but you cannot perform a regular, non-LTO link on them.
10215
10216 When producing the final binary, GCC only
10217 applies link-time optimizations to those files that contain bytecode.
10218 Therefore, you can mix and match object files and libraries with
10219 GIMPLE bytecodes and final object code. GCC automatically selects
10220 which files to optimize in LTO mode and which files to link without
10221 further processing.
10222
10223 Generally, options specified at link time override those
10224 specified at compile time, although in some cases GCC attempts to infer
10225 link-time options from the settings used to compile the input files.
10226
10227 If you do not specify an optimization level option @option{-O} at
10228 link time, then GCC uses the highest optimization level
10229 used when compiling the object files. Note that it is generally
10230 ineffective to specify an optimization level option only at link time and
10231 not at compile time, for two reasons. First, compiling without
10232 optimization suppresses compiler passes that gather information
10233 needed for effective optimization at link time. Second, some early
10234 optimization passes can be performed only at compile time and
10235 not at link time.
10236
10237 There are some code generation flags preserved by GCC when
10238 generating bytecodes, as they need to be used during the final link.
10239 Currently, the following options and their settings are taken from
10240 the first object file that explicitly specifies them:
10241 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10242 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10243 and all the @option{-m} target flags.
10244
10245 Certain ABI-changing flags are required to match in all compilation units,
10246 and trying to override this at link time with a conflicting value
10247 is ignored. This includes options such as @option{-freg-struct-return}
10248 and @option{-fpcc-struct-return}.
10249
10250 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10251 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10252 are passed through to the link stage and merged conservatively for
10253 conflicting translation units. Specifically
10254 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10255 precedence; and for example @option{-ffp-contract=off} takes precedence
10256 over @option{-ffp-contract=fast}. You can override them at link time.
10257
10258 If LTO encounters objects with C linkage declared with incompatible
10259 types in separate translation units to be linked together (undefined
10260 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10261 issued. The behavior is still undefined at run time. Similar
10262 diagnostics may be raised for other languages.
10263
10264 Another feature of LTO is that it is possible to apply interprocedural
10265 optimizations on files written in different languages:
10266
10267 @smallexample
10268 gcc -c -flto foo.c
10269 g++ -c -flto bar.cc
10270 gfortran -c -flto baz.f90
10271 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10272 @end smallexample
10273
10274 Notice that the final link is done with @command{g++} to get the C++
10275 runtime libraries and @option{-lgfortran} is added to get the Fortran
10276 runtime libraries. In general, when mixing languages in LTO mode, you
10277 should use the same link command options as when mixing languages in a
10278 regular (non-LTO) compilation.
10279
10280 If object files containing GIMPLE bytecode are stored in a library archive, say
10281 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10282 are using a linker with plugin support. To create static libraries suitable
10283 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10284 and @command{ranlib};
10285 to show the symbols of object files with GIMPLE bytecode, use
10286 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10287 and @command{nm} have been compiled with plugin support. At link time, use the
10288 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10289 the LTO optimization process:
10290
10291 @smallexample
10292 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10293 @end smallexample
10294
10295 With the linker plugin enabled, the linker extracts the needed
10296 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10297 to make them part of the aggregated GIMPLE image to be optimized.
10298
10299 If you are not using a linker with plugin support and/or do not
10300 enable the linker plugin, then the objects inside @file{libfoo.a}
10301 are extracted and linked as usual, but they do not participate
10302 in the LTO optimization process. In order to make a static library suitable
10303 for both LTO optimization and usual linkage, compile its object files with
10304 @option{-flto} @option{-ffat-lto-objects}.
10305
10306 Link-time optimizations do not require the presence of the whole program to
10307 operate. If the program does not require any symbols to be exported, it is
10308 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10309 the interprocedural optimizers to use more aggressive assumptions which may
10310 lead to improved optimization opportunities.
10311 Use of @option{-fwhole-program} is not needed when linker plugin is
10312 active (see @option{-fuse-linker-plugin}).
10313
10314 The current implementation of LTO makes no
10315 attempt to generate bytecode that is portable between different
10316 types of hosts. The bytecode files are versioned and there is a
10317 strict version check, so bytecode files generated in one version of
10318 GCC do not work with an older or newer version of GCC.
10319
10320 Link-time optimization does not work well with generation of debugging
10321 information on systems other than those using a combination of ELF and
10322 DWARF.
10323
10324 If you specify the optional @var{n}, the optimization and code
10325 generation done at link time is executed in parallel using @var{n}
10326 parallel jobs by utilizing an installed @command{make} program. The
10327 environment variable @env{MAKE} may be used to override the program
10328 used. The default value for @var{n} is 1.
10329
10330 You can also specify @option{-flto=jobserver} to use GNU make's
10331 job server mode to determine the number of parallel jobs. This
10332 is useful when the Makefile calling GCC is already executing in parallel.
10333 You must prepend a @samp{+} to the command recipe in the parent Makefile
10334 for this to work. This option likely only works if @env{MAKE} is
10335 GNU make.
10336
10337 @item -flto-partition=@var{alg}
10338 @opindex flto-partition
10339 Specify the partitioning algorithm used by the link-time optimizer.
10340 The value is either @samp{1to1} to specify a partitioning mirroring
10341 the original source files or @samp{balanced} to specify partitioning
10342 into equally sized chunks (whenever possible) or @samp{max} to create
10343 new partition for every symbol where possible. Specifying @samp{none}
10344 as an algorithm disables partitioning and streaming completely.
10345 The default value is @samp{balanced}. While @samp{1to1} can be used
10346 as an workaround for various code ordering issues, the @samp{max}
10347 partitioning is intended for internal testing only.
10348 The value @samp{one} specifies that exactly one partition should be
10349 used while the value @samp{none} bypasses partitioning and executes
10350 the link-time optimization step directly from the WPA phase.
10351
10352 @item -flto-odr-type-merging
10353 @opindex flto-odr-type-merging
10354 Enable streaming of mangled types names of C++ types and their unification
10355 at link time. This increases size of LTO object files, but enables
10356 diagnostics about One Definition Rule violations.
10357
10358 @item -flto-compression-level=@var{n}
10359 @opindex flto-compression-level
10360 This option specifies the level of compression used for intermediate
10361 language written to LTO object files, and is only meaningful in
10362 conjunction with LTO mode (@option{-flto}). Valid
10363 values are 0 (no compression) to 9 (maximum compression). Values
10364 outside this range are clamped to either 0 or 9. If the option is not
10365 given, a default balanced compression setting is used.
10366
10367 @item -fuse-linker-plugin
10368 @opindex fuse-linker-plugin
10369 Enables the use of a linker plugin during link-time optimization. This
10370 option relies on plugin support in the linker, which is available in gold
10371 or in GNU ld 2.21 or newer.
10372
10373 This option enables the extraction of object files with GIMPLE bytecode out
10374 of library archives. This improves the quality of optimization by exposing
10375 more code to the link-time optimizer. This information specifies what
10376 symbols can be accessed externally (by non-LTO object or during dynamic
10377 linking). Resulting code quality improvements on binaries (and shared
10378 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10379 See @option{-flto} for a description of the effect of this flag and how to
10380 use it.
10381
10382 This option is enabled by default when LTO support in GCC is enabled
10383 and GCC was configured for use with
10384 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10385
10386 @item -ffat-lto-objects
10387 @opindex ffat-lto-objects
10388 Fat LTO objects are object files that contain both the intermediate language
10389 and the object code. This makes them usable for both LTO linking and normal
10390 linking. This option is effective only when compiling with @option{-flto}
10391 and is ignored at link time.
10392
10393 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10394 requires the complete toolchain to be aware of LTO. It requires a linker with
10395 linker plugin support for basic functionality. Additionally,
10396 @command{nm}, @command{ar} and @command{ranlib}
10397 need to support linker plugins to allow a full-featured build environment
10398 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10399 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10400 to these tools. With non fat LTO makefiles need to be modified to use them.
10401
10402 Note that modern binutils provide plugin auto-load mechanism.
10403 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10404 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10405 @command{gcc-ranlib}).
10406
10407 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10408 support.
10409
10410 @item -fcompare-elim
10411 @opindex fcompare-elim
10412 After register allocation and post-register allocation instruction splitting,
10413 identify arithmetic instructions that compute processor flags similar to a
10414 comparison operation based on that arithmetic. If possible, eliminate the
10415 explicit comparison operation.
10416
10417 This pass only applies to certain targets that cannot explicitly represent
10418 the comparison operation before register allocation is complete.
10419
10420 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10421
10422 @item -fcprop-registers
10423 @opindex fcprop-registers
10424 After register allocation and post-register allocation instruction splitting,
10425 perform a copy-propagation pass to try to reduce scheduling dependencies
10426 and occasionally eliminate the copy.
10427
10428 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10429
10430 @item -fprofile-correction
10431 @opindex fprofile-correction
10432 Profiles collected using an instrumented binary for multi-threaded programs may
10433 be inconsistent due to missed counter updates. When this option is specified,
10434 GCC uses heuristics to correct or smooth out such inconsistencies. By
10435 default, GCC emits an error message when an inconsistent profile is detected.
10436
10437 This option is enabled by @option{-fauto-profile}.
10438
10439 @item -fprofile-use
10440 @itemx -fprofile-use=@var{path}
10441 @opindex fprofile-use
10442 Enable profile feedback-directed optimizations,
10443 and the following optimizations, many of which
10444 are generally profitable only with profile feedback available:
10445
10446 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10447 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10448 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10449 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10450 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10451 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10452 -fprofile-reorder-functions}
10453
10454 Before you can use this option, you must first generate profiling information.
10455 @xref{Instrumentation Options}, for information about the
10456 @option{-fprofile-generate} option.
10457
10458 By default, GCC emits an error message if the feedback profiles do not
10459 match the source code. This error can be turned into a warning by using
10460 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10461 optimized code. Additionally, by default, GCC also emits a warning message if
10462 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10463
10464 If @var{path} is specified, GCC looks at the @var{path} to find
10465 the profile feedback data files. See @option{-fprofile-dir}.
10466
10467 @item -fauto-profile
10468 @itemx -fauto-profile=@var{path}
10469 @opindex fauto-profile
10470 Enable sampling-based feedback-directed optimizations,
10471 and the following optimizations,
10472 many of which are generally profitable only with profile feedback available:
10473
10474 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10475 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10476 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10477 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10478 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10479 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10480 -fprofile-correction}
10481
10482 @var{path} is the name of a file containing AutoFDO profile information.
10483 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10484
10485 Producing an AutoFDO profile data file requires running your program
10486 with the @command{perf} utility on a supported GNU/Linux target system.
10487 For more information, see @uref{https://perf.wiki.kernel.org/}.
10488
10489 E.g.
10490 @smallexample
10491 perf record -e br_inst_retired:near_taken -b -o perf.data \
10492 -- your_program
10493 @end smallexample
10494
10495 Then use the @command{create_gcov} tool to convert the raw profile data
10496 to a format that can be used by GCC.@ You must also supply the
10497 unstripped binary for your program to this tool.
10498 See @uref{https://github.com/google/autofdo}.
10499
10500 E.g.
10501 @smallexample
10502 create_gcov --binary=your_program.unstripped --profile=perf.data \
10503 --gcov=profile.afdo
10504 @end smallexample
10505 @end table
10506
10507 The following options control compiler behavior regarding floating-point
10508 arithmetic. These options trade off between speed and
10509 correctness. All must be specifically enabled.
10510
10511 @table @gcctabopt
10512 @item -ffloat-store
10513 @opindex ffloat-store
10514 Do not store floating-point variables in registers, and inhibit other
10515 options that might change whether a floating-point value is taken from a
10516 register or memory.
10517
10518 @cindex floating-point precision
10519 This option prevents undesirable excess precision on machines such as
10520 the 68000 where the floating registers (of the 68881) keep more
10521 precision than a @code{double} is supposed to have. Similarly for the
10522 x86 architecture. For most programs, the excess precision does only
10523 good, but a few programs rely on the precise definition of IEEE floating
10524 point. Use @option{-ffloat-store} for such programs, after modifying
10525 them to store all pertinent intermediate computations into variables.
10526
10527 @item -fexcess-precision=@var{style}
10528 @opindex fexcess-precision
10529 This option allows further control over excess precision on machines
10530 where floating-point operations occur in a format with more precision or
10531 range than the IEEE standard and interchange floating-point types. By
10532 default, @option{-fexcess-precision=fast} is in effect; this means that
10533 operations may be carried out in a wider precision than the types specified
10534 in the source if that would result in faster code, and it is unpredictable
10535 when rounding to the types specified in the source code takes place.
10536 When compiling C, if @option{-fexcess-precision=standard} is specified then
10537 excess precision follows the rules specified in ISO C99; in particular,
10538 both casts and assignments cause values to be rounded to their
10539 semantic types (whereas @option{-ffloat-store} only affects
10540 assignments). This option is enabled by default for C if a strict
10541 conformance option such as @option{-std=c99} is used.
10542 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10543 regardless of whether a strict conformance option is used.
10544
10545 @opindex mfpmath
10546 @option{-fexcess-precision=standard} is not implemented for languages
10547 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10548 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10549 semantics apply without excess precision, and in the latter, rounding
10550 is unpredictable.
10551
10552 @item -ffast-math
10553 @opindex ffast-math
10554 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10555 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10556 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10557 @option{-fexcess-precision=fast}.
10558
10559 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10560
10561 This option is not turned on by any @option{-O} option besides
10562 @option{-Ofast} since it can result in incorrect output for programs
10563 that depend on an exact implementation of IEEE or ISO rules/specifications
10564 for math functions. It may, however, yield faster code for programs
10565 that do not require the guarantees of these specifications.
10566
10567 @item -fno-math-errno
10568 @opindex fno-math-errno
10569 @opindex fmath-errno
10570 Do not set @code{errno} after calling math functions that are executed
10571 with a single instruction, e.g., @code{sqrt}. A program that relies on
10572 IEEE exceptions for math error handling may want to use this flag
10573 for speed while maintaining IEEE arithmetic compatibility.
10574
10575 This option is not turned on by any @option{-O} option since
10576 it can result in incorrect output for programs that depend on
10577 an exact implementation of IEEE or ISO rules/specifications for
10578 math functions. It may, however, yield faster code for programs
10579 that do not require the guarantees of these specifications.
10580
10581 The default is @option{-fmath-errno}.
10582
10583 On Darwin systems, the math library never sets @code{errno}. There is
10584 therefore no reason for the compiler to consider the possibility that
10585 it might, and @option{-fno-math-errno} is the default.
10586
10587 @item -funsafe-math-optimizations
10588 @opindex funsafe-math-optimizations
10589
10590 Allow optimizations for floating-point arithmetic that (a) assume
10591 that arguments and results are valid and (b) may violate IEEE or
10592 ANSI standards. When used at link time, it may include libraries
10593 or startup files that change the default FPU control word or other
10594 similar optimizations.
10595
10596 This option is not turned on by any @option{-O} option since
10597 it can result in incorrect output for programs that depend on
10598 an exact implementation of IEEE or ISO rules/specifications for
10599 math functions. It may, however, yield faster code for programs
10600 that do not require the guarantees of these specifications.
10601 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10602 @option{-fassociative-math} and @option{-freciprocal-math}.
10603
10604 The default is @option{-fno-unsafe-math-optimizations}.
10605
10606 @item -fassociative-math
10607 @opindex fassociative-math
10608
10609 Allow re-association of operands in series of floating-point operations.
10610 This violates the ISO C and C++ language standard by possibly changing
10611 computation result. NOTE: re-ordering may change the sign of zero as
10612 well as ignore NaNs and inhibit or create underflow or overflow (and
10613 thus cannot be used on code that relies on rounding behavior like
10614 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10615 and thus may not be used when ordered comparisons are required.
10616 This option requires that both @option{-fno-signed-zeros} and
10617 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10618 much sense with @option{-frounding-math}. For Fortran the option
10619 is automatically enabled when both @option{-fno-signed-zeros} and
10620 @option{-fno-trapping-math} are in effect.
10621
10622 The default is @option{-fno-associative-math}.
10623
10624 @item -freciprocal-math
10625 @opindex freciprocal-math
10626
10627 Allow the reciprocal of a value to be used instead of dividing by
10628 the value if this enables optimizations. For example @code{x / y}
10629 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10630 is subject to common subexpression elimination. Note that this loses
10631 precision and increases the number of flops operating on the value.
10632
10633 The default is @option{-fno-reciprocal-math}.
10634
10635 @item -ffinite-math-only
10636 @opindex ffinite-math-only
10637 Allow optimizations for floating-point arithmetic that assume
10638 that arguments and results are not NaNs or +-Infs.
10639
10640 This option is not turned on by any @option{-O} option since
10641 it can result in incorrect output for programs that depend on
10642 an exact implementation of IEEE or ISO rules/specifications for
10643 math functions. It may, however, yield faster code for programs
10644 that do not require the guarantees of these specifications.
10645
10646 The default is @option{-fno-finite-math-only}.
10647
10648 @item -fno-signed-zeros
10649 @opindex fno-signed-zeros
10650 @opindex fsigned-zeros
10651 Allow optimizations for floating-point arithmetic that ignore the
10652 signedness of zero. IEEE arithmetic specifies the behavior of
10653 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10654 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10655 This option implies that the sign of a zero result isn't significant.
10656
10657 The default is @option{-fsigned-zeros}.
10658
10659 @item -fno-trapping-math
10660 @opindex fno-trapping-math
10661 @opindex ftrapping-math
10662 Compile code assuming that floating-point operations cannot generate
10663 user-visible traps. These traps include division by zero, overflow,
10664 underflow, inexact result and invalid operation. This option requires
10665 that @option{-fno-signaling-nans} be in effect. Setting this option may
10666 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10667
10668 This option should never be turned on by any @option{-O} option since
10669 it can result in incorrect output for programs that depend on
10670 an exact implementation of IEEE or ISO rules/specifications for
10671 math functions.
10672
10673 The default is @option{-ftrapping-math}.
10674
10675 @item -frounding-math
10676 @opindex frounding-math
10677 Disable transformations and optimizations that assume default floating-point
10678 rounding behavior. This is round-to-zero for all floating point
10679 to integer conversions, and round-to-nearest for all other arithmetic
10680 truncations. This option should be specified for programs that change
10681 the FP rounding mode dynamically, or that may be executed with a
10682 non-default rounding mode. This option disables constant folding of
10683 floating-point expressions at compile time (which may be affected by
10684 rounding mode) and arithmetic transformations that are unsafe in the
10685 presence of sign-dependent rounding modes.
10686
10687 The default is @option{-fno-rounding-math}.
10688
10689 This option is experimental and does not currently guarantee to
10690 disable all GCC optimizations that are affected by rounding mode.
10691 Future versions of GCC may provide finer control of this setting
10692 using C99's @code{FENV_ACCESS} pragma. This command-line option
10693 will be used to specify the default state for @code{FENV_ACCESS}.
10694
10695 @item -fsignaling-nans
10696 @opindex fsignaling-nans
10697 Compile code assuming that IEEE signaling NaNs may generate user-visible
10698 traps during floating-point operations. Setting this option disables
10699 optimizations that may change the number of exceptions visible with
10700 signaling NaNs. This option implies @option{-ftrapping-math}.
10701
10702 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10703 be defined.
10704
10705 The default is @option{-fno-signaling-nans}.
10706
10707 This option is experimental and does not currently guarantee to
10708 disable all GCC optimizations that affect signaling NaN behavior.
10709
10710 @item -fno-fp-int-builtin-inexact
10711 @opindex fno-fp-int-builtin-inexact
10712 @opindex ffp-int-builtin-inexact
10713 Do not allow the built-in functions @code{ceil}, @code{floor},
10714 @code{round} and @code{trunc}, and their @code{float} and @code{long
10715 double} variants, to generate code that raises the ``inexact''
10716 floating-point exception for noninteger arguments. ISO C99 and C11
10717 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10718 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10719 functions to do so.
10720
10721 The default is @option{-ffp-int-builtin-inexact}, allowing the
10722 exception to be raised. This option does nothing unless
10723 @option{-ftrapping-math} is in effect.
10724
10725 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10726 generate a call to a library function then the ``inexact'' exception
10727 may be raised if the library implementation does not follow TS 18661.
10728
10729 @item -fsingle-precision-constant
10730 @opindex fsingle-precision-constant
10731 Treat floating-point constants as single precision instead of
10732 implicitly converting them to double-precision constants.
10733
10734 @item -fcx-limited-range
10735 @opindex fcx-limited-range
10736 When enabled, this option states that a range reduction step is not
10737 needed when performing complex division. Also, there is no checking
10738 whether the result of a complex multiplication or division is @code{NaN
10739 + I*NaN}, with an attempt to rescue the situation in that case. The
10740 default is @option{-fno-cx-limited-range}, but is enabled by
10741 @option{-ffast-math}.
10742
10743 This option controls the default setting of the ISO C99
10744 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10745 all languages.
10746
10747 @item -fcx-fortran-rules
10748 @opindex fcx-fortran-rules
10749 Complex multiplication and division follow Fortran rules. Range
10750 reduction is done as part of complex division, but there is no checking
10751 whether the result of a complex multiplication or division is @code{NaN
10752 + I*NaN}, with an attempt to rescue the situation in that case.
10753
10754 The default is @option{-fno-cx-fortran-rules}.
10755
10756 @end table
10757
10758 The following options control optimizations that may improve
10759 performance, but are not enabled by any @option{-O} options. This
10760 section includes experimental options that may produce broken code.
10761
10762 @table @gcctabopt
10763 @item -fbranch-probabilities
10764 @opindex fbranch-probabilities
10765 After running a program compiled with @option{-fprofile-arcs}
10766 (@pxref{Instrumentation Options}),
10767 you can compile it a second time using
10768 @option{-fbranch-probabilities}, to improve optimizations based on
10769 the number of times each branch was taken. When a program
10770 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10771 counts to a file called @file{@var{sourcename}.gcda} for each source
10772 file. The information in this data file is very dependent on the
10773 structure of the generated code, so you must use the same source code
10774 and the same optimization options for both compilations.
10775
10776 With @option{-fbranch-probabilities}, GCC puts a
10777 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10778 These can be used to improve optimization. Currently, they are only
10779 used in one place: in @file{reorg.c}, instead of guessing which path a
10780 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10781 exactly determine which path is taken more often.
10782
10783 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10784
10785 @item -fprofile-values
10786 @opindex fprofile-values
10787 If combined with @option{-fprofile-arcs}, it adds code so that some
10788 data about values of expressions in the program is gathered.
10789
10790 With @option{-fbranch-probabilities}, it reads back the data gathered
10791 from profiling values of expressions for usage in optimizations.
10792
10793 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10794 @option{-fauto-profile}.
10795
10796 @item -fprofile-reorder-functions
10797 @opindex fprofile-reorder-functions
10798 Function reordering based on profile instrumentation collects
10799 first time of execution of a function and orders these functions
10800 in ascending order.
10801
10802 Enabled with @option{-fprofile-use}.
10803
10804 @item -fvpt
10805 @opindex fvpt
10806 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10807 to add code to gather information about values of expressions.
10808
10809 With @option{-fbranch-probabilities}, it reads back the data gathered
10810 and actually performs the optimizations based on them.
10811 Currently the optimizations include specialization of division operations
10812 using the knowledge about the value of the denominator.
10813
10814 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10815
10816 @item -frename-registers
10817 @opindex frename-registers
10818 Attempt to avoid false dependencies in scheduled code by making use
10819 of registers left over after register allocation. This optimization
10820 most benefits processors with lots of registers. Depending on the
10821 debug information format adopted by the target, however, it can
10822 make debugging impossible, since variables no longer stay in
10823 a ``home register''.
10824
10825 Enabled by default with @option{-funroll-loops}.
10826
10827 @item -fschedule-fusion
10828 @opindex fschedule-fusion
10829 Performs a target dependent pass over the instruction stream to schedule
10830 instructions of same type together because target machine can execute them
10831 more efficiently if they are adjacent to each other in the instruction flow.
10832
10833 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10834
10835 @item -ftracer
10836 @opindex ftracer
10837 Perform tail duplication to enlarge superblock size. This transformation
10838 simplifies the control flow of the function allowing other optimizations to do
10839 a better job.
10840
10841 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10842
10843 @item -funroll-loops
10844 @opindex funroll-loops
10845 Unroll loops whose number of iterations can be determined at compile time or
10846 upon entry to the loop. @option{-funroll-loops} implies
10847 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10848 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10849 a small constant number of iterations). This option makes code larger, and may
10850 or may not make it run faster.
10851
10852 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10853
10854 @item -funroll-all-loops
10855 @opindex funroll-all-loops
10856 Unroll all loops, even if their number of iterations is uncertain when
10857 the loop is entered. This usually makes programs run more slowly.
10858 @option{-funroll-all-loops} implies the same options as
10859 @option{-funroll-loops}.
10860
10861 @item -fpeel-loops
10862 @opindex fpeel-loops
10863 Peels loops for which there is enough information that they do not
10864 roll much (from profile feedback or static analysis). It also turns on
10865 complete loop peeling (i.e.@: complete removal of loops with small constant
10866 number of iterations).
10867
10868 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10869
10870 @item -fmove-loop-invariants
10871 @opindex fmove-loop-invariants
10872 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10873 at level @option{-O1} and higher, except for @option{-Og}.
10874
10875 @item -fsplit-loops
10876 @opindex fsplit-loops
10877 Split a loop into two if it contains a condition that's always true
10878 for one side of the iteration space and false for the other.
10879
10880 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10881
10882 @item -funswitch-loops
10883 @opindex funswitch-loops
10884 Move branches with loop invariant conditions out of the loop, with duplicates
10885 of the loop on both branches (modified according to result of the condition).
10886
10887 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10888
10889 @item -fversion-loops-for-strides
10890 @opindex fversion-loops-for-strides
10891 If a loop iterates over an array with a variable stride, create another
10892 version of the loop that assumes the stride is always one. For example:
10893
10894 @smallexample
10895 for (int i = 0; i < n; ++i)
10896 x[i * stride] = @dots{};
10897 @end smallexample
10898
10899 becomes:
10900
10901 @smallexample
10902 if (stride == 1)
10903 for (int i = 0; i < n; ++i)
10904 x[i] = @dots{};
10905 else
10906 for (int i = 0; i < n; ++i)
10907 x[i * stride] = @dots{};
10908 @end smallexample
10909
10910 This is particularly useful for assumed-shape arrays in Fortran where
10911 (for example) it allows better vectorization assuming contiguous accesses.
10912 This flag is enabled by default at @option{-O3}.
10913 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10914
10915 @item -ffunction-sections
10916 @itemx -fdata-sections
10917 @opindex ffunction-sections
10918 @opindex fdata-sections
10919 Place each function or data item into its own section in the output
10920 file if the target supports arbitrary sections. The name of the
10921 function or the name of the data item determines the section's name
10922 in the output file.
10923
10924 Use these options on systems where the linker can perform optimizations to
10925 improve locality of reference in the instruction space. Most systems using the
10926 ELF object format have linkers with such optimizations. On AIX, the linker
10927 rearranges sections (CSECTs) based on the call graph. The performance impact
10928 varies.
10929
10930 Together with a linker garbage collection (linker @option{--gc-sections}
10931 option) these options may lead to smaller statically-linked executables (after
10932 stripping).
10933
10934 On ELF/DWARF systems these options do not degenerate the quality of the debug
10935 information. There could be issues with other object files/debug info formats.
10936
10937 Only use these options when there are significant benefits from doing so. When
10938 you specify these options, the assembler and linker create larger object and
10939 executable files and are also slower. These options affect code generation.
10940 They prevent optimizations by the compiler and assembler using relative
10941 locations inside a translation unit since the locations are unknown until
10942 link time. An example of such an optimization is relaxing calls to short call
10943 instructions.
10944
10945 @item -fbranch-target-load-optimize
10946 @opindex fbranch-target-load-optimize
10947 Perform branch target register load optimization before prologue / epilogue
10948 threading.
10949 The use of target registers can typically be exposed only during reload,
10950 thus hoisting loads out of loops and doing inter-block scheduling needs
10951 a separate optimization pass.
10952
10953 @item -fbranch-target-load-optimize2
10954 @opindex fbranch-target-load-optimize2
10955 Perform branch target register load optimization after prologue / epilogue
10956 threading.
10957
10958 @item -fbtr-bb-exclusive
10959 @opindex fbtr-bb-exclusive
10960 When performing branch target register load optimization, don't reuse
10961 branch target registers within any basic block.
10962
10963 @item -fstdarg-opt
10964 @opindex fstdarg-opt
10965 Optimize the prologue of variadic argument functions with respect to usage of
10966 those arguments.
10967
10968 @item -fsection-anchors
10969 @opindex fsection-anchors
10970 Try to reduce the number of symbolic address calculations by using
10971 shared ``anchor'' symbols to address nearby objects. This transformation
10972 can help to reduce the number of GOT entries and GOT accesses on some
10973 targets.
10974
10975 For example, the implementation of the following function @code{foo}:
10976
10977 @smallexample
10978 static int a, b, c;
10979 int foo (void) @{ return a + b + c; @}
10980 @end smallexample
10981
10982 @noindent
10983 usually calculates the addresses of all three variables, but if you
10984 compile it with @option{-fsection-anchors}, it accesses the variables
10985 from a common anchor point instead. The effect is similar to the
10986 following pseudocode (which isn't valid C):
10987
10988 @smallexample
10989 int foo (void)
10990 @{
10991 register int *xr = &x;
10992 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10993 @}
10994 @end smallexample
10995
10996 Not all targets support this option.
10997
10998 @item --param @var{name}=@var{value}
10999 @opindex param
11000 In some places, GCC uses various constants to control the amount of
11001 optimization that is done. For example, GCC does not inline functions
11002 that contain more than a certain number of instructions. You can
11003 control some of these constants on the command line using the
11004 @option{--param} option.
11005
11006 The names of specific parameters, and the meaning of the values, are
11007 tied to the internals of the compiler, and are subject to change
11008 without notice in future releases.
11009
11010 In order to get minimal, maximal and default value of a parameter,
11011 one can use @option{--help=param -Q} options.
11012
11013 In each case, the @var{value} is an integer. The allowable choices for
11014 @var{name} are:
11015
11016 @table @gcctabopt
11017 @item predictable-branch-outcome
11018 When branch is predicted to be taken with probability lower than this threshold
11019 (in percent), then it is considered well predictable.
11020
11021 @item max-rtl-if-conversion-insns
11022 RTL if-conversion tries to remove conditional branches around a block and
11023 replace them with conditionally executed instructions. This parameter
11024 gives the maximum number of instructions in a block which should be
11025 considered for if-conversion. The compiler will
11026 also use other heuristics to decide whether if-conversion is likely to be
11027 profitable.
11028
11029 @item max-rtl-if-conversion-predictable-cost
11030 @itemx max-rtl-if-conversion-unpredictable-cost
11031 RTL if-conversion will try to remove conditional branches around a block
11032 and replace them with conditionally executed instructions. These parameters
11033 give the maximum permissible cost for the sequence that would be generated
11034 by if-conversion depending on whether the branch is statically determined
11035 to be predictable or not. The units for this parameter are the same as
11036 those for the GCC internal seq_cost metric. The compiler will try to
11037 provide a reasonable default for this parameter using the BRANCH_COST
11038 target macro.
11039
11040 @item max-crossjump-edges
11041 The maximum number of incoming edges to consider for cross-jumping.
11042 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11043 the number of edges incoming to each block. Increasing values mean
11044 more aggressive optimization, making the compilation time increase with
11045 probably small improvement in executable size.
11046
11047 @item min-crossjump-insns
11048 The minimum number of instructions that must be matched at the end
11049 of two blocks before cross-jumping is performed on them. This
11050 value is ignored in the case where all instructions in the block being
11051 cross-jumped from are matched.
11052
11053 @item max-grow-copy-bb-insns
11054 The maximum code size expansion factor when copying basic blocks
11055 instead of jumping. The expansion is relative to a jump instruction.
11056
11057 @item max-goto-duplication-insns
11058 The maximum number of instructions to duplicate to a block that jumps
11059 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11060 passes, GCC factors computed gotos early in the compilation process,
11061 and unfactors them as late as possible. Only computed jumps at the
11062 end of a basic blocks with no more than max-goto-duplication-insns are
11063 unfactored.
11064
11065 @item max-delay-slot-insn-search
11066 The maximum number of instructions to consider when looking for an
11067 instruction to fill a delay slot. If more than this arbitrary number of
11068 instructions are searched, the time savings from filling the delay slot
11069 are minimal, so stop searching. Increasing values mean more
11070 aggressive optimization, making the compilation time increase with probably
11071 small improvement in execution time.
11072
11073 @item max-delay-slot-live-search
11074 When trying to fill delay slots, the maximum number of instructions to
11075 consider when searching for a block with valid live register
11076 information. Increasing this arbitrarily chosen value means more
11077 aggressive optimization, increasing the compilation time. This parameter
11078 should be removed when the delay slot code is rewritten to maintain the
11079 control-flow graph.
11080
11081 @item max-gcse-memory
11082 The approximate maximum amount of memory that can be allocated in
11083 order to perform the global common subexpression elimination
11084 optimization. If more memory than specified is required, the
11085 optimization is not done.
11086
11087 @item max-gcse-insertion-ratio
11088 If the ratio of expression insertions to deletions is larger than this value
11089 for any expression, then RTL PRE inserts or removes the expression and thus
11090 leaves partially redundant computations in the instruction stream.
11091
11092 @item max-pending-list-length
11093 The maximum number of pending dependencies scheduling allows
11094 before flushing the current state and starting over. Large functions
11095 with few branches or calls can create excessively large lists which
11096 needlessly consume memory and resources.
11097
11098 @item max-modulo-backtrack-attempts
11099 The maximum number of backtrack attempts the scheduler should make
11100 when modulo scheduling a loop. Larger values can exponentially increase
11101 compilation time.
11102
11103 @item max-inline-insns-single
11104 Several parameters control the tree inliner used in GCC@.
11105 This number sets the maximum number of instructions (counted in GCC's
11106 internal representation) in a single function that the tree inliner
11107 considers for inlining. This only affects functions declared
11108 inline and methods implemented in a class declaration (C++).
11109
11110 @item max-inline-insns-auto
11111 When you use @option{-finline-functions} (included in @option{-O3}),
11112 a lot of functions that would otherwise not be considered for inlining
11113 by the compiler are investigated. To those functions, a different
11114 (more restrictive) limit compared to functions declared inline can
11115 be applied.
11116
11117 @item max-inline-insns-small
11118 This is bound applied to calls which are considered relevant with
11119 @option{-finline-small-functions}.
11120
11121 @item max-inline-insns-size
11122 This is bound applied to calls which are optimized for size. Small growth
11123 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11124
11125 @item uninlined-function-insns
11126 Number of instructions accounted by inliner for function overhead such as
11127 function prologue and epilogue.
11128
11129 @item uninlined-function-time
11130 Extra time accounted by inliner for function overhead such as time needed to
11131 execute function prologue and epilogue
11132
11133 @item uninlined-thunk-insns
11134 @item uninlined-thunk-time
11135 Same as @option{--param uninlined-function-insns} and
11136 @option{--param uninlined-function-time} but applied to function thunks
11137
11138 @item inline-min-speedup
11139 When estimated performance improvement of caller + callee runtime exceeds this
11140 threshold (in percent), the function can be inlined regardless of the limit on
11141 @option{--param max-inline-insns-single} and @option{--param
11142 max-inline-insns-auto}.
11143
11144 @item large-function-insns
11145 The limit specifying really large functions. For functions larger than this
11146 limit after inlining, inlining is constrained by
11147 @option{--param large-function-growth}. This parameter is useful primarily
11148 to avoid extreme compilation time caused by non-linear algorithms used by the
11149 back end.
11150
11151 @item large-function-growth
11152 Specifies maximal growth of large function caused by inlining in percents.
11153 For example, parameter value 100 limits large function growth to 2.0 times
11154 the original size.
11155
11156 @item large-unit-insns
11157 The limit specifying large translation unit. Growth caused by inlining of
11158 units larger than this limit is limited by @option{--param inline-unit-growth}.
11159 For small units this might be too tight.
11160 For example, consider a unit consisting of function A
11161 that is inline and B that just calls A three times. If B is small relative to
11162 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11163 large units consisting of small inlineable functions, however, the overall unit
11164 growth limit is needed to avoid exponential explosion of code size. Thus for
11165 smaller units, the size is increased to @option{--param large-unit-insns}
11166 before applying @option{--param inline-unit-growth}.
11167
11168 @item inline-unit-growth
11169 Specifies maximal overall growth of the compilation unit caused by inlining.
11170 For example, parameter value 20 limits unit growth to 1.2 times the original
11171 size. Cold functions (either marked cold via an attribute or by profile
11172 feedback) are not accounted into the unit size.
11173
11174 @item ipcp-unit-growth
11175 Specifies maximal overall growth of the compilation unit caused by
11176 interprocedural constant propagation. For example, parameter value 10 limits
11177 unit growth to 1.1 times the original size.
11178
11179 @item large-stack-frame
11180 The limit specifying large stack frames. While inlining the algorithm is trying
11181 to not grow past this limit too much.
11182
11183 @item large-stack-frame-growth
11184 Specifies maximal growth of large stack frames caused by inlining in percents.
11185 For example, parameter value 1000 limits large stack frame growth to 11 times
11186 the original size.
11187
11188 @item max-inline-insns-recursive
11189 @itemx max-inline-insns-recursive-auto
11190 Specifies the maximum number of instructions an out-of-line copy of a
11191 self-recursive inline
11192 function can grow into by performing recursive inlining.
11193
11194 @option{--param max-inline-insns-recursive} applies to functions
11195 declared inline.
11196 For functions not declared inline, recursive inlining
11197 happens only when @option{-finline-functions} (included in @option{-O3}) is
11198 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11199
11200 @item max-inline-recursive-depth
11201 @itemx max-inline-recursive-depth-auto
11202 Specifies the maximum recursion depth used for recursive inlining.
11203
11204 @option{--param max-inline-recursive-depth} applies to functions
11205 declared inline. For functions not declared inline, recursive inlining
11206 happens only when @option{-finline-functions} (included in @option{-O3}) is
11207 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11208
11209 @item min-inline-recursive-probability
11210 Recursive inlining is profitable only for function having deep recursion
11211 in average and can hurt for function having little recursion depth by
11212 increasing the prologue size or complexity of function body to other
11213 optimizers.
11214
11215 When profile feedback is available (see @option{-fprofile-generate}) the actual
11216 recursion depth can be guessed from the probability that function recurses
11217 via a given call expression. This parameter limits inlining only to call
11218 expressions whose probability exceeds the given threshold (in percents).
11219
11220 @item early-inlining-insns
11221 Specify growth that the early inliner can make. In effect it increases
11222 the amount of inlining for code having a large abstraction penalty.
11223
11224 @item max-early-inliner-iterations
11225 Limit of iterations of the early inliner. This basically bounds
11226 the number of nested indirect calls the early inliner can resolve.
11227 Deeper chains are still handled by late inlining.
11228
11229 @item comdat-sharing-probability
11230 Probability (in percent) that C++ inline function with comdat visibility
11231 are shared across multiple compilation units.
11232
11233 @item profile-func-internal-id
11234 A parameter to control whether to use function internal id in profile
11235 database lookup. If the value is 0, the compiler uses an id that
11236 is based on function assembler name and filename, which makes old profile
11237 data more tolerant to source changes such as function reordering etc.
11238
11239 @item min-vect-loop-bound
11240 The minimum number of iterations under which loops are not vectorized
11241 when @option{-ftree-vectorize} is used. The number of iterations after
11242 vectorization needs to be greater than the value specified by this option
11243 to allow vectorization.
11244
11245 @item gcse-cost-distance-ratio
11246 Scaling factor in calculation of maximum distance an expression
11247 can be moved by GCSE optimizations. This is currently supported only in the
11248 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11249 is with simple expressions, i.e., the expressions that have cost
11250 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11251 hoisting of simple expressions.
11252
11253 @item gcse-unrestricted-cost
11254 Cost, roughly measured as the cost of a single typical machine
11255 instruction, at which GCSE optimizations do not constrain
11256 the distance an expression can travel. This is currently
11257 supported only in the code hoisting pass. The lesser the cost,
11258 the more aggressive code hoisting is. Specifying 0
11259 allows all expressions to travel unrestricted distances.
11260
11261 @item max-hoist-depth
11262 The depth of search in the dominator tree for expressions to hoist.
11263 This is used to avoid quadratic behavior in hoisting algorithm.
11264 The value of 0 does not limit on the search, but may slow down compilation
11265 of huge functions.
11266
11267 @item max-tail-merge-comparisons
11268 The maximum amount of similar bbs to compare a bb with. This is used to
11269 avoid quadratic behavior in tree tail merging.
11270
11271 @item max-tail-merge-iterations
11272 The maximum amount of iterations of the pass over the function. This is used to
11273 limit compilation time in tree tail merging.
11274
11275 @item store-merging-allow-unaligned
11276 Allow the store merging pass to introduce unaligned stores if it is legal to
11277 do so.
11278
11279 @item max-stores-to-merge
11280 The maximum number of stores to attempt to merge into wider stores in the store
11281 merging pass.
11282
11283 @item max-unrolled-insns
11284 The maximum number of instructions that a loop may have to be unrolled.
11285 If a loop is unrolled, this parameter also determines how many times
11286 the loop code is unrolled.
11287
11288 @item max-average-unrolled-insns
11289 The maximum number of instructions biased by probabilities of their execution
11290 that a loop may have to be unrolled. If a loop is unrolled,
11291 this parameter also determines how many times the loop code is unrolled.
11292
11293 @item max-unroll-times
11294 The maximum number of unrollings of a single loop.
11295
11296 @item max-peeled-insns
11297 The maximum number of instructions that a loop may have to be peeled.
11298 If a loop is peeled, this parameter also determines how many times
11299 the loop code is peeled.
11300
11301 @item max-peel-times
11302 The maximum number of peelings of a single loop.
11303
11304 @item max-peel-branches
11305 The maximum number of branches on the hot path through the peeled sequence.
11306
11307 @item max-completely-peeled-insns
11308 The maximum number of insns of a completely peeled loop.
11309
11310 @item max-completely-peel-times
11311 The maximum number of iterations of a loop to be suitable for complete peeling.
11312
11313 @item max-completely-peel-loop-nest-depth
11314 The maximum depth of a loop nest suitable for complete peeling.
11315
11316 @item max-unswitch-insns
11317 The maximum number of insns of an unswitched loop.
11318
11319 @item max-unswitch-level
11320 The maximum number of branches unswitched in a single loop.
11321
11322 @item lim-expensive
11323 The minimum cost of an expensive expression in the loop invariant motion.
11324
11325 @item iv-consider-all-candidates-bound
11326 Bound on number of candidates for induction variables, below which
11327 all candidates are considered for each use in induction variable
11328 optimizations. If there are more candidates than this,
11329 only the most relevant ones are considered to avoid quadratic time complexity.
11330
11331 @item iv-max-considered-uses
11332 The induction variable optimizations give up on loops that contain more
11333 induction variable uses.
11334
11335 @item iv-always-prune-cand-set-bound
11336 If the number of candidates in the set is smaller than this value,
11337 always try to remove unnecessary ivs from the set
11338 when adding a new one.
11339
11340 @item avg-loop-niter
11341 Average number of iterations of a loop.
11342
11343 @item dse-max-object-size
11344 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11345 Larger values may result in larger compilation times.
11346
11347 @item dse-max-alias-queries-per-store
11348 Maximum number of queries into the alias oracle per store.
11349 Larger values result in larger compilation times and may result in more
11350 removed dead stores.
11351
11352 @item scev-max-expr-size
11353 Bound on size of expressions used in the scalar evolutions analyzer.
11354 Large expressions slow the analyzer.
11355
11356 @item scev-max-expr-complexity
11357 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11358 Complex expressions slow the analyzer.
11359
11360 @item max-tree-if-conversion-phi-args
11361 Maximum number of arguments in a PHI supported by TREE if conversion
11362 unless the loop is marked with simd pragma.
11363
11364 @item vect-max-version-for-alignment-checks
11365 The maximum number of run-time checks that can be performed when
11366 doing loop versioning for alignment in the vectorizer.
11367
11368 @item vect-max-version-for-alias-checks
11369 The maximum number of run-time checks that can be performed when
11370 doing loop versioning for alias in the vectorizer.
11371
11372 @item vect-max-peeling-for-alignment
11373 The maximum number of loop peels to enhance access alignment
11374 for vectorizer. Value -1 means no limit.
11375
11376 @item max-iterations-to-track
11377 The maximum number of iterations of a loop the brute-force algorithm
11378 for analysis of the number of iterations of the loop tries to evaluate.
11379
11380 @item hot-bb-count-ws-permille
11381 A basic block profile count is considered hot if it contributes to
11382 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11383
11384 @item hot-bb-frequency-fraction
11385 Select fraction of the entry block frequency of executions of basic block in
11386 function given basic block needs to have to be considered hot.
11387
11388 @item max-predicted-iterations
11389 The maximum number of loop iterations we predict statically. This is useful
11390 in cases where a function contains a single loop with known bound and
11391 another loop with unknown bound.
11392 The known number of iterations is predicted correctly, while
11393 the unknown number of iterations average to roughly 10. This means that the
11394 loop without bounds appears artificially cold relative to the other one.
11395
11396 @item builtin-expect-probability
11397 Control the probability of the expression having the specified value. This
11398 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11399
11400 @item builtin-string-cmp-inline-length
11401 The maximum length of a constant string for a builtin string cmp call
11402 eligible for inlining.
11403
11404 @item align-threshold
11405
11406 Select fraction of the maximal frequency of executions of a basic block in
11407 a function to align the basic block.
11408
11409 @item align-loop-iterations
11410
11411 A loop expected to iterate at least the selected number of iterations is
11412 aligned.
11413
11414 @item tracer-dynamic-coverage
11415 @itemx tracer-dynamic-coverage-feedback
11416
11417 This value is used to limit superblock formation once the given percentage of
11418 executed instructions is covered. This limits unnecessary code size
11419 expansion.
11420
11421 The @option{tracer-dynamic-coverage-feedback} parameter
11422 is used only when profile
11423 feedback is available. The real profiles (as opposed to statically estimated
11424 ones) are much less balanced allowing the threshold to be larger value.
11425
11426 @item tracer-max-code-growth
11427 Stop tail duplication once code growth has reached given percentage. This is
11428 a rather artificial limit, as most of the duplicates are eliminated later in
11429 cross jumping, so it may be set to much higher values than is the desired code
11430 growth.
11431
11432 @item tracer-min-branch-ratio
11433
11434 Stop reverse growth when the reverse probability of best edge is less than this
11435 threshold (in percent).
11436
11437 @item tracer-min-branch-probability
11438 @itemx tracer-min-branch-probability-feedback
11439
11440 Stop forward growth if the best edge has probability lower than this
11441 threshold.
11442
11443 Similarly to @option{tracer-dynamic-coverage} two parameters are
11444 provided. @option{tracer-min-branch-probability-feedback} is used for
11445 compilation with profile feedback and @option{tracer-min-branch-probability}
11446 compilation without. The value for compilation with profile feedback
11447 needs to be more conservative (higher) in order to make tracer
11448 effective.
11449
11450 @item stack-clash-protection-guard-size
11451 Specify the size of the operating system provided stack guard as
11452 2 raised to @var{num} bytes. Higher values may reduce the
11453 number of explicit probes, but a value larger than the operating system
11454 provided guard will leave code vulnerable to stack clash style attacks.
11455
11456 @item stack-clash-protection-probe-interval
11457 Stack clash protection involves probing stack space as it is allocated. This
11458 param controls the maximum distance between probes into the stack as 2 raised
11459 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11460 larger than the operating system provided guard will leave code vulnerable to
11461 stack clash style attacks.
11462
11463 @item max-cse-path-length
11464
11465 The maximum number of basic blocks on path that CSE considers.
11466
11467 @item max-cse-insns
11468 The maximum number of instructions CSE processes before flushing.
11469
11470 @item ggc-min-expand
11471
11472 GCC uses a garbage collector to manage its own memory allocation. This
11473 parameter specifies the minimum percentage by which the garbage
11474 collector's heap should be allowed to expand between collections.
11475 Tuning this may improve compilation speed; it has no effect on code
11476 generation.
11477
11478 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11479 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11480 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11481 GCC is not able to calculate RAM on a particular platform, the lower
11482 bound of 30% is used. Setting this parameter and
11483 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11484 every opportunity. This is extremely slow, but can be useful for
11485 debugging.
11486
11487 @item ggc-min-heapsize
11488
11489 Minimum size of the garbage collector's heap before it begins bothering
11490 to collect garbage. The first collection occurs after the heap expands
11491 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11492 tuning this may improve compilation speed, and has no effect on code
11493 generation.
11494
11495 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11496 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11497 with a lower bound of 4096 (four megabytes) and an upper bound of
11498 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11499 particular platform, the lower bound is used. Setting this parameter
11500 very large effectively disables garbage collection. Setting this
11501 parameter and @option{ggc-min-expand} to zero causes a full collection
11502 to occur at every opportunity.
11503
11504 @item max-reload-search-insns
11505 The maximum number of instruction reload should look backward for equivalent
11506 register. Increasing values mean more aggressive optimization, making the
11507 compilation time increase with probably slightly better performance.
11508
11509 @item max-cselib-memory-locations
11510 The maximum number of memory locations cselib should take into account.
11511 Increasing values mean more aggressive optimization, making the compilation time
11512 increase with probably slightly better performance.
11513
11514 @item max-sched-ready-insns
11515 The maximum number of instructions ready to be issued the scheduler should
11516 consider at any given time during the first scheduling pass. Increasing
11517 values mean more thorough searches, making the compilation time increase
11518 with probably little benefit.
11519
11520 @item max-sched-region-blocks
11521 The maximum number of blocks in a region to be considered for
11522 interblock scheduling.
11523
11524 @item max-pipeline-region-blocks
11525 The maximum number of blocks in a region to be considered for
11526 pipelining in the selective scheduler.
11527
11528 @item max-sched-region-insns
11529 The maximum number of insns in a region to be considered for
11530 interblock scheduling.
11531
11532 @item max-pipeline-region-insns
11533 The maximum number of insns in a region to be considered for
11534 pipelining in the selective scheduler.
11535
11536 @item min-spec-prob
11537 The minimum probability (in percents) of reaching a source block
11538 for interblock speculative scheduling.
11539
11540 @item max-sched-extend-regions-iters
11541 The maximum number of iterations through CFG to extend regions.
11542 A value of 0 disables region extensions.
11543
11544 @item max-sched-insn-conflict-delay
11545 The maximum conflict delay for an insn to be considered for speculative motion.
11546
11547 @item sched-spec-prob-cutoff
11548 The minimal probability of speculation success (in percents), so that
11549 speculative insns are scheduled.
11550
11551 @item sched-state-edge-prob-cutoff
11552 The minimum probability an edge must have for the scheduler to save its
11553 state across it.
11554
11555 @item sched-mem-true-dep-cost
11556 Minimal distance (in CPU cycles) between store and load targeting same
11557 memory locations.
11558
11559 @item selsched-max-lookahead
11560 The maximum size of the lookahead window of selective scheduling. It is a
11561 depth of search for available instructions.
11562
11563 @item selsched-max-sched-times
11564 The maximum number of times that an instruction is scheduled during
11565 selective scheduling. This is the limit on the number of iterations
11566 through which the instruction may be pipelined.
11567
11568 @item selsched-insns-to-rename
11569 The maximum number of best instructions in the ready list that are considered
11570 for renaming in the selective scheduler.
11571
11572 @item sms-min-sc
11573 The minimum value of stage count that swing modulo scheduler
11574 generates.
11575
11576 @item max-last-value-rtl
11577 The maximum size measured as number of RTLs that can be recorded in an expression
11578 in combiner for a pseudo register as last known value of that register.
11579
11580 @item max-combine-insns
11581 The maximum number of instructions the RTL combiner tries to combine.
11582
11583 @item integer-share-limit
11584 Small integer constants can use a shared data structure, reducing the
11585 compiler's memory usage and increasing its speed. This sets the maximum
11586 value of a shared integer constant.
11587
11588 @item ssp-buffer-size
11589 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11590 protection when @option{-fstack-protection} is used.
11591
11592 @item min-size-for-stack-sharing
11593 The minimum size of variables taking part in stack slot sharing when not
11594 optimizing.
11595
11596 @item max-jump-thread-duplication-stmts
11597 Maximum number of statements allowed in a block that needs to be
11598 duplicated when threading jumps.
11599
11600 @item max-fields-for-field-sensitive
11601 Maximum number of fields in a structure treated in
11602 a field sensitive manner during pointer analysis.
11603
11604 @item prefetch-latency
11605 Estimate on average number of instructions that are executed before
11606 prefetch finishes. The distance prefetched ahead is proportional
11607 to this constant. Increasing this number may also lead to less
11608 streams being prefetched (see @option{simultaneous-prefetches}).
11609
11610 @item simultaneous-prefetches
11611 Maximum number of prefetches that can run at the same time.
11612
11613 @item l1-cache-line-size
11614 The size of cache line in L1 data cache, in bytes.
11615
11616 @item l1-cache-size
11617 The size of L1 data cache, in kilobytes.
11618
11619 @item l2-cache-size
11620 The size of L2 data cache, in kilobytes.
11621
11622 @item prefetch-dynamic-strides
11623 Whether the loop array prefetch pass should issue software prefetch hints
11624 for strides that are non-constant. In some cases this may be
11625 beneficial, though the fact the stride is non-constant may make it
11626 hard to predict when there is clear benefit to issuing these hints.
11627
11628 Set to 1 if the prefetch hints should be issued for non-constant
11629 strides. Set to 0 if prefetch hints should be issued only for strides that
11630 are known to be constant and below @option{prefetch-minimum-stride}.
11631
11632 @item prefetch-minimum-stride
11633 Minimum constant stride, in bytes, to start using prefetch hints for. If
11634 the stride is less than this threshold, prefetch hints will not be issued.
11635
11636 This setting is useful for processors that have hardware prefetchers, in
11637 which case there may be conflicts between the hardware prefetchers and
11638 the software prefetchers. If the hardware prefetchers have a maximum
11639 stride they can handle, it should be used here to improve the use of
11640 software prefetchers.
11641
11642 A value of -1 means we don't have a threshold and therefore
11643 prefetch hints can be issued for any constant stride.
11644
11645 This setting is only useful for strides that are known and constant.
11646
11647 @item loop-interchange-max-num-stmts
11648 The maximum number of stmts in a loop to be interchanged.
11649
11650 @item loop-interchange-stride-ratio
11651 The minimum ratio between stride of two loops for interchange to be profitable.
11652
11653 @item min-insn-to-prefetch-ratio
11654 The minimum ratio between the number of instructions and the
11655 number of prefetches to enable prefetching in a loop.
11656
11657 @item prefetch-min-insn-to-mem-ratio
11658 The minimum ratio between the number of instructions and the
11659 number of memory references to enable prefetching in a loop.
11660
11661 @item use-canonical-types
11662 Whether the compiler should use the ``canonical'' type system.
11663 Should always be 1, which uses a more efficient internal
11664 mechanism for comparing types in C++ and Objective-C++. However, if
11665 bugs in the canonical type system are causing compilation failures,
11666 set this value to 0 to disable canonical types.
11667
11668 @item switch-conversion-max-branch-ratio
11669 Switch initialization conversion refuses to create arrays that are
11670 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11671 branches in the switch.
11672
11673 @item max-partial-antic-length
11674 Maximum length of the partial antic set computed during the tree
11675 partial redundancy elimination optimization (@option{-ftree-pre}) when
11676 optimizing at @option{-O3} and above. For some sorts of source code
11677 the enhanced partial redundancy elimination optimization can run away,
11678 consuming all of the memory available on the host machine. This
11679 parameter sets a limit on the length of the sets that are computed,
11680 which prevents the runaway behavior. Setting a value of 0 for
11681 this parameter allows an unlimited set length.
11682
11683 @item rpo-vn-max-loop-depth
11684 Maximum loop depth that is value-numbered optimistically.
11685 When the limit hits the innermost
11686 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11687 loop nest are value-numbered optimistically and the remaining ones not.
11688
11689 @item sccvn-max-alias-queries-per-access
11690 Maximum number of alias-oracle queries we perform when looking for
11691 redundancies for loads and stores. If this limit is hit the search
11692 is aborted and the load or store is not considered redundant. The
11693 number of queries is algorithmically limited to the number of
11694 stores on all paths from the load to the function entry.
11695
11696 @item ira-max-loops-num
11697 IRA uses regional register allocation by default. If a function
11698 contains more loops than the number given by this parameter, only at most
11699 the given number of the most frequently-executed loops form regions
11700 for regional register allocation.
11701
11702 @item ira-max-conflict-table-size
11703 Although IRA uses a sophisticated algorithm to compress the conflict
11704 table, the table can still require excessive amounts of memory for
11705 huge functions. If the conflict table for a function could be more
11706 than the size in MB given by this parameter, the register allocator
11707 instead uses a faster, simpler, and lower-quality
11708 algorithm that does not require building a pseudo-register conflict table.
11709
11710 @item ira-loop-reserved-regs
11711 IRA can be used to evaluate more accurate register pressure in loops
11712 for decisions to move loop invariants (see @option{-O3}). The number
11713 of available registers reserved for some other purposes is given
11714 by this parameter. Default of the parameter
11715 is the best found from numerous experiments.
11716
11717 @item lra-inheritance-ebb-probability-cutoff
11718 LRA tries to reuse values reloaded in registers in subsequent insns.
11719 This optimization is called inheritance. EBB is used as a region to
11720 do this optimization. The parameter defines a minimal fall-through
11721 edge probability in percentage used to add BB to inheritance EBB in
11722 LRA. The default value was chosen
11723 from numerous runs of SPEC2000 on x86-64.
11724
11725 @item loop-invariant-max-bbs-in-loop
11726 Loop invariant motion can be very expensive, both in compilation time and
11727 in amount of needed compile-time memory, with very large loops. Loops
11728 with more basic blocks than this parameter won't have loop invariant
11729 motion optimization performed on them.
11730
11731 @item loop-max-datarefs-for-datadeps
11732 Building data dependencies is expensive for very large loops. This
11733 parameter limits the number of data references in loops that are
11734 considered for data dependence analysis. These large loops are no
11735 handled by the optimizations using loop data dependencies.
11736
11737 @item max-vartrack-size
11738 Sets a maximum number of hash table slots to use during variable
11739 tracking dataflow analysis of any function. If this limit is exceeded
11740 with variable tracking at assignments enabled, analysis for that
11741 function is retried without it, after removing all debug insns from
11742 the function. If the limit is exceeded even without debug insns, var
11743 tracking analysis is completely disabled for the function. Setting
11744 the parameter to zero makes it unlimited.
11745
11746 @item max-vartrack-expr-depth
11747 Sets a maximum number of recursion levels when attempting to map
11748 variable names or debug temporaries to value expressions. This trades
11749 compilation time for more complete debug information. If this is set too
11750 low, value expressions that are available and could be represented in
11751 debug information may end up not being used; setting this higher may
11752 enable the compiler to find more complex debug expressions, but compile
11753 time and memory use may grow.
11754
11755 @item max-debug-marker-count
11756 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11757 markers) to avoid complexity explosion at inlining or expanding to RTL.
11758 If a function has more such gimple stmts than the set limit, such stmts
11759 will be dropped from the inlined copy of a function, and from its RTL
11760 expansion.
11761
11762 @item min-nondebug-insn-uid
11763 Use uids starting at this parameter for nondebug insns. The range below
11764 the parameter is reserved exclusively for debug insns created by
11765 @option{-fvar-tracking-assignments}, but debug insns may get
11766 (non-overlapping) uids above it if the reserved range is exhausted.
11767
11768 @item ipa-sra-ptr-growth-factor
11769 IPA-SRA replaces a pointer to an aggregate with one or more new
11770 parameters only when their cumulative size is less or equal to
11771 @option{ipa-sra-ptr-growth-factor} times the size of the original
11772 pointer parameter.
11773
11774 @item sra-max-scalarization-size-Ospeed
11775 @itemx sra-max-scalarization-size-Osize
11776 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11777 replace scalar parts of aggregates with uses of independent scalar
11778 variables. These parameters control the maximum size, in storage units,
11779 of aggregate which is considered for replacement when compiling for
11780 speed
11781 (@option{sra-max-scalarization-size-Ospeed}) or size
11782 (@option{sra-max-scalarization-size-Osize}) respectively.
11783
11784 @item tm-max-aggregate-size
11785 When making copies of thread-local variables in a transaction, this
11786 parameter specifies the size in bytes after which variables are
11787 saved with the logging functions as opposed to save/restore code
11788 sequence pairs. This option only applies when using
11789 @option{-fgnu-tm}.
11790
11791 @item graphite-max-nb-scop-params
11792 To avoid exponential effects in the Graphite loop transforms, the
11793 number of parameters in a Static Control Part (SCoP) is bounded.
11794 A value of zero can be used to lift
11795 the bound. A variable whose value is unknown at compilation time and
11796 defined outside a SCoP is a parameter of the SCoP.
11797
11798 @item loop-block-tile-size
11799 Loop blocking or strip mining transforms, enabled with
11800 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11801 loop in the loop nest by a given number of iterations. The strip
11802 length can be changed using the @option{loop-block-tile-size}
11803 parameter.
11804
11805 @item ipa-cp-value-list-size
11806 IPA-CP attempts to track all possible values and types passed to a function's
11807 parameter in order to propagate them and perform devirtualization.
11808 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11809 stores per one formal parameter of a function.
11810
11811 @item ipa-cp-eval-threshold
11812 IPA-CP calculates its own score of cloning profitability heuristics
11813 and performs those cloning opportunities with scores that exceed
11814 @option{ipa-cp-eval-threshold}.
11815
11816 @item ipa-cp-recursion-penalty
11817 Percentage penalty the recursive functions will receive when they
11818 are evaluated for cloning.
11819
11820 @item ipa-cp-single-call-penalty
11821 Percentage penalty functions containing a single call to another
11822 function will receive when they are evaluated for cloning.
11823
11824 @item ipa-max-agg-items
11825 IPA-CP is also capable to propagate a number of scalar values passed
11826 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11827 number of such values per one parameter.
11828
11829 @item ipa-cp-loop-hint-bonus
11830 When IPA-CP determines that a cloning candidate would make the number
11831 of iterations of a loop known, it adds a bonus of
11832 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11833 the candidate.
11834
11835 @item ipa-cp-array-index-hint-bonus
11836 When IPA-CP determines that a cloning candidate would make the index of
11837 an array access known, it adds a bonus of
11838 @option{ipa-cp-array-index-hint-bonus} to the profitability
11839 score of the candidate.
11840
11841 @item ipa-max-aa-steps
11842 During its analysis of function bodies, IPA-CP employs alias analysis
11843 in order to track values pointed to by function parameters. In order
11844 not spend too much time analyzing huge functions, it gives up and
11845 consider all memory clobbered after examining
11846 @option{ipa-max-aa-steps} statements modifying memory.
11847
11848 @item lto-partitions
11849 Specify desired number of partitions produced during WHOPR compilation.
11850 The number of partitions should exceed the number of CPUs used for compilation.
11851
11852 @item lto-min-partition
11853 Size of minimal partition for WHOPR (in estimated instructions).
11854 This prevents expenses of splitting very small programs into too many
11855 partitions.
11856
11857 @item lto-max-partition
11858 Size of max partition for WHOPR (in estimated instructions).
11859 to provide an upper bound for individual size of partition.
11860 Meant to be used only with balanced partitioning.
11861
11862 @item cxx-max-namespaces-for-diagnostic-help
11863 The maximum number of namespaces to consult for suggestions when C++
11864 name lookup fails for an identifier.
11865
11866 @item sink-frequency-threshold
11867 The maximum relative execution frequency (in percents) of the target block
11868 relative to a statement's original block to allow statement sinking of a
11869 statement. Larger numbers result in more aggressive statement sinking.
11870 A small positive adjustment is applied for
11871 statements with memory operands as those are even more profitable so sink.
11872
11873 @item max-stores-to-sink
11874 The maximum number of conditional store pairs that can be sunk. Set to 0
11875 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11876 (@option{-ftree-loop-if-convert}) is disabled.
11877
11878 @item allow-store-data-races
11879 Allow optimizers to introduce new data races on stores.
11880 Set to 1 to allow, otherwise to 0.
11881
11882 @item case-values-threshold
11883 The smallest number of different values for which it is best to use a
11884 jump-table instead of a tree of conditional branches. If the value is
11885 0, use the default for the machine.
11886
11887 @item tree-reassoc-width
11888 Set the maximum number of instructions executed in parallel in
11889 reassociated tree. This parameter overrides target dependent
11890 heuristics used by default if has non zero value.
11891
11892 @item sched-pressure-algorithm
11893 Choose between the two available implementations of
11894 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11895 and is the more likely to prevent instructions from being reordered.
11896 Algorithm 2 was designed to be a compromise between the relatively
11897 conservative approach taken by algorithm 1 and the rather aggressive
11898 approach taken by the default scheduler. It relies more heavily on
11899 having a regular register file and accurate register pressure classes.
11900 See @file{haifa-sched.c} in the GCC sources for more details.
11901
11902 The default choice depends on the target.
11903
11904 @item max-slsr-cand-scan
11905 Set the maximum number of existing candidates that are considered when
11906 seeking a basis for a new straight-line strength reduction candidate.
11907
11908 @item asan-globals
11909 Enable buffer overflow detection for global objects. This kind
11910 of protection is enabled by default if you are using
11911 @option{-fsanitize=address} option.
11912 To disable global objects protection use @option{--param asan-globals=0}.
11913
11914 @item asan-stack
11915 Enable buffer overflow detection for stack objects. This kind of
11916 protection is enabled by default when using @option{-fsanitize=address}.
11917 To disable stack protection use @option{--param asan-stack=0} option.
11918
11919 @item asan-instrument-reads
11920 Enable buffer overflow detection for memory reads. This kind of
11921 protection is enabled by default when using @option{-fsanitize=address}.
11922 To disable memory reads protection use
11923 @option{--param asan-instrument-reads=0}.
11924
11925 @item asan-instrument-writes
11926 Enable buffer overflow detection for memory writes. This kind of
11927 protection is enabled by default when using @option{-fsanitize=address}.
11928 To disable memory writes protection use
11929 @option{--param asan-instrument-writes=0} option.
11930
11931 @item asan-memintrin
11932 Enable detection for built-in functions. This kind of protection
11933 is enabled by default when using @option{-fsanitize=address}.
11934 To disable built-in functions protection use
11935 @option{--param asan-memintrin=0}.
11936
11937 @item asan-use-after-return
11938 Enable detection of use-after-return. This kind of protection
11939 is enabled by default when using the @option{-fsanitize=address} option.
11940 To disable it use @option{--param asan-use-after-return=0}.
11941
11942 Note: By default the check is disabled at run time. To enable it,
11943 add @code{detect_stack_use_after_return=1} to the environment variable
11944 @env{ASAN_OPTIONS}.
11945
11946 @item asan-instrumentation-with-call-threshold
11947 If number of memory accesses in function being instrumented
11948 is greater or equal to this number, use callbacks instead of inline checks.
11949 E.g. to disable inline code use
11950 @option{--param asan-instrumentation-with-call-threshold=0}.
11951
11952 @item use-after-scope-direct-emission-threshold
11953 If the size of a local variable in bytes is smaller or equal to this
11954 number, directly poison (or unpoison) shadow memory instead of using
11955 run-time callbacks.
11956
11957 @item max-fsm-thread-path-insns
11958 Maximum number of instructions to copy when duplicating blocks on a
11959 finite state automaton jump thread path.
11960
11961 @item max-fsm-thread-length
11962 Maximum number of basic blocks on a finite state automaton jump thread
11963 path.
11964
11965 @item max-fsm-thread-paths
11966 Maximum number of new jump thread paths to create for a finite state
11967 automaton.
11968
11969 @item parloops-chunk-size
11970 Chunk size of omp schedule for loops parallelized by parloops.
11971
11972 @item parloops-schedule
11973 Schedule type of omp schedule for loops parallelized by parloops (static,
11974 dynamic, guided, auto, runtime).
11975
11976 @item parloops-min-per-thread
11977 The minimum number of iterations per thread of an innermost parallelized
11978 loop for which the parallelized variant is preferred over the single threaded
11979 one. Note that for a parallelized loop nest the
11980 minimum number of iterations of the outermost loop per thread is two.
11981
11982 @item max-ssa-name-query-depth
11983 Maximum depth of recursion when querying properties of SSA names in things
11984 like fold routines. One level of recursion corresponds to following a
11985 use-def chain.
11986
11987 @item hsa-gen-debug-stores
11988 Enable emission of special debug stores within HSA kernels which are
11989 then read and reported by libgomp plugin. Generation of these stores
11990 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11991 enable it.
11992
11993 @item max-speculative-devirt-maydefs
11994 The maximum number of may-defs we analyze when looking for a must-def
11995 specifying the dynamic type of an object that invokes a virtual call
11996 we may be able to devirtualize speculatively.
11997
11998 @item max-vrp-switch-assertions
11999 The maximum number of assertions to add along the default edge of a switch
12000 statement during VRP.
12001
12002 @item unroll-jam-min-percent
12003 The minimum percentage of memory references that must be optimized
12004 away for the unroll-and-jam transformation to be considered profitable.
12005
12006 @item unroll-jam-max-unroll
12007 The maximum number of times the outer loop should be unrolled by
12008 the unroll-and-jam transformation.
12009
12010 @item max-rtl-if-conversion-unpredictable-cost
12011 Maximum permissible cost for the sequence that would be generated
12012 by the RTL if-conversion pass for a branch that is considered unpredictable.
12013
12014 @item max-variable-expansions-in-unroller
12015 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12016 of times that an individual variable will be expanded during loop unrolling.
12017
12018 @item tracer-min-branch-probability-feedback
12019 Stop forward growth if the probability of best edge is less than
12020 this threshold (in percent). Used when profile feedback is available.
12021
12022 @item partial-inlining-entry-probability
12023 Maximum probability of the entry BB of split region
12024 (in percent relative to entry BB of the function)
12025 to make partial inlining happen.
12026
12027 @item max-tracked-strlens
12028 Maximum number of strings for which strlen optimization pass will
12029 track string lengths.
12030
12031 @item gcse-after-reload-partial-fraction
12032 The threshold ratio for performing partial redundancy
12033 elimination after reload.
12034
12035 @item gcse-after-reload-critical-fraction
12036 The threshold ratio of critical edges execution count that
12037 permit performing redundancy elimination after reload.
12038
12039 @item max-loop-header-insns
12040 The maximum number of insns in loop header duplicated
12041 by the copy loop headers pass.
12042
12043 @item vect-epilogues-nomask
12044 Enable loop epilogue vectorization using smaller vector size.
12045
12046 @item slp-max-insns-in-bb
12047 Maximum number of instructions in basic block to be
12048 considered for SLP vectorization.
12049
12050 @item avoid-fma-max-bits
12051 Maximum number of bits for which we avoid creating FMAs.
12052
12053 @item sms-loop-average-count-threshold
12054 A threshold on the average loop count considered by the swing modulo scheduler.
12055
12056 @item sms-dfa-history
12057 The number of cycles the swing modulo scheduler considers when checking
12058 conflicts using DFA.
12059
12060 @item hot-bb-count-fraction
12061 Select fraction of the maximal count of repetitions of basic block
12062 in program given basic block needs
12063 to have to be considered hot (used in non-LTO mode)
12064
12065 @item max-inline-insns-recursive-auto
12066 The maximum number of instructions non-inline function
12067 can grow to via recursive inlining.
12068
12069 @item graphite-allow-codegen-errors
12070 Whether codegen errors should be ICEs when @option{-fchecking}.
12071
12072 @item sms-max-ii-factor
12073 A factor for tuning the upper bound that swing modulo scheduler
12074 uses for scheduling a loop.
12075
12076 @item lra-max-considered-reload-pseudos
12077 The max number of reload pseudos which are considered during
12078 spilling a non-reload pseudo.
12079
12080 @item max-pow-sqrt-depth
12081 Maximum depth of sqrt chains to use when synthesizing exponentiation
12082 by a real constant.
12083
12084 @item max-dse-active-local-stores
12085 Maximum number of active local stores in RTL dead store elimination.
12086
12087 @item asan-instrument-allocas
12088 Enable asan allocas/VLAs protection.
12089
12090 @item max-iterations-computation-cost
12091 Bound on the cost of an expression to compute the number of iterations.
12092
12093 @item max-isl-operations
12094 Maximum number of isl operations, 0 means unlimited.
12095
12096 @item graphite-max-arrays-per-scop
12097 Maximum number of arrays per scop.
12098
12099 @item max-vartrack-reverse-op-size
12100 Max. size of loc list for which reverse ops should be added.
12101
12102 @item unlikely-bb-count-fraction
12103 The minimum fraction of profile runs a given basic block execution count
12104 must be not to be considered unlikely.
12105
12106 @item tracer-dynamic-coverage-feedback
12107 The percentage of function, weighted by execution frequency,
12108 that must be covered by trace formation.
12109 Used when profile feedback is available.
12110
12111 @item max-inline-recursive-depth-auto
12112 The maximum depth of recursive inlining for non-inline functions.
12113
12114 @item fsm-scale-path-stmts
12115 Scale factor to apply to the number of statements in a threading path
12116 when comparing to the number of (scaled) blocks.
12117
12118 @item fsm-maximum-phi-arguments
12119 Maximum number of arguments a PHI may have before the FSM threader
12120 will not try to thread through its block.
12121
12122 @item uninit-control-dep-attempts
12123 Maximum number of nested calls to search for control dependencies
12124 during uninitialized variable analysis.
12125
12126 @item indir-call-topn-profile
12127 Track top N target addresses in indirect-call profile.
12128
12129 @item max-once-peeled-insns
12130 The maximum number of insns of a peeled loop that rolls only once.
12131
12132 @item sra-max-scalarization-size-Osize
12133 Maximum size, in storage units, of an aggregate
12134 which should be considered for scalarization when compiling for size.
12135
12136 @item fsm-scale-path-blocks
12137 Scale factor to apply to the number of blocks in a threading path
12138 when comparing to the number of (scaled) statements.
12139
12140 @item sched-autopref-queue-depth
12141 Hardware autoprefetcher scheduler model control flag.
12142 Number of lookahead cycles the model looks into; at '
12143 ' only enable instruction sorting heuristic.
12144
12145 @item loop-versioning-max-inner-insns
12146 The maximum number of instructions that an inner loop can have
12147 before the loop versioning pass considers it too big to copy.
12148
12149 @item loop-versioning-max-outer-insns
12150 The maximum number of instructions that an outer loop can have
12151 before the loop versioning pass considers it too big to copy,
12152 discounting any instructions in inner loops that directly benefit
12153 from versioning.
12154
12155 @end table
12156 @end table
12157
12158 @node Instrumentation Options
12159 @section Program Instrumentation Options
12160 @cindex instrumentation options
12161 @cindex program instrumentation options
12162 @cindex run-time error checking options
12163 @cindex profiling options
12164 @cindex options, program instrumentation
12165 @cindex options, run-time error checking
12166 @cindex options, profiling
12167
12168 GCC supports a number of command-line options that control adding
12169 run-time instrumentation to the code it normally generates.
12170 For example, one purpose of instrumentation is collect profiling
12171 statistics for use in finding program hot spots, code coverage
12172 analysis, or profile-guided optimizations.
12173 Another class of program instrumentation is adding run-time checking
12174 to detect programming errors like invalid pointer
12175 dereferences or out-of-bounds array accesses, as well as deliberately
12176 hostile attacks such as stack smashing or C++ vtable hijacking.
12177 There is also a general hook which can be used to implement other
12178 forms of tracing or function-level instrumentation for debug or
12179 program analysis purposes.
12180
12181 @table @gcctabopt
12182 @cindex @command{prof}
12183 @cindex @command{gprof}
12184 @item -p
12185 @itemx -pg
12186 @opindex p
12187 @opindex pg
12188 Generate extra code to write profile information suitable for the
12189 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12190 (for @option{-pg}). You must use this option when compiling
12191 the source files you want data about, and you must also use it when
12192 linking.
12193
12194 You can use the function attribute @code{no_instrument_function} to
12195 suppress profiling of individual functions when compiling with these options.
12196 @xref{Common Function Attributes}.
12197
12198 @item -fprofile-arcs
12199 @opindex fprofile-arcs
12200 Add code so that program flow @dfn{arcs} are instrumented. During
12201 execution the program records how many times each branch and call is
12202 executed and how many times it is taken or returns. On targets that support
12203 constructors with priority support, profiling properly handles constructors,
12204 destructors and C++ constructors (and destructors) of classes which are used
12205 as a type of a global variable.
12206
12207 When the compiled
12208 program exits it saves this data to a file called
12209 @file{@var{auxname}.gcda} for each source file. The data may be used for
12210 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12211 test coverage analysis (@option{-ftest-coverage}). Each object file's
12212 @var{auxname} is generated from the name of the output file, if
12213 explicitly specified and it is not the final executable, otherwise it is
12214 the basename of the source file. In both cases any suffix is removed
12215 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12216 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12217 @xref{Cross-profiling}.
12218
12219 @cindex @command{gcov}
12220 @item --coverage
12221 @opindex coverage
12222
12223 This option is used to compile and link code instrumented for coverage
12224 analysis. The option is a synonym for @option{-fprofile-arcs}
12225 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12226 linking). See the documentation for those options for more details.
12227
12228 @itemize
12229
12230 @item
12231 Compile the source files with @option{-fprofile-arcs} plus optimization
12232 and code generation options. For test coverage analysis, use the
12233 additional @option{-ftest-coverage} option. You do not need to profile
12234 every source file in a program.
12235
12236 @item
12237 Compile the source files additionally with @option{-fprofile-abs-path}
12238 to create absolute path names in the @file{.gcno} files. This allows
12239 @command{gcov} to find the correct sources in projects where compilations
12240 occur with different working directories.
12241
12242 @item
12243 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12244 (the latter implies the former).
12245
12246 @item
12247 Run the program on a representative workload to generate the arc profile
12248 information. This may be repeated any number of times. You can run
12249 concurrent instances of your program, and provided that the file system
12250 supports locking, the data files will be correctly updated. Unless
12251 a strict ISO C dialect option is in effect, @code{fork} calls are
12252 detected and correctly handled without double counting.
12253
12254 @item
12255 For profile-directed optimizations, compile the source files again with
12256 the same optimization and code generation options plus
12257 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12258 Control Optimization}).
12259
12260 @item
12261 For test coverage analysis, use @command{gcov} to produce human readable
12262 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12263 @command{gcov} documentation for further information.
12264
12265 @end itemize
12266
12267 With @option{-fprofile-arcs}, for each function of your program GCC
12268 creates a program flow graph, then finds a spanning tree for the graph.
12269 Only arcs that are not on the spanning tree have to be instrumented: the
12270 compiler adds code to count the number of times that these arcs are
12271 executed. When an arc is the only exit or only entrance to a block, the
12272 instrumentation code can be added to the block; otherwise, a new basic
12273 block must be created to hold the instrumentation code.
12274
12275 @need 2000
12276 @item -ftest-coverage
12277 @opindex ftest-coverage
12278 Produce a notes file that the @command{gcov} code-coverage utility
12279 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12280 show program coverage. Each source file's note file is called
12281 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12282 above for a description of @var{auxname} and instructions on how to
12283 generate test coverage data. Coverage data matches the source files
12284 more closely if you do not optimize.
12285
12286 @item -fprofile-abs-path
12287 @opindex fprofile-abs-path
12288 Automatically convert relative source file names to absolute path names
12289 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12290 sources in projects where compilations occur with different working
12291 directories.
12292
12293 @item -fprofile-dir=@var{path}
12294 @opindex fprofile-dir
12295
12296 Set the directory to search for the profile data files in to @var{path}.
12297 This option affects only the profile data generated by
12298 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12299 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12300 and its related options. Both absolute and relative paths can be used.
12301 By default, GCC uses the current directory as @var{path}, thus the
12302 profile data file appears in the same directory as the object file.
12303 In order to prevent the file name clashing, if the object file name is
12304 not an absolute path, we mangle the absolute path of the
12305 @file{@var{sourcename}.gcda} file and use it as the file name of a
12306 @file{.gcda} file.
12307
12308 When an executable is run in a massive parallel environment, it is recommended
12309 to save profile to different folders. That can be done with variables
12310 in @var{path} that are exported during run-time:
12311
12312 @table @gcctabopt
12313
12314 @item %p
12315 process ID.
12316
12317 @item %q@{VAR@}
12318 value of environment variable @var{VAR}
12319
12320 @end table
12321
12322 @item -fprofile-generate
12323 @itemx -fprofile-generate=@var{path}
12324 @opindex fprofile-generate
12325
12326 Enable options usually used for instrumenting application to produce
12327 profile useful for later recompilation with profile feedback based
12328 optimization. You must use @option{-fprofile-generate} both when
12329 compiling and when linking your program.
12330
12331 The following options are enabled:
12332 @option{-fprofile-arcs}, @option{-fprofile-values},
12333 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12334
12335 If @var{path} is specified, GCC looks at the @var{path} to find
12336 the profile feedback data files. See @option{-fprofile-dir}.
12337
12338 To optimize the program based on the collected profile information, use
12339 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12340
12341 @item -fprofile-update=@var{method}
12342 @opindex fprofile-update
12343
12344 Alter the update method for an application instrumented for profile
12345 feedback based optimization. The @var{method} argument should be one of
12346 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12347 The first one is useful for single-threaded applications,
12348 while the second one prevents profile corruption by emitting thread-safe code.
12349
12350 @strong{Warning:} When an application does not properly join all threads
12351 (or creates an detached thread), a profile file can be still corrupted.
12352
12353 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12354 when supported by a target, or to @samp{single} otherwise. The GCC driver
12355 automatically selects @samp{prefer-atomic} when @option{-pthread}
12356 is present in the command line.
12357
12358 @item -fprofile-filter-files=@var{regex}
12359 @opindex fprofile-filter-files
12360
12361 Instrument only functions from files where names match
12362 any regular expression (separated by a semi-colon).
12363
12364 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12365 only @file{main.c} and all C files starting with 'module'.
12366
12367 @item -fprofile-exclude-files=@var{regex}
12368 @opindex fprofile-exclude-files
12369
12370 Instrument only functions from files where names do not match
12371 all the regular expressions (separated by a semi-colon).
12372
12373 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12374 of all files that are located in @file{/usr/} folder.
12375
12376 @item -fsanitize=address
12377 @opindex fsanitize=address
12378 Enable AddressSanitizer, a fast memory error detector.
12379 Memory access instructions are instrumented to detect
12380 out-of-bounds and use-after-free bugs.
12381 The option enables @option{-fsanitize-address-use-after-scope}.
12382 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12383 more details. The run-time behavior can be influenced using the
12384 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12385 the available options are shown at startup of the instrumented program. See
12386 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12387 for a list of supported options.
12388 The option cannot be combined with @option{-fsanitize=thread}.
12389
12390 @item -fsanitize=kernel-address
12391 @opindex fsanitize=kernel-address
12392 Enable AddressSanitizer for Linux kernel.
12393 See @uref{https://github.com/google/kasan/wiki} for more details.
12394
12395 @item -fsanitize=pointer-compare
12396 @opindex fsanitize=pointer-compare
12397 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12398 The option must be combined with either @option{-fsanitize=kernel-address} or
12399 @option{-fsanitize=address}
12400 The option cannot be combined with @option{-fsanitize=thread}.
12401 Note: By default the check is disabled at run time. To enable it,
12402 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12403 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12404 invalid operation only when both pointers are non-null.
12405
12406 @item -fsanitize=pointer-subtract
12407 @opindex fsanitize=pointer-subtract
12408 Instrument subtraction with pointer operands.
12409 The option must be combined with either @option{-fsanitize=kernel-address} or
12410 @option{-fsanitize=address}
12411 The option cannot be combined with @option{-fsanitize=thread}.
12412 Note: By default the check is disabled at run time. To enable it,
12413 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12414 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12415 invalid operation only when both pointers are non-null.
12416
12417 @item -fsanitize=thread
12418 @opindex fsanitize=thread
12419 Enable ThreadSanitizer, a fast data race detector.
12420 Memory access instructions are instrumented to detect
12421 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12422 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12423 environment variable; see
12424 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12425 supported options.
12426 The option cannot be combined with @option{-fsanitize=address},
12427 @option{-fsanitize=leak}.
12428
12429 Note that sanitized atomic builtins cannot throw exceptions when
12430 operating on invalid memory addresses with non-call exceptions
12431 (@option{-fnon-call-exceptions}).
12432
12433 @item -fsanitize=leak
12434 @opindex fsanitize=leak
12435 Enable LeakSanitizer, a memory leak detector.
12436 This option only matters for linking of executables and
12437 the executable is linked against a library that overrides @code{malloc}
12438 and other allocator functions. See
12439 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12440 details. The run-time behavior can be influenced using the
12441 @env{LSAN_OPTIONS} environment variable.
12442 The option cannot be combined with @option{-fsanitize=thread}.
12443
12444 @item -fsanitize=undefined
12445 @opindex fsanitize=undefined
12446 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12447 Various computations are instrumented to detect undefined behavior
12448 at runtime. Current suboptions are:
12449
12450 @table @gcctabopt
12451
12452 @item -fsanitize=shift
12453 @opindex fsanitize=shift
12454 This option enables checking that the result of a shift operation is
12455 not undefined. Note that what exactly is considered undefined differs
12456 slightly between C and C++, as well as between ISO C90 and C99, etc.
12457 This option has two suboptions, @option{-fsanitize=shift-base} and
12458 @option{-fsanitize=shift-exponent}.
12459
12460 @item -fsanitize=shift-exponent
12461 @opindex fsanitize=shift-exponent
12462 This option enables checking that the second argument of a shift operation
12463 is not negative and is smaller than the precision of the promoted first
12464 argument.
12465
12466 @item -fsanitize=shift-base
12467 @opindex fsanitize=shift-base
12468 If the second argument of a shift operation is within range, check that the
12469 result of a shift operation is not undefined. Note that what exactly is
12470 considered undefined differs slightly between C and C++, as well as between
12471 ISO C90 and C99, etc.
12472
12473 @item -fsanitize=integer-divide-by-zero
12474 @opindex fsanitize=integer-divide-by-zero
12475 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12476
12477 @item -fsanitize=unreachable
12478 @opindex fsanitize=unreachable
12479 With this option, the compiler turns the @code{__builtin_unreachable}
12480 call into a diagnostics message call instead. When reaching the
12481 @code{__builtin_unreachable} call, the behavior is undefined.
12482
12483 @item -fsanitize=vla-bound
12484 @opindex fsanitize=vla-bound
12485 This option instructs the compiler to check that the size of a variable
12486 length array is positive.
12487
12488 @item -fsanitize=null
12489 @opindex fsanitize=null
12490 This option enables pointer checking. Particularly, the application
12491 built with this option turned on will issue an error message when it
12492 tries to dereference a NULL pointer, or if a reference (possibly an
12493 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12494 on an object pointed by a NULL pointer.
12495
12496 @item -fsanitize=return
12497 @opindex fsanitize=return
12498 This option enables return statement checking. Programs
12499 built with this option turned on will issue an error message
12500 when the end of a non-void function is reached without actually
12501 returning a value. This option works in C++ only.
12502
12503 @item -fsanitize=signed-integer-overflow
12504 @opindex fsanitize=signed-integer-overflow
12505 This option enables signed integer overflow checking. We check that
12506 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12507 does not overflow in the signed arithmetics. Note, integer promotion
12508 rules must be taken into account. That is, the following is not an
12509 overflow:
12510 @smallexample
12511 signed char a = SCHAR_MAX;
12512 a++;
12513 @end smallexample
12514
12515 @item -fsanitize=bounds
12516 @opindex fsanitize=bounds
12517 This option enables instrumentation of array bounds. Various out of bounds
12518 accesses are detected. Flexible array members, flexible array member-like
12519 arrays, and initializers of variables with static storage are not instrumented.
12520
12521 @item -fsanitize=bounds-strict
12522 @opindex fsanitize=bounds-strict
12523 This option enables strict instrumentation of array bounds. Most out of bounds
12524 accesses are detected, including flexible array members and flexible array
12525 member-like arrays. Initializers of variables with static storage are not
12526 instrumented.
12527
12528 @item -fsanitize=alignment
12529 @opindex fsanitize=alignment
12530
12531 This option enables checking of alignment of pointers when they are
12532 dereferenced, or when a reference is bound to insufficiently aligned target,
12533 or when a method or constructor is invoked on insufficiently aligned object.
12534
12535 @item -fsanitize=object-size
12536 @opindex fsanitize=object-size
12537 This option enables instrumentation of memory references using the
12538 @code{__builtin_object_size} function. Various out of bounds pointer
12539 accesses are detected.
12540
12541 @item -fsanitize=float-divide-by-zero
12542 @opindex fsanitize=float-divide-by-zero
12543 Detect floating-point division by zero. Unlike other similar options,
12544 @option{-fsanitize=float-divide-by-zero} is not enabled by
12545 @option{-fsanitize=undefined}, since floating-point division by zero can
12546 be a legitimate way of obtaining infinities and NaNs.
12547
12548 @item -fsanitize=float-cast-overflow
12549 @opindex fsanitize=float-cast-overflow
12550 This option enables floating-point type to integer conversion checking.
12551 We check that the result of the conversion does not overflow.
12552 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12553 not enabled by @option{-fsanitize=undefined}.
12554 This option does not work well with @code{FE_INVALID} exceptions enabled.
12555
12556 @item -fsanitize=nonnull-attribute
12557 @opindex fsanitize=nonnull-attribute
12558
12559 This option enables instrumentation of calls, checking whether null values
12560 are not passed to arguments marked as requiring a non-null value by the
12561 @code{nonnull} function attribute.
12562
12563 @item -fsanitize=returns-nonnull-attribute
12564 @opindex fsanitize=returns-nonnull-attribute
12565
12566 This option enables instrumentation of return statements in functions
12567 marked with @code{returns_nonnull} function attribute, to detect returning
12568 of null values from such functions.
12569
12570 @item -fsanitize=bool
12571 @opindex fsanitize=bool
12572
12573 This option enables instrumentation of loads from bool. If a value other
12574 than 0/1 is loaded, a run-time error is issued.
12575
12576 @item -fsanitize=enum
12577 @opindex fsanitize=enum
12578
12579 This option enables instrumentation of loads from an enum type. If
12580 a value outside the range of values for the enum type is loaded,
12581 a run-time error is issued.
12582
12583 @item -fsanitize=vptr
12584 @opindex fsanitize=vptr
12585
12586 This option enables instrumentation of C++ member function calls, member
12587 accesses and some conversions between pointers to base and derived classes,
12588 to verify the referenced object has the correct dynamic type.
12589
12590 @item -fsanitize=pointer-overflow
12591 @opindex fsanitize=pointer-overflow
12592
12593 This option enables instrumentation of pointer arithmetics. If the pointer
12594 arithmetics overflows, a run-time error is issued.
12595
12596 @item -fsanitize=builtin
12597 @opindex fsanitize=builtin
12598
12599 This option enables instrumentation of arguments to selected builtin
12600 functions. If an invalid value is passed to such arguments, a run-time
12601 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12602 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12603 by this option.
12604
12605 @end table
12606
12607 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12608 @option{-fsanitize=undefined} gives a diagnostic message.
12609 This currently works only for the C family of languages.
12610
12611 @item -fno-sanitize=all
12612 @opindex fno-sanitize=all
12613
12614 This option disables all previously enabled sanitizers.
12615 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12616 together.
12617
12618 @item -fasan-shadow-offset=@var{number}
12619 @opindex fasan-shadow-offset
12620 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12621 It is useful for experimenting with different shadow memory layouts in
12622 Kernel AddressSanitizer.
12623
12624 @item -fsanitize-sections=@var{s1},@var{s2},...
12625 @opindex fsanitize-sections
12626 Sanitize global variables in selected user-defined sections. @var{si} may
12627 contain wildcards.
12628
12629 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12630 @opindex fsanitize-recover
12631 @opindex fno-sanitize-recover
12632 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12633 mentioned in comma-separated list of @var{opts}. Enabling this option
12634 for a sanitizer component causes it to attempt to continue
12635 running the program as if no error happened. This means multiple
12636 runtime errors can be reported in a single program run, and the exit
12637 code of the program may indicate success even when errors
12638 have been reported. The @option{-fno-sanitize-recover=} option
12639 can be used to alter
12640 this behavior: only the first detected error is reported
12641 and program then exits with a non-zero exit code.
12642
12643 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12644 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12645 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12646 @option{-fsanitize=bounds-strict},
12647 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12648 For these sanitizers error recovery is turned on by default,
12649 except @option{-fsanitize=address}, for which this feature is experimental.
12650 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12651 accepted, the former enables recovery for all sanitizers that support it,
12652 the latter disables recovery for all sanitizers that support it.
12653
12654 Even if a recovery mode is turned on the compiler side, it needs to be also
12655 enabled on the runtime library side, otherwise the failures are still fatal.
12656 The runtime library defaults to @code{halt_on_error=0} for
12657 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12658 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12659 setting the @code{halt_on_error} flag in the corresponding environment variable.
12660
12661 Syntax without an explicit @var{opts} parameter is deprecated. It is
12662 equivalent to specifying an @var{opts} list of:
12663
12664 @smallexample
12665 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12666 @end smallexample
12667
12668 @item -fsanitize-address-use-after-scope
12669 @opindex fsanitize-address-use-after-scope
12670 Enable sanitization of local variables to detect use-after-scope bugs.
12671 The option sets @option{-fstack-reuse} to @samp{none}.
12672
12673 @item -fsanitize-undefined-trap-on-error
12674 @opindex fsanitize-undefined-trap-on-error
12675 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12676 report undefined behavior using @code{__builtin_trap} rather than
12677 a @code{libubsan} library routine. The advantage of this is that the
12678 @code{libubsan} library is not needed and is not linked in, so this
12679 is usable even in freestanding environments.
12680
12681 @item -fsanitize-coverage=trace-pc
12682 @opindex fsanitize-coverage=trace-pc
12683 Enable coverage-guided fuzzing code instrumentation.
12684 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12685
12686 @item -fsanitize-coverage=trace-cmp
12687 @opindex fsanitize-coverage=trace-cmp
12688 Enable dataflow guided fuzzing code instrumentation.
12689 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12690 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12691 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12692 variable or @code{__sanitizer_cov_trace_const_cmp1},
12693 @code{__sanitizer_cov_trace_const_cmp2},
12694 @code{__sanitizer_cov_trace_const_cmp4} or
12695 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12696 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12697 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12698 @code{__sanitizer_cov_trace_switch} for switch statements.
12699
12700 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12701 @opindex fcf-protection
12702 Enable code instrumentation of control-flow transfers to increase
12703 program security by checking that target addresses of control-flow
12704 transfer instructions (such as indirect function call, function return,
12705 indirect jump) are valid. This prevents diverting the flow of control
12706 to an unexpected target. This is intended to protect against such
12707 threats as Return-oriented Programming (ROP), and similarly
12708 call/jmp-oriented programming (COP/JOP).
12709
12710 The value @code{branch} tells the compiler to implement checking of
12711 validity of control-flow transfer at the point of indirect branch
12712 instructions, i.e.@: call/jmp instructions. The value @code{return}
12713 implements checking of validity at the point of returning from a
12714 function. The value @code{full} is an alias for specifying both
12715 @code{branch} and @code{return}. The value @code{none} turns off
12716 instrumentation.
12717
12718 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12719 used. The first bit of @code{__CET__} is set to 1 for the value
12720 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12721 the @code{return}.
12722
12723 You can also use the @code{nocf_check} attribute to identify
12724 which functions and calls should be skipped from instrumentation
12725 (@pxref{Function Attributes}).
12726
12727 Currently the x86 GNU/Linux target provides an implementation based
12728 on Intel Control-flow Enforcement Technology (CET).
12729
12730 @item -fstack-protector
12731 @opindex fstack-protector
12732 Emit extra code to check for buffer overflows, such as stack smashing
12733 attacks. This is done by adding a guard variable to functions with
12734 vulnerable objects. This includes functions that call @code{alloca}, and
12735 functions with buffers larger than 8 bytes. The guards are initialized
12736 when a function is entered and then checked when the function exits.
12737 If a guard check fails, an error message is printed and the program exits.
12738
12739 @item -fstack-protector-all
12740 @opindex fstack-protector-all
12741 Like @option{-fstack-protector} except that all functions are protected.
12742
12743 @item -fstack-protector-strong
12744 @opindex fstack-protector-strong
12745 Like @option{-fstack-protector} but includes additional functions to
12746 be protected --- those that have local array definitions, or have
12747 references to local frame addresses.
12748
12749 @item -fstack-protector-explicit
12750 @opindex fstack-protector-explicit
12751 Like @option{-fstack-protector} but only protects those functions which
12752 have the @code{stack_protect} attribute.
12753
12754 @item -fstack-check
12755 @opindex fstack-check
12756 Generate code to verify that you do not go beyond the boundary of the
12757 stack. You should specify this flag if you are running in an
12758 environment with multiple threads, but you only rarely need to specify it in
12759 a single-threaded environment since stack overflow is automatically
12760 detected on nearly all systems if there is only one stack.
12761
12762 Note that this switch does not actually cause checking to be done; the
12763 operating system or the language runtime must do that. The switch causes
12764 generation of code to ensure that they see the stack being extended.
12765
12766 You can additionally specify a string parameter: @samp{no} means no
12767 checking, @samp{generic} means force the use of old-style checking,
12768 @samp{specific} means use the best checking method and is equivalent
12769 to bare @option{-fstack-check}.
12770
12771 Old-style checking is a generic mechanism that requires no specific
12772 target support in the compiler but comes with the following drawbacks:
12773
12774 @enumerate
12775 @item
12776 Modified allocation strategy for large objects: they are always
12777 allocated dynamically if their size exceeds a fixed threshold. Note this
12778 may change the semantics of some code.
12779
12780 @item
12781 Fixed limit on the size of the static frame of functions: when it is
12782 topped by a particular function, stack checking is not reliable and
12783 a warning is issued by the compiler.
12784
12785 @item
12786 Inefficiency: because of both the modified allocation strategy and the
12787 generic implementation, code performance is hampered.
12788 @end enumerate
12789
12790 Note that old-style stack checking is also the fallback method for
12791 @samp{specific} if no target support has been added in the compiler.
12792
12793 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12794 and stack overflows. @samp{specific} is an excellent choice when compiling
12795 Ada code. It is not generally sufficient to protect against stack-clash
12796 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12797
12798 @item -fstack-clash-protection
12799 @opindex fstack-clash-protection
12800 Generate code to prevent stack clash style attacks. When this option is
12801 enabled, the compiler will only allocate one page of stack space at a time
12802 and each page is accessed immediately after allocation. Thus, it prevents
12803 allocations from jumping over any stack guard page provided by the
12804 operating system.
12805
12806 Most targets do not fully support stack clash protection. However, on
12807 those targets @option{-fstack-clash-protection} will protect dynamic stack
12808 allocations. @option{-fstack-clash-protection} may also provide limited
12809 protection for static stack allocations if the target supports
12810 @option{-fstack-check=specific}.
12811
12812 @item -fstack-limit-register=@var{reg}
12813 @itemx -fstack-limit-symbol=@var{sym}
12814 @itemx -fno-stack-limit
12815 @opindex fstack-limit-register
12816 @opindex fstack-limit-symbol
12817 @opindex fno-stack-limit
12818 Generate code to ensure that the stack does not grow beyond a certain value,
12819 either the value of a register or the address of a symbol. If a larger
12820 stack is required, a signal is raised at run time. For most targets,
12821 the signal is raised before the stack overruns the boundary, so
12822 it is possible to catch the signal without taking special precautions.
12823
12824 For instance, if the stack starts at absolute address @samp{0x80000000}
12825 and grows downwards, you can use the flags
12826 @option{-fstack-limit-symbol=__stack_limit} and
12827 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12828 of 128KB@. Note that this may only work with the GNU linker.
12829
12830 You can locally override stack limit checking by using the
12831 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12832
12833 @item -fsplit-stack
12834 @opindex fsplit-stack
12835 Generate code to automatically split the stack before it overflows.
12836 The resulting program has a discontiguous stack which can only
12837 overflow if the program is unable to allocate any more memory. This
12838 is most useful when running threaded programs, as it is no longer
12839 necessary to calculate a good stack size to use for each thread. This
12840 is currently only implemented for the x86 targets running
12841 GNU/Linux.
12842
12843 When code compiled with @option{-fsplit-stack} calls code compiled
12844 without @option{-fsplit-stack}, there may not be much stack space
12845 available for the latter code to run. If compiling all code,
12846 including library code, with @option{-fsplit-stack} is not an option,
12847 then the linker can fix up these calls so that the code compiled
12848 without @option{-fsplit-stack} always has a large stack. Support for
12849 this is implemented in the gold linker in GNU binutils release 2.21
12850 and later.
12851
12852 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12853 @opindex fvtable-verify
12854 This option is only available when compiling C++ code.
12855 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12856 feature that verifies at run time, for every virtual call, that
12857 the vtable pointer through which the call is made is valid for the type of
12858 the object, and has not been corrupted or overwritten. If an invalid vtable
12859 pointer is detected at run time, an error is reported and execution of the
12860 program is immediately halted.
12861
12862 This option causes run-time data structures to be built at program startup,
12863 which are used for verifying the vtable pointers.
12864 The options @samp{std} and @samp{preinit}
12865 control the timing of when these data structures are built. In both cases the
12866 data structures are built before execution reaches @code{main}. Using
12867 @option{-fvtable-verify=std} causes the data structures to be built after
12868 shared libraries have been loaded and initialized.
12869 @option{-fvtable-verify=preinit} causes them to be built before shared
12870 libraries have been loaded and initialized.
12871
12872 If this option appears multiple times in the command line with different
12873 values specified, @samp{none} takes highest priority over both @samp{std} and
12874 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12875
12876 @item -fvtv-debug
12877 @opindex fvtv-debug
12878 When used in conjunction with @option{-fvtable-verify=std} or
12879 @option{-fvtable-verify=preinit}, causes debug versions of the
12880 runtime functions for the vtable verification feature to be called.
12881 This flag also causes the compiler to log information about which
12882 vtable pointers it finds for each class.
12883 This information is written to a file named @file{vtv_set_ptr_data.log}
12884 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12885 if that is defined or the current working directory otherwise.
12886
12887 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12888 file, be sure to delete any existing one.
12889
12890 @item -fvtv-counts
12891 @opindex fvtv-counts
12892 This is a debugging flag. When used in conjunction with
12893 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12894 causes the compiler to keep track of the total number of virtual calls
12895 it encounters and the number of verifications it inserts. It also
12896 counts the number of calls to certain run-time library functions
12897 that it inserts and logs this information for each compilation unit.
12898 The compiler writes this information to a file named
12899 @file{vtv_count_data.log} in the directory named by the environment
12900 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12901 directory otherwise. It also counts the size of the vtable pointer sets
12902 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12903 in the same directory.
12904
12905 Note: This feature @emph{appends} data to the log files. To get fresh log
12906 files, be sure to delete any existing ones.
12907
12908 @item -finstrument-functions
12909 @opindex finstrument-functions
12910 Generate instrumentation calls for entry and exit to functions. Just
12911 after function entry and just before function exit, the following
12912 profiling functions are called with the address of the current
12913 function and its call site. (On some platforms,
12914 @code{__builtin_return_address} does not work beyond the current
12915 function, so the call site information may not be available to the
12916 profiling functions otherwise.)
12917
12918 @smallexample
12919 void __cyg_profile_func_enter (void *this_fn,
12920 void *call_site);
12921 void __cyg_profile_func_exit (void *this_fn,
12922 void *call_site);
12923 @end smallexample
12924
12925 The first argument is the address of the start of the current function,
12926 which may be looked up exactly in the symbol table.
12927
12928 This instrumentation is also done for functions expanded inline in other
12929 functions. The profiling calls indicate where, conceptually, the
12930 inline function is entered and exited. This means that addressable
12931 versions of such functions must be available. If all your uses of a
12932 function are expanded inline, this may mean an additional expansion of
12933 code size. If you use @code{extern inline} in your C code, an
12934 addressable version of such functions must be provided. (This is
12935 normally the case anyway, but if you get lucky and the optimizer always
12936 expands the functions inline, you might have gotten away without
12937 providing static copies.)
12938
12939 A function may be given the attribute @code{no_instrument_function}, in
12940 which case this instrumentation is not done. This can be used, for
12941 example, for the profiling functions listed above, high-priority
12942 interrupt routines, and any functions from which the profiling functions
12943 cannot safely be called (perhaps signal handlers, if the profiling
12944 routines generate output or allocate memory).
12945 @xref{Common Function Attributes}.
12946
12947 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12948 @opindex finstrument-functions-exclude-file-list
12949
12950 Set the list of functions that are excluded from instrumentation (see
12951 the description of @option{-finstrument-functions}). If the file that
12952 contains a function definition matches with one of @var{file}, then
12953 that function is not instrumented. The match is done on substrings:
12954 if the @var{file} parameter is a substring of the file name, it is
12955 considered to be a match.
12956
12957 For example:
12958
12959 @smallexample
12960 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12961 @end smallexample
12962
12963 @noindent
12964 excludes any inline function defined in files whose pathnames
12965 contain @file{/bits/stl} or @file{include/sys}.
12966
12967 If, for some reason, you want to include letter @samp{,} in one of
12968 @var{sym}, write @samp{\,}. For example,
12969 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12970 (note the single quote surrounding the option).
12971
12972 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12973 @opindex finstrument-functions-exclude-function-list
12974
12975 This is similar to @option{-finstrument-functions-exclude-file-list},
12976 but this option sets the list of function names to be excluded from
12977 instrumentation. The function name to be matched is its user-visible
12978 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12979 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12980 match is done on substrings: if the @var{sym} parameter is a substring
12981 of the function name, it is considered to be a match. For C99 and C++
12982 extended identifiers, the function name must be given in UTF-8, not
12983 using universal character names.
12984
12985 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12986 @opindex fpatchable-function-entry
12987 Generate @var{N} NOPs right at the beginning
12988 of each function, with the function entry point before the @var{M}th NOP.
12989 If @var{M} is omitted, it defaults to @code{0} so the
12990 function entry points to the address just at the first NOP.
12991 The NOP instructions reserve extra space which can be used to patch in
12992 any desired instrumentation at run time, provided that the code segment
12993 is writable. The amount of space is controllable indirectly via
12994 the number of NOPs; the NOP instruction used corresponds to the instruction
12995 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12996 is target-specific and may also depend on the architecture variant and/or
12997 other compilation options.
12998
12999 For run-time identification, the starting addresses of these areas,
13000 which correspond to their respective function entries minus @var{M},
13001 are additionally collected in the @code{__patchable_function_entries}
13002 section of the resulting binary.
13003
13004 Note that the value of @code{__attribute__ ((patchable_function_entry
13005 (N,M)))} takes precedence over command-line option
13006 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13007 the area size or to remove it completely on a single function.
13008 If @code{N=0}, no pad location is recorded.
13009
13010 The NOP instructions are inserted at---and maybe before, depending on
13011 @var{M}---the function entry address, even before the prologue.
13012
13013 @end table
13014
13015
13016 @node Preprocessor Options
13017 @section Options Controlling the Preprocessor
13018 @cindex preprocessor options
13019 @cindex options, preprocessor
13020
13021 These options control the C preprocessor, which is run on each C source
13022 file before actual compilation.
13023
13024 If you use the @option{-E} option, nothing is done except preprocessing.
13025 Some of these options make sense only together with @option{-E} because
13026 they cause the preprocessor output to be unsuitable for actual
13027 compilation.
13028
13029 In addition to the options listed here, there are a number of options
13030 to control search paths for include files documented in
13031 @ref{Directory Options}.
13032 Options to control preprocessor diagnostics are listed in
13033 @ref{Warning Options}.
13034
13035 @table @gcctabopt
13036 @include cppopts.texi
13037
13038 @item -Wp,@var{option}
13039 @opindex Wp
13040 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13041 and pass @var{option} directly through to the preprocessor. If
13042 @var{option} contains commas, it is split into multiple options at the
13043 commas. However, many options are modified, translated or interpreted
13044 by the compiler driver before being passed to the preprocessor, and
13045 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13046 interface is undocumented and subject to change, so whenever possible
13047 you should avoid using @option{-Wp} and let the driver handle the
13048 options instead.
13049
13050 @item -Xpreprocessor @var{option}
13051 @opindex Xpreprocessor
13052 Pass @var{option} as an option to the preprocessor. You can use this to
13053 supply system-specific preprocessor options that GCC does not
13054 recognize.
13055
13056 If you want to pass an option that takes an argument, you must use
13057 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13058
13059 @item -no-integrated-cpp
13060 @opindex no-integrated-cpp
13061 Perform preprocessing as a separate pass before compilation.
13062 By default, GCC performs preprocessing as an integrated part of
13063 input tokenization and parsing.
13064 If this option is provided, the appropriate language front end
13065 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13066 and Objective-C, respectively) is instead invoked twice,
13067 once for preprocessing only and once for actual compilation
13068 of the preprocessed input.
13069 This option may be useful in conjunction with the @option{-B} or
13070 @option{-wrapper} options to specify an alternate preprocessor or
13071 perform additional processing of the program source between
13072 normal preprocessing and compilation.
13073
13074 @end table
13075
13076 @node Assembler Options
13077 @section Passing Options to the Assembler
13078
13079 @c prevent bad page break with this line
13080 You can pass options to the assembler.
13081
13082 @table @gcctabopt
13083 @item -Wa,@var{option}
13084 @opindex Wa
13085 Pass @var{option} as an option to the assembler. If @var{option}
13086 contains commas, it is split into multiple options at the commas.
13087
13088 @item -Xassembler @var{option}
13089 @opindex Xassembler
13090 Pass @var{option} as an option to the assembler. You can use this to
13091 supply system-specific assembler options that GCC does not
13092 recognize.
13093
13094 If you want to pass an option that takes an argument, you must use
13095 @option{-Xassembler} twice, once for the option and once for the argument.
13096
13097 @end table
13098
13099 @node Link Options
13100 @section Options for Linking
13101 @cindex link options
13102 @cindex options, linking
13103
13104 These options come into play when the compiler links object files into
13105 an executable output file. They are meaningless if the compiler is
13106 not doing a link step.
13107
13108 @table @gcctabopt
13109 @cindex file names
13110 @item @var{object-file-name}
13111 A file name that does not end in a special recognized suffix is
13112 considered to name an object file or library. (Object files are
13113 distinguished from libraries by the linker according to the file
13114 contents.) If linking is done, these object files are used as input
13115 to the linker.
13116
13117 @item -c
13118 @itemx -S
13119 @itemx -E
13120 @opindex c
13121 @opindex S
13122 @opindex E
13123 If any of these options is used, then the linker is not run, and
13124 object file names should not be used as arguments. @xref{Overall
13125 Options}.
13126
13127 @item -flinker-output=@var{type}
13128 @opindex flinker-output
13129 This option controls the code generation of the link time optimizer. By
13130 default the linker output is determined by the linker plugin automatically. For
13131 debugging the compiler and in the case of incremental linking to non-lto object
13132 file is desired, it may be useful to control the type manually.
13133
13134 If @var{type} is @samp{exec} the code generation is configured to produce static
13135 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
13136
13137 If @var{type} is @samp{dyn} the code generation is configured to produce shared
13138 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
13139 enabled automatically. This makes it possible to build shared libraries without
13140 position independent code on architectures this is possible, i.e.@: on x86.
13141
13142 If @var{type} is @samp{pie} the code generation is configured to produce
13143 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
13144 except that @option{-fpie} is not disabled if specified at compilation time.
13145
13146 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13147 done. The sections containing intermediate code for link-time optimization are
13148 merged, pre-optimized, and output to the resulting object file. In addition, if
13149 @option{-ffat-lto-objects} is specified the binary code is produced for future
13150 non-lto linking. The object file produced by incremental linking will be smaller
13151 than a static library produced from the same object files. At link-time the
13152 result of incremental linking will also load faster to compiler than a static
13153 library assuming that majority of objects in the library are used.
13154
13155 Finally @samp{nolto-rel} configure compiler to for incremental linking where
13156 code generation is forced, final binary is produced and the intermediate code
13157 for later link-time optimization is stripped. When multiple object files are
13158 linked together the resulting code will be optimized better than with link time
13159 optimizations disabled (for example, the cross-module inlining will happen),
13160 most of benefits of whole program optimizations are however lost.
13161
13162 During the incremental link (by @option{-r}) the linker plugin will default to
13163 @option{rel}. With current interfaces to GNU Binutils it is however not
13164 possible to link incrementally LTO objects and non-LTO objects into a single
13165 mixed object file. In the case any of object files in incremental link cannot
13166 be used for link-time optimization the linker plugin will output warning and
13167 use @samp{nolto-rel}. To maintain the whole program optimization it is
13168 recommended to link such objects into static library instead. Alternatively it
13169 is possible to use H.J. Lu's binutils with support for mixed objects.
13170
13171 @item -fuse-ld=bfd
13172 @opindex fuse-ld=bfd
13173 Use the @command{bfd} linker instead of the default linker.
13174
13175 @item -fuse-ld=gold
13176 @opindex fuse-ld=gold
13177 Use the @command{gold} linker instead of the default linker.
13178
13179 @item -fuse-ld=lld
13180 @opindex fuse-ld=lld
13181 Use the LLVM @command{lld} linker instead of the default linker.
13182
13183 @cindex Libraries
13184 @item -l@var{library}
13185 @itemx -l @var{library}
13186 @opindex l
13187 Search the library named @var{library} when linking. (The second
13188 alternative with the library as a separate argument is only for
13189 POSIX compliance and is not recommended.)
13190
13191 The @option{-l} option is passed directly to the linker by GCC. Refer
13192 to your linker documentation for exact details. The general
13193 description below applies to the GNU linker.
13194
13195 The linker searches a standard list of directories for the library.
13196 The directories searched include several standard system directories
13197 plus any that you specify with @option{-L}.
13198
13199 Static libraries are archives of object files, and have file names
13200 like @file{lib@var{library}.a}. Some targets also support shared
13201 libraries, which typically have names like @file{lib@var{library}.so}.
13202 If both static and shared libraries are found, the linker gives
13203 preference to linking with the shared library unless the
13204 @option{-static} option is used.
13205
13206 It makes a difference where in the command you write this option; the
13207 linker searches and processes libraries and object files in the order they
13208 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13209 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13210 to functions in @samp{z}, those functions may not be loaded.
13211
13212 @item -lobjc
13213 @opindex lobjc
13214 You need this special case of the @option{-l} option in order to
13215 link an Objective-C or Objective-C++ program.
13216
13217 @item -nostartfiles
13218 @opindex nostartfiles
13219 Do not use the standard system startup files when linking.
13220 The standard system libraries are used normally, unless @option{-nostdlib},
13221 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13222
13223 @item -nodefaultlibs
13224 @opindex nodefaultlibs
13225 Do not use the standard system libraries when linking.
13226 Only the libraries you specify are passed to the linker, and options
13227 specifying linkage of the system libraries, such as @option{-static-libgcc}
13228 or @option{-shared-libgcc}, are ignored.
13229 The standard startup files are used normally, unless @option{-nostartfiles}
13230 is used.
13231
13232 The compiler may generate calls to @code{memcmp},
13233 @code{memset}, @code{memcpy} and @code{memmove}.
13234 These entries are usually resolved by entries in
13235 libc. These entry points should be supplied through some other
13236 mechanism when this option is specified.
13237
13238 @item -nolibc
13239 @opindex nolibc
13240 Do not use the C library or system libraries tightly coupled with it when
13241 linking. Still link with the startup files, @file{libgcc} or toolchain
13242 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13243 or @file{libstdc++} unless options preventing their inclusion are used as
13244 well. This typically removes @option{-lc} from the link command line, as well
13245 as system libraries that normally go with it and become meaningless when
13246 absence of a C library is assumed, for example @option{-lpthread} or
13247 @option{-lm} in some configurations. This is intended for bare-board
13248 targets when there is indeed no C library available.
13249
13250 @item -nostdlib
13251 @opindex nostdlib
13252 Do not use the standard system startup files or libraries when linking.
13253 No startup files and only the libraries you specify are passed to
13254 the linker, and options specifying linkage of the system libraries, such as
13255 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13256
13257 The compiler may generate calls to @code{memcmp}, @code{memset},
13258 @code{memcpy} and @code{memmove}.
13259 These entries are usually resolved by entries in
13260 libc. These entry points should be supplied through some other
13261 mechanism when this option is specified.
13262
13263 @cindex @option{-lgcc}, use with @option{-nostdlib}
13264 @cindex @option{-nostdlib} and unresolved references
13265 @cindex unresolved references and @option{-nostdlib}
13266 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13267 @cindex @option{-nodefaultlibs} and unresolved references
13268 @cindex unresolved references and @option{-nodefaultlibs}
13269 One of the standard libraries bypassed by @option{-nostdlib} and
13270 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13271 which GCC uses to overcome shortcomings of particular machines, or special
13272 needs for some languages.
13273 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13274 Collection (GCC) Internals},
13275 for more discussion of @file{libgcc.a}.)
13276 In most cases, you need @file{libgcc.a} even when you want to avoid
13277 other standard libraries. In other words, when you specify @option{-nostdlib}
13278 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13279 This ensures that you have no unresolved references to internal GCC
13280 library subroutines.
13281 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13282 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13283 GNU Compiler Collection (GCC) Internals}.)
13284
13285 @item -e @var{entry}
13286 @itemx --entry=@var{entry}
13287 @opindex e
13288 @opindex entry
13289
13290 Specify that the program entry point is @var{entry}. The argument is
13291 interpreted by the linker; the GNU linker accepts either a symbol name
13292 or an address.
13293
13294 @item -pie
13295 @opindex pie
13296 Produce a dynamically linked position independent executable on targets
13297 that support it. For predictable results, you must also specify the same
13298 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13299 or model suboptions) when you specify this linker option.
13300
13301 @item -no-pie
13302 @opindex no-pie
13303 Don't produce a dynamically linked position independent executable.
13304
13305 @item -static-pie
13306 @opindex static-pie
13307 Produce a static position independent executable on targets that support
13308 it. A static position independent executable is similar to a static
13309 executable, but can be loaded at any address without a dynamic linker.
13310 For predictable results, you must also specify the same set of options
13311 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13312 suboptions) when you specify this linker option.
13313
13314 @item -pthread
13315 @opindex pthread
13316 Link with the POSIX threads library. This option is supported on
13317 GNU/Linux targets, most other Unix derivatives, and also on
13318 x86 Cygwin and MinGW targets. On some targets this option also sets
13319 flags for the preprocessor, so it should be used consistently for both
13320 compilation and linking.
13321
13322 @item -r
13323 @opindex r
13324 Produce a relocatable object as output. This is also known as partial
13325 linking.
13326
13327 @item -rdynamic
13328 @opindex rdynamic
13329 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13330 that support it. This instructs the linker to add all symbols, not
13331 only used ones, to the dynamic symbol table. This option is needed
13332 for some uses of @code{dlopen} or to allow obtaining backtraces
13333 from within a program.
13334
13335 @item -s
13336 @opindex s
13337 Remove all symbol table and relocation information from the executable.
13338
13339 @item -static
13340 @opindex static
13341 On systems that support dynamic linking, this overrides @option{-pie}
13342 and prevents linking with the shared libraries. On other systems, this
13343 option has no effect.
13344
13345 @item -shared
13346 @opindex shared
13347 Produce a shared object which can then be linked with other objects to
13348 form an executable. Not all systems support this option. For predictable
13349 results, you must also specify the same set of options used for compilation
13350 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13351 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13352 needs to build supplementary stub code for constructors to work. On
13353 multi-libbed systems, @samp{gcc -shared} must select the correct support
13354 libraries to link against. Failing to supply the correct flags may lead
13355 to subtle defects. Supplying them in cases where they are not necessary
13356 is innocuous.}
13357
13358 @item -shared-libgcc
13359 @itemx -static-libgcc
13360 @opindex shared-libgcc
13361 @opindex static-libgcc
13362 On systems that provide @file{libgcc} as a shared library, these options
13363 force the use of either the shared or static version, respectively.
13364 If no shared version of @file{libgcc} was built when the compiler was
13365 configured, these options have no effect.
13366
13367 There are several situations in which an application should use the
13368 shared @file{libgcc} instead of the static version. The most common
13369 of these is when the application wishes to throw and catch exceptions
13370 across different shared libraries. In that case, each of the libraries
13371 as well as the application itself should use the shared @file{libgcc}.
13372
13373 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13374 whenever you build a shared library or a main executable, because C++
13375 programs typically use exceptions, so this is the right thing to do.
13376
13377 If, instead, you use the GCC driver to create shared libraries, you may
13378 find that they are not always linked with the shared @file{libgcc}.
13379 If GCC finds, at its configuration time, that you have a non-GNU linker
13380 or a GNU linker that does not support option @option{--eh-frame-hdr},
13381 it links the shared version of @file{libgcc} into shared libraries
13382 by default. Otherwise, it takes advantage of the linker and optimizes
13383 away the linking with the shared version of @file{libgcc}, linking with
13384 the static version of libgcc by default. This allows exceptions to
13385 propagate through such shared libraries, without incurring relocation
13386 costs at library load time.
13387
13388 However, if a library or main executable is supposed to throw or catch
13389 exceptions, you must link it using the G++ driver, or using the option
13390 @option{-shared-libgcc}, such that it is linked with the shared
13391 @file{libgcc}.
13392
13393 @item -static-libasan
13394 @opindex static-libasan
13395 When the @option{-fsanitize=address} option is used to link a program,
13396 the GCC driver automatically links against @option{libasan}. If
13397 @file{libasan} is available as a shared library, and the @option{-static}
13398 option is not used, then this links against the shared version of
13399 @file{libasan}. The @option{-static-libasan} option directs the GCC
13400 driver to link @file{libasan} statically, without necessarily linking
13401 other libraries statically.
13402
13403 @item -static-libtsan
13404 @opindex static-libtsan
13405 When the @option{-fsanitize=thread} option is used to link a program,
13406 the GCC driver automatically links against @option{libtsan}. If
13407 @file{libtsan} is available as a shared library, and the @option{-static}
13408 option is not used, then this links against the shared version of
13409 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13410 driver to link @file{libtsan} statically, without necessarily linking
13411 other libraries statically.
13412
13413 @item -static-liblsan
13414 @opindex static-liblsan
13415 When the @option{-fsanitize=leak} option is used to link a program,
13416 the GCC driver automatically links against @option{liblsan}. If
13417 @file{liblsan} is available as a shared library, and the @option{-static}
13418 option is not used, then this links against the shared version of
13419 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13420 driver to link @file{liblsan} statically, without necessarily linking
13421 other libraries statically.
13422
13423 @item -static-libubsan
13424 @opindex static-libubsan
13425 When the @option{-fsanitize=undefined} option is used to link a program,
13426 the GCC driver automatically links against @option{libubsan}. If
13427 @file{libubsan} is available as a shared library, and the @option{-static}
13428 option is not used, then this links against the shared version of
13429 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13430 driver to link @file{libubsan} statically, without necessarily linking
13431 other libraries statically.
13432
13433 @item -static-libstdc++
13434 @opindex static-libstdc++
13435 When the @command{g++} program is used to link a C++ program, it
13436 normally automatically links against @option{libstdc++}. If
13437 @file{libstdc++} is available as a shared library, and the
13438 @option{-static} option is not used, then this links against the
13439 shared version of @file{libstdc++}. That is normally fine. However, it
13440 is sometimes useful to freeze the version of @file{libstdc++} used by
13441 the program without going all the way to a fully static link. The
13442 @option{-static-libstdc++} option directs the @command{g++} driver to
13443 link @file{libstdc++} statically, without necessarily linking other
13444 libraries statically.
13445
13446 @item -symbolic
13447 @opindex symbolic
13448 Bind references to global symbols when building a shared object. Warn
13449 about any unresolved references (unless overridden by the link editor
13450 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13451 this option.
13452
13453 @item -T @var{script}
13454 @opindex T
13455 @cindex linker script
13456 Use @var{script} as the linker script. This option is supported by most
13457 systems using the GNU linker. On some targets, such as bare-board
13458 targets without an operating system, the @option{-T} option may be required
13459 when linking to avoid references to undefined symbols.
13460
13461 @item -Xlinker @var{option}
13462 @opindex Xlinker
13463 Pass @var{option} as an option to the linker. You can use this to
13464 supply system-specific linker options that GCC does not recognize.
13465
13466 If you want to pass an option that takes a separate argument, you must use
13467 @option{-Xlinker} twice, once for the option and once for the argument.
13468 For example, to pass @option{-assert definitions}, you must write
13469 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13470 @option{-Xlinker "-assert definitions"}, because this passes the entire
13471 string as a single argument, which is not what the linker expects.
13472
13473 When using the GNU linker, it is usually more convenient to pass
13474 arguments to linker options using the @option{@var{option}=@var{value}}
13475 syntax than as separate arguments. For example, you can specify
13476 @option{-Xlinker -Map=output.map} rather than
13477 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13478 this syntax for command-line options.
13479
13480 @item -Wl,@var{option}
13481 @opindex Wl
13482 Pass @var{option} as an option to the linker. If @var{option} contains
13483 commas, it is split into multiple options at the commas. You can use this
13484 syntax to pass an argument to the option.
13485 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13486 linker. When using the GNU linker, you can also get the same effect with
13487 @option{-Wl,-Map=output.map}.
13488
13489 @item -u @var{symbol}
13490 @opindex u
13491 Pretend the symbol @var{symbol} is undefined, to force linking of
13492 library modules to define it. You can use @option{-u} multiple times with
13493 different symbols to force loading of additional library modules.
13494
13495 @item -z @var{keyword}
13496 @opindex z
13497 @option{-z} is passed directly on to the linker along with the keyword
13498 @var{keyword}. See the section in the documentation of your linker for
13499 permitted values and their meanings.
13500 @end table
13501
13502 @node Directory Options
13503 @section Options for Directory Search
13504 @cindex directory options
13505 @cindex options, directory search
13506 @cindex search path
13507
13508 These options specify directories to search for header files, for
13509 libraries and for parts of the compiler:
13510
13511 @table @gcctabopt
13512 @include cppdiropts.texi
13513
13514 @item -iplugindir=@var{dir}
13515 @opindex iplugindir=
13516 Set the directory to search for plugins that are passed
13517 by @option{-fplugin=@var{name}} instead of
13518 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13519 to be used by the user, but only passed by the driver.
13520
13521 @item -L@var{dir}
13522 @opindex L
13523 Add directory @var{dir} to the list of directories to be searched
13524 for @option{-l}.
13525
13526 @item -B@var{prefix}
13527 @opindex B
13528 This option specifies where to find the executables, libraries,
13529 include files, and data files of the compiler itself.
13530
13531 The compiler driver program runs one or more of the subprograms
13532 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13533 @var{prefix} as a prefix for each program it tries to run, both with and
13534 without @samp{@var{machine}/@var{version}/} for the corresponding target
13535 machine and compiler version.
13536
13537 For each subprogram to be run, the compiler driver first tries the
13538 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13539 is not specified, the driver tries two standard prefixes,
13540 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13541 those results in a file name that is found, the unmodified program
13542 name is searched for using the directories specified in your
13543 @env{PATH} environment variable.
13544
13545 The compiler checks to see if the path provided by @option{-B}
13546 refers to a directory, and if necessary it adds a directory
13547 separator character at the end of the path.
13548
13549 @option{-B} prefixes that effectively specify directory names also apply
13550 to libraries in the linker, because the compiler translates these
13551 options into @option{-L} options for the linker. They also apply to
13552 include files in the preprocessor, because the compiler translates these
13553 options into @option{-isystem} options for the preprocessor. In this case,
13554 the compiler appends @samp{include} to the prefix.
13555
13556 The runtime support file @file{libgcc.a} can also be searched for using
13557 the @option{-B} prefix, if needed. If it is not found there, the two
13558 standard prefixes above are tried, and that is all. The file is left
13559 out of the link if it is not found by those means.
13560
13561 Another way to specify a prefix much like the @option{-B} prefix is to use
13562 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13563 Variables}.
13564
13565 As a special kludge, if the path provided by @option{-B} is
13566 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13567 9, then it is replaced by @file{[dir/]include}. This is to help
13568 with boot-strapping the compiler.
13569
13570 @item -no-canonical-prefixes
13571 @opindex no-canonical-prefixes
13572 Do not expand any symbolic links, resolve references to @samp{/../}
13573 or @samp{/./}, or make the path absolute when generating a relative
13574 prefix.
13575
13576 @item --sysroot=@var{dir}
13577 @opindex sysroot
13578 Use @var{dir} as the logical root directory for headers and libraries.
13579 For example, if the compiler normally searches for headers in
13580 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13581 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13582
13583 If you use both this option and the @option{-isysroot} option, then
13584 the @option{--sysroot} option applies to libraries, but the
13585 @option{-isysroot} option applies to header files.
13586
13587 The GNU linker (beginning with version 2.16) has the necessary support
13588 for this option. If your linker does not support this option, the
13589 header file aspect of @option{--sysroot} still works, but the
13590 library aspect does not.
13591
13592 @item --no-sysroot-suffix
13593 @opindex no-sysroot-suffix
13594 For some targets, a suffix is added to the root directory specified
13595 with @option{--sysroot}, depending on the other options used, so that
13596 headers may for example be found in
13597 @file{@var{dir}/@var{suffix}/usr/include} instead of
13598 @file{@var{dir}/usr/include}. This option disables the addition of
13599 such a suffix.
13600
13601 @end table
13602
13603 @node Code Gen Options
13604 @section Options for Code Generation Conventions
13605 @cindex code generation conventions
13606 @cindex options, code generation
13607 @cindex run-time options
13608
13609 These machine-independent options control the interface conventions
13610 used in code generation.
13611
13612 Most of them have both positive and negative forms; the negative form
13613 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13614 one of the forms is listed---the one that is not the default. You
13615 can figure out the other form by either removing @samp{no-} or adding
13616 it.
13617
13618 @table @gcctabopt
13619 @item -fstack-reuse=@var{reuse-level}
13620 @opindex fstack_reuse
13621 This option controls stack space reuse for user declared local/auto variables
13622 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13623 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13624 local variables and temporaries, @samp{named_vars} enables the reuse only for
13625 user defined local variables with names, and @samp{none} disables stack reuse
13626 completely. The default value is @samp{all}. The option is needed when the
13627 program extends the lifetime of a scoped local variable or a compiler generated
13628 temporary beyond the end point defined by the language. When a lifetime of
13629 a variable ends, and if the variable lives in memory, the optimizing compiler
13630 has the freedom to reuse its stack space with other temporaries or scoped
13631 local variables whose live range does not overlap with it. Legacy code extending
13632 local lifetime is likely to break with the stack reuse optimization.
13633
13634 For example,
13635
13636 @smallexample
13637 int *p;
13638 @{
13639 int local1;
13640
13641 p = &local1;
13642 local1 = 10;
13643 ....
13644 @}
13645 @{
13646 int local2;
13647 local2 = 20;
13648 ...
13649 @}
13650
13651 if (*p == 10) // out of scope use of local1
13652 @{
13653
13654 @}
13655 @end smallexample
13656
13657 Another example:
13658 @smallexample
13659
13660 struct A
13661 @{
13662 A(int k) : i(k), j(k) @{ @}
13663 int i;
13664 int j;
13665 @};
13666
13667 A *ap;
13668
13669 void foo(const A& ar)
13670 @{
13671 ap = &ar;
13672 @}
13673
13674 void bar()
13675 @{
13676 foo(A(10)); // temp object's lifetime ends when foo returns
13677
13678 @{
13679 A a(20);
13680 ....
13681 @}
13682 ap->i+= 10; // ap references out of scope temp whose space
13683 // is reused with a. What is the value of ap->i?
13684 @}
13685
13686 @end smallexample
13687
13688 The lifetime of a compiler generated temporary is well defined by the C++
13689 standard. When a lifetime of a temporary ends, and if the temporary lives
13690 in memory, the optimizing compiler has the freedom to reuse its stack
13691 space with other temporaries or scoped local variables whose live range
13692 does not overlap with it. However some of the legacy code relies on
13693 the behavior of older compilers in which temporaries' stack space is
13694 not reused, the aggressive stack reuse can lead to runtime errors. This
13695 option is used to control the temporary stack reuse optimization.
13696
13697 @item -ftrapv
13698 @opindex ftrapv
13699 This option generates traps for signed overflow on addition, subtraction,
13700 multiplication operations.
13701 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13702 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13703 @option{-fwrapv} being effective. Note that only active options override, so
13704 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13705 results in @option{-ftrapv} being effective.
13706
13707 @item -fwrapv
13708 @opindex fwrapv
13709 This option instructs the compiler to assume that signed arithmetic
13710 overflow of addition, subtraction and multiplication wraps around
13711 using twos-complement representation. This flag enables some optimizations
13712 and disables others.
13713 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13714 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13715 @option{-fwrapv} being effective. Note that only active options override, so
13716 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13717 results in @option{-ftrapv} being effective.
13718
13719 @item -fwrapv-pointer
13720 @opindex fwrapv-pointer
13721 This option instructs the compiler to assume that pointer arithmetic
13722 overflow on addition and subtraction wraps around using twos-complement
13723 representation. This flag disables some optimizations which assume
13724 pointer overflow is invalid.
13725
13726 @item -fstrict-overflow
13727 @opindex fstrict-overflow
13728 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13729 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13730
13731 @item -fexceptions
13732 @opindex fexceptions
13733 Enable exception handling. Generates extra code needed to propagate
13734 exceptions. For some targets, this implies GCC generates frame
13735 unwind information for all functions, which can produce significant data
13736 size overhead, although it does not affect execution. If you do not
13737 specify this option, GCC enables it by default for languages like
13738 C++ that normally require exception handling, and disables it for
13739 languages like C that do not normally require it. However, you may need
13740 to enable this option when compiling C code that needs to interoperate
13741 properly with exception handlers written in C++. You may also wish to
13742 disable this option if you are compiling older C++ programs that don't
13743 use exception handling.
13744
13745 @item -fnon-call-exceptions
13746 @opindex fnon-call-exceptions
13747 Generate code that allows trapping instructions to throw exceptions.
13748 Note that this requires platform-specific runtime support that does
13749 not exist everywhere. Moreover, it only allows @emph{trapping}
13750 instructions to throw exceptions, i.e.@: memory references or floating-point
13751 instructions. It does not allow exceptions to be thrown from
13752 arbitrary signal handlers such as @code{SIGALRM}.
13753
13754 @item -fdelete-dead-exceptions
13755 @opindex fdelete-dead-exceptions
13756 Consider that instructions that may throw exceptions but don't otherwise
13757 contribute to the execution of the program can be optimized away.
13758 This option is enabled by default for the Ada front end, as permitted by
13759 the Ada language specification.
13760 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13761
13762 @item -funwind-tables
13763 @opindex funwind-tables
13764 Similar to @option{-fexceptions}, except that it just generates any needed
13765 static data, but does not affect the generated code in any other way.
13766 You normally do not need to enable this option; instead, a language processor
13767 that needs this handling enables it on your behalf.
13768
13769 @item -fasynchronous-unwind-tables
13770 @opindex fasynchronous-unwind-tables
13771 Generate unwind table in DWARF format, if supported by target machine. The
13772 table is exact at each instruction boundary, so it can be used for stack
13773 unwinding from asynchronous events (such as debugger or garbage collector).
13774
13775 @item -fno-gnu-unique
13776 @opindex fno-gnu-unique
13777 @opindex fgnu-unique
13778 On systems with recent GNU assembler and C library, the C++ compiler
13779 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13780 of template static data members and static local variables in inline
13781 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13782 is necessary to avoid problems with a library used by two different
13783 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13784 therefore disagreeing with the other one about the binding of the
13785 symbol. But this causes @code{dlclose} to be ignored for affected
13786 DSOs; if your program relies on reinitialization of a DSO via
13787 @code{dlclose} and @code{dlopen}, you can use
13788 @option{-fno-gnu-unique}.
13789
13790 @item -fpcc-struct-return
13791 @opindex fpcc-struct-return
13792 Return ``short'' @code{struct} and @code{union} values in memory like
13793 longer ones, rather than in registers. This convention is less
13794 efficient, but it has the advantage of allowing intercallability between
13795 GCC-compiled files and files compiled with other compilers, particularly
13796 the Portable C Compiler (pcc).
13797
13798 The precise convention for returning structures in memory depends
13799 on the target configuration macros.
13800
13801 Short structures and unions are those whose size and alignment match
13802 that of some integer type.
13803
13804 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13805 switch is not binary compatible with code compiled with the
13806 @option{-freg-struct-return} switch.
13807 Use it to conform to a non-default application binary interface.
13808
13809 @item -freg-struct-return
13810 @opindex freg-struct-return
13811 Return @code{struct} and @code{union} values in registers when possible.
13812 This is more efficient for small structures than
13813 @option{-fpcc-struct-return}.
13814
13815 If you specify neither @option{-fpcc-struct-return} nor
13816 @option{-freg-struct-return}, GCC defaults to whichever convention is
13817 standard for the target. If there is no standard convention, GCC
13818 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13819 the principal compiler. In those cases, we can choose the standard, and
13820 we chose the more efficient register return alternative.
13821
13822 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13823 switch is not binary compatible with code compiled with the
13824 @option{-fpcc-struct-return} switch.
13825 Use it to conform to a non-default application binary interface.
13826
13827 @item -fshort-enums
13828 @opindex fshort-enums
13829 Allocate to an @code{enum} type only as many bytes as it needs for the
13830 declared range of possible values. Specifically, the @code{enum} type
13831 is equivalent to the smallest integer type that has enough room.
13832
13833 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13834 code that is not binary compatible with code generated without that switch.
13835 Use it to conform to a non-default application binary interface.
13836
13837 @item -fshort-wchar
13838 @opindex fshort-wchar
13839 Override the underlying type for @code{wchar_t} to be @code{short
13840 unsigned int} instead of the default for the target. This option is
13841 useful for building programs to run under WINE@.
13842
13843 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13844 code that is not binary compatible with code generated without that switch.
13845 Use it to conform to a non-default application binary interface.
13846
13847 @item -fno-common
13848 @opindex fno-common
13849 @opindex fcommon
13850 @cindex tentative definitions
13851 In C code, this option controls the placement of global variables
13852 defined without an initializer, known as @dfn{tentative definitions}
13853 in the C standard. Tentative definitions are distinct from declarations
13854 of a variable with the @code{extern} keyword, which do not allocate storage.
13855
13856 Unix C compilers have traditionally allocated storage for
13857 uninitialized global variables in a common block. This allows the
13858 linker to resolve all tentative definitions of the same variable
13859 in different compilation units to the same object, or to a non-tentative
13860 definition.
13861 This is the behavior specified by @option{-fcommon}, and is the default for
13862 GCC on most targets.
13863 On the other hand, this behavior is not required by ISO
13864 C, and on some targets may carry a speed or code size penalty on
13865 variable references.
13866
13867 The @option{-fno-common} option specifies that the compiler should instead
13868 place uninitialized global variables in the BSS section of the object file.
13869 This inhibits the merging of tentative definitions by the linker so
13870 you get a multiple-definition error if the same
13871 variable is defined in more than one compilation unit.
13872 Compiling with @option{-fno-common} is useful on targets for which
13873 it provides better performance, or if you wish to verify that the
13874 program will work on other systems that always treat uninitialized
13875 variable definitions this way.
13876
13877 @item -fno-ident
13878 @opindex fno-ident
13879 @opindex fident
13880 Ignore the @code{#ident} directive.
13881
13882 @item -finhibit-size-directive
13883 @opindex finhibit-size-directive
13884 Don't output a @code{.size} assembler directive, or anything else that
13885 would cause trouble if the function is split in the middle, and the
13886 two halves are placed at locations far apart in memory. This option is
13887 used when compiling @file{crtstuff.c}; you should not need to use it
13888 for anything else.
13889
13890 @item -fverbose-asm
13891 @opindex fverbose-asm
13892 Put extra commentary information in the generated assembly code to
13893 make it more readable. This option is generally only of use to those
13894 who actually need to read the generated assembly code (perhaps while
13895 debugging the compiler itself).
13896
13897 @option{-fno-verbose-asm}, the default, causes the
13898 extra information to be omitted and is useful when comparing two assembler
13899 files.
13900
13901 The added comments include:
13902
13903 @itemize @bullet
13904
13905 @item
13906 information on the compiler version and command-line options,
13907
13908 @item
13909 the source code lines associated with the assembly instructions,
13910 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13911
13912 @item
13913 hints on which high-level expressions correspond to
13914 the various assembly instruction operands.
13915
13916 @end itemize
13917
13918 For example, given this C source file:
13919
13920 @smallexample
13921 int test (int n)
13922 @{
13923 int i;
13924 int total = 0;
13925
13926 for (i = 0; i < n; i++)
13927 total += i * i;
13928
13929 return total;
13930 @}
13931 @end smallexample
13932
13933 compiling to (x86_64) assembly via @option{-S} and emitting the result
13934 direct to stdout via @option{-o} @option{-}
13935
13936 @smallexample
13937 gcc -S test.c -fverbose-asm -Os -o -
13938 @end smallexample
13939
13940 gives output similar to this:
13941
13942 @smallexample
13943 .file "test.c"
13944 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13945 [...snip...]
13946 # options passed:
13947 [...snip...]
13948
13949 .text
13950 .globl test
13951 .type test, @@function
13952 test:
13953 .LFB0:
13954 .cfi_startproc
13955 # test.c:4: int total = 0;
13956 xorl %eax, %eax # <retval>
13957 # test.c:6: for (i = 0; i < n; i++)
13958 xorl %edx, %edx # i
13959 .L2:
13960 # test.c:6: for (i = 0; i < n; i++)
13961 cmpl %edi, %edx # n, i
13962 jge .L5 #,
13963 # test.c:7: total += i * i;
13964 movl %edx, %ecx # i, tmp92
13965 imull %edx, %ecx # i, tmp92
13966 # test.c:6: for (i = 0; i < n; i++)
13967 incl %edx # i
13968 # test.c:7: total += i * i;
13969 addl %ecx, %eax # tmp92, <retval>
13970 jmp .L2 #
13971 .L5:
13972 # test.c:10: @}
13973 ret
13974 .cfi_endproc
13975 .LFE0:
13976 .size test, .-test
13977 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13978 .section .note.GNU-stack,"",@@progbits
13979 @end smallexample
13980
13981 The comments are intended for humans rather than machines and hence the
13982 precise format of the comments is subject to change.
13983
13984 @item -frecord-gcc-switches
13985 @opindex frecord-gcc-switches
13986 This switch causes the command line used to invoke the
13987 compiler to be recorded into the object file that is being created.
13988 This switch is only implemented on some targets and the exact format
13989 of the recording is target and binary file format dependent, but it
13990 usually takes the form of a section containing ASCII text. This
13991 switch is related to the @option{-fverbose-asm} switch, but that
13992 switch only records information in the assembler output file as
13993 comments, so it never reaches the object file.
13994 See also @option{-grecord-gcc-switches} for another
13995 way of storing compiler options into the object file.
13996
13997 @item -fpic
13998 @opindex fpic
13999 @cindex global offset table
14000 @cindex PIC
14001 Generate position-independent code (PIC) suitable for use in a shared
14002 library, if supported for the target machine. Such code accesses all
14003 constant addresses through a global offset table (GOT)@. The dynamic
14004 loader resolves the GOT entries when the program starts (the dynamic
14005 loader is not part of GCC; it is part of the operating system). If
14006 the GOT size for the linked executable exceeds a machine-specific
14007 maximum size, you get an error message from the linker indicating that
14008 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14009 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14010 on the m68k and RS/6000. The x86 has no such limit.)
14011
14012 Position-independent code requires special support, and therefore works
14013 only on certain machines. For the x86, GCC supports PIC for System V
14014 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14015 position-independent.
14016
14017 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14018 are defined to 1.
14019
14020 @item -fPIC
14021 @opindex fPIC
14022 If supported for the target machine, emit position-independent code,
14023 suitable for dynamic linking and avoiding any limit on the size of the
14024 global offset table. This option makes a difference on AArch64, m68k,
14025 PowerPC and SPARC@.
14026
14027 Position-independent code requires special support, and therefore works
14028 only on certain machines.
14029
14030 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14031 are defined to 2.
14032
14033 @item -fpie
14034 @itemx -fPIE
14035 @opindex fpie
14036 @opindex fPIE
14037 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14038 generated position-independent code can be only linked into executables.
14039 Usually these options are used to compile code that will be linked using
14040 the @option{-pie} GCC option.
14041
14042 @option{-fpie} and @option{-fPIE} both define the macros
14043 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14044 for @option{-fpie} and 2 for @option{-fPIE}.
14045
14046 @item -fno-plt
14047 @opindex fno-plt
14048 @opindex fplt
14049 Do not use the PLT for external function calls in position-independent code.
14050 Instead, load the callee address at call sites from the GOT and branch to it.
14051 This leads to more efficient code by eliminating PLT stubs and exposing
14052 GOT loads to optimizations. On architectures such as 32-bit x86 where
14053 PLT stubs expect the GOT pointer in a specific register, this gives more
14054 register allocation freedom to the compiler.
14055 Lazy binding requires use of the PLT;
14056 with @option{-fno-plt} all external symbols are resolved at load time.
14057
14058 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14059 through the PLT for specific external functions.
14060
14061 In position-dependent code, a few targets also convert calls to
14062 functions that are marked to not use the PLT to use the GOT instead.
14063
14064 @item -fno-jump-tables
14065 @opindex fno-jump-tables
14066 @opindex fjump-tables
14067 Do not use jump tables for switch statements even where it would be
14068 more efficient than other code generation strategies. This option is
14069 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14070 building code that forms part of a dynamic linker and cannot
14071 reference the address of a jump table. On some targets, jump tables
14072 do not require a GOT and this option is not needed.
14073
14074 @item -ffixed-@var{reg}
14075 @opindex ffixed
14076 Treat the register named @var{reg} as a fixed register; generated code
14077 should never refer to it (except perhaps as a stack pointer, frame
14078 pointer or in some other fixed role).
14079
14080 @var{reg} must be the name of a register. The register names accepted
14081 are machine-specific and are defined in the @code{REGISTER_NAMES}
14082 macro in the machine description macro file.
14083
14084 This flag does not have a negative form, because it specifies a
14085 three-way choice.
14086
14087 @item -fcall-used-@var{reg}
14088 @opindex fcall-used
14089 Treat the register named @var{reg} as an allocable register that is
14090 clobbered by function calls. It may be allocated for temporaries or
14091 variables that do not live across a call. Functions compiled this way
14092 do not save and restore the register @var{reg}.
14093
14094 It is an error to use this flag with the frame pointer or stack pointer.
14095 Use of this flag for other registers that have fixed pervasive roles in
14096 the machine's execution model produces disastrous results.
14097
14098 This flag does not have a negative form, because it specifies a
14099 three-way choice.
14100
14101 @item -fcall-saved-@var{reg}
14102 @opindex fcall-saved
14103 Treat the register named @var{reg} as an allocable register saved by
14104 functions. It may be allocated even for temporaries or variables that
14105 live across a call. Functions compiled this way save and restore
14106 the register @var{reg} if they use it.
14107
14108 It is an error to use this flag with the frame pointer or stack pointer.
14109 Use of this flag for other registers that have fixed pervasive roles in
14110 the machine's execution model produces disastrous results.
14111
14112 A different sort of disaster results from the use of this flag for
14113 a register in which function values may be returned.
14114
14115 This flag does not have a negative form, because it specifies a
14116 three-way choice.
14117
14118 @item -fpack-struct[=@var{n}]
14119 @opindex fpack-struct
14120 Without a value specified, pack all structure members together without
14121 holes. When a value is specified (which must be a small power of two), pack
14122 structure members according to this value, representing the maximum
14123 alignment (that is, objects with default alignment requirements larger than
14124 this are output potentially unaligned at the next fitting location.
14125
14126 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14127 code that is not binary compatible with code generated without that switch.
14128 Additionally, it makes the code suboptimal.
14129 Use it to conform to a non-default application binary interface.
14130
14131 @item -fleading-underscore
14132 @opindex fleading-underscore
14133 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14134 change the way C symbols are represented in the object file. One use
14135 is to help link with legacy assembly code.
14136
14137 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14138 generate code that is not binary compatible with code generated without that
14139 switch. Use it to conform to a non-default application binary interface.
14140 Not all targets provide complete support for this switch.
14141
14142 @item -ftls-model=@var{model}
14143 @opindex ftls-model
14144 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14145 The @var{model} argument should be one of @samp{global-dynamic},
14146 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14147 Note that the choice is subject to optimization: the compiler may use
14148 a more efficient model for symbols not visible outside of the translation
14149 unit, or if @option{-fpic} is not given on the command line.
14150
14151 The default without @option{-fpic} is @samp{initial-exec}; with
14152 @option{-fpic} the default is @samp{global-dynamic}.
14153
14154 @item -ftrampolines
14155 @opindex ftrampolines
14156 For targets that normally need trampolines for nested functions, always
14157 generate them instead of using descriptors. Otherwise, for targets that
14158 do not need them, like for example HP-PA or IA-64, do nothing.
14159
14160 A trampoline is a small piece of code that is created at run time on the
14161 stack when the address of a nested function is taken, and is used to call
14162 the nested function indirectly. Therefore, it requires the stack to be
14163 made executable in order for the program to work properly.
14164
14165 @option{-fno-trampolines} is enabled by default on a language by language
14166 basis to let the compiler avoid generating them, if it computes that this
14167 is safe, and replace them with descriptors. Descriptors are made up of data
14168 only, but the generated code must be prepared to deal with them. As of this
14169 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14170
14171 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14172 @option{-fno-trampolines} are not binary compatible if nested functions are
14173 present. This option must therefore be used on a program-wide basis and be
14174 manipulated with extreme care.
14175
14176 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14177 @opindex fvisibility
14178 Set the default ELF image symbol visibility to the specified option---all
14179 symbols are marked with this unless overridden within the code.
14180 Using this feature can very substantially improve linking and
14181 load times of shared object libraries, produce more optimized
14182 code, provide near-perfect API export and prevent symbol clashes.
14183 It is @strong{strongly} recommended that you use this in any shared objects
14184 you distribute.
14185
14186 Despite the nomenclature, @samp{default} always means public; i.e.,
14187 available to be linked against from outside the shared object.
14188 @samp{protected} and @samp{internal} are pretty useless in real-world
14189 usage so the only other commonly used option is @samp{hidden}.
14190 The default if @option{-fvisibility} isn't specified is
14191 @samp{default}, i.e., make every symbol public.
14192
14193 A good explanation of the benefits offered by ensuring ELF
14194 symbols have the correct visibility is given by ``How To Write
14195 Shared Libraries'' by Ulrich Drepper (which can be found at
14196 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14197 solution made possible by this option to marking things hidden when
14198 the default is public is to make the default hidden and mark things
14199 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14200 and @code{__attribute__ ((visibility("default")))} instead of
14201 @code{__declspec(dllexport)} you get almost identical semantics with
14202 identical syntax. This is a great boon to those working with
14203 cross-platform projects.
14204
14205 For those adding visibility support to existing code, you may find
14206 @code{#pragma GCC visibility} of use. This works by you enclosing
14207 the declarations you wish to set visibility for with (for example)
14208 @code{#pragma GCC visibility push(hidden)} and
14209 @code{#pragma GCC visibility pop}.
14210 Bear in mind that symbol visibility should be viewed @strong{as
14211 part of the API interface contract} and thus all new code should
14212 always specify visibility when it is not the default; i.e., declarations
14213 only for use within the local DSO should @strong{always} be marked explicitly
14214 as hidden as so to avoid PLT indirection overheads---making this
14215 abundantly clear also aids readability and self-documentation of the code.
14216 Note that due to ISO C++ specification requirements, @code{operator new} and
14217 @code{operator delete} must always be of default visibility.
14218
14219 Be aware that headers from outside your project, in particular system
14220 headers and headers from any other library you use, may not be
14221 expecting to be compiled with visibility other than the default. You
14222 may need to explicitly say @code{#pragma GCC visibility push(default)}
14223 before including any such headers.
14224
14225 @code{extern} declarations are not affected by @option{-fvisibility}, so
14226 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14227 no modifications. However, this means that calls to @code{extern}
14228 functions with no explicit visibility use the PLT, so it is more
14229 effective to use @code{__attribute ((visibility))} and/or
14230 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14231 declarations should be treated as hidden.
14232
14233 Note that @option{-fvisibility} does affect C++ vague linkage
14234 entities. This means that, for instance, an exception class that is
14235 be thrown between DSOs must be explicitly marked with default
14236 visibility so that the @samp{type_info} nodes are unified between
14237 the DSOs.
14238
14239 An overview of these techniques, their benefits and how to use them
14240 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14241
14242 @item -fstrict-volatile-bitfields
14243 @opindex fstrict-volatile-bitfields
14244 This option should be used if accesses to volatile bit-fields (or other
14245 structure fields, although the compiler usually honors those types
14246 anyway) should use a single access of the width of the
14247 field's type, aligned to a natural alignment if possible. For
14248 example, targets with memory-mapped peripheral registers might require
14249 all such accesses to be 16 bits wide; with this flag you can
14250 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14251 is 16 bits on these targets) to force GCC to use 16-bit accesses
14252 instead of, perhaps, a more efficient 32-bit access.
14253
14254 If this option is disabled, the compiler uses the most efficient
14255 instruction. In the previous example, that might be a 32-bit load
14256 instruction, even though that accesses bytes that do not contain
14257 any portion of the bit-field, or memory-mapped registers unrelated to
14258 the one being updated.
14259
14260 In some cases, such as when the @code{packed} attribute is applied to a
14261 structure field, it may not be possible to access the field with a single
14262 read or write that is correctly aligned for the target machine. In this
14263 case GCC falls back to generating multiple accesses rather than code that
14264 will fault or truncate the result at run time.
14265
14266 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14267 not allowed to touch non bit-field members. It is therefore recommended
14268 to define all bits of the field's type as bit-field members.
14269
14270 The default value of this option is determined by the application binary
14271 interface for the target processor.
14272
14273 @item -fsync-libcalls
14274 @opindex fsync-libcalls
14275 This option controls whether any out-of-line instance of the @code{__sync}
14276 family of functions may be used to implement the C++11 @code{__atomic}
14277 family of functions.
14278
14279 The default value of this option is enabled, thus the only useful form
14280 of the option is @option{-fno-sync-libcalls}. This option is used in
14281 the implementation of the @file{libatomic} runtime library.
14282
14283 @end table
14284
14285 @node Developer Options
14286 @section GCC Developer Options
14287 @cindex developer options
14288 @cindex debugging GCC
14289 @cindex debug dump options
14290 @cindex dump options
14291 @cindex compilation statistics
14292
14293 This section describes command-line options that are primarily of
14294 interest to GCC developers, including options to support compiler
14295 testing and investigation of compiler bugs and compile-time
14296 performance problems. This includes options that produce debug dumps
14297 at various points in the compilation; that print statistics such as
14298 memory use and execution time; and that print information about GCC's
14299 configuration, such as where it searches for libraries. You should
14300 rarely need to use any of these options for ordinary compilation and
14301 linking tasks.
14302
14303 Many developer options that cause GCC to dump output to a file take an
14304 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14305 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14306 error.
14307
14308 If @samp{=@var{filename}} is omitted, a default dump file name is
14309 constructed by concatenating the base dump file name, a pass number,
14310 phase letter, and pass name. The base dump file name is the name of
14311 output file produced by the compiler if explicitly specified and not
14312 an executable; otherwise it is the source file name.
14313 The pass number is determined by the order passes are registered with
14314 the compiler's pass manager.
14315 This is generally the same as the order of execution, but passes
14316 registered by plugins, target-specific passes, or passes that are
14317 otherwise registered late are numbered higher than the pass named
14318 @samp{final}, even if they are executed earlier. The phase letter is
14319 one of @samp{i} (inter-procedural analysis), @samp{l}
14320 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14321 The files are created in the directory of the output file.
14322
14323 @table @gcctabopt
14324
14325 @item -d@var{letters}
14326 @itemx -fdump-rtl-@var{pass}
14327 @itemx -fdump-rtl-@var{pass}=@var{filename}
14328 @opindex d
14329 @opindex fdump-rtl-@var{pass}
14330 Says to make debugging dumps during compilation at times specified by
14331 @var{letters}. This is used for debugging the RTL-based passes of the
14332 compiler.
14333
14334 Some @option{-d@var{letters}} switches have different meaning when
14335 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14336 for information about preprocessor-specific dump options.
14337
14338 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14339 @option{-d} option @var{letters}. Here are the possible
14340 letters for use in @var{pass} and @var{letters}, and their meanings:
14341
14342 @table @gcctabopt
14343
14344 @item -fdump-rtl-alignments
14345 @opindex fdump-rtl-alignments
14346 Dump after branch alignments have been computed.
14347
14348 @item -fdump-rtl-asmcons
14349 @opindex fdump-rtl-asmcons
14350 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14351
14352 @item -fdump-rtl-auto_inc_dec
14353 @opindex fdump-rtl-auto_inc_dec
14354 Dump after auto-inc-dec discovery. This pass is only run on
14355 architectures that have auto inc or auto dec instructions.
14356
14357 @item -fdump-rtl-barriers
14358 @opindex fdump-rtl-barriers
14359 Dump after cleaning up the barrier instructions.
14360
14361 @item -fdump-rtl-bbpart
14362 @opindex fdump-rtl-bbpart
14363 Dump after partitioning hot and cold basic blocks.
14364
14365 @item -fdump-rtl-bbro
14366 @opindex fdump-rtl-bbro
14367 Dump after block reordering.
14368
14369 @item -fdump-rtl-btl1
14370 @itemx -fdump-rtl-btl2
14371 @opindex fdump-rtl-btl2
14372 @opindex fdump-rtl-btl2
14373 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14374 after the two branch
14375 target load optimization passes.
14376
14377 @item -fdump-rtl-bypass
14378 @opindex fdump-rtl-bypass
14379 Dump after jump bypassing and control flow optimizations.
14380
14381 @item -fdump-rtl-combine
14382 @opindex fdump-rtl-combine
14383 Dump after the RTL instruction combination pass.
14384
14385 @item -fdump-rtl-compgotos
14386 @opindex fdump-rtl-compgotos
14387 Dump after duplicating the computed gotos.
14388
14389 @item -fdump-rtl-ce1
14390 @itemx -fdump-rtl-ce2
14391 @itemx -fdump-rtl-ce3
14392 @opindex fdump-rtl-ce1
14393 @opindex fdump-rtl-ce2
14394 @opindex fdump-rtl-ce3
14395 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14396 @option{-fdump-rtl-ce3} enable dumping after the three
14397 if conversion passes.
14398
14399 @item -fdump-rtl-cprop_hardreg
14400 @opindex fdump-rtl-cprop_hardreg
14401 Dump after hard register copy propagation.
14402
14403 @item -fdump-rtl-csa
14404 @opindex fdump-rtl-csa
14405 Dump after combining stack adjustments.
14406
14407 @item -fdump-rtl-cse1
14408 @itemx -fdump-rtl-cse2
14409 @opindex fdump-rtl-cse1
14410 @opindex fdump-rtl-cse2
14411 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14412 the two common subexpression elimination passes.
14413
14414 @item -fdump-rtl-dce
14415 @opindex fdump-rtl-dce
14416 Dump after the standalone dead code elimination passes.
14417
14418 @item -fdump-rtl-dbr
14419 @opindex fdump-rtl-dbr
14420 Dump after delayed branch scheduling.
14421
14422 @item -fdump-rtl-dce1
14423 @itemx -fdump-rtl-dce2
14424 @opindex fdump-rtl-dce1
14425 @opindex fdump-rtl-dce2
14426 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14427 the two dead store elimination passes.
14428
14429 @item -fdump-rtl-eh
14430 @opindex fdump-rtl-eh
14431 Dump after finalization of EH handling code.
14432
14433 @item -fdump-rtl-eh_ranges
14434 @opindex fdump-rtl-eh_ranges
14435 Dump after conversion of EH handling range regions.
14436
14437 @item -fdump-rtl-expand
14438 @opindex fdump-rtl-expand
14439 Dump after RTL generation.
14440
14441 @item -fdump-rtl-fwprop1
14442 @itemx -fdump-rtl-fwprop2
14443 @opindex fdump-rtl-fwprop1
14444 @opindex fdump-rtl-fwprop2
14445 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14446 dumping after the two forward propagation passes.
14447
14448 @item -fdump-rtl-gcse1
14449 @itemx -fdump-rtl-gcse2
14450 @opindex fdump-rtl-gcse1
14451 @opindex fdump-rtl-gcse2
14452 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14453 after global common subexpression elimination.
14454
14455 @item -fdump-rtl-init-regs
14456 @opindex fdump-rtl-init-regs
14457 Dump after the initialization of the registers.
14458
14459 @item -fdump-rtl-initvals
14460 @opindex fdump-rtl-initvals
14461 Dump after the computation of the initial value sets.
14462
14463 @item -fdump-rtl-into_cfglayout
14464 @opindex fdump-rtl-into_cfglayout
14465 Dump after converting to cfglayout mode.
14466
14467 @item -fdump-rtl-ira
14468 @opindex fdump-rtl-ira
14469 Dump after iterated register allocation.
14470
14471 @item -fdump-rtl-jump
14472 @opindex fdump-rtl-jump
14473 Dump after the second jump optimization.
14474
14475 @item -fdump-rtl-loop2
14476 @opindex fdump-rtl-loop2
14477 @option{-fdump-rtl-loop2} enables dumping after the rtl
14478 loop optimization passes.
14479
14480 @item -fdump-rtl-mach
14481 @opindex fdump-rtl-mach
14482 Dump after performing the machine dependent reorganization pass, if that
14483 pass exists.
14484
14485 @item -fdump-rtl-mode_sw
14486 @opindex fdump-rtl-mode_sw
14487 Dump after removing redundant mode switches.
14488
14489 @item -fdump-rtl-rnreg
14490 @opindex fdump-rtl-rnreg
14491 Dump after register renumbering.
14492
14493 @item -fdump-rtl-outof_cfglayout
14494 @opindex fdump-rtl-outof_cfglayout
14495 Dump after converting from cfglayout mode.
14496
14497 @item -fdump-rtl-peephole2
14498 @opindex fdump-rtl-peephole2
14499 Dump after the peephole pass.
14500
14501 @item -fdump-rtl-postreload
14502 @opindex fdump-rtl-postreload
14503 Dump after post-reload optimizations.
14504
14505 @item -fdump-rtl-pro_and_epilogue
14506 @opindex fdump-rtl-pro_and_epilogue
14507 Dump after generating the function prologues and epilogues.
14508
14509 @item -fdump-rtl-sched1
14510 @itemx -fdump-rtl-sched2
14511 @opindex fdump-rtl-sched1
14512 @opindex fdump-rtl-sched2
14513 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14514 after the basic block scheduling passes.
14515
14516 @item -fdump-rtl-ree
14517 @opindex fdump-rtl-ree
14518 Dump after sign/zero extension elimination.
14519
14520 @item -fdump-rtl-seqabstr
14521 @opindex fdump-rtl-seqabstr
14522 Dump after common sequence discovery.
14523
14524 @item -fdump-rtl-shorten
14525 @opindex fdump-rtl-shorten
14526 Dump after shortening branches.
14527
14528 @item -fdump-rtl-sibling
14529 @opindex fdump-rtl-sibling
14530 Dump after sibling call optimizations.
14531
14532 @item -fdump-rtl-split1
14533 @itemx -fdump-rtl-split2
14534 @itemx -fdump-rtl-split3
14535 @itemx -fdump-rtl-split4
14536 @itemx -fdump-rtl-split5
14537 @opindex fdump-rtl-split1
14538 @opindex fdump-rtl-split2
14539 @opindex fdump-rtl-split3
14540 @opindex fdump-rtl-split4
14541 @opindex fdump-rtl-split5
14542 These options enable dumping after five rounds of
14543 instruction splitting.
14544
14545 @item -fdump-rtl-sms
14546 @opindex fdump-rtl-sms
14547 Dump after modulo scheduling. This pass is only run on some
14548 architectures.
14549
14550 @item -fdump-rtl-stack
14551 @opindex fdump-rtl-stack
14552 Dump after conversion from GCC's ``flat register file'' registers to the
14553 x87's stack-like registers. This pass is only run on x86 variants.
14554
14555 @item -fdump-rtl-subreg1
14556 @itemx -fdump-rtl-subreg2
14557 @opindex fdump-rtl-subreg1
14558 @opindex fdump-rtl-subreg2
14559 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14560 the two subreg expansion passes.
14561
14562 @item -fdump-rtl-unshare
14563 @opindex fdump-rtl-unshare
14564 Dump after all rtl has been unshared.
14565
14566 @item -fdump-rtl-vartrack
14567 @opindex fdump-rtl-vartrack
14568 Dump after variable tracking.
14569
14570 @item -fdump-rtl-vregs
14571 @opindex fdump-rtl-vregs
14572 Dump after converting virtual registers to hard registers.
14573
14574 @item -fdump-rtl-web
14575 @opindex fdump-rtl-web
14576 Dump after live range splitting.
14577
14578 @item -fdump-rtl-regclass
14579 @itemx -fdump-rtl-subregs_of_mode_init
14580 @itemx -fdump-rtl-subregs_of_mode_finish
14581 @itemx -fdump-rtl-dfinit
14582 @itemx -fdump-rtl-dfinish
14583 @opindex fdump-rtl-regclass
14584 @opindex fdump-rtl-subregs_of_mode_init
14585 @opindex fdump-rtl-subregs_of_mode_finish
14586 @opindex fdump-rtl-dfinit
14587 @opindex fdump-rtl-dfinish
14588 These dumps are defined but always produce empty files.
14589
14590 @item -da
14591 @itemx -fdump-rtl-all
14592 @opindex da
14593 @opindex fdump-rtl-all
14594 Produce all the dumps listed above.
14595
14596 @item -dA
14597 @opindex dA
14598 Annotate the assembler output with miscellaneous debugging information.
14599
14600 @item -dD
14601 @opindex dD
14602 Dump all macro definitions, at the end of preprocessing, in addition to
14603 normal output.
14604
14605 @item -dH
14606 @opindex dH
14607 Produce a core dump whenever an error occurs.
14608
14609 @item -dp
14610 @opindex dp
14611 Annotate the assembler output with a comment indicating which
14612 pattern and alternative is used. The length and cost of each instruction are
14613 also printed.
14614
14615 @item -dP
14616 @opindex dP
14617 Dump the RTL in the assembler output as a comment before each instruction.
14618 Also turns on @option{-dp} annotation.
14619
14620 @item -dx
14621 @opindex dx
14622 Just generate RTL for a function instead of compiling it. Usually used
14623 with @option{-fdump-rtl-expand}.
14624 @end table
14625
14626 @item -fdump-debug
14627 @opindex fdump-debug
14628 Dump debugging information generated during the debug
14629 generation phase.
14630
14631 @item -fdump-earlydebug
14632 @opindex fdump-earlydebug
14633 Dump debugging information generated during the early debug
14634 generation phase.
14635
14636 @item -fdump-noaddr
14637 @opindex fdump-noaddr
14638 When doing debugging dumps, suppress address output. This makes it more
14639 feasible to use diff on debugging dumps for compiler invocations with
14640 different compiler binaries and/or different
14641 text / bss / data / heap / stack / dso start locations.
14642
14643 @item -freport-bug
14644 @opindex freport-bug
14645 Collect and dump debug information into a temporary file if an
14646 internal compiler error (ICE) occurs.
14647
14648 @item -fdump-unnumbered
14649 @opindex fdump-unnumbered
14650 When doing debugging dumps, suppress instruction numbers and address output.
14651 This makes it more feasible to use diff on debugging dumps for compiler
14652 invocations with different options, in particular with and without
14653 @option{-g}.
14654
14655 @item -fdump-unnumbered-links
14656 @opindex fdump-unnumbered-links
14657 When doing debugging dumps (see @option{-d} option above), suppress
14658 instruction numbers for the links to the previous and next instructions
14659 in a sequence.
14660
14661 @item -fdump-ipa-@var{switch}
14662 @itemx -fdump-ipa-@var{switch}-@var{options}
14663 @opindex fdump-ipa
14664 Control the dumping at various stages of inter-procedural analysis
14665 language tree to a file. The file name is generated by appending a
14666 switch specific suffix to the source file name, and the file is created
14667 in the same directory as the output file. The following dumps are
14668 possible:
14669
14670 @table @samp
14671 @item all
14672 Enables all inter-procedural analysis dumps.
14673
14674 @item cgraph
14675 Dumps information about call-graph optimization, unused function removal,
14676 and inlining decisions.
14677
14678 @item inline
14679 Dump after function inlining.
14680
14681 @end table
14682
14683 Additionally, the options @option{-optimized}, @option{-missed},
14684 @option{-note}, and @option{-all} can be provided, with the same meaning
14685 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14686
14687 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14688 information on callsites that were inlined, along with callsites
14689 that were not inlined.
14690
14691 By default, the dump will contain messages about successful
14692 optimizations (equivalent to @option{-optimized}) together with
14693 low-level details about the analysis.
14694
14695 @item -fdump-lang-all
14696 @itemx -fdump-lang-@var{switch}
14697 @itemx -fdump-lang-@var{switch}-@var{options}
14698 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14699 @opindex fdump-lang-all
14700 @opindex fdump-lang
14701 Control the dumping of language-specific information. The @var{options}
14702 and @var{filename} portions behave as described in the
14703 @option{-fdump-tree} option. The following @var{switch} values are
14704 accepted:
14705
14706 @table @samp
14707 @item all
14708
14709 Enable all language-specific dumps.
14710
14711 @item class
14712 Dump class hierarchy information. Virtual table information is emitted
14713 unless '@option{slim}' is specified. This option is applicable to C++ only.
14714
14715 @item raw
14716 Dump the raw internal tree data. This option is applicable to C++ only.
14717
14718 @end table
14719
14720 @item -fdump-passes
14721 @opindex fdump-passes
14722 Print on @file{stderr} the list of optimization passes that are turned
14723 on and off by the current command-line options.
14724
14725 @item -fdump-statistics-@var{option}
14726 @opindex fdump-statistics
14727 Enable and control dumping of pass statistics in a separate file. The
14728 file name is generated by appending a suffix ending in
14729 @samp{.statistics} to the source file name, and the file is created in
14730 the same directory as the output file. If the @samp{-@var{option}}
14731 form is used, @samp{-stats} causes counters to be summed over the
14732 whole compilation unit while @samp{-details} dumps every event as
14733 the passes generate them. The default with no option is to sum
14734 counters for each function compiled.
14735
14736 @item -fdump-tree-all
14737 @itemx -fdump-tree-@var{switch}
14738 @itemx -fdump-tree-@var{switch}-@var{options}
14739 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14740 @opindex fdump-tree-all
14741 @opindex fdump-tree
14742 Control the dumping at various stages of processing the intermediate
14743 language tree to a file. If the @samp{-@var{options}}
14744 form is used, @var{options} is a list of @samp{-} separated options
14745 which control the details of the dump. Not all options are applicable
14746 to all dumps; those that are not meaningful are ignored. The
14747 following options are available
14748
14749 @table @samp
14750 @item address
14751 Print the address of each node. Usually this is not meaningful as it
14752 changes according to the environment and source file. Its primary use
14753 is for tying up a dump file with a debug environment.
14754 @item asmname
14755 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14756 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14757 use working backward from mangled names in the assembly file.
14758 @item slim
14759 When dumping front-end intermediate representations, inhibit dumping
14760 of members of a scope or body of a function merely because that scope
14761 has been reached. Only dump such items when they are directly reachable
14762 by some other path.
14763
14764 When dumping pretty-printed trees, this option inhibits dumping the
14765 bodies of control structures.
14766
14767 When dumping RTL, print the RTL in slim (condensed) form instead of
14768 the default LISP-like representation.
14769 @item raw
14770 Print a raw representation of the tree. By default, trees are
14771 pretty-printed into a C-like representation.
14772 @item details
14773 Enable more detailed dumps (not honored by every dump option). Also
14774 include information from the optimization passes.
14775 @item stats
14776 Enable dumping various statistics about the pass (not honored by every dump
14777 option).
14778 @item blocks
14779 Enable showing basic block boundaries (disabled in raw dumps).
14780 @item graph
14781 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14782 dump a representation of the control flow graph suitable for viewing with
14783 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14784 the file is pretty-printed as a subgraph, so that GraphViz can render them
14785 all in a single plot.
14786
14787 This option currently only works for RTL dumps, and the RTL is always
14788 dumped in slim form.
14789 @item vops
14790 Enable showing virtual operands for every statement.
14791 @item lineno
14792 Enable showing line numbers for statements.
14793 @item uid
14794 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14795 @item verbose
14796 Enable showing the tree dump for each statement.
14797 @item eh
14798 Enable showing the EH region number holding each statement.
14799 @item scev
14800 Enable showing scalar evolution analysis details.
14801 @item optimized
14802 Enable showing optimization information (only available in certain
14803 passes).
14804 @item missed
14805 Enable showing missed optimization information (only available in certain
14806 passes).
14807 @item note
14808 Enable other detailed optimization information (only available in
14809 certain passes).
14810 @item all
14811 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14812 and @option{lineno}.
14813 @item optall
14814 Turn on all optimization options, i.e., @option{optimized},
14815 @option{missed}, and @option{note}.
14816 @end table
14817
14818 To determine what tree dumps are available or find the dump for a pass
14819 of interest follow the steps below.
14820
14821 @enumerate
14822 @item
14823 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14824 look for a code that corresponds to the pass you are interested in.
14825 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14826 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14827 The number at the end distinguishes distinct invocations of the same pass.
14828 @item
14829 To enable the creation of the dump file, append the pass code to
14830 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14831 to enable the dump from the Early Value Range Propagation pass, invoke
14832 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14833 specify the name of the dump file. If you don't specify one, GCC
14834 creates as described below.
14835 @item
14836 Find the pass dump in a file whose name is composed of three components
14837 separated by a period: the name of the source file GCC was invoked to
14838 compile, a numeric suffix indicating the pass number followed by the
14839 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14840 and finally the pass code. For example, the Early VRP pass dump might
14841 be in a file named @file{myfile.c.038t.evrp} in the current working
14842 directory. Note that the numeric codes are not stable and may change
14843 from one version of GCC to another.
14844 @end enumerate
14845
14846 @item -fopt-info
14847 @itemx -fopt-info-@var{options}
14848 @itemx -fopt-info-@var{options}=@var{filename}
14849 @opindex fopt-info
14850 Controls optimization dumps from various optimization passes. If the
14851 @samp{-@var{options}} form is used, @var{options} is a list of
14852 @samp{-} separated option keywords to select the dump details and
14853 optimizations.
14854
14855 The @var{options} can be divided into three groups:
14856 @enumerate
14857 @item
14858 options describing what kinds of messages should be emitted,
14859 @item
14860 options describing the verbosity of the dump, and
14861 @item
14862 options describing which optimizations should be included.
14863 @end enumerate
14864 The options from each group can be freely mixed as they are
14865 non-overlapping. However, in case of any conflicts,
14866 the later options override the earlier options on the command
14867 line.
14868
14869 The following options control which kinds of messages should be emitted:
14870
14871 @table @samp
14872 @item optimized
14873 Print information when an optimization is successfully applied. It is
14874 up to a pass to decide which information is relevant. For example, the
14875 vectorizer passes print the source location of loops which are
14876 successfully vectorized.
14877 @item missed
14878 Print information about missed optimizations. Individual passes
14879 control which information to include in the output.
14880 @item note
14881 Print verbose information about optimizations, such as certain
14882 transformations, more detailed messages about decisions etc.
14883 @item all
14884 Print detailed optimization information. This includes
14885 @samp{optimized}, @samp{missed}, and @samp{note}.
14886 @end table
14887
14888 The following option controls the dump verbosity:
14889
14890 @table @samp
14891 @item internals
14892 By default, only ``high-level'' messages are emitted. This option enables
14893 additional, more detailed, messages, which are likely to only be of interest
14894 to GCC developers.
14895 @end table
14896
14897 One or more of the following option keywords can be used to describe a
14898 group of optimizations:
14899
14900 @table @samp
14901 @item ipa
14902 Enable dumps from all interprocedural optimizations.
14903 @item loop
14904 Enable dumps from all loop optimizations.
14905 @item inline
14906 Enable dumps from all inlining optimizations.
14907 @item omp
14908 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14909 @item vec
14910 Enable dumps from all vectorization optimizations.
14911 @item optall
14912 Enable dumps from all optimizations. This is a superset of
14913 the optimization groups listed above.
14914 @end table
14915
14916 If @var{options} is
14917 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14918 about successful optimizations from all the passes, omitting messages
14919 that are treated as ``internals''.
14920
14921 If the @var{filename} is provided, then the dumps from all the
14922 applicable optimizations are concatenated into the @var{filename}.
14923 Otherwise the dump is output onto @file{stderr}. Though multiple
14924 @option{-fopt-info} options are accepted, only one of them can include
14925 a @var{filename}. If other filenames are provided then all but the
14926 first such option are ignored.
14927
14928 Note that the output @var{filename} is overwritten
14929 in case of multiple translation units. If a combined output from
14930 multiple translation units is desired, @file{stderr} should be used
14931 instead.
14932
14933 In the following example, the optimization info is output to
14934 @file{stderr}:
14935
14936 @smallexample
14937 gcc -O3 -fopt-info
14938 @end smallexample
14939
14940 This example:
14941 @smallexample
14942 gcc -O3 -fopt-info-missed=missed.all
14943 @end smallexample
14944
14945 @noindent
14946 outputs missed optimization report from all the passes into
14947 @file{missed.all}, and this one:
14948
14949 @smallexample
14950 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14951 @end smallexample
14952
14953 @noindent
14954 prints information about missed optimization opportunities from
14955 vectorization passes on @file{stderr}.
14956 Note that @option{-fopt-info-vec-missed} is equivalent to
14957 @option{-fopt-info-missed-vec}. The order of the optimization group
14958 names and message types listed after @option{-fopt-info} does not matter.
14959
14960 As another example,
14961 @smallexample
14962 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14963 @end smallexample
14964
14965 @noindent
14966 outputs information about missed optimizations as well as
14967 optimized locations from all the inlining passes into
14968 @file{inline.txt}.
14969
14970 Finally, consider:
14971
14972 @smallexample
14973 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14974 @end smallexample
14975
14976 @noindent
14977 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14978 in conflict since only one output file is allowed. In this case, only
14979 the first option takes effect and the subsequent options are
14980 ignored. Thus only @file{vec.miss} is produced which contains
14981 dumps from the vectorizer about missed opportunities.
14982
14983 @item -fsave-optimization-record
14984 @opindex fsave-optimization-record
14985 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
14986 were performed, for those optimizations that support @option{-fopt-info}.
14987
14988 This option is experimental and the format of the data within the
14989 compressed JSON file is subject to change.
14990
14991 It is roughly equivalent to a machine-readable version of
14992 @option{-fopt-info-all}, as a collection of messages with source file,
14993 line number and column number, with the following additional data for
14994 each message:
14995
14996 @itemize @bullet
14997
14998 @item
14999 the execution count of the code being optimized, along with metadata about
15000 whether this was from actual profile data, or just an estimate, allowing
15001 consumers to prioritize messages by code hotness,
15002
15003 @item
15004 the function name of the code being optimized, where applicable,
15005
15006 @item
15007 the ``inlining chain'' for the code being optimized, so that when
15008 a function is inlined into several different places (which might
15009 themselves be inlined), the reader can distinguish between the copies,
15010
15011 @item
15012 objects identifying those parts of the message that refer to expressions,
15013 statements or symbol-table nodes, which of these categories they are, and,
15014 when available, their source code location,
15015
15016 @item
15017 the GCC pass that emitted the message, and
15018
15019 @item
15020 the location in GCC's own code from which the message was emitted
15021
15022 @end itemize
15023
15024 Additionally, some messages are logically nested within other
15025 messages, reflecting implementation details of the optimization
15026 passes.
15027
15028 @item -fsched-verbose=@var{n}
15029 @opindex fsched-verbose
15030 On targets that use instruction scheduling, this option controls the
15031 amount of debugging output the scheduler prints to the dump files.
15032
15033 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15034 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15035 For @var{n} greater than one, it also output basic block probabilities,
15036 detailed ready list information and unit/insn info. For @var{n} greater
15037 than two, it includes RTL at abort point, control-flow and regions info.
15038 And for @var{n} over four, @option{-fsched-verbose} also includes
15039 dependence info.
15040
15041
15042
15043 @item -fenable-@var{kind}-@var{pass}
15044 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15045 @opindex fdisable-
15046 @opindex fenable-
15047
15048 This is a set of options that are used to explicitly disable/enable
15049 optimization passes. These options are intended for use for debugging GCC.
15050 Compiler users should use regular options for enabling/disabling
15051 passes instead.
15052
15053 @table @gcctabopt
15054
15055 @item -fdisable-ipa-@var{pass}
15056 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15057 statically invoked in the compiler multiple times, the pass name should be
15058 appended with a sequential number starting from 1.
15059
15060 @item -fdisable-rtl-@var{pass}
15061 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15062 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15063 statically invoked in the compiler multiple times, the pass name should be
15064 appended with a sequential number starting from 1. @var{range-list} is a
15065 comma-separated list of function ranges or assembler names. Each range is a number
15066 pair separated by a colon. The range is inclusive in both ends. If the range
15067 is trivial, the number pair can be simplified as a single number. If the
15068 function's call graph node's @var{uid} falls within one of the specified ranges,
15069 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15070 function header of a dump file, and the pass names can be dumped by using
15071 option @option{-fdump-passes}.
15072
15073 @item -fdisable-tree-@var{pass}
15074 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15075 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15076 option arguments.
15077
15078 @item -fenable-ipa-@var{pass}
15079 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15080 statically invoked in the compiler multiple times, the pass name should be
15081 appended with a sequential number starting from 1.
15082
15083 @item -fenable-rtl-@var{pass}
15084 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15085 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15086 description and examples.
15087
15088 @item -fenable-tree-@var{pass}
15089 @itemx -fenable-tree-@var{pass}=@var{range-list}
15090 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15091 of option arguments.
15092
15093 @end table
15094
15095 Here are some examples showing uses of these options.
15096
15097 @smallexample
15098
15099 # disable ccp1 for all functions
15100 -fdisable-tree-ccp1
15101 # disable complete unroll for function whose cgraph node uid is 1
15102 -fenable-tree-cunroll=1
15103 # disable gcse2 for functions at the following ranges [1,1],
15104 # [300,400], and [400,1000]
15105 # disable gcse2 for functions foo and foo2
15106 -fdisable-rtl-gcse2=foo,foo2
15107 # disable early inlining
15108 -fdisable-tree-einline
15109 # disable ipa inlining
15110 -fdisable-ipa-inline
15111 # enable tree full unroll
15112 -fenable-tree-unroll
15113
15114 @end smallexample
15115
15116 @item -fchecking
15117 @itemx -fchecking=@var{n}
15118 @opindex fchecking
15119 @opindex fno-checking
15120 Enable internal consistency checking. The default depends on
15121 the compiler configuration. @option{-fchecking=2} enables further
15122 internal consistency checking that might affect code generation.
15123
15124 @item -frandom-seed=@var{string}
15125 @opindex frandom-seed
15126 This option provides a seed that GCC uses in place of
15127 random numbers in generating certain symbol names
15128 that have to be different in every compiled file. It is also used to
15129 place unique stamps in coverage data files and the object files that
15130 produce them. You can use the @option{-frandom-seed} option to produce
15131 reproducibly identical object files.
15132
15133 The @var{string} can either be a number (decimal, octal or hex) or an
15134 arbitrary string (in which case it's converted to a number by
15135 computing CRC32).
15136
15137 The @var{string} should be different for every file you compile.
15138
15139 @item -save-temps
15140 @itemx -save-temps=cwd
15141 @opindex save-temps
15142 Store the usual ``temporary'' intermediate files permanently; place them
15143 in the current directory and name them based on the source file. Thus,
15144 compiling @file{foo.c} with @option{-c -save-temps} produces files
15145 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15146 preprocessed @file{foo.i} output file even though the compiler now
15147 normally uses an integrated preprocessor.
15148
15149 When used in combination with the @option{-x} command-line option,
15150 @option{-save-temps} is sensible enough to avoid over writing an
15151 input source file with the same extension as an intermediate file.
15152 The corresponding intermediate file may be obtained by renaming the
15153 source file before using @option{-save-temps}.
15154
15155 If you invoke GCC in parallel, compiling several different source
15156 files that share a common base name in different subdirectories or the
15157 same source file compiled for multiple output destinations, it is
15158 likely that the different parallel compilers will interfere with each
15159 other, and overwrite the temporary files. For instance:
15160
15161 @smallexample
15162 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15163 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15164 @end smallexample
15165
15166 may result in @file{foo.i} and @file{foo.o} being written to
15167 simultaneously by both compilers.
15168
15169 @item -save-temps=obj
15170 @opindex save-temps=obj
15171 Store the usual ``temporary'' intermediate files permanently. If the
15172 @option{-o} option is used, the temporary files are based on the
15173 object file. If the @option{-o} option is not used, the
15174 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15175
15176 For example:
15177
15178 @smallexample
15179 gcc -save-temps=obj -c foo.c
15180 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15181 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15182 @end smallexample
15183
15184 @noindent
15185 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15186 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15187 @file{dir2/yfoobar.o}.
15188
15189 @item -time@r{[}=@var{file}@r{]}
15190 @opindex time
15191 Report the CPU time taken by each subprocess in the compilation
15192 sequence. For C source files, this is the compiler proper and assembler
15193 (plus the linker if linking is done).
15194
15195 Without the specification of an output file, the output looks like this:
15196
15197 @smallexample
15198 # cc1 0.12 0.01
15199 # as 0.00 0.01
15200 @end smallexample
15201
15202 The first number on each line is the ``user time'', that is time spent
15203 executing the program itself. The second number is ``system time'',
15204 time spent executing operating system routines on behalf of the program.
15205 Both numbers are in seconds.
15206
15207 With the specification of an output file, the output is appended to the
15208 named file, and it looks like this:
15209
15210 @smallexample
15211 0.12 0.01 cc1 @var{options}
15212 0.00 0.01 as @var{options}
15213 @end smallexample
15214
15215 The ``user time'' and the ``system time'' are moved before the program
15216 name, and the options passed to the program are displayed, so that one
15217 can later tell what file was being compiled, and with which options.
15218
15219 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15220 @opindex fdump-final-insns
15221 Dump the final internal representation (RTL) to @var{file}. If the
15222 optional argument is omitted (or if @var{file} is @code{.}), the name
15223 of the dump file is determined by appending @code{.gkd} to the
15224 compilation output file name.
15225
15226 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15227 @opindex fcompare-debug
15228 @opindex fno-compare-debug
15229 If no error occurs during compilation, run the compiler a second time,
15230 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15231 passed to the second compilation. Dump the final internal
15232 representation in both compilations, and print an error if they differ.
15233
15234 If the equal sign is omitted, the default @option{-gtoggle} is used.
15235
15236 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15237 and nonzero, implicitly enables @option{-fcompare-debug}. If
15238 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15239 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15240 is used.
15241
15242 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15243 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15244 of the final representation and the second compilation, preventing even
15245 @env{GCC_COMPARE_DEBUG} from taking effect.
15246
15247 To verify full coverage during @option{-fcompare-debug} testing, set
15248 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15249 which GCC rejects as an invalid option in any actual compilation
15250 (rather than preprocessing, assembly or linking). To get just a
15251 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15252 not overridden} will do.
15253
15254 @item -fcompare-debug-second
15255 @opindex fcompare-debug-second
15256 This option is implicitly passed to the compiler for the second
15257 compilation requested by @option{-fcompare-debug}, along with options to
15258 silence warnings, and omitting other options that would cause the compiler
15259 to produce output to files or to standard output as a side effect. Dump
15260 files and preserved temporary files are renamed so as to contain the
15261 @code{.gk} additional extension during the second compilation, to avoid
15262 overwriting those generated by the first.
15263
15264 When this option is passed to the compiler driver, it causes the
15265 @emph{first} compilation to be skipped, which makes it useful for little
15266 other than debugging the compiler proper.
15267
15268 @item -gtoggle
15269 @opindex gtoggle
15270 Turn off generation of debug info, if leaving out this option
15271 generates it, or turn it on at level 2 otherwise. The position of this
15272 argument in the command line does not matter; it takes effect after all
15273 other options are processed, and it does so only once, no matter how
15274 many times it is given. This is mainly intended to be used with
15275 @option{-fcompare-debug}.
15276
15277 @item -fvar-tracking-assignments-toggle
15278 @opindex fvar-tracking-assignments-toggle
15279 @opindex fno-var-tracking-assignments-toggle
15280 Toggle @option{-fvar-tracking-assignments}, in the same way that
15281 @option{-gtoggle} toggles @option{-g}.
15282
15283 @item -Q
15284 @opindex Q
15285 Makes the compiler print out each function name as it is compiled, and
15286 print some statistics about each pass when it finishes.
15287
15288 @item -ftime-report
15289 @opindex ftime-report
15290 Makes the compiler print some statistics about the time consumed by each
15291 pass when it finishes.
15292
15293 @item -ftime-report-details
15294 @opindex ftime-report-details
15295 Record the time consumed by infrastructure parts separately for each pass.
15296
15297 @item -fira-verbose=@var{n}
15298 @opindex fira-verbose
15299 Control the verbosity of the dump file for the integrated register allocator.
15300 The default value is 5. If the value @var{n} is greater or equal to 10,
15301 the dump output is sent to stderr using the same format as @var{n} minus 10.
15302
15303 @item -flto-report
15304 @opindex flto-report
15305 Prints a report with internal details on the workings of the link-time
15306 optimizer. The contents of this report vary from version to version.
15307 It is meant to be useful to GCC developers when processing object
15308 files in LTO mode (via @option{-flto}).
15309
15310 Disabled by default.
15311
15312 @item -flto-report-wpa
15313 @opindex flto-report-wpa
15314 Like @option{-flto-report}, but only print for the WPA phase of Link
15315 Time Optimization.
15316
15317 @item -fmem-report
15318 @opindex fmem-report
15319 Makes the compiler print some statistics about permanent memory
15320 allocation when it finishes.
15321
15322 @item -fmem-report-wpa
15323 @opindex fmem-report-wpa
15324 Makes the compiler print some statistics about permanent memory
15325 allocation for the WPA phase only.
15326
15327 @item -fpre-ipa-mem-report
15328 @opindex fpre-ipa-mem-report
15329 @item -fpost-ipa-mem-report
15330 @opindex fpost-ipa-mem-report
15331 Makes the compiler print some statistics about permanent memory
15332 allocation before or after interprocedural optimization.
15333
15334 @item -fprofile-report
15335 @opindex fprofile-report
15336 Makes the compiler print some statistics about consistency of the
15337 (estimated) profile and effect of individual passes.
15338
15339 @item -fstack-usage
15340 @opindex fstack-usage
15341 Makes the compiler output stack usage information for the program, on a
15342 per-function basis. The filename for the dump is made by appending
15343 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15344 the output file, if explicitly specified and it is not an executable,
15345 otherwise it is the basename of the source file. An entry is made up
15346 of three fields:
15347
15348 @itemize
15349 @item
15350 The name of the function.
15351 @item
15352 A number of bytes.
15353 @item
15354 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15355 @end itemize
15356
15357 The qualifier @code{static} means that the function manipulates the stack
15358 statically: a fixed number of bytes are allocated for the frame on function
15359 entry and released on function exit; no stack adjustments are otherwise made
15360 in the function. The second field is this fixed number of bytes.
15361
15362 The qualifier @code{dynamic} means that the function manipulates the stack
15363 dynamically: in addition to the static allocation described above, stack
15364 adjustments are made in the body of the function, for example to push/pop
15365 arguments around function calls. If the qualifier @code{bounded} is also
15366 present, the amount of these adjustments is bounded at compile time and
15367 the second field is an upper bound of the total amount of stack used by
15368 the function. If it is not present, the amount of these adjustments is
15369 not bounded at compile time and the second field only represents the
15370 bounded part.
15371
15372 @item -fstats
15373 @opindex fstats
15374 Emit statistics about front-end processing at the end of the compilation.
15375 This option is supported only by the C++ front end, and
15376 the information is generally only useful to the G++ development team.
15377
15378 @item -fdbg-cnt-list
15379 @opindex fdbg-cnt-list
15380 Print the name and the counter upper bound for all debug counters.
15381
15382
15383 @item -fdbg-cnt=@var{counter-value-list}
15384 @opindex fdbg-cnt
15385 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15386 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15387 tuples which sets the lower and the upper bound of each debug
15388 counter @var{name}. The @var{lower_bound} is optional and is zero
15389 initialized if not set.
15390 All debug counters have the initial upper bound of @code{UINT_MAX};
15391 thus @code{dbg_cnt} returns true always unless the upper bound
15392 is set by this option.
15393 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15394 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15395 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15396
15397 @item -print-file-name=@var{library}
15398 @opindex print-file-name
15399 Print the full absolute name of the library file @var{library} that
15400 would be used when linking---and don't do anything else. With this
15401 option, GCC does not compile or link anything; it just prints the
15402 file name.
15403
15404 @item -print-multi-directory
15405 @opindex print-multi-directory
15406 Print the directory name corresponding to the multilib selected by any
15407 other switches present in the command line. This directory is supposed
15408 to exist in @env{GCC_EXEC_PREFIX}.
15409
15410 @item -print-multi-lib
15411 @opindex print-multi-lib
15412 Print the mapping from multilib directory names to compiler switches
15413 that enable them. The directory name is separated from the switches by
15414 @samp{;}, and each switch starts with an @samp{@@} instead of the
15415 @samp{-}, without spaces between multiple switches. This is supposed to
15416 ease shell processing.
15417
15418 @item -print-multi-os-directory
15419 @opindex print-multi-os-directory
15420 Print the path to OS libraries for the selected
15421 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15422 present in the @file{lib} subdirectory and no multilibs are used, this is
15423 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15424 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15425 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15426 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15427
15428 @item -print-multiarch
15429 @opindex print-multiarch
15430 Print the path to OS libraries for the selected multiarch,
15431 relative to some @file{lib} subdirectory.
15432
15433 @item -print-prog-name=@var{program}
15434 @opindex print-prog-name
15435 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15436
15437 @item -print-libgcc-file-name
15438 @opindex print-libgcc-file-name
15439 Same as @option{-print-file-name=libgcc.a}.
15440
15441 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15442 but you do want to link with @file{libgcc.a}. You can do:
15443
15444 @smallexample
15445 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15446 @end smallexample
15447
15448 @item -print-search-dirs
15449 @opindex print-search-dirs
15450 Print the name of the configured installation directory and a list of
15451 program and library directories @command{gcc} searches---and don't do anything else.
15452
15453 This is useful when @command{gcc} prints the error message
15454 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15455 To resolve this you either need to put @file{cpp0} and the other compiler
15456 components where @command{gcc} expects to find them, or you can set the environment
15457 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15458 Don't forget the trailing @samp{/}.
15459 @xref{Environment Variables}.
15460
15461 @item -print-sysroot
15462 @opindex print-sysroot
15463 Print the target sysroot directory that is used during
15464 compilation. This is the target sysroot specified either at configure
15465 time or using the @option{--sysroot} option, possibly with an extra
15466 suffix that depends on compilation options. If no target sysroot is
15467 specified, the option prints nothing.
15468
15469 @item -print-sysroot-headers-suffix
15470 @opindex print-sysroot-headers-suffix
15471 Print the suffix added to the target sysroot when searching for
15472 headers, or give an error if the compiler is not configured with such
15473 a suffix---and don't do anything else.
15474
15475 @item -dumpmachine
15476 @opindex dumpmachine
15477 Print the compiler's target machine (for example,
15478 @samp{i686-pc-linux-gnu})---and don't do anything else.
15479
15480 @item -dumpversion
15481 @opindex dumpversion
15482 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15483 anything else. This is the compiler version used in filesystem paths and
15484 specs. Depending on how the compiler has been configured it can be just
15485 a single number (major version), two numbers separated by a dot (major and
15486 minor version) or three numbers separated by dots (major, minor and patchlevel
15487 version).
15488
15489 @item -dumpfullversion
15490 @opindex dumpfullversion
15491 Print the full compiler version---and don't do anything else. The output is
15492 always three numbers separated by dots, major, minor and patchlevel version.
15493
15494 @item -dumpspecs
15495 @opindex dumpspecs
15496 Print the compiler's built-in specs---and don't do anything else. (This
15497 is used when GCC itself is being built.) @xref{Spec Files}.
15498 @end table
15499
15500 @node Submodel Options
15501 @section Machine-Dependent Options
15502 @cindex submodel options
15503 @cindex specifying hardware config
15504 @cindex hardware models and configurations, specifying
15505 @cindex target-dependent options
15506 @cindex machine-dependent options
15507
15508 Each target machine supported by GCC can have its own options---for
15509 example, to allow you to compile for a particular processor variant or
15510 ABI, or to control optimizations specific to that machine. By
15511 convention, the names of machine-specific options start with
15512 @samp{-m}.
15513
15514 Some configurations of the compiler also support additional target-specific
15515 options, usually for compatibility with other compilers on the same
15516 platform.
15517
15518 @c This list is ordered alphanumerically by subsection name.
15519 @c It should be the same order and spelling as these options are listed
15520 @c in Machine Dependent Options
15521
15522 @menu
15523 * AArch64 Options::
15524 * Adapteva Epiphany Options::
15525 * AMD GCN Options::
15526 * ARC Options::
15527 * ARM Options::
15528 * AVR Options::
15529 * Blackfin Options::
15530 * C6X Options::
15531 * CRIS Options::
15532 * CR16 Options::
15533 * C-SKY Options::
15534 * Darwin Options::
15535 * DEC Alpha Options::
15536 * FR30 Options::
15537 * FT32 Options::
15538 * FRV Options::
15539 * GNU/Linux Options::
15540 * H8/300 Options::
15541 * HPPA Options::
15542 * IA-64 Options::
15543 * LM32 Options::
15544 * M32C Options::
15545 * M32R/D Options::
15546 * M680x0 Options::
15547 * MCore Options::
15548 * MeP Options::
15549 * MicroBlaze Options::
15550 * MIPS Options::
15551 * MMIX Options::
15552 * MN10300 Options::
15553 * Moxie Options::
15554 * MSP430 Options::
15555 * NDS32 Options::
15556 * Nios II Options::
15557 * Nvidia PTX Options::
15558 * OpenRISC Options::
15559 * PDP-11 Options::
15560 * picoChip Options::
15561 * PowerPC Options::
15562 * RISC-V Options::
15563 * RL78 Options::
15564 * RS/6000 and PowerPC Options::
15565 * RX Options::
15566 * S/390 and zSeries Options::
15567 * Score Options::
15568 * SH Options::
15569 * Solaris 2 Options::
15570 * SPARC Options::
15571 * SPU Options::
15572 * System V Options::
15573 * TILE-Gx Options::
15574 * TILEPro Options::
15575 * V850 Options::
15576 * VAX Options::
15577 * Visium Options::
15578 * VMS Options::
15579 * VxWorks Options::
15580 * x86 Options::
15581 * x86 Windows Options::
15582 * Xstormy16 Options::
15583 * Xtensa Options::
15584 * zSeries Options::
15585 @end menu
15586
15587 @node AArch64 Options
15588 @subsection AArch64 Options
15589 @cindex AArch64 Options
15590
15591 These options are defined for AArch64 implementations:
15592
15593 @table @gcctabopt
15594
15595 @item -mabi=@var{name}
15596 @opindex mabi
15597 Generate code for the specified data model. Permissible values
15598 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15599 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15600 but long int and pointers are 64 bits.
15601
15602 The default depends on the specific target configuration. Note that
15603 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15604 entire program with the same ABI, and link with a compatible set of libraries.
15605
15606 @item -mbig-endian
15607 @opindex mbig-endian
15608 Generate big-endian code. This is the default when GCC is configured for an
15609 @samp{aarch64_be-*-*} target.
15610
15611 @item -mgeneral-regs-only
15612 @opindex mgeneral-regs-only
15613 Generate code which uses only the general-purpose registers. This will prevent
15614 the compiler from using floating-point and Advanced SIMD registers but will not
15615 impose any restrictions on the assembler.
15616
15617 @item -mlittle-endian
15618 @opindex mlittle-endian
15619 Generate little-endian code. This is the default when GCC is configured for an
15620 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15621
15622 @item -mcmodel=tiny
15623 @opindex mcmodel=tiny
15624 Generate code for the tiny code model. The program and its statically defined
15625 symbols must be within 1MB of each other. Programs can be statically or
15626 dynamically linked.
15627
15628 @item -mcmodel=small
15629 @opindex mcmodel=small
15630 Generate code for the small code model. The program and its statically defined
15631 symbols must be within 4GB of each other. Programs can be statically or
15632 dynamically linked. This is the default code model.
15633
15634 @item -mcmodel=large
15635 @opindex mcmodel=large
15636 Generate code for the large code model. This makes no assumptions about
15637 addresses and sizes of sections. Programs can be statically linked only.
15638
15639 @item -mstrict-align
15640 @itemx -mno-strict-align
15641 @opindex mstrict-align
15642 @opindex mno-strict-align
15643 Avoid or allow generating memory accesses that may not be aligned on a natural
15644 object boundary as described in the architecture specification.
15645
15646 @item -momit-leaf-frame-pointer
15647 @itemx -mno-omit-leaf-frame-pointer
15648 @opindex momit-leaf-frame-pointer
15649 @opindex mno-omit-leaf-frame-pointer
15650 Omit or keep the frame pointer in leaf functions. The former behavior is the
15651 default.
15652
15653 @item -mstack-protector-guard=@var{guard}
15654 @itemx -mstack-protector-guard-reg=@var{reg}
15655 @itemx -mstack-protector-guard-offset=@var{offset}
15656 @opindex mstack-protector-guard
15657 @opindex mstack-protector-guard-reg
15658 @opindex mstack-protector-guard-offset
15659 Generate stack protection code using canary at @var{guard}. Supported
15660 locations are @samp{global} for a global canary or @samp{sysreg} for a
15661 canary in an appropriate system register.
15662
15663 With the latter choice the options
15664 @option{-mstack-protector-guard-reg=@var{reg}} and
15665 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15666 which system register to use as base register for reading the canary,
15667 and from what offset from that base register. There is no default
15668 register or offset as this is entirely for use within the Linux
15669 kernel.
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 -mtls-dialect=desc
15690 @opindex mtls-dialect=desc
15691 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15692 of TLS variables. This is the default.
15693
15694 @item -mtls-dialect=traditional
15695 @opindex mtls-dialect=traditional
15696 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15697 of TLS variables.
15698
15699 @item -mtls-size=@var{size}
15700 @opindex mtls-size
15701 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15702 This option requires binutils 2.26 or newer.
15703
15704 @item -mfix-cortex-a53-835769
15705 @itemx -mno-fix-cortex-a53-835769
15706 @opindex mfix-cortex-a53-835769
15707 @opindex mno-fix-cortex-a53-835769
15708 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15709 This involves inserting a NOP instruction between memory instructions and
15710 64-bit integer multiply-accumulate instructions.
15711
15712 @item -mfix-cortex-a53-843419
15713 @itemx -mno-fix-cortex-a53-843419
15714 @opindex mfix-cortex-a53-843419
15715 @opindex mno-fix-cortex-a53-843419
15716 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15717 This erratum workaround is made at link time and this will only pass the
15718 corresponding flag to the linker.
15719
15720 @item -mlow-precision-recip-sqrt
15721 @itemx -mno-low-precision-recip-sqrt
15722 @opindex mlow-precision-recip-sqrt
15723 @opindex mno-low-precision-recip-sqrt
15724 Enable or disable the reciprocal square root approximation.
15725 This option only has an effect if @option{-ffast-math} or
15726 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15727 precision of reciprocal square root results to about 16 bits for
15728 single precision and to 32 bits for double precision.
15729
15730 @item -mlow-precision-sqrt
15731 @itemx -mno-low-precision-sqrt
15732 @opindex mlow-precision-sqrt
15733 @opindex mno-low-precision-sqrt
15734 Enable or disable the square root approximation.
15735 This option only has an effect if @option{-ffast-math} or
15736 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15737 precision of square root results to about 16 bits for
15738 single precision and to 32 bits for double precision.
15739 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15740
15741 @item -mlow-precision-div
15742 @itemx -mno-low-precision-div
15743 @opindex mlow-precision-div
15744 @opindex mno-low-precision-div
15745 Enable or disable the division approximation.
15746 This option only has an effect if @option{-ffast-math} or
15747 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15748 precision of division results to about 16 bits for
15749 single precision and to 32 bits for double precision.
15750
15751 @item -mtrack-speculation
15752 @itemx -mno-track-speculation
15753 Enable or disable generation of additional code to track speculative
15754 execution through conditional branches. The tracking state can then
15755 be used by the compiler when expanding calls to
15756 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15757 sequence to be generated.
15758
15759 @item -march=@var{name}
15760 @opindex march
15761 Specify the name of the target architecture and, optionally, one or
15762 more feature modifiers. This option has the form
15763 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15764
15765 The permissible values for @var{arch} are @samp{armv8-a},
15766 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15767 @samp{armv8.5-a} or @var{native}.
15768
15769 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15770 support for the ARMv8.5-A architecture extensions.
15771
15772 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15773 support for the ARMv8.4-A architecture extensions.
15774
15775 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15776 support for the ARMv8.3-A architecture extensions.
15777
15778 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15779 support for the ARMv8.2-A architecture extensions.
15780
15781 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15782 support for the ARMv8.1-A architecture extension. In particular, it
15783 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15784
15785 The value @samp{native} is available on native AArch64 GNU/Linux and
15786 causes the compiler to pick the architecture of the host system. This
15787 option has no effect if the compiler is unable to recognize the
15788 architecture of the host system,
15789
15790 The permissible values for @var{feature} are listed in the sub-section
15791 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15792 Feature Modifiers}. Where conflicting feature modifiers are
15793 specified, the right-most feature is used.
15794
15795 GCC uses @var{name} to determine what kind of instructions it can emit
15796 when generating assembly code. If @option{-march} is specified
15797 without either of @option{-mtune} or @option{-mcpu} also being
15798 specified, the code is tuned to perform well across a range of target
15799 processors implementing the target architecture.
15800
15801 @item -mtune=@var{name}
15802 @opindex mtune
15803 Specify the name of the target processor for which GCC should tune the
15804 performance of the code. Permissible values for this option are:
15805 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15806 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15807 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15808 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15809 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15810 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15811 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15812 @samp{thunderxt83}, @samp{thunderx2t99},
15813 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15814 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15815 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15816 @samp{native}.
15817
15818 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15819 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15820 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15821 should tune for a big.LITTLE system.
15822
15823 Additionally on native AArch64 GNU/Linux systems the value
15824 @samp{native} tunes performance to the host system. This option has no effect
15825 if the compiler is unable to recognize the processor of the host system.
15826
15827 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15828 are specified, the code is tuned to perform well across a range
15829 of target processors.
15830
15831 This option cannot be suffixed by feature modifiers.
15832
15833 @item -mcpu=@var{name}
15834 @opindex mcpu
15835 Specify the name of the target processor, optionally suffixed by one
15836 or more feature modifiers. This option has the form
15837 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15838 the permissible values for @var{cpu} are the same as those available
15839 for @option{-mtune}. The permissible values for @var{feature} are
15840 documented in the sub-section on
15841 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15842 Feature Modifiers}. Where conflicting feature modifiers are
15843 specified, the right-most feature is used.
15844
15845 GCC uses @var{name} to determine what kind of instructions it can emit when
15846 generating assembly code (as if by @option{-march}) and to determine
15847 the target processor for which to tune for performance (as if
15848 by @option{-mtune}). Where this option is used in conjunction
15849 with @option{-march} or @option{-mtune}, those options take precedence
15850 over the appropriate part of this option.
15851
15852 @item -moverride=@var{string}
15853 @opindex moverride
15854 Override tuning decisions made by the back-end in response to a
15855 @option{-mtune=} switch. The syntax, semantics, and accepted values
15856 for @var{string} in this option are not guaranteed to be consistent
15857 across releases.
15858
15859 This option is only intended to be useful when developing GCC.
15860
15861 @item -mverbose-cost-dump
15862 @opindex mverbose-cost-dump
15863 Enable verbose cost model dumping in the debug dump files. This option is
15864 provided for use in debugging the compiler.
15865
15866 @item -mpc-relative-literal-loads
15867 @itemx -mno-pc-relative-literal-loads
15868 @opindex mpc-relative-literal-loads
15869 @opindex mno-pc-relative-literal-loads
15870 Enable or disable PC-relative literal loads. With this option literal pools are
15871 accessed using a single instruction and emitted after each function. This
15872 limits the maximum size of functions to 1MB. This is enabled by default for
15873 @option{-mcmodel=tiny}.
15874
15875 @item -msign-return-address=@var{scope}
15876 @opindex msign-return-address
15877 Select the function scope on which return address signing will be applied.
15878 Permissible values are @samp{none}, which disables return address signing,
15879 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15880 functions, and @samp{all}, which enables pointer signing for all functions. The
15881 default value is @samp{none}. This option has been deprecated by
15882 -mbranch-protection.
15883
15884 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]|@var{bti}
15885 @opindex mbranch-protection
15886 Select the branch protection features to use.
15887 @samp{none} is the default and turns off all types of branch protection.
15888 @samp{standard} turns on all types of branch protection features. If a feature
15889 has additional tuning options, then @samp{standard} sets it to its standard
15890 level.
15891 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15892 level: signing functions that save the return address to memory (non-leaf
15893 functions will practically always do this) using the a-key. The optional
15894 argument @samp{leaf} can be used to extend the signing to include leaf
15895 functions.
15896 @samp{bti} turns on branch target identification mechanism.
15897
15898 @item -msve-vector-bits=@var{bits}
15899 @opindex msve-vector-bits
15900 Specify the number of bits in an SVE vector register. This option only has
15901 an effect when SVE is enabled.
15902
15903 GCC supports two forms of SVE code generation: ``vector-length
15904 agnostic'' output that works with any size of vector register and
15905 ``vector-length specific'' output that allows GCC to make assumptions
15906 about the vector length when it is useful for optimization reasons.
15907 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15908 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15909 Specifying @samp{scalable} selects vector-length agnostic
15910 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15911 agnostic output. All other values generate vector-length specific code.
15912 The behavior of these values may change in future releases and no value except
15913 @samp{scalable} should be relied on for producing code that is portable across
15914 different hardware SVE vector lengths.
15915
15916 The default is @samp{-msve-vector-bits=scalable}, which produces
15917 vector-length agnostic code.
15918 @end table
15919
15920 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15921 @anchor{aarch64-feature-modifiers}
15922 @cindex @option{-march} feature modifiers
15923 @cindex @option{-mcpu} feature modifiers
15924 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15925 the following and their inverses @option{no@var{feature}}:
15926
15927 @table @samp
15928 @item crc
15929 Enable CRC extension. This is on by default for
15930 @option{-march=armv8.1-a}.
15931 @item crypto
15932 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15933 instructions.
15934 @item fp
15935 Enable floating-point instructions. This is on by default for all possible
15936 values for options @option{-march} and @option{-mcpu}.
15937 @item simd
15938 Enable Advanced SIMD instructions. This also enables floating-point
15939 instructions. This is on by default for all possible values for options
15940 @option{-march} and @option{-mcpu}.
15941 @item sve
15942 Enable Scalable Vector Extension instructions. This also enables Advanced
15943 SIMD and floating-point instructions.
15944 @item lse
15945 Enable Large System Extension instructions. This is on by default for
15946 @option{-march=armv8.1-a}.
15947 @item rdma
15948 Enable Round Double Multiply Accumulate instructions. This is on by default
15949 for @option{-march=armv8.1-a}.
15950 @item fp16
15951 Enable FP16 extension. This also enables floating-point instructions.
15952 @item fp16fml
15953 Enable FP16 fmla extension. This also enables FP16 extensions and
15954 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.
15955
15956 @item rcpc
15957 Enable the RcPc extension. This does not change code generation from GCC,
15958 but is passed on to the assembler, enabling inline asm statements to use
15959 instructions from the RcPc extension.
15960 @item dotprod
15961 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15962 @item aes
15963 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15964 SIMD instructions.
15965 @item sha2
15966 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15967 @item sha3
15968 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15969 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15970 @item sm4
15971 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15972 Use of this option with architectures prior to Armv8.2-A is not supported.
15973 @item profile
15974 Enable the Statistical Profiling extension. This option is only to enable the
15975 extension at the assembler level and does not affect code generation.
15976 @item rng
15977 Enable the Armv8.5-a Random Number instructions. This option is only to
15978 enable the extension at the assembler level and does not affect code
15979 generation.
15980 @item memtag
15981 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
15982 enable the extension at the assembler level and does not affect code
15983 generation.
15984 @item sb
15985 Enable the Armv8-a Speculation Barrier instruction. This option is only to
15986 enable the extension at the assembler level and does not affect code
15987 generation. This option is enabled by default for @option{-march=armv8.5-a}.
15988 @item ssbs
15989 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
15990 is only to enable the extension at the assembler level and does not affect code
15991 generation. This option is enabled by default for @option{-march=armv8.5-a}.
15992 @item predres
15993 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
15994 This option is only to enable the extension at the assembler level and does
15995 not affect code generation. This option is enabled by default for
15996 @option{-march=armv8.5-a}.
15997
15998 @end table
15999
16000 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16001 which implies @option{fp}.
16002 Conversely, @option{nofp} implies @option{nosimd}, which implies
16003 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16004
16005 @node Adapteva Epiphany Options
16006 @subsection Adapteva Epiphany Options
16007
16008 These @samp{-m} options are defined for Adapteva Epiphany:
16009
16010 @table @gcctabopt
16011 @item -mhalf-reg-file
16012 @opindex mhalf-reg-file
16013 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16014 That allows code to run on hardware variants that lack these registers.
16015
16016 @item -mprefer-short-insn-regs
16017 @opindex mprefer-short-insn-regs
16018 Preferentially allocate registers that allow short instruction generation.
16019 This can result in increased instruction count, so this may either reduce or
16020 increase overall code size.
16021
16022 @item -mbranch-cost=@var{num}
16023 @opindex mbranch-cost
16024 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16025 This cost is only a heuristic and is not guaranteed to produce
16026 consistent results across releases.
16027
16028 @item -mcmove
16029 @opindex mcmove
16030 Enable the generation of conditional moves.
16031
16032 @item -mnops=@var{num}
16033 @opindex mnops
16034 Emit @var{num} NOPs before every other generated instruction.
16035
16036 @item -mno-soft-cmpsf
16037 @opindex mno-soft-cmpsf
16038 @opindex msoft-cmpsf
16039 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16040 and test the flags. This is faster than a software comparison, but can
16041 get incorrect results in the presence of NaNs, or when two different small
16042 numbers are compared such that their difference is calculated as zero.
16043 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16044 software comparisons.
16045
16046 @item -mstack-offset=@var{num}
16047 @opindex mstack-offset
16048 Set the offset between the top of the stack and the stack pointer.
16049 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16050 can be used by leaf functions without stack allocation.
16051 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16052 Note also that this option changes the ABI; compiling a program with a
16053 different stack offset than the libraries have been compiled with
16054 generally does not work.
16055 This option can be useful if you want to evaluate if a different stack
16056 offset would give you better code, but to actually use a different stack
16057 offset to build working programs, it is recommended to configure the
16058 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16059
16060 @item -mno-round-nearest
16061 @opindex mno-round-nearest
16062 @opindex mround-nearest
16063 Make the scheduler assume that the rounding mode has been set to
16064 truncating. The default is @option{-mround-nearest}.
16065
16066 @item -mlong-calls
16067 @opindex mlong-calls
16068 If not otherwise specified by an attribute, assume all calls might be beyond
16069 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16070 function address into a register before performing a (otherwise direct) call.
16071 This is the default.
16072
16073 @item -mshort-calls
16074 @opindex short-calls
16075 If not otherwise specified by an attribute, assume all direct calls are
16076 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16077 for direct calls. The default is @option{-mlong-calls}.
16078
16079 @item -msmall16
16080 @opindex msmall16
16081 Assume addresses can be loaded as 16-bit unsigned values. This does not
16082 apply to function addresses for which @option{-mlong-calls} semantics
16083 are in effect.
16084
16085 @item -mfp-mode=@var{mode}
16086 @opindex mfp-mode
16087 Set the prevailing mode of the floating-point unit.
16088 This determines the floating-point mode that is provided and expected
16089 at function call and return time. Making this mode match the mode you
16090 predominantly need at function start can make your programs smaller and
16091 faster by avoiding unnecessary mode switches.
16092
16093 @var{mode} can be set to one the following values:
16094
16095 @table @samp
16096 @item caller
16097 Any mode at function entry is valid, and retained or restored when
16098 the function returns, and when it calls other functions.
16099 This mode is useful for compiling libraries or other compilation units
16100 you might want to incorporate into different programs with different
16101 prevailing FPU modes, and the convenience of being able to use a single
16102 object file outweighs the size and speed overhead for any extra
16103 mode switching that might be needed, compared with what would be needed
16104 with a more specific choice of prevailing FPU mode.
16105
16106 @item truncate
16107 This is the mode used for floating-point calculations with
16108 truncating (i.e.@: round towards zero) rounding mode. That includes
16109 conversion from floating point to integer.
16110
16111 @item round-nearest
16112 This is the mode used for floating-point calculations with
16113 round-to-nearest-or-even rounding mode.
16114
16115 @item int
16116 This is the mode used to perform integer calculations in the FPU, e.g.@:
16117 integer multiply, or integer multiply-and-accumulate.
16118 @end table
16119
16120 The default is @option{-mfp-mode=caller}
16121
16122 @item -mno-split-lohi
16123 @itemx -mno-postinc
16124 @itemx -mno-postmodify
16125 @opindex mno-split-lohi
16126 @opindex msplit-lohi
16127 @opindex mno-postinc
16128 @opindex mpostinc
16129 @opindex mno-postmodify
16130 @opindex mpostmodify
16131 Code generation tweaks that disable, respectively, splitting of 32-bit
16132 loads, generation of post-increment addresses, and generation of
16133 post-modify addresses. The defaults are @option{msplit-lohi},
16134 @option{-mpost-inc}, and @option{-mpost-modify}.
16135
16136 @item -mnovect-double
16137 @opindex mno-vect-double
16138 @opindex mvect-double
16139 Change the preferred SIMD mode to SImode. The default is
16140 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16141
16142 @item -max-vect-align=@var{num}
16143 @opindex max-vect-align
16144 The maximum alignment for SIMD vector mode types.
16145 @var{num} may be 4 or 8. The default is 8.
16146 Note that this is an ABI change, even though many library function
16147 interfaces are unaffected if they don't use SIMD vector modes
16148 in places that affect size and/or alignment of relevant types.
16149
16150 @item -msplit-vecmove-early
16151 @opindex msplit-vecmove-early
16152 Split vector moves into single word moves before reload. In theory this
16153 can give better register allocation, but so far the reverse seems to be
16154 generally the case.
16155
16156 @item -m1reg-@var{reg}
16157 @opindex m1reg-
16158 Specify a register to hold the constant @minus{}1, which makes loading small negative
16159 constants and certain bitmasks faster.
16160 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16161 which specify use of that register as a fixed register,
16162 and @samp{none}, which means that no register is used for this
16163 purpose. The default is @option{-m1reg-none}.
16164
16165 @end table
16166
16167 @node AMD GCN Options
16168 @subsection AMD GCN Options
16169 @cindex AMD GCN Options
16170
16171 These options are defined specifically for the AMD GCN port.
16172
16173 @table @gcctabopt
16174
16175 @item -march=@var{gpu}
16176 @opindex march
16177 @itemx -mtune=@var{gpu}
16178 @opindex mtune
16179 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16180 are
16181
16182 @table @samp
16183 @opindex fiji
16184 @item fiji
16185 Compile for GCN3 Fiji devices (gfx803).
16186
16187 @item gfx900
16188 Compile for GCN5 Vega 10 devices (gfx900).
16189
16190 @end table
16191
16192 @item -mstack-size=@var{bytes}
16193 @opindex mstack-size
16194 Specify how many @var{bytes} of stack space will be requested for each GPU
16195 thread (wave-front). Beware that there may be many threads and limited memory
16196 available. The size of the stack allocation may also have an impact on
16197 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16198 1MB otherwise.
16199
16200 @end table
16201
16202 @node ARC Options
16203 @subsection ARC Options
16204 @cindex ARC options
16205
16206 The following options control the architecture variant for which code
16207 is being compiled:
16208
16209 @c architecture variants
16210 @table @gcctabopt
16211
16212 @item -mbarrel-shifter
16213 @opindex mbarrel-shifter
16214 Generate instructions supported by barrel shifter. This is the default
16215 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16216
16217 @item -mjli-always
16218 @opindex mjli-alawys
16219 Force to call a function using jli_s instruction. This option is
16220 valid only for ARCv2 architecture.
16221
16222 @item -mcpu=@var{cpu}
16223 @opindex mcpu
16224 Set architecture type, register usage, and instruction scheduling
16225 parameters for @var{cpu}. There are also shortcut alias options
16226 available for backward compatibility and convenience. Supported
16227 values for @var{cpu} are
16228
16229 @table @samp
16230 @opindex mA6
16231 @opindex mARC600
16232 @item arc600
16233 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16234
16235 @item arc601
16236 @opindex mARC601
16237 Compile for ARC601. Alias: @option{-mARC601}.
16238
16239 @item arc700
16240 @opindex mA7
16241 @opindex mARC700
16242 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16243 This is the default when configured with @option{--with-cpu=arc700}@.
16244
16245 @item arcem
16246 Compile for ARC EM.
16247
16248 @item archs
16249 Compile for ARC HS.
16250
16251 @item em
16252 Compile for ARC EM CPU with no hardware extensions.
16253
16254 @item em4
16255 Compile for ARC EM4 CPU.
16256
16257 @item em4_dmips
16258 Compile for ARC EM4 DMIPS CPU.
16259
16260 @item em4_fpus
16261 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16262 extension.
16263
16264 @item em4_fpuda
16265 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16266 double assist instructions.
16267
16268 @item hs
16269 Compile for ARC HS CPU with no hardware extensions except the atomic
16270 instructions.
16271
16272 @item hs34
16273 Compile for ARC HS34 CPU.
16274
16275 @item hs38
16276 Compile for ARC HS38 CPU.
16277
16278 @item hs38_linux
16279 Compile for ARC HS38 CPU with all hardware extensions on.
16280
16281 @item arc600_norm
16282 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16283
16284 @item arc600_mul32x16
16285 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16286 instructions enabled.
16287
16288 @item arc600_mul64
16289 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16290 instructions enabled.
16291
16292 @item arc601_norm
16293 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16294
16295 @item arc601_mul32x16
16296 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16297 instructions enabled.
16298
16299 @item arc601_mul64
16300 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16301 instructions enabled.
16302
16303 @item nps400
16304 Compile for ARC 700 on NPS400 chip.
16305
16306 @item em_mini
16307 Compile for ARC EM minimalist configuration featuring reduced register
16308 set.
16309
16310 @end table
16311
16312 @item -mdpfp
16313 @opindex mdpfp
16314 @itemx -mdpfp-compact
16315 @opindex mdpfp-compact
16316 Generate double-precision FPX instructions, tuned for the compact
16317 implementation.
16318
16319 @item -mdpfp-fast
16320 @opindex mdpfp-fast
16321 Generate double-precision FPX instructions, tuned for the fast
16322 implementation.
16323
16324 @item -mno-dpfp-lrsr
16325 @opindex mno-dpfp-lrsr
16326 Disable @code{lr} and @code{sr} instructions from using FPX extension
16327 aux registers.
16328
16329 @item -mea
16330 @opindex mea
16331 Generate extended arithmetic instructions. Currently only
16332 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16333 supported. This is always enabled for @option{-mcpu=ARC700}.
16334
16335 @item -mno-mpy
16336 @opindex mno-mpy
16337 @opindex mmpy
16338 Do not generate @code{mpy}-family instructions for ARC700. This option is
16339 deprecated.
16340
16341 @item -mmul32x16
16342 @opindex mmul32x16
16343 Generate 32x16-bit multiply and multiply-accumulate instructions.
16344
16345 @item -mmul64
16346 @opindex mmul64
16347 Generate @code{mul64} and @code{mulu64} instructions.
16348 Only valid for @option{-mcpu=ARC600}.
16349
16350 @item -mnorm
16351 @opindex mnorm
16352 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16353 is in effect.
16354
16355 @item -mspfp
16356 @opindex mspfp
16357 @itemx -mspfp-compact
16358 @opindex mspfp-compact
16359 Generate single-precision FPX instructions, tuned for the compact
16360 implementation.
16361
16362 @item -mspfp-fast
16363 @opindex mspfp-fast
16364 Generate single-precision FPX instructions, tuned for the fast
16365 implementation.
16366
16367 @item -msimd
16368 @opindex msimd
16369 Enable generation of ARC SIMD instructions via target-specific
16370 builtins. Only valid for @option{-mcpu=ARC700}.
16371
16372 @item -msoft-float
16373 @opindex msoft-float
16374 This option ignored; it is provided for compatibility purposes only.
16375 Software floating-point code is emitted by default, and this default
16376 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16377 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16378 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16379
16380 @item -mswap
16381 @opindex mswap
16382 Generate @code{swap} instructions.
16383
16384 @item -matomic
16385 @opindex matomic
16386 This enables use of the locked load/store conditional extension to implement
16387 atomic memory built-in functions. Not available for ARC 6xx or ARC
16388 EM cores.
16389
16390 @item -mdiv-rem
16391 @opindex mdiv-rem
16392 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16393
16394 @item -mcode-density
16395 @opindex mcode-density
16396 Enable code density instructions for ARC EM.
16397 This option is on by default for ARC HS.
16398
16399 @item -mll64
16400 @opindex mll64
16401 Enable double load/store operations for ARC HS cores.
16402
16403 @item -mtp-regno=@var{regno}
16404 @opindex mtp-regno
16405 Specify thread pointer register number.
16406
16407 @item -mmpy-option=@var{multo}
16408 @opindex mmpy-option
16409 Compile ARCv2 code with a multiplier design option. You can specify
16410 the option using either a string or numeric value for @var{multo}.
16411 @samp{wlh1} is the default value. The recognized values are:
16412
16413 @table @samp
16414 @item 0
16415 @itemx none
16416 No multiplier available.
16417
16418 @item 1
16419 @itemx w
16420 16x16 multiplier, fully pipelined.
16421 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16422
16423 @item 2
16424 @itemx wlh1
16425 32x32 multiplier, fully
16426 pipelined (1 stage). The following instructions are additionally
16427 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16428
16429 @item 3
16430 @itemx wlh2
16431 32x32 multiplier, fully pipelined
16432 (2 stages). The following instructions are additionally enabled: @code{mpy},
16433 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16434
16435 @item 4
16436 @itemx wlh3
16437 Two 16x16 multipliers, blocking,
16438 sequential. The following instructions are additionally enabled: @code{mpy},
16439 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16440
16441 @item 5
16442 @itemx wlh4
16443 One 16x16 multiplier, blocking,
16444 sequential. The following instructions are additionally enabled: @code{mpy},
16445 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16446
16447 @item 6
16448 @itemx wlh5
16449 One 32x4 multiplier, blocking,
16450 sequential. The following instructions are additionally enabled: @code{mpy},
16451 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16452
16453 @item 7
16454 @itemx plus_dmpy
16455 ARC HS SIMD support.
16456
16457 @item 8
16458 @itemx plus_macd
16459 ARC HS SIMD support.
16460
16461 @item 9
16462 @itemx plus_qmacw
16463 ARC HS SIMD support.
16464
16465 @end table
16466
16467 This option is only available for ARCv2 cores@.
16468
16469 @item -mfpu=@var{fpu}
16470 @opindex mfpu
16471 Enables support for specific floating-point hardware extensions for ARCv2
16472 cores. Supported values for @var{fpu} are:
16473
16474 @table @samp
16475
16476 @item fpus
16477 Enables support for single-precision floating-point hardware
16478 extensions@.
16479
16480 @item fpud
16481 Enables support for double-precision floating-point hardware
16482 extensions. The single-precision floating-point extension is also
16483 enabled. Not available for ARC EM@.
16484
16485 @item fpuda
16486 Enables support for double-precision floating-point hardware
16487 extensions using double-precision assist instructions. The single-precision
16488 floating-point extension is also enabled. This option is
16489 only available for ARC EM@.
16490
16491 @item fpuda_div
16492 Enables support for double-precision floating-point hardware
16493 extensions using double-precision assist instructions.
16494 The single-precision floating-point, square-root, and divide
16495 extensions are also enabled. This option is
16496 only available for ARC EM@.
16497
16498 @item fpuda_fma
16499 Enables support for double-precision floating-point hardware
16500 extensions using double-precision assist instructions.
16501 The single-precision floating-point and fused multiply and add
16502 hardware extensions are also enabled. This option is
16503 only available for ARC EM@.
16504
16505 @item fpuda_all
16506 Enables support for double-precision floating-point hardware
16507 extensions using double-precision assist instructions.
16508 All single-precision floating-point hardware extensions are also
16509 enabled. This option is only available for ARC EM@.
16510
16511 @item fpus_div
16512 Enables support for single-precision floating-point, square-root and divide
16513 hardware extensions@.
16514
16515 @item fpud_div
16516 Enables support for double-precision floating-point, square-root and divide
16517 hardware extensions. This option
16518 includes option @samp{fpus_div}. Not available for ARC EM@.
16519
16520 @item fpus_fma
16521 Enables support for single-precision floating-point and
16522 fused multiply and add hardware extensions@.
16523
16524 @item fpud_fma
16525 Enables support for double-precision floating-point and
16526 fused multiply and add hardware extensions. This option
16527 includes option @samp{fpus_fma}. Not available for ARC EM@.
16528
16529 @item fpus_all
16530 Enables support for all single-precision floating-point hardware
16531 extensions@.
16532
16533 @item fpud_all
16534 Enables support for all single- and double-precision floating-point
16535 hardware extensions. Not available for ARC EM@.
16536
16537 @end table
16538
16539 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16540 @opindex mirq-ctrl-saved
16541 Specifies general-purposes registers that the processor automatically
16542 saves/restores on interrupt entry and exit. @var{register-range} is
16543 specified as two registers separated by a dash. The register range
16544 always starts with @code{r0}, the upper limit is @code{fp} register.
16545 @var{blink} and @var{lp_count} are optional. This option is only
16546 valid for ARC EM and ARC HS cores.
16547
16548 @item -mrgf-banked-regs=@var{number}
16549 @opindex mrgf-banked-regs
16550 Specifies the number of registers replicated in second register bank
16551 on entry to fast interrupt. Fast interrupts are interrupts with the
16552 highest priority level P0. These interrupts save only PC and STATUS32
16553 registers to avoid memory transactions during interrupt entry and exit
16554 sequences. Use this option when you are using fast interrupts in an
16555 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16556
16557 @item -mlpc-width=@var{width}
16558 @opindex mlpc-width
16559 Specify the width of the @code{lp_count} register. Valid values for
16560 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16561 fixed to 32 bits. If the width is less than 32, the compiler does not
16562 attempt to transform loops in your program to use the zero-delay loop
16563 mechanism unless it is known that the @code{lp_count} register can
16564 hold the required loop-counter value. Depending on the width
16565 specified, the compiler and run-time library might continue to use the
16566 loop mechanism for various needs. This option defines macro
16567 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16568
16569 @item -mrf16
16570 @opindex mrf16
16571 This option instructs the compiler to generate code for a 16-entry
16572 register file. This option defines the @code{__ARC_RF16__}
16573 preprocessor macro.
16574
16575 @item -mbranch-index
16576 @opindex mbranch-index
16577 Enable use of @code{bi} or @code{bih} instructions to implement jump
16578 tables.
16579
16580 @end table
16581
16582 The following options are passed through to the assembler, and also
16583 define preprocessor macro symbols.
16584
16585 @c Flags used by the assembler, but for which we define preprocessor
16586 @c macro symbols as well.
16587 @table @gcctabopt
16588 @item -mdsp-packa
16589 @opindex mdsp-packa
16590 Passed down to the assembler to enable the DSP Pack A extensions.
16591 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16592 deprecated.
16593
16594 @item -mdvbf
16595 @opindex mdvbf
16596 Passed down to the assembler to enable the dual Viterbi butterfly
16597 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16598 option is deprecated.
16599
16600 @c ARC700 4.10 extension instruction
16601 @item -mlock
16602 @opindex mlock
16603 Passed down to the assembler to enable the locked load/store
16604 conditional extension. Also sets the preprocessor symbol
16605 @code{__Xlock}.
16606
16607 @item -mmac-d16
16608 @opindex mmac-d16
16609 Passed down to the assembler. Also sets the preprocessor symbol
16610 @code{__Xxmac_d16}. This option is deprecated.
16611
16612 @item -mmac-24
16613 @opindex mmac-24
16614 Passed down to the assembler. Also sets the preprocessor symbol
16615 @code{__Xxmac_24}. This option is deprecated.
16616
16617 @c ARC700 4.10 extension instruction
16618 @item -mrtsc
16619 @opindex mrtsc
16620 Passed down to the assembler to enable the 64-bit time-stamp counter
16621 extension instruction. Also sets the preprocessor symbol
16622 @code{__Xrtsc}. This option is deprecated.
16623
16624 @c ARC700 4.10 extension instruction
16625 @item -mswape
16626 @opindex mswape
16627 Passed down to the assembler to enable the swap byte ordering
16628 extension instruction. Also sets the preprocessor symbol
16629 @code{__Xswape}.
16630
16631 @item -mtelephony
16632 @opindex mtelephony
16633 Passed down to the assembler to enable dual- and single-operand
16634 instructions for telephony. Also sets the preprocessor symbol
16635 @code{__Xtelephony}. This option is deprecated.
16636
16637 @item -mxy
16638 @opindex mxy
16639 Passed down to the assembler to enable the XY memory extension. Also
16640 sets the preprocessor symbol @code{__Xxy}.
16641
16642 @end table
16643
16644 The following options control how the assembly code is annotated:
16645
16646 @c Assembly annotation options
16647 @table @gcctabopt
16648 @item -misize
16649 @opindex misize
16650 Annotate assembler instructions with estimated addresses.
16651
16652 @item -mannotate-align
16653 @opindex mannotate-align
16654 Explain what alignment considerations lead to the decision to make an
16655 instruction short or long.
16656
16657 @end table
16658
16659 The following options are passed through to the linker:
16660
16661 @c options passed through to the linker
16662 @table @gcctabopt
16663 @item -marclinux
16664 @opindex marclinux
16665 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16666 This option is enabled by default in tool chains built for
16667 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16668 when profiling is not requested.
16669
16670 @item -marclinux_prof
16671 @opindex marclinux_prof
16672 Passed through to the linker, to specify use of the
16673 @code{arclinux_prof} emulation. This option is enabled by default in
16674 tool chains built for @w{@code{arc-linux-uclibc}} and
16675 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16676
16677 @end table
16678
16679 The following options control the semantics of generated code:
16680
16681 @c semantically relevant code generation options
16682 @table @gcctabopt
16683 @item -mlong-calls
16684 @opindex mlong-calls
16685 Generate calls as register indirect calls, thus providing access
16686 to the full 32-bit address range.
16687
16688 @item -mmedium-calls
16689 @opindex mmedium-calls
16690 Don't use less than 25-bit addressing range for calls, which is the
16691 offset available for an unconditional branch-and-link
16692 instruction. Conditional execution of function calls is suppressed, to
16693 allow use of the 25-bit range, rather than the 21-bit range with
16694 conditional branch-and-link. This is the default for tool chains built
16695 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16696
16697 @item -G @var{num}
16698 @opindex G
16699 Put definitions of externally-visible data in a small data section if
16700 that data is no bigger than @var{num} bytes. The default value of
16701 @var{num} is 4 for any ARC configuration, or 8 when we have double
16702 load/store operations.
16703
16704 @item -mno-sdata
16705 @opindex mno-sdata
16706 @opindex msdata
16707 Do not generate sdata references. This is the default for tool chains
16708 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16709 targets.
16710
16711 @item -mvolatile-cache
16712 @opindex mvolatile-cache
16713 Use ordinarily cached memory accesses for volatile references. This is the
16714 default.
16715
16716 @item -mno-volatile-cache
16717 @opindex mno-volatile-cache
16718 @opindex mvolatile-cache
16719 Enable cache bypass for volatile references.
16720
16721 @end table
16722
16723 The following options fine tune code generation:
16724 @c code generation tuning options
16725 @table @gcctabopt
16726 @item -malign-call
16727 @opindex malign-call
16728 Do alignment optimizations for call instructions.
16729
16730 @item -mauto-modify-reg
16731 @opindex mauto-modify-reg
16732 Enable the use of pre/post modify with register displacement.
16733
16734 @item -mbbit-peephole
16735 @opindex mbbit-peephole
16736 Enable bbit peephole2.
16737
16738 @item -mno-brcc
16739 @opindex mno-brcc
16740 This option disables a target-specific pass in @file{arc_reorg} to
16741 generate compare-and-branch (@code{br@var{cc}}) instructions.
16742 It has no effect on
16743 generation of these instructions driven by the combiner pass.
16744
16745 @item -mcase-vector-pcrel
16746 @opindex mcase-vector-pcrel
16747 Use PC-relative switch case tables to enable case table shortening.
16748 This is the default for @option{-Os}.
16749
16750 @item -mcompact-casesi
16751 @opindex mcompact-casesi
16752 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16753 and only available for ARCv1 cores. This option is deprecated.
16754
16755 @item -mno-cond-exec
16756 @opindex mno-cond-exec
16757 Disable the ARCompact-specific pass to generate conditional
16758 execution instructions.
16759
16760 Due to delay slot scheduling and interactions between operand numbers,
16761 literal sizes, instruction lengths, and the support for conditional execution,
16762 the target-independent pass to generate conditional execution is often lacking,
16763 so the ARC port has kept a special pass around that tries to find more
16764 conditional execution generation opportunities after register allocation,
16765 branch shortening, and delay slot scheduling have been done. This pass
16766 generally, but not always, improves performance and code size, at the cost of
16767 extra compilation time, which is why there is an option to switch it off.
16768 If you have a problem with call instructions exceeding their allowable
16769 offset range because they are conditionalized, you should consider using
16770 @option{-mmedium-calls} instead.
16771
16772 @item -mearly-cbranchsi
16773 @opindex mearly-cbranchsi
16774 Enable pre-reload use of the @code{cbranchsi} pattern.
16775
16776 @item -mexpand-adddi
16777 @opindex mexpand-adddi
16778 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16779 @code{add.f}, @code{adc} etc. This option is deprecated.
16780
16781 @item -mindexed-loads
16782 @opindex mindexed-loads
16783 Enable the use of indexed loads. This can be problematic because some
16784 optimizers then assume that indexed stores exist, which is not
16785 the case.
16786
16787 @item -mlra
16788 @opindex mlra
16789 Enable Local Register Allocation. This is still experimental for ARC,
16790 so by default the compiler uses standard reload
16791 (i.e.@: @option{-mno-lra}).
16792
16793 @item -mlra-priority-none
16794 @opindex mlra-priority-none
16795 Don't indicate any priority for target registers.
16796
16797 @item -mlra-priority-compact
16798 @opindex mlra-priority-compact
16799 Indicate target register priority for r0..r3 / r12..r15.
16800
16801 @item -mlra-priority-noncompact
16802 @opindex mlra-priority-noncompact
16803 Reduce target register priority for r0..r3 / r12..r15.
16804
16805 @item -mmillicode
16806 @opindex mmillicode
16807 When optimizing for size (using @option{-Os}), prologues and epilogues
16808 that have to save or restore a large number of registers are often
16809 shortened by using call to a special function in libgcc; this is
16810 referred to as a @emph{millicode} call. As these calls can pose
16811 performance issues, and/or cause linking issues when linking in a
16812 nonstandard way, this option is provided to turn on or off millicode
16813 call generation.
16814
16815 @item -mcode-density-frame
16816 @opindex mcode-density-frame
16817 This option enable the compiler to emit @code{enter} and @code{leave}
16818 instructions. These instructions are only valid for CPUs with
16819 code-density feature.
16820
16821 @item -mmixed-code
16822 @opindex mmixed-code
16823 Tweak register allocation to help 16-bit instruction generation.
16824 This generally has the effect of decreasing the average instruction size
16825 while increasing the instruction count.
16826
16827 @item -mq-class
16828 @opindex mq-class
16829 Enable @samp{q} instruction alternatives.
16830 This is the default for @option{-Os}.
16831
16832 @item -mRcq
16833 @opindex mRcq
16834 Enable @samp{Rcq} constraint handling.
16835 Most short code generation depends on this.
16836 This is the default.
16837
16838 @item -mRcw
16839 @opindex mRcw
16840 Enable @samp{Rcw} constraint handling.
16841 Most ccfsm condexec mostly depends on this.
16842 This is the default.
16843
16844 @item -msize-level=@var{level}
16845 @opindex msize-level
16846 Fine-tune size optimization with regards to instruction lengths and alignment.
16847 The recognized values for @var{level} are:
16848 @table @samp
16849 @item 0
16850 No size optimization. This level is deprecated and treated like @samp{1}.
16851
16852 @item 1
16853 Short instructions are used opportunistically.
16854
16855 @item 2
16856 In addition, alignment of loops and of code after barriers are dropped.
16857
16858 @item 3
16859 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16860
16861 @end table
16862
16863 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16864 the behavior when this is not set is equivalent to level @samp{1}.
16865
16866 @item -mtune=@var{cpu}
16867 @opindex mtune
16868 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16869 by @option{-mcpu=}.
16870
16871 Supported values for @var{cpu} are
16872
16873 @table @samp
16874 @item ARC600
16875 Tune for ARC600 CPU.
16876
16877 @item ARC601
16878 Tune for ARC601 CPU.
16879
16880 @item ARC700
16881 Tune for ARC700 CPU with standard multiplier block.
16882
16883 @item ARC700-xmac
16884 Tune for ARC700 CPU with XMAC block.
16885
16886 @item ARC725D
16887 Tune for ARC725D CPU.
16888
16889 @item ARC750D
16890 Tune for ARC750D CPU.
16891
16892 @end table
16893
16894 @item -mmultcost=@var{num}
16895 @opindex mmultcost
16896 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16897 normal instruction.
16898
16899 @item -munalign-prob-threshold=@var{probability}
16900 @opindex munalign-prob-threshold
16901 Set probability threshold for unaligning branches.
16902 When tuning for @samp{ARC700} and optimizing for speed, branches without
16903 filled delay slot are preferably emitted unaligned and long, unless
16904 profiling indicates that the probability for the branch to be taken
16905 is below @var{probability}. @xref{Cross-profiling}.
16906 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16907
16908 @end table
16909
16910 The following options are maintained for backward compatibility, but
16911 are now deprecated and will be removed in a future release:
16912
16913 @c Deprecated options
16914 @table @gcctabopt
16915
16916 @item -margonaut
16917 @opindex margonaut
16918 Obsolete FPX.
16919
16920 @item -mbig-endian
16921 @opindex mbig-endian
16922 @itemx -EB
16923 @opindex EB
16924 Compile code for big-endian targets. Use of these options is now
16925 deprecated. Big-endian code is supported by configuring GCC to build
16926 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16927 for which big endian is the default.
16928
16929 @item -mlittle-endian
16930 @opindex mlittle-endian
16931 @itemx -EL
16932 @opindex EL
16933 Compile code for little-endian targets. Use of these options is now
16934 deprecated. Little-endian code is supported by configuring GCC to build
16935 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16936 for which little endian is the default.
16937
16938 @item -mbarrel_shifter
16939 @opindex mbarrel_shifter
16940 Replaced by @option{-mbarrel-shifter}.
16941
16942 @item -mdpfp_compact
16943 @opindex mdpfp_compact
16944 Replaced by @option{-mdpfp-compact}.
16945
16946 @item -mdpfp_fast
16947 @opindex mdpfp_fast
16948 Replaced by @option{-mdpfp-fast}.
16949
16950 @item -mdsp_packa
16951 @opindex mdsp_packa
16952 Replaced by @option{-mdsp-packa}.
16953
16954 @item -mEA
16955 @opindex mEA
16956 Replaced by @option{-mea}.
16957
16958 @item -mmac_24
16959 @opindex mmac_24
16960 Replaced by @option{-mmac-24}.
16961
16962 @item -mmac_d16
16963 @opindex mmac_d16
16964 Replaced by @option{-mmac-d16}.
16965
16966 @item -mspfp_compact
16967 @opindex mspfp_compact
16968 Replaced by @option{-mspfp-compact}.
16969
16970 @item -mspfp_fast
16971 @opindex mspfp_fast
16972 Replaced by @option{-mspfp-fast}.
16973
16974 @item -mtune=@var{cpu}
16975 @opindex mtune
16976 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16977 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16978 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16979
16980 @item -multcost=@var{num}
16981 @opindex multcost
16982 Replaced by @option{-mmultcost}.
16983
16984 @end table
16985
16986 @node ARM Options
16987 @subsection ARM Options
16988 @cindex ARM options
16989
16990 These @samp{-m} options are defined for the ARM port:
16991
16992 @table @gcctabopt
16993 @item -mabi=@var{name}
16994 @opindex mabi
16995 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16996 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16997
16998 @item -mapcs-frame
16999 @opindex mapcs-frame
17000 Generate a stack frame that is compliant with the ARM Procedure Call
17001 Standard for all functions, even if this is not strictly necessary for
17002 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17003 with this option causes the stack frames not to be generated for
17004 leaf functions. The default is @option{-mno-apcs-frame}.
17005 This option is deprecated.
17006
17007 @item -mapcs
17008 @opindex mapcs
17009 This is a synonym for @option{-mapcs-frame} and is deprecated.
17010
17011 @ignore
17012 @c not currently implemented
17013 @item -mapcs-stack-check
17014 @opindex mapcs-stack-check
17015 Generate code to check the amount of stack space available upon entry to
17016 every function (that actually uses some stack space). If there is
17017 insufficient space available then either the function
17018 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17019 called, depending upon the amount of stack space required. The runtime
17020 system is required to provide these functions. The default is
17021 @option{-mno-apcs-stack-check}, since this produces smaller code.
17022
17023 @c not currently implemented
17024 @item -mapcs-reentrant
17025 @opindex mapcs-reentrant
17026 Generate reentrant, position-independent code. The default is
17027 @option{-mno-apcs-reentrant}.
17028 @end ignore
17029
17030 @item -mthumb-interwork
17031 @opindex mthumb-interwork
17032 Generate code that supports calling between the ARM and Thumb
17033 instruction sets. Without this option, on pre-v5 architectures, the
17034 two instruction sets cannot be reliably used inside one program. The
17035 default is @option{-mno-thumb-interwork}, since slightly larger code
17036 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17037 configurations this option is meaningless.
17038
17039 @item -mno-sched-prolog
17040 @opindex mno-sched-prolog
17041 @opindex msched-prolog
17042 Prevent the reordering of instructions in the function prologue, or the
17043 merging of those instruction with the instructions in the function's
17044 body. This means that all functions start with a recognizable set
17045 of instructions (or in fact one of a choice from a small set of
17046 different function prologues), and this information can be used to
17047 locate the start of functions inside an executable piece of code. The
17048 default is @option{-msched-prolog}.
17049
17050 @item -mfloat-abi=@var{name}
17051 @opindex mfloat-abi
17052 Specifies which floating-point ABI to use. Permissible values
17053 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17054
17055 Specifying @samp{soft} causes GCC to generate output containing
17056 library calls for floating-point operations.
17057 @samp{softfp} allows the generation of code using hardware floating-point
17058 instructions, but still uses the soft-float calling conventions.
17059 @samp{hard} allows generation of floating-point instructions
17060 and uses FPU-specific calling conventions.
17061
17062 The default depends on the specific target configuration. Note that
17063 the hard-float and soft-float ABIs are not link-compatible; you must
17064 compile your entire program with the same ABI, and link with a
17065 compatible set of libraries.
17066
17067 @item -mlittle-endian
17068 @opindex mlittle-endian
17069 Generate code for a processor running in little-endian mode. This is
17070 the default for all standard configurations.
17071
17072 @item -mbig-endian
17073 @opindex mbig-endian
17074 Generate code for a processor running in big-endian mode; the default is
17075 to compile code for a little-endian processor.
17076
17077 @item -mbe8
17078 @itemx -mbe32
17079 @opindex mbe8
17080 When linking a big-endian image select between BE8 and BE32 formats.
17081 The option has no effect for little-endian images and is ignored. The
17082 default is dependent on the selected target architecture. For ARMv6
17083 and later architectures the default is BE8, for older architectures
17084 the default is BE32. BE32 format has been deprecated by ARM.
17085
17086 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17087 @opindex march
17088 This specifies the name of the target ARM architecture. GCC uses this
17089 name to determine what kind of instructions it can emit when generating
17090 assembly code. This option can be used in conjunction with or instead
17091 of the @option{-mcpu=} option.
17092
17093 Permissible names are:
17094 @samp{armv4t},
17095 @samp{armv5t}, @samp{armv5te},
17096 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17097 @samp{armv6z}, @samp{armv6zk},
17098 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17099 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17100 @samp{armv8.4-a},
17101 @samp{armv8.5-a},
17102 @samp{armv7-r},
17103 @samp{armv8-r},
17104 @samp{armv6-m}, @samp{armv6s-m},
17105 @samp{armv7-m}, @samp{armv7e-m},
17106 @samp{armv8-m.base}, @samp{armv8-m.main},
17107 @samp{iwmmxt} and @samp{iwmmxt2}.
17108
17109 Additionally, the following architectures, which lack support for the
17110 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17111
17112 Many of the architectures support extensions. These can be added by
17113 appending @samp{+@var{extension}} to the architecture name. Extension
17114 options are processed in order and capabilities accumulate. An extension
17115 will also enable any necessary base extensions
17116 upon which it depends. For example, the @samp{+crypto} extension
17117 will always enable the @samp{+simd} extension. The exception to the
17118 additive construction is for extensions that are prefixed with
17119 @samp{+no@dots{}}: these extensions disable the specified option and
17120 any other extensions that may depend on the presence of that
17121 extension.
17122
17123 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17124 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17125 entirely disabled by the @samp{+nofp} option that follows it.
17126
17127 Most extension names are generically named, but have an effect that is
17128 dependent upon the architecture to which it is applied. For example,
17129 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17130 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17131 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17132 variant for @samp{armv8-a}.
17133
17134 The table below lists the supported extensions for each architecture.
17135 Architectures not mentioned do not support any extensions.
17136
17137 @table @samp
17138 @item armv5te
17139 @itemx armv6
17140 @itemx armv6j
17141 @itemx armv6k
17142 @itemx armv6kz
17143 @itemx armv6t2
17144 @itemx armv6z
17145 @itemx armv6zk
17146 @table @samp
17147 @item +fp
17148 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17149 used as an alias for this extension.
17150
17151 @item +nofp
17152 Disable the floating-point instructions.
17153 @end table
17154
17155 @item armv7
17156 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17157 @table @samp
17158 @item +fp
17159 The VFPv3 floating-point instructions, with 16 double-precision
17160 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17161 for this extension. Note that floating-point is not supported by the
17162 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17163 ARMv7-R architectures.
17164
17165 @item +nofp
17166 Disable the floating-point instructions.
17167 @end table
17168
17169 @item armv7-a
17170 @table @samp
17171 @item +mp
17172 The multiprocessing extension.
17173
17174 @item +sec
17175 The security extension.
17176
17177 @item +fp
17178 The VFPv3 floating-point instructions, with 16 double-precision
17179 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17180 for this extension.
17181
17182 @item +simd
17183 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17184 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17185 for this extension.
17186
17187 @item +vfpv3
17188 The VFPv3 floating-point instructions, with 32 double-precision
17189 registers.
17190
17191 @item +vfpv3-d16-fp16
17192 The VFPv3 floating-point instructions, with 16 double-precision
17193 registers and the half-precision floating-point conversion operations.
17194
17195 @item +vfpv3-fp16
17196 The VFPv3 floating-point instructions, with 32 double-precision
17197 registers and the half-precision floating-point conversion operations.
17198
17199 @item +vfpv4-d16
17200 The VFPv4 floating-point instructions, with 16 double-precision
17201 registers.
17202
17203 @item +vfpv4
17204 The VFPv4 floating-point instructions, with 32 double-precision
17205 registers.
17206
17207 @item +neon-fp16
17208 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17209 the half-precision floating-point conversion operations.
17210
17211 @item +neon-vfpv4
17212 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17213
17214 @item +nosimd
17215 Disable the Advanced SIMD instructions (does not disable floating point).
17216
17217 @item +nofp
17218 Disable the floating-point and Advanced SIMD instructions.
17219 @end table
17220
17221 @item armv7ve
17222 The extended version of the ARMv7-A architecture with support for
17223 virtualization.
17224 @table @samp
17225 @item +fp
17226 The VFPv4 floating-point instructions, with 16 double-precision registers.
17227 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17228
17229 @item +simd
17230 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17231 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17232
17233 @item +vfpv3-d16
17234 The VFPv3 floating-point instructions, with 16 double-precision
17235 registers.
17236
17237 @item +vfpv3
17238 The VFPv3 floating-point instructions, with 32 double-precision
17239 registers.
17240
17241 @item +vfpv3-d16-fp16
17242 The VFPv3 floating-point instructions, with 16 double-precision
17243 registers and the half-precision floating-point conversion operations.
17244
17245 @item +vfpv3-fp16
17246 The VFPv3 floating-point instructions, with 32 double-precision
17247 registers and the half-precision floating-point conversion operations.
17248
17249 @item +vfpv4-d16
17250 The VFPv4 floating-point instructions, with 16 double-precision
17251 registers.
17252
17253 @item +vfpv4
17254 The VFPv4 floating-point instructions, with 32 double-precision
17255 registers.
17256
17257 @item +neon
17258 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17259 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17260
17261 @item +neon-fp16
17262 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17263 the half-precision floating-point conversion operations.
17264
17265 @item +nosimd
17266 Disable the Advanced SIMD instructions (does not disable floating point).
17267
17268 @item +nofp
17269 Disable the floating-point and Advanced SIMD instructions.
17270 @end table
17271
17272 @item armv8-a
17273 @table @samp
17274 @item +crc
17275 The Cyclic Redundancy Check (CRC) instructions.
17276 @item +simd
17277 The ARMv8-A Advanced SIMD and floating-point instructions.
17278 @item +crypto
17279 The cryptographic instructions.
17280 @item +nocrypto
17281 Disable the cryptographic instructions.
17282 @item +nofp
17283 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17284 @item +sb
17285 Speculation Barrier Instruction.
17286 @item +predres
17287 Execution and Data Prediction Restriction Instructions.
17288 @end table
17289
17290 @item armv8.1-a
17291 @table @samp
17292 @item +simd
17293 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17294
17295 @item +crypto
17296 The cryptographic instructions. This also enables the Advanced SIMD and
17297 floating-point instructions.
17298
17299 @item +nocrypto
17300 Disable the cryptographic instructions.
17301
17302 @item +nofp
17303 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17304
17305 @item +sb
17306 Speculation Barrier Instruction.
17307
17308 @item +predres
17309 Execution and Data Prediction Restriction Instructions.
17310 @end table
17311
17312 @item armv8.2-a
17313 @itemx armv8.3-a
17314 @table @samp
17315 @item +fp16
17316 The half-precision floating-point data processing instructions.
17317 This also enables the Advanced SIMD and floating-point instructions.
17318
17319 @item +fp16fml
17320 The half-precision floating-point fmla extension. This also enables
17321 the half-precision floating-point extension and Advanced SIMD and
17322 floating-point instructions.
17323
17324 @item +simd
17325 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17326
17327 @item +crypto
17328 The cryptographic instructions. This also enables the Advanced SIMD and
17329 floating-point instructions.
17330
17331 @item +dotprod
17332 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17333
17334 @item +nocrypto
17335 Disable the cryptographic extension.
17336
17337 @item +nofp
17338 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17339
17340 @item +sb
17341 Speculation Barrier Instruction.
17342
17343 @item +predres
17344 Execution and Data Prediction Restriction Instructions.
17345 @end table
17346
17347 @item armv8.4-a
17348 @table @samp
17349 @item +fp16
17350 The half-precision floating-point data processing instructions.
17351 This also enables the Advanced SIMD and floating-point instructions as well
17352 as the Dot Product extension and the half-precision floating-point fmla
17353 extension.
17354
17355 @item +simd
17356 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17357 Dot Product extension.
17358
17359 @item +crypto
17360 The cryptographic instructions. This also enables the Advanced SIMD and
17361 floating-point instructions as well as the Dot Product extension.
17362
17363 @item +nocrypto
17364 Disable the cryptographic extension.
17365
17366 @item +nofp
17367 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17368
17369 @item +sb
17370 Speculation Barrier Instruction.
17371
17372 @item +predres
17373 Execution and Data Prediction Restriction Instructions.
17374 @end table
17375
17376 @item armv8.5-a
17377 @table @samp
17378 @item +fp16
17379 The half-precision floating-point data processing instructions.
17380 This also enables the Advanced SIMD and floating-point instructions as well
17381 as the Dot Product extension and the half-precision floating-point fmla
17382 extension.
17383
17384 @item +simd
17385 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17386 Dot Product extension.
17387
17388 @item +crypto
17389 The cryptographic instructions. This also enables the Advanced SIMD and
17390 floating-point instructions as well as the Dot Product extension.
17391
17392 @item +nocrypto
17393 Disable the cryptographic extension.
17394
17395 @item +nofp
17396 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17397 @end table
17398
17399 @item armv7-r
17400 @table @samp
17401 @item +fp.sp
17402 The single-precision VFPv3 floating-point instructions. The extension
17403 @samp{+vfpv3xd} can be used as an alias for this extension.
17404
17405 @item +fp
17406 The VFPv3 floating-point instructions with 16 double-precision registers.
17407 The extension +vfpv3-d16 can be used as an alias for this extension.
17408
17409 @item +vfpv3xd-d16-fp16
17410 The single-precision VFPv3 floating-point instructions with 16 double-precision
17411 registers and the half-precision floating-point conversion operations.
17412
17413 @item +vfpv3-d16-fp16
17414 The VFPv3 floating-point instructions with 16 double-precision
17415 registers and the half-precision floating-point conversion operations.
17416
17417 @item +nofp
17418 Disable the floating-point extension.
17419
17420 @item +idiv
17421 The ARM-state integer division instructions.
17422
17423 @item +noidiv
17424 Disable the ARM-state integer division extension.
17425 @end table
17426
17427 @item armv7e-m
17428 @table @samp
17429 @item +fp
17430 The single-precision VFPv4 floating-point instructions.
17431
17432 @item +fpv5
17433 The single-precision FPv5 floating-point instructions.
17434
17435 @item +fp.dp
17436 The single- and double-precision FPv5 floating-point instructions.
17437
17438 @item +nofp
17439 Disable the floating-point extensions.
17440 @end table
17441
17442 @item armv8-m.main
17443 @table @samp
17444 @item +dsp
17445 The DSP instructions.
17446
17447 @item +nodsp
17448 Disable the DSP extension.
17449
17450 @item +fp
17451 The single-precision floating-point instructions.
17452
17453 @item +fp.dp
17454 The single- and double-precision floating-point instructions.
17455
17456 @item +nofp
17457 Disable the floating-point extension.
17458 @end table
17459
17460 @item armv8-r
17461 @table @samp
17462 @item +crc
17463 The Cyclic Redundancy Check (CRC) instructions.
17464 @item +fp.sp
17465 The single-precision FPv5 floating-point instructions.
17466 @item +simd
17467 The ARMv8-A Advanced SIMD and floating-point instructions.
17468 @item +crypto
17469 The cryptographic instructions.
17470 @item +nocrypto
17471 Disable the cryptographic instructions.
17472 @item +nofp
17473 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17474 @end table
17475
17476 @end table
17477
17478 @option{-march=native} causes the compiler to auto-detect the architecture
17479 of the build computer. At present, this feature is only supported on
17480 GNU/Linux, and not all architectures are recognized. If the auto-detect
17481 is unsuccessful the option has no effect.
17482
17483 @item -mtune=@var{name}
17484 @opindex mtune
17485 This option specifies the name of the target ARM processor for
17486 which GCC should tune the performance of the code.
17487 For some ARM implementations better performance can be obtained by using
17488 this option.
17489 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17490 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17491 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17492 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17493 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17494 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17495 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17496 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17497 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17498 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17499 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17500 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17501 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17502 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17503 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17504 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17505 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17506 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17507 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17508 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17509 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17510 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17511
17512 Additionally, this option can specify that GCC should tune the performance
17513 of the code for a big.LITTLE system. Permissible names are:
17514 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17515 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17516 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17517 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17518
17519 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17520 performance for a blend of processors within architecture @var{arch}.
17521 The aim is to generate code that run well on the current most popular
17522 processors, balancing between optimizations that benefit some CPUs in the
17523 range, and avoiding performance pitfalls of other CPUs. The effects of
17524 this option may change in future GCC versions as CPU models come and go.
17525
17526 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17527 the extension options do not affect the tuning of the generated code.
17528
17529 @option{-mtune=native} causes the compiler to auto-detect the CPU
17530 of the build computer. At present, this feature is only supported on
17531 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17532 unsuccessful the option has no effect.
17533
17534 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17535 @opindex mcpu
17536 This specifies the name of the target ARM processor. GCC uses this name
17537 to derive the name of the target ARM architecture (as if specified
17538 by @option{-march}) and the ARM processor type for which to tune for
17539 performance (as if specified by @option{-mtune}). Where this option
17540 is used in conjunction with @option{-march} or @option{-mtune},
17541 those options take precedence over the appropriate part of this option.
17542
17543 Many of the supported CPUs implement optional architectural
17544 extensions. Where this is so the architectural extensions are
17545 normally enabled by default. If implementations that lack the
17546 extension exist, then the extension syntax can be used to disable
17547 those extensions that have been omitted. For floating-point and
17548 Advanced SIMD (Neon) instructions, the settings of the options
17549 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17550 floating-point and Advanced SIMD instructions will only be used if
17551 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17552 @option{-mfpu} other than @samp{auto} will override the available
17553 floating-point and SIMD extension instructions.
17554
17555 For example, @samp{cortex-a9} can be found in three major
17556 configurations: integer only, with just a floating-point unit or with
17557 floating-point and Advanced SIMD. The default is to enable all the
17558 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17559 be used to disable just the SIMD or both the SIMD and floating-point
17560 instructions respectively.
17561
17562 Permissible names for this option are the same as those for
17563 @option{-mtune}.
17564
17565 The following extension options are common to the listed CPUs:
17566
17567 @table @samp
17568 @item +nodsp
17569 Disable the DSP instructions on @samp{cortex-m33}.
17570
17571 @item +nofp
17572 Disables the floating-point instructions on @samp{arm9e},
17573 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17574 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17575 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17576 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17577 Disables the floating-point and SIMD instructions on
17578 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17579 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17580 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17581 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17582 @samp{cortex-a53} and @samp{cortex-a55}.
17583
17584 @item +nofp.dp
17585 Disables the double-precision component of the floating-point instructions
17586 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17587 @samp{cortex-m7}.
17588
17589 @item +nosimd
17590 Disables the SIMD (but not floating-point) instructions on
17591 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17592 and @samp{cortex-a9}.
17593
17594 @item +crypto
17595 Enables the cryptographic instructions on @samp{cortex-a32},
17596 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17597 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17598 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17599 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17600 @samp{cortex-a75.cortex-a55}.
17601 @end table
17602
17603 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17604 VFPv3 with 16 double-precision registers. It supports the following
17605 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17606 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17607 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17608 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17609 the extensions to @option{-march=armv7-a}.
17610
17611 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17612 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17613 See @option{-mtune} for more information.
17614
17615 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17616 of the build computer. At present, this feature is only supported on
17617 GNU/Linux, and not all architectures are recognized. If the auto-detect
17618 is unsuccessful the option has no effect.
17619
17620 @item -mfpu=@var{name}
17621 @opindex mfpu
17622 This specifies what floating-point hardware (or hardware emulation) is
17623 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17624 @samp{vfpv3},
17625 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17626 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17627 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17628 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17629 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17630 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17631 is an alias for @samp{vfpv2}.
17632
17633 The setting @samp{auto} is the default and is special. It causes the
17634 compiler to select the floating-point and Advanced SIMD instructions
17635 based on the settings of @option{-mcpu} and @option{-march}.
17636
17637 If the selected floating-point hardware includes the NEON extension
17638 (e.g.@: @option{-mfpu=neon}), note that floating-point
17639 operations are not generated by GCC's auto-vectorization pass unless
17640 @option{-funsafe-math-optimizations} is also specified. This is
17641 because NEON hardware does not fully implement the IEEE 754 standard for
17642 floating-point arithmetic (in particular denormal values are treated as
17643 zero), so the use of NEON instructions may lead to a loss of precision.
17644
17645 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}).
17646
17647 @item -mfp16-format=@var{name}
17648 @opindex mfp16-format
17649 Specify the format of the @code{__fp16} half-precision floating-point type.
17650 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17651 the default is @samp{none}, in which case the @code{__fp16} type is not
17652 defined. @xref{Half-Precision}, for more information.
17653
17654 @item -mstructure-size-boundary=@var{n}
17655 @opindex mstructure-size-boundary
17656 The sizes of all structures and unions are rounded up to a multiple
17657 of the number of bits set by this option. Permissible values are 8, 32
17658 and 64. The default value varies for different toolchains. For the COFF
17659 targeted toolchain the default value is 8. A value of 64 is only allowed
17660 if the underlying ABI supports it.
17661
17662 Specifying a larger number can produce faster, more efficient code, but
17663 can also increase the size of the program. Different values are potentially
17664 incompatible. Code compiled with one value cannot necessarily expect to
17665 work with code or libraries compiled with another value, if they exchange
17666 information using structures or unions.
17667
17668 This option is deprecated.
17669
17670 @item -mabort-on-noreturn
17671 @opindex mabort-on-noreturn
17672 Generate a call to the function @code{abort} at the end of a
17673 @code{noreturn} function. It is executed if the function tries to
17674 return.
17675
17676 @item -mlong-calls
17677 @itemx -mno-long-calls
17678 @opindex mlong-calls
17679 @opindex mno-long-calls
17680 Tells the compiler to perform function calls by first loading the
17681 address of the function into a register and then performing a subroutine
17682 call on this register. This switch is needed if the target function
17683 lies outside of the 64-megabyte addressing range of the offset-based
17684 version of subroutine call instruction.
17685
17686 Even if this switch is enabled, not all function calls are turned
17687 into long calls. The heuristic is that static functions, functions
17688 that have the @code{short_call} attribute, functions that are inside
17689 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17690 definitions have already been compiled within the current compilation
17691 unit are not turned into long calls. The exceptions to this rule are
17692 that weak function definitions, functions with the @code{long_call}
17693 attribute or the @code{section} attribute, and functions that are within
17694 the scope of a @code{#pragma long_calls} directive are always
17695 turned into long calls.
17696
17697 This feature is not enabled by default. Specifying
17698 @option{-mno-long-calls} restores the default behavior, as does
17699 placing the function calls within the scope of a @code{#pragma
17700 long_calls_off} directive. Note these switches have no effect on how
17701 the compiler generates code to handle function calls via function
17702 pointers.
17703
17704 @item -msingle-pic-base
17705 @opindex msingle-pic-base
17706 Treat the register used for PIC addressing as read-only, rather than
17707 loading it in the prologue for each function. The runtime system is
17708 responsible for initializing this register with an appropriate value
17709 before execution begins.
17710
17711 @item -mpic-register=@var{reg}
17712 @opindex mpic-register
17713 Specify the register to be used for PIC addressing.
17714 For standard PIC base case, the default is any suitable register
17715 determined by compiler. For single PIC base case, the default is
17716 @samp{R9} if target is EABI based or stack-checking is enabled,
17717 otherwise the default is @samp{R10}.
17718
17719 @item -mpic-data-is-text-relative
17720 @opindex mpic-data-is-text-relative
17721 Assume that the displacement between the text and data segments is fixed
17722 at static link time. This permits using PC-relative addressing
17723 operations to access data known to be in the data segment. For
17724 non-VxWorks RTP targets, this option is enabled by default. When
17725 disabled on such targets, it will enable @option{-msingle-pic-base} by
17726 default.
17727
17728 @item -mpoke-function-name
17729 @opindex mpoke-function-name
17730 Write the name of each function into the text section, directly
17731 preceding the function prologue. The generated code is similar to this:
17732
17733 @smallexample
17734 t0
17735 .ascii "arm_poke_function_name", 0
17736 .align
17737 t1
17738 .word 0xff000000 + (t1 - t0)
17739 arm_poke_function_name
17740 mov ip, sp
17741 stmfd sp!, @{fp, ip, lr, pc@}
17742 sub fp, ip, #4
17743 @end smallexample
17744
17745 When performing a stack backtrace, code can inspect the value of
17746 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17747 location @code{pc - 12} and the top 8 bits are set, then we know that
17748 there is a function name embedded immediately preceding this location
17749 and has length @code{((pc[-3]) & 0xff000000)}.
17750
17751 @item -mthumb
17752 @itemx -marm
17753 @opindex marm
17754 @opindex mthumb
17755
17756 Select between generating code that executes in ARM and Thumb
17757 states. The default for most configurations is to generate code
17758 that executes in ARM state, but the default can be changed by
17759 configuring GCC with the @option{--with-mode=}@var{state}
17760 configure option.
17761
17762 You can also override the ARM and Thumb mode for each function
17763 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17764 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17765
17766 @item -mflip-thumb
17767 @opindex mflip-thumb
17768 Switch ARM/Thumb modes on alternating functions.
17769 This option is provided for regression testing of mixed Thumb/ARM code
17770 generation, and is not intended for ordinary use in compiling code.
17771
17772 @item -mtpcs-frame
17773 @opindex mtpcs-frame
17774 Generate a stack frame that is compliant with the Thumb Procedure Call
17775 Standard for all non-leaf functions. (A leaf function is one that does
17776 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17777
17778 @item -mtpcs-leaf-frame
17779 @opindex mtpcs-leaf-frame
17780 Generate a stack frame that is compliant with the Thumb Procedure Call
17781 Standard for all leaf functions. (A leaf function is one that does
17782 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17783
17784 @item -mcallee-super-interworking
17785 @opindex mcallee-super-interworking
17786 Gives all externally visible functions in the file being compiled an ARM
17787 instruction set header which switches to Thumb mode before executing the
17788 rest of the function. This allows these functions to be called from
17789 non-interworking code. This option is not valid in AAPCS configurations
17790 because interworking is enabled by default.
17791
17792 @item -mcaller-super-interworking
17793 @opindex mcaller-super-interworking
17794 Allows calls via function pointers (including virtual functions) to
17795 execute correctly regardless of whether the target code has been
17796 compiled for interworking or not. There is a small overhead in the cost
17797 of executing a function pointer if this option is enabled. This option
17798 is not valid in AAPCS configurations because interworking is enabled
17799 by default.
17800
17801 @item -mtp=@var{name}
17802 @opindex mtp
17803 Specify the access model for the thread local storage pointer. The valid
17804 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17805 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17806 (supported in the arm6k architecture), and @samp{auto}, which uses the
17807 best available method for the selected processor. The default setting is
17808 @samp{auto}.
17809
17810 @item -mtls-dialect=@var{dialect}
17811 @opindex mtls-dialect
17812 Specify the dialect to use for accessing thread local storage. Two
17813 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17814 @samp{gnu} dialect selects the original GNU scheme for supporting
17815 local and global dynamic TLS models. The @samp{gnu2} dialect
17816 selects the GNU descriptor scheme, which provides better performance
17817 for shared libraries. The GNU descriptor scheme is compatible with
17818 the original scheme, but does require new assembler, linker and
17819 library support. Initial and local exec TLS models are unaffected by
17820 this option and always use the original scheme.
17821
17822 @item -mword-relocations
17823 @opindex mword-relocations
17824 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17825 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17826 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17827 is specified. This option conflicts with @option{-mslow-flash-data}.
17828
17829 @item -mfix-cortex-m3-ldrd
17830 @opindex mfix-cortex-m3-ldrd
17831 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17832 with overlapping destination and base registers are used. This option avoids
17833 generating these instructions. This option is enabled by default when
17834 @option{-mcpu=cortex-m3} is specified.
17835
17836 @item -munaligned-access
17837 @itemx -mno-unaligned-access
17838 @opindex munaligned-access
17839 @opindex mno-unaligned-access
17840 Enables (or disables) reading and writing of 16- and 32- bit values
17841 from addresses that are not 16- or 32- bit aligned. By default
17842 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17843 ARMv8-M Baseline architectures, and enabled for all other
17844 architectures. If unaligned access is not enabled then words in packed
17845 data structures are accessed a byte at a time.
17846
17847 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17848 generated object file to either true or false, depending upon the
17849 setting of this option. If unaligned access is enabled then the
17850 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17851 defined.
17852
17853 @item -mneon-for-64bits
17854 @opindex mneon-for-64bits
17855 Enables using Neon to handle scalar 64-bits operations. This is
17856 disabled by default since the cost of moving data from core registers
17857 to Neon is high.
17858
17859 @item -mslow-flash-data
17860 @opindex mslow-flash-data
17861 Assume loading data from flash is slower than fetching instruction.
17862 Therefore literal load is minimized for better performance.
17863 This option is only supported when compiling for ARMv7 M-profile and
17864 off by default. It conflicts with @option{-mword-relocations}.
17865
17866 @item -masm-syntax-unified
17867 @opindex masm-syntax-unified
17868 Assume inline assembler is using unified asm syntax. The default is
17869 currently off which implies divided syntax. This option has no impact
17870 on Thumb2. However, this may change in future releases of GCC.
17871 Divided syntax should be considered deprecated.
17872
17873 @item -mrestrict-it
17874 @opindex mrestrict-it
17875 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17876 IT blocks can only contain a single 16-bit instruction from a select
17877 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17878
17879 @item -mprint-tune-info
17880 @opindex mprint-tune-info
17881 Print CPU tuning information as comment in assembler file. This is
17882 an option used only for regression testing of the compiler and not
17883 intended for ordinary use in compiling code. This option is disabled
17884 by default.
17885
17886 @item -mverbose-cost-dump
17887 @opindex mverbose-cost-dump
17888 Enable verbose cost model dumping in the debug dump files. This option is
17889 provided for use in debugging the compiler.
17890
17891 @item -mpure-code
17892 @opindex mpure-code
17893 Do not allow constant data to be placed in code sections.
17894 Additionally, when compiling for ELF object format give all text sections the
17895 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17896 is only available when generating non-pic code for M-profile targets with the
17897 MOVT instruction.
17898
17899 @item -mcmse
17900 @opindex mcmse
17901 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17902 Development Tools Engineering Specification", which can be found on
17903 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17904 @end table
17905
17906 @node AVR Options
17907 @subsection AVR Options
17908 @cindex AVR Options
17909
17910 These options are defined for AVR implementations:
17911
17912 @table @gcctabopt
17913 @item -mmcu=@var{mcu}
17914 @opindex mmcu
17915 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17916
17917 The default for this option is@tie{}@samp{avr2}.
17918
17919 GCC supports the following AVR devices and ISAs:
17920
17921 @include avr-mmcu.texi
17922
17923 @item -mabsdata
17924 @opindex mabsdata
17925
17926 Assume that all data in static storage can be accessed by LDS / STS
17927 instructions. This option has only an effect on reduced Tiny devices like
17928 ATtiny40. See also the @code{absdata}
17929 @ref{AVR Variable Attributes,variable attribute}.
17930
17931 @item -maccumulate-args
17932 @opindex maccumulate-args
17933 Accumulate outgoing function arguments and acquire/release the needed
17934 stack space for outgoing function arguments once in function
17935 prologue/epilogue. Without this option, outgoing arguments are pushed
17936 before calling a function and popped afterwards.
17937
17938 Popping the arguments after the function call can be expensive on
17939 AVR so that accumulating the stack space might lead to smaller
17940 executables because arguments need not be removed from the
17941 stack after such a function call.
17942
17943 This option can lead to reduced code size for functions that perform
17944 several calls to functions that get their arguments on the stack like
17945 calls to printf-like functions.
17946
17947 @item -mbranch-cost=@var{cost}
17948 @opindex mbranch-cost
17949 Set the branch costs for conditional branch instructions to
17950 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17951 integers. The default branch cost is 0.
17952
17953 @item -mcall-prologues
17954 @opindex mcall-prologues
17955 Functions prologues/epilogues are expanded as calls to appropriate
17956 subroutines. Code size is smaller.
17957
17958 @item -mgas-isr-prologues
17959 @opindex mgas-isr-prologues
17960 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17961 instruction supported by GNU Binutils.
17962 If this option is on, the feature can still be disabled for individual
17963 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17964 function attribute. This feature is activated per default
17965 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17966 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17967
17968 @item -mint8
17969 @opindex mint8
17970 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17971 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17972 and @code{long long} is 4 bytes. Please note that this option does not
17973 conform to the C standards, but it results in smaller code
17974 size.
17975
17976 @item -mmain-is-OS_task
17977 @opindex mmain-is-OS_task
17978 Do not save registers in @code{main}. The effect is the same like
17979 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17980 to @code{main}. It is activated per default if optimization is on.
17981
17982 @item -mn-flash=@var{num}
17983 @opindex mn-flash
17984 Assume that the flash memory has a size of
17985 @var{num} times 64@tie{}KiB.
17986
17987 @item -mno-interrupts
17988 @opindex mno-interrupts
17989 Generated code is not compatible with hardware interrupts.
17990 Code size is smaller.
17991
17992 @item -mrelax
17993 @opindex mrelax
17994 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17995 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17996 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17997 the assembler's command line and the @option{--relax} option to the
17998 linker's command line.
17999
18000 Jump relaxing is performed by the linker because jump offsets are not
18001 known before code is located. Therefore, the assembler code generated by the
18002 compiler is the same, but the instructions in the executable may
18003 differ from instructions in the assembler code.
18004
18005 Relaxing must be turned on if linker stubs are needed, see the
18006 section on @code{EIND} and linker stubs below.
18007
18008 @item -mrmw
18009 @opindex mrmw
18010 Assume that the device supports the Read-Modify-Write
18011 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18012
18013 @item -mshort-calls
18014 @opindex mshort-calls
18015
18016 Assume that @code{RJMP} and @code{RCALL} can target the whole
18017 program memory.
18018
18019 This option is used internally for multilib selection. It is
18020 not an optimization option, and you don't need to set it by hand.
18021
18022 @item -msp8
18023 @opindex msp8
18024 Treat the stack pointer register as an 8-bit register,
18025 i.e.@: assume the high byte of the stack pointer is zero.
18026 In general, you don't need to set this option by hand.
18027
18028 This option is used internally by the compiler to select and
18029 build multilibs for architectures @code{avr2} and @code{avr25}.
18030 These architectures mix devices with and without @code{SPH}.
18031 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18032 the compiler driver adds or removes this option from the compiler
18033 proper's command line, because the compiler then knows if the device
18034 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18035 register or not.
18036
18037 @item -mstrict-X
18038 @opindex mstrict-X
18039 Use address register @code{X} in a way proposed by the hardware. This means
18040 that @code{X} is only used in indirect, post-increment or
18041 pre-decrement addressing.
18042
18043 Without this option, the @code{X} register may be used in the same way
18044 as @code{Y} or @code{Z} which then is emulated by additional
18045 instructions.
18046 For example, loading a value with @code{X+const} addressing with a
18047 small non-negative @code{const < 64} to a register @var{Rn} is
18048 performed as
18049
18050 @example
18051 adiw r26, const ; X += const
18052 ld @var{Rn}, X ; @var{Rn} = *X
18053 sbiw r26, const ; X -= const
18054 @end example
18055
18056 @item -mtiny-stack
18057 @opindex mtiny-stack
18058 Only change the lower 8@tie{}bits of the stack pointer.
18059
18060 @item -mfract-convert-truncate
18061 @opindex mfract-convert-truncate
18062 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18063
18064 @item -nodevicelib
18065 @opindex nodevicelib
18066 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18067
18068 @item -Waddr-space-convert
18069 @opindex Waddr-space-convert
18070 @opindex Wno-addr-space-convert
18071 Warn about conversions between address spaces in the case where the
18072 resulting address space is not contained in the incoming address space.
18073
18074 @item -Wmisspelled-isr
18075 @opindex Wmisspelled-isr
18076 @opindex Wno-misspelled-isr
18077 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18078 Enabled by default.
18079 @end table
18080
18081 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18082 @cindex @code{EIND}
18083 Pointers in the implementation are 16@tie{}bits wide.
18084 The address of a function or label is represented as word address so
18085 that indirect jumps and calls can target any code address in the
18086 range of 64@tie{}Ki words.
18087
18088 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18089 bytes of program memory space, there is a special function register called
18090 @code{EIND} that serves as most significant part of the target address
18091 when @code{EICALL} or @code{EIJMP} instructions are used.
18092
18093 Indirect jumps and calls on these devices are handled as follows by
18094 the compiler and are subject to some limitations:
18095
18096 @itemize @bullet
18097
18098 @item
18099 The compiler never sets @code{EIND}.
18100
18101 @item
18102 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18103 instructions or might read @code{EIND} directly in order to emulate an
18104 indirect call/jump by means of a @code{RET} instruction.
18105
18106 @item
18107 The compiler assumes that @code{EIND} never changes during the startup
18108 code or during the application. In particular, @code{EIND} is not
18109 saved/restored in function or interrupt service routine
18110 prologue/epilogue.
18111
18112 @item
18113 For indirect calls to functions and computed goto, the linker
18114 generates @emph{stubs}. Stubs are jump pads sometimes also called
18115 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18116 The stub contains a direct jump to the desired address.
18117
18118 @item
18119 Linker relaxation must be turned on so that the linker generates
18120 the stubs correctly in all situations. See the compiler option
18121 @option{-mrelax} and the linker option @option{--relax}.
18122 There are corner cases where the linker is supposed to generate stubs
18123 but aborts without relaxation and without a helpful error message.
18124
18125 @item
18126 The default linker script is arranged for code with @code{EIND = 0}.
18127 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18128 linker script has to be used in order to place the sections whose
18129 name start with @code{.trampolines} into the segment where @code{EIND}
18130 points to.
18131
18132 @item
18133 The startup code from libgcc never sets @code{EIND}.
18134 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18135 For the impact of AVR-LibC on @code{EIND}, see the
18136 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18137
18138 @item
18139 It is legitimate for user-specific startup code to set up @code{EIND}
18140 early, for example by means of initialization code located in
18141 section @code{.init3}. Such code runs prior to general startup code
18142 that initializes RAM and calls constructors, but after the bit
18143 of startup code from AVR-LibC that sets @code{EIND} to the segment
18144 where the vector table is located.
18145 @example
18146 #include <avr/io.h>
18147
18148 static void
18149 __attribute__((section(".init3"),naked,used,no_instrument_function))
18150 init3_set_eind (void)
18151 @{
18152 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18153 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18154 @}
18155 @end example
18156
18157 @noindent
18158 The @code{__trampolines_start} symbol is defined in the linker script.
18159
18160 @item
18161 Stubs are generated automatically by the linker if
18162 the following two conditions are met:
18163 @itemize @minus
18164
18165 @item The address of a label is taken by means of the @code{gs} modifier
18166 (short for @emph{generate stubs}) like so:
18167 @example
18168 LDI r24, lo8(gs(@var{func}))
18169 LDI r25, hi8(gs(@var{func}))
18170 @end example
18171 @item The final location of that label is in a code segment
18172 @emph{outside} the segment where the stubs are located.
18173 @end itemize
18174
18175 @item
18176 The compiler emits such @code{gs} modifiers for code labels in the
18177 following situations:
18178 @itemize @minus
18179 @item Taking address of a function or code label.
18180 @item Computed goto.
18181 @item If prologue-save function is used, see @option{-mcall-prologues}
18182 command-line option.
18183 @item Switch/case dispatch tables. If you do not want such dispatch
18184 tables you can specify the @option{-fno-jump-tables} command-line option.
18185 @item C and C++ constructors/destructors called during startup/shutdown.
18186 @item If the tools hit a @code{gs()} modifier explained above.
18187 @end itemize
18188
18189 @item
18190 Jumping to non-symbolic addresses like so is @emph{not} supported:
18191
18192 @example
18193 int main (void)
18194 @{
18195 /* Call function at word address 0x2 */
18196 return ((int(*)(void)) 0x2)();
18197 @}
18198 @end example
18199
18200 Instead, a stub has to be set up, i.e.@: the function has to be called
18201 through a symbol (@code{func_4} in the example):
18202
18203 @example
18204 int main (void)
18205 @{
18206 extern int func_4 (void);
18207
18208 /* Call function at byte address 0x4 */
18209 return func_4();
18210 @}
18211 @end example
18212
18213 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18214 Alternatively, @code{func_4} can be defined in the linker script.
18215 @end itemize
18216
18217 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18218 @cindex @code{RAMPD}
18219 @cindex @code{RAMPX}
18220 @cindex @code{RAMPY}
18221 @cindex @code{RAMPZ}
18222 Some AVR devices support memories larger than the 64@tie{}KiB range
18223 that can be accessed with 16-bit pointers. To access memory locations
18224 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18225 register is used as high part of the address:
18226 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18227 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18228 register, respectively, to get a wide address. Similarly,
18229 @code{RAMPD} is used together with direct addressing.
18230
18231 @itemize
18232 @item
18233 The startup code initializes the @code{RAMP} special function
18234 registers with zero.
18235
18236 @item
18237 If a @ref{AVR Named Address Spaces,named address space} other than
18238 generic or @code{__flash} is used, then @code{RAMPZ} is set
18239 as needed before the operation.
18240
18241 @item
18242 If the device supports RAM larger than 64@tie{}KiB and the compiler
18243 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18244 is reset to zero after the operation.
18245
18246 @item
18247 If the device comes with a specific @code{RAMP} register, the ISR
18248 prologue/epilogue saves/restores that SFR and initializes it with
18249 zero in case the ISR code might (implicitly) use it.
18250
18251 @item
18252 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18253 If you use inline assembler to read from locations outside the
18254 16-bit address range and change one of the @code{RAMP} registers,
18255 you must reset it to zero after the access.
18256
18257 @end itemize
18258
18259 @subsubsection AVR Built-in Macros
18260
18261 GCC defines several built-in macros so that the user code can test
18262 for the presence or absence of features. Almost any of the following
18263 built-in macros are deduced from device capabilities and thus
18264 triggered by the @option{-mmcu=} command-line option.
18265
18266 For even more AVR-specific built-in macros see
18267 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18268
18269 @table @code
18270
18271 @item __AVR_ARCH__
18272 Build-in macro that resolves to a decimal number that identifies the
18273 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18274 Possible values are:
18275
18276 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18277 @code{4}, @code{5}, @code{51}, @code{6}
18278
18279 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18280 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18281
18282 respectively and
18283
18284 @code{100},
18285 @code{102}, @code{103}, @code{104},
18286 @code{105}, @code{106}, @code{107}
18287
18288 for @var{mcu}=@code{avrtiny},
18289 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18290 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18291 If @var{mcu} specifies a device, this built-in macro is set
18292 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18293 defined to @code{4}.
18294
18295 @item __AVR_@var{Device}__
18296 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18297 the device's name. For example, @option{-mmcu=atmega8} defines the
18298 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18299 @code{__AVR_ATtiny261A__}, etc.
18300
18301 The built-in macros' names follow
18302 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18303 the device name as from the AVR user manual. The difference between
18304 @var{Device} in the built-in macro and @var{device} in
18305 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18306
18307 If @var{device} is not a device but only a core architecture like
18308 @samp{avr51}, this macro is not defined.
18309
18310 @item __AVR_DEVICE_NAME__
18311 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18312 the device's name. For example, with @option{-mmcu=atmega8} the macro
18313 is defined to @code{atmega8}.
18314
18315 If @var{device} is not a device but only a core architecture like
18316 @samp{avr51}, this macro is not defined.
18317
18318 @item __AVR_XMEGA__
18319 The device / architecture belongs to the XMEGA family of devices.
18320
18321 @item __AVR_HAVE_ELPM__
18322 The device has the @code{ELPM} instruction.
18323
18324 @item __AVR_HAVE_ELPMX__
18325 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18326 R@var{n},Z+} instructions.
18327
18328 @item __AVR_HAVE_MOVW__
18329 The device has the @code{MOVW} instruction to perform 16-bit
18330 register-register moves.
18331
18332 @item __AVR_HAVE_LPMX__
18333 The device has the @code{LPM R@var{n},Z} and
18334 @code{LPM R@var{n},Z+} instructions.
18335
18336 @item __AVR_HAVE_MUL__
18337 The device has a hardware multiplier.
18338
18339 @item __AVR_HAVE_JMP_CALL__
18340 The device has the @code{JMP} and @code{CALL} instructions.
18341 This is the case for devices with more than 8@tie{}KiB of program
18342 memory.
18343
18344 @item __AVR_HAVE_EIJMP_EICALL__
18345 @itemx __AVR_3_BYTE_PC__
18346 The device has the @code{EIJMP} and @code{EICALL} instructions.
18347 This is the case for devices with more than 128@tie{}KiB of program memory.
18348 This also means that the program counter
18349 (PC) is 3@tie{}bytes wide.
18350
18351 @item __AVR_2_BYTE_PC__
18352 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18353 with up to 128@tie{}KiB of program memory.
18354
18355 @item __AVR_HAVE_8BIT_SP__
18356 @itemx __AVR_HAVE_16BIT_SP__
18357 The stack pointer (SP) register is treated as 8-bit respectively
18358 16-bit register by the compiler.
18359 The definition of these macros is affected by @option{-mtiny-stack}.
18360
18361 @item __AVR_HAVE_SPH__
18362 @itemx __AVR_SP8__
18363 The device has the SPH (high part of stack pointer) special function
18364 register or has an 8-bit stack pointer, respectively.
18365 The definition of these macros is affected by @option{-mmcu=} and
18366 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18367 by @option{-msp8}.
18368
18369 @item __AVR_HAVE_RAMPD__
18370 @itemx __AVR_HAVE_RAMPX__
18371 @itemx __AVR_HAVE_RAMPY__
18372 @itemx __AVR_HAVE_RAMPZ__
18373 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18374 @code{RAMPZ} special function register, respectively.
18375
18376 @item __NO_INTERRUPTS__
18377 This macro reflects the @option{-mno-interrupts} command-line option.
18378
18379 @item __AVR_ERRATA_SKIP__
18380 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18381 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18382 instructions because of a hardware erratum. Skip instructions are
18383 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18384 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18385 set.
18386
18387 @item __AVR_ISA_RMW__
18388 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18389
18390 @item __AVR_SFR_OFFSET__=@var{offset}
18391 Instructions that can address I/O special function registers directly
18392 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18393 address as if addressed by an instruction to access RAM like @code{LD}
18394 or @code{STS}. This offset depends on the device architecture and has
18395 to be subtracted from the RAM address in order to get the
18396 respective I/O@tie{}address.
18397
18398 @item __AVR_SHORT_CALLS__
18399 The @option{-mshort-calls} command line option is set.
18400
18401 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18402 Some devices support reading from flash memory by means of @code{LD*}
18403 instructions. The flash memory is seen in the data address space
18404 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18405 is not defined, this feature is not available. If defined,
18406 the address space is linear and there is no need to put
18407 @code{.rodata} into RAM. This is handled by the default linker
18408 description file, and is currently available for
18409 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18410 there is no need to use address spaces like @code{__flash} or
18411 features like attribute @code{progmem} and @code{pgm_read_*}.
18412
18413 @item __WITH_AVRLIBC__
18414 The compiler is configured to be used together with AVR-Libc.
18415 See the @option{--with-avrlibc} configure option.
18416
18417 @end table
18418
18419 @node Blackfin Options
18420 @subsection Blackfin Options
18421 @cindex Blackfin Options
18422
18423 @table @gcctabopt
18424 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18425 @opindex mcpu=
18426 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18427 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18428 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18429 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18430 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18431 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18432 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18433 @samp{bf561}, @samp{bf592}.
18434
18435 The optional @var{sirevision} specifies the silicon revision of the target
18436 Blackfin processor. Any workarounds available for the targeted silicon revision
18437 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18438 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18439 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18440 hexadecimal digits representing the major and minor numbers in the silicon
18441 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18442 is not defined. If @var{sirevision} is @samp{any}, the
18443 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18444 If this optional @var{sirevision} is not used, GCC assumes the latest known
18445 silicon revision of the targeted Blackfin processor.
18446
18447 GCC defines a preprocessor macro for the specified @var{cpu}.
18448 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18449 provided by libgloss to be linked in if @option{-msim} is not given.
18450
18451 Without this option, @samp{bf532} is used as the processor by default.
18452
18453 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18454 only the preprocessor macro is defined.
18455
18456 @item -msim
18457 @opindex msim
18458 Specifies that the program will be run on the simulator. This causes
18459 the simulator BSP provided by libgloss to be linked in. This option
18460 has effect only for @samp{bfin-elf} toolchain.
18461 Certain other options, such as @option{-mid-shared-library} and
18462 @option{-mfdpic}, imply @option{-msim}.
18463
18464 @item -momit-leaf-frame-pointer
18465 @opindex momit-leaf-frame-pointer
18466 Don't keep the frame pointer in a register for leaf functions. This
18467 avoids the instructions to save, set up and restore frame pointers and
18468 makes an extra register available in leaf functions.
18469
18470 @item -mspecld-anomaly
18471 @opindex mspecld-anomaly
18472 When enabled, the compiler ensures that the generated code does not
18473 contain speculative loads after jump instructions. If this option is used,
18474 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18475
18476 @item -mno-specld-anomaly
18477 @opindex mno-specld-anomaly
18478 @opindex mspecld-anomaly
18479 Don't generate extra code to prevent speculative loads from occurring.
18480
18481 @item -mcsync-anomaly
18482 @opindex mcsync-anomaly
18483 When enabled, the compiler ensures that the generated code does not
18484 contain CSYNC or SSYNC instructions too soon after conditional branches.
18485 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18486
18487 @item -mno-csync-anomaly
18488 @opindex mno-csync-anomaly
18489 @opindex mcsync-anomaly
18490 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18491 occurring too soon after a conditional branch.
18492
18493 @item -mlow64k
18494 @opindex mlow64k
18495 When enabled, the compiler is free to take advantage of the knowledge that
18496 the entire program fits into the low 64k of memory.
18497
18498 @item -mno-low64k
18499 @opindex mno-low64k
18500 Assume that the program is arbitrarily large. This is the default.
18501
18502 @item -mstack-check-l1
18503 @opindex mstack-check-l1
18504 Do stack checking using information placed into L1 scratchpad memory by the
18505 uClinux kernel.
18506
18507 @item -mid-shared-library
18508 @opindex mid-shared-library
18509 Generate code that supports shared libraries via the library ID method.
18510 This allows for execute in place and shared libraries in an environment
18511 without virtual memory management. This option implies @option{-fPIC}.
18512 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18513
18514 @item -mno-id-shared-library
18515 @opindex mno-id-shared-library
18516 @opindex mid-shared-library
18517 Generate code that doesn't assume ID-based shared libraries are being used.
18518 This is the default.
18519
18520 @item -mleaf-id-shared-library
18521 @opindex mleaf-id-shared-library
18522 Generate code that supports shared libraries via the library ID method,
18523 but assumes that this library or executable won't link against any other
18524 ID shared libraries. That allows the compiler to use faster code for jumps
18525 and calls.
18526
18527 @item -mno-leaf-id-shared-library
18528 @opindex mno-leaf-id-shared-library
18529 @opindex mleaf-id-shared-library
18530 Do not assume that the code being compiled won't link against any ID shared
18531 libraries. Slower code is generated for jump and call insns.
18532
18533 @item -mshared-library-id=n
18534 @opindex mshared-library-id
18535 Specifies the identification number of the ID-based shared library being
18536 compiled. Specifying a value of 0 generates more compact code; specifying
18537 other values forces the allocation of that number to the current
18538 library but is no more space- or time-efficient than omitting this option.
18539
18540 @item -msep-data
18541 @opindex msep-data
18542 Generate code that allows the data segment to be located in a different
18543 area of memory from the text segment. This allows for execute in place in
18544 an environment without virtual memory management by eliminating relocations
18545 against the text section.
18546
18547 @item -mno-sep-data
18548 @opindex mno-sep-data
18549 @opindex msep-data
18550 Generate code that assumes that the data segment follows the text segment.
18551 This is the default.
18552
18553 @item -mlong-calls
18554 @itemx -mno-long-calls
18555 @opindex mlong-calls
18556 @opindex mno-long-calls
18557 Tells the compiler to perform function calls by first loading the
18558 address of the function into a register and then performing a subroutine
18559 call on this register. This switch is needed if the target function
18560 lies outside of the 24-bit addressing range of the offset-based
18561 version of subroutine call instruction.
18562
18563 This feature is not enabled by default. Specifying
18564 @option{-mno-long-calls} restores the default behavior. Note these
18565 switches have no effect on how the compiler generates code to handle
18566 function calls via function pointers.
18567
18568 @item -mfast-fp
18569 @opindex mfast-fp
18570 Link with the fast floating-point library. This library relaxes some of
18571 the IEEE floating-point standard's rules for checking inputs against
18572 Not-a-Number (NAN), in the interest of performance.
18573
18574 @item -minline-plt
18575 @opindex minline-plt
18576 Enable inlining of PLT entries in function calls to functions that are
18577 not known to bind locally. It has no effect without @option{-mfdpic}.
18578
18579 @item -mmulticore
18580 @opindex mmulticore
18581 Build a standalone application for multicore Blackfin processors.
18582 This option causes proper start files and link scripts supporting
18583 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18584 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18585
18586 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18587 selects the one-application-per-core programming model. Without
18588 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18589 programming model is used. In this model, the main function of Core B
18590 should be named as @code{coreb_main}.
18591
18592 If this option is not used, the single-core application programming
18593 model is used.
18594
18595 @item -mcorea
18596 @opindex mcorea
18597 Build a standalone application for Core A of BF561 when using
18598 the one-application-per-core programming model. Proper start files
18599 and link scripts are used to support Core A, and the macro
18600 @code{__BFIN_COREA} is defined.
18601 This option can only be used in conjunction with @option{-mmulticore}.
18602
18603 @item -mcoreb
18604 @opindex mcoreb
18605 Build a standalone application for Core B of BF561 when using
18606 the one-application-per-core programming model. Proper start files
18607 and link scripts are used to support Core B, and the macro
18608 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18609 should be used instead of @code{main}.
18610 This option can only be used in conjunction with @option{-mmulticore}.
18611
18612 @item -msdram
18613 @opindex msdram
18614 Build a standalone application for SDRAM. Proper start files and
18615 link scripts are used to put the application into SDRAM, and the macro
18616 @code{__BFIN_SDRAM} is defined.
18617 The loader should initialize SDRAM before loading the application.
18618
18619 @item -micplb
18620 @opindex micplb
18621 Assume that ICPLBs are enabled at run time. This has an effect on certain
18622 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18623 are enabled; for standalone applications the default is off.
18624 @end table
18625
18626 @node C6X Options
18627 @subsection C6X Options
18628 @cindex C6X Options
18629
18630 @table @gcctabopt
18631 @item -march=@var{name}
18632 @opindex march
18633 This specifies the name of the target architecture. GCC uses this
18634 name to determine what kind of instructions it can emit when generating
18635 assembly code. Permissible names are: @samp{c62x},
18636 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18637
18638 @item -mbig-endian
18639 @opindex mbig-endian
18640 Generate code for a big-endian target.
18641
18642 @item -mlittle-endian
18643 @opindex mlittle-endian
18644 Generate code for a little-endian target. This is the default.
18645
18646 @item -msim
18647 @opindex msim
18648 Choose startup files and linker script suitable for the simulator.
18649
18650 @item -msdata=default
18651 @opindex msdata=default
18652 Put small global and static data in the @code{.neardata} section,
18653 which is pointed to by register @code{B14}. Put small uninitialized
18654 global and static data in the @code{.bss} section, which is adjacent
18655 to the @code{.neardata} section. Put small read-only data into the
18656 @code{.rodata} section. The corresponding sections used for large
18657 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18658
18659 @item -msdata=all
18660 @opindex msdata=all
18661 Put all data, not just small objects, into the sections reserved for
18662 small data, and use addressing relative to the @code{B14} register to
18663 access them.
18664
18665 @item -msdata=none
18666 @opindex msdata=none
18667 Make no use of the sections reserved for small data, and use absolute
18668 addresses to access all data. Put all initialized global and static
18669 data in the @code{.fardata} section, and all uninitialized data in the
18670 @code{.far} section. Put all constant data into the @code{.const}
18671 section.
18672 @end table
18673
18674 @node CRIS Options
18675 @subsection CRIS Options
18676 @cindex CRIS Options
18677
18678 These options are defined specifically for the CRIS ports.
18679
18680 @table @gcctabopt
18681 @item -march=@var{architecture-type}
18682 @itemx -mcpu=@var{architecture-type}
18683 @opindex march
18684 @opindex mcpu
18685 Generate code for the specified architecture. The choices for
18686 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18687 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18688 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18689 @samp{v10}.
18690
18691 @item -mtune=@var{architecture-type}
18692 @opindex mtune
18693 Tune to @var{architecture-type} everything applicable about the generated
18694 code, except for the ABI and the set of available instructions. The
18695 choices for @var{architecture-type} are the same as for
18696 @option{-march=@var{architecture-type}}.
18697
18698 @item -mmax-stack-frame=@var{n}
18699 @opindex mmax-stack-frame
18700 Warn when the stack frame of a function exceeds @var{n} bytes.
18701
18702 @item -metrax4
18703 @itemx -metrax100
18704 @opindex metrax4
18705 @opindex metrax100
18706 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18707 @option{-march=v3} and @option{-march=v8} respectively.
18708
18709 @item -mmul-bug-workaround
18710 @itemx -mno-mul-bug-workaround
18711 @opindex mmul-bug-workaround
18712 @opindex mno-mul-bug-workaround
18713 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18714 models where it applies. This option is active by default.
18715
18716 @item -mpdebug
18717 @opindex mpdebug
18718 Enable CRIS-specific verbose debug-related information in the assembly
18719 code. This option also has the effect of turning off the @samp{#NO_APP}
18720 formatted-code indicator to the assembler at the beginning of the
18721 assembly file.
18722
18723 @item -mcc-init
18724 @opindex mcc-init
18725 Do not use condition-code results from previous instruction; always emit
18726 compare and test instructions before use of condition codes.
18727
18728 @item -mno-side-effects
18729 @opindex mno-side-effects
18730 @opindex mside-effects
18731 Do not emit instructions with side effects in addressing modes other than
18732 post-increment.
18733
18734 @item -mstack-align
18735 @itemx -mno-stack-align
18736 @itemx -mdata-align
18737 @itemx -mno-data-align
18738 @itemx -mconst-align
18739 @itemx -mno-const-align
18740 @opindex mstack-align
18741 @opindex mno-stack-align
18742 @opindex mdata-align
18743 @opindex mno-data-align
18744 @opindex mconst-align
18745 @opindex mno-const-align
18746 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18747 stack frame, individual data and constants to be aligned for the maximum
18748 single data access size for the chosen CPU model. The default is to
18749 arrange for 32-bit alignment. ABI details such as structure layout are
18750 not affected by these options.
18751
18752 @item -m32-bit
18753 @itemx -m16-bit
18754 @itemx -m8-bit
18755 @opindex m32-bit
18756 @opindex m16-bit
18757 @opindex m8-bit
18758 Similar to the stack- data- and const-align options above, these options
18759 arrange for stack frame, writable data and constants to all be 32-bit,
18760 16-bit or 8-bit aligned. The default is 32-bit alignment.
18761
18762 @item -mno-prologue-epilogue
18763 @itemx -mprologue-epilogue
18764 @opindex mno-prologue-epilogue
18765 @opindex mprologue-epilogue
18766 With @option{-mno-prologue-epilogue}, the normal function prologue and
18767 epilogue which set up the stack frame are omitted and no return
18768 instructions or return sequences are generated in the code. Use this
18769 option only together with visual inspection of the compiled code: no
18770 warnings or errors are generated when call-saved registers must be saved,
18771 or storage for local variables needs to be allocated.
18772
18773 @item -mno-gotplt
18774 @itemx -mgotplt
18775 @opindex mno-gotplt
18776 @opindex mgotplt
18777 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18778 instruction sequences that load addresses for functions from the PLT part
18779 of the GOT rather than (traditional on other architectures) calls to the
18780 PLT@. The default is @option{-mgotplt}.
18781
18782 @item -melf
18783 @opindex melf
18784 Legacy no-op option only recognized with the cris-axis-elf and
18785 cris-axis-linux-gnu targets.
18786
18787 @item -mlinux
18788 @opindex mlinux
18789 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18790
18791 @item -sim
18792 @opindex sim
18793 This option, recognized for the cris-axis-elf, arranges
18794 to link with input-output functions from a simulator library. Code,
18795 initialized data and zero-initialized data are allocated consecutively.
18796
18797 @item -sim2
18798 @opindex sim2
18799 Like @option{-sim}, but pass linker options to locate initialized data at
18800 0x40000000 and zero-initialized data at 0x80000000.
18801 @end table
18802
18803 @node CR16 Options
18804 @subsection CR16 Options
18805 @cindex CR16 Options
18806
18807 These options are defined specifically for the CR16 ports.
18808
18809 @table @gcctabopt
18810
18811 @item -mmac
18812 @opindex mmac
18813 Enable the use of multiply-accumulate instructions. Disabled by default.
18814
18815 @item -mcr16cplus
18816 @itemx -mcr16c
18817 @opindex mcr16cplus
18818 @opindex mcr16c
18819 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18820 is default.
18821
18822 @item -msim
18823 @opindex msim
18824 Links the library libsim.a which is in compatible with simulator. Applicable
18825 to ELF compiler only.
18826
18827 @item -mint32
18828 @opindex mint32
18829 Choose integer type as 32-bit wide.
18830
18831 @item -mbit-ops
18832 @opindex mbit-ops
18833 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18834
18835 @item -mdata-model=@var{model}
18836 @opindex mdata-model
18837 Choose a data model. The choices for @var{model} are @samp{near},
18838 @samp{far} or @samp{medium}. @samp{medium} is default.
18839 However, @samp{far} is not valid with @option{-mcr16c}, as the
18840 CR16C architecture does not support the far data model.
18841 @end table
18842
18843 @node C-SKY Options
18844 @subsection C-SKY Options
18845 @cindex C-SKY Options
18846
18847 GCC supports these options when compiling for C-SKY V2 processors.
18848
18849 @table @gcctabopt
18850
18851 @item -march=@var{arch}
18852 @opindex march=
18853 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18854 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18855 The default is @samp{ck810}.
18856
18857 @item -mcpu=@var{cpu}
18858 @opindex mcpu=
18859 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18860 @samp{ck801}, @samp{ck801t},
18861 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18862 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18863 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18864 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18865 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18866 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18867 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18868 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18869 @samp{ck803eftr1}, @samp{ck803efhtr1},
18870 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18871 @samp{ck803sef}, @samp{ck803seft},
18872 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18873 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18874 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18875 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18876
18877 @item -mbig-endian
18878 @opindex mbig-endian
18879 @itemx -EB
18880 @opindex EB
18881 @itemx -mlittle-endian
18882 @opindex mlittle-endian
18883 @itemx -EL
18884 @opindex EL
18885
18886 Select big- or little-endian code. The default is little-endian.
18887
18888 @item -mhard-float
18889 @opindex mhard-float
18890 @itemx -msoft-float
18891 @opindex msoft-float
18892
18893 Select hardware or software floating-point implementations.
18894 The default is soft float.
18895
18896 @item -mdouble-float
18897 @itemx -mno-double-float
18898 @opindex mdouble-float
18899 When @option{-mhard-float} is in effect, enable generation of
18900 double-precision float instructions. This is the default except
18901 when compiling for CK803.
18902
18903 @item -mfdivdu
18904 @itemx -mno-fdivdu
18905 @opindex mfdivdu
18906 When @option{-mhard-float} is in effect, enable generation of
18907 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18908 This is the default except when compiling for CK803.
18909
18910 @item -mfpu=@var{fpu}
18911 @opindex mfpu=
18912 Select the floating-point processor. This option can only be used with
18913 @option{-mhard-float}.
18914 Values for @var{fpu} are
18915 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18916 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18917 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18918
18919 @item -melrw
18920 @itemx -mno-elrw
18921 @opindex melrw
18922 Enable the extended @code{lrw} instruction. This option defaults to on
18923 for CK801 and off otherwise.
18924
18925 @item -mistack
18926 @itemx -mno-istack
18927 @opindex mistack
18928 Enable interrupt stack instructions; the default is off.
18929
18930 The @option{-mistack} option is required to handle the
18931 @code{interrupt} and @code{isr} function attributes
18932 (@pxref{C-SKY Function Attributes}).
18933
18934 @item -mmp
18935 @opindex mmp
18936 Enable multiprocessor instructions; the default is off.
18937
18938 @item -mcp
18939 @opindex mcp
18940 Enable coprocessor instructions; the default is off.
18941
18942 @item -mcache
18943 @opindex mcache
18944 Enable coprocessor instructions; the default is off.
18945
18946 @item -msecurity
18947 @opindex msecurity
18948 Enable C-SKY security instructions; the default is off.
18949
18950 @item -mtrust
18951 @opindex mtrust
18952 Enable C-SKY trust instructions; the default is off.
18953
18954 @item -mdsp
18955 @opindex mdsp
18956 @itemx -medsp
18957 @opindex medsp
18958 @itemx -mvdsp
18959 @opindex mvdsp
18960 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18961 All of these options default to off.
18962
18963 @item -mdiv
18964 @itemx -mno-div
18965 @opindex mdiv
18966 Generate divide instructions. Default is off.
18967
18968 @item -msmart
18969 @itemx -mno-smart
18970 @opindex msmart
18971 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18972 use of 16-bit instructions. This option is ignored for CK801 where this
18973 is the required behavior, and it defaults to on for CK802.
18974 For other targets, the default is off.
18975
18976 @item -mhigh-registers
18977 @itemx -mno-high-registers
18978 @opindex mhigh-registers
18979 Generate code using the high registers numbered 16-31. This option
18980 is not supported on CK801, CK802, or CK803, and is enabled by default
18981 for other processors.
18982
18983 @item -manchor
18984 @itemx -mno-anchor
18985 @opindex manchor
18986 Generate code using global anchor symbol addresses.
18987
18988 @item -mpushpop
18989 @itemx -mno-pushpop
18990 @opindex mpushpop
18991 Generate code using @code{push} and @code{pop} instructions. This option
18992 defaults to on.
18993
18994 @item -mmultiple-stld
18995 @itemx -mstm
18996 @itemx -mno-multiple-stld
18997 @itemx -mno-stm
18998 @opindex mmultiple-stld
18999 Generate code using @code{stm} and @code{ldm} instructions. This option
19000 isn't supported on CK801 but is enabled by default on other processors.
19001
19002 @item -mconstpool
19003 @itemx -mno-constpool
19004 @opindex mconstpool
19005 Create constant pools in the compiler instead of deferring it to the
19006 assembler. This option is the default and required for correct code
19007 generation on CK801 and CK802, and is optional on other processors.
19008
19009 @item -mstack-size
19010 @item -mno-stack-size
19011 @opindex mstack-size
19012 Emit @code{.stack_size} directives for each function in the assembly
19013 output. This option defaults to off.
19014
19015 @item -mccrt
19016 @itemx -mno-ccrt
19017 @opindex mccrt
19018 Generate code for the C-SKY compiler runtime instead of libgcc. This
19019 option defaults to off.
19020
19021 @item -mbranch-cost=@var{n}
19022 @opindex mbranch-cost=
19023 Set the branch costs to roughly @code{n} instructions. The default is 1.
19024
19025 @item -msched-prolog
19026 @itemx -mno-sched-prolog
19027 @opindex msched-prolog
19028 Permit scheduling of function prologue and epilogue sequences. Using
19029 this option can result in code that is not compliant with the C-SKY V2 ABI
19030 prologue requirements and that cannot be debugged or backtraced.
19031 It is disabled by default.
19032
19033 @end table
19034
19035 @node Darwin Options
19036 @subsection Darwin Options
19037 @cindex Darwin options
19038
19039 These options are defined for all architectures running the Darwin operating
19040 system.
19041
19042 FSF GCC on Darwin does not create ``fat'' object files; it creates
19043 an object file for the single architecture that GCC was built to
19044 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19045 @option{-arch} options are used; it does so by running the compiler or
19046 linker multiple times and joining the results together with
19047 @file{lipo}.
19048
19049 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19050 @samp{i686}) is determined by the flags that specify the ISA
19051 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19052 @option{-force_cpusubtype_ALL} option can be used to override this.
19053
19054 The Darwin tools vary in their behavior when presented with an ISA
19055 mismatch. The assembler, @file{as}, only permits instructions to
19056 be used that are valid for the subtype of the file it is generating,
19057 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19058 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19059 and prints an error if asked to create a shared library with a less
19060 restrictive subtype than its input files (for instance, trying to put
19061 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19062 for executables, @command{ld}, quietly gives the executable the most
19063 restrictive subtype of any of its input files.
19064
19065 @table @gcctabopt
19066 @item -F@var{dir}
19067 @opindex F
19068 Add the framework directory @var{dir} to the head of the list of
19069 directories to be searched for header files. These directories are
19070 interleaved with those specified by @option{-I} options and are
19071 scanned in a left-to-right order.
19072
19073 A framework directory is a directory with frameworks in it. A
19074 framework is a directory with a @file{Headers} and/or
19075 @file{PrivateHeaders} directory contained directly in it that ends
19076 in @file{.framework}. The name of a framework is the name of this
19077 directory excluding the @file{.framework}. Headers associated with
19078 the framework are found in one of those two directories, with
19079 @file{Headers} being searched first. A subframework is a framework
19080 directory that is in a framework's @file{Frameworks} directory.
19081 Includes of subframework headers can only appear in a header of a
19082 framework that contains the subframework, or in a sibling subframework
19083 header. Two subframeworks are siblings if they occur in the same
19084 framework. A subframework should not have the same name as a
19085 framework; a warning is issued if this is violated. Currently a
19086 subframework cannot have subframeworks; in the future, the mechanism
19087 may be extended to support this. The standard frameworks can be found
19088 in @file{/System/Library/Frameworks} and
19089 @file{/Library/Frameworks}. An example include looks like
19090 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19091 the name of the framework and @file{header.h} is found in the
19092 @file{PrivateHeaders} or @file{Headers} directory.
19093
19094 @item -iframework@var{dir}
19095 @opindex iframework
19096 Like @option{-F} except the directory is a treated as a system
19097 directory. The main difference between this @option{-iframework} and
19098 @option{-F} is that with @option{-iframework} the compiler does not
19099 warn about constructs contained within header files found via
19100 @var{dir}. This option is valid only for the C family of languages.
19101
19102 @item -gused
19103 @opindex gused
19104 Emit debugging information for symbols that are used. For stabs
19105 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19106 This is by default ON@.
19107
19108 @item -gfull
19109 @opindex gfull
19110 Emit debugging information for all symbols and types.
19111
19112 @item -mmacosx-version-min=@var{version}
19113 The earliest version of MacOS X that this executable will run on
19114 is @var{version}. Typical values of @var{version} include @code{10.1},
19115 @code{10.2}, and @code{10.3.9}.
19116
19117 If the compiler was built to use the system's headers by default,
19118 then the default for this option is the system version on which the
19119 compiler is running, otherwise the default is to make choices that
19120 are compatible with as many systems and code bases as possible.
19121
19122 @item -mkernel
19123 @opindex mkernel
19124 Enable kernel development mode. The @option{-mkernel} option sets
19125 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19126 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19127 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19128 applicable. This mode also sets @option{-mno-altivec},
19129 @option{-msoft-float}, @option{-fno-builtin} and
19130 @option{-mlong-branch} for PowerPC targets.
19131
19132 @item -mone-byte-bool
19133 @opindex mone-byte-bool
19134 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19135 By default @code{sizeof(bool)} is @code{4} when compiling for
19136 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19137 option has no effect on x86.
19138
19139 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19140 to generate code that is not binary compatible with code generated
19141 without that switch. Using this switch may require recompiling all
19142 other modules in a program, including system libraries. Use this
19143 switch to conform to a non-default data model.
19144
19145 @item -mfix-and-continue
19146 @itemx -ffix-and-continue
19147 @itemx -findirect-data
19148 @opindex mfix-and-continue
19149 @opindex ffix-and-continue
19150 @opindex findirect-data
19151 Generate code suitable for fast turnaround development, such as to
19152 allow GDB to dynamically load @file{.o} files into already-running
19153 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19154 are provided for backwards compatibility.
19155
19156 @item -all_load
19157 @opindex all_load
19158 Loads all members of static archive libraries.
19159 See man ld(1) for more information.
19160
19161 @item -arch_errors_fatal
19162 @opindex arch_errors_fatal
19163 Cause the errors having to do with files that have the wrong architecture
19164 to be fatal.
19165
19166 @item -bind_at_load
19167 @opindex bind_at_load
19168 Causes the output file to be marked such that the dynamic linker will
19169 bind all undefined references when the file is loaded or launched.
19170
19171 @item -bundle
19172 @opindex bundle
19173 Produce a Mach-o bundle format file.
19174 See man ld(1) for more information.
19175
19176 @item -bundle_loader @var{executable}
19177 @opindex bundle_loader
19178 This option specifies the @var{executable} that will load the build
19179 output file being linked. See man ld(1) for more information.
19180
19181 @item -dynamiclib
19182 @opindex dynamiclib
19183 When passed this option, GCC produces a dynamic library instead of
19184 an executable when linking, using the Darwin @file{libtool} command.
19185
19186 @item -force_cpusubtype_ALL
19187 @opindex force_cpusubtype_ALL
19188 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19189 one controlled by the @option{-mcpu} or @option{-march} option.
19190
19191 @item -allowable_client @var{client_name}
19192 @itemx -client_name
19193 @itemx -compatibility_version
19194 @itemx -current_version
19195 @itemx -dead_strip
19196 @itemx -dependency-file
19197 @itemx -dylib_file
19198 @itemx -dylinker_install_name
19199 @itemx -dynamic
19200 @itemx -exported_symbols_list
19201 @itemx -filelist
19202 @need 800
19203 @itemx -flat_namespace
19204 @itemx -force_flat_namespace
19205 @itemx -headerpad_max_install_names
19206 @itemx -image_base
19207 @itemx -init
19208 @itemx -install_name
19209 @itemx -keep_private_externs
19210 @itemx -multi_module
19211 @itemx -multiply_defined
19212 @itemx -multiply_defined_unused
19213 @need 800
19214 @itemx -noall_load
19215 @itemx -no_dead_strip_inits_and_terms
19216 @itemx -nofixprebinding
19217 @itemx -nomultidefs
19218 @itemx -noprebind
19219 @itemx -noseglinkedit
19220 @itemx -pagezero_size
19221 @itemx -prebind
19222 @itemx -prebind_all_twolevel_modules
19223 @itemx -private_bundle
19224 @need 800
19225 @itemx -read_only_relocs
19226 @itemx -sectalign
19227 @itemx -sectobjectsymbols
19228 @itemx -whyload
19229 @itemx -seg1addr
19230 @itemx -sectcreate
19231 @itemx -sectobjectsymbols
19232 @itemx -sectorder
19233 @itemx -segaddr
19234 @itemx -segs_read_only_addr
19235 @need 800
19236 @itemx -segs_read_write_addr
19237 @itemx -seg_addr_table
19238 @itemx -seg_addr_table_filename
19239 @itemx -seglinkedit
19240 @itemx -segprot
19241 @itemx -segs_read_only_addr
19242 @itemx -segs_read_write_addr
19243 @itemx -single_module
19244 @itemx -static
19245 @itemx -sub_library
19246 @need 800
19247 @itemx -sub_umbrella
19248 @itemx -twolevel_namespace
19249 @itemx -umbrella
19250 @itemx -undefined
19251 @itemx -unexported_symbols_list
19252 @itemx -weak_reference_mismatches
19253 @itemx -whatsloaded
19254 @opindex allowable_client
19255 @opindex client_name
19256 @opindex compatibility_version
19257 @opindex current_version
19258 @opindex dead_strip
19259 @opindex dependency-file
19260 @opindex dylib_file
19261 @opindex dylinker_install_name
19262 @opindex dynamic
19263 @opindex exported_symbols_list
19264 @opindex filelist
19265 @opindex flat_namespace
19266 @opindex force_flat_namespace
19267 @opindex headerpad_max_install_names
19268 @opindex image_base
19269 @opindex init
19270 @opindex install_name
19271 @opindex keep_private_externs
19272 @opindex multi_module
19273 @opindex multiply_defined
19274 @opindex multiply_defined_unused
19275 @opindex noall_load
19276 @opindex no_dead_strip_inits_and_terms
19277 @opindex nofixprebinding
19278 @opindex nomultidefs
19279 @opindex noprebind
19280 @opindex noseglinkedit
19281 @opindex pagezero_size
19282 @opindex prebind
19283 @opindex prebind_all_twolevel_modules
19284 @opindex private_bundle
19285 @opindex read_only_relocs
19286 @opindex sectalign
19287 @opindex sectobjectsymbols
19288 @opindex whyload
19289 @opindex seg1addr
19290 @opindex sectcreate
19291 @opindex sectobjectsymbols
19292 @opindex sectorder
19293 @opindex segaddr
19294 @opindex segs_read_only_addr
19295 @opindex segs_read_write_addr
19296 @opindex seg_addr_table
19297 @opindex seg_addr_table_filename
19298 @opindex seglinkedit
19299 @opindex segprot
19300 @opindex segs_read_only_addr
19301 @opindex segs_read_write_addr
19302 @opindex single_module
19303 @opindex static
19304 @opindex sub_library
19305 @opindex sub_umbrella
19306 @opindex twolevel_namespace
19307 @opindex umbrella
19308 @opindex undefined
19309 @opindex unexported_symbols_list
19310 @opindex weak_reference_mismatches
19311 @opindex whatsloaded
19312 These options are passed to the Darwin linker. The Darwin linker man page
19313 describes them in detail.
19314 @end table
19315
19316 @node DEC Alpha Options
19317 @subsection DEC Alpha Options
19318
19319 These @samp{-m} options are defined for the DEC Alpha implementations:
19320
19321 @table @gcctabopt
19322 @item -mno-soft-float
19323 @itemx -msoft-float
19324 @opindex mno-soft-float
19325 @opindex msoft-float
19326 Use (do not use) the hardware floating-point instructions for
19327 floating-point operations. When @option{-msoft-float} is specified,
19328 functions in @file{libgcc.a} are used to perform floating-point
19329 operations. Unless they are replaced by routines that emulate the
19330 floating-point operations, or compiled in such a way as to call such
19331 emulations routines, these routines issue floating-point
19332 operations. If you are compiling for an Alpha without floating-point
19333 operations, you must ensure that the library is built so as not to call
19334 them.
19335
19336 Note that Alpha implementations without floating-point operations are
19337 required to have floating-point registers.
19338
19339 @item -mfp-reg
19340 @itemx -mno-fp-regs
19341 @opindex mfp-reg
19342 @opindex mno-fp-regs
19343 Generate code that uses (does not use) the floating-point register set.
19344 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19345 register set is not used, floating-point operands are passed in integer
19346 registers as if they were integers and floating-point results are passed
19347 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19348 so any function with a floating-point argument or return value called by code
19349 compiled with @option{-mno-fp-regs} must also be compiled with that
19350 option.
19351
19352 A typical use of this option is building a kernel that does not use,
19353 and hence need not save and restore, any floating-point registers.
19354
19355 @item -mieee
19356 @opindex mieee
19357 The Alpha architecture implements floating-point hardware optimized for
19358 maximum performance. It is mostly compliant with the IEEE floating-point
19359 standard. However, for full compliance, software assistance is
19360 required. This option generates code fully IEEE-compliant code
19361 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19362 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19363 defined during compilation. The resulting code is less efficient but is
19364 able to correctly support denormalized numbers and exceptional IEEE
19365 values such as not-a-number and plus/minus infinity. Other Alpha
19366 compilers call this option @option{-ieee_with_no_inexact}.
19367
19368 @item -mieee-with-inexact
19369 @opindex mieee-with-inexact
19370 This is like @option{-mieee} except the generated code also maintains
19371 the IEEE @var{inexact-flag}. Turning on this option causes the
19372 generated code to implement fully-compliant IEEE math. In addition to
19373 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19374 macro. On some Alpha implementations the resulting code may execute
19375 significantly slower than the code generated by default. Since there is
19376 very little code that depends on the @var{inexact-flag}, you should
19377 normally not specify this option. Other Alpha compilers call this
19378 option @option{-ieee_with_inexact}.
19379
19380 @item -mfp-trap-mode=@var{trap-mode}
19381 @opindex mfp-trap-mode
19382 This option controls what floating-point related traps are enabled.
19383 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19384 The trap mode can be set to one of four values:
19385
19386 @table @samp
19387 @item n
19388 This is the default (normal) setting. The only traps that are enabled
19389 are the ones that cannot be disabled in software (e.g., division by zero
19390 trap).
19391
19392 @item u
19393 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19394 as well.
19395
19396 @item su
19397 Like @samp{u}, but the instructions are marked to be safe for software
19398 completion (see Alpha architecture manual for details).
19399
19400 @item sui
19401 Like @samp{su}, but inexact traps are enabled as well.
19402 @end table
19403
19404 @item -mfp-rounding-mode=@var{rounding-mode}
19405 @opindex mfp-rounding-mode
19406 Selects the IEEE rounding mode. Other Alpha compilers call this option
19407 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19408 of:
19409
19410 @table @samp
19411 @item n
19412 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19413 the nearest machine number or towards the even machine number in case
19414 of a tie.
19415
19416 @item m
19417 Round towards minus infinity.
19418
19419 @item c
19420 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19421
19422 @item d
19423 Dynamic rounding mode. A field in the floating-point control register
19424 (@var{fpcr}, see Alpha architecture reference manual) controls the
19425 rounding mode in effect. The C library initializes this register for
19426 rounding towards plus infinity. Thus, unless your program modifies the
19427 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19428 @end table
19429
19430 @item -mtrap-precision=@var{trap-precision}
19431 @opindex mtrap-precision
19432 In the Alpha architecture, floating-point traps are imprecise. This
19433 means without software assistance it is impossible to recover from a
19434 floating trap and program execution normally needs to be terminated.
19435 GCC can generate code that can assist operating system trap handlers
19436 in determining the exact location that caused a floating-point trap.
19437 Depending on the requirements of an application, different levels of
19438 precisions can be selected:
19439
19440 @table @samp
19441 @item p
19442 Program precision. This option is the default and means a trap handler
19443 can only identify which program caused a floating-point exception.
19444
19445 @item f
19446 Function precision. The trap handler can determine the function that
19447 caused a floating-point exception.
19448
19449 @item i
19450 Instruction precision. The trap handler can determine the exact
19451 instruction that caused a floating-point exception.
19452 @end table
19453
19454 Other Alpha compilers provide the equivalent options called
19455 @option{-scope_safe} and @option{-resumption_safe}.
19456
19457 @item -mieee-conformant
19458 @opindex mieee-conformant
19459 This option marks the generated code as IEEE conformant. You must not
19460 use this option unless you also specify @option{-mtrap-precision=i} and either
19461 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19462 is to emit the line @samp{.eflag 48} in the function prologue of the
19463 generated assembly file.
19464
19465 @item -mbuild-constants
19466 @opindex mbuild-constants
19467 Normally GCC examines a 32- or 64-bit integer constant to
19468 see if it can construct it from smaller constants in two or three
19469 instructions. If it cannot, it outputs the constant as a literal and
19470 generates code to load it from the data segment at run time.
19471
19472 Use this option to require GCC to construct @emph{all} integer constants
19473 using code, even if it takes more instructions (the maximum is six).
19474
19475 You typically use this option to build a shared library dynamic
19476 loader. Itself a shared library, it must relocate itself in memory
19477 before it can find the variables and constants in its own data segment.
19478
19479 @item -mbwx
19480 @itemx -mno-bwx
19481 @itemx -mcix
19482 @itemx -mno-cix
19483 @itemx -mfix
19484 @itemx -mno-fix
19485 @itemx -mmax
19486 @itemx -mno-max
19487 @opindex mbwx
19488 @opindex mno-bwx
19489 @opindex mcix
19490 @opindex mno-cix
19491 @opindex mfix
19492 @opindex mno-fix
19493 @opindex mmax
19494 @opindex mno-max
19495 Indicate whether GCC should generate code to use the optional BWX,
19496 CIX, FIX and MAX instruction sets. The default is to use the instruction
19497 sets supported by the CPU type specified via @option{-mcpu=} option or that
19498 of the CPU on which GCC was built if none is specified.
19499
19500 @item -mfloat-vax
19501 @itemx -mfloat-ieee
19502 @opindex mfloat-vax
19503 @opindex mfloat-ieee
19504 Generate code that uses (does not use) VAX F and G floating-point
19505 arithmetic instead of IEEE single and double precision.
19506
19507 @item -mexplicit-relocs
19508 @itemx -mno-explicit-relocs
19509 @opindex mexplicit-relocs
19510 @opindex mno-explicit-relocs
19511 Older Alpha assemblers provided no way to generate symbol relocations
19512 except via assembler macros. Use of these macros does not allow
19513 optimal instruction scheduling. GNU binutils as of version 2.12
19514 supports a new syntax that allows the compiler to explicitly mark
19515 which relocations should apply to which instructions. This option
19516 is mostly useful for debugging, as GCC detects the capabilities of
19517 the assembler when it is built and sets the default accordingly.
19518
19519 @item -msmall-data
19520 @itemx -mlarge-data
19521 @opindex msmall-data
19522 @opindex mlarge-data
19523 When @option{-mexplicit-relocs} is in effect, static data is
19524 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19525 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19526 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19527 16-bit relocations off of the @code{$gp} register. This limits the
19528 size of the small data area to 64KB, but allows the variables to be
19529 directly accessed via a single instruction.
19530
19531 The default is @option{-mlarge-data}. With this option the data area
19532 is limited to just below 2GB@. Programs that require more than 2GB of
19533 data must use @code{malloc} or @code{mmap} to allocate the data in the
19534 heap instead of in the program's data segment.
19535
19536 When generating code for shared libraries, @option{-fpic} implies
19537 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19538
19539 @item -msmall-text
19540 @itemx -mlarge-text
19541 @opindex msmall-text
19542 @opindex mlarge-text
19543 When @option{-msmall-text} is used, the compiler assumes that the
19544 code of the entire program (or shared library) fits in 4MB, and is
19545 thus reachable with a branch instruction. When @option{-msmall-data}
19546 is used, the compiler can assume that all local symbols share the
19547 same @code{$gp} value, and thus reduce the number of instructions
19548 required for a function call from 4 to 1.
19549
19550 The default is @option{-mlarge-text}.
19551
19552 @item -mcpu=@var{cpu_type}
19553 @opindex mcpu
19554 Set the instruction set and instruction scheduling parameters for
19555 machine type @var{cpu_type}. You can specify either the @samp{EV}
19556 style name or the corresponding chip number. GCC supports scheduling
19557 parameters for the EV4, EV5 and EV6 family of processors and
19558 chooses the default values for the instruction set from the processor
19559 you specify. If you do not specify a processor type, GCC defaults
19560 to the processor on which the compiler was built.
19561
19562 Supported values for @var{cpu_type} are
19563
19564 @table @samp
19565 @item ev4
19566 @itemx ev45
19567 @itemx 21064
19568 Schedules as an EV4 and has no instruction set extensions.
19569
19570 @item ev5
19571 @itemx 21164
19572 Schedules as an EV5 and has no instruction set extensions.
19573
19574 @item ev56
19575 @itemx 21164a
19576 Schedules as an EV5 and supports the BWX extension.
19577
19578 @item pca56
19579 @itemx 21164pc
19580 @itemx 21164PC
19581 Schedules as an EV5 and supports the BWX and MAX extensions.
19582
19583 @item ev6
19584 @itemx 21264
19585 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19586
19587 @item ev67
19588 @itemx 21264a
19589 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19590 @end table
19591
19592 Native toolchains also support the value @samp{native},
19593 which selects the best architecture option for the host processor.
19594 @option{-mcpu=native} has no effect if GCC does not recognize
19595 the processor.
19596
19597 @item -mtune=@var{cpu_type}
19598 @opindex mtune
19599 Set only the instruction scheduling parameters for machine type
19600 @var{cpu_type}. The instruction set is not changed.
19601
19602 Native toolchains also support the value @samp{native},
19603 which selects the best architecture option for the host processor.
19604 @option{-mtune=native} has no effect if GCC does not recognize
19605 the processor.
19606
19607 @item -mmemory-latency=@var{time}
19608 @opindex mmemory-latency
19609 Sets the latency the scheduler should assume for typical memory
19610 references as seen by the application. This number is highly
19611 dependent on the memory access patterns used by the application
19612 and the size of the external cache on the machine.
19613
19614 Valid options for @var{time} are
19615
19616 @table @samp
19617 @item @var{number}
19618 A decimal number representing clock cycles.
19619
19620 @item L1
19621 @itemx L2
19622 @itemx L3
19623 @itemx main
19624 The compiler contains estimates of the number of clock cycles for
19625 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19626 (also called Dcache, Scache, and Bcache), as well as to main memory.
19627 Note that L3 is only valid for EV5.
19628
19629 @end table
19630 @end table
19631
19632 @node FR30 Options
19633 @subsection FR30 Options
19634 @cindex FR30 Options
19635
19636 These options are defined specifically for the FR30 port.
19637
19638 @table @gcctabopt
19639
19640 @item -msmall-model
19641 @opindex msmall-model
19642 Use the small address space model. This can produce smaller code, but
19643 it does assume that all symbolic values and addresses fit into a
19644 20-bit range.
19645
19646 @item -mno-lsim
19647 @opindex mno-lsim
19648 Assume that runtime support has been provided and so there is no need
19649 to include the simulator library (@file{libsim.a}) on the linker
19650 command line.
19651
19652 @end table
19653
19654 @node FT32 Options
19655 @subsection FT32 Options
19656 @cindex FT32 Options
19657
19658 These options are defined specifically for the FT32 port.
19659
19660 @table @gcctabopt
19661
19662 @item -msim
19663 @opindex msim
19664 Specifies that the program will be run on the simulator. This causes
19665 an alternate runtime startup and library to be linked.
19666 You must not use this option when generating programs that will run on
19667 real hardware; you must provide your own runtime library for whatever
19668 I/O functions are needed.
19669
19670 @item -mlra
19671 @opindex mlra
19672 Enable Local Register Allocation. This is still experimental for FT32,
19673 so by default the compiler uses standard reload.
19674
19675 @item -mnodiv
19676 @opindex mnodiv
19677 Do not use div and mod instructions.
19678
19679 @item -mft32b
19680 @opindex mft32b
19681 Enable use of the extended instructions of the FT32B processor.
19682
19683 @item -mcompress
19684 @opindex mcompress
19685 Compress all code using the Ft32B code compression scheme.
19686
19687 @item -mnopm
19688 @opindex mnopm
19689 Do not generate code that reads program memory.
19690
19691 @end table
19692
19693 @node FRV Options
19694 @subsection FRV Options
19695 @cindex FRV Options
19696
19697 @table @gcctabopt
19698 @item -mgpr-32
19699 @opindex mgpr-32
19700
19701 Only use the first 32 general-purpose registers.
19702
19703 @item -mgpr-64
19704 @opindex mgpr-64
19705
19706 Use all 64 general-purpose registers.
19707
19708 @item -mfpr-32
19709 @opindex mfpr-32
19710
19711 Use only the first 32 floating-point registers.
19712
19713 @item -mfpr-64
19714 @opindex mfpr-64
19715
19716 Use all 64 floating-point registers.
19717
19718 @item -mhard-float
19719 @opindex mhard-float
19720
19721 Use hardware instructions for floating-point operations.
19722
19723 @item -msoft-float
19724 @opindex msoft-float
19725
19726 Use library routines for floating-point operations.
19727
19728 @item -malloc-cc
19729 @opindex malloc-cc
19730
19731 Dynamically allocate condition code registers.
19732
19733 @item -mfixed-cc
19734 @opindex mfixed-cc
19735
19736 Do not try to dynamically allocate condition code registers, only
19737 use @code{icc0} and @code{fcc0}.
19738
19739 @item -mdword
19740 @opindex mdword
19741
19742 Change ABI to use double word insns.
19743
19744 @item -mno-dword
19745 @opindex mno-dword
19746 @opindex mdword
19747
19748 Do not use double word instructions.
19749
19750 @item -mdouble
19751 @opindex mdouble
19752
19753 Use floating-point double instructions.
19754
19755 @item -mno-double
19756 @opindex mno-double
19757
19758 Do not use floating-point double instructions.
19759
19760 @item -mmedia
19761 @opindex mmedia
19762
19763 Use media instructions.
19764
19765 @item -mno-media
19766 @opindex mno-media
19767
19768 Do not use media instructions.
19769
19770 @item -mmuladd
19771 @opindex mmuladd
19772
19773 Use multiply and add/subtract instructions.
19774
19775 @item -mno-muladd
19776 @opindex mno-muladd
19777
19778 Do not use multiply and add/subtract instructions.
19779
19780 @item -mfdpic
19781 @opindex mfdpic
19782
19783 Select the FDPIC ABI, which uses function descriptors to represent
19784 pointers to functions. Without any PIC/PIE-related options, it
19785 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19786 assumes GOT entries and small data are within a 12-bit range from the
19787 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19788 are computed with 32 bits.
19789 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19790
19791 @item -minline-plt
19792 @opindex minline-plt
19793
19794 Enable inlining of PLT entries in function calls to functions that are
19795 not known to bind locally. It has no effect without @option{-mfdpic}.
19796 It's enabled by default if optimizing for speed and compiling for
19797 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19798 optimization option such as @option{-O3} or above is present in the
19799 command line.
19800
19801 @item -mTLS
19802 @opindex mTLS
19803
19804 Assume a large TLS segment when generating thread-local code.
19805
19806 @item -mtls
19807 @opindex mtls
19808
19809 Do not assume a large TLS segment when generating thread-local code.
19810
19811 @item -mgprel-ro
19812 @opindex mgprel-ro
19813
19814 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19815 that is known to be in read-only sections. It's enabled by default,
19816 except for @option{-fpic} or @option{-fpie}: even though it may help
19817 make the global offset table smaller, it trades 1 instruction for 4.
19818 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19819 one of which may be shared by multiple symbols, and it avoids the need
19820 for a GOT entry for the referenced symbol, so it's more likely to be a
19821 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19822
19823 @item -multilib-library-pic
19824 @opindex multilib-library-pic
19825
19826 Link with the (library, not FD) pic libraries. It's implied by
19827 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19828 @option{-fpic} without @option{-mfdpic}. You should never have to use
19829 it explicitly.
19830
19831 @item -mlinked-fp
19832 @opindex mlinked-fp
19833
19834 Follow the EABI requirement of always creating a frame pointer whenever
19835 a stack frame is allocated. This option is enabled by default and can
19836 be disabled with @option{-mno-linked-fp}.
19837
19838 @item -mlong-calls
19839 @opindex mlong-calls
19840
19841 Use indirect addressing to call functions outside the current
19842 compilation unit. This allows the functions to be placed anywhere
19843 within the 32-bit address space.
19844
19845 @item -malign-labels
19846 @opindex malign-labels
19847
19848 Try to align labels to an 8-byte boundary by inserting NOPs into the
19849 previous packet. This option only has an effect when VLIW packing
19850 is enabled. It doesn't create new packets; it merely adds NOPs to
19851 existing ones.
19852
19853 @item -mlibrary-pic
19854 @opindex mlibrary-pic
19855
19856 Generate position-independent EABI code.
19857
19858 @item -macc-4
19859 @opindex macc-4
19860
19861 Use only the first four media accumulator registers.
19862
19863 @item -macc-8
19864 @opindex macc-8
19865
19866 Use all eight media accumulator registers.
19867
19868 @item -mpack
19869 @opindex mpack
19870
19871 Pack VLIW instructions.
19872
19873 @item -mno-pack
19874 @opindex mno-pack
19875
19876 Do not pack VLIW instructions.
19877
19878 @item -mno-eflags
19879 @opindex mno-eflags
19880
19881 Do not mark ABI switches in e_flags.
19882
19883 @item -mcond-move
19884 @opindex mcond-move
19885
19886 Enable the use of conditional-move instructions (default).
19887
19888 This switch is mainly for debugging the compiler and will likely be removed
19889 in a future version.
19890
19891 @item -mno-cond-move
19892 @opindex mno-cond-move
19893
19894 Disable the use of conditional-move instructions.
19895
19896 This switch is mainly for debugging the compiler and will likely be removed
19897 in a future version.
19898
19899 @item -mscc
19900 @opindex mscc
19901
19902 Enable the use of conditional set instructions (default).
19903
19904 This switch is mainly for debugging the compiler and will likely be removed
19905 in a future version.
19906
19907 @item -mno-scc
19908 @opindex mno-scc
19909
19910 Disable the use of conditional set instructions.
19911
19912 This switch is mainly for debugging the compiler and will likely be removed
19913 in a future version.
19914
19915 @item -mcond-exec
19916 @opindex mcond-exec
19917
19918 Enable the use of conditional execution (default).
19919
19920 This switch is mainly for debugging the compiler and will likely be removed
19921 in a future version.
19922
19923 @item -mno-cond-exec
19924 @opindex mno-cond-exec
19925
19926 Disable the use of conditional execution.
19927
19928 This switch is mainly for debugging the compiler and will likely be removed
19929 in a future version.
19930
19931 @item -mvliw-branch
19932 @opindex mvliw-branch
19933
19934 Run a pass to pack branches into VLIW instructions (default).
19935
19936 This switch is mainly for debugging the compiler and will likely be removed
19937 in a future version.
19938
19939 @item -mno-vliw-branch
19940 @opindex mno-vliw-branch
19941
19942 Do not run a pass to pack branches into VLIW instructions.
19943
19944 This switch is mainly for debugging the compiler and will likely be removed
19945 in a future version.
19946
19947 @item -mmulti-cond-exec
19948 @opindex mmulti-cond-exec
19949
19950 Enable optimization of @code{&&} and @code{||} in conditional execution
19951 (default).
19952
19953 This switch is mainly for debugging the compiler and will likely be removed
19954 in a future version.
19955
19956 @item -mno-multi-cond-exec
19957 @opindex mno-multi-cond-exec
19958
19959 Disable optimization of @code{&&} and @code{||} in conditional execution.
19960
19961 This switch is mainly for debugging the compiler and will likely be removed
19962 in a future version.
19963
19964 @item -mnested-cond-exec
19965 @opindex mnested-cond-exec
19966
19967 Enable nested conditional execution optimizations (default).
19968
19969 This switch is mainly for debugging the compiler and will likely be removed
19970 in a future version.
19971
19972 @item -mno-nested-cond-exec
19973 @opindex mno-nested-cond-exec
19974
19975 Disable nested conditional execution optimizations.
19976
19977 This switch is mainly for debugging the compiler and will likely be removed
19978 in a future version.
19979
19980 @item -moptimize-membar
19981 @opindex moptimize-membar
19982
19983 This switch removes redundant @code{membar} instructions from the
19984 compiler-generated code. It is enabled by default.
19985
19986 @item -mno-optimize-membar
19987 @opindex mno-optimize-membar
19988 @opindex moptimize-membar
19989
19990 This switch disables the automatic removal of redundant @code{membar}
19991 instructions from the generated code.
19992
19993 @item -mtomcat-stats
19994 @opindex mtomcat-stats
19995
19996 Cause gas to print out tomcat statistics.
19997
19998 @item -mcpu=@var{cpu}
19999 @opindex mcpu
20000
20001 Select the processor type for which to generate code. Possible values are
20002 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20003 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20004
20005 @end table
20006
20007 @node GNU/Linux Options
20008 @subsection GNU/Linux Options
20009
20010 These @samp{-m} options are defined for GNU/Linux targets:
20011
20012 @table @gcctabopt
20013 @item -mglibc
20014 @opindex mglibc
20015 Use the GNU C library. This is the default except
20016 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20017 @samp{*-*-linux-*android*} targets.
20018
20019 @item -muclibc
20020 @opindex muclibc
20021 Use uClibc C library. This is the default on
20022 @samp{*-*-linux-*uclibc*} targets.
20023
20024 @item -mmusl
20025 @opindex mmusl
20026 Use the musl C library. This is the default on
20027 @samp{*-*-linux-*musl*} targets.
20028
20029 @item -mbionic
20030 @opindex mbionic
20031 Use Bionic C library. This is the default on
20032 @samp{*-*-linux-*android*} targets.
20033
20034 @item -mandroid
20035 @opindex mandroid
20036 Compile code compatible with Android platform. This is the default on
20037 @samp{*-*-linux-*android*} targets.
20038
20039 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20040 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20041 this option makes the GCC driver pass Android-specific options to the linker.
20042 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20043 to be defined.
20044
20045 @item -tno-android-cc
20046 @opindex tno-android-cc
20047 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20048 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20049 @option{-fno-rtti} by default.
20050
20051 @item -tno-android-ld
20052 @opindex tno-android-ld
20053 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20054 linking options to the linker.
20055
20056 @end table
20057
20058 @node H8/300 Options
20059 @subsection H8/300 Options
20060
20061 These @samp{-m} options are defined for the H8/300 implementations:
20062
20063 @table @gcctabopt
20064 @item -mrelax
20065 @opindex mrelax
20066 Shorten some address references at link time, when possible; uses the
20067 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20068 ld, Using ld}, for a fuller description.
20069
20070 @item -mh
20071 @opindex mh
20072 Generate code for the H8/300H@.
20073
20074 @item -ms
20075 @opindex ms
20076 Generate code for the H8S@.
20077
20078 @item -mn
20079 @opindex mn
20080 Generate code for the H8S and H8/300H in the normal mode. This switch
20081 must be used either with @option{-mh} or @option{-ms}.
20082
20083 @item -ms2600
20084 @opindex ms2600
20085 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20086
20087 @item -mexr
20088 @opindex mexr
20089 Extended registers are stored on stack before execution of function
20090 with monitor attribute. Default option is @option{-mexr}.
20091 This option is valid only for H8S targets.
20092
20093 @item -mno-exr
20094 @opindex mno-exr
20095 @opindex mexr
20096 Extended registers are not stored on stack before execution of function
20097 with monitor attribute. Default option is @option{-mno-exr}.
20098 This option is valid only for H8S targets.
20099
20100 @item -mint32
20101 @opindex mint32
20102 Make @code{int} data 32 bits by default.
20103
20104 @item -malign-300
20105 @opindex malign-300
20106 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20107 The default for the H8/300H and H8S is to align longs and floats on
20108 4-byte boundaries.
20109 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20110 This option has no effect on the H8/300.
20111 @end table
20112
20113 @node HPPA Options
20114 @subsection HPPA Options
20115 @cindex HPPA Options
20116
20117 These @samp{-m} options are defined for the HPPA family of computers:
20118
20119 @table @gcctabopt
20120 @item -march=@var{architecture-type}
20121 @opindex march
20122 Generate code for the specified architecture. The choices for
20123 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20124 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20125 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20126 architecture option for your machine. Code compiled for lower numbered
20127 architectures runs on higher numbered architectures, but not the
20128 other way around.
20129
20130 @item -mpa-risc-1-0
20131 @itemx -mpa-risc-1-1
20132 @itemx -mpa-risc-2-0
20133 @opindex mpa-risc-1-0
20134 @opindex mpa-risc-1-1
20135 @opindex mpa-risc-2-0
20136 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20137
20138 @item -mcaller-copies
20139 @opindex mcaller-copies
20140 The caller copies function arguments passed by hidden reference. This
20141 option should be used with care as it is not compatible with the default
20142 32-bit runtime. However, only aggregates larger than eight bytes are
20143 passed by hidden reference and the option provides better compatibility
20144 with OpenMP.
20145
20146 @item -mjump-in-delay
20147 @opindex mjump-in-delay
20148 This option is ignored and provided for compatibility purposes only.
20149
20150 @item -mdisable-fpregs
20151 @opindex mdisable-fpregs
20152 Prevent floating-point registers from being used in any manner. This is
20153 necessary for compiling kernels that perform lazy context switching of
20154 floating-point registers. If you use this option and attempt to perform
20155 floating-point operations, the compiler aborts.
20156
20157 @item -mdisable-indexing
20158 @opindex mdisable-indexing
20159 Prevent the compiler from using indexing address modes. This avoids some
20160 rather obscure problems when compiling MIG generated code under MACH@.
20161
20162 @item -mno-space-regs
20163 @opindex mno-space-regs
20164 @opindex mspace-regs
20165 Generate code that assumes the target has no space registers. This allows
20166 GCC to generate faster indirect calls and use unscaled index address modes.
20167
20168 Such code is suitable for level 0 PA systems and kernels.
20169
20170 @item -mfast-indirect-calls
20171 @opindex mfast-indirect-calls
20172 Generate code that assumes calls never cross space boundaries. This
20173 allows GCC to emit code that performs faster indirect calls.
20174
20175 This option does not work in the presence of shared libraries or nested
20176 functions.
20177
20178 @item -mfixed-range=@var{register-range}
20179 @opindex mfixed-range
20180 Generate code treating the given register range as fixed registers.
20181 A fixed register is one that the register allocator cannot use. This is
20182 useful when compiling kernel code. A register range is specified as
20183 two registers separated by a dash. Multiple register ranges can be
20184 specified separated by a comma.
20185
20186 @item -mlong-load-store
20187 @opindex mlong-load-store
20188 Generate 3-instruction load and store sequences as sometimes required by
20189 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20190 the HP compilers.
20191
20192 @item -mportable-runtime
20193 @opindex mportable-runtime
20194 Use the portable calling conventions proposed by HP for ELF systems.
20195
20196 @item -mgas
20197 @opindex mgas
20198 Enable the use of assembler directives only GAS understands.
20199
20200 @item -mschedule=@var{cpu-type}
20201 @opindex mschedule
20202 Schedule code according to the constraints for the machine type
20203 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20204 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20205 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20206 proper scheduling option for your machine. The default scheduling is
20207 @samp{8000}.
20208
20209 @item -mlinker-opt
20210 @opindex mlinker-opt
20211 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20212 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20213 linkers in which they give bogus error messages when linking some programs.
20214
20215 @item -msoft-float
20216 @opindex msoft-float
20217 Generate output containing library calls for floating point.
20218 @strong{Warning:} the requisite libraries are not available for all HPPA
20219 targets. Normally the facilities of the machine's usual C compiler are
20220 used, but this cannot be done directly in cross-compilation. You must make
20221 your own arrangements to provide suitable library functions for
20222 cross-compilation.
20223
20224 @option{-msoft-float} changes the calling convention in the output file;
20225 therefore, it is only useful if you compile @emph{all} of a program with
20226 this option. In particular, you need to compile @file{libgcc.a}, the
20227 library that comes with GCC, with @option{-msoft-float} in order for
20228 this to work.
20229
20230 @item -msio
20231 @opindex msio
20232 Generate the predefine, @code{_SIO}, for server IO@. The default is
20233 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20234 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20235 options are available under HP-UX and HI-UX@.
20236
20237 @item -mgnu-ld
20238 @opindex mgnu-ld
20239 Use options specific to GNU @command{ld}.
20240 This passes @option{-shared} to @command{ld} when
20241 building a shared library. It is the default when GCC is configured,
20242 explicitly or implicitly, with the GNU linker. This option does not
20243 affect which @command{ld} is called; it only changes what parameters
20244 are passed to that @command{ld}.
20245 The @command{ld} that is called is determined by the
20246 @option{--with-ld} configure option, GCC's program search path, and
20247 finally by the user's @env{PATH}. The linker used by GCC can be printed
20248 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20249 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20250
20251 @item -mhp-ld
20252 @opindex mhp-ld
20253 Use options specific to HP @command{ld}.
20254 This passes @option{-b} to @command{ld} when building
20255 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20256 links. It is the default when GCC is configured, explicitly or
20257 implicitly, with the HP linker. This option does not affect
20258 which @command{ld} is called; it only changes what parameters are passed to that
20259 @command{ld}.
20260 The @command{ld} that is called is determined by the @option{--with-ld}
20261 configure option, GCC's program search path, and finally by the user's
20262 @env{PATH}. The linker used by GCC can be printed using @samp{which
20263 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20264 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20265
20266 @item -mlong-calls
20267 @opindex mno-long-calls
20268 @opindex mlong-calls
20269 Generate code that uses long call sequences. This ensures that a call
20270 is always able to reach linker generated stubs. The default is to generate
20271 long calls only when the distance from the call site to the beginning
20272 of the function or translation unit, as the case may be, exceeds a
20273 predefined limit set by the branch type being used. The limits for
20274 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20275 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20276 240,000 bytes.
20277
20278 Distances are measured from the beginning of functions when using the
20279 @option{-ffunction-sections} option, or when using the @option{-mgas}
20280 and @option{-mno-portable-runtime} options together under HP-UX with
20281 the SOM linker.
20282
20283 It is normally not desirable to use this option as it degrades
20284 performance. However, it may be useful in large applications,
20285 particularly when partial linking is used to build the application.
20286
20287 The types of long calls used depends on the capabilities of the
20288 assembler and linker, and the type of code being generated. The
20289 impact on systems that support long absolute calls, and long pic
20290 symbol-difference or pc-relative calls should be relatively small.
20291 However, an indirect call is used on 32-bit ELF systems in pic code
20292 and it is quite long.
20293
20294 @item -munix=@var{unix-std}
20295 @opindex march
20296 Generate compiler predefines and select a startfile for the specified
20297 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20298 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20299 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20300 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20301 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20302 and later.
20303
20304 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20305 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20306 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20307 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20308 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20309 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20310
20311 It is @emph{important} to note that this option changes the interfaces
20312 for various library routines. It also affects the operational behavior
20313 of the C library. Thus, @emph{extreme} care is needed in using this
20314 option.
20315
20316 Library code that is intended to operate with more than one UNIX
20317 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20318 as appropriate. Most GNU software doesn't provide this capability.
20319
20320 @item -nolibdld
20321 @opindex nolibdld
20322 Suppress the generation of link options to search libdld.sl when the
20323 @option{-static} option is specified on HP-UX 10 and later.
20324
20325 @item -static
20326 @opindex static
20327 The HP-UX implementation of setlocale in libc has a dependency on
20328 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20329 when the @option{-static} option is specified, special link options
20330 are needed to resolve this dependency.
20331
20332 On HP-UX 10 and later, the GCC driver adds the necessary options to
20333 link with libdld.sl when the @option{-static} option is specified.
20334 This causes the resulting binary to be dynamic. On the 64-bit port,
20335 the linkers generate dynamic binaries by default in any case. The
20336 @option{-nolibdld} option can be used to prevent the GCC driver from
20337 adding these link options.
20338
20339 @item -threads
20340 @opindex threads
20341 Add support for multithreading with the @dfn{dce thread} library
20342 under HP-UX@. This option sets flags for both the preprocessor and
20343 linker.
20344 @end table
20345
20346 @node IA-64 Options
20347 @subsection IA-64 Options
20348 @cindex IA-64 Options
20349
20350 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20351
20352 @table @gcctabopt
20353 @item -mbig-endian
20354 @opindex mbig-endian
20355 Generate code for a big-endian target. This is the default for HP-UX@.
20356
20357 @item -mlittle-endian
20358 @opindex mlittle-endian
20359 Generate code for a little-endian target. This is the default for AIX5
20360 and GNU/Linux.
20361
20362 @item -mgnu-as
20363 @itemx -mno-gnu-as
20364 @opindex mgnu-as
20365 @opindex mno-gnu-as
20366 Generate (or don't) code for the GNU assembler. This is the default.
20367 @c Also, this is the default if the configure option @option{--with-gnu-as}
20368 @c is used.
20369
20370 @item -mgnu-ld
20371 @itemx -mno-gnu-ld
20372 @opindex mgnu-ld
20373 @opindex mno-gnu-ld
20374 Generate (or don't) code for the GNU linker. This is the default.
20375 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20376 @c is used.
20377
20378 @item -mno-pic
20379 @opindex mno-pic
20380 Generate code that does not use a global pointer register. The result
20381 is not position independent code, and violates the IA-64 ABI@.
20382
20383 @item -mvolatile-asm-stop
20384 @itemx -mno-volatile-asm-stop
20385 @opindex mvolatile-asm-stop
20386 @opindex mno-volatile-asm-stop
20387 Generate (or don't) a stop bit immediately before and after volatile asm
20388 statements.
20389
20390 @item -mregister-names
20391 @itemx -mno-register-names
20392 @opindex mregister-names
20393 @opindex mno-register-names
20394 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20395 the stacked registers. This may make assembler output more readable.
20396
20397 @item -mno-sdata
20398 @itemx -msdata
20399 @opindex mno-sdata
20400 @opindex msdata
20401 Disable (or enable) optimizations that use the small data section. This may
20402 be useful for working around optimizer bugs.
20403
20404 @item -mconstant-gp
20405 @opindex mconstant-gp
20406 Generate code that uses a single constant global pointer value. This is
20407 useful when compiling kernel code.
20408
20409 @item -mauto-pic
20410 @opindex mauto-pic
20411 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20412 This is useful when compiling firmware code.
20413
20414 @item -minline-float-divide-min-latency
20415 @opindex minline-float-divide-min-latency
20416 Generate code for inline divides of floating-point values
20417 using the minimum latency algorithm.
20418
20419 @item -minline-float-divide-max-throughput
20420 @opindex minline-float-divide-max-throughput
20421 Generate code for inline divides of floating-point values
20422 using the maximum throughput algorithm.
20423
20424 @item -mno-inline-float-divide
20425 @opindex mno-inline-float-divide
20426 Do not generate inline code for divides of floating-point values.
20427
20428 @item -minline-int-divide-min-latency
20429 @opindex minline-int-divide-min-latency
20430 Generate code for inline divides of integer values
20431 using the minimum latency algorithm.
20432
20433 @item -minline-int-divide-max-throughput
20434 @opindex minline-int-divide-max-throughput
20435 Generate code for inline divides of integer values
20436 using the maximum throughput algorithm.
20437
20438 @item -mno-inline-int-divide
20439 @opindex mno-inline-int-divide
20440 @opindex minline-int-divide
20441 Do not generate inline code for divides of integer values.
20442
20443 @item -minline-sqrt-min-latency
20444 @opindex minline-sqrt-min-latency
20445 Generate code for inline square roots
20446 using the minimum latency algorithm.
20447
20448 @item -minline-sqrt-max-throughput
20449 @opindex minline-sqrt-max-throughput
20450 Generate code for inline square roots
20451 using the maximum throughput algorithm.
20452
20453 @item -mno-inline-sqrt
20454 @opindex mno-inline-sqrt
20455 Do not generate inline code for @code{sqrt}.
20456
20457 @item -mfused-madd
20458 @itemx -mno-fused-madd
20459 @opindex mfused-madd
20460 @opindex mno-fused-madd
20461 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20462 instructions. The default is to use these instructions.
20463
20464 @item -mno-dwarf2-asm
20465 @itemx -mdwarf2-asm
20466 @opindex mno-dwarf2-asm
20467 @opindex mdwarf2-asm
20468 Don't (or do) generate assembler code for the DWARF line number debugging
20469 info. This may be useful when not using the GNU assembler.
20470
20471 @item -mearly-stop-bits
20472 @itemx -mno-early-stop-bits
20473 @opindex mearly-stop-bits
20474 @opindex mno-early-stop-bits
20475 Allow stop bits to be placed earlier than immediately preceding the
20476 instruction that triggered the stop bit. This can improve instruction
20477 scheduling, but does not always do so.
20478
20479 @item -mfixed-range=@var{register-range}
20480 @opindex mfixed-range
20481 Generate code treating the given register range as fixed registers.
20482 A fixed register is one that the register allocator cannot use. This is
20483 useful when compiling kernel code. A register range is specified as
20484 two registers separated by a dash. Multiple register ranges can be
20485 specified separated by a comma.
20486
20487 @item -mtls-size=@var{tls-size}
20488 @opindex mtls-size
20489 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20490 64.
20491
20492 @item -mtune=@var{cpu-type}
20493 @opindex mtune
20494 Tune the instruction scheduling for a particular CPU, Valid values are
20495 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20496 and @samp{mckinley}.
20497
20498 @item -milp32
20499 @itemx -mlp64
20500 @opindex milp32
20501 @opindex mlp64
20502 Generate code for a 32-bit or 64-bit environment.
20503 The 32-bit environment sets int, long and pointer to 32 bits.
20504 The 64-bit environment sets int to 32 bits and long and pointer
20505 to 64 bits. These are HP-UX specific flags.
20506
20507 @item -mno-sched-br-data-spec
20508 @itemx -msched-br-data-spec
20509 @opindex mno-sched-br-data-spec
20510 @opindex msched-br-data-spec
20511 (Dis/En)able data speculative scheduling before reload.
20512 This results in generation of @code{ld.a} instructions and
20513 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20514 The default setting is disabled.
20515
20516 @item -msched-ar-data-spec
20517 @itemx -mno-sched-ar-data-spec
20518 @opindex msched-ar-data-spec
20519 @opindex mno-sched-ar-data-spec
20520 (En/Dis)able data speculative scheduling after reload.
20521 This results in generation of @code{ld.a} instructions and
20522 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20523 The default setting is enabled.
20524
20525 @item -mno-sched-control-spec
20526 @itemx -msched-control-spec
20527 @opindex mno-sched-control-spec
20528 @opindex msched-control-spec
20529 (Dis/En)able control speculative scheduling. This feature is
20530 available only during region scheduling (i.e.@: before reload).
20531 This results in generation of the @code{ld.s} instructions and
20532 the corresponding check instructions @code{chk.s}.
20533 The default setting is disabled.
20534
20535 @item -msched-br-in-data-spec
20536 @itemx -mno-sched-br-in-data-spec
20537 @opindex msched-br-in-data-spec
20538 @opindex mno-sched-br-in-data-spec
20539 (En/Dis)able speculative scheduling of the instructions that
20540 are dependent on the data speculative loads before reload.
20541 This is effective only with @option{-msched-br-data-spec} enabled.
20542 The default setting is enabled.
20543
20544 @item -msched-ar-in-data-spec
20545 @itemx -mno-sched-ar-in-data-spec
20546 @opindex msched-ar-in-data-spec
20547 @opindex mno-sched-ar-in-data-spec
20548 (En/Dis)able speculative scheduling of the instructions that
20549 are dependent on the data speculative loads after reload.
20550 This is effective only with @option{-msched-ar-data-spec} enabled.
20551 The default setting is enabled.
20552
20553 @item -msched-in-control-spec
20554 @itemx -mno-sched-in-control-spec
20555 @opindex msched-in-control-spec
20556 @opindex mno-sched-in-control-spec
20557 (En/Dis)able speculative scheduling of the instructions that
20558 are dependent on the control speculative loads.
20559 This is effective only with @option{-msched-control-spec} enabled.
20560 The default setting is enabled.
20561
20562 @item -mno-sched-prefer-non-data-spec-insns
20563 @itemx -msched-prefer-non-data-spec-insns
20564 @opindex mno-sched-prefer-non-data-spec-insns
20565 @opindex msched-prefer-non-data-spec-insns
20566 If enabled, data-speculative instructions are chosen for schedule
20567 only if there are no other choices at the moment. This makes
20568 the use of the data speculation much more conservative.
20569 The default setting is disabled.
20570
20571 @item -mno-sched-prefer-non-control-spec-insns
20572 @itemx -msched-prefer-non-control-spec-insns
20573 @opindex mno-sched-prefer-non-control-spec-insns
20574 @opindex msched-prefer-non-control-spec-insns
20575 If enabled, control-speculative instructions are chosen for schedule
20576 only if there are no other choices at the moment. This makes
20577 the use of the control speculation much more conservative.
20578 The default setting is disabled.
20579
20580 @item -mno-sched-count-spec-in-critical-path
20581 @itemx -msched-count-spec-in-critical-path
20582 @opindex mno-sched-count-spec-in-critical-path
20583 @opindex msched-count-spec-in-critical-path
20584 If enabled, speculative dependencies are considered during
20585 computation of the instructions priorities. This makes the use of the
20586 speculation a bit more conservative.
20587 The default setting is disabled.
20588
20589 @item -msched-spec-ldc
20590 @opindex msched-spec-ldc
20591 Use a simple data speculation check. This option is on by default.
20592
20593 @item -msched-control-spec-ldc
20594 @opindex msched-spec-ldc
20595 Use a simple check for control speculation. This option is on by default.
20596
20597 @item -msched-stop-bits-after-every-cycle
20598 @opindex msched-stop-bits-after-every-cycle
20599 Place a stop bit after every cycle when scheduling. This option is on
20600 by default.
20601
20602 @item -msched-fp-mem-deps-zero-cost
20603 @opindex msched-fp-mem-deps-zero-cost
20604 Assume that floating-point stores and loads are not likely to cause a conflict
20605 when placed into the same instruction group. This option is disabled by
20606 default.
20607
20608 @item -msel-sched-dont-check-control-spec
20609 @opindex msel-sched-dont-check-control-spec
20610 Generate checks for control speculation in selective scheduling.
20611 This flag is disabled by default.
20612
20613 @item -msched-max-memory-insns=@var{max-insns}
20614 @opindex msched-max-memory-insns
20615 Limit on the number of memory insns per instruction group, giving lower
20616 priority to subsequent memory insns attempting to schedule in the same
20617 instruction group. Frequently useful to prevent cache bank conflicts.
20618 The default value is 1.
20619
20620 @item -msched-max-memory-insns-hard-limit
20621 @opindex msched-max-memory-insns-hard-limit
20622 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20623 disallowing more than that number in an instruction group.
20624 Otherwise, the limit is ``soft'', meaning that non-memory operations
20625 are preferred when the limit is reached, but memory operations may still
20626 be scheduled.
20627
20628 @end table
20629
20630 @node LM32 Options
20631 @subsection LM32 Options
20632 @cindex LM32 options
20633
20634 These @option{-m} options are defined for the LatticeMico32 architecture:
20635
20636 @table @gcctabopt
20637 @item -mbarrel-shift-enabled
20638 @opindex mbarrel-shift-enabled
20639 Enable barrel-shift instructions.
20640
20641 @item -mdivide-enabled
20642 @opindex mdivide-enabled
20643 Enable divide and modulus instructions.
20644
20645 @item -mmultiply-enabled
20646 @opindex multiply-enabled
20647 Enable multiply instructions.
20648
20649 @item -msign-extend-enabled
20650 @opindex msign-extend-enabled
20651 Enable sign extend instructions.
20652
20653 @item -muser-enabled
20654 @opindex muser-enabled
20655 Enable user-defined instructions.
20656
20657 @end table
20658
20659 @node M32C Options
20660 @subsection M32C Options
20661 @cindex M32C options
20662
20663 @table @gcctabopt
20664 @item -mcpu=@var{name}
20665 @opindex mcpu=
20666 Select the CPU for which code is generated. @var{name} may be one of
20667 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20668 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20669 the M32C/80 series.
20670
20671 @item -msim
20672 @opindex msim
20673 Specifies that the program will be run on the simulator. This causes
20674 an alternate runtime library to be linked in which supports, for
20675 example, file I/O@. You must not use this option when generating
20676 programs that will run on real hardware; you must provide your own
20677 runtime library for whatever I/O functions are needed.
20678
20679 @item -memregs=@var{number}
20680 @opindex memregs=
20681 Specifies the number of memory-based pseudo-registers GCC uses
20682 during code generation. These pseudo-registers are used like real
20683 registers, so there is a tradeoff between GCC's ability to fit the
20684 code into available registers, and the performance penalty of using
20685 memory instead of registers. Note that all modules in a program must
20686 be compiled with the same value for this option. Because of that, you
20687 must not use this option with GCC's default runtime libraries.
20688
20689 @end table
20690
20691 @node M32R/D Options
20692 @subsection M32R/D Options
20693 @cindex M32R/D options
20694
20695 These @option{-m} options are defined for Renesas M32R/D architectures:
20696
20697 @table @gcctabopt
20698 @item -m32r2
20699 @opindex m32r2
20700 Generate code for the M32R/2@.
20701
20702 @item -m32rx
20703 @opindex m32rx
20704 Generate code for the M32R/X@.
20705
20706 @item -m32r
20707 @opindex m32r
20708 Generate code for the M32R@. This is the default.
20709
20710 @item -mmodel=small
20711 @opindex mmodel=small
20712 Assume all objects live in the lower 16MB of memory (so that their addresses
20713 can be loaded with the @code{ld24} instruction), and assume all subroutines
20714 are reachable with the @code{bl} instruction.
20715 This is the default.
20716
20717 The addressability of a particular object can be set with the
20718 @code{model} attribute.
20719
20720 @item -mmodel=medium
20721 @opindex mmodel=medium
20722 Assume objects may be anywhere in the 32-bit address space (the compiler
20723 generates @code{seth/add3} instructions to load their addresses), and
20724 assume all subroutines are reachable with the @code{bl} instruction.
20725
20726 @item -mmodel=large
20727 @opindex mmodel=large
20728 Assume objects may be anywhere in the 32-bit address space (the compiler
20729 generates @code{seth/add3} instructions to load their addresses), and
20730 assume subroutines may not be reachable with the @code{bl} instruction
20731 (the compiler generates the much slower @code{seth/add3/jl}
20732 instruction sequence).
20733
20734 @item -msdata=none
20735 @opindex msdata=none
20736 Disable use of the small data area. Variables are put into
20737 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20738 @code{section} attribute has been specified).
20739 This is the default.
20740
20741 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20742 Objects may be explicitly put in the small data area with the
20743 @code{section} attribute using one of these sections.
20744
20745 @item -msdata=sdata
20746 @opindex msdata=sdata
20747 Put small global and static data in the small data area, but do not
20748 generate special code to reference them.
20749
20750 @item -msdata=use
20751 @opindex msdata=use
20752 Put small global and static data in the small data area, and generate
20753 special instructions to reference them.
20754
20755 @item -G @var{num}
20756 @opindex G
20757 @cindex smaller data references
20758 Put global and static objects less than or equal to @var{num} bytes
20759 into the small data or BSS sections instead of the normal data or BSS
20760 sections. The default value of @var{num} is 8.
20761 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20762 for this option to have any effect.
20763
20764 All modules should be compiled with the same @option{-G @var{num}} value.
20765 Compiling with different values of @var{num} may or may not work; if it
20766 doesn't the linker gives an error message---incorrect code is not
20767 generated.
20768
20769 @item -mdebug
20770 @opindex mdebug
20771 Makes the M32R-specific code in the compiler display some statistics
20772 that might help in debugging programs.
20773
20774 @item -malign-loops
20775 @opindex malign-loops
20776 Align all loops to a 32-byte boundary.
20777
20778 @item -mno-align-loops
20779 @opindex mno-align-loops
20780 Do not enforce a 32-byte alignment for loops. This is the default.
20781
20782 @item -missue-rate=@var{number}
20783 @opindex missue-rate=@var{number}
20784 Issue @var{number} instructions per cycle. @var{number} can only be 1
20785 or 2.
20786
20787 @item -mbranch-cost=@var{number}
20788 @opindex mbranch-cost=@var{number}
20789 @var{number} can only be 1 or 2. If it is 1 then branches are
20790 preferred over conditional code, if it is 2, then the opposite applies.
20791
20792 @item -mflush-trap=@var{number}
20793 @opindex mflush-trap=@var{number}
20794 Specifies the trap number to use to flush the cache. The default is
20795 12. Valid numbers are between 0 and 15 inclusive.
20796
20797 @item -mno-flush-trap
20798 @opindex mno-flush-trap
20799 Specifies that the cache cannot be flushed by using a trap.
20800
20801 @item -mflush-func=@var{name}
20802 @opindex mflush-func=@var{name}
20803 Specifies the name of the operating system function to call to flush
20804 the cache. The default is @samp{_flush_cache}, but a function call
20805 is only used if a trap is not available.
20806
20807 @item -mno-flush-func
20808 @opindex mno-flush-func
20809 Indicates that there is no OS function for flushing the cache.
20810
20811 @end table
20812
20813 @node M680x0 Options
20814 @subsection M680x0 Options
20815 @cindex M680x0 options
20816
20817 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20818 The default settings depend on which architecture was selected when
20819 the compiler was configured; the defaults for the most common choices
20820 are given below.
20821
20822 @table @gcctabopt
20823 @item -march=@var{arch}
20824 @opindex march
20825 Generate code for a specific M680x0 or ColdFire instruction set
20826 architecture. Permissible values of @var{arch} for M680x0
20827 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20828 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20829 architectures are selected according to Freescale's ISA classification
20830 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20831 @samp{isab} and @samp{isac}.
20832
20833 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20834 code for a ColdFire target. The @var{arch} in this macro is one of the
20835 @option{-march} arguments given above.
20836
20837 When used together, @option{-march} and @option{-mtune} select code
20838 that runs on a family of similar processors but that is optimized
20839 for a particular microarchitecture.
20840
20841 @item -mcpu=@var{cpu}
20842 @opindex mcpu
20843 Generate code for a specific M680x0 or ColdFire processor.
20844 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20845 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20846 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20847 below, which also classifies the CPUs into families:
20848
20849 @multitable @columnfractions 0.20 0.80
20850 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20851 @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}
20852 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20853 @item @samp{5206e} @tab @samp{5206e}
20854 @item @samp{5208} @tab @samp{5207} @samp{5208}
20855 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20856 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20857 @item @samp{5216} @tab @samp{5214} @samp{5216}
20858 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20859 @item @samp{5225} @tab @samp{5224} @samp{5225}
20860 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20861 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20862 @item @samp{5249} @tab @samp{5249}
20863 @item @samp{5250} @tab @samp{5250}
20864 @item @samp{5271} @tab @samp{5270} @samp{5271}
20865 @item @samp{5272} @tab @samp{5272}
20866 @item @samp{5275} @tab @samp{5274} @samp{5275}
20867 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20868 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20869 @item @samp{5307} @tab @samp{5307}
20870 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20871 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20872 @item @samp{5407} @tab @samp{5407}
20873 @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}
20874 @end multitable
20875
20876 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20877 @var{arch} is compatible with @var{cpu}. Other combinations of
20878 @option{-mcpu} and @option{-march} are rejected.
20879
20880 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20881 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20882 where the value of @var{family} is given by the table above.
20883
20884 @item -mtune=@var{tune}
20885 @opindex mtune
20886 Tune the code for a particular microarchitecture within the
20887 constraints set by @option{-march} and @option{-mcpu}.
20888 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20889 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20890 and @samp{cpu32}. The ColdFire microarchitectures
20891 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20892
20893 You can also use @option{-mtune=68020-40} for code that needs
20894 to run relatively well on 68020, 68030 and 68040 targets.
20895 @option{-mtune=68020-60} is similar but includes 68060 targets
20896 as well. These two options select the same tuning decisions as
20897 @option{-m68020-40} and @option{-m68020-60} respectively.
20898
20899 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20900 when tuning for 680x0 architecture @var{arch}. It also defines
20901 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20902 option is used. If GCC is tuning for a range of architectures,
20903 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20904 it defines the macros for every architecture in the range.
20905
20906 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20907 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20908 of the arguments given above.
20909
20910 @item -m68000
20911 @itemx -mc68000
20912 @opindex m68000
20913 @opindex mc68000
20914 Generate output for a 68000. This is the default
20915 when the compiler is configured for 68000-based systems.
20916 It is equivalent to @option{-march=68000}.
20917
20918 Use this option for microcontrollers with a 68000 or EC000 core,
20919 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20920
20921 @item -m68010
20922 @opindex m68010
20923 Generate output for a 68010. This is the default
20924 when the compiler is configured for 68010-based systems.
20925 It is equivalent to @option{-march=68010}.
20926
20927 @item -m68020
20928 @itemx -mc68020
20929 @opindex m68020
20930 @opindex mc68020
20931 Generate output for a 68020. This is the default
20932 when the compiler is configured for 68020-based systems.
20933 It is equivalent to @option{-march=68020}.
20934
20935 @item -m68030
20936 @opindex m68030
20937 Generate output for a 68030. This is the default when the compiler is
20938 configured for 68030-based systems. It is equivalent to
20939 @option{-march=68030}.
20940
20941 @item -m68040
20942 @opindex m68040
20943 Generate output for a 68040. This is the default when the compiler is
20944 configured for 68040-based systems. It is equivalent to
20945 @option{-march=68040}.
20946
20947 This option inhibits the use of 68881/68882 instructions that have to be
20948 emulated by software on the 68040. Use this option if your 68040 does not
20949 have code to emulate those instructions.
20950
20951 @item -m68060
20952 @opindex m68060
20953 Generate output for a 68060. This is the default when the compiler is
20954 configured for 68060-based systems. It is equivalent to
20955 @option{-march=68060}.
20956
20957 This option inhibits the use of 68020 and 68881/68882 instructions that
20958 have to be emulated by software on the 68060. Use this option if your 68060
20959 does not have code to emulate those instructions.
20960
20961 @item -mcpu32
20962 @opindex mcpu32
20963 Generate output for a CPU32. This is the default
20964 when the compiler is configured for CPU32-based systems.
20965 It is equivalent to @option{-march=cpu32}.
20966
20967 Use this option for microcontrollers with a
20968 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20969 68336, 68340, 68341, 68349 and 68360.
20970
20971 @item -m5200
20972 @opindex m5200
20973 Generate output for a 520X ColdFire CPU@. This is the default
20974 when the compiler is configured for 520X-based systems.
20975 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20976 in favor of that option.
20977
20978 Use this option for microcontroller with a 5200 core, including
20979 the MCF5202, MCF5203, MCF5204 and MCF5206.
20980
20981 @item -m5206e
20982 @opindex m5206e
20983 Generate output for a 5206e ColdFire CPU@. The option is now
20984 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20985
20986 @item -m528x
20987 @opindex m528x
20988 Generate output for a member of the ColdFire 528X family.
20989 The option is now deprecated in favor of the equivalent
20990 @option{-mcpu=528x}.
20991
20992 @item -m5307
20993 @opindex m5307
20994 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20995 in favor of the equivalent @option{-mcpu=5307}.
20996
20997 @item -m5407
20998 @opindex m5407
20999 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21000 in favor of the equivalent @option{-mcpu=5407}.
21001
21002 @item -mcfv4e
21003 @opindex mcfv4e
21004 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21005 This includes use of hardware floating-point instructions.
21006 The option is equivalent to @option{-mcpu=547x}, and is now
21007 deprecated in favor of that option.
21008
21009 @item -m68020-40
21010 @opindex m68020-40
21011 Generate output for a 68040, without using any of the new instructions.
21012 This results in code that can run relatively efficiently on either a
21013 68020/68881 or a 68030 or a 68040. The generated code does use the
21014 68881 instructions that are emulated on the 68040.
21015
21016 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21017
21018 @item -m68020-60
21019 @opindex m68020-60
21020 Generate output for a 68060, without using any of the new instructions.
21021 This results in code that can run relatively efficiently on either a
21022 68020/68881 or a 68030 or a 68040. The generated code does use the
21023 68881 instructions that are emulated on the 68060.
21024
21025 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21026
21027 @item -mhard-float
21028 @itemx -m68881
21029 @opindex mhard-float
21030 @opindex m68881
21031 Generate floating-point instructions. This is the default for 68020
21032 and above, and for ColdFire devices that have an FPU@. It defines the
21033 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21034 on ColdFire targets.
21035
21036 @item -msoft-float
21037 @opindex msoft-float
21038 Do not generate floating-point instructions; use library calls instead.
21039 This is the default for 68000, 68010, and 68832 targets. It is also
21040 the default for ColdFire devices that have no FPU.
21041
21042 @item -mdiv
21043 @itemx -mno-div
21044 @opindex mdiv
21045 @opindex mno-div
21046 Generate (do not generate) ColdFire hardware divide and remainder
21047 instructions. If @option{-march} is used without @option{-mcpu},
21048 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21049 architectures. Otherwise, the default is taken from the target CPU
21050 (either the default CPU, or the one specified by @option{-mcpu}). For
21051 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21052 @option{-mcpu=5206e}.
21053
21054 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21055
21056 @item -mshort
21057 @opindex mshort
21058 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21059 Additionally, parameters passed on the stack are also aligned to a
21060 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21061
21062 @item -mno-short
21063 @opindex mno-short
21064 Do not consider type @code{int} to be 16 bits wide. This is the default.
21065
21066 @item -mnobitfield
21067 @itemx -mno-bitfield
21068 @opindex mnobitfield
21069 @opindex mno-bitfield
21070 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21071 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21072
21073 @item -mbitfield
21074 @opindex mbitfield
21075 Do use the bit-field instructions. The @option{-m68020} option implies
21076 @option{-mbitfield}. This is the default if you use a configuration
21077 designed for a 68020.
21078
21079 @item -mrtd
21080 @opindex mrtd
21081 Use a different function-calling convention, in which functions
21082 that take a fixed number of arguments return with the @code{rtd}
21083 instruction, which pops their arguments while returning. This
21084 saves one instruction in the caller since there is no need to pop
21085 the arguments there.
21086
21087 This calling convention is incompatible with the one normally
21088 used on Unix, so you cannot use it if you need to call libraries
21089 compiled with the Unix compiler.
21090
21091 Also, you must provide function prototypes for all functions that
21092 take variable numbers of arguments (including @code{printf});
21093 otherwise incorrect code is generated for calls to those
21094 functions.
21095
21096 In addition, seriously incorrect code results if you call a
21097 function with too many arguments. (Normally, extra arguments are
21098 harmlessly ignored.)
21099
21100 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21101 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21102
21103 The default is @option{-mno-rtd}.
21104
21105 @item -malign-int
21106 @itemx -mno-align-int
21107 @opindex malign-int
21108 @opindex mno-align-int
21109 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21110 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21111 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21112 Aligning variables on 32-bit boundaries produces code that runs somewhat
21113 faster on processors with 32-bit busses at the expense of more memory.
21114
21115 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21116 aligns structures containing the above types differently than
21117 most published application binary interface specifications for the m68k.
21118
21119 @item -mpcrel
21120 @opindex mpcrel
21121 Use the pc-relative addressing mode of the 68000 directly, instead of
21122 using a global offset table. At present, this option implies @option{-fpic},
21123 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21124 not presently supported with @option{-mpcrel}, though this could be supported for
21125 68020 and higher processors.
21126
21127 @item -mno-strict-align
21128 @itemx -mstrict-align
21129 @opindex mno-strict-align
21130 @opindex mstrict-align
21131 Do not (do) assume that unaligned memory references are handled by
21132 the system.
21133
21134 @item -msep-data
21135 Generate code that allows the data segment to be located in a different
21136 area of memory from the text segment. This allows for execute-in-place in
21137 an environment without virtual memory management. This option implies
21138 @option{-fPIC}.
21139
21140 @item -mno-sep-data
21141 Generate code that assumes that the data segment follows the text segment.
21142 This is the default.
21143
21144 @item -mid-shared-library
21145 Generate code that supports shared libraries via the library ID method.
21146 This allows for execute-in-place and shared libraries in an environment
21147 without virtual memory management. This option implies @option{-fPIC}.
21148
21149 @item -mno-id-shared-library
21150 Generate code that doesn't assume ID-based shared libraries are being used.
21151 This is the default.
21152
21153 @item -mshared-library-id=n
21154 Specifies the identification number of the ID-based shared library being
21155 compiled. Specifying a value of 0 generates more compact code; specifying
21156 other values forces the allocation of that number to the current
21157 library, but is no more space- or time-efficient than omitting this option.
21158
21159 @item -mxgot
21160 @itemx -mno-xgot
21161 @opindex mxgot
21162 @opindex mno-xgot
21163 When generating position-independent code for ColdFire, generate code
21164 that works if the GOT has more than 8192 entries. This code is
21165 larger and slower than code generated without this option. On M680x0
21166 processors, this option is not needed; @option{-fPIC} suffices.
21167
21168 GCC normally uses a single instruction to load values from the GOT@.
21169 While this is relatively efficient, it only works if the GOT
21170 is smaller than about 64k. Anything larger causes the linker
21171 to report an error such as:
21172
21173 @cindex relocation truncated to fit (ColdFire)
21174 @smallexample
21175 relocation truncated to fit: R_68K_GOT16O foobar
21176 @end smallexample
21177
21178 If this happens, you should recompile your code with @option{-mxgot}.
21179 It should then work with very large GOTs. However, code generated with
21180 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21181 the value of a global symbol.
21182
21183 Note that some linkers, including newer versions of the GNU linker,
21184 can create multiple GOTs and sort GOT entries. If you have such a linker,
21185 you should only need to use @option{-mxgot} when compiling a single
21186 object file that accesses more than 8192 GOT entries. Very few do.
21187
21188 These options have no effect unless GCC is generating
21189 position-independent code.
21190
21191 @item -mlong-jump-table-offsets
21192 @opindex mlong-jump-table-offsets
21193 Use 32-bit offsets in @code{switch} tables. The default is to use
21194 16-bit offsets.
21195
21196 @end table
21197
21198 @node MCore Options
21199 @subsection MCore Options
21200 @cindex MCore options
21201
21202 These are the @samp{-m} options defined for the Motorola M*Core
21203 processors.
21204
21205 @table @gcctabopt
21206
21207 @item -mhardlit
21208 @itemx -mno-hardlit
21209 @opindex mhardlit
21210 @opindex mno-hardlit
21211 Inline constants into the code stream if it can be done in two
21212 instructions or less.
21213
21214 @item -mdiv
21215 @itemx -mno-div
21216 @opindex mdiv
21217 @opindex mno-div
21218 Use the divide instruction. (Enabled by default).
21219
21220 @item -mrelax-immediate
21221 @itemx -mno-relax-immediate
21222 @opindex mrelax-immediate
21223 @opindex mno-relax-immediate
21224 Allow arbitrary-sized immediates in bit operations.
21225
21226 @item -mwide-bitfields
21227 @itemx -mno-wide-bitfields
21228 @opindex mwide-bitfields
21229 @opindex mno-wide-bitfields
21230 Always treat bit-fields as @code{int}-sized.
21231
21232 @item -m4byte-functions
21233 @itemx -mno-4byte-functions
21234 @opindex m4byte-functions
21235 @opindex mno-4byte-functions
21236 Force all functions to be aligned to a 4-byte boundary.
21237
21238 @item -mcallgraph-data
21239 @itemx -mno-callgraph-data
21240 @opindex mcallgraph-data
21241 @opindex mno-callgraph-data
21242 Emit callgraph information.
21243
21244 @item -mslow-bytes
21245 @itemx -mno-slow-bytes
21246 @opindex mslow-bytes
21247 @opindex mno-slow-bytes
21248 Prefer word access when reading byte quantities.
21249
21250 @item -mlittle-endian
21251 @itemx -mbig-endian
21252 @opindex mlittle-endian
21253 @opindex mbig-endian
21254 Generate code for a little-endian target.
21255
21256 @item -m210
21257 @itemx -m340
21258 @opindex m210
21259 @opindex m340
21260 Generate code for the 210 processor.
21261
21262 @item -mno-lsim
21263 @opindex mno-lsim
21264 Assume that runtime support has been provided and so omit the
21265 simulator library (@file{libsim.a)} from the linker command line.
21266
21267 @item -mstack-increment=@var{size}
21268 @opindex mstack-increment
21269 Set the maximum amount for a single stack increment operation. Large
21270 values can increase the speed of programs that contain functions
21271 that need a large amount of stack space, but they can also trigger a
21272 segmentation fault if the stack is extended too much. The default
21273 value is 0x1000.
21274
21275 @end table
21276
21277 @node MeP Options
21278 @subsection MeP Options
21279 @cindex MeP options
21280
21281 @table @gcctabopt
21282
21283 @item -mabsdiff
21284 @opindex mabsdiff
21285 Enables the @code{abs} instruction, which is the absolute difference
21286 between two registers.
21287
21288 @item -mall-opts
21289 @opindex mall-opts
21290 Enables all the optional instructions---average, multiply, divide, bit
21291 operations, leading zero, absolute difference, min/max, clip, and
21292 saturation.
21293
21294
21295 @item -maverage
21296 @opindex maverage
21297 Enables the @code{ave} instruction, which computes the average of two
21298 registers.
21299
21300 @item -mbased=@var{n}
21301 @opindex mbased=
21302 Variables of size @var{n} bytes or smaller are placed in the
21303 @code{.based} section by default. Based variables use the @code{$tp}
21304 register as a base register, and there is a 128-byte limit to the
21305 @code{.based} section.
21306
21307 @item -mbitops
21308 @opindex mbitops
21309 Enables the bit operation instructions---bit test (@code{btstm}), set
21310 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21311 test-and-set (@code{tas}).
21312
21313 @item -mc=@var{name}
21314 @opindex mc=
21315 Selects which section constant data is placed in. @var{name} may
21316 be @samp{tiny}, @samp{near}, or @samp{far}.
21317
21318 @item -mclip
21319 @opindex mclip
21320 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21321 useful unless you also provide @option{-mminmax}.
21322
21323 @item -mconfig=@var{name}
21324 @opindex mconfig=
21325 Selects one of the built-in core configurations. Each MeP chip has
21326 one or more modules in it; each module has a core CPU and a variety of
21327 coprocessors, optional instructions, and peripherals. The
21328 @code{MeP-Integrator} tool, not part of GCC, provides these
21329 configurations through this option; using this option is the same as
21330 using all the corresponding command-line options. The default
21331 configuration is @samp{default}.
21332
21333 @item -mcop
21334 @opindex mcop
21335 Enables the coprocessor instructions. By default, this is a 32-bit
21336 coprocessor. Note that the coprocessor is normally enabled via the
21337 @option{-mconfig=} option.
21338
21339 @item -mcop32
21340 @opindex mcop32
21341 Enables the 32-bit coprocessor's instructions.
21342
21343 @item -mcop64
21344 @opindex mcop64
21345 Enables the 64-bit coprocessor's instructions.
21346
21347 @item -mivc2
21348 @opindex mivc2
21349 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21350
21351 @item -mdc
21352 @opindex mdc
21353 Causes constant variables to be placed in the @code{.near} section.
21354
21355 @item -mdiv
21356 @opindex mdiv
21357 Enables the @code{div} and @code{divu} instructions.
21358
21359 @item -meb
21360 @opindex meb
21361 Generate big-endian code.
21362
21363 @item -mel
21364 @opindex mel
21365 Generate little-endian code.
21366
21367 @item -mio-volatile
21368 @opindex mio-volatile
21369 Tells the compiler that any variable marked with the @code{io}
21370 attribute is to be considered volatile.
21371
21372 @item -ml
21373 @opindex ml
21374 Causes variables to be assigned to the @code{.far} section by default.
21375
21376 @item -mleadz
21377 @opindex mleadz
21378 Enables the @code{leadz} (leading zero) instruction.
21379
21380 @item -mm
21381 @opindex mm
21382 Causes variables to be assigned to the @code{.near} section by default.
21383
21384 @item -mminmax
21385 @opindex mminmax
21386 Enables the @code{min} and @code{max} instructions.
21387
21388 @item -mmult
21389 @opindex mmult
21390 Enables the multiplication and multiply-accumulate instructions.
21391
21392 @item -mno-opts
21393 @opindex mno-opts
21394 Disables all the optional instructions enabled by @option{-mall-opts}.
21395
21396 @item -mrepeat
21397 @opindex mrepeat
21398 Enables the @code{repeat} and @code{erepeat} instructions, used for
21399 low-overhead looping.
21400
21401 @item -ms
21402 @opindex ms
21403 Causes all variables to default to the @code{.tiny} section. Note
21404 that there is a 65536-byte limit to this section. Accesses to these
21405 variables use the @code{%gp} base register.
21406
21407 @item -msatur
21408 @opindex msatur
21409 Enables the saturation instructions. Note that the compiler does not
21410 currently generate these itself, but this option is included for
21411 compatibility with other tools, like @code{as}.
21412
21413 @item -msdram
21414 @opindex msdram
21415 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21416
21417 @item -msim
21418 @opindex msim
21419 Link the simulator run-time libraries.
21420
21421 @item -msimnovec
21422 @opindex msimnovec
21423 Link the simulator runtime libraries, excluding built-in support
21424 for reset and exception vectors and tables.
21425
21426 @item -mtf
21427 @opindex mtf
21428 Causes all functions to default to the @code{.far} section. Without
21429 this option, functions default to the @code{.near} section.
21430
21431 @item -mtiny=@var{n}
21432 @opindex mtiny=
21433 Variables that are @var{n} bytes or smaller are allocated to the
21434 @code{.tiny} section. These variables use the @code{$gp} base
21435 register. The default for this option is 4, but note that there's a
21436 65536-byte limit to the @code{.tiny} section.
21437
21438 @end table
21439
21440 @node MicroBlaze Options
21441 @subsection MicroBlaze Options
21442 @cindex MicroBlaze Options
21443
21444 @table @gcctabopt
21445
21446 @item -msoft-float
21447 @opindex msoft-float
21448 Use software emulation for floating point (default).
21449
21450 @item -mhard-float
21451 @opindex mhard-float
21452 Use hardware floating-point instructions.
21453
21454 @item -mmemcpy
21455 @opindex mmemcpy
21456 Do not optimize block moves, use @code{memcpy}.
21457
21458 @item -mno-clearbss
21459 @opindex mno-clearbss
21460 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21461
21462 @item -mcpu=@var{cpu-type}
21463 @opindex mcpu=
21464 Use features of, and schedule code for, the given CPU.
21465 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21466 where @var{X} is a major version, @var{YY} is the minor version, and
21467 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21468 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21469
21470 @item -mxl-soft-mul
21471 @opindex mxl-soft-mul
21472 Use software multiply emulation (default).
21473
21474 @item -mxl-soft-div
21475 @opindex mxl-soft-div
21476 Use software emulation for divides (default).
21477
21478 @item -mxl-barrel-shift
21479 @opindex mxl-barrel-shift
21480 Use the hardware barrel shifter.
21481
21482 @item -mxl-pattern-compare
21483 @opindex mxl-pattern-compare
21484 Use pattern compare instructions.
21485
21486 @item -msmall-divides
21487 @opindex msmall-divides
21488 Use table lookup optimization for small signed integer divisions.
21489
21490 @item -mxl-stack-check
21491 @opindex mxl-stack-check
21492 This option is deprecated. Use @option{-fstack-check} instead.
21493
21494 @item -mxl-gp-opt
21495 @opindex mxl-gp-opt
21496 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21497
21498 @item -mxl-multiply-high
21499 @opindex mxl-multiply-high
21500 Use multiply high instructions for high part of 32x32 multiply.
21501
21502 @item -mxl-float-convert
21503 @opindex mxl-float-convert
21504 Use hardware floating-point conversion instructions.
21505
21506 @item -mxl-float-sqrt
21507 @opindex mxl-float-sqrt
21508 Use hardware floating-point square root instruction.
21509
21510 @item -mbig-endian
21511 @opindex mbig-endian
21512 Generate code for a big-endian target.
21513
21514 @item -mlittle-endian
21515 @opindex mlittle-endian
21516 Generate code for a little-endian target.
21517
21518 @item -mxl-reorder
21519 @opindex mxl-reorder
21520 Use reorder instructions (swap and byte reversed load/store).
21521
21522 @item -mxl-mode-@var{app-model}
21523 Select application model @var{app-model}. Valid models are
21524 @table @samp
21525 @item executable
21526 normal executable (default), uses startup code @file{crt0.o}.
21527
21528 @item -mpic-data-is-text-relative
21529 @opindex mpic-data-is-text-relative
21530 Assume that the displacement between the text and data segments is fixed
21531 at static link time. This allows data to be referenced by offset from start of
21532 text address instead of GOT since PC-relative addressing is not supported.
21533
21534 @item xmdstub
21535 for use with Xilinx Microprocessor Debugger (XMD) based
21536 software intrusive debug agent called xmdstub. This uses startup file
21537 @file{crt1.o} and sets the start address of the program to 0x800.
21538
21539 @item bootstrap
21540 for applications that are loaded using a bootloader.
21541 This model uses startup file @file{crt2.o} which does not contain a processor
21542 reset vector handler. This is suitable for transferring control on a
21543 processor reset to the bootloader rather than the application.
21544
21545 @item novectors
21546 for applications that do not require any of the
21547 MicroBlaze vectors. This option may be useful for applications running
21548 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21549 @end table
21550
21551 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21552 @option{-mxl-mode-@var{app-model}}.
21553
21554 @end table
21555
21556 @node MIPS Options
21557 @subsection MIPS Options
21558 @cindex MIPS options
21559
21560 @table @gcctabopt
21561
21562 @item -EB
21563 @opindex EB
21564 Generate big-endian code.
21565
21566 @item -EL
21567 @opindex EL
21568 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21569 configurations.
21570
21571 @item -march=@var{arch}
21572 @opindex march
21573 Generate code that runs on @var{arch}, which can be the name of a
21574 generic MIPS ISA, or the name of a particular processor.
21575 The ISA names are:
21576 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21577 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21578 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21579 @samp{mips64r5} and @samp{mips64r6}.
21580 The processor names are:
21581 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21582 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21583 @samp{5kc}, @samp{5kf},
21584 @samp{20kc},
21585 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21586 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21587 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21588 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21589 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21590 @samp{i6400}, @samp{i6500},
21591 @samp{interaptiv},
21592 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21593 @samp{gs464e}, @samp{gs264e},
21594 @samp{m4k},
21595 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21596 @samp{m5100}, @samp{m5101},
21597 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21598 @samp{orion},
21599 @samp{p5600}, @samp{p6600},
21600 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21601 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21602 @samp{r6000}, @samp{r8000},
21603 @samp{rm7000}, @samp{rm9000},
21604 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21605 @samp{sb1},
21606 @samp{sr71000},
21607 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21608 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21609 @samp{xlr} and @samp{xlp}.
21610 The special value @samp{from-abi} selects the
21611 most compatible architecture for the selected ABI (that is,
21612 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21613
21614 The native Linux/GNU toolchain also supports the value @samp{native},
21615 which selects the best architecture option for the host processor.
21616 @option{-march=native} has no effect if GCC does not recognize
21617 the processor.
21618
21619 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21620 (for example, @option{-march=r2k}). Prefixes are optional, and
21621 @samp{vr} may be written @samp{r}.
21622
21623 Names of the form @samp{@var{n}f2_1} refer to processors with
21624 FPUs clocked at half the rate of the core, names of the form
21625 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21626 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21627 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21628 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21629 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21630 accepted as synonyms for @samp{@var{n}f1_1}.
21631
21632 GCC defines two macros based on the value of this option. The first
21633 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21634 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21635 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21636 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21637 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21638
21639 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21640 above. In other words, it has the full prefix and does not
21641 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21642 the macro names the resolved architecture (either @code{"mips1"} or
21643 @code{"mips3"}). It names the default architecture when no
21644 @option{-march} option is given.
21645
21646 @item -mtune=@var{arch}
21647 @opindex mtune
21648 Optimize for @var{arch}. Among other things, this option controls
21649 the way instructions are scheduled, and the perceived cost of arithmetic
21650 operations. The list of @var{arch} values is the same as for
21651 @option{-march}.
21652
21653 When this option is not used, GCC optimizes for the processor
21654 specified by @option{-march}. By using @option{-march} and
21655 @option{-mtune} together, it is possible to generate code that
21656 runs on a family of processors, but optimize the code for one
21657 particular member of that family.
21658
21659 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21660 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21661 @option{-march} ones described above.
21662
21663 @item -mips1
21664 @opindex mips1
21665 Equivalent to @option{-march=mips1}.
21666
21667 @item -mips2
21668 @opindex mips2
21669 Equivalent to @option{-march=mips2}.
21670
21671 @item -mips3
21672 @opindex mips3
21673 Equivalent to @option{-march=mips3}.
21674
21675 @item -mips4
21676 @opindex mips4
21677 Equivalent to @option{-march=mips4}.
21678
21679 @item -mips32
21680 @opindex mips32
21681 Equivalent to @option{-march=mips32}.
21682
21683 @item -mips32r3
21684 @opindex mips32r3
21685 Equivalent to @option{-march=mips32r3}.
21686
21687 @item -mips32r5
21688 @opindex mips32r5
21689 Equivalent to @option{-march=mips32r5}.
21690
21691 @item -mips32r6
21692 @opindex mips32r6
21693 Equivalent to @option{-march=mips32r6}.
21694
21695 @item -mips64
21696 @opindex mips64
21697 Equivalent to @option{-march=mips64}.
21698
21699 @item -mips64r2
21700 @opindex mips64r2
21701 Equivalent to @option{-march=mips64r2}.
21702
21703 @item -mips64r3
21704 @opindex mips64r3
21705 Equivalent to @option{-march=mips64r3}.
21706
21707 @item -mips64r5
21708 @opindex mips64r5
21709 Equivalent to @option{-march=mips64r5}.
21710
21711 @item -mips64r6
21712 @opindex mips64r6
21713 Equivalent to @option{-march=mips64r6}.
21714
21715 @item -mips16
21716 @itemx -mno-mips16
21717 @opindex mips16
21718 @opindex mno-mips16
21719 Generate (do not generate) MIPS16 code. If GCC is targeting a
21720 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21721
21722 MIPS16 code generation can also be controlled on a per-function basis
21723 by means of @code{mips16} and @code{nomips16} attributes.
21724 @xref{Function Attributes}, for more information.
21725
21726 @item -mflip-mips16
21727 @opindex mflip-mips16
21728 Generate MIPS16 code on alternating functions. This option is provided
21729 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21730 not intended for ordinary use in compiling user code.
21731
21732 @item -minterlink-compressed
21733 @itemx -mno-interlink-compressed
21734 @opindex minterlink-compressed
21735 @opindex mno-interlink-compressed
21736 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21737 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21738
21739 For example, code using the standard ISA encoding cannot jump directly
21740 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21741 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21742 knows that the target of the jump is not compressed.
21743
21744 @item -minterlink-mips16
21745 @itemx -mno-interlink-mips16
21746 @opindex minterlink-mips16
21747 @opindex mno-interlink-mips16
21748 Aliases of @option{-minterlink-compressed} and
21749 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21750 and are retained for backwards compatibility.
21751
21752 @item -mabi=32
21753 @itemx -mabi=o64
21754 @itemx -mabi=n32
21755 @itemx -mabi=64
21756 @itemx -mabi=eabi
21757 @opindex mabi=32
21758 @opindex mabi=o64
21759 @opindex mabi=n32
21760 @opindex mabi=64
21761 @opindex mabi=eabi
21762 Generate code for the given ABI@.
21763
21764 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21765 generates 64-bit code when you select a 64-bit architecture, but you
21766 can use @option{-mgp32} to get 32-bit code instead.
21767
21768 For information about the O64 ABI, see
21769 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21770
21771 GCC supports a variant of the o32 ABI in which floating-point registers
21772 are 64 rather than 32 bits wide. You can select this combination with
21773 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21774 and @code{mfhc1} instructions and is therefore only supported for
21775 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21776
21777 The register assignments for arguments and return values remain the
21778 same, but each scalar value is passed in a single 64-bit register
21779 rather than a pair of 32-bit registers. For example, scalar
21780 floating-point values are returned in @samp{$f0} only, not a
21781 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21782 remains the same in that the even-numbered double-precision registers
21783 are saved.
21784
21785 Two additional variants of the o32 ABI are supported to enable
21786 a transition from 32-bit to 64-bit registers. These are FPXX
21787 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21788 The FPXX extension mandates that all code must execute correctly
21789 when run using 32-bit or 64-bit registers. The code can be interlinked
21790 with either FP32 or FP64, but not both.
21791 The FP64A extension is similar to the FP64 extension but forbids the
21792 use of odd-numbered single-precision registers. This can be used
21793 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21794 processors and allows both FP32 and FP64A code to interlink and
21795 run in the same process without changing FPU modes.
21796
21797 @item -mabicalls
21798 @itemx -mno-abicalls
21799 @opindex mabicalls
21800 @opindex mno-abicalls
21801 Generate (do not generate) code that is suitable for SVR4-style
21802 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21803 systems.
21804
21805 @item -mshared
21806 @itemx -mno-shared
21807 Generate (do not generate) code that is fully position-independent,
21808 and that can therefore be linked into shared libraries. This option
21809 only affects @option{-mabicalls}.
21810
21811 All @option{-mabicalls} code has traditionally been position-independent,
21812 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21813 as an extension, the GNU toolchain allows executables to use absolute
21814 accesses for locally-binding symbols. It can also use shorter GP
21815 initialization sequences and generate direct calls to locally-defined
21816 functions. This mode is selected by @option{-mno-shared}.
21817
21818 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21819 objects that can only be linked by the GNU linker. However, the option
21820 does not affect the ABI of the final executable; it only affects the ABI
21821 of relocatable objects. Using @option{-mno-shared} generally makes
21822 executables both smaller and quicker.
21823
21824 @option{-mshared} is the default.
21825
21826 @item -mplt
21827 @itemx -mno-plt
21828 @opindex mplt
21829 @opindex mno-plt
21830 Assume (do not assume) that the static and dynamic linkers
21831 support PLTs and copy relocations. This option only affects
21832 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21833 has no effect without @option{-msym32}.
21834
21835 You can make @option{-mplt} the default by configuring
21836 GCC with @option{--with-mips-plt}. The default is
21837 @option{-mno-plt} otherwise.
21838
21839 @item -mxgot
21840 @itemx -mno-xgot
21841 @opindex mxgot
21842 @opindex mno-xgot
21843 Lift (do not lift) the usual restrictions on the size of the global
21844 offset table.
21845
21846 GCC normally uses a single instruction to load values from the GOT@.
21847 While this is relatively efficient, it only works if the GOT
21848 is smaller than about 64k. Anything larger causes the linker
21849 to report an error such as:
21850
21851 @cindex relocation truncated to fit (MIPS)
21852 @smallexample
21853 relocation truncated to fit: R_MIPS_GOT16 foobar
21854 @end smallexample
21855
21856 If this happens, you should recompile your code with @option{-mxgot}.
21857 This works with very large GOTs, although the code is also
21858 less efficient, since it takes three instructions to fetch the
21859 value of a global symbol.
21860
21861 Note that some linkers can create multiple GOTs. If you have such a
21862 linker, you should only need to use @option{-mxgot} when a single object
21863 file accesses more than 64k's worth of GOT entries. Very few do.
21864
21865 These options have no effect unless GCC is generating position
21866 independent code.
21867
21868 @item -mgp32
21869 @opindex mgp32
21870 Assume that general-purpose registers are 32 bits wide.
21871
21872 @item -mgp64
21873 @opindex mgp64
21874 Assume that general-purpose registers are 64 bits wide.
21875
21876 @item -mfp32
21877 @opindex mfp32
21878 Assume that floating-point registers are 32 bits wide.
21879
21880 @item -mfp64
21881 @opindex mfp64
21882 Assume that floating-point registers are 64 bits wide.
21883
21884 @item -mfpxx
21885 @opindex mfpxx
21886 Do not assume the width of floating-point registers.
21887
21888 @item -mhard-float
21889 @opindex mhard-float
21890 Use floating-point coprocessor instructions.
21891
21892 @item -msoft-float
21893 @opindex msoft-float
21894 Do not use floating-point coprocessor instructions. Implement
21895 floating-point calculations using library calls instead.
21896
21897 @item -mno-float
21898 @opindex mno-float
21899 Equivalent to @option{-msoft-float}, but additionally asserts that the
21900 program being compiled does not perform any floating-point operations.
21901 This option is presently supported only by some bare-metal MIPS
21902 configurations, where it may select a special set of libraries
21903 that lack all floating-point support (including, for example, the
21904 floating-point @code{printf} formats).
21905 If code compiled with @option{-mno-float} accidentally contains
21906 floating-point operations, it is likely to suffer a link-time
21907 or run-time failure.
21908
21909 @item -msingle-float
21910 @opindex msingle-float
21911 Assume that the floating-point coprocessor only supports single-precision
21912 operations.
21913
21914 @item -mdouble-float
21915 @opindex mdouble-float
21916 Assume that the floating-point coprocessor supports double-precision
21917 operations. This is the default.
21918
21919 @item -modd-spreg
21920 @itemx -mno-odd-spreg
21921 @opindex modd-spreg
21922 @opindex mno-odd-spreg
21923 Enable the use of odd-numbered single-precision floating-point registers
21924 for the o32 ABI. This is the default for processors that are known to
21925 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21926 is set by default.
21927
21928 @item -mabs=2008
21929 @itemx -mabs=legacy
21930 @opindex mabs=2008
21931 @opindex mabs=legacy
21932 These options control the treatment of the special not-a-number (NaN)
21933 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21934 @code{neg.@i{fmt}} machine instructions.
21935
21936 By default or when @option{-mabs=legacy} is used the legacy
21937 treatment is selected. In this case these instructions are considered
21938 arithmetic and avoided where correct operation is required and the
21939 input operand might be a NaN. A longer sequence of instructions that
21940 manipulate the sign bit of floating-point datum manually is used
21941 instead unless the @option{-ffinite-math-only} option has also been
21942 specified.
21943
21944 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21945 this case these instructions are considered non-arithmetic and therefore
21946 operating correctly in all cases, including in particular where the
21947 input operand is a NaN. These instructions are therefore always used
21948 for the respective operations.
21949
21950 @item -mnan=2008
21951 @itemx -mnan=legacy
21952 @opindex mnan=2008
21953 @opindex mnan=legacy
21954 These options control the encoding of the special not-a-number (NaN)
21955 IEEE 754 floating-point data.
21956
21957 The @option{-mnan=legacy} option selects the legacy encoding. In this
21958 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21959 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21960 by the first bit of their trailing significand field being 1.
21961
21962 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21963 this case qNaNs are denoted by the first bit of their trailing
21964 significand field being 1, whereas sNaNs are denoted by the first bit of
21965 their trailing significand field being 0.
21966
21967 The default is @option{-mnan=legacy} unless GCC has been configured with
21968 @option{--with-nan=2008}.
21969
21970 @item -mllsc
21971 @itemx -mno-llsc
21972 @opindex mllsc
21973 @opindex mno-llsc
21974 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21975 implement atomic memory built-in functions. When neither option is
21976 specified, GCC uses the instructions if the target architecture
21977 supports them.
21978
21979 @option{-mllsc} is useful if the runtime environment can emulate the
21980 instructions and @option{-mno-llsc} can be useful when compiling for
21981 nonstandard ISAs. You can make either option the default by
21982 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21983 respectively. @option{--with-llsc} is the default for some
21984 configurations; see the installation documentation for details.
21985
21986 @item -mdsp
21987 @itemx -mno-dsp
21988 @opindex mdsp
21989 @opindex mno-dsp
21990 Use (do not use) revision 1 of the MIPS DSP ASE@.
21991 @xref{MIPS DSP Built-in Functions}. This option defines the
21992 preprocessor macro @code{__mips_dsp}. It also defines
21993 @code{__mips_dsp_rev} to 1.
21994
21995 @item -mdspr2
21996 @itemx -mno-dspr2
21997 @opindex mdspr2
21998 @opindex mno-dspr2
21999 Use (do not use) revision 2 of the MIPS DSP ASE@.
22000 @xref{MIPS DSP Built-in Functions}. This option defines the
22001 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22002 It also defines @code{__mips_dsp_rev} to 2.
22003
22004 @item -msmartmips
22005 @itemx -mno-smartmips
22006 @opindex msmartmips
22007 @opindex mno-smartmips
22008 Use (do not use) the MIPS SmartMIPS ASE.
22009
22010 @item -mpaired-single
22011 @itemx -mno-paired-single
22012 @opindex mpaired-single
22013 @opindex mno-paired-single
22014 Use (do not use) paired-single floating-point instructions.
22015 @xref{MIPS Paired-Single Support}. This option requires
22016 hardware floating-point support to be enabled.
22017
22018 @item -mdmx
22019 @itemx -mno-mdmx
22020 @opindex mdmx
22021 @opindex mno-mdmx
22022 Use (do not use) MIPS Digital Media Extension instructions.
22023 This option can only be used when generating 64-bit code and requires
22024 hardware floating-point support to be enabled.
22025
22026 @item -mips3d
22027 @itemx -mno-mips3d
22028 @opindex mips3d
22029 @opindex mno-mips3d
22030 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22031 The option @option{-mips3d} implies @option{-mpaired-single}.
22032
22033 @item -mmicromips
22034 @itemx -mno-micromips
22035 @opindex mmicromips
22036 @opindex mno-mmicromips
22037 Generate (do not generate) microMIPS code.
22038
22039 MicroMIPS code generation can also be controlled on a per-function basis
22040 by means of @code{micromips} and @code{nomicromips} attributes.
22041 @xref{Function Attributes}, for more information.
22042
22043 @item -mmt
22044 @itemx -mno-mt
22045 @opindex mmt
22046 @opindex mno-mt
22047 Use (do not use) MT Multithreading instructions.
22048
22049 @item -mmcu
22050 @itemx -mno-mcu
22051 @opindex mmcu
22052 @opindex mno-mcu
22053 Use (do not use) the MIPS MCU ASE instructions.
22054
22055 @item -meva
22056 @itemx -mno-eva
22057 @opindex meva
22058 @opindex mno-eva
22059 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22060
22061 @item -mvirt
22062 @itemx -mno-virt
22063 @opindex mvirt
22064 @opindex mno-virt
22065 Use (do not use) the MIPS Virtualization (VZ) instructions.
22066
22067 @item -mxpa
22068 @itemx -mno-xpa
22069 @opindex mxpa
22070 @opindex mno-xpa
22071 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22072
22073 @item -mcrc
22074 @itemx -mno-crc
22075 @opindex mcrc
22076 @opindex mno-crc
22077 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22078
22079 @item -mginv
22080 @itemx -mno-ginv
22081 @opindex mginv
22082 @opindex mno-ginv
22083 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22084
22085 @item -mloongson-mmi
22086 @itemx -mno-loongson-mmi
22087 @opindex mloongson-mmi
22088 @opindex mno-loongson-mmi
22089 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22090
22091 @item -mloongson-ext
22092 @itemx -mno-loongson-ext
22093 @opindex mloongson-ext
22094 @opindex mno-loongson-ext
22095 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22096
22097 @item -mloongson-ext2
22098 @itemx -mno-loongson-ext2
22099 @opindex mloongson-ext2
22100 @opindex mno-loongson-ext2
22101 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22102
22103 @item -mlong64
22104 @opindex mlong64
22105 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22106 an explanation of the default and the way that the pointer size is
22107 determined.
22108
22109 @item -mlong32
22110 @opindex mlong32
22111 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22112
22113 The default size of @code{int}s, @code{long}s and pointers depends on
22114 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22115 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22116 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22117 or the same size as integer registers, whichever is smaller.
22118
22119 @item -msym32
22120 @itemx -mno-sym32
22121 @opindex msym32
22122 @opindex mno-sym32
22123 Assume (do not assume) that all symbols have 32-bit values, regardless
22124 of the selected ABI@. This option is useful in combination with
22125 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22126 to generate shorter and faster references to symbolic addresses.
22127
22128 @item -G @var{num}
22129 @opindex G
22130 Put definitions of externally-visible data in a small data section
22131 if that data is no bigger than @var{num} bytes. GCC can then generate
22132 more efficient accesses to the data; see @option{-mgpopt} for details.
22133
22134 The default @option{-G} option depends on the configuration.
22135
22136 @item -mlocal-sdata
22137 @itemx -mno-local-sdata
22138 @opindex mlocal-sdata
22139 @opindex mno-local-sdata
22140 Extend (do not extend) the @option{-G} behavior to local data too,
22141 such as to static variables in C@. @option{-mlocal-sdata} is the
22142 default for all configurations.
22143
22144 If the linker complains that an application is using too much small data,
22145 you might want to try rebuilding the less performance-critical parts with
22146 @option{-mno-local-sdata}. You might also want to build large
22147 libraries with @option{-mno-local-sdata}, so that the libraries leave
22148 more room for the main program.
22149
22150 @item -mextern-sdata
22151 @itemx -mno-extern-sdata
22152 @opindex mextern-sdata
22153 @opindex mno-extern-sdata
22154 Assume (do not assume) that externally-defined data is in
22155 a small data section if the size of that data is within the @option{-G} limit.
22156 @option{-mextern-sdata} is the default for all configurations.
22157
22158 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22159 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22160 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22161 is placed in a small data section. If @var{Var} is defined by another
22162 module, you must either compile that module with a high-enough
22163 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22164 definition. If @var{Var} is common, you must link the application
22165 with a high-enough @option{-G} setting.
22166
22167 The easiest way of satisfying these restrictions is to compile
22168 and link every module with the same @option{-G} option. However,
22169 you may wish to build a library that supports several different
22170 small data limits. You can do this by compiling the library with
22171 the highest supported @option{-G} setting and additionally using
22172 @option{-mno-extern-sdata} to stop the library from making assumptions
22173 about externally-defined data.
22174
22175 @item -mgpopt
22176 @itemx -mno-gpopt
22177 @opindex mgpopt
22178 @opindex mno-gpopt
22179 Use (do not use) GP-relative accesses for symbols that are known to be
22180 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22181 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22182 configurations.
22183
22184 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22185 might not hold the value of @code{_gp}. For example, if the code is
22186 part of a library that might be used in a boot monitor, programs that
22187 call boot monitor routines pass an unknown value in @code{$gp}.
22188 (In such situations, the boot monitor itself is usually compiled
22189 with @option{-G0}.)
22190
22191 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22192 @option{-mno-extern-sdata}.
22193
22194 @item -membedded-data
22195 @itemx -mno-embedded-data
22196 @opindex membedded-data
22197 @opindex mno-embedded-data
22198 Allocate variables to the read-only data section first if possible, then
22199 next in the small data section if possible, otherwise in data. This gives
22200 slightly slower code than the default, but reduces the amount of RAM required
22201 when executing, and thus may be preferred for some embedded systems.
22202
22203 @item -muninit-const-in-rodata
22204 @itemx -mno-uninit-const-in-rodata
22205 @opindex muninit-const-in-rodata
22206 @opindex mno-uninit-const-in-rodata
22207 Put uninitialized @code{const} variables in the read-only data section.
22208 This option is only meaningful in conjunction with @option{-membedded-data}.
22209
22210 @item -mcode-readable=@var{setting}
22211 @opindex mcode-readable
22212 Specify whether GCC may generate code that reads from executable sections.
22213 There are three possible settings:
22214
22215 @table @gcctabopt
22216 @item -mcode-readable=yes
22217 Instructions may freely access executable sections. This is the
22218 default setting.
22219
22220 @item -mcode-readable=pcrel
22221 MIPS16 PC-relative load instructions can access executable sections,
22222 but other instructions must not do so. This option is useful on 4KSc
22223 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22224 It is also useful on processors that can be configured to have a dual
22225 instruction/data SRAM interface and that, like the M4K, automatically
22226 redirect PC-relative loads to the instruction RAM.
22227
22228 @item -mcode-readable=no
22229 Instructions must not access executable sections. This option can be
22230 useful on targets that are configured to have a dual instruction/data
22231 SRAM interface but that (unlike the M4K) do not automatically redirect
22232 PC-relative loads to the instruction RAM.
22233 @end table
22234
22235 @item -msplit-addresses
22236 @itemx -mno-split-addresses
22237 @opindex msplit-addresses
22238 @opindex mno-split-addresses
22239 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22240 relocation operators. This option has been superseded by
22241 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22242
22243 @item -mexplicit-relocs
22244 @itemx -mno-explicit-relocs
22245 @opindex mexplicit-relocs
22246 @opindex mno-explicit-relocs
22247 Use (do not use) assembler relocation operators when dealing with symbolic
22248 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22249 is to use assembler macros instead.
22250
22251 @option{-mexplicit-relocs} is the default if GCC was configured
22252 to use an assembler that supports relocation operators.
22253
22254 @item -mcheck-zero-division
22255 @itemx -mno-check-zero-division
22256 @opindex mcheck-zero-division
22257 @opindex mno-check-zero-division
22258 Trap (do not trap) on integer division by zero.
22259
22260 The default is @option{-mcheck-zero-division}.
22261
22262 @item -mdivide-traps
22263 @itemx -mdivide-breaks
22264 @opindex mdivide-traps
22265 @opindex mdivide-breaks
22266 MIPS systems check for division by zero by generating either a
22267 conditional trap or a break instruction. Using traps results in
22268 smaller code, but is only supported on MIPS II and later. Also, some
22269 versions of the Linux kernel have a bug that prevents trap from
22270 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22271 allow conditional traps on architectures that support them and
22272 @option{-mdivide-breaks} to force the use of breaks.
22273
22274 The default is usually @option{-mdivide-traps}, but this can be
22275 overridden at configure time using @option{--with-divide=breaks}.
22276 Divide-by-zero checks can be completely disabled using
22277 @option{-mno-check-zero-division}.
22278
22279 @item -mload-store-pairs
22280 @itemx -mno-load-store-pairs
22281 @opindex mload-store-pairs
22282 @opindex mno-load-store-pairs
22283 Enable (disable) an optimization that pairs consecutive load or store
22284 instructions to enable load/store bonding. This option is enabled by
22285 default but only takes effect when the selected architecture is known
22286 to support bonding.
22287
22288 @item -mmemcpy
22289 @itemx -mno-memcpy
22290 @opindex mmemcpy
22291 @opindex mno-memcpy
22292 Force (do not force) the use of @code{memcpy} for non-trivial block
22293 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22294 most constant-sized copies.
22295
22296 @item -mlong-calls
22297 @itemx -mno-long-calls
22298 @opindex mlong-calls
22299 @opindex mno-long-calls
22300 Disable (do not disable) use of the @code{jal} instruction. Calling
22301 functions using @code{jal} is more efficient but requires the caller
22302 and callee to be in the same 256 megabyte segment.
22303
22304 This option has no effect on abicalls code. The default is
22305 @option{-mno-long-calls}.
22306
22307 @item -mmad
22308 @itemx -mno-mad
22309 @opindex mmad
22310 @opindex mno-mad
22311 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22312 instructions, as provided by the R4650 ISA@.
22313
22314 @item -mimadd
22315 @itemx -mno-imadd
22316 @opindex mimadd
22317 @opindex mno-imadd
22318 Enable (disable) use of the @code{madd} and @code{msub} integer
22319 instructions. The default is @option{-mimadd} on architectures
22320 that support @code{madd} and @code{msub} except for the 74k
22321 architecture where it was found to generate slower code.
22322
22323 @item -mfused-madd
22324 @itemx -mno-fused-madd
22325 @opindex mfused-madd
22326 @opindex mno-fused-madd
22327 Enable (disable) use of the floating-point multiply-accumulate
22328 instructions, when they are available. The default is
22329 @option{-mfused-madd}.
22330
22331 On the R8000 CPU when multiply-accumulate instructions are used,
22332 the intermediate product is calculated to infinite precision
22333 and is not subject to the FCSR Flush to Zero bit. This may be
22334 undesirable in some circumstances. On other processors the result
22335 is numerically identical to the equivalent computation using
22336 separate multiply, add, subtract and negate instructions.
22337
22338 @item -nocpp
22339 @opindex nocpp
22340 Tell the MIPS assembler to not run its preprocessor over user
22341 assembler files (with a @samp{.s} suffix) when assembling them.
22342
22343 @item -mfix-24k
22344 @itemx -mno-fix-24k
22345 @opindex mfix-24k
22346 @opindex mno-fix-24k
22347 Work around the 24K E48 (lost data on stores during refill) errata.
22348 The workarounds are implemented by the assembler rather than by GCC@.
22349
22350 @item -mfix-r4000
22351 @itemx -mno-fix-r4000
22352 @opindex mfix-r4000
22353 @opindex mno-fix-r4000
22354 Work around certain R4000 CPU errata:
22355 @itemize @minus
22356 @item
22357 A double-word or a variable shift may give an incorrect result if executed
22358 immediately after starting an integer division.
22359 @item
22360 A double-word or a variable shift may give an incorrect result if executed
22361 while an integer multiplication is in progress.
22362 @item
22363 An integer division may give an incorrect result if started in a delay slot
22364 of a taken branch or a jump.
22365 @end itemize
22366
22367 @item -mfix-r4400
22368 @itemx -mno-fix-r4400
22369 @opindex mfix-r4400
22370 @opindex mno-fix-r4400
22371 Work around certain R4400 CPU errata:
22372 @itemize @minus
22373 @item
22374 A double-word or a variable shift may give an incorrect result if executed
22375 immediately after starting an integer division.
22376 @end itemize
22377
22378 @item -mfix-r10000
22379 @itemx -mno-fix-r10000
22380 @opindex mfix-r10000
22381 @opindex mno-fix-r10000
22382 Work around certain R10000 errata:
22383 @itemize @minus
22384 @item
22385 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22386 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22387 @end itemize
22388
22389 This option can only be used if the target architecture supports
22390 branch-likely instructions. @option{-mfix-r10000} is the default when
22391 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22392 otherwise.
22393
22394 @item -mfix-r5900
22395 @itemx -mno-fix-r5900
22396 @opindex mfix-r5900
22397 Do not attempt to schedule the preceding instruction into the delay slot
22398 of a branch instruction placed at the end of a short loop of six
22399 instructions or fewer and always schedule a @code{nop} instruction there
22400 instead. The short loop bug under certain conditions causes loops to
22401 execute only once or twice, due to a hardware bug in the R5900 chip. The
22402 workaround is implemented by the assembler rather than by GCC@.
22403
22404 @item -mfix-rm7000
22405 @itemx -mno-fix-rm7000
22406 @opindex mfix-rm7000
22407 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22408 workarounds are implemented by the assembler rather than by GCC@.
22409
22410 @item -mfix-vr4120
22411 @itemx -mno-fix-vr4120
22412 @opindex mfix-vr4120
22413 Work around certain VR4120 errata:
22414 @itemize @minus
22415 @item
22416 @code{dmultu} does not always produce the correct result.
22417 @item
22418 @code{div} and @code{ddiv} do not always produce the correct result if one
22419 of the operands is negative.
22420 @end itemize
22421 The workarounds for the division errata rely on special functions in
22422 @file{libgcc.a}. At present, these functions are only provided by
22423 the @code{mips64vr*-elf} configurations.
22424
22425 Other VR4120 errata require a NOP to be inserted between certain pairs of
22426 instructions. These errata are handled by the assembler, not by GCC itself.
22427
22428 @item -mfix-vr4130
22429 @opindex mfix-vr4130
22430 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22431 workarounds are implemented by the assembler rather than by GCC,
22432 although GCC avoids using @code{mflo} and @code{mfhi} if the
22433 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22434 instructions are available instead.
22435
22436 @item -mfix-sb1
22437 @itemx -mno-fix-sb1
22438 @opindex mfix-sb1
22439 Work around certain SB-1 CPU core errata.
22440 (This flag currently works around the SB-1 revision 2
22441 ``F1'' and ``F2'' floating-point errata.)
22442
22443 @item -mr10k-cache-barrier=@var{setting}
22444 @opindex mr10k-cache-barrier
22445 Specify whether GCC should insert cache barriers to avoid the
22446 side effects of speculation on R10K processors.
22447
22448 In common with many processors, the R10K tries to predict the outcome
22449 of a conditional branch and speculatively executes instructions from
22450 the ``taken'' branch. It later aborts these instructions if the
22451 predicted outcome is wrong. However, on the R10K, even aborted
22452 instructions can have side effects.
22453
22454 This problem only affects kernel stores and, depending on the system,
22455 kernel loads. As an example, a speculatively-executed store may load
22456 the target memory into cache and mark the cache line as dirty, even if
22457 the store itself is later aborted. If a DMA operation writes to the
22458 same area of memory before the ``dirty'' line is flushed, the cached
22459 data overwrites the DMA-ed data. See the R10K processor manual
22460 for a full description, including other potential problems.
22461
22462 One workaround is to insert cache barrier instructions before every memory
22463 access that might be speculatively executed and that might have side
22464 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22465 controls GCC's implementation of this workaround. It assumes that
22466 aborted accesses to any byte in the following regions does not have
22467 side effects:
22468
22469 @enumerate
22470 @item
22471 the memory occupied by the current function's stack frame;
22472
22473 @item
22474 the memory occupied by an incoming stack argument;
22475
22476 @item
22477 the memory occupied by an object with a link-time-constant address.
22478 @end enumerate
22479
22480 It is the kernel's responsibility to ensure that speculative
22481 accesses to these regions are indeed safe.
22482
22483 If the input program contains a function declaration such as:
22484
22485 @smallexample
22486 void foo (void);
22487 @end smallexample
22488
22489 then the implementation of @code{foo} must allow @code{j foo} and
22490 @code{jal foo} to be executed speculatively. GCC honors this
22491 restriction for functions it compiles itself. It expects non-GCC
22492 functions (such as hand-written assembly code) to do the same.
22493
22494 The option has three forms:
22495
22496 @table @gcctabopt
22497 @item -mr10k-cache-barrier=load-store
22498 Insert a cache barrier before a load or store that might be
22499 speculatively executed and that might have side effects even
22500 if aborted.
22501
22502 @item -mr10k-cache-barrier=store
22503 Insert a cache barrier before a store that might be speculatively
22504 executed and that might have side effects even if aborted.
22505
22506 @item -mr10k-cache-barrier=none
22507 Disable the insertion of cache barriers. This is the default setting.
22508 @end table
22509
22510 @item -mflush-func=@var{func}
22511 @itemx -mno-flush-func
22512 @opindex mflush-func
22513 Specifies the function to call to flush the I and D caches, or to not
22514 call any such function. If called, the function must take the same
22515 arguments as the common @code{_flush_func}, that is, the address of the
22516 memory range for which the cache is being flushed, the size of the
22517 memory range, and the number 3 (to flush both caches). The default
22518 depends on the target GCC was configured for, but commonly is either
22519 @code{_flush_func} or @code{__cpu_flush}.
22520
22521 @item mbranch-cost=@var{num}
22522 @opindex mbranch-cost
22523 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22524 This cost is only a heuristic and is not guaranteed to produce
22525 consistent results across releases. A zero cost redundantly selects
22526 the default, which is based on the @option{-mtune} setting.
22527
22528 @item -mbranch-likely
22529 @itemx -mno-branch-likely
22530 @opindex mbranch-likely
22531 @opindex mno-branch-likely
22532 Enable or disable use of Branch Likely instructions, regardless of the
22533 default for the selected architecture. By default, Branch Likely
22534 instructions may be generated if they are supported by the selected
22535 architecture. An exception is for the MIPS32 and MIPS64 architectures
22536 and processors that implement those architectures; for those, Branch
22537 Likely instructions are not be generated by default because the MIPS32
22538 and MIPS64 architectures specifically deprecate their use.
22539
22540 @item -mcompact-branches=never
22541 @itemx -mcompact-branches=optimal
22542 @itemx -mcompact-branches=always
22543 @opindex mcompact-branches=never
22544 @opindex mcompact-branches=optimal
22545 @opindex mcompact-branches=always
22546 These options control which form of branches will be generated. The
22547 default is @option{-mcompact-branches=optimal}.
22548
22549 The @option{-mcompact-branches=never} option ensures that compact branch
22550 instructions will never be generated.
22551
22552 The @option{-mcompact-branches=always} option ensures that a compact
22553 branch instruction will be generated if available. If a compact branch
22554 instruction is not available, a delay slot form of the branch will be
22555 used instead.
22556
22557 This option is supported from MIPS Release 6 onwards.
22558
22559 The @option{-mcompact-branches=optimal} option will cause a delay slot
22560 branch to be used if one is available in the current ISA and the delay
22561 slot is successfully filled. If the delay slot is not filled, a compact
22562 branch will be chosen if one is available.
22563
22564 @item -mfp-exceptions
22565 @itemx -mno-fp-exceptions
22566 @opindex mfp-exceptions
22567 Specifies whether FP exceptions are enabled. This affects how
22568 FP instructions are scheduled for some processors.
22569 The default is that FP exceptions are
22570 enabled.
22571
22572 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22573 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22574 FP pipe.
22575
22576 @item -mvr4130-align
22577 @itemx -mno-vr4130-align
22578 @opindex mvr4130-align
22579 The VR4130 pipeline is two-way superscalar, but can only issue two
22580 instructions together if the first one is 8-byte aligned. When this
22581 option is enabled, GCC aligns pairs of instructions that it
22582 thinks should execute in parallel.
22583
22584 This option only has an effect when optimizing for the VR4130.
22585 It normally makes code faster, but at the expense of making it bigger.
22586 It is enabled by default at optimization level @option{-O3}.
22587
22588 @item -msynci
22589 @itemx -mno-synci
22590 @opindex msynci
22591 Enable (disable) generation of @code{synci} instructions on
22592 architectures that support it. The @code{synci} instructions (if
22593 enabled) are generated when @code{__builtin___clear_cache} is
22594 compiled.
22595
22596 This option defaults to @option{-mno-synci}, but the default can be
22597 overridden by configuring GCC with @option{--with-synci}.
22598
22599 When compiling code for single processor systems, it is generally safe
22600 to use @code{synci}. However, on many multi-core (SMP) systems, it
22601 does not invalidate the instruction caches on all cores and may lead
22602 to undefined behavior.
22603
22604 @item -mrelax-pic-calls
22605 @itemx -mno-relax-pic-calls
22606 @opindex mrelax-pic-calls
22607 Try to turn PIC calls that are normally dispatched via register
22608 @code{$25} into direct calls. This is only possible if the linker can
22609 resolve the destination at link time and if the destination is within
22610 range for a direct call.
22611
22612 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22613 an assembler and a linker that support the @code{.reloc} assembly
22614 directive and @option{-mexplicit-relocs} is in effect. With
22615 @option{-mno-explicit-relocs}, this optimization can be performed by the
22616 assembler and the linker alone without help from the compiler.
22617
22618 @item -mmcount-ra-address
22619 @itemx -mno-mcount-ra-address
22620 @opindex mmcount-ra-address
22621 @opindex mno-mcount-ra-address
22622 Emit (do not emit) code that allows @code{_mcount} to modify the
22623 calling function's return address. When enabled, this option extends
22624 the usual @code{_mcount} interface with a new @var{ra-address}
22625 parameter, which has type @code{intptr_t *} and is passed in register
22626 @code{$12}. @code{_mcount} can then modify the return address by
22627 doing both of the following:
22628 @itemize
22629 @item
22630 Returning the new address in register @code{$31}.
22631 @item
22632 Storing the new address in @code{*@var{ra-address}},
22633 if @var{ra-address} is nonnull.
22634 @end itemize
22635
22636 The default is @option{-mno-mcount-ra-address}.
22637
22638 @item -mframe-header-opt
22639 @itemx -mno-frame-header-opt
22640 @opindex mframe-header-opt
22641 Enable (disable) frame header optimization in the o32 ABI. When using the
22642 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22643 function to write out register arguments. When enabled, this optimization
22644 will suppress the allocation of the frame header if it can be determined that
22645 it is unused.
22646
22647 This optimization is off by default at all optimization levels.
22648
22649 @item -mlxc1-sxc1
22650 @itemx -mno-lxc1-sxc1
22651 @opindex mlxc1-sxc1
22652 When applicable, enable (disable) the generation of @code{lwxc1},
22653 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22654
22655 @item -mmadd4
22656 @itemx -mno-madd4
22657 @opindex mmadd4
22658 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22659 @code{madd.d} and related instructions. Enabled by default.
22660
22661 @end table
22662
22663 @node MMIX Options
22664 @subsection MMIX Options
22665 @cindex MMIX Options
22666
22667 These options are defined for the MMIX:
22668
22669 @table @gcctabopt
22670 @item -mlibfuncs
22671 @itemx -mno-libfuncs
22672 @opindex mlibfuncs
22673 @opindex mno-libfuncs
22674 Specify that intrinsic library functions are being compiled, passing all
22675 values in registers, no matter the size.
22676
22677 @item -mepsilon
22678 @itemx -mno-epsilon
22679 @opindex mepsilon
22680 @opindex mno-epsilon
22681 Generate floating-point comparison instructions that compare with respect
22682 to the @code{rE} epsilon register.
22683
22684 @item -mabi=mmixware
22685 @itemx -mabi=gnu
22686 @opindex mabi=mmixware
22687 @opindex mabi=gnu
22688 Generate code that passes function parameters and return values that (in
22689 the called function) are seen as registers @code{$0} and up, as opposed to
22690 the GNU ABI which uses global registers @code{$231} and up.
22691
22692 @item -mzero-extend
22693 @itemx -mno-zero-extend
22694 @opindex mzero-extend
22695 @opindex mno-zero-extend
22696 When reading data from memory in sizes shorter than 64 bits, use (do not
22697 use) zero-extending load instructions by default, rather than
22698 sign-extending ones.
22699
22700 @item -mknuthdiv
22701 @itemx -mno-knuthdiv
22702 @opindex mknuthdiv
22703 @opindex mno-knuthdiv
22704 Make the result of a division yielding a remainder have the same sign as
22705 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22706 remainder follows the sign of the dividend. Both methods are
22707 arithmetically valid, the latter being almost exclusively used.
22708
22709 @item -mtoplevel-symbols
22710 @itemx -mno-toplevel-symbols
22711 @opindex mtoplevel-symbols
22712 @opindex mno-toplevel-symbols
22713 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22714 code can be used with the @code{PREFIX} assembly directive.
22715
22716 @item -melf
22717 @opindex melf
22718 Generate an executable in the ELF format, rather than the default
22719 @samp{mmo} format used by the @command{mmix} simulator.
22720
22721 @item -mbranch-predict
22722 @itemx -mno-branch-predict
22723 @opindex mbranch-predict
22724 @opindex mno-branch-predict
22725 Use (do not use) the probable-branch instructions, when static branch
22726 prediction indicates a probable branch.
22727
22728 @item -mbase-addresses
22729 @itemx -mno-base-addresses
22730 @opindex mbase-addresses
22731 @opindex mno-base-addresses
22732 Generate (do not generate) code that uses @emph{base addresses}. Using a
22733 base address automatically generates a request (handled by the assembler
22734 and the linker) for a constant to be set up in a global register. The
22735 register is used for one or more base address requests within the range 0
22736 to 255 from the value held in the register. The generally leads to short
22737 and fast code, but the number of different data items that can be
22738 addressed is limited. This means that a program that uses lots of static
22739 data may require @option{-mno-base-addresses}.
22740
22741 @item -msingle-exit
22742 @itemx -mno-single-exit
22743 @opindex msingle-exit
22744 @opindex mno-single-exit
22745 Force (do not force) generated code to have a single exit point in each
22746 function.
22747 @end table
22748
22749 @node MN10300 Options
22750 @subsection MN10300 Options
22751 @cindex MN10300 options
22752
22753 These @option{-m} options are defined for Matsushita MN10300 architectures:
22754
22755 @table @gcctabopt
22756 @item -mmult-bug
22757 @opindex mmult-bug
22758 Generate code to avoid bugs in the multiply instructions for the MN10300
22759 processors. This is the default.
22760
22761 @item -mno-mult-bug
22762 @opindex mno-mult-bug
22763 Do not generate code to avoid bugs in the multiply instructions for the
22764 MN10300 processors.
22765
22766 @item -mam33
22767 @opindex mam33
22768 Generate code using features specific to the AM33 processor.
22769
22770 @item -mno-am33
22771 @opindex mno-am33
22772 Do not generate code using features specific to the AM33 processor. This
22773 is the default.
22774
22775 @item -mam33-2
22776 @opindex mam33-2
22777 Generate code using features specific to the AM33/2.0 processor.
22778
22779 @item -mam34
22780 @opindex mam34
22781 Generate code using features specific to the AM34 processor.
22782
22783 @item -mtune=@var{cpu-type}
22784 @opindex mtune
22785 Use the timing characteristics of the indicated CPU type when
22786 scheduling instructions. This does not change the targeted processor
22787 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22788 @samp{am33-2} or @samp{am34}.
22789
22790 @item -mreturn-pointer-on-d0
22791 @opindex mreturn-pointer-on-d0
22792 When generating a function that returns a pointer, return the pointer
22793 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22794 only in @code{a0}, and attempts to call such functions without a prototype
22795 result in errors. Note that this option is on by default; use
22796 @option{-mno-return-pointer-on-d0} to disable it.
22797
22798 @item -mno-crt0
22799 @opindex mno-crt0
22800 Do not link in the C run-time initialization object file.
22801
22802 @item -mrelax
22803 @opindex mrelax
22804 Indicate to the linker that it should perform a relaxation optimization pass
22805 to shorten branches, calls and absolute memory addresses. This option only
22806 has an effect when used on the command line for the final link step.
22807
22808 This option makes symbolic debugging impossible.
22809
22810 @item -mliw
22811 @opindex mliw
22812 Allow the compiler to generate @emph{Long Instruction Word}
22813 instructions if the target is the @samp{AM33} or later. This is the
22814 default. This option defines the preprocessor macro @code{__LIW__}.
22815
22816 @item -mno-liw
22817 @opindex mno-liw
22818 Do not allow the compiler to generate @emph{Long Instruction Word}
22819 instructions. This option defines the preprocessor macro
22820 @code{__NO_LIW__}.
22821
22822 @item -msetlb
22823 @opindex msetlb
22824 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22825 instructions if the target is the @samp{AM33} or later. This is the
22826 default. This option defines the preprocessor macro @code{__SETLB__}.
22827
22828 @item -mno-setlb
22829 @opindex mno-setlb
22830 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22831 instructions. This option defines the preprocessor macro
22832 @code{__NO_SETLB__}.
22833
22834 @end table
22835
22836 @node Moxie Options
22837 @subsection Moxie Options
22838 @cindex Moxie Options
22839
22840 @table @gcctabopt
22841
22842 @item -meb
22843 @opindex meb
22844 Generate big-endian code. This is the default for @samp{moxie-*-*}
22845 configurations.
22846
22847 @item -mel
22848 @opindex mel
22849 Generate little-endian code.
22850
22851 @item -mmul.x
22852 @opindex mmul.x
22853 Generate mul.x and umul.x instructions. This is the default for
22854 @samp{moxiebox-*-*} configurations.
22855
22856 @item -mno-crt0
22857 @opindex mno-crt0
22858 Do not link in the C run-time initialization object file.
22859
22860 @end table
22861
22862 @node MSP430 Options
22863 @subsection MSP430 Options
22864 @cindex MSP430 Options
22865
22866 These options are defined for the MSP430:
22867
22868 @table @gcctabopt
22869
22870 @item -masm-hex
22871 @opindex masm-hex
22872 Force assembly output to always use hex constants. Normally such
22873 constants are signed decimals, but this option is available for
22874 testsuite and/or aesthetic purposes.
22875
22876 @item -mmcu=
22877 @opindex mmcu=
22878 Select the MCU to target. This is used to create a C preprocessor
22879 symbol based upon the MCU name, converted to upper case and pre- and
22880 post-fixed with @samp{__}. This in turn is used by the
22881 @file{msp430.h} header file to select an MCU-specific supplementary
22882 header file.
22883
22884 The option also sets the ISA to use. If the MCU name is one that is
22885 known to only support the 430 ISA then that is selected, otherwise the
22886 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22887 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22888 name selects the 430X ISA.
22889
22890 In addition an MCU-specific linker script is added to the linker
22891 command line. The script's name is the name of the MCU with
22892 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22893 command line defines the C preprocessor symbol @code{__XXX__} and
22894 cause the linker to search for a script called @file{xxx.ld}.
22895
22896 This option is also passed on to the assembler.
22897
22898 @item -mwarn-mcu
22899 @itemx -mno-warn-mcu
22900 @opindex mwarn-mcu
22901 @opindex mno-warn-mcu
22902 This option enables or disables warnings about conflicts between the
22903 MCU name specified by the @option{-mmcu} option and the ISA set by the
22904 @option{-mcpu} option and/or the hardware multiply support set by the
22905 @option{-mhwmult} option. It also toggles warnings about unrecognized
22906 MCU names. This option is on by default.
22907
22908 @item -mcpu=
22909 @opindex mcpu=
22910 Specifies the ISA to use. Accepted values are @samp{msp430},
22911 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22912 @option{-mmcu=} option should be used to select the ISA.
22913
22914 @item -msim
22915 @opindex msim
22916 Link to the simulator runtime libraries and linker script. Overrides
22917 any scripts that would be selected by the @option{-mmcu=} option.
22918
22919 @item -mlarge
22920 @opindex mlarge
22921 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22922
22923 @item -msmall
22924 @opindex msmall
22925 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22926
22927 @item -mrelax
22928 @opindex mrelax
22929 This option is passed to the assembler and linker, and allows the
22930 linker to perform certain optimizations that cannot be done until
22931 the final link.
22932
22933 @item mhwmult=
22934 @opindex mhwmult=
22935 Describes the type of hardware multiply supported by the target.
22936 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22937 for the original 16-bit-only multiply supported by early MCUs.
22938 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22939 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22940 A value of @samp{auto} can also be given. This tells GCC to deduce
22941 the hardware multiply support based upon the MCU name provided by the
22942 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22943 the MCU name is not recognized then no hardware multiply support is
22944 assumed. @code{auto} is the default setting.
22945
22946 Hardware multiplies are normally performed by calling a library
22947 routine. This saves space in the generated code. When compiling at
22948 @option{-O3} or higher however the hardware multiplier is invoked
22949 inline. This makes for bigger, but faster code.
22950
22951 The hardware multiply routines disable interrupts whilst running and
22952 restore the previous interrupt state when they finish. This makes
22953 them safe to use inside interrupt handlers as well as in normal code.
22954
22955 @item -minrt
22956 @opindex minrt
22957 Enable the use of a minimum runtime environment - no static
22958 initializers or constructors. This is intended for memory-constrained
22959 devices. The compiler includes special symbols in some objects
22960 that tell the linker and runtime which code fragments are required.
22961
22962 @item -mcode-region=
22963 @itemx -mdata-region=
22964 @opindex mcode-region
22965 @opindex mdata-region
22966 These options tell the compiler where to place functions and data that
22967 do not have one of the @code{lower}, @code{upper}, @code{either} or
22968 @code{section} attributes. Possible values are @code{lower},
22969 @code{upper}, @code{either} or @code{any}. The first three behave
22970 like the corresponding attribute. The fourth possible value -
22971 @code{any} - is the default. It leaves placement entirely up to the
22972 linker script and how it assigns the standard sections
22973 (@code{.text}, @code{.data}, etc) to the memory regions.
22974
22975 @item -msilicon-errata=
22976 @opindex msilicon-errata
22977 This option passes on a request to assembler to enable the fixes for
22978 the named silicon errata.
22979
22980 @item -msilicon-errata-warn=
22981 @opindex msilicon-errata-warn
22982 This option passes on a request to the assembler to enable warning
22983 messages when a silicon errata might need to be applied.
22984
22985 @end table
22986
22987 @node NDS32 Options
22988 @subsection NDS32 Options
22989 @cindex NDS32 Options
22990
22991 These options are defined for NDS32 implementations:
22992
22993 @table @gcctabopt
22994
22995 @item -mbig-endian
22996 @opindex mbig-endian
22997 Generate code in big-endian mode.
22998
22999 @item -mlittle-endian
23000 @opindex mlittle-endian
23001 Generate code in little-endian mode.
23002
23003 @item -mreduced-regs
23004 @opindex mreduced-regs
23005 Use reduced-set registers for register allocation.
23006
23007 @item -mfull-regs
23008 @opindex mfull-regs
23009 Use full-set registers for register allocation.
23010
23011 @item -mcmov
23012 @opindex mcmov
23013 Generate conditional move instructions.
23014
23015 @item -mno-cmov
23016 @opindex mno-cmov
23017 Do not generate conditional move instructions.
23018
23019 @item -mext-perf
23020 @opindex mext-perf
23021 Generate performance extension instructions.
23022
23023 @item -mno-ext-perf
23024 @opindex mno-ext-perf
23025 Do not generate performance extension instructions.
23026
23027 @item -mext-perf2
23028 @opindex mext-perf2
23029 Generate performance extension 2 instructions.
23030
23031 @item -mno-ext-perf2
23032 @opindex mno-ext-perf2
23033 Do not generate performance extension 2 instructions.
23034
23035 @item -mext-string
23036 @opindex mext-string
23037 Generate string extension instructions.
23038
23039 @item -mno-ext-string
23040 @opindex mno-ext-string
23041 Do not generate string extension instructions.
23042
23043 @item -mv3push
23044 @opindex mv3push
23045 Generate v3 push25/pop25 instructions.
23046
23047 @item -mno-v3push
23048 @opindex mno-v3push
23049 Do not generate v3 push25/pop25 instructions.
23050
23051 @item -m16-bit
23052 @opindex m16-bit
23053 Generate 16-bit instructions.
23054
23055 @item -mno-16-bit
23056 @opindex mno-16-bit
23057 Do not generate 16-bit instructions.
23058
23059 @item -misr-vector-size=@var{num}
23060 @opindex misr-vector-size
23061 Specify the size of each interrupt vector, which must be 4 or 16.
23062
23063 @item -mcache-block-size=@var{num}
23064 @opindex mcache-block-size
23065 Specify the size of each cache block,
23066 which must be a power of 2 between 4 and 512.
23067
23068 @item -march=@var{arch}
23069 @opindex march
23070 Specify the name of the target architecture.
23071
23072 @item -mcmodel=@var{code-model}
23073 @opindex mcmodel
23074 Set the code model to one of
23075 @table @asis
23076 @item @samp{small}
23077 All the data and read-only data segments must be within 512KB addressing space.
23078 The text segment must be within 16MB addressing space.
23079 @item @samp{medium}
23080 The data segment must be within 512KB while the read-only data segment can be
23081 within 4GB addressing space. The text segment should be still within 16MB
23082 addressing space.
23083 @item @samp{large}
23084 All the text and data segments can be within 4GB addressing space.
23085 @end table
23086
23087 @item -mctor-dtor
23088 @opindex mctor-dtor
23089 Enable constructor/destructor feature.
23090
23091 @item -mrelax
23092 @opindex mrelax
23093 Guide linker to relax instructions.
23094
23095 @end table
23096
23097 @node Nios II Options
23098 @subsection Nios II Options
23099 @cindex Nios II options
23100 @cindex Altera Nios II options
23101
23102 These are the options defined for the Altera Nios II processor.
23103
23104 @table @gcctabopt
23105
23106 @item -G @var{num}
23107 @opindex G
23108 @cindex smaller data references
23109 Put global and static objects less than or equal to @var{num} bytes
23110 into the small data or BSS sections instead of the normal data or BSS
23111 sections. The default value of @var{num} is 8.
23112
23113 @item -mgpopt=@var{option}
23114 @itemx -mgpopt
23115 @itemx -mno-gpopt
23116 @opindex mgpopt
23117 @opindex mno-gpopt
23118 Generate (do not generate) GP-relative accesses. The following
23119 @var{option} names are recognized:
23120
23121 @table @samp
23122
23123 @item none
23124 Do not generate GP-relative accesses.
23125
23126 @item local
23127 Generate GP-relative accesses for small data objects that are not
23128 external, weak, or uninitialized common symbols.
23129 Also use GP-relative addressing for objects that
23130 have been explicitly placed in a small data section via a @code{section}
23131 attribute.
23132
23133 @item global
23134 As for @samp{local}, but also generate GP-relative accesses for
23135 small data objects that are external, weak, or common. If you use this option,
23136 you must ensure that all parts of your program (including libraries) are
23137 compiled with the same @option{-G} setting.
23138
23139 @item data
23140 Generate GP-relative accesses for all data objects in the program. If you
23141 use this option, the entire data and BSS segments
23142 of your program must fit in 64K of memory and you must use an appropriate
23143 linker script to allocate them within the addressable range of the
23144 global pointer.
23145
23146 @item all
23147 Generate GP-relative addresses for function pointers as well as data
23148 pointers. If you use this option, the entire text, data, and BSS segments
23149 of your program must fit in 64K of memory and you must use an appropriate
23150 linker script to allocate them within the addressable range of the
23151 global pointer.
23152
23153 @end table
23154
23155 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23156 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23157
23158 The default is @option{-mgpopt} except when @option{-fpic} or
23159 @option{-fPIC} is specified to generate position-independent code.
23160 Note that the Nios II ABI does not permit GP-relative accesses from
23161 shared libraries.
23162
23163 You may need to specify @option{-mno-gpopt} explicitly when building
23164 programs that include large amounts of small data, including large
23165 GOT data sections. In this case, the 16-bit offset for GP-relative
23166 addressing may not be large enough to allow access to the entire
23167 small data section.
23168
23169 @item -mgprel-sec=@var{regexp}
23170 @opindex mgprel-sec
23171 This option specifies additional section names that can be accessed via
23172 GP-relative addressing. It is most useful in conjunction with
23173 @code{section} attributes on variable declarations
23174 (@pxref{Common Variable Attributes}) and a custom linker script.
23175 The @var{regexp} is a POSIX Extended Regular Expression.
23176
23177 This option does not affect the behavior of the @option{-G} option, and
23178 the specified sections are in addition to the standard @code{.sdata}
23179 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23180
23181 @item -mr0rel-sec=@var{regexp}
23182 @opindex mr0rel-sec
23183 This option specifies names of sections that can be accessed via a
23184 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23185 of the 32-bit address space. It is most useful in conjunction with
23186 @code{section} attributes on variable declarations
23187 (@pxref{Common Variable Attributes}) and a custom linker script.
23188 The @var{regexp} is a POSIX Extended Regular Expression.
23189
23190 In contrast to the use of GP-relative addressing for small data,
23191 zero-based addressing is never generated by default and there are no
23192 conventional section names used in standard linker scripts for sections
23193 in the low or high areas of memory.
23194
23195 @item -mel
23196 @itemx -meb
23197 @opindex mel
23198 @opindex meb
23199 Generate little-endian (default) or big-endian (experimental) code,
23200 respectively.
23201
23202 @item -march=@var{arch}
23203 @opindex march
23204 This specifies the name of the target Nios II architecture. GCC uses this
23205 name to determine what kind of instructions it can emit when generating
23206 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23207
23208 The preprocessor macro @code{__nios2_arch__} is available to programs,
23209 with value 1 or 2, indicating the targeted ISA level.
23210
23211 @item -mbypass-cache
23212 @itemx -mno-bypass-cache
23213 @opindex mno-bypass-cache
23214 @opindex mbypass-cache
23215 Force all load and store instructions to always bypass cache by
23216 using I/O variants of the instructions. The default is not to
23217 bypass the cache.
23218
23219 @item -mno-cache-volatile
23220 @itemx -mcache-volatile
23221 @opindex mcache-volatile
23222 @opindex mno-cache-volatile
23223 Volatile memory access bypass the cache using the I/O variants of
23224 the load and store instructions. The default is not to bypass the cache.
23225
23226 @item -mno-fast-sw-div
23227 @itemx -mfast-sw-div
23228 @opindex mno-fast-sw-div
23229 @opindex mfast-sw-div
23230 Do not use table-based fast divide for small numbers. The default
23231 is to use the fast divide at @option{-O3} and above.
23232
23233 @item -mno-hw-mul
23234 @itemx -mhw-mul
23235 @itemx -mno-hw-mulx
23236 @itemx -mhw-mulx
23237 @itemx -mno-hw-div
23238 @itemx -mhw-div
23239 @opindex mno-hw-mul
23240 @opindex mhw-mul
23241 @opindex mno-hw-mulx
23242 @opindex mhw-mulx
23243 @opindex mno-hw-div
23244 @opindex mhw-div
23245 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23246 instructions by the compiler. The default is to emit @code{mul}
23247 and not emit @code{div} and @code{mulx}.
23248
23249 @item -mbmx
23250 @itemx -mno-bmx
23251 @itemx -mcdx
23252 @itemx -mno-cdx
23253 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23254 CDX (code density) instructions. Enabling these instructions also
23255 requires @option{-march=r2}. Since these instructions are optional
23256 extensions to the R2 architecture, the default is not to emit them.
23257
23258 @item -mcustom-@var{insn}=@var{N}
23259 @itemx -mno-custom-@var{insn}
23260 @opindex mcustom-@var{insn}
23261 @opindex mno-custom-@var{insn}
23262 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23263 custom instruction with encoding @var{N} when generating code that uses
23264 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23265 instruction 253 for single-precision floating-point add operations instead
23266 of the default behavior of using a library call.
23267
23268 The following values of @var{insn} are supported. Except as otherwise
23269 noted, floating-point operations are expected to be implemented with
23270 normal IEEE 754 semantics and correspond directly to the C operators or the
23271 equivalent GCC built-in functions (@pxref{Other Builtins}).
23272
23273 Single-precision floating point:
23274 @table @asis
23275
23276 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23277 Binary arithmetic operations.
23278
23279 @item @samp{fnegs}
23280 Unary negation.
23281
23282 @item @samp{fabss}
23283 Unary absolute value.
23284
23285 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23286 Comparison operations.
23287
23288 @item @samp{fmins}, @samp{fmaxs}
23289 Floating-point minimum and maximum. These instructions are only
23290 generated if @option{-ffinite-math-only} is specified.
23291
23292 @item @samp{fsqrts}
23293 Unary square root operation.
23294
23295 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23296 Floating-point trigonometric and exponential functions. These instructions
23297 are only generated if @option{-funsafe-math-optimizations} is also specified.
23298
23299 @end table
23300
23301 Double-precision floating point:
23302 @table @asis
23303
23304 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23305 Binary arithmetic operations.
23306
23307 @item @samp{fnegd}
23308 Unary negation.
23309
23310 @item @samp{fabsd}
23311 Unary absolute value.
23312
23313 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23314 Comparison operations.
23315
23316 @item @samp{fmind}, @samp{fmaxd}
23317 Double-precision minimum and maximum. These instructions are only
23318 generated if @option{-ffinite-math-only} is specified.
23319
23320 @item @samp{fsqrtd}
23321 Unary square root operation.
23322
23323 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23324 Double-precision trigonometric and exponential functions. These instructions
23325 are only generated if @option{-funsafe-math-optimizations} is also specified.
23326
23327 @end table
23328
23329 Conversions:
23330 @table @asis
23331 @item @samp{fextsd}
23332 Conversion from single precision to double precision.
23333
23334 @item @samp{ftruncds}
23335 Conversion from double precision to single precision.
23336
23337 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23338 Conversion from floating point to signed or unsigned integer types, with
23339 truncation towards zero.
23340
23341 @item @samp{round}
23342 Conversion from single-precision floating point to signed integer,
23343 rounding to the nearest integer and ties away from zero.
23344 This corresponds to the @code{__builtin_lroundf} function when
23345 @option{-fno-math-errno} is used.
23346
23347 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23348 Conversion from signed or unsigned integer types to floating-point types.
23349
23350 @end table
23351
23352 In addition, all of the following transfer instructions for internal
23353 registers X and Y must be provided to use any of the double-precision
23354 floating-point instructions. Custom instructions taking two
23355 double-precision source operands expect the first operand in the
23356 64-bit register X. The other operand (or only operand of a unary
23357 operation) is given to the custom arithmetic instruction with the
23358 least significant half in source register @var{src1} and the most
23359 significant half in @var{src2}. A custom instruction that returns a
23360 double-precision result returns the most significant 32 bits in the
23361 destination register and the other half in 32-bit register Y.
23362 GCC automatically generates the necessary code sequences to write
23363 register X and/or read register Y when double-precision floating-point
23364 instructions are used.
23365
23366 @table @asis
23367
23368 @item @samp{fwrx}
23369 Write @var{src1} into the least significant half of X and @var{src2} into
23370 the most significant half of X.
23371
23372 @item @samp{fwry}
23373 Write @var{src1} into Y.
23374
23375 @item @samp{frdxhi}, @samp{frdxlo}
23376 Read the most or least (respectively) significant half of X and store it in
23377 @var{dest}.
23378
23379 @item @samp{frdy}
23380 Read the value of Y and store it into @var{dest}.
23381 @end table
23382
23383 Note that you can gain more local control over generation of Nios II custom
23384 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23385 and @code{target("no-custom-@var{insn}")} function attributes
23386 (@pxref{Function Attributes})
23387 or pragmas (@pxref{Function Specific Option Pragmas}).
23388
23389 @item -mcustom-fpu-cfg=@var{name}
23390 @opindex mcustom-fpu-cfg
23391
23392 This option enables a predefined, named set of custom instruction encodings
23393 (see @option{-mcustom-@var{insn}} above).
23394 Currently, the following sets are defined:
23395
23396 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23397 @gccoptlist{-mcustom-fmuls=252 @gol
23398 -mcustom-fadds=253 @gol
23399 -mcustom-fsubs=254 @gol
23400 -fsingle-precision-constant}
23401
23402 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23403 @gccoptlist{-mcustom-fmuls=252 @gol
23404 -mcustom-fadds=253 @gol
23405 -mcustom-fsubs=254 @gol
23406 -mcustom-fdivs=255 @gol
23407 -fsingle-precision-constant}
23408
23409 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23410 @gccoptlist{-mcustom-floatus=243 @gol
23411 -mcustom-fixsi=244 @gol
23412 -mcustom-floatis=245 @gol
23413 -mcustom-fcmpgts=246 @gol
23414 -mcustom-fcmples=249 @gol
23415 -mcustom-fcmpeqs=250 @gol
23416 -mcustom-fcmpnes=251 @gol
23417 -mcustom-fmuls=252 @gol
23418 -mcustom-fadds=253 @gol
23419 -mcustom-fsubs=254 @gol
23420 -mcustom-fdivs=255 @gol
23421 -fsingle-precision-constant}
23422
23423 Custom instruction assignments given by individual
23424 @option{-mcustom-@var{insn}=} options override those given by
23425 @option{-mcustom-fpu-cfg=}, regardless of the
23426 order of the options on the command line.
23427
23428 Note that you can gain more local control over selection of a FPU
23429 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23430 function attribute (@pxref{Function Attributes})
23431 or pragma (@pxref{Function Specific Option Pragmas}).
23432
23433 @end table
23434
23435 These additional @samp{-m} options are available for the Altera Nios II
23436 ELF (bare-metal) target:
23437
23438 @table @gcctabopt
23439
23440 @item -mhal
23441 @opindex mhal
23442 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23443 startup and termination code, and is typically used in conjunction with
23444 @option{-msys-crt0=} to specify the location of the alternate startup code
23445 provided by the HAL BSP.
23446
23447 @item -msmallc
23448 @opindex msmallc
23449 Link with a limited version of the C library, @option{-lsmallc}, rather than
23450 Newlib.
23451
23452 @item -msys-crt0=@var{startfile}
23453 @opindex msys-crt0
23454 @var{startfile} is the file name of the startfile (crt0) to use
23455 when linking. This option is only useful in conjunction with @option{-mhal}.
23456
23457 @item -msys-lib=@var{systemlib}
23458 @opindex msys-lib
23459 @var{systemlib} is the library name of the library that provides
23460 low-level system calls required by the C library,
23461 e.g.@: @code{read} and @code{write}.
23462 This option is typically used to link with a library provided by a HAL BSP.
23463
23464 @end table
23465
23466 @node Nvidia PTX Options
23467 @subsection Nvidia PTX Options
23468 @cindex Nvidia PTX options
23469 @cindex nvptx options
23470
23471 These options are defined for Nvidia PTX:
23472
23473 @table @gcctabopt
23474
23475 @item -m32
23476 @itemx -m64
23477 @opindex m32
23478 @opindex m64
23479 Generate code for 32-bit or 64-bit ABI.
23480
23481 @item -misa=@var{ISA-string}
23482 @opindex march
23483 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23484 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23485 @samp{sm_35}. The default ISA is sm_30.
23486
23487 @item -mmainkernel
23488 @opindex mmainkernel
23489 Link in code for a __main kernel. This is for stand-alone instead of
23490 offloading execution.
23491
23492 @item -moptimize
23493 @opindex moptimize
23494 Apply partitioned execution optimizations. This is the default when any
23495 level of optimization is selected.
23496
23497 @item -msoft-stack
23498 @opindex msoft-stack
23499 Generate code that does not use @code{.local} memory
23500 directly for stack storage. Instead, a per-warp stack pointer is
23501 maintained explicitly. This enables variable-length stack allocation (with
23502 variable-length arrays or @code{alloca}), and when global memory is used for
23503 underlying storage, makes it possible to access automatic variables from other
23504 threads, or with atomic instructions. This code generation variant is used
23505 for OpenMP offloading, but the option is exposed on its own for the purpose
23506 of testing the compiler; to generate code suitable for linking into programs
23507 using OpenMP offloading, use option @option{-mgomp}.
23508
23509 @item -muniform-simt
23510 @opindex muniform-simt
23511 Switch to code generation variant that allows to execute all threads in each
23512 warp, while maintaining memory state and side effects as if only one thread
23513 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23514 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23515 current lane index equals the master lane index), and the register being
23516 assigned is copied via a shuffle instruction from the master lane. Outside of
23517 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23518 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23519 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23520 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23521 with current lane index to compute the master lane index.
23522
23523 @item -mgomp
23524 @opindex mgomp
23525 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23526 @option{-muniform-simt} options, and selects corresponding multilib variant.
23527
23528 @end table
23529
23530 @node OpenRISC Options
23531 @subsection OpenRISC Options
23532 @cindex OpenRISC Options
23533
23534 These options are defined for OpenRISC:
23535
23536 @table @gcctabopt
23537
23538 @item -mboard=@var{name}
23539 @opindex mboard
23540 Configure a board specific runtime. This will be passed to the linker for
23541 newlib board library linking. The default is @code{or1ksim}.
23542
23543 @item -mnewlib
23544 @opindex mnewlib
23545 For compatibility, it's always newlib for elf now.
23546
23547 @item -mhard-div
23548 @opindex mhard-div
23549 Generate code for hardware which supports divide instructions. This is the
23550 default.
23551
23552 @item -mhard-mul
23553 @opindex mhard-mul
23554 Generate code for hardware which supports multiply instructions. This is the
23555 default.
23556
23557 @item -mcmov
23558 @opindex mcmov
23559 Generate code for hardware which supports the conditional move (@code{l.cmov})
23560 instruction.
23561
23562 @item -mror
23563 @opindex mror
23564 Generate code for hardware which supports rotate right instructions.
23565
23566 @item -msext
23567 @opindex msext
23568 Generate code for hardware which supports sign-extension instructions.
23569
23570 @item -msfimm
23571 @opindex msfimm
23572 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23573 instructions.
23574
23575 @item -mshftimm
23576 @opindex mshftimm
23577 Generate code for hardware which supports shift immediate related instructions
23578 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23579 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23580 also be specified.
23581
23582 @item -msoft-div
23583 @opindex msoft-div
23584 Generate code for hardware which requires divide instruction emulation.
23585
23586 @item -msoft-mul
23587 @opindex msoft-mul
23588 Generate code for hardware which requires multiply instruction emulation.
23589
23590 @end table
23591
23592 @node PDP-11 Options
23593 @subsection PDP-11 Options
23594 @cindex PDP-11 Options
23595
23596 These options are defined for the PDP-11:
23597
23598 @table @gcctabopt
23599 @item -mfpu
23600 @opindex mfpu
23601 Use hardware FPP floating point. This is the default. (FIS floating
23602 point on the PDP-11/40 is not supported.) Implies -m45.
23603
23604 @item -msoft-float
23605 @opindex msoft-float
23606 Do not use hardware floating point.
23607
23608 @item -mac0
23609 @opindex mac0
23610 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23611
23612 @item -mno-ac0
23613 @opindex mno-ac0
23614 Return floating-point results in memory. This is the default.
23615
23616 @item -m40
23617 @opindex m40
23618 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23619
23620 @item -m45
23621 @opindex m45
23622 Generate code for a PDP-11/45. This is the default.
23623
23624 @item -m10
23625 @opindex m10
23626 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23627
23628 @item -mint16
23629 @itemx -mno-int32
23630 @opindex mint16
23631 @opindex mno-int32
23632 Use 16-bit @code{int}. This is the default.
23633
23634 @item -mint32
23635 @itemx -mno-int16
23636 @opindex mint32
23637 @opindex mno-int16
23638 Use 32-bit @code{int}.
23639
23640 @item -msplit
23641 @opindex msplit
23642 Target has split instruction and data space. Implies -m45.
23643
23644 @item -munix-asm
23645 @opindex munix-asm
23646 Use Unix assembler syntax.
23647
23648 @item -mdec-asm
23649 @opindex mdec-asm
23650 Use DEC assembler syntax.
23651
23652 @item -mgnu-asm
23653 @opindex mgnu-asm
23654 Use GNU assembler syntax. This is the default.
23655
23656 @item -mlra
23657 @opindex mlra
23658 Use the new LRA register allocator. By default, the old ``reload''
23659 allocator is used.
23660 @end table
23661
23662 @node picoChip Options
23663 @subsection picoChip Options
23664 @cindex picoChip options
23665
23666 These @samp{-m} options are defined for picoChip implementations:
23667
23668 @table @gcctabopt
23669
23670 @item -mae=@var{ae_type}
23671 @opindex mcpu
23672 Set the instruction set, register set, and instruction scheduling
23673 parameters for array element type @var{ae_type}. Supported values
23674 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23675
23676 @option{-mae=ANY} selects a completely generic AE type. Code
23677 generated with this option runs on any of the other AE types. The
23678 code is not as efficient as it would be if compiled for a specific
23679 AE type, and some types of operation (e.g., multiplication) do not
23680 work properly on all types of AE.
23681
23682 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23683 for compiled code, and is the default.
23684
23685 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23686 option may suffer from poor performance of byte (char) manipulation,
23687 since the DSP AE does not provide hardware support for byte load/stores.
23688
23689 @item -msymbol-as-address
23690 Enable the compiler to directly use a symbol name as an address in a
23691 load/store instruction, without first loading it into a
23692 register. Typically, the use of this option generates larger
23693 programs, which run faster than when the option isn't used. However, the
23694 results vary from program to program, so it is left as a user option,
23695 rather than being permanently enabled.
23696
23697 @item -mno-inefficient-warnings
23698 Disables warnings about the generation of inefficient code. These
23699 warnings can be generated, for example, when compiling code that
23700 performs byte-level memory operations on the MAC AE type. The MAC AE has
23701 no hardware support for byte-level memory operations, so all byte
23702 load/stores must be synthesized from word load/store operations. This is
23703 inefficient and a warning is generated to indicate
23704 that you should rewrite the code to avoid byte operations, or to target
23705 an AE type that has the necessary hardware support. This option disables
23706 these warnings.
23707
23708 @end table
23709
23710 @node PowerPC Options
23711 @subsection PowerPC Options
23712 @cindex PowerPC options
23713
23714 These are listed under @xref{RS/6000 and PowerPC Options}.
23715
23716 @node RISC-V Options
23717 @subsection RISC-V Options
23718 @cindex RISC-V Options
23719
23720 These command-line options are defined for RISC-V targets:
23721
23722 @table @gcctabopt
23723 @item -mbranch-cost=@var{n}
23724 @opindex mbranch-cost
23725 Set the cost of branches to roughly @var{n} instructions.
23726
23727 @item -mplt
23728 @itemx -mno-plt
23729 @opindex plt
23730 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23731 non-PIC. The default is @option{-mplt}.
23732
23733 @item -mabi=@var{ABI-string}
23734 @opindex mabi
23735 Specify integer and floating-point calling convention. @var{ABI-string}
23736 contains two parts: the size of integer types and the registers used for
23737 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23738 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23739 32-bit), and that floating-point values up to 64 bits wide are passed in F
23740 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23741 allows the compiler to generate code that uses the F and D extensions but only
23742 allows floating-point values up to 32 bits long to be passed in registers; or
23743 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23744 passed in registers.
23745
23746 The default for this argument is system dependent, users who want a specific
23747 calling convention should specify one explicitly. The valid calling
23748 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23749 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23750 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23751 invalid because the ABI requires 64-bit values be passed in F registers, but F
23752 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23753 only be used with the @samp{rv32e} architecture. This ABI is not well
23754 specified at present, and is subject to change.
23755
23756 @item -mfdiv
23757 @itemx -mno-fdiv
23758 @opindex mfdiv
23759 Do or don't use hardware floating-point divide and square root instructions.
23760 This requires the F or D extensions for floating-point registers. The default
23761 is to use them if the specified architecture has these instructions.
23762
23763 @item -mdiv
23764 @itemx -mno-div
23765 @opindex mdiv
23766 Do or don't use hardware instructions for integer division. This requires the
23767 M extension. The default is to use them if the specified architecture has
23768 these instructions.
23769
23770 @item -march=@var{ISA-string}
23771 @opindex march
23772 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23773 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23774 @samp{rv32imaf}.
23775
23776 @item -mtune=@var{processor-string}
23777 @opindex mtune
23778 Optimize the output for the given processor, specified by microarchitecture
23779 name. Permissible values for this option are: @samp{rocket},
23780 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23781 and @samp{size}.
23782
23783 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23784
23785 The @samp{size} choice is not intended for use by end-users. This is used
23786 when @option{-Os} is specified. It overrides the instruction cost info
23787 provided by @option{-mtune=}, but does not override the pipeline info. This
23788 helps reduce code size while still giving good performance.
23789
23790 @item -mpreferred-stack-boundary=@var{num}
23791 @opindex mpreferred-stack-boundary
23792 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23793 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23794 the default is 4 (16 bytes or 128-bits).
23795
23796 @strong{Warning:} If you use this switch, then you must build all modules with
23797 the same value, including any libraries. This includes the system libraries
23798 and startup modules.
23799
23800 @item -msmall-data-limit=@var{n}
23801 @opindex msmall-data-limit
23802 Put global and static data smaller than @var{n} bytes into a special section
23803 (on some targets).
23804
23805 @item -msave-restore
23806 @itemx -mno-save-restore
23807 @opindex msave-restore
23808 Do or don't use smaller but slower prologue and epilogue code that uses
23809 library function calls. The default is to use fast inline prologues and
23810 epilogues.
23811
23812 @item -mstrict-align
23813 @itemx -mno-strict-align
23814 @opindex mstrict-align
23815 Do not or do generate unaligned memory accesses. The default is set depending
23816 on whether the processor we are optimizing for supports fast unaligned access
23817 or not.
23818
23819 @item -mcmodel=medlow
23820 @opindex mcmodel=medlow
23821 Generate code for the medium-low code model. The program and its statically
23822 defined symbols must lie within a single 2 GiB address range and must lie
23823 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23824 statically or dynamically linked. This is the default code model.
23825
23826 @item -mcmodel=medany
23827 @opindex mcmodel=medany
23828 Generate code for the medium-any code model. The program and its statically
23829 defined symbols must be within any single 2 GiB address range. Programs can be
23830 statically or dynamically linked.
23831
23832 @item -mexplicit-relocs
23833 @itemx -mno-exlicit-relocs
23834 Use or do not use assembler relocation operators when dealing with symbolic
23835 addresses. The alternative is to use assembler macros instead, which may
23836 limit optimization.
23837
23838 @item -mrelax
23839 @itemx -mno-relax
23840 Take advantage of linker relaxations to reduce the number of instructions
23841 required to materialize symbol addresses. The default is to take advantage of
23842 linker relaxations.
23843
23844 @item -memit-attribute
23845 @itemx -mno-emit-attribute
23846 Emit (do not emit) RISC-V attribute to record extra information into ELF
23847 objects. This feature requires at least binutils 2.32.
23848 @end table
23849
23850 @node RL78 Options
23851 @subsection RL78 Options
23852 @cindex RL78 Options
23853
23854 @table @gcctabopt
23855
23856 @item -msim
23857 @opindex msim
23858 Links in additional target libraries to support operation within a
23859 simulator.
23860
23861 @item -mmul=none
23862 @itemx -mmul=g10
23863 @itemx -mmul=g13
23864 @itemx -mmul=g14
23865 @itemx -mmul=rl78
23866 @opindex mmul
23867 Specifies the type of hardware multiplication and division support to
23868 be used. The simplest is @code{none}, which uses software for both
23869 multiplication and division. This is the default. The @code{g13}
23870 value is for the hardware multiply/divide peripheral found on the
23871 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23872 the multiplication and division instructions supported by the RL78/G14
23873 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23874 the value @code{mg10} is an alias for @code{none}.
23875
23876 In addition a C preprocessor macro is defined, based upon the setting
23877 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23878 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23879
23880 @item -mcpu=g10
23881 @itemx -mcpu=g13
23882 @itemx -mcpu=g14
23883 @itemx -mcpu=rl78
23884 @opindex mcpu
23885 Specifies the RL78 core to target. The default is the G14 core, also
23886 known as an S3 core or just RL78. The G13 or S2 core does not have
23887 multiply or divide instructions, instead it uses a hardware peripheral
23888 for these operations. The G10 or S1 core does not have register
23889 banks, so it uses a different calling convention.
23890
23891 If this option is set it also selects the type of hardware multiply
23892 support to use, unless this is overridden by an explicit
23893 @option{-mmul=none} option on the command line. Thus specifying
23894 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23895 peripheral and specifying @option{-mcpu=g10} disables the use of
23896 hardware multiplications altogether.
23897
23898 Note, although the RL78/G14 core is the default target, specifying
23899 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23900 change the behavior of the toolchain since it also enables G14
23901 hardware multiply support. If these options are not specified on the
23902 command line then software multiplication routines will be used even
23903 though the code targets the RL78 core. This is for backwards
23904 compatibility with older toolchains which did not have hardware
23905 multiply and divide support.
23906
23907 In addition a C preprocessor macro is defined, based upon the setting
23908 of this option. Possible values are: @code{__RL78_G10__},
23909 @code{__RL78_G13__} or @code{__RL78_G14__}.
23910
23911 @item -mg10
23912 @itemx -mg13
23913 @itemx -mg14
23914 @itemx -mrl78
23915 @opindex mg10
23916 @opindex mg13
23917 @opindex mg14
23918 @opindex mrl78
23919 These are aliases for the corresponding @option{-mcpu=} option. They
23920 are provided for backwards compatibility.
23921
23922 @item -mallregs
23923 @opindex mallregs
23924 Allow the compiler to use all of the available registers. By default
23925 registers @code{r24..r31} are reserved for use in interrupt handlers.
23926 With this option enabled these registers can be used in ordinary
23927 functions as well.
23928
23929 @item -m64bit-doubles
23930 @itemx -m32bit-doubles
23931 @opindex m64bit-doubles
23932 @opindex m32bit-doubles
23933 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23934 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23935 @option{-m32bit-doubles}.
23936
23937 @item -msave-mduc-in-interrupts
23938 @itemx -mno-save-mduc-in-interrupts
23939 @opindex msave-mduc-in-interrupts
23940 @opindex mno-save-mduc-in-interrupts
23941 Specifies that interrupt handler functions should preserve the
23942 MDUC registers. This is only necessary if normal code might use
23943 the MDUC registers, for example because it performs multiplication
23944 and division operations. The default is to ignore the MDUC registers
23945 as this makes the interrupt handlers faster. The target option -mg13
23946 needs to be passed for this to work as this feature is only available
23947 on the G13 target (S2 core). The MDUC registers will only be saved
23948 if the interrupt handler performs a multiplication or division
23949 operation or it calls another function.
23950
23951 @end table
23952
23953 @node RS/6000 and PowerPC Options
23954 @subsection IBM RS/6000 and PowerPC Options
23955 @cindex RS/6000 and PowerPC Options
23956 @cindex IBM RS/6000 and PowerPC Options
23957
23958 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23959 @table @gcctabopt
23960 @item -mpowerpc-gpopt
23961 @itemx -mno-powerpc-gpopt
23962 @itemx -mpowerpc-gfxopt
23963 @itemx -mno-powerpc-gfxopt
23964 @need 800
23965 @itemx -mpowerpc64
23966 @itemx -mno-powerpc64
23967 @itemx -mmfcrf
23968 @itemx -mno-mfcrf
23969 @itemx -mpopcntb
23970 @itemx -mno-popcntb
23971 @itemx -mpopcntd
23972 @itemx -mno-popcntd
23973 @itemx -mfprnd
23974 @itemx -mno-fprnd
23975 @need 800
23976 @itemx -mcmpb
23977 @itemx -mno-cmpb
23978 @itemx -mmfpgpr
23979 @itemx -mno-mfpgpr
23980 @itemx -mhard-dfp
23981 @itemx -mno-hard-dfp
23982 @opindex mpowerpc-gpopt
23983 @opindex mno-powerpc-gpopt
23984 @opindex mpowerpc-gfxopt
23985 @opindex mno-powerpc-gfxopt
23986 @opindex mpowerpc64
23987 @opindex mno-powerpc64
23988 @opindex mmfcrf
23989 @opindex mno-mfcrf
23990 @opindex mpopcntb
23991 @opindex mno-popcntb
23992 @opindex mpopcntd
23993 @opindex mno-popcntd
23994 @opindex mfprnd
23995 @opindex mno-fprnd
23996 @opindex mcmpb
23997 @opindex mno-cmpb
23998 @opindex mmfpgpr
23999 @opindex mno-mfpgpr
24000 @opindex mhard-dfp
24001 @opindex mno-hard-dfp
24002 You use these options to specify which instructions are available on the
24003 processor you are using. The default value of these options is
24004 determined when configuring GCC@. Specifying the
24005 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24006 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24007 rather than the options listed above.
24008
24009 Specifying @option{-mpowerpc-gpopt} allows
24010 GCC to use the optional PowerPC architecture instructions in the
24011 General Purpose group, including floating-point square root. Specifying
24012 @option{-mpowerpc-gfxopt} allows GCC to
24013 use the optional PowerPC architecture instructions in the Graphics
24014 group, including floating-point select.
24015
24016 The @option{-mmfcrf} option allows GCC to generate the move from
24017 condition register field instruction implemented on the POWER4
24018 processor and other processors that support the PowerPC V2.01
24019 architecture.
24020 The @option{-mpopcntb} option allows GCC to generate the popcount and
24021 double-precision FP reciprocal estimate instruction implemented on the
24022 POWER5 processor and other processors that support the PowerPC V2.02
24023 architecture.
24024 The @option{-mpopcntd} option allows GCC to generate the popcount
24025 instruction implemented on the POWER7 processor and other processors
24026 that support the PowerPC V2.06 architecture.
24027 The @option{-mfprnd} option allows GCC to generate the FP round to
24028 integer instructions implemented on the POWER5+ processor and other
24029 processors that support the PowerPC V2.03 architecture.
24030 The @option{-mcmpb} option allows GCC to generate the compare bytes
24031 instruction implemented on the POWER6 processor and other processors
24032 that support the PowerPC V2.05 architecture.
24033 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24034 general-purpose register instructions implemented on the POWER6X
24035 processor and other processors that support the extended PowerPC V2.05
24036 architecture.
24037 The @option{-mhard-dfp} option allows GCC to generate the decimal
24038 floating-point instructions implemented on some POWER processors.
24039
24040 The @option{-mpowerpc64} option allows GCC to generate the additional
24041 64-bit instructions that are found in the full PowerPC64 architecture
24042 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24043 @option{-mno-powerpc64}.
24044
24045 @item -mcpu=@var{cpu_type}
24046 @opindex mcpu
24047 Set architecture type, register usage, and
24048 instruction scheduling parameters for machine type @var{cpu_type}.
24049 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24050 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24051 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24052 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24053 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24054 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24055 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24056 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24057 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24058 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24059 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24060 @samp{rs64}, and @samp{native}.
24061
24062 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24063 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24064 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24065 architecture machine types, with an appropriate, generic processor
24066 model assumed for scheduling purposes.
24067
24068 Specifying @samp{native} as cpu type detects and selects the
24069 architecture option that corresponds to the host processor of the
24070 system performing the compilation.
24071 @option{-mcpu=native} has no effect if GCC does not recognize the
24072 processor.
24073
24074 The other options specify a specific processor. Code generated under
24075 those options runs best on that processor, and may not run at all on
24076 others.
24077
24078 The @option{-mcpu} options automatically enable or disable the
24079 following options:
24080
24081 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24082 -mpopcntb -mpopcntd -mpowerpc64 @gol
24083 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24084 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24085 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24086 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24087
24088 The particular options set for any particular CPU varies between
24089 compiler versions, depending on what setting seems to produce optimal
24090 code for that CPU; it doesn't necessarily reflect the actual hardware's
24091 capabilities. If you wish to set an individual option to a particular
24092 value, you may specify it after the @option{-mcpu} option, like
24093 @option{-mcpu=970 -mno-altivec}.
24094
24095 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24096 not enabled or disabled by the @option{-mcpu} option at present because
24097 AIX does not have full support for these options. You may still
24098 enable or disable them individually if you're sure it'll work in your
24099 environment.
24100
24101 @item -mtune=@var{cpu_type}
24102 @opindex mtune
24103 Set the instruction scheduling parameters for machine type
24104 @var{cpu_type}, but do not set the architecture type or register usage,
24105 as @option{-mcpu=@var{cpu_type}} does. The same
24106 values for @var{cpu_type} are used for @option{-mtune} as for
24107 @option{-mcpu}. If both are specified, the code generated uses the
24108 architecture and registers set by @option{-mcpu}, but the
24109 scheduling parameters set by @option{-mtune}.
24110
24111 @item -mcmodel=small
24112 @opindex mcmodel=small
24113 Generate PowerPC64 code for the small model: The TOC is limited to
24114 64k.
24115
24116 @item -mcmodel=medium
24117 @opindex mcmodel=medium
24118 Generate PowerPC64 code for the medium model: The TOC and other static
24119 data may be up to a total of 4G in size. This is the default for 64-bit
24120 Linux.
24121
24122 @item -mcmodel=large
24123 @opindex mcmodel=large
24124 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24125 in size. Other data and code is only limited by the 64-bit address
24126 space.
24127
24128 @item -maltivec
24129 @itemx -mno-altivec
24130 @opindex maltivec
24131 @opindex mno-altivec
24132 Generate code that uses (does not use) AltiVec instructions, and also
24133 enable the use of built-in functions that allow more direct access to
24134 the AltiVec instruction set. You may also need to set
24135 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24136 enhancements.
24137
24138 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24139 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24140 match array element order corresponding to the endianness of the
24141 target. That is, element zero identifies the leftmost element in a
24142 vector register when targeting a big-endian platform, and identifies
24143 the rightmost element in a vector register when targeting a
24144 little-endian platform.
24145
24146 @item -mvrsave
24147 @itemx -mno-vrsave
24148 @opindex mvrsave
24149 @opindex mno-vrsave
24150 Generate VRSAVE instructions when generating AltiVec code.
24151
24152 @item -msecure-plt
24153 @opindex msecure-plt
24154 Generate code that allows @command{ld} and @command{ld.so}
24155 to build executables and shared
24156 libraries with non-executable @code{.plt} and @code{.got} sections.
24157 This is a PowerPC
24158 32-bit SYSV ABI option.
24159
24160 @item -mbss-plt
24161 @opindex mbss-plt
24162 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24163 fills in, and
24164 requires @code{.plt} and @code{.got}
24165 sections that are both writable and executable.
24166 This is a PowerPC 32-bit SYSV ABI option.
24167
24168 @item -misel
24169 @itemx -mno-isel
24170 @opindex misel
24171 @opindex mno-isel
24172 This switch enables or disables the generation of ISEL instructions.
24173
24174 @item -mvsx
24175 @itemx -mno-vsx
24176 @opindex mvsx
24177 @opindex mno-vsx
24178 Generate code that uses (does not use) vector/scalar (VSX)
24179 instructions, and also enable the use of built-in functions that allow
24180 more direct access to the VSX instruction set.
24181
24182 @item -mcrypto
24183 @itemx -mno-crypto
24184 @opindex mcrypto
24185 @opindex mno-crypto
24186 Enable the use (disable) of the built-in functions that allow direct
24187 access to the cryptographic instructions that were added in version
24188 2.07 of the PowerPC ISA.
24189
24190 @item -mhtm
24191 @itemx -mno-htm
24192 @opindex mhtm
24193 @opindex mno-htm
24194 Enable (disable) the use of the built-in functions that allow direct
24195 access to the Hardware Transactional Memory (HTM) instructions that
24196 were added in version 2.07 of the PowerPC ISA.
24197
24198 @item -mpower8-fusion
24199 @itemx -mno-power8-fusion
24200 @opindex mpower8-fusion
24201 @opindex mno-power8-fusion
24202 Generate code that keeps (does not keeps) some integer operations
24203 adjacent so that the instructions can be fused together on power8 and
24204 later processors.
24205
24206 @item -mpower8-vector
24207 @itemx -mno-power8-vector
24208 @opindex mpower8-vector
24209 @opindex mno-power8-vector
24210 Generate code that uses (does not use) the vector and scalar
24211 instructions that were added in version 2.07 of the PowerPC ISA. Also
24212 enable the use of built-in functions that allow more direct access to
24213 the vector instructions.
24214
24215 @item -mquad-memory
24216 @itemx -mno-quad-memory
24217 @opindex mquad-memory
24218 @opindex mno-quad-memory
24219 Generate code that uses (does not use) the non-atomic quad word memory
24220 instructions. The @option{-mquad-memory} option requires use of
24221 64-bit mode.
24222
24223 @item -mquad-memory-atomic
24224 @itemx -mno-quad-memory-atomic
24225 @opindex mquad-memory-atomic
24226 @opindex mno-quad-memory-atomic
24227 Generate code that uses (does not use) the atomic quad word memory
24228 instructions. The @option{-mquad-memory-atomic} option requires use of
24229 64-bit mode.
24230
24231 @item -mfloat128
24232 @itemx -mno-float128
24233 @opindex mfloat128
24234 @opindex mno-float128
24235 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24236 and use either software emulation for IEEE 128-bit floating point or
24237 hardware instructions.
24238
24239 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24240 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24241 use the IEEE 128-bit floating point support. The IEEE 128-bit
24242 floating point support only works on PowerPC Linux systems.
24243
24244 The default for @option{-mfloat128} is enabled on PowerPC Linux
24245 systems using the VSX instruction set, and disabled on other systems.
24246
24247 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24248 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24249 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24250 floating point instructions. Otherwise, if you do not specify to
24251 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24252 system, IEEE 128-bit floating point will be done with software
24253 emulation.
24254
24255 @item -mfloat128-hardware
24256 @itemx -mno-float128-hardware
24257 @opindex mfloat128-hardware
24258 @opindex mno-float128-hardware
24259 Enable/disable using ISA 3.0 hardware instructions to support the
24260 @var{__float128} data type.
24261
24262 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24263 Linux systems using the ISA 3.0 instruction set, and disabled on other
24264 systems.
24265
24266 @item -m32
24267 @itemx -m64
24268 @opindex m32
24269 @opindex m64
24270 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24271 targets (including GNU/Linux). The 32-bit environment sets int, long
24272 and pointer to 32 bits and generates code that runs on any PowerPC
24273 variant. The 64-bit environment sets int to 32 bits and long and
24274 pointer to 64 bits, and generates code for PowerPC64, as for
24275 @option{-mpowerpc64}.
24276
24277 @item -mfull-toc
24278 @itemx -mno-fp-in-toc
24279 @itemx -mno-sum-in-toc
24280 @itemx -mminimal-toc
24281 @opindex mfull-toc
24282 @opindex mno-fp-in-toc
24283 @opindex mno-sum-in-toc
24284 @opindex mminimal-toc
24285 Modify generation of the TOC (Table Of Contents), which is created for
24286 every executable file. The @option{-mfull-toc} option is selected by
24287 default. In that case, GCC allocates at least one TOC entry for
24288 each unique non-automatic variable reference in your program. GCC
24289 also places floating-point constants in the TOC@. However, only
24290 16,384 entries are available in the TOC@.
24291
24292 If you receive a linker error message that saying you have overflowed
24293 the available TOC space, you can reduce the amount of TOC space used
24294 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24295 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24296 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24297 generate code to calculate the sum of an address and a constant at
24298 run time instead of putting that sum into the TOC@. You may specify one
24299 or both of these options. Each causes GCC to produce very slightly
24300 slower and larger code at the expense of conserving TOC space.
24301
24302 If you still run out of space in the TOC even when you specify both of
24303 these options, specify @option{-mminimal-toc} instead. This option causes
24304 GCC to make only one TOC entry for every file. When you specify this
24305 option, GCC produces code that is slower and larger but which
24306 uses extremely little TOC space. You may wish to use this option
24307 only on files that contain less frequently-executed code.
24308
24309 @item -maix64
24310 @itemx -maix32
24311 @opindex maix64
24312 @opindex maix32
24313 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24314 @code{long} type, and the infrastructure needed to support them.
24315 Specifying @option{-maix64} implies @option{-mpowerpc64},
24316 while @option{-maix32} disables the 64-bit ABI and
24317 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24318
24319 @item -mxl-compat
24320 @itemx -mno-xl-compat
24321 @opindex mxl-compat
24322 @opindex mno-xl-compat
24323 Produce code that conforms more closely to IBM XL compiler semantics
24324 when using AIX-compatible ABI@. Pass floating-point arguments to
24325 prototyped functions beyond the register save area (RSA) on the stack
24326 in addition to argument FPRs. Do not assume that most significant
24327 double in 128-bit long double value is properly rounded when comparing
24328 values and converting to double. Use XL symbol names for long double
24329 support routines.
24330
24331 The AIX calling convention was extended but not initially documented to
24332 handle an obscure K&R C case of calling a function that takes the
24333 address of its arguments with fewer arguments than declared. IBM XL
24334 compilers access floating-point arguments that do not fit in the
24335 RSA from the stack when a subroutine is compiled without
24336 optimization. Because always storing floating-point arguments on the
24337 stack is inefficient and rarely needed, this option is not enabled by
24338 default and only is necessary when calling subroutines compiled by IBM
24339 XL compilers without optimization.
24340
24341 @item -mpe
24342 @opindex mpe
24343 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24344 application written to use message passing with special startup code to
24345 enable the application to run. The system must have PE installed in the
24346 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24347 must be overridden with the @option{-specs=} option to specify the
24348 appropriate directory location. The Parallel Environment does not
24349 support threads, so the @option{-mpe} option and the @option{-pthread}
24350 option are incompatible.
24351
24352 @item -malign-natural
24353 @itemx -malign-power
24354 @opindex malign-natural
24355 @opindex malign-power
24356 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24357 @option{-malign-natural} overrides the ABI-defined alignment of larger
24358 types, such as floating-point doubles, on their natural size-based boundary.
24359 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24360 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24361
24362 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24363 is not supported.
24364
24365 @item -msoft-float
24366 @itemx -mhard-float
24367 @opindex msoft-float
24368 @opindex mhard-float
24369 Generate code that does not use (uses) the floating-point register set.
24370 Software floating-point emulation is provided if you use the
24371 @option{-msoft-float} option, and pass the option to GCC when linking.
24372
24373 @item -mmultiple
24374 @itemx -mno-multiple
24375 @opindex mmultiple
24376 @opindex mno-multiple
24377 Generate code that uses (does not use) the load multiple word
24378 instructions and the store multiple word instructions. These
24379 instructions are generated by default on POWER systems, and not
24380 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24381 PowerPC systems, since those instructions do not work when the
24382 processor is in little-endian mode. The exceptions are PPC740 and
24383 PPC750 which permit these instructions in little-endian mode.
24384
24385 @item -mupdate
24386 @itemx -mno-update
24387 @opindex mupdate
24388 @opindex mno-update
24389 Generate code that uses (does not use) the load or store instructions
24390 that update the base register to the address of the calculated memory
24391 location. These instructions are generated by default. If you use
24392 @option{-mno-update}, there is a small window between the time that the
24393 stack pointer is updated and the address of the previous frame is
24394 stored, which means code that walks the stack frame across interrupts or
24395 signals may get corrupted data.
24396
24397 @item -mavoid-indexed-addresses
24398 @itemx -mno-avoid-indexed-addresses
24399 @opindex mavoid-indexed-addresses
24400 @opindex mno-avoid-indexed-addresses
24401 Generate code that tries to avoid (not avoid) the use of indexed load
24402 or store instructions. These instructions can incur a performance
24403 penalty on Power6 processors in certain situations, such as when
24404 stepping through large arrays that cross a 16M boundary. This option
24405 is enabled by default when targeting Power6 and disabled otherwise.
24406
24407 @item -mfused-madd
24408 @itemx -mno-fused-madd
24409 @opindex mfused-madd
24410 @opindex mno-fused-madd
24411 Generate code that uses (does not use) the floating-point multiply and
24412 accumulate instructions. These instructions are generated by default
24413 if hardware floating point is used. The machine-dependent
24414 @option{-mfused-madd} option is now mapped to the machine-independent
24415 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24416 mapped to @option{-ffp-contract=off}.
24417
24418 @item -mmulhw
24419 @itemx -mno-mulhw
24420 @opindex mmulhw
24421 @opindex mno-mulhw
24422 Generate code that uses (does not use) the half-word multiply and
24423 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24424 These instructions are generated by default when targeting those
24425 processors.
24426
24427 @item -mdlmzb
24428 @itemx -mno-dlmzb
24429 @opindex mdlmzb
24430 @opindex mno-dlmzb
24431 Generate code that uses (does not use) the string-search @samp{dlmzb}
24432 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24433 generated by default when targeting those processors.
24434
24435 @item -mno-bit-align
24436 @itemx -mbit-align
24437 @opindex mno-bit-align
24438 @opindex mbit-align
24439 On System V.4 and embedded PowerPC systems do not (do) force structures
24440 and unions that contain bit-fields to be aligned to the base type of the
24441 bit-field.
24442
24443 For example, by default a structure containing nothing but 8
24444 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24445 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24446 the structure is aligned to a 1-byte boundary and is 1 byte in
24447 size.
24448
24449 @item -mno-strict-align
24450 @itemx -mstrict-align
24451 @opindex mno-strict-align
24452 @opindex mstrict-align
24453 On System V.4 and embedded PowerPC systems do not (do) assume that
24454 unaligned memory references are handled by the system.
24455
24456 @item -mrelocatable
24457 @itemx -mno-relocatable
24458 @opindex mrelocatable
24459 @opindex mno-relocatable
24460 Generate code that allows (does not allow) a static executable to be
24461 relocated to a different address at run time. A simple embedded
24462 PowerPC system loader should relocate the entire contents of
24463 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24464 a table of 32-bit addresses generated by this option. For this to
24465 work, all objects linked together must be compiled with
24466 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24467 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24468
24469 @item -mrelocatable-lib
24470 @itemx -mno-relocatable-lib
24471 @opindex mrelocatable-lib
24472 @opindex mno-relocatable-lib
24473 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24474 @code{.fixup} section to allow static executables to be relocated at
24475 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24476 alignment of @option{-mrelocatable}. Objects compiled with
24477 @option{-mrelocatable-lib} may be linked with objects compiled with
24478 any combination of the @option{-mrelocatable} options.
24479
24480 @item -mno-toc
24481 @itemx -mtoc
24482 @opindex mno-toc
24483 @opindex mtoc
24484 On System V.4 and embedded PowerPC systems do not (do) assume that
24485 register 2 contains a pointer to a global area pointing to the addresses
24486 used in the program.
24487
24488 @item -mlittle
24489 @itemx -mlittle-endian
24490 @opindex mlittle
24491 @opindex mlittle-endian
24492 On System V.4 and embedded PowerPC systems compile code for the
24493 processor in little-endian mode. The @option{-mlittle-endian} option is
24494 the same as @option{-mlittle}.
24495
24496 @item -mbig
24497 @itemx -mbig-endian
24498 @opindex mbig
24499 @opindex mbig-endian
24500 On System V.4 and embedded PowerPC systems compile code for the
24501 processor in big-endian mode. The @option{-mbig-endian} option is
24502 the same as @option{-mbig}.
24503
24504 @item -mdynamic-no-pic
24505 @opindex mdynamic-no-pic
24506 On Darwin and Mac OS X systems, compile code so that it is not
24507 relocatable, but that its external references are relocatable. The
24508 resulting code is suitable for applications, but not shared
24509 libraries.
24510
24511 @item -msingle-pic-base
24512 @opindex msingle-pic-base
24513 Treat the register used for PIC addressing as read-only, rather than
24514 loading it in the prologue for each function. The runtime system is
24515 responsible for initializing this register with an appropriate value
24516 before execution begins.
24517
24518 @item -mprioritize-restricted-insns=@var{priority}
24519 @opindex mprioritize-restricted-insns
24520 This option controls the priority that is assigned to
24521 dispatch-slot restricted instructions during the second scheduling
24522 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24523 or @samp{2} to assign no, highest, or second-highest (respectively)
24524 priority to dispatch-slot restricted
24525 instructions.
24526
24527 @item -msched-costly-dep=@var{dependence_type}
24528 @opindex msched-costly-dep
24529 This option controls which dependences are considered costly
24530 by the target during instruction scheduling. The argument
24531 @var{dependence_type} takes one of the following values:
24532
24533 @table @asis
24534 @item @samp{no}
24535 No dependence is costly.
24536
24537 @item @samp{all}
24538 All dependences are costly.
24539
24540 @item @samp{true_store_to_load}
24541 A true dependence from store to load is costly.
24542
24543 @item @samp{store_to_load}
24544 Any dependence from store to load is costly.
24545
24546 @item @var{number}
24547 Any dependence for which the latency is greater than or equal to
24548 @var{number} is costly.
24549 @end table
24550
24551 @item -minsert-sched-nops=@var{scheme}
24552 @opindex minsert-sched-nops
24553 This option controls which NOP insertion scheme is used during
24554 the second scheduling pass. The argument @var{scheme} takes one of the
24555 following values:
24556
24557 @table @asis
24558 @item @samp{no}
24559 Don't insert NOPs.
24560
24561 @item @samp{pad}
24562 Pad with NOPs any dispatch group that has vacant issue slots,
24563 according to the scheduler's grouping.
24564
24565 @item @samp{regroup_exact}
24566 Insert NOPs to force costly dependent insns into
24567 separate groups. Insert exactly as many NOPs as needed to force an insn
24568 to a new group, according to the estimated processor grouping.
24569
24570 @item @var{number}
24571 Insert NOPs to force costly dependent insns into
24572 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24573 @end table
24574
24575 @item -mcall-sysv
24576 @opindex mcall-sysv
24577 On System V.4 and embedded PowerPC systems compile code using calling
24578 conventions that adhere to the March 1995 draft of the System V
24579 Application Binary Interface, PowerPC processor supplement. This is the
24580 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24581
24582 @item -mcall-sysv-eabi
24583 @itemx -mcall-eabi
24584 @opindex mcall-sysv-eabi
24585 @opindex mcall-eabi
24586 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24587
24588 @item -mcall-sysv-noeabi
24589 @opindex mcall-sysv-noeabi
24590 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24591
24592 @item -mcall-aixdesc
24593 @opindex m
24594 On System V.4 and embedded PowerPC systems compile code for the AIX
24595 operating system.
24596
24597 @item -mcall-linux
24598 @opindex mcall-linux
24599 On System V.4 and embedded PowerPC systems compile code for the
24600 Linux-based GNU system.
24601
24602 @item -mcall-freebsd
24603 @opindex mcall-freebsd
24604 On System V.4 and embedded PowerPC systems compile code for the
24605 FreeBSD operating system.
24606
24607 @item -mcall-netbsd
24608 @opindex mcall-netbsd
24609 On System V.4 and embedded PowerPC systems compile code for the
24610 NetBSD operating system.
24611
24612 @item -mcall-openbsd
24613 @opindex mcall-netbsd
24614 On System V.4 and embedded PowerPC systems compile code for the
24615 OpenBSD operating system.
24616
24617 @item -mtraceback=@var{traceback_type}
24618 @opindex mtraceback
24619 Select the type of traceback table. Valid values for @var{traceback_type}
24620 are @samp{full}, @samp{part}, and @samp{no}.
24621
24622 @item -maix-struct-return
24623 @opindex maix-struct-return
24624 Return all structures in memory (as specified by the AIX ABI)@.
24625
24626 @item -msvr4-struct-return
24627 @opindex msvr4-struct-return
24628 Return structures smaller than 8 bytes in registers (as specified by the
24629 SVR4 ABI)@.
24630
24631 @item -mabi=@var{abi-type}
24632 @opindex mabi
24633 Extend the current ABI with a particular extension, or remove such extension.
24634 Valid values are @samp{altivec}, @samp{no-altivec},
24635 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24636 @samp{elfv1}, @samp{elfv2}@.
24637
24638 @item -mabi=ibmlongdouble
24639 @opindex mabi=ibmlongdouble
24640 Change the current ABI to use IBM extended-precision long double.
24641 This is not likely to work if your system defaults to using IEEE
24642 extended-precision long double. If you change the long double type
24643 from IEEE extended-precision, the compiler will issue a warning unless
24644 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24645 to be enabled.
24646
24647 @item -mabi=ieeelongdouble
24648 @opindex mabi=ieeelongdouble
24649 Change the current ABI to use IEEE extended-precision long double.
24650 This is not likely to work if your system defaults to using IBM
24651 extended-precision long double. If you change the long double type
24652 from IBM extended-precision, the compiler will issue a warning unless
24653 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24654 to be enabled.
24655
24656 @item -mabi=elfv1
24657 @opindex mabi=elfv1
24658 Change the current ABI to use the ELFv1 ABI.
24659 This is the default ABI for big-endian PowerPC 64-bit Linux.
24660 Overriding the default ABI requires special system support and is
24661 likely to fail in spectacular ways.
24662
24663 @item -mabi=elfv2
24664 @opindex mabi=elfv2
24665 Change the current ABI to use the ELFv2 ABI.
24666 This is the default ABI for little-endian PowerPC 64-bit Linux.
24667 Overriding the default ABI requires special system support and is
24668 likely to fail in spectacular ways.
24669
24670 @item -mgnu-attribute
24671 @itemx -mno-gnu-attribute
24672 @opindex mgnu-attribute
24673 @opindex mno-gnu-attribute
24674 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24675 .gnu.attributes section that specify ABI variations in function
24676 parameters or return values.
24677
24678 @item -mprototype
24679 @itemx -mno-prototype
24680 @opindex mprototype
24681 @opindex mno-prototype
24682 On System V.4 and embedded PowerPC systems assume that all calls to
24683 variable argument functions are properly prototyped. Otherwise, the
24684 compiler must insert an instruction before every non-prototyped call to
24685 set or clear bit 6 of the condition code register (@code{CR}) to
24686 indicate whether floating-point values are passed in the floating-point
24687 registers in case the function takes variable arguments. With
24688 @option{-mprototype}, only calls to prototyped variable argument functions
24689 set or clear the bit.
24690
24691 @item -msim
24692 @opindex msim
24693 On embedded PowerPC systems, assume that the startup module is called
24694 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24695 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24696 configurations.
24697
24698 @item -mmvme
24699 @opindex mmvme
24700 On embedded PowerPC systems, assume that the startup module is called
24701 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24702 @file{libc.a}.
24703
24704 @item -mads
24705 @opindex mads
24706 On embedded PowerPC systems, assume that the startup module is called
24707 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24708 @file{libc.a}.
24709
24710 @item -myellowknife
24711 @opindex myellowknife
24712 On embedded PowerPC systems, assume that the startup module is called
24713 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24714 @file{libc.a}.
24715
24716 @item -mvxworks
24717 @opindex mvxworks
24718 On System V.4 and embedded PowerPC systems, specify that you are
24719 compiling for a VxWorks system.
24720
24721 @item -memb
24722 @opindex memb
24723 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24724 header to indicate that @samp{eabi} extended relocations are used.
24725
24726 @item -meabi
24727 @itemx -mno-eabi
24728 @opindex meabi
24729 @opindex mno-eabi
24730 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24731 Embedded Applications Binary Interface (EABI), which is a set of
24732 modifications to the System V.4 specifications. Selecting @option{-meabi}
24733 means that the stack is aligned to an 8-byte boundary, a function
24734 @code{__eabi} is called from @code{main} to set up the EABI
24735 environment, and the @option{-msdata} option can use both @code{r2} and
24736 @code{r13} to point to two separate small data areas. Selecting
24737 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24738 no EABI initialization function is called from @code{main}, and the
24739 @option{-msdata} option only uses @code{r13} to point to a single
24740 small data area. The @option{-meabi} option is on by default if you
24741 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24742
24743 @item -msdata=eabi
24744 @opindex msdata=eabi
24745 On System V.4 and embedded PowerPC systems, put small initialized
24746 @code{const} global and static data in the @code{.sdata2} section, which
24747 is pointed to by register @code{r2}. Put small initialized
24748 non-@code{const} global and static data in the @code{.sdata} section,
24749 which is pointed to by register @code{r13}. Put small uninitialized
24750 global and static data in the @code{.sbss} section, which is adjacent to
24751 the @code{.sdata} section. The @option{-msdata=eabi} option is
24752 incompatible with the @option{-mrelocatable} option. The
24753 @option{-msdata=eabi} option also sets the @option{-memb} option.
24754
24755 @item -msdata=sysv
24756 @opindex msdata=sysv
24757 On System V.4 and embedded PowerPC systems, put small global and static
24758 data in the @code{.sdata} section, which is pointed to by register
24759 @code{r13}. Put small uninitialized global and static data in the
24760 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24761 The @option{-msdata=sysv} option is incompatible with the
24762 @option{-mrelocatable} option.
24763
24764 @item -msdata=default
24765 @itemx -msdata
24766 @opindex msdata=default
24767 @opindex msdata
24768 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24769 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24770 same as @option{-msdata=sysv}.
24771
24772 @item -msdata=data
24773 @opindex msdata=data
24774 On System V.4 and embedded PowerPC systems, put small global
24775 data in the @code{.sdata} section. Put small uninitialized global
24776 data in the @code{.sbss} section. Do not use register @code{r13}
24777 to address small data however. This is the default behavior unless
24778 other @option{-msdata} options are used.
24779
24780 @item -msdata=none
24781 @itemx -mno-sdata
24782 @opindex msdata=none
24783 @opindex mno-sdata
24784 On embedded PowerPC systems, put all initialized global and static data
24785 in the @code{.data} section, and all uninitialized data in the
24786 @code{.bss} section.
24787
24788 @item -mreadonly-in-sdata
24789 @opindex mreadonly-in-sdata
24790 @opindex mno-readonly-in-sdata
24791 Put read-only objects in the @code{.sdata} section as well. This is the
24792 default.
24793
24794 @item -mblock-move-inline-limit=@var{num}
24795 @opindex mblock-move-inline-limit
24796 Inline all block moves (such as calls to @code{memcpy} or structure
24797 copies) less than or equal to @var{num} bytes. The minimum value for
24798 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24799 targets. The default value is target-specific.
24800
24801 @item -mblock-compare-inline-limit=@var{num}
24802 @opindex mblock-compare-inline-limit
24803 Generate non-looping inline code for all block compares (such as calls
24804 to @code{memcmp} or structure compares) less than or equal to @var{num}
24805 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24806 block compare is disabled. The default value is target-specific.
24807
24808 @item -mblock-compare-inline-loop-limit=@var{num}
24809 @opindex mblock-compare-inline-loop-limit
24810 Generate an inline expansion using loop code for all block compares that
24811 are less than or equal to @var{num} bytes, but greater than the limit
24812 for non-loop inline block compare expansion. If the block length is not
24813 constant, at most @var{num} bytes will be compared before @code{memcmp}
24814 is called to compare the remainder of the block. The default value is
24815 target-specific.
24816
24817 @item -mstring-compare-inline-limit=@var{num}
24818 @opindex mstring-compare-inline-limit
24819 Compare at most @var{num} string bytes with inline code.
24820 If the difference or end of string is not found at the
24821 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24822 take care of the rest of the comparison. The default is 64 bytes.
24823
24824 @item -G @var{num}
24825 @opindex G
24826 @cindex smaller data references (PowerPC)
24827 @cindex .sdata/.sdata2 references (PowerPC)
24828 On embedded PowerPC systems, put global and static items less than or
24829 equal to @var{num} bytes into the small data or BSS sections instead of
24830 the normal data or BSS section. By default, @var{num} is 8. The
24831 @option{-G @var{num}} switch is also passed to the linker.
24832 All modules should be compiled with the same @option{-G @var{num}} value.
24833
24834 @item -mregnames
24835 @itemx -mno-regnames
24836 @opindex mregnames
24837 @opindex mno-regnames
24838 On System V.4 and embedded PowerPC systems do (do not) emit register
24839 names in the assembly language output using symbolic forms.
24840
24841 @item -mlongcall
24842 @itemx -mno-longcall
24843 @opindex mlongcall
24844 @opindex mno-longcall
24845 By default assume that all calls are far away so that a longer and more
24846 expensive calling sequence is required. This is required for calls
24847 farther than 32 megabytes (33,554,432 bytes) from the current location.
24848 A short call is generated if the compiler knows
24849 the call cannot be that far away. This setting can be overridden by
24850 the @code{shortcall} function attribute, or by @code{#pragma
24851 longcall(0)}.
24852
24853 Some linkers are capable of detecting out-of-range calls and generating
24854 glue code on the fly. On these systems, long calls are unnecessary and
24855 generate slower code. As of this writing, the AIX linker can do this,
24856 as can the GNU linker for PowerPC/64. It is planned to add this feature
24857 to the GNU linker for 32-bit PowerPC systems as well.
24858
24859 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
24860 GCC can generate long calls using an inline PLT call sequence (see
24861 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
24862 ELFv1 (big-endian) do not support inline PLT calls.
24863
24864 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24865 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24866 addresses represent the callee and the branch island. The
24867 Darwin/PPC linker prefers the first address and generates a @code{bl
24868 callee} if the PPC @code{bl} instruction reaches the callee directly;
24869 otherwise, the linker generates @code{bl L42} to call the branch
24870 island. The branch island is appended to the body of the
24871 calling function; it computes the full 32-bit address of the callee
24872 and jumps to it.
24873
24874 On Mach-O (Darwin) systems, this option directs the compiler emit to
24875 the glue for every direct call, and the Darwin linker decides whether
24876 to use or discard it.
24877
24878 In the future, GCC may ignore all longcall specifications
24879 when the linker is known to generate glue.
24880
24881 @item -mpltseq
24882 @itemx -mno-pltseq
24883 @opindex mpltseq
24884 @opindex mno-pltseq
24885 Implement (do not implement) -fno-plt and long calls using an inline
24886 PLT call sequence that supports lazy linking and long calls to
24887 functions in dlopen'd shared libraries. Inline PLT calls are only
24888 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24889 linkers, and are enabled by default if the support is detected when
24890 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
24891 configured with @option{--enable-secureplt}. @option{-mpltseq} code
24892 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
24893 linked together.
24894
24895 @item -mtls-markers
24896 @itemx -mno-tls-markers
24897 @opindex mtls-markers
24898 @opindex mno-tls-markers
24899 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24900 specifying the function argument. The relocation allows the linker to
24901 reliably associate function call with argument setup instructions for
24902 TLS optimization, which in turn allows GCC to better schedule the
24903 sequence.
24904
24905 @item -mrecip
24906 @itemx -mno-recip
24907 @opindex mrecip
24908 This option enables use of the reciprocal estimate and
24909 reciprocal square root estimate instructions with additional
24910 Newton-Raphson steps to increase precision instead of doing a divide or
24911 square root and divide for floating-point arguments. You should use
24912 the @option{-ffast-math} option when using @option{-mrecip} (or at
24913 least @option{-funsafe-math-optimizations},
24914 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24915 @option{-fno-trapping-math}). Note that while the throughput of the
24916 sequence is generally higher than the throughput of the non-reciprocal
24917 instruction, the precision of the sequence can be decreased by up to 2
24918 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24919 roots.
24920
24921 @item -mrecip=@var{opt}
24922 @opindex mrecip=opt
24923 This option controls which reciprocal estimate instructions
24924 may be used. @var{opt} is a comma-separated list of options, which may
24925 be preceded by a @code{!} to invert the option:
24926
24927 @table @samp
24928
24929 @item all
24930 Enable all estimate instructions.
24931
24932 @item default
24933 Enable the default instructions, equivalent to @option{-mrecip}.
24934
24935 @item none
24936 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24937
24938 @item div
24939 Enable the reciprocal approximation instructions for both
24940 single and double precision.
24941
24942 @item divf
24943 Enable the single-precision reciprocal approximation instructions.
24944
24945 @item divd
24946 Enable the double-precision reciprocal approximation instructions.
24947
24948 @item rsqrt
24949 Enable the reciprocal square root approximation instructions for both
24950 single and double precision.
24951
24952 @item rsqrtf
24953 Enable the single-precision reciprocal square root approximation instructions.
24954
24955 @item rsqrtd
24956 Enable the double-precision reciprocal square root approximation instructions.
24957
24958 @end table
24959
24960 So, for example, @option{-mrecip=all,!rsqrtd} enables
24961 all of the reciprocal estimate instructions, except for the
24962 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24963 which handle the double-precision reciprocal square root calculations.
24964
24965 @item -mrecip-precision
24966 @itemx -mno-recip-precision
24967 @opindex mrecip-precision
24968 Assume (do not assume) that the reciprocal estimate instructions
24969 provide higher-precision estimates than is mandated by the PowerPC
24970 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24971 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24972 The double-precision square root estimate instructions are not generated by
24973 default on low-precision machines, since they do not provide an
24974 estimate that converges after three steps.
24975
24976 @item -mveclibabi=@var{type}
24977 @opindex mveclibabi
24978 Specifies the ABI type to use for vectorizing intrinsics using an
24979 external library. The only type supported at present is @samp{mass},
24980 which specifies to use IBM's Mathematical Acceleration Subsystem
24981 (MASS) libraries for vectorizing intrinsics using external libraries.
24982 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24983 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24984 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24985 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24986 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24987 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24988 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24989 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24990 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24991 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24992 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24993 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24994 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24995 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24996 for power7. Both @option{-ftree-vectorize} and
24997 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24998 libraries must be specified at link time.
24999
25000 @item -mfriz
25001 @itemx -mno-friz
25002 @opindex mfriz
25003 Generate (do not generate) the @code{friz} instruction when the
25004 @option{-funsafe-math-optimizations} option is used to optimize
25005 rounding of floating-point values to 64-bit integer and back to floating
25006 point. The @code{friz} instruction does not return the same value if
25007 the floating-point number is too large to fit in an integer.
25008
25009 @item -mpointers-to-nested-functions
25010 @itemx -mno-pointers-to-nested-functions
25011 @opindex mpointers-to-nested-functions
25012 Generate (do not generate) code to load up the static chain register
25013 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25014 systems where a function pointer points to a 3-word descriptor giving
25015 the function address, TOC value to be loaded in register @code{r2}, and
25016 static chain value to be loaded in register @code{r11}. The
25017 @option{-mpointers-to-nested-functions} is on by default. You cannot
25018 call through pointers to nested functions or pointers
25019 to functions compiled in other languages that use the static chain if
25020 you use @option{-mno-pointers-to-nested-functions}.
25021
25022 @item -msave-toc-indirect
25023 @itemx -mno-save-toc-indirect
25024 @opindex msave-toc-indirect
25025 Generate (do not generate) code to save the TOC value in the reserved
25026 stack location in the function prologue if the function calls through
25027 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25028 saved in the prologue, it is saved just before the call through the
25029 pointer. The @option{-mno-save-toc-indirect} option is the default.
25030
25031 @item -mcompat-align-parm
25032 @itemx -mno-compat-align-parm
25033 @opindex mcompat-align-parm
25034 Generate (do not generate) code to pass structure parameters with a
25035 maximum alignment of 64 bits, for compatibility with older versions
25036 of GCC.
25037
25038 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25039 structure parameter on a 128-bit boundary when that structure contained
25040 a member requiring 128-bit alignment. This is corrected in more
25041 recent versions of GCC. This option may be used to generate code
25042 that is compatible with functions compiled with older versions of
25043 GCC.
25044
25045 The @option{-mno-compat-align-parm} option is the default.
25046
25047 @item -mstack-protector-guard=@var{guard}
25048 @itemx -mstack-protector-guard-reg=@var{reg}
25049 @itemx -mstack-protector-guard-offset=@var{offset}
25050 @itemx -mstack-protector-guard-symbol=@var{symbol}
25051 @opindex mstack-protector-guard
25052 @opindex mstack-protector-guard-reg
25053 @opindex mstack-protector-guard-offset
25054 @opindex mstack-protector-guard-symbol
25055 Generate stack protection code using canary at @var{guard}. Supported
25056 locations are @samp{global} for global canary or @samp{tls} for per-thread
25057 canary in the TLS block (the default with GNU libc version 2.4 or later).
25058
25059 With the latter choice the options
25060 @option{-mstack-protector-guard-reg=@var{reg}} and
25061 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25062 which register to use as base register for reading the canary, and from what
25063 offset from that base register. The default for those is as specified in the
25064 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25065 the offset with a symbol reference to a canary in the TLS block.
25066 @end table
25067
25068 @node RX Options
25069 @subsection RX Options
25070 @cindex RX Options
25071
25072 These command-line options are defined for RX targets:
25073
25074 @table @gcctabopt
25075 @item -m64bit-doubles
25076 @itemx -m32bit-doubles
25077 @opindex m64bit-doubles
25078 @opindex m32bit-doubles
25079 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25080 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25081 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25082 works on 32-bit values, which is why the default is
25083 @option{-m32bit-doubles}.
25084
25085 @item -fpu
25086 @itemx -nofpu
25087 @opindex fpu
25088 @opindex nofpu
25089 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25090 floating-point hardware. The default is enabled for the RX600
25091 series and disabled for the RX200 series.
25092
25093 Floating-point instructions are only generated for 32-bit floating-point
25094 values, however, so the FPU hardware is not used for doubles if the
25095 @option{-m64bit-doubles} option is used.
25096
25097 @emph{Note} If the @option{-fpu} option is enabled then
25098 @option{-funsafe-math-optimizations} is also enabled automatically.
25099 This is because the RX FPU instructions are themselves unsafe.
25100
25101 @item -mcpu=@var{name}
25102 @opindex mcpu
25103 Selects the type of RX CPU to be targeted. Currently three types are
25104 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25105 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25106
25107 The only difference between @samp{RX600} and @samp{RX610} is that the
25108 @samp{RX610} does not support the @code{MVTIPL} instruction.
25109
25110 The @samp{RX200} series does not have a hardware floating-point unit
25111 and so @option{-nofpu} is enabled by default when this type is
25112 selected.
25113
25114 @item -mbig-endian-data
25115 @itemx -mlittle-endian-data
25116 @opindex mbig-endian-data
25117 @opindex mlittle-endian-data
25118 Store data (but not code) in the big-endian format. The default is
25119 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25120 format.
25121
25122 @item -msmall-data-limit=@var{N}
25123 @opindex msmall-data-limit
25124 Specifies the maximum size in bytes of global and static variables
25125 which can be placed into the small data area. Using the small data
25126 area can lead to smaller and faster code, but the size of area is
25127 limited and it is up to the programmer to ensure that the area does
25128 not overflow. Also when the small data area is used one of the RX's
25129 registers (usually @code{r13}) is reserved for use pointing to this
25130 area, so it is no longer available for use by the compiler. This
25131 could result in slower and/or larger code if variables are pushed onto
25132 the stack instead of being held in this register.
25133
25134 Note, common variables (variables that have not been initialized) and
25135 constants are not placed into the small data area as they are assigned
25136 to other sections in the output executable.
25137
25138 The default value is zero, which disables this feature. Note, this
25139 feature is not enabled by default with higher optimization levels
25140 (@option{-O2} etc) because of the potentially detrimental effects of
25141 reserving a register. It is up to the programmer to experiment and
25142 discover whether this feature is of benefit to their program. See the
25143 description of the @option{-mpid} option for a description of how the
25144 actual register to hold the small data area pointer is chosen.
25145
25146 @item -msim
25147 @itemx -mno-sim
25148 @opindex msim
25149 @opindex mno-sim
25150 Use the simulator runtime. The default is to use the libgloss
25151 board-specific runtime.
25152
25153 @item -mas100-syntax
25154 @itemx -mno-as100-syntax
25155 @opindex mas100-syntax
25156 @opindex mno-as100-syntax
25157 When generating assembler output use a syntax that is compatible with
25158 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25159 assembler, but it has some restrictions so it is not generated by default.
25160
25161 @item -mmax-constant-size=@var{N}
25162 @opindex mmax-constant-size
25163 Specifies the maximum size, in bytes, of a constant that can be used as
25164 an operand in a RX instruction. Although the RX instruction set does
25165 allow constants of up to 4 bytes in length to be used in instructions,
25166 a longer value equates to a longer instruction. Thus in some
25167 circumstances it can be beneficial to restrict the size of constants
25168 that are used in instructions. Constants that are too big are instead
25169 placed into a constant pool and referenced via register indirection.
25170
25171 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25172 or 4 means that constants of any size are allowed.
25173
25174 @item -mrelax
25175 @opindex mrelax
25176 Enable linker relaxation. Linker relaxation is a process whereby the
25177 linker attempts to reduce the size of a program by finding shorter
25178 versions of various instructions. Disabled by default.
25179
25180 @item -mint-register=@var{N}
25181 @opindex mint-register
25182 Specify the number of registers to reserve for fast interrupt handler
25183 functions. The value @var{N} can be between 0 and 4. A value of 1
25184 means that register @code{r13} is reserved for the exclusive use
25185 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25186 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25187 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25188 A value of 0, the default, does not reserve any registers.
25189
25190 @item -msave-acc-in-interrupts
25191 @opindex msave-acc-in-interrupts
25192 Specifies that interrupt handler functions should preserve the
25193 accumulator register. This is only necessary if normal code might use
25194 the accumulator register, for example because it performs 64-bit
25195 multiplications. The default is to ignore the accumulator as this
25196 makes the interrupt handlers faster.
25197
25198 @item -mpid
25199 @itemx -mno-pid
25200 @opindex mpid
25201 @opindex mno-pid
25202 Enables the generation of position independent data. When enabled any
25203 access to constant data is done via an offset from a base address
25204 held in a register. This allows the location of constant data to be
25205 determined at run time without requiring the executable to be
25206 relocated, which is a benefit to embedded applications with tight
25207 memory constraints. Data that can be modified is not affected by this
25208 option.
25209
25210 Note, using this feature reserves a register, usually @code{r13}, for
25211 the constant data base address. This can result in slower and/or
25212 larger code, especially in complicated functions.
25213
25214 The actual register chosen to hold the constant data base address
25215 depends upon whether the @option{-msmall-data-limit} and/or the
25216 @option{-mint-register} command-line options are enabled. Starting
25217 with register @code{r13} and proceeding downwards, registers are
25218 allocated first to satisfy the requirements of @option{-mint-register},
25219 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25220 is possible for the small data area register to be @code{r8} if both
25221 @option{-mint-register=4} and @option{-mpid} are specified on the
25222 command line.
25223
25224 By default this feature is not enabled. The default can be restored
25225 via the @option{-mno-pid} command-line option.
25226
25227 @item -mno-warn-multiple-fast-interrupts
25228 @itemx -mwarn-multiple-fast-interrupts
25229 @opindex mno-warn-multiple-fast-interrupts
25230 @opindex mwarn-multiple-fast-interrupts
25231 Prevents GCC from issuing a warning message if it finds more than one
25232 fast interrupt handler when it is compiling a file. The default is to
25233 issue a warning for each extra fast interrupt handler found, as the RX
25234 only supports one such interrupt.
25235
25236 @item -mallow-string-insns
25237 @itemx -mno-allow-string-insns
25238 @opindex mallow-string-insns
25239 @opindex mno-allow-string-insns
25240 Enables or disables the use of the string manipulation instructions
25241 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25242 @code{SWHILE} and also the @code{RMPA} instruction. These
25243 instructions may prefetch data, which is not safe to do if accessing
25244 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25245 for more information).
25246
25247 The default is to allow these instructions, but it is not possible for
25248 GCC to reliably detect all circumstances where a string instruction
25249 might be used to access an I/O register, so their use cannot be
25250 disabled automatically. Instead it is reliant upon the programmer to
25251 use the @option{-mno-allow-string-insns} option if their program
25252 accesses I/O space.
25253
25254 When the instructions are enabled GCC defines the C preprocessor
25255 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25256 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25257
25258 @item -mjsr
25259 @itemx -mno-jsr
25260 @opindex mjsr
25261 @opindex mno-jsr
25262 Use only (or not only) @code{JSR} instructions to access functions.
25263 This option can be used when code size exceeds the range of @code{BSR}
25264 instructions. Note that @option{-mno-jsr} does not mean to not use
25265 @code{JSR} but instead means that any type of branch may be used.
25266 @end table
25267
25268 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25269 has special significance to the RX port when used with the
25270 @code{interrupt} function attribute. This attribute indicates a
25271 function intended to process fast interrupts. GCC ensures
25272 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25273 and/or @code{r13} and only provided that the normal use of the
25274 corresponding registers have been restricted via the
25275 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25276 options.
25277
25278 @node S/390 and zSeries Options
25279 @subsection S/390 and zSeries Options
25280 @cindex S/390 and zSeries Options
25281
25282 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25283
25284 @table @gcctabopt
25285 @item -mhard-float
25286 @itemx -msoft-float
25287 @opindex mhard-float
25288 @opindex msoft-float
25289 Use (do not use) the hardware floating-point instructions and registers
25290 for floating-point operations. When @option{-msoft-float} is specified,
25291 functions in @file{libgcc.a} are used to perform floating-point
25292 operations. When @option{-mhard-float} is specified, the compiler
25293 generates IEEE floating-point instructions. This is the default.
25294
25295 @item -mhard-dfp
25296 @itemx -mno-hard-dfp
25297 @opindex mhard-dfp
25298 @opindex mno-hard-dfp
25299 Use (do not use) the hardware decimal-floating-point instructions for
25300 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25301 specified, functions in @file{libgcc.a} are used to perform
25302 decimal-floating-point operations. When @option{-mhard-dfp} is
25303 specified, the compiler generates decimal-floating-point hardware
25304 instructions. This is the default for @option{-march=z9-ec} or higher.
25305
25306 @item -mlong-double-64
25307 @itemx -mlong-double-128
25308 @opindex mlong-double-64
25309 @opindex mlong-double-128
25310 These switches control the size of @code{long double} type. A size
25311 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25312 type. This is the default.
25313
25314 @item -mbackchain
25315 @itemx -mno-backchain
25316 @opindex mbackchain
25317 @opindex mno-backchain
25318 Store (do not store) the address of the caller's frame as backchain pointer
25319 into the callee's stack frame.
25320 A backchain may be needed to allow debugging using tools that do not understand
25321 DWARF call frame information.
25322 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25323 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25324 the backchain is placed into the topmost word of the 96/160 byte register
25325 save area.
25326
25327 In general, code compiled with @option{-mbackchain} is call-compatible with
25328 code compiled with @option{-mmo-backchain}; however, use of the backchain
25329 for debugging purposes usually requires that the whole binary is built with
25330 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25331 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25332 to build a linux kernel use @option{-msoft-float}.
25333
25334 The default is to not maintain the backchain.
25335
25336 @item -mpacked-stack
25337 @itemx -mno-packed-stack
25338 @opindex mpacked-stack
25339 @opindex mno-packed-stack
25340 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25341 specified, the compiler uses the all fields of the 96/160 byte register save
25342 area only for their default purpose; unused fields still take up stack space.
25343 When @option{-mpacked-stack} is specified, register save slots are densely
25344 packed at the top of the register save area; unused space is reused for other
25345 purposes, allowing for more efficient use of the available stack space.
25346 However, when @option{-mbackchain} is also in effect, the topmost word of
25347 the save area is always used to store the backchain, and the return address
25348 register is always saved two words below the backchain.
25349
25350 As long as the stack frame backchain is not used, code generated with
25351 @option{-mpacked-stack} is call-compatible with code generated with
25352 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25353 S/390 or zSeries generated code that uses the stack frame backchain at run
25354 time, not just for debugging purposes. Such code is not call-compatible
25355 with code compiled with @option{-mpacked-stack}. Also, note that the
25356 combination of @option{-mbackchain},
25357 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25358 to build a linux kernel use @option{-msoft-float}.
25359
25360 The default is to not use the packed stack layout.
25361
25362 @item -msmall-exec
25363 @itemx -mno-small-exec
25364 @opindex msmall-exec
25365 @opindex mno-small-exec
25366 Generate (or do not generate) code using the @code{bras} instruction
25367 to do subroutine calls.
25368 This only works reliably if the total executable size does not
25369 exceed 64k. The default is to use the @code{basr} instruction instead,
25370 which does not have this limitation.
25371
25372 @item -m64
25373 @itemx -m31
25374 @opindex m64
25375 @opindex m31
25376 When @option{-m31} is specified, generate code compliant to the
25377 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25378 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25379 particular to generate 64-bit instructions. For the @samp{s390}
25380 targets, the default is @option{-m31}, while the @samp{s390x}
25381 targets default to @option{-m64}.
25382
25383 @item -mzarch
25384 @itemx -mesa
25385 @opindex mzarch
25386 @opindex mesa
25387 When @option{-mzarch} is specified, generate code using the
25388 instructions available on z/Architecture.
25389 When @option{-mesa} is specified, generate code using the
25390 instructions available on ESA/390. Note that @option{-mesa} is
25391 not possible with @option{-m64}.
25392 When generating code compliant to the GNU/Linux for S/390 ABI,
25393 the default is @option{-mesa}. When generating code compliant
25394 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25395
25396 @item -mhtm
25397 @itemx -mno-htm
25398 @opindex mhtm
25399 @opindex mno-htm
25400 The @option{-mhtm} option enables a set of builtins making use of
25401 instructions available with the transactional execution facility
25402 introduced with the IBM zEnterprise EC12 machine generation
25403 @ref{S/390 System z Built-in Functions}.
25404 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25405
25406 @item -mvx
25407 @itemx -mno-vx
25408 @opindex mvx
25409 @opindex mno-vx
25410 When @option{-mvx} is specified, generate code using the instructions
25411 available with the vector extension facility introduced with the IBM
25412 z13 machine generation.
25413 This option changes the ABI for some vector type values with regard to
25414 alignment and calling conventions. In case vector type values are
25415 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25416 command will be added to mark the resulting binary with the ABI used.
25417 @option{-mvx} is enabled by default when using @option{-march=z13}.
25418
25419 @item -mzvector
25420 @itemx -mno-zvector
25421 @opindex mzvector
25422 @opindex mno-zvector
25423 The @option{-mzvector} option enables vector language extensions and
25424 builtins using instructions available with the vector extension
25425 facility introduced with the IBM z13 machine generation.
25426 This option adds support for @samp{vector} to be used as a keyword to
25427 define vector type variables and arguments. @samp{vector} is only
25428 available when GNU extensions are enabled. It will not be expanded
25429 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25430 In addition to the GCC low-level builtins @option{-mzvector} enables
25431 a set of builtins added for compatibility with AltiVec-style
25432 implementations like Power and Cell. In order to make use of these
25433 builtins the header file @file{vecintrin.h} needs to be included.
25434 @option{-mzvector} is disabled by default.
25435
25436 @item -mmvcle
25437 @itemx -mno-mvcle
25438 @opindex mmvcle
25439 @opindex mno-mvcle
25440 Generate (or do not generate) code using the @code{mvcle} instruction
25441 to perform block moves. When @option{-mno-mvcle} is specified,
25442 use a @code{mvc} loop instead. This is the default unless optimizing for
25443 size.
25444
25445 @item -mdebug
25446 @itemx -mno-debug
25447 @opindex mdebug
25448 @opindex mno-debug
25449 Print (or do not print) additional debug information when compiling.
25450 The default is to not print debug information.
25451
25452 @item -march=@var{cpu-type}
25453 @opindex march
25454 Generate code that runs on @var{cpu-type}, which is the name of a
25455 system representing a certain processor type. Possible values for
25456 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25457 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25458 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25459 @samp{z14}/@samp{arch12}, and @samp{native}.
25460
25461 The default is @option{-march=z900}.
25462
25463 Specifying @samp{native} as cpu type can be used to select the best
25464 architecture option for the host processor.
25465 @option{-march=native} has no effect if GCC does not recognize the
25466 processor.
25467
25468 @item -mtune=@var{cpu-type}
25469 @opindex mtune
25470 Tune to @var{cpu-type} everything applicable about the generated code,
25471 except for the ABI and the set of available instructions.
25472 The list of @var{cpu-type} values is the same as for @option{-march}.
25473 The default is the value used for @option{-march}.
25474
25475 @item -mtpf-trace
25476 @itemx -mno-tpf-trace
25477 @opindex mtpf-trace
25478 @opindex mno-tpf-trace
25479 Generate code that adds (does not add) in TPF OS specific branches to trace
25480 routines in the operating system. This option is off by default, even
25481 when compiling for the TPF OS@.
25482
25483 @item -mfused-madd
25484 @itemx -mno-fused-madd
25485 @opindex mfused-madd
25486 @opindex mno-fused-madd
25487 Generate code that uses (does not use) the floating-point multiply and
25488 accumulate instructions. These instructions are generated by default if
25489 hardware floating point is used.
25490
25491 @item -mwarn-framesize=@var{framesize}
25492 @opindex mwarn-framesize
25493 Emit a warning if the current function exceeds the given frame size. Because
25494 this is a compile-time check it doesn't need to be a real problem when the program
25495 runs. It is intended to identify functions that most probably cause
25496 a stack overflow. It is useful to be used in an environment with limited stack
25497 size e.g.@: the linux kernel.
25498
25499 @item -mwarn-dynamicstack
25500 @opindex mwarn-dynamicstack
25501 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25502 arrays. This is generally a bad idea with a limited stack size.
25503
25504 @item -mstack-guard=@var{stack-guard}
25505 @itemx -mstack-size=@var{stack-size}
25506 @opindex mstack-guard
25507 @opindex mstack-size
25508 If these options are provided the S/390 back end emits additional instructions in
25509 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25510 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25511 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25512 the frame size of the compiled function is chosen.
25513 These options are intended to be used to help debugging stack overflow problems.
25514 The additionally emitted code causes only little overhead and hence can also be
25515 used in production-like systems without greater performance degradation. The given
25516 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25517 @var{stack-guard} without exceeding 64k.
25518 In order to be efficient the extra code makes the assumption that the stack starts
25519 at an address aligned to the value given by @var{stack-size}.
25520 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25521
25522 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25523 @opindex mhotpatch
25524 If the hotpatch option is enabled, a ``hot-patching'' function
25525 prologue is generated for all functions in the compilation unit.
25526 The funtion label is prepended with the given number of two-byte
25527 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25528 the label, 2 * @var{post-halfwords} bytes are appended, using the
25529 largest NOP like instructions the architecture allows (maximum
25530 1000000).
25531
25532 If both arguments are zero, hotpatching is disabled.
25533
25534 This option can be overridden for individual functions with the
25535 @code{hotpatch} attribute.
25536 @end table
25537
25538 @node Score Options
25539 @subsection Score Options
25540 @cindex Score Options
25541
25542 These options are defined for Score implementations:
25543
25544 @table @gcctabopt
25545 @item -meb
25546 @opindex meb
25547 Compile code for big-endian mode. This is the default.
25548
25549 @item -mel
25550 @opindex mel
25551 Compile code for little-endian mode.
25552
25553 @item -mnhwloop
25554 @opindex mnhwloop
25555 Disable generation of @code{bcnz} instructions.
25556
25557 @item -muls
25558 @opindex muls
25559 Enable generation of unaligned load and store instructions.
25560
25561 @item -mmac
25562 @opindex mmac
25563 Enable the use of multiply-accumulate instructions. Disabled by default.
25564
25565 @item -mscore5
25566 @opindex mscore5
25567 Specify the SCORE5 as the target architecture.
25568
25569 @item -mscore5u
25570 @opindex mscore5u
25571 Specify the SCORE5U of the target architecture.
25572
25573 @item -mscore7
25574 @opindex mscore7
25575 Specify the SCORE7 as the target architecture. This is the default.
25576
25577 @item -mscore7d
25578 @opindex mscore7d
25579 Specify the SCORE7D as the target architecture.
25580 @end table
25581
25582 @node SH Options
25583 @subsection SH Options
25584
25585 These @samp{-m} options are defined for the SH implementations:
25586
25587 @table @gcctabopt
25588 @item -m1
25589 @opindex m1
25590 Generate code for the SH1.
25591
25592 @item -m2
25593 @opindex m2
25594 Generate code for the SH2.
25595
25596 @item -m2e
25597 Generate code for the SH2e.
25598
25599 @item -m2a-nofpu
25600 @opindex m2a-nofpu
25601 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25602 that the floating-point unit is not used.
25603
25604 @item -m2a-single-only
25605 @opindex m2a-single-only
25606 Generate code for the SH2a-FPU, in such a way that no double-precision
25607 floating-point operations are used.
25608
25609 @item -m2a-single
25610 @opindex m2a-single
25611 Generate code for the SH2a-FPU assuming the floating-point unit is in
25612 single-precision mode by default.
25613
25614 @item -m2a
25615 @opindex m2a
25616 Generate code for the SH2a-FPU assuming the floating-point unit is in
25617 double-precision mode by default.
25618
25619 @item -m3
25620 @opindex m3
25621 Generate code for the SH3.
25622
25623 @item -m3e
25624 @opindex m3e
25625 Generate code for the SH3e.
25626
25627 @item -m4-nofpu
25628 @opindex m4-nofpu
25629 Generate code for the SH4 without a floating-point unit.
25630
25631 @item -m4-single-only
25632 @opindex m4-single-only
25633 Generate code for the SH4 with a floating-point unit that only
25634 supports single-precision arithmetic.
25635
25636 @item -m4-single
25637 @opindex m4-single
25638 Generate code for the SH4 assuming the floating-point unit is in
25639 single-precision mode by default.
25640
25641 @item -m4
25642 @opindex m4
25643 Generate code for the SH4.
25644
25645 @item -m4-100
25646 @opindex m4-100
25647 Generate code for SH4-100.
25648
25649 @item -m4-100-nofpu
25650 @opindex m4-100-nofpu
25651 Generate code for SH4-100 in such a way that the
25652 floating-point unit is not used.
25653
25654 @item -m4-100-single
25655 @opindex m4-100-single
25656 Generate code for SH4-100 assuming the floating-point unit is in
25657 single-precision mode by default.
25658
25659 @item -m4-100-single-only
25660 @opindex m4-100-single-only
25661 Generate code for SH4-100 in such a way that no double-precision
25662 floating-point operations are used.
25663
25664 @item -m4-200
25665 @opindex m4-200
25666 Generate code for SH4-200.
25667
25668 @item -m4-200-nofpu
25669 @opindex m4-200-nofpu
25670 Generate code for SH4-200 without in such a way that the
25671 floating-point unit is not used.
25672
25673 @item -m4-200-single
25674 @opindex m4-200-single
25675 Generate code for SH4-200 assuming the floating-point unit is in
25676 single-precision mode by default.
25677
25678 @item -m4-200-single-only
25679 @opindex m4-200-single-only
25680 Generate code for SH4-200 in such a way that no double-precision
25681 floating-point operations are used.
25682
25683 @item -m4-300
25684 @opindex m4-300
25685 Generate code for SH4-300.
25686
25687 @item -m4-300-nofpu
25688 @opindex m4-300-nofpu
25689 Generate code for SH4-300 without in such a way that the
25690 floating-point unit is not used.
25691
25692 @item -m4-300-single
25693 @opindex m4-300-single
25694 Generate code for SH4-300 in such a way that no double-precision
25695 floating-point operations are used.
25696
25697 @item -m4-300-single-only
25698 @opindex m4-300-single-only
25699 Generate code for SH4-300 in such a way that no double-precision
25700 floating-point operations are used.
25701
25702 @item -m4-340
25703 @opindex m4-340
25704 Generate code for SH4-340 (no MMU, no FPU).
25705
25706 @item -m4-500
25707 @opindex m4-500
25708 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25709 assembler.
25710
25711 @item -m4a-nofpu
25712 @opindex m4a-nofpu
25713 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25714 floating-point unit is not used.
25715
25716 @item -m4a-single-only
25717 @opindex m4a-single-only
25718 Generate code for the SH4a, in such a way that no double-precision
25719 floating-point operations are used.
25720
25721 @item -m4a-single
25722 @opindex m4a-single
25723 Generate code for the SH4a assuming the floating-point unit is in
25724 single-precision mode by default.
25725
25726 @item -m4a
25727 @opindex m4a
25728 Generate code for the SH4a.
25729
25730 @item -m4al
25731 @opindex m4al
25732 Same as @option{-m4a-nofpu}, except that it implicitly passes
25733 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25734 instructions at the moment.
25735
25736 @item -mb
25737 @opindex mb
25738 Compile code for the processor in big-endian mode.
25739
25740 @item -ml
25741 @opindex ml
25742 Compile code for the processor in little-endian mode.
25743
25744 @item -mdalign
25745 @opindex mdalign
25746 Align doubles at 64-bit boundaries. Note that this changes the calling
25747 conventions, and thus some functions from the standard C library do
25748 not work unless you recompile it first with @option{-mdalign}.
25749
25750 @item -mrelax
25751 @opindex mrelax
25752 Shorten some address references at link time, when possible; uses the
25753 linker option @option{-relax}.
25754
25755 @item -mbigtable
25756 @opindex mbigtable
25757 Use 32-bit offsets in @code{switch} tables. The default is to use
25758 16-bit offsets.
25759
25760 @item -mbitops
25761 @opindex mbitops
25762 Enable the use of bit manipulation instructions on SH2A.
25763
25764 @item -mfmovd
25765 @opindex mfmovd
25766 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25767 alignment constraints.
25768
25769 @item -mrenesas
25770 @opindex mrenesas
25771 Comply with the calling conventions defined by Renesas.
25772
25773 @item -mno-renesas
25774 @opindex mno-renesas
25775 Comply with the calling conventions defined for GCC before the Renesas
25776 conventions were available. This option is the default for all
25777 targets of the SH toolchain.
25778
25779 @item -mnomacsave
25780 @opindex mnomacsave
25781 Mark the @code{MAC} register as call-clobbered, even if
25782 @option{-mrenesas} is given.
25783
25784 @item -mieee
25785 @itemx -mno-ieee
25786 @opindex mieee
25787 @opindex mno-ieee
25788 Control the IEEE compliance of floating-point comparisons, which affects the
25789 handling of cases where the result of a comparison is unordered. By default
25790 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25791 enabled @option{-mno-ieee} is implicitly set, which results in faster
25792 floating-point greater-equal and less-equal comparisons. The implicit settings
25793 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25794
25795 @item -minline-ic_invalidate
25796 @opindex minline-ic_invalidate
25797 Inline code to invalidate instruction cache entries after setting up
25798 nested function trampolines.
25799 This option has no effect if @option{-musermode} is in effect and the selected
25800 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25801 instruction.
25802 If the selected code generation option does not allow the use of the @code{icbi}
25803 instruction, and @option{-musermode} is not in effect, the inlined code
25804 manipulates the instruction cache address array directly with an associative
25805 write. This not only requires privileged mode at run time, but it also
25806 fails if the cache line had been mapped via the TLB and has become unmapped.
25807
25808 @item -misize
25809 @opindex misize
25810 Dump instruction size and location in the assembly code.
25811
25812 @item -mpadstruct
25813 @opindex mpadstruct
25814 This option is deprecated. It pads structures to multiple of 4 bytes,
25815 which is incompatible with the SH ABI@.
25816
25817 @item -matomic-model=@var{model}
25818 @opindex matomic-model=@var{model}
25819 Sets the model of atomic operations and additional parameters as a comma
25820 separated list. For details on the atomic built-in functions see
25821 @ref{__atomic Builtins}. The following models and parameters are supported:
25822
25823 @table @samp
25824
25825 @item none
25826 Disable compiler generated atomic sequences and emit library calls for atomic
25827 operations. This is the default if the target is not @code{sh*-*-linux*}.
25828
25829 @item soft-gusa
25830 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25831 built-in functions. The generated atomic sequences require additional support
25832 from the interrupt/exception handling code of the system and are only suitable
25833 for SH3* and SH4* single-core systems. This option is enabled by default when
25834 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25835 this option also partially utilizes the hardware atomic instructions
25836 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25837 @samp{strict} is specified.
25838
25839 @item soft-tcb
25840 Generate software atomic sequences that use a variable in the thread control
25841 block. This is a variation of the gUSA sequences which can also be used on
25842 SH1* and SH2* targets. The generated atomic sequences require additional
25843 support from the interrupt/exception handling code of the system and are only
25844 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25845 parameter has to be specified as well.
25846
25847 @item soft-imask
25848 Generate software atomic sequences that temporarily disable interrupts by
25849 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25850 in privileged mode and is only suitable for single-core systems. Additional
25851 support from the interrupt/exception handling code of the system is not
25852 required. This model is enabled by default when the target is
25853 @code{sh*-*-linux*} and SH1* or SH2*.
25854
25855 @item hard-llcs
25856 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25857 instructions only. This is only available on SH4A and is suitable for
25858 multi-core systems. Since the hardware instructions support only 32 bit atomic
25859 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25860 Code compiled with this option is also compatible with other software
25861 atomic model interrupt/exception handling systems if executed on an SH4A
25862 system. Additional support from the interrupt/exception handling code of the
25863 system is not required for this model.
25864
25865 @item gbr-offset=
25866 This parameter specifies the offset in bytes of the variable in the thread
25867 control block structure that should be used by the generated atomic sequences
25868 when the @samp{soft-tcb} model has been selected. For other models this
25869 parameter is ignored. The specified value must be an integer multiple of four
25870 and in the range 0-1020.
25871
25872 @item strict
25873 This parameter prevents mixed usage of multiple atomic models, even if they
25874 are compatible, and makes the compiler generate atomic sequences of the
25875 specified model only.
25876
25877 @end table
25878
25879 @item -mtas
25880 @opindex mtas
25881 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25882 Notice that depending on the particular hardware and software configuration
25883 this can degrade overall performance due to the operand cache line flushes
25884 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25885 processors the @code{tas.b} instruction must be used with caution since it
25886 can result in data corruption for certain cache configurations.
25887
25888 @item -mprefergot
25889 @opindex mprefergot
25890 When generating position-independent code, emit function calls using
25891 the Global Offset Table instead of the Procedure Linkage Table.
25892
25893 @item -musermode
25894 @itemx -mno-usermode
25895 @opindex musermode
25896 @opindex mno-usermode
25897 Don't allow (allow) the compiler generating privileged mode code. Specifying
25898 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25899 inlined code would not work in user mode. @option{-musermode} is the default
25900 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25901 @option{-musermode} has no effect, since there is no user mode.
25902
25903 @item -multcost=@var{number}
25904 @opindex multcost=@var{number}
25905 Set the cost to assume for a multiply insn.
25906
25907 @item -mdiv=@var{strategy}
25908 @opindex mdiv=@var{strategy}
25909 Set the division strategy to be used for integer division operations.
25910 @var{strategy} can be one of:
25911
25912 @table @samp
25913
25914 @item call-div1
25915 Calls a library function that uses the single-step division instruction
25916 @code{div1} to perform the operation. Division by zero calculates an
25917 unspecified result and does not trap. This is the default except for SH4,
25918 SH2A and SHcompact.
25919
25920 @item call-fp
25921 Calls a library function that performs the operation in double precision
25922 floating point. Division by zero causes a floating-point exception. This is
25923 the default for SHcompact with FPU. Specifying this for targets that do not
25924 have a double precision FPU defaults to @code{call-div1}.
25925
25926 @item call-table
25927 Calls a library function that uses a lookup table for small divisors and
25928 the @code{div1} instruction with case distinction for larger divisors. Division
25929 by zero calculates an unspecified result and does not trap. This is the default
25930 for SH4. Specifying this for targets that do not have dynamic shift
25931 instructions defaults to @code{call-div1}.
25932
25933 @end table
25934
25935 When a division strategy has not been specified the default strategy is
25936 selected based on the current target. For SH2A the default strategy is to
25937 use the @code{divs} and @code{divu} instructions instead of library function
25938 calls.
25939
25940 @item -maccumulate-outgoing-args
25941 @opindex maccumulate-outgoing-args
25942 Reserve space once for outgoing arguments in the function prologue rather
25943 than around each call. Generally beneficial for performance and size. Also
25944 needed for unwinding to avoid changing the stack frame around conditional code.
25945
25946 @item -mdivsi3_libfunc=@var{name}
25947 @opindex mdivsi3_libfunc=@var{name}
25948 Set the name of the library function used for 32-bit signed division to
25949 @var{name}.
25950 This only affects the name used in the @samp{call} division strategies, and
25951 the compiler still expects the same sets of input/output/clobbered registers as
25952 if this option were not present.
25953
25954 @item -mfixed-range=@var{register-range}
25955 @opindex mfixed-range
25956 Generate code treating the given register range as fixed registers.
25957 A fixed register is one that the register allocator cannot use. This is
25958 useful when compiling kernel code. A register range is specified as
25959 two registers separated by a dash. Multiple register ranges can be
25960 specified separated by a comma.
25961
25962 @item -mbranch-cost=@var{num}
25963 @opindex mbranch-cost=@var{num}
25964 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25965 make the compiler try to generate more branch-free code if possible.
25966 If not specified the value is selected depending on the processor type that
25967 is being compiled for.
25968
25969 @item -mzdcbranch
25970 @itemx -mno-zdcbranch
25971 @opindex mzdcbranch
25972 @opindex mno-zdcbranch
25973 Assume (do not assume) that zero displacement conditional branch instructions
25974 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25975 compiler prefers zero displacement branch code sequences. This is
25976 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25977 disabled by specifying @option{-mno-zdcbranch}.
25978
25979 @item -mcbranch-force-delay-slot
25980 @opindex mcbranch-force-delay-slot
25981 Force the usage of delay slots for conditional branches, which stuffs the delay
25982 slot with a @code{nop} if a suitable instruction cannot be found. By default
25983 this option is disabled. It can be enabled to work around hardware bugs as
25984 found in the original SH7055.
25985
25986 @item -mfused-madd
25987 @itemx -mno-fused-madd
25988 @opindex mfused-madd
25989 @opindex mno-fused-madd
25990 Generate code that uses (does not use) the floating-point multiply and
25991 accumulate instructions. These instructions are generated by default
25992 if hardware floating point is used. The machine-dependent
25993 @option{-mfused-madd} option is now mapped to the machine-independent
25994 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25995 mapped to @option{-ffp-contract=off}.
25996
25997 @item -mfsca
25998 @itemx -mno-fsca
25999 @opindex mfsca
26000 @opindex mno-fsca
26001 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26002 and cosine approximations. The option @option{-mfsca} must be used in
26003 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26004 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26005 approximations even if @option{-funsafe-math-optimizations} is in effect.
26006
26007 @item -mfsrra
26008 @itemx -mno-fsrra
26009 @opindex mfsrra
26010 @opindex mno-fsrra
26011 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26012 reciprocal square root approximations. The option @option{-mfsrra} must be used
26013 in combination with @option{-funsafe-math-optimizations} and
26014 @option{-ffinite-math-only}. It is enabled by default when generating code for
26015 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26016 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26017 in effect.
26018
26019 @item -mpretend-cmove
26020 @opindex mpretend-cmove
26021 Prefer zero-displacement conditional branches for conditional move instruction
26022 patterns. This can result in faster code on the SH4 processor.
26023
26024 @item -mfdpic
26025 @opindex fdpic
26026 Generate code using the FDPIC ABI.
26027
26028 @end table
26029
26030 @node Solaris 2 Options
26031 @subsection Solaris 2 Options
26032 @cindex Solaris 2 options
26033
26034 These @samp{-m} options are supported on Solaris 2:
26035
26036 @table @gcctabopt
26037 @item -mclear-hwcap
26038 @opindex mclear-hwcap
26039 @option{-mclear-hwcap} tells the compiler to remove the hardware
26040 capabilities generated by the Solaris assembler. This is only necessary
26041 when object files use ISA extensions not supported by the current
26042 machine, but check at runtime whether or not to use them.
26043
26044 @item -mimpure-text
26045 @opindex mimpure-text
26046 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26047 the compiler to not pass @option{-z text} to the linker when linking a
26048 shared object. Using this option, you can link position-dependent
26049 code into a shared object.
26050
26051 @option{-mimpure-text} suppresses the ``relocations remain against
26052 allocatable but non-writable sections'' linker error message.
26053 However, the necessary relocations trigger copy-on-write, and the
26054 shared object is not actually shared across processes. Instead of
26055 using @option{-mimpure-text}, you should compile all source code with
26056 @option{-fpic} or @option{-fPIC}.
26057
26058 @end table
26059
26060 These switches are supported in addition to the above on Solaris 2:
26061
26062 @table @gcctabopt
26063 @item -pthreads
26064 @opindex pthreads
26065 This is a synonym for @option{-pthread}.
26066 @end table
26067
26068 @node SPARC Options
26069 @subsection SPARC Options
26070 @cindex SPARC options
26071
26072 These @samp{-m} options are supported on the SPARC:
26073
26074 @table @gcctabopt
26075 @item -mno-app-regs
26076 @itemx -mapp-regs
26077 @opindex mno-app-regs
26078 @opindex mapp-regs
26079 Specify @option{-mapp-regs} to generate output using the global registers
26080 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26081 global register 1, each global register 2 through 4 is then treated as an
26082 allocable register that is clobbered by function calls. This is the default.
26083
26084 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26085 specify @option{-mno-app-regs}. You should compile libraries and system
26086 software with this option.
26087
26088 @item -mflat
26089 @itemx -mno-flat
26090 @opindex mflat
26091 @opindex mno-flat
26092 With @option{-mflat}, the compiler does not generate save/restore instructions
26093 and uses a ``flat'' or single register window model. This model is compatible
26094 with the regular register window model. The local registers and the input
26095 registers (0--5) are still treated as ``call-saved'' registers and are
26096 saved on the stack as needed.
26097
26098 With @option{-mno-flat} (the default), the compiler generates save/restore
26099 instructions (except for leaf functions). This is the normal operating mode.
26100
26101 @item -mfpu
26102 @itemx -mhard-float
26103 @opindex mfpu
26104 @opindex mhard-float
26105 Generate output containing floating-point instructions. This is the
26106 default.
26107
26108 @item -mno-fpu
26109 @itemx -msoft-float
26110 @opindex mno-fpu
26111 @opindex msoft-float
26112 Generate output containing library calls for floating point.
26113 @strong{Warning:} the requisite libraries are not available for all SPARC
26114 targets. Normally the facilities of the machine's usual C compiler are
26115 used, but this cannot be done directly in cross-compilation. You must make
26116 your own arrangements to provide suitable library functions for
26117 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26118 @samp{sparclite-*-*} do provide software floating-point support.
26119
26120 @option{-msoft-float} changes the calling convention in the output file;
26121 therefore, it is only useful if you compile @emph{all} of a program with
26122 this option. In particular, you need to compile @file{libgcc.a}, the
26123 library that comes with GCC, with @option{-msoft-float} in order for
26124 this to work.
26125
26126 @item -mhard-quad-float
26127 @opindex mhard-quad-float
26128 Generate output containing quad-word (long double) floating-point
26129 instructions.
26130
26131 @item -msoft-quad-float
26132 @opindex msoft-quad-float
26133 Generate output containing library calls for quad-word (long double)
26134 floating-point instructions. The functions called are those specified
26135 in the SPARC ABI@. This is the default.
26136
26137 As of this writing, there are no SPARC implementations that have hardware
26138 support for the quad-word floating-point instructions. They all invoke
26139 a trap handler for one of these instructions, and then the trap handler
26140 emulates the effect of the instruction. Because of the trap handler overhead,
26141 this is much slower than calling the ABI library routines. Thus the
26142 @option{-msoft-quad-float} option is the default.
26143
26144 @item -mno-unaligned-doubles
26145 @itemx -munaligned-doubles
26146 @opindex mno-unaligned-doubles
26147 @opindex munaligned-doubles
26148 Assume that doubles have 8-byte alignment. This is the default.
26149
26150 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26151 alignment only if they are contained in another type, or if they have an
26152 absolute address. Otherwise, it assumes they have 4-byte alignment.
26153 Specifying this option avoids some rare compatibility problems with code
26154 generated by other compilers. It is not the default because it results
26155 in a performance loss, especially for floating-point code.
26156
26157 @item -muser-mode
26158 @itemx -mno-user-mode
26159 @opindex muser-mode
26160 @opindex mno-user-mode
26161 Do not generate code that can only run in supervisor mode. This is relevant
26162 only for the @code{casa} instruction emitted for the LEON3 processor. This
26163 is the default.
26164
26165 @item -mfaster-structs
26166 @itemx -mno-faster-structs
26167 @opindex mfaster-structs
26168 @opindex mno-faster-structs
26169 With @option{-mfaster-structs}, the compiler assumes that structures
26170 should have 8-byte alignment. This enables the use of pairs of
26171 @code{ldd} and @code{std} instructions for copies in structure
26172 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26173 However, the use of this changed alignment directly violates the SPARC
26174 ABI@. Thus, it's intended only for use on targets where the developer
26175 acknowledges that their resulting code is not directly in line with
26176 the rules of the ABI@.
26177
26178 @item -mstd-struct-return
26179 @itemx -mno-std-struct-return
26180 @opindex mstd-struct-return
26181 @opindex mno-std-struct-return
26182 With @option{-mstd-struct-return}, the compiler generates checking code
26183 in functions returning structures or unions to detect size mismatches
26184 between the two sides of function calls, as per the 32-bit ABI@.
26185
26186 The default is @option{-mno-std-struct-return}. This option has no effect
26187 in 64-bit mode.
26188
26189 @item -mlra
26190 @itemx -mno-lra
26191 @opindex mlra
26192 @opindex mno-lra
26193 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26194 so @option{-mno-lra} needs to be passed to get old Reload.
26195
26196 @item -mcpu=@var{cpu_type}
26197 @opindex mcpu
26198 Set the instruction set, register set, and instruction scheduling parameters
26199 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26200 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26201 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26202 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26203 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26204 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26205
26206 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26207 which selects the best architecture option for the host processor.
26208 @option{-mcpu=native} has no effect if GCC does not recognize
26209 the processor.
26210
26211 Default instruction scheduling parameters are used for values that select
26212 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26213 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26214
26215 Here is a list of each supported architecture and their supported
26216 implementations.
26217
26218 @table @asis
26219 @item v7
26220 cypress, leon3v7
26221
26222 @item v8
26223 supersparc, hypersparc, leon, leon3
26224
26225 @item sparclite
26226 f930, f934, sparclite86x
26227
26228 @item sparclet
26229 tsc701
26230
26231 @item v9
26232 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26233 niagara7, m8
26234 @end table
26235
26236 By default (unless configured otherwise), GCC generates code for the V7
26237 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26238 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26239 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26240 SPARCStation 1, 2, IPX etc.
26241
26242 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26243 architecture. The only difference from V7 code is that the compiler emits
26244 the integer multiply and integer divide instructions which exist in SPARC-V8
26245 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26246 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26247 2000 series.
26248
26249 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26250 the SPARC architecture. This adds the integer multiply, integer divide step
26251 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26252 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26253 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26254 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26255 MB86934 chip, which is the more recent SPARClite with FPU@.
26256
26257 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26258 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26259 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26260 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26261 optimizes it for the TEMIC SPARClet chip.
26262
26263 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26264 architecture. This adds 64-bit integer and floating-point move instructions,
26265 3 additional floating-point condition code registers and conditional move
26266 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26267 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26268 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26269 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26270 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26271 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26272 additionally optimizes it for Sun UltraSPARC T2 chips. With
26273 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26274 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26275 additionally optimizes it for Sun UltraSPARC T4 chips. With
26276 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26277 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26278 additionally optimizes it for Oracle M8 chips.
26279
26280 @item -mtune=@var{cpu_type}
26281 @opindex mtune
26282 Set the instruction scheduling parameters for machine type
26283 @var{cpu_type}, but do not set the instruction set or register set that the
26284 option @option{-mcpu=@var{cpu_type}} does.
26285
26286 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26287 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26288 that select a particular CPU implementation. Those are
26289 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26290 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26291 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26292 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26293 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26294 and GNU/Linux toolchains, @samp{native} can also be used.
26295
26296 @item -mv8plus
26297 @itemx -mno-v8plus
26298 @opindex mv8plus
26299 @opindex mno-v8plus
26300 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26301 difference from the V8 ABI is that the global and out registers are
26302 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26303 mode for all SPARC-V9 processors.
26304
26305 @item -mvis
26306 @itemx -mno-vis
26307 @opindex mvis
26308 @opindex mno-vis
26309 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26310 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26311
26312 @item -mvis2
26313 @itemx -mno-vis2
26314 @opindex mvis2
26315 @opindex mno-vis2
26316 With @option{-mvis2}, GCC generates code that takes advantage of
26317 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26318 default is @option{-mvis2} when targeting a cpu that supports such
26319 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26320 also sets @option{-mvis}.
26321
26322 @item -mvis3
26323 @itemx -mno-vis3
26324 @opindex mvis3
26325 @opindex mno-vis3
26326 With @option{-mvis3}, GCC generates code that takes advantage of
26327 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26328 default is @option{-mvis3} when targeting a cpu that supports such
26329 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26330 also sets @option{-mvis2} and @option{-mvis}.
26331
26332 @item -mvis4
26333 @itemx -mno-vis4
26334 @opindex mvis4
26335 @opindex mno-vis4
26336 With @option{-mvis4}, GCC generates code that takes advantage of
26337 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26338 default is @option{-mvis4} when targeting a cpu that supports such
26339 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26340 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26341
26342 @item -mvis4b
26343 @itemx -mno-vis4b
26344 @opindex mvis4b
26345 @opindex mno-vis4b
26346 With @option{-mvis4b}, GCC generates code that takes advantage of
26347 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26348 the additional VIS instructions introduced in the Oracle SPARC
26349 Architecture 2017. The default is @option{-mvis4b} when targeting a
26350 cpu that supports such instructions, such as m8 and later. Setting
26351 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26352 @option{-mvis2} and @option{-mvis}.
26353
26354 @item -mcbcond
26355 @itemx -mno-cbcond
26356 @opindex mcbcond
26357 @opindex mno-cbcond
26358 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26359 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26360 when targeting a CPU that supports such instructions, such as Niagara-4 and
26361 later.
26362
26363 @item -mfmaf
26364 @itemx -mno-fmaf
26365 @opindex mfmaf
26366 @opindex mno-fmaf
26367 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26368 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26369 when targeting a CPU that supports such instructions, such as Niagara-3 and
26370 later.
26371
26372 @item -mfsmuld
26373 @itemx -mno-fsmuld
26374 @opindex mfsmuld
26375 @opindex mno-fsmuld
26376 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26377 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26378 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26379 or V9 with FPU except @option{-mcpu=leon}.
26380
26381 @item -mpopc
26382 @itemx -mno-popc
26383 @opindex mpopc
26384 @opindex mno-popc
26385 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26386 Population Count instruction. The default is @option{-mpopc}
26387 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26388 later.
26389
26390 @item -msubxc
26391 @itemx -mno-subxc
26392 @opindex msubxc
26393 @opindex mno-subxc
26394 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26395 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26396 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26397 later.
26398
26399 @item -mfix-at697f
26400 @opindex mfix-at697f
26401 Enable the documented workaround for the single erratum of the Atmel AT697F
26402 processor (which corresponds to erratum #13 of the AT697E processor).
26403
26404 @item -mfix-ut699
26405 @opindex mfix-ut699
26406 Enable the documented workarounds for the floating-point errata and the data
26407 cache nullify errata of the UT699 processor.
26408
26409 @item -mfix-ut700
26410 @opindex mfix-ut700
26411 Enable the documented workaround for the back-to-back store errata of
26412 the UT699E/UT700 processor.
26413
26414 @item -mfix-gr712rc
26415 @opindex mfix-gr712rc
26416 Enable the documented workaround for the back-to-back store errata of
26417 the GR712RC processor.
26418 @end table
26419
26420 These @samp{-m} options are supported in addition to the above
26421 on SPARC-V9 processors in 64-bit environments:
26422
26423 @table @gcctabopt
26424 @item -m32
26425 @itemx -m64
26426 @opindex m32
26427 @opindex m64
26428 Generate code for a 32-bit or 64-bit environment.
26429 The 32-bit environment sets int, long and pointer to 32 bits.
26430 The 64-bit environment sets int to 32 bits and long and pointer
26431 to 64 bits.
26432
26433 @item -mcmodel=@var{which}
26434 @opindex mcmodel
26435 Set the code model to one of
26436
26437 @table @samp
26438 @item medlow
26439 The Medium/Low code model: 64-bit addresses, programs
26440 must be linked in the low 32 bits of memory. Programs can be statically
26441 or dynamically linked.
26442
26443 @item medmid
26444 The Medium/Middle code model: 64-bit addresses, programs
26445 must be linked in the low 44 bits of memory, the text and data segments must
26446 be less than 2GB in size and the data segment must be located within 2GB of
26447 the text segment.
26448
26449 @item medany
26450 The Medium/Anywhere code model: 64-bit addresses, programs
26451 may be linked anywhere in memory, the text and data segments must be less
26452 than 2GB in size and the data segment must be located within 2GB of the
26453 text segment.
26454
26455 @item embmedany
26456 The Medium/Anywhere code model for embedded systems:
26457 64-bit addresses, the text and data segments must be less than 2GB in
26458 size, both starting anywhere in memory (determined at link time). The
26459 global register %g4 points to the base of the data segment. Programs
26460 are statically linked and PIC is not supported.
26461 @end table
26462
26463 @item -mmemory-model=@var{mem-model}
26464 @opindex mmemory-model
26465 Set the memory model in force on the processor to one of
26466
26467 @table @samp
26468 @item default
26469 The default memory model for the processor and operating system.
26470
26471 @item rmo
26472 Relaxed Memory Order
26473
26474 @item pso
26475 Partial Store Order
26476
26477 @item tso
26478 Total Store Order
26479
26480 @item sc
26481 Sequential Consistency
26482 @end table
26483
26484 These memory models are formally defined in Appendix D of the SPARC-V9
26485 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26486
26487 @item -mstack-bias
26488 @itemx -mno-stack-bias
26489 @opindex mstack-bias
26490 @opindex mno-stack-bias
26491 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26492 frame pointer if present, are offset by @minus{}2047 which must be added back
26493 when making stack frame references. This is the default in 64-bit mode.
26494 Otherwise, assume no such offset is present.
26495 @end table
26496
26497 @node SPU Options
26498 @subsection SPU Options
26499 @cindex SPU options
26500
26501 These @samp{-m} options are supported on the SPU:
26502
26503 @table @gcctabopt
26504 @item -mwarn-reloc
26505 @itemx -merror-reloc
26506 @opindex mwarn-reloc
26507 @opindex merror-reloc
26508
26509 The loader for SPU does not handle dynamic relocations. By default, GCC
26510 gives an error when it generates code that requires a dynamic
26511 relocation. @option{-mno-error-reloc} disables the error,
26512 @option{-mwarn-reloc} generates a warning instead.
26513
26514 @item -msafe-dma
26515 @itemx -munsafe-dma
26516 @opindex msafe-dma
26517 @opindex munsafe-dma
26518
26519 Instructions that initiate or test completion of DMA must not be
26520 reordered with respect to loads and stores of the memory that is being
26521 accessed.
26522 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26523 memory accesses, but that can lead to inefficient code in places where the
26524 memory is known to not change. Rather than mark the memory as volatile,
26525 you can use @option{-msafe-dma} to tell the compiler to treat
26526 the DMA instructions as potentially affecting all memory.
26527
26528 @item -mbranch-hints
26529 @opindex mbranch-hints
26530
26531 By default, GCC generates a branch hint instruction to avoid
26532 pipeline stalls for always-taken or probably-taken branches. A hint
26533 is not generated closer than 8 instructions away from its branch.
26534 There is little reason to disable them, except for debugging purposes,
26535 or to make an object a little bit smaller.
26536
26537 @item -msmall-mem
26538 @itemx -mlarge-mem
26539 @opindex msmall-mem
26540 @opindex mlarge-mem
26541
26542 By default, GCC generates code assuming that addresses are never larger
26543 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26544 a full 32-bit address.
26545
26546 @item -mstdmain
26547 @opindex mstdmain
26548
26549 By default, GCC links against startup code that assumes the SPU-style
26550 main function interface (which has an unconventional parameter list).
26551 With @option{-mstdmain}, GCC links your program against startup
26552 code that assumes a C99-style interface to @code{main}, including a
26553 local copy of @code{argv} strings.
26554
26555 @item -mfixed-range=@var{register-range}
26556 @opindex mfixed-range
26557 Generate code treating the given register range as fixed registers.
26558 A fixed register is one that the register allocator cannot use. This is
26559 useful when compiling kernel code. A register range is specified as
26560 two registers separated by a dash. Multiple register ranges can be
26561 specified separated by a comma.
26562
26563 @item -mea32
26564 @itemx -mea64
26565 @opindex mea32
26566 @opindex mea64
26567 Compile code assuming that pointers to the PPU address space accessed
26568 via the @code{__ea} named address space qualifier are either 32 or 64
26569 bits wide. The default is 32 bits. As this is an ABI-changing option,
26570 all object code in an executable must be compiled with the same setting.
26571
26572 @item -maddress-space-conversion
26573 @itemx -mno-address-space-conversion
26574 @opindex maddress-space-conversion
26575 @opindex mno-address-space-conversion
26576 Allow/disallow treating the @code{__ea} address space as superset
26577 of the generic address space. This enables explicit type casts
26578 between @code{__ea} and generic pointer as well as implicit
26579 conversions of generic pointers to @code{__ea} pointers. The
26580 default is to allow address space pointer conversions.
26581
26582 @item -mcache-size=@var{cache-size}
26583 @opindex mcache-size
26584 This option controls the version of libgcc that the compiler links to an
26585 executable and selects a software-managed cache for accessing variables
26586 in the @code{__ea} address space with a particular cache size. Possible
26587 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26588 and @samp{128}. The default cache size is 64KB.
26589
26590 @item -matomic-updates
26591 @itemx -mno-atomic-updates
26592 @opindex matomic-updates
26593 @opindex mno-atomic-updates
26594 This option controls the version of libgcc that the compiler links to an
26595 executable and selects whether atomic updates to the software-managed
26596 cache of PPU-side variables are used. If you use atomic updates, changes
26597 to a PPU variable from SPU code using the @code{__ea} named address space
26598 qualifier do not interfere with changes to other PPU variables residing
26599 in the same cache line from PPU code. If you do not use atomic updates,
26600 such interference may occur; however, writing back cache lines is
26601 more efficient. The default behavior is to use atomic updates.
26602
26603 @item -mdual-nops
26604 @itemx -mdual-nops=@var{n}
26605 @opindex mdual-nops
26606 By default, GCC inserts NOPs to increase dual issue when it expects
26607 it to increase performance. @var{n} can be a value from 0 to 10. A
26608 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26609 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26610
26611 @item -mhint-max-nops=@var{n}
26612 @opindex mhint-max-nops
26613 Maximum number of NOPs to insert for a branch hint. A branch hint must
26614 be at least 8 instructions away from the branch it is affecting. GCC
26615 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26616 generate the branch hint.
26617
26618 @item -mhint-max-distance=@var{n}
26619 @opindex mhint-max-distance
26620 The encoding of the branch hint instruction limits the hint to be within
26621 256 instructions of the branch it is affecting. By default, GCC makes
26622 sure it is within 125.
26623
26624 @item -msafe-hints
26625 @opindex msafe-hints
26626 Work around a hardware bug that causes the SPU to stall indefinitely.
26627 By default, GCC inserts the @code{hbrp} instruction to make sure
26628 this stall won't happen.
26629
26630 @end table
26631
26632 @node System V Options
26633 @subsection Options for System V
26634
26635 These additional options are available on System V Release 4 for
26636 compatibility with other compilers on those systems:
26637
26638 @table @gcctabopt
26639 @item -G
26640 @opindex G
26641 Create a shared object.
26642 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26643
26644 @item -Qy
26645 @opindex Qy
26646 Identify the versions of each tool used by the compiler, in a
26647 @code{.ident} assembler directive in the output.
26648
26649 @item -Qn
26650 @opindex Qn
26651 Refrain from adding @code{.ident} directives to the output file (this is
26652 the default).
26653
26654 @item -YP,@var{dirs}
26655 @opindex YP
26656 Search the directories @var{dirs}, and no others, for libraries
26657 specified with @option{-l}.
26658
26659 @item -Ym,@var{dir}
26660 @opindex Ym
26661 Look in the directory @var{dir} to find the M4 preprocessor.
26662 The assembler uses this option.
26663 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26664 @c the generic assembler that comes with Solaris takes just -Ym.
26665 @end table
26666
26667 @node TILE-Gx Options
26668 @subsection TILE-Gx Options
26669 @cindex TILE-Gx options
26670
26671 These @samp{-m} options are supported on the TILE-Gx:
26672
26673 @table @gcctabopt
26674 @item -mcmodel=small
26675 @opindex mcmodel=small
26676 Generate code for the small model. The distance for direct calls is
26677 limited to 500M in either direction. PC-relative addresses are 32
26678 bits. Absolute addresses support the full address range.
26679
26680 @item -mcmodel=large
26681 @opindex mcmodel=large
26682 Generate code for the large model. There is no limitation on call
26683 distance, pc-relative addresses, or absolute addresses.
26684
26685 @item -mcpu=@var{name}
26686 @opindex mcpu
26687 Selects the type of CPU to be targeted. Currently the only supported
26688 type is @samp{tilegx}.
26689
26690 @item -m32
26691 @itemx -m64
26692 @opindex m32
26693 @opindex m64
26694 Generate code for a 32-bit or 64-bit environment. The 32-bit
26695 environment sets int, long, and pointer to 32 bits. The 64-bit
26696 environment sets int to 32 bits and long and pointer to 64 bits.
26697
26698 @item -mbig-endian
26699 @itemx -mlittle-endian
26700 @opindex mbig-endian
26701 @opindex mlittle-endian
26702 Generate code in big/little endian mode, respectively.
26703 @end table
26704
26705 @node TILEPro Options
26706 @subsection TILEPro Options
26707 @cindex TILEPro options
26708
26709 These @samp{-m} options are supported on the TILEPro:
26710
26711 @table @gcctabopt
26712 @item -mcpu=@var{name}
26713 @opindex mcpu
26714 Selects the type of CPU to be targeted. Currently the only supported
26715 type is @samp{tilepro}.
26716
26717 @item -m32
26718 @opindex m32
26719 Generate code for a 32-bit environment, which sets int, long, and
26720 pointer to 32 bits. This is the only supported behavior so the flag
26721 is essentially ignored.
26722 @end table
26723
26724 @node V850 Options
26725 @subsection V850 Options
26726 @cindex V850 Options
26727
26728 These @samp{-m} options are defined for V850 implementations:
26729
26730 @table @gcctabopt
26731 @item -mlong-calls
26732 @itemx -mno-long-calls
26733 @opindex mlong-calls
26734 @opindex mno-long-calls
26735 Treat all calls as being far away (near). If calls are assumed to be
26736 far away, the compiler always loads the function's address into a
26737 register, and calls indirect through the pointer.
26738
26739 @item -mno-ep
26740 @itemx -mep
26741 @opindex mno-ep
26742 @opindex mep
26743 Do not optimize (do optimize) basic blocks that use the same index
26744 pointer 4 or more times to copy pointer into the @code{ep} register, and
26745 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26746 option is on by default if you optimize.
26747
26748 @item -mno-prolog-function
26749 @itemx -mprolog-function
26750 @opindex mno-prolog-function
26751 @opindex mprolog-function
26752 Do not use (do use) external functions to save and restore registers
26753 at the prologue and epilogue of a function. The external functions
26754 are slower, but use less code space if more than one function saves
26755 the same number of registers. The @option{-mprolog-function} option
26756 is on by default if you optimize.
26757
26758 @item -mspace
26759 @opindex mspace
26760 Try to make the code as small as possible. At present, this just turns
26761 on the @option{-mep} and @option{-mprolog-function} options.
26762
26763 @item -mtda=@var{n}
26764 @opindex mtda
26765 Put static or global variables whose size is @var{n} bytes or less into
26766 the tiny data area that register @code{ep} points to. The tiny data
26767 area can hold up to 256 bytes in total (128 bytes for byte references).
26768
26769 @item -msda=@var{n}
26770 @opindex msda
26771 Put static or global variables whose size is @var{n} bytes or less into
26772 the small data area that register @code{gp} points to. The small data
26773 area can hold up to 64 kilobytes.
26774
26775 @item -mzda=@var{n}
26776 @opindex mzda
26777 Put static or global variables whose size is @var{n} bytes or less into
26778 the first 32 kilobytes of memory.
26779
26780 @item -mv850
26781 @opindex mv850
26782 Specify that the target processor is the V850.
26783
26784 @item -mv850e3v5
26785 @opindex mv850e3v5
26786 Specify that the target processor is the V850E3V5. The preprocessor
26787 constant @code{__v850e3v5__} is defined if this option is used.
26788
26789 @item -mv850e2v4
26790 @opindex mv850e2v4
26791 Specify that the target processor is the V850E3V5. This is an alias for
26792 the @option{-mv850e3v5} option.
26793
26794 @item -mv850e2v3
26795 @opindex mv850e2v3
26796 Specify that the target processor is the V850E2V3. The preprocessor
26797 constant @code{__v850e2v3__} is defined if this option is used.
26798
26799 @item -mv850e2
26800 @opindex mv850e2
26801 Specify that the target processor is the V850E2. The preprocessor
26802 constant @code{__v850e2__} is defined if this option is used.
26803
26804 @item -mv850e1
26805 @opindex mv850e1
26806 Specify that the target processor is the V850E1. The preprocessor
26807 constants @code{__v850e1__} and @code{__v850e__} are defined if
26808 this option is used.
26809
26810 @item -mv850es
26811 @opindex mv850es
26812 Specify that the target processor is the V850ES. This is an alias for
26813 the @option{-mv850e1} option.
26814
26815 @item -mv850e
26816 @opindex mv850e
26817 Specify that the target processor is the V850E@. The preprocessor
26818 constant @code{__v850e__} is defined if this option is used.
26819
26820 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26821 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26822 are defined then a default target processor is chosen and the
26823 relevant @samp{__v850*__} preprocessor constant is defined.
26824
26825 The preprocessor constants @code{__v850} and @code{__v851__} are always
26826 defined, regardless of which processor variant is the target.
26827
26828 @item -mdisable-callt
26829 @itemx -mno-disable-callt
26830 @opindex mdisable-callt
26831 @opindex mno-disable-callt
26832 This option suppresses generation of the @code{CALLT} instruction for the
26833 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26834 architecture.
26835
26836 This option is enabled by default when the RH850 ABI is
26837 in use (see @option{-mrh850-abi}), and disabled by default when the
26838 GCC ABI is in use. If @code{CALLT} instructions are being generated
26839 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26840
26841 @item -mrelax
26842 @itemx -mno-relax
26843 @opindex mrelax
26844 @opindex mno-relax
26845 Pass on (or do not pass on) the @option{-mrelax} command-line option
26846 to the assembler.
26847
26848 @item -mlong-jumps
26849 @itemx -mno-long-jumps
26850 @opindex mlong-jumps
26851 @opindex mno-long-jumps
26852 Disable (or re-enable) the generation of PC-relative jump instructions.
26853
26854 @item -msoft-float
26855 @itemx -mhard-float
26856 @opindex msoft-float
26857 @opindex mhard-float
26858 Disable (or re-enable) the generation of hardware floating point
26859 instructions. This option is only significant when the target
26860 architecture is @samp{V850E2V3} or higher. If hardware floating point
26861 instructions are being generated then the C preprocessor symbol
26862 @code{__FPU_OK__} is defined, otherwise the symbol
26863 @code{__NO_FPU__} is defined.
26864
26865 @item -mloop
26866 @opindex mloop
26867 Enables the use of the e3v5 LOOP instruction. The use of this
26868 instruction is not enabled by default when the e3v5 architecture is
26869 selected because its use is still experimental.
26870
26871 @item -mrh850-abi
26872 @itemx -mghs
26873 @opindex mrh850-abi
26874 @opindex mghs
26875 Enables support for the RH850 version of the V850 ABI. This is the
26876 default. With this version of the ABI the following rules apply:
26877
26878 @itemize
26879 @item
26880 Integer sized structures and unions are returned via a memory pointer
26881 rather than a register.
26882
26883 @item
26884 Large structures and unions (more than 8 bytes in size) are passed by
26885 value.
26886
26887 @item
26888 Functions are aligned to 16-bit boundaries.
26889
26890 @item
26891 The @option{-m8byte-align} command-line option is supported.
26892
26893 @item
26894 The @option{-mdisable-callt} command-line option is enabled by
26895 default. The @option{-mno-disable-callt} command-line option is not
26896 supported.
26897 @end itemize
26898
26899 When this version of the ABI is enabled the C preprocessor symbol
26900 @code{__V850_RH850_ABI__} is defined.
26901
26902 @item -mgcc-abi
26903 @opindex mgcc-abi
26904 Enables support for the old GCC version of the V850 ABI. With this
26905 version of the ABI the following rules apply:
26906
26907 @itemize
26908 @item
26909 Integer sized structures and unions are returned in register @code{r10}.
26910
26911 @item
26912 Large structures and unions (more than 8 bytes in size) are passed by
26913 reference.
26914
26915 @item
26916 Functions are aligned to 32-bit boundaries, unless optimizing for
26917 size.
26918
26919 @item
26920 The @option{-m8byte-align} command-line option is not supported.
26921
26922 @item
26923 The @option{-mdisable-callt} command-line option is supported but not
26924 enabled by default.
26925 @end itemize
26926
26927 When this version of the ABI is enabled the C preprocessor symbol
26928 @code{__V850_GCC_ABI__} is defined.
26929
26930 @item -m8byte-align
26931 @itemx -mno-8byte-align
26932 @opindex m8byte-align
26933 @opindex mno-8byte-align
26934 Enables support for @code{double} and @code{long long} types to be
26935 aligned on 8-byte boundaries. The default is to restrict the
26936 alignment of all objects to at most 4-bytes. When
26937 @option{-m8byte-align} is in effect the C preprocessor symbol
26938 @code{__V850_8BYTE_ALIGN__} is defined.
26939
26940 @item -mbig-switch
26941 @opindex mbig-switch
26942 Generate code suitable for big switch tables. Use this option only if
26943 the assembler/linker complain about out of range branches within a switch
26944 table.
26945
26946 @item -mapp-regs
26947 @opindex mapp-regs
26948 This option causes r2 and r5 to be used in the code generated by
26949 the compiler. This setting is the default.
26950
26951 @item -mno-app-regs
26952 @opindex mno-app-regs
26953 This option causes r2 and r5 to be treated as fixed registers.
26954
26955 @end table
26956
26957 @node VAX Options
26958 @subsection VAX Options
26959 @cindex VAX options
26960
26961 These @samp{-m} options are defined for the VAX:
26962
26963 @table @gcctabopt
26964 @item -munix
26965 @opindex munix
26966 Do not output certain jump instructions (@code{aobleq} and so on)
26967 that the Unix assembler for the VAX cannot handle across long
26968 ranges.
26969
26970 @item -mgnu
26971 @opindex mgnu
26972 Do output those jump instructions, on the assumption that the
26973 GNU assembler is being used.
26974
26975 @item -mg
26976 @opindex mg
26977 Output code for G-format floating-point numbers instead of D-format.
26978 @end table
26979
26980 @node Visium Options
26981 @subsection Visium Options
26982 @cindex Visium options
26983
26984 @table @gcctabopt
26985
26986 @item -mdebug
26987 @opindex mdebug
26988 A program which performs file I/O and is destined to run on an MCM target
26989 should be linked with this option. It causes the libraries libc.a and
26990 libdebug.a to be linked. The program should be run on the target under
26991 the control of the GDB remote debugging stub.
26992
26993 @item -msim
26994 @opindex msim
26995 A program which performs file I/O and is destined to run on the simulator
26996 should be linked with option. This causes libraries libc.a and libsim.a to
26997 be linked.
26998
26999 @item -mfpu
27000 @itemx -mhard-float
27001 @opindex mfpu
27002 @opindex mhard-float
27003 Generate code containing floating-point instructions. This is the
27004 default.
27005
27006 @item -mno-fpu
27007 @itemx -msoft-float
27008 @opindex mno-fpu
27009 @opindex msoft-float
27010 Generate code containing library calls for floating-point.
27011
27012 @option{-msoft-float} changes the calling convention in the output file;
27013 therefore, it is only useful if you compile @emph{all} of a program with
27014 this option. In particular, you need to compile @file{libgcc.a}, the
27015 library that comes with GCC, with @option{-msoft-float} in order for
27016 this to work.
27017
27018 @item -mcpu=@var{cpu_type}
27019 @opindex mcpu
27020 Set the instruction set, register set, and instruction scheduling parameters
27021 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27022 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27023
27024 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27025
27026 By default (unless configured otherwise), GCC generates code for the GR5
27027 variant of the Visium architecture.
27028
27029 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27030 architecture. The only difference from GR5 code is that the compiler will
27031 generate block move instructions.
27032
27033 @item -mtune=@var{cpu_type}
27034 @opindex mtune
27035 Set the instruction scheduling parameters for machine type @var{cpu_type},
27036 but do not set the instruction set or register set that the option
27037 @option{-mcpu=@var{cpu_type}} would.
27038
27039 @item -msv-mode
27040 @opindex msv-mode
27041 Generate code for the supervisor mode, where there are no restrictions on
27042 the access to general registers. This is the default.
27043
27044 @item -muser-mode
27045 @opindex muser-mode
27046 Generate code for the user mode, where the access to some general registers
27047 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27048 mode; on the GR6, only registers r29 to r31 are affected.
27049 @end table
27050
27051 @node VMS Options
27052 @subsection VMS Options
27053
27054 These @samp{-m} options are defined for the VMS implementations:
27055
27056 @table @gcctabopt
27057 @item -mvms-return-codes
27058 @opindex mvms-return-codes
27059 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27060 condition (e.g.@: error) codes.
27061
27062 @item -mdebug-main=@var{prefix}
27063 @opindex mdebug-main=@var{prefix}
27064 Flag the first routine whose name starts with @var{prefix} as the main
27065 routine for the debugger.
27066
27067 @item -mmalloc64
27068 @opindex mmalloc64
27069 Default to 64-bit memory allocation routines.
27070
27071 @item -mpointer-size=@var{size}
27072 @opindex mpointer-size=@var{size}
27073 Set the default size of pointers. Possible options for @var{size} are
27074 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27075 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27076 The later option disables @code{pragma pointer_size}.
27077 @end table
27078
27079 @node VxWorks Options
27080 @subsection VxWorks Options
27081 @cindex VxWorks Options
27082
27083 The options in this section are defined for all VxWorks targets.
27084 Options specific to the target hardware are listed with the other
27085 options for that target.
27086
27087 @table @gcctabopt
27088 @item -mrtp
27089 @opindex mrtp
27090 GCC can generate code for both VxWorks kernels and real time processes
27091 (RTPs). This option switches from the former to the latter. It also
27092 defines the preprocessor macro @code{__RTP__}.
27093
27094 @item -non-static
27095 @opindex non-static
27096 Link an RTP executable against shared libraries rather than static
27097 libraries. The options @option{-static} and @option{-shared} can
27098 also be used for RTPs (@pxref{Link Options}); @option{-static}
27099 is the default.
27100
27101 @item -Bstatic
27102 @itemx -Bdynamic
27103 @opindex Bstatic
27104 @opindex Bdynamic
27105 These options are passed down to the linker. They are defined for
27106 compatibility with Diab.
27107
27108 @item -Xbind-lazy
27109 @opindex Xbind-lazy
27110 Enable lazy binding of function calls. This option is equivalent to
27111 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27112
27113 @item -Xbind-now
27114 @opindex Xbind-now
27115 Disable lazy binding of function calls. This option is the default and
27116 is defined for compatibility with Diab.
27117 @end table
27118
27119 @node x86 Options
27120 @subsection x86 Options
27121 @cindex x86 Options
27122
27123 These @samp{-m} options are defined for the x86 family of computers.
27124
27125 @table @gcctabopt
27126
27127 @item -march=@var{cpu-type}
27128 @opindex march
27129 Generate instructions for the machine type @var{cpu-type}. In contrast to
27130 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27131 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27132 to generate code that may not run at all on processors other than the one
27133 indicated. Specifying @option{-march=@var{cpu-type}} implies
27134 @option{-mtune=@var{cpu-type}}.
27135
27136 The choices for @var{cpu-type} are:
27137
27138 @table @samp
27139 @item native
27140 This selects the CPU to generate code for at compilation time by determining
27141 the processor type of the compiling machine. Using @option{-march=native}
27142 enables all instruction subsets supported by the local machine (hence
27143 the result might not run on different machines). Using @option{-mtune=native}
27144 produces code optimized for the local machine under the constraints
27145 of the selected instruction set.
27146
27147 @item x86-64
27148 A generic CPU with 64-bit extensions.
27149
27150 @item i386
27151 Original Intel i386 CPU@.
27152
27153 @item i486
27154 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27155
27156 @item i586
27157 @itemx pentium
27158 Intel Pentium CPU with no MMX support.
27159
27160 @item lakemont
27161 Intel Lakemont MCU, based on Intel Pentium CPU.
27162
27163 @item pentium-mmx
27164 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27165
27166 @item pentiumpro
27167 Intel Pentium Pro CPU@.
27168
27169 @item i686
27170 When used with @option{-march}, the Pentium Pro
27171 instruction set is used, so the code runs on all i686 family chips.
27172 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27173
27174 @item pentium2
27175 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27176 support.
27177
27178 @item pentium3
27179 @itemx pentium3m
27180 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27181 set support.
27182
27183 @item pentium-m
27184 Intel Pentium M; low-power version of Intel Pentium III CPU
27185 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27186
27187 @item pentium4
27188 @itemx pentium4m
27189 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27190
27191 @item prescott
27192 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27193 set support.
27194
27195 @item nocona
27196 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27197 SSE2 and SSE3 instruction set support.
27198
27199 @item core2
27200 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27201 instruction set support.
27202
27203 @item nehalem
27204 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27205 SSE4.1, SSE4.2 and POPCNT instruction set support.
27206
27207 @item westmere
27208 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27209 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27210
27211 @item sandybridge
27212 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27213 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27214
27215 @item ivybridge
27216 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27217 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27218 instruction set support.
27219
27220 @item haswell
27221 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27222 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27223 BMI, BMI2 and F16C instruction set support.
27224
27225 @item broadwell
27226 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27227 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27228 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27229
27230 @item skylake
27231 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27232 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27233 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27234 XSAVES instruction set support.
27235
27236 @item bonnell
27237 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27238 instruction set support.
27239
27240 @item silvermont
27241 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27242 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27243
27244 @item goldmont
27245 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27246 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27247 instruction set support.
27248
27249 @item goldmont-plus
27250 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27251 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27252 PTWRITE, RDPID, SGX and UMIP instruction set support.
27253
27254 @item tremont
27255 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27256 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27257 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27258
27259 @item knl
27260 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27261 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27262 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27263 AVX512CD instruction set support.
27264
27265 @item knm
27266 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27267 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27268 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27269 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27270
27271 @item skylake-avx512
27272 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27273 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27274 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27275 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27276
27277 @item cannonlake
27278 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27279 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27280 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27281 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27282 AVX512IFMA, SHA and UMIP instruction set support.
27283
27284 @item icelake-client
27285 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27286 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27287 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27288 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27289 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27290 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27291
27292 @item icelake-server
27293 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27294 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27295 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27296 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27297 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27298 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27299 set support.
27300
27301 @item cascadelake
27302 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27303 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27304 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27305 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27306
27307 @item k6
27308 AMD K6 CPU with MMX instruction set support.
27309
27310 @item k6-2
27311 @itemx k6-3
27312 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27313
27314 @item athlon
27315 @itemx athlon-tbird
27316 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27317 support.
27318
27319 @item athlon-4
27320 @itemx athlon-xp
27321 @itemx athlon-mp
27322 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27323 instruction set support.
27324
27325 @item k8
27326 @itemx opteron
27327 @itemx athlon64
27328 @itemx athlon-fx
27329 Processors based on the AMD K8 core with x86-64 instruction set support,
27330 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27331 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27332 instruction set extensions.)
27333
27334 @item k8-sse3
27335 @itemx opteron-sse3
27336 @itemx athlon64-sse3
27337 Improved versions of AMD K8 cores with SSE3 instruction set support.
27338
27339 @item amdfam10
27340 @itemx barcelona
27341 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27342 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27343 instruction set extensions.)
27344
27345 @item bdver1
27346 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27347 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27348 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27349 @item bdver2
27350 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27351 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27352 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27353 extensions.)
27354 @item bdver3
27355 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27356 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27357 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27358 64-bit instruction set extensions.
27359 @item bdver4
27360 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27361 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27362 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27363 SSE4.2, ABM and 64-bit instruction set extensions.
27364
27365 @item znver1
27366 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27367 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27368 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27369 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27370 instruction set extensions.
27371 @item znver2
27372 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27373 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27374 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27375 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27376 instruction set extensions.)
27377
27378
27379 @item btver1
27380 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27381 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27382 instruction set extensions.)
27383
27384 @item btver2
27385 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27386 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27387 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27388
27389 @item winchip-c6
27390 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27391 set support.
27392
27393 @item winchip2
27394 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27395 instruction set support.
27396
27397 @item c3
27398 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27399 (No scheduling is implemented for this chip.)
27400
27401 @item c3-2
27402 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27403 (No scheduling is implemented for this chip.)
27404
27405 @item c7
27406 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27407 (No scheduling is implemented for this chip.)
27408
27409 @item samuel-2
27410 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27411 (No scheduling is implemented for this chip.)
27412
27413 @item nehemiah
27414 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27415 (No scheduling is implemented for this chip.)
27416
27417 @item esther
27418 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27419 (No scheduling is implemented for this chip.)
27420
27421 @item eden-x2
27422 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27423 (No scheduling is implemented for this chip.)
27424
27425 @item eden-x4
27426 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27427 AVX and AVX2 instruction set support.
27428 (No scheduling is implemented for this chip.)
27429
27430 @item nano
27431 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27432 instruction set support.
27433 (No scheduling is implemented for this chip.)
27434
27435 @item nano-1000
27436 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27437 instruction set support.
27438 (No scheduling is implemented for this chip.)
27439
27440 @item nano-2000
27441 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27442 instruction set support.
27443 (No scheduling is implemented for this chip.)
27444
27445 @item nano-3000
27446 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27447 instruction set support.
27448 (No scheduling is implemented for this chip.)
27449
27450 @item nano-x2
27451 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27452 instruction set support.
27453 (No scheduling is implemented for this chip.)
27454
27455 @item nano-x4
27456 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27457 instruction set support.
27458 (No scheduling is implemented for this chip.)
27459
27460 @item geode
27461 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27462 @end table
27463
27464 @item -mtune=@var{cpu-type}
27465 @opindex mtune
27466 Tune to @var{cpu-type} everything applicable about the generated code, except
27467 for the ABI and the set of available instructions.
27468 While picking a specific @var{cpu-type} schedules things appropriately
27469 for that particular chip, the compiler does not generate any code that
27470 cannot run on the default machine type unless you use a
27471 @option{-march=@var{cpu-type}} option.
27472 For example, if GCC is configured for i686-pc-linux-gnu
27473 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27474 but still runs on i686 machines.
27475
27476 The choices for @var{cpu-type} are the same as for @option{-march}.
27477 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27478
27479 @table @samp
27480 @item generic
27481 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27482 If you know the CPU on which your code will run, then you should use
27483 the corresponding @option{-mtune} or @option{-march} option instead of
27484 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27485 of your application will have, then you should use this option.
27486
27487 As new processors are deployed in the marketplace, the behavior of this
27488 option will change. Therefore, if you upgrade to a newer version of
27489 GCC, code generation controlled by this option will change to reflect
27490 the processors
27491 that are most common at the time that version of GCC is released.
27492
27493 There is no @option{-march=generic} option because @option{-march}
27494 indicates the instruction set the compiler can use, and there is no
27495 generic instruction set applicable to all processors. In contrast,
27496 @option{-mtune} indicates the processor (or, in this case, collection of
27497 processors) for which the code is optimized.
27498
27499 @item intel
27500 Produce code optimized for the most current Intel processors, which are
27501 Haswell and Silvermont for this version of GCC. If you know the CPU
27502 on which your code will run, then you should use the corresponding
27503 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27504 But, if you want your application performs better on both Haswell and
27505 Silvermont, then you should use this option.
27506
27507 As new Intel processors are deployed in the marketplace, the behavior of
27508 this option will change. Therefore, if you upgrade to a newer version of
27509 GCC, code generation controlled by this option will change to reflect
27510 the most current Intel processors at the time that version of GCC is
27511 released.
27512
27513 There is no @option{-march=intel} option because @option{-march} indicates
27514 the instruction set the compiler can use, and there is no common
27515 instruction set applicable to all processors. In contrast,
27516 @option{-mtune} indicates the processor (or, in this case, collection of
27517 processors) for which the code is optimized.
27518 @end table
27519
27520 @item -mcpu=@var{cpu-type}
27521 @opindex mcpu
27522 A deprecated synonym for @option{-mtune}.
27523
27524 @item -mfpmath=@var{unit}
27525 @opindex mfpmath
27526 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27527 for @var{unit} are:
27528
27529 @table @samp
27530 @item 387
27531 Use the standard 387 floating-point coprocessor present on the majority of chips and
27532 emulated otherwise. Code compiled with this option runs almost everywhere.
27533 The temporary results are computed in 80-bit precision instead of the precision
27534 specified by the type, resulting in slightly different results compared to most
27535 of other chips. See @option{-ffloat-store} for more detailed description.
27536
27537 This is the default choice for non-Darwin x86-32 targets.
27538
27539 @item sse
27540 Use scalar floating-point instructions present in the SSE instruction set.
27541 This instruction set is supported by Pentium III and newer chips,
27542 and in the AMD line
27543 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27544 instruction set supports only single-precision arithmetic, thus the double and
27545 extended-precision arithmetic are still done using 387. A later version, present
27546 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27547 arithmetic too.
27548
27549 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27550 or @option{-msse2} switches to enable SSE extensions and make this option
27551 effective. For the x86-64 compiler, these extensions are enabled by default.
27552
27553 The resulting code should be considerably faster in the majority of cases and avoid
27554 the numerical instability problems of 387 code, but may break some existing
27555 code that expects temporaries to be 80 bits.
27556
27557 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27558 and the default choice for x86-32 targets with the SSE2 instruction set
27559 when @option{-ffast-math} is enabled.
27560
27561 @item sse,387
27562 @itemx sse+387
27563 @itemx both
27564 Attempt to utilize both instruction sets at once. This effectively doubles the
27565 amount of available registers, and on chips with separate execution units for
27566 387 and SSE the execution resources too. Use this option with care, as it is
27567 still experimental, because the GCC register allocator does not model separate
27568 functional units well, resulting in unstable performance.
27569 @end table
27570
27571 @item -masm=@var{dialect}
27572 @opindex masm=@var{dialect}
27573 Output assembly instructions using selected @var{dialect}. Also affects
27574 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27575 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27576 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27577 not support @samp{intel}.
27578
27579 @item -mieee-fp
27580 @itemx -mno-ieee-fp
27581 @opindex mieee-fp
27582 @opindex mno-ieee-fp
27583 Control whether or not the compiler uses IEEE floating-point
27584 comparisons. These correctly handle the case where the result of a
27585 comparison is unordered.
27586
27587 @item -m80387
27588 @itemx -mhard-float
27589 @opindex 80387
27590 @opindex mhard-float
27591 Generate output containing 80387 instructions for floating point.
27592
27593 @item -mno-80387
27594 @itemx -msoft-float
27595 @opindex no-80387
27596 @opindex msoft-float
27597 Generate output containing library calls for floating point.
27598
27599 @strong{Warning:} the requisite libraries are not part of GCC@.
27600 Normally the facilities of the machine's usual C compiler are used, but
27601 this cannot be done directly in cross-compilation. You must make your
27602 own arrangements to provide suitable library functions for
27603 cross-compilation.
27604
27605 On machines where a function returns floating-point results in the 80387
27606 register stack, some floating-point opcodes may be emitted even if
27607 @option{-msoft-float} is used.
27608
27609 @item -mno-fp-ret-in-387
27610 @opindex mno-fp-ret-in-387
27611 @opindex mfp-ret-in-387
27612 Do not use the FPU registers for return values of functions.
27613
27614 The usual calling convention has functions return values of types
27615 @code{float} and @code{double} in an FPU register, even if there
27616 is no FPU@. The idea is that the operating system should emulate
27617 an FPU@.
27618
27619 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27620 in ordinary CPU registers instead.
27621
27622 @item -mno-fancy-math-387
27623 @opindex mno-fancy-math-387
27624 @opindex mfancy-math-387
27625 Some 387 emulators do not support the @code{sin}, @code{cos} and
27626 @code{sqrt} instructions for the 387. Specify this option to avoid
27627 generating those instructions.
27628 This option is overridden when @option{-march}
27629 indicates that the target CPU always has an FPU and so the
27630 instruction does not need emulation. These
27631 instructions are not generated unless you also use the
27632 @option{-funsafe-math-optimizations} switch.
27633
27634 @item -malign-double
27635 @itemx -mno-align-double
27636 @opindex malign-double
27637 @opindex mno-align-double
27638 Control whether GCC aligns @code{double}, @code{long double}, and
27639 @code{long long} variables on a two-word boundary or a one-word
27640 boundary. Aligning @code{double} variables on a two-word boundary
27641 produces code that runs somewhat faster on a Pentium at the
27642 expense of more memory.
27643
27644 On x86-64, @option{-malign-double} is enabled by default.
27645
27646 @strong{Warning:} if you use the @option{-malign-double} switch,
27647 structures containing the above types are aligned differently than
27648 the published application binary interface specifications for the x86-32
27649 and are not binary compatible with structures in code compiled
27650 without that switch.
27651
27652 @item -m96bit-long-double
27653 @itemx -m128bit-long-double
27654 @opindex m96bit-long-double
27655 @opindex m128bit-long-double
27656 These switches control the size of @code{long double} type. The x86-32
27657 application binary interface specifies the size to be 96 bits,
27658 so @option{-m96bit-long-double} is the default in 32-bit mode.
27659
27660 Modern architectures (Pentium and newer) prefer @code{long double}
27661 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27662 conforming to the ABI, this is not possible. So specifying
27663 @option{-m128bit-long-double} aligns @code{long double}
27664 to a 16-byte boundary by padding the @code{long double} with an additional
27665 32-bit zero.
27666
27667 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27668 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27669
27670 Notice that neither of these options enable any extra precision over the x87
27671 standard of 80 bits for a @code{long double}.
27672
27673 @strong{Warning:} if you override the default value for your target ABI, this
27674 changes the size of
27675 structures and arrays containing @code{long double} variables,
27676 as well as modifying the function calling convention for functions taking
27677 @code{long double}. Hence they are not binary-compatible
27678 with code compiled without that switch.
27679
27680 @item -mlong-double-64
27681 @itemx -mlong-double-80
27682 @itemx -mlong-double-128
27683 @opindex mlong-double-64
27684 @opindex mlong-double-80
27685 @opindex mlong-double-128
27686 These switches control the size of @code{long double} type. A size
27687 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27688 type. This is the default for 32-bit Bionic C library. A size
27689 of 128 bits makes the @code{long double} type equivalent to the
27690 @code{__float128} type. This is the default for 64-bit Bionic C library.
27691
27692 @strong{Warning:} if you override the default value for your target ABI, this
27693 changes the size of
27694 structures and arrays containing @code{long double} variables,
27695 as well as modifying the function calling convention for functions taking
27696 @code{long double}. Hence they are not binary-compatible
27697 with code compiled without that switch.
27698
27699 @item -malign-data=@var{type}
27700 @opindex malign-data
27701 Control how GCC aligns variables. Supported values for @var{type} are
27702 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27703 and earlier, @samp{abi} uses alignment value as specified by the
27704 psABI, and @samp{cacheline} uses increased alignment value to match
27705 the cache line size. @samp{compat} is the default.
27706
27707 @item -mlarge-data-threshold=@var{threshold}
27708 @opindex mlarge-data-threshold
27709 When @option{-mcmodel=medium} is specified, data objects larger than
27710 @var{threshold} are placed in the large data section. This value must be the
27711 same across all objects linked into the binary, and defaults to 65535.
27712
27713 @item -mrtd
27714 @opindex mrtd
27715 Use a different function-calling convention, in which functions that
27716 take a fixed number of arguments return with the @code{ret @var{num}}
27717 instruction, which pops their arguments while returning. This saves one
27718 instruction in the caller since there is no need to pop the arguments
27719 there.
27720
27721 You can specify that an individual function is called with this calling
27722 sequence with the function attribute @code{stdcall}. You can also
27723 override the @option{-mrtd} option by using the function attribute
27724 @code{cdecl}. @xref{Function Attributes}.
27725
27726 @strong{Warning:} this calling convention is incompatible with the one
27727 normally used on Unix, so you cannot use it if you need to call
27728 libraries compiled with the Unix compiler.
27729
27730 Also, you must provide function prototypes for all functions that
27731 take variable numbers of arguments (including @code{printf});
27732 otherwise incorrect code is generated for calls to those
27733 functions.
27734
27735 In addition, seriously incorrect code results if you call a
27736 function with too many arguments. (Normally, extra arguments are
27737 harmlessly ignored.)
27738
27739 @item -mregparm=@var{num}
27740 @opindex mregparm
27741 Control how many registers are used to pass integer arguments. By
27742 default, no registers are used to pass arguments, and at most 3
27743 registers can be used. You can control this behavior for a specific
27744 function by using the function attribute @code{regparm}.
27745 @xref{Function Attributes}.
27746
27747 @strong{Warning:} if you use this switch, and
27748 @var{num} is nonzero, then you must build all modules with the same
27749 value, including any libraries. This includes the system libraries and
27750 startup modules.
27751
27752 @item -msseregparm
27753 @opindex msseregparm
27754 Use SSE register passing conventions for float and double arguments
27755 and return values. You can control this behavior for a specific
27756 function by using the function attribute @code{sseregparm}.
27757 @xref{Function Attributes}.
27758
27759 @strong{Warning:} if you use this switch then you must build all
27760 modules with the same value, including any libraries. This includes
27761 the system libraries and startup modules.
27762
27763 @item -mvect8-ret-in-mem
27764 @opindex mvect8-ret-in-mem
27765 Return 8-byte vectors in memory instead of MMX registers. This is the
27766 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27767 Studio compilers until version 12. Later compiler versions (starting
27768 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27769 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27770 you need to remain compatible with existing code produced by those
27771 previous compiler versions or older versions of GCC@.
27772
27773 @item -mpc32
27774 @itemx -mpc64
27775 @itemx -mpc80
27776 @opindex mpc32
27777 @opindex mpc64
27778 @opindex mpc80
27779
27780 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27781 is specified, the significands of results of floating-point operations are
27782 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27783 significands of results of floating-point operations to 53 bits (double
27784 precision) and @option{-mpc80} rounds the significands of results of
27785 floating-point operations to 64 bits (extended double precision), which is
27786 the default. When this option is used, floating-point operations in higher
27787 precisions are not available to the programmer without setting the FPU
27788 control word explicitly.
27789
27790 Setting the rounding of floating-point operations to less than the default
27791 80 bits can speed some programs by 2% or more. Note that some mathematical
27792 libraries assume that extended-precision (80-bit) floating-point operations
27793 are enabled by default; routines in such libraries could suffer significant
27794 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27795 when this option is used to set the precision to less than extended precision.
27796
27797 @item -mstackrealign
27798 @opindex mstackrealign
27799 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27800 option generates an alternate prologue and epilogue that realigns the
27801 run-time stack if necessary. This supports mixing legacy codes that keep
27802 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27803 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27804 applicable to individual functions.
27805
27806 @item -mpreferred-stack-boundary=@var{num}
27807 @opindex mpreferred-stack-boundary
27808 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27809 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27810 the default is 4 (16 bytes or 128 bits).
27811
27812 @strong{Warning:} When generating code for the x86-64 architecture with
27813 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27814 used to keep the stack boundary aligned to 8 byte boundary. Since
27815 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27816 intended to be used in controlled environment where stack space is
27817 important limitation. This option leads to wrong code when functions
27818 compiled with 16 byte stack alignment (such as functions from a standard
27819 library) are called with misaligned stack. In this case, SSE
27820 instructions may lead to misaligned memory access traps. In addition,
27821 variable arguments are handled incorrectly for 16 byte aligned
27822 objects (including x87 long double and __int128), leading to wrong
27823 results. You must build all modules with
27824 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27825 includes the system libraries and startup modules.
27826
27827 @item -mincoming-stack-boundary=@var{num}
27828 @opindex mincoming-stack-boundary
27829 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27830 boundary. If @option{-mincoming-stack-boundary} is not specified,
27831 the one specified by @option{-mpreferred-stack-boundary} is used.
27832
27833 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27834 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27835 suffer significant run time performance penalties. On Pentium III, the
27836 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27837 properly if it is not 16-byte aligned.
27838
27839 To ensure proper alignment of this values on the stack, the stack boundary
27840 must be as aligned as that required by any value stored on the stack.
27841 Further, every function must be generated such that it keeps the stack
27842 aligned. Thus calling a function compiled with a higher preferred
27843 stack boundary from a function compiled with a lower preferred stack
27844 boundary most likely misaligns the stack. It is recommended that
27845 libraries that use callbacks always use the default setting.
27846
27847 This extra alignment does consume extra stack space, and generally
27848 increases code size. Code that is sensitive to stack space usage, such
27849 as embedded systems and operating system kernels, may want to reduce the
27850 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27851
27852 @need 200
27853 @item -mmmx
27854 @opindex mmmx
27855 @need 200
27856 @itemx -msse
27857 @opindex msse
27858 @need 200
27859 @itemx -msse2
27860 @opindex msse2
27861 @need 200
27862 @itemx -msse3
27863 @opindex msse3
27864 @need 200
27865 @itemx -mssse3
27866 @opindex mssse3
27867 @need 200
27868 @itemx -msse4
27869 @opindex msse4
27870 @need 200
27871 @itemx -msse4a
27872 @opindex msse4a
27873 @need 200
27874 @itemx -msse4.1
27875 @opindex msse4.1
27876 @need 200
27877 @itemx -msse4.2
27878 @opindex msse4.2
27879 @need 200
27880 @itemx -mavx
27881 @opindex mavx
27882 @need 200
27883 @itemx -mavx2
27884 @opindex mavx2
27885 @need 200
27886 @itemx -mavx512f
27887 @opindex mavx512f
27888 @need 200
27889 @itemx -mavx512pf
27890 @opindex mavx512pf
27891 @need 200
27892 @itemx -mavx512er
27893 @opindex mavx512er
27894 @need 200
27895 @itemx -mavx512cd
27896 @opindex mavx512cd
27897 @need 200
27898 @itemx -mavx512vl
27899 @opindex mavx512vl
27900 @need 200
27901 @itemx -mavx512bw
27902 @opindex mavx512bw
27903 @need 200
27904 @itemx -mavx512dq
27905 @opindex mavx512dq
27906 @need 200
27907 @itemx -mavx512ifma
27908 @opindex mavx512ifma
27909 @need 200
27910 @itemx -mavx512vbmi
27911 @opindex mavx512vbmi
27912 @need 200
27913 @itemx -msha
27914 @opindex msha
27915 @need 200
27916 @itemx -maes
27917 @opindex maes
27918 @need 200
27919 @itemx -mpclmul
27920 @opindex mpclmul
27921 @need 200
27922 @itemx -mclflushopt
27923 @opindex mclflushopt
27924 @need 200
27925 @itemx -mclwb
27926 @opindex mclwb
27927 @need 200
27928 @itemx -mfsgsbase
27929 @opindex mfsgsbase
27930 @need 200
27931 @itemx -mptwrite
27932 @opindex mptwrite
27933 @need 200
27934 @itemx -mrdrnd
27935 @opindex mrdrnd
27936 @need 200
27937 @itemx -mf16c
27938 @opindex mf16c
27939 @need 200
27940 @itemx -mfma
27941 @opindex mfma
27942 @need 200
27943 @itemx -mpconfig
27944 @opindex mpconfig
27945 @need 200
27946 @itemx -mwbnoinvd
27947 @opindex mwbnoinvd
27948 @need 200
27949 @itemx -mfma4
27950 @opindex mfma4
27951 @need 200
27952 @itemx -mprfchw
27953 @opindex mprfchw
27954 @need 200
27955 @itemx -mrdpid
27956 @opindex mrdpid
27957 @need 200
27958 @itemx -mprefetchwt1
27959 @opindex mprefetchwt1
27960 @need 200
27961 @itemx -mrdseed
27962 @opindex mrdseed
27963 @need 200
27964 @itemx -msgx
27965 @opindex msgx
27966 @need 200
27967 @itemx -mxop
27968 @opindex mxop
27969 @need 200
27970 @itemx -mlwp
27971 @opindex mlwp
27972 @need 200
27973 @itemx -m3dnow
27974 @opindex m3dnow
27975 @need 200
27976 @itemx -m3dnowa
27977 @opindex m3dnowa
27978 @need 200
27979 @itemx -mpopcnt
27980 @opindex mpopcnt
27981 @need 200
27982 @itemx -mabm
27983 @opindex mabm
27984 @need 200
27985 @itemx -madx
27986 @opindex madx
27987 @need 200
27988 @itemx -mbmi
27989 @opindex mbmi
27990 @need 200
27991 @itemx -mbmi2
27992 @opindex mbmi2
27993 @need 200
27994 @itemx -mlzcnt
27995 @opindex mlzcnt
27996 @need 200
27997 @itemx -mfxsr
27998 @opindex mfxsr
27999 @need 200
28000 @itemx -mxsave
28001 @opindex mxsave
28002 @need 200
28003 @itemx -mxsaveopt
28004 @opindex mxsaveopt
28005 @need 200
28006 @itemx -mxsavec
28007 @opindex mxsavec
28008 @need 200
28009 @itemx -mxsaves
28010 @opindex mxsaves
28011 @need 200
28012 @itemx -mrtm
28013 @opindex mrtm
28014 @need 200
28015 @itemx -mhle
28016 @opindex mhle
28017 @need 200
28018 @itemx -mtbm
28019 @opindex mtbm
28020 @need 200
28021 @itemx -mmwaitx
28022 @opindex mmwaitx
28023 @need 200
28024 @itemx -mclzero
28025 @opindex mclzero
28026 @need 200
28027 @itemx -mpku
28028 @opindex mpku
28029 @need 200
28030 @itemx -mavx512vbmi2
28031 @opindex mavx512vbmi2
28032 @need 200
28033 @itemx -mgfni
28034 @opindex mgfni
28035 @need 200
28036 @itemx -mvaes
28037 @opindex mvaes
28038 @need 200
28039 @itemx -mwaitpkg
28040 @opindex mwaitpkg
28041 @need 200
28042 @itemx -mvpclmulqdq
28043 @opindex mvpclmulqdq
28044 @need 200
28045 @itemx -mavx512bitalg
28046 @opindex mavx512bitalg
28047 @need 200
28048 @itemx -mmovdiri
28049 @opindex mmovdiri
28050 @need 200
28051 @itemx -mmovdir64b
28052 @opindex mmovdir64b
28053 @need 200
28054 @itemx -mavx512vpopcntdq
28055 @opindex mavx512vpopcntdq
28056 @need 200
28057 @itemx -mavx5124fmaps
28058 @opindex mavx5124fmaps
28059 @need 200
28060 @itemx -mavx512vnni
28061 @opindex mavx512vnni
28062 @need 200
28063 @itemx -mavx5124vnniw
28064 @opindex mavx5124vnniw
28065 @need 200
28066 @itemx -mcldemote
28067 @opindex mcldemote
28068 These switches enable the use of instructions in the MMX, SSE,
28069 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28070 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28071 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28072 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28073 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28074 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28075 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28076 AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28077 extended instruction sets. Each has a corresponding @option{-mno-} option to
28078 disable use of these instructions.
28079
28080 These extensions are also available as built-in functions: see
28081 @ref{x86 Built-in Functions}, for details of the functions enabled and
28082 disabled by these switches.
28083
28084 To generate SSE/SSE2 instructions automatically from floating-point
28085 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28086
28087 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28088 generates new AVX instructions or AVX equivalence for all SSEx instructions
28089 when needed.
28090
28091 These options enable GCC to use these extended instructions in
28092 generated code, even without @option{-mfpmath=sse}. Applications that
28093 perform run-time CPU detection must compile separate files for each
28094 supported architecture, using the appropriate flags. In particular,
28095 the file containing the CPU detection code should be compiled without
28096 these options.
28097
28098 @item -mdump-tune-features
28099 @opindex mdump-tune-features
28100 This option instructs GCC to dump the names of the x86 performance
28101 tuning features and default settings. The names can be used in
28102 @option{-mtune-ctrl=@var{feature-list}}.
28103
28104 @item -mtune-ctrl=@var{feature-list}
28105 @opindex mtune-ctrl=@var{feature-list}
28106 This option is used to do fine grain control of x86 code generation features.
28107 @var{feature-list} is a comma separated list of @var{feature} names. See also
28108 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28109 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28110 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28111 developers. Using it may lead to code paths not covered by testing and can
28112 potentially result in compiler ICEs or runtime errors.
28113
28114 @item -mno-default
28115 @opindex mno-default
28116 This option instructs GCC to turn off all tunable features. See also
28117 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28118
28119 @item -mcld
28120 @opindex mcld
28121 This option instructs GCC to emit a @code{cld} instruction in the prologue
28122 of functions that use string instructions. String instructions depend on
28123 the DF flag to select between autoincrement or autodecrement mode. While the
28124 ABI specifies the DF flag to be cleared on function entry, some operating
28125 systems violate this specification by not clearing the DF flag in their
28126 exception dispatchers. The exception handler can be invoked with the DF flag
28127 set, which leads to wrong direction mode when string instructions are used.
28128 This option can be enabled by default on 32-bit x86 targets by configuring
28129 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28130 instructions can be suppressed with the @option{-mno-cld} compiler option
28131 in this case.
28132
28133 @item -mvzeroupper
28134 @opindex mvzeroupper
28135 This option instructs GCC to emit a @code{vzeroupper} instruction
28136 before a transfer of control flow out of the function to minimize
28137 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28138 intrinsics.
28139
28140 @item -mprefer-avx128
28141 @opindex mprefer-avx128
28142 This option instructs GCC to use 128-bit AVX instructions instead of
28143 256-bit AVX instructions in the auto-vectorizer.
28144
28145 @item -mprefer-vector-width=@var{opt}
28146 @opindex mprefer-vector-width
28147 This option instructs GCC to use @var{opt}-bit vector width in instructions
28148 instead of default on the selected platform.
28149
28150 @table @samp
28151 @item none
28152 No extra limitations applied to GCC other than defined by the selected platform.
28153
28154 @item 128
28155 Prefer 128-bit vector width for instructions.
28156
28157 @item 256
28158 Prefer 256-bit vector width for instructions.
28159
28160 @item 512
28161 Prefer 512-bit vector width for instructions.
28162 @end table
28163
28164 @item -mcx16
28165 @opindex mcx16
28166 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28167 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28168 objects. This is useful for atomic updates of data structures exceeding one
28169 machine word in size. The compiler uses this instruction to implement
28170 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28171 128-bit integers, a library call is always used.
28172
28173 @item -msahf
28174 @opindex msahf
28175 This option enables generation of @code{SAHF} instructions in 64-bit code.
28176 Early Intel Pentium 4 CPUs with Intel 64 support,
28177 prior to the introduction of Pentium 4 G1 step in December 2005,
28178 lacked the @code{LAHF} and @code{SAHF} instructions
28179 which are supported by AMD64.
28180 These are load and store instructions, respectively, for certain status flags.
28181 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28182 @code{drem}, and @code{remainder} built-in functions;
28183 see @ref{Other Builtins} for details.
28184
28185 @item -mmovbe
28186 @opindex mmovbe
28187 This option enables use of the @code{movbe} instruction to implement
28188 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28189
28190 @item -mshstk
28191 @opindex mshstk
28192 The @option{-mshstk} option enables shadow stack built-in functions
28193 from x86 Control-flow Enforcement Technology (CET).
28194
28195 @item -mcrc32
28196 @opindex mcrc32
28197 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28198 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28199 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28200
28201 @item -mrecip
28202 @opindex mrecip
28203 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28204 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28205 with an additional Newton-Raphson step
28206 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28207 (and their vectorized
28208 variants) for single-precision floating-point arguments. These instructions
28209 are generated only when @option{-funsafe-math-optimizations} is enabled
28210 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28211 Note that while the throughput of the sequence is higher than the throughput
28212 of the non-reciprocal instruction, the precision of the sequence can be
28213 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28214
28215 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28216 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28217 combination), and doesn't need @option{-mrecip}.
28218
28219 Also note that GCC emits the above sequence with additional Newton-Raphson step
28220 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28221 already with @option{-ffast-math} (or the above option combination), and
28222 doesn't need @option{-mrecip}.
28223
28224 @item -mrecip=@var{opt}
28225 @opindex mrecip=opt
28226 This option controls which reciprocal estimate instructions
28227 may be used. @var{opt} is a comma-separated list of options, which may
28228 be preceded by a @samp{!} to invert the option:
28229
28230 @table @samp
28231 @item all
28232 Enable all estimate instructions.
28233
28234 @item default
28235 Enable the default instructions, equivalent to @option{-mrecip}.
28236
28237 @item none
28238 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28239
28240 @item div
28241 Enable the approximation for scalar division.
28242
28243 @item vec-div
28244 Enable the approximation for vectorized division.
28245
28246 @item sqrt
28247 Enable the approximation for scalar square root.
28248
28249 @item vec-sqrt
28250 Enable the approximation for vectorized square root.
28251 @end table
28252
28253 So, for example, @option{-mrecip=all,!sqrt} enables
28254 all of the reciprocal approximations, except for square root.
28255
28256 @item -mveclibabi=@var{type}
28257 @opindex mveclibabi
28258 Specifies the ABI type to use for vectorizing intrinsics using an
28259 external library. Supported values for @var{type} are @samp{svml}
28260 for the Intel short
28261 vector math library and @samp{acml} for the AMD math core library.
28262 To use this option, both @option{-ftree-vectorize} and
28263 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28264 ABI-compatible library must be specified at link time.
28265
28266 GCC currently emits calls to @code{vmldExp2},
28267 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28268 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28269 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28270 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28271 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28272 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28273 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28274 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28275 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28276 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28277 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28278 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28279 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28280 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28281 when @option{-mveclibabi=acml} is used.
28282
28283 @item -mabi=@var{name}
28284 @opindex mabi
28285 Generate code for the specified calling convention. Permissible values
28286 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28287 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28288 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28289 You can control this behavior for specific functions by
28290 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28291 @xref{Function Attributes}.
28292
28293 @item -mforce-indirect-call
28294 @opindex mforce-indirect-call
28295 Force all calls to functions to be indirect. This is useful
28296 when using Intel Processor Trace where it generates more precise timing
28297 information for function calls.
28298
28299 @item -mmanual-endbr
28300 @opindex mmanual-endbr
28301 Insert ENDBR instruction at function entry only via the @code{cf_check}
28302 function attribute. This is useful when used with the option
28303 @option{-fcf-protection=branch} to control ENDBR insertion at the
28304 function entry.
28305
28306 @item -mcall-ms2sysv-xlogues
28307 @opindex mcall-ms2sysv-xlogues
28308 @opindex mno-call-ms2sysv-xlogues
28309 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28310 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28311 default, the code for saving and restoring these registers is emitted inline,
28312 resulting in fairly lengthy prologues and epilogues. Using
28313 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28314 use stubs in the static portion of libgcc to perform these saves and restores,
28315 thus reducing function size at the cost of a few extra instructions.
28316
28317 @item -mtls-dialect=@var{type}
28318 @opindex mtls-dialect
28319 Generate code to access thread-local storage using the @samp{gnu} or
28320 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28321 @samp{gnu2} is more efficient, but it may add compile- and run-time
28322 requirements that cannot be satisfied on all systems.
28323
28324 @item -mpush-args
28325 @itemx -mno-push-args
28326 @opindex mpush-args
28327 @opindex mno-push-args
28328 Use PUSH operations to store outgoing parameters. This method is shorter
28329 and usually equally fast as method using SUB/MOV operations and is enabled
28330 by default. In some cases disabling it may improve performance because of
28331 improved scheduling and reduced dependencies.
28332
28333 @item -maccumulate-outgoing-args
28334 @opindex maccumulate-outgoing-args
28335 If enabled, the maximum amount of space required for outgoing arguments is
28336 computed in the function prologue. This is faster on most modern CPUs
28337 because of reduced dependencies, improved scheduling and reduced stack usage
28338 when the preferred stack boundary is not equal to 2. The drawback is a notable
28339 increase in code size. This switch implies @option{-mno-push-args}.
28340
28341 @item -mthreads
28342 @opindex mthreads
28343 Support thread-safe exception handling on MinGW. Programs that rely
28344 on thread-safe exception handling must compile and link all code with the
28345 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28346 @option{-D_MT}; when linking, it links in a special thread helper library
28347 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28348
28349 @item -mms-bitfields
28350 @itemx -mno-ms-bitfields
28351 @opindex mms-bitfields
28352 @opindex mno-ms-bitfields
28353
28354 Enable/disable bit-field layout compatible with the native Microsoft
28355 Windows compiler.
28356
28357 If @code{packed} is used on a structure, or if bit-fields are used,
28358 it may be that the Microsoft ABI lays out the structure differently
28359 than the way GCC normally does. Particularly when moving packed
28360 data between functions compiled with GCC and the native Microsoft compiler
28361 (either via function call or as data in a file), it may be necessary to access
28362 either format.
28363
28364 This option is enabled by default for Microsoft Windows
28365 targets. This behavior can also be controlled locally by use of variable
28366 or type attributes. For more information, see @ref{x86 Variable Attributes}
28367 and @ref{x86 Type Attributes}.
28368
28369 The Microsoft structure layout algorithm is fairly simple with the exception
28370 of the bit-field packing.
28371 The padding and alignment of members of structures and whether a bit-field
28372 can straddle a storage-unit boundary are determine by these rules:
28373
28374 @enumerate
28375 @item Structure members are stored sequentially in the order in which they are
28376 declared: the first member has the lowest memory address and the last member
28377 the highest.
28378
28379 @item Every data object has an alignment requirement. The alignment requirement
28380 for all data except structures, unions, and arrays is either the size of the
28381 object or the current packing size (specified with either the
28382 @code{aligned} attribute or the @code{pack} pragma),
28383 whichever is less. For structures, unions, and arrays,
28384 the alignment requirement is the largest alignment requirement of its members.
28385 Every object is allocated an offset so that:
28386
28387 @smallexample
28388 offset % alignment_requirement == 0
28389 @end smallexample
28390
28391 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28392 unit if the integral types are the same size and if the next bit-field fits
28393 into the current allocation unit without crossing the boundary imposed by the
28394 common alignment requirements of the bit-fields.
28395 @end enumerate
28396
28397 MSVC interprets zero-length bit-fields in the following ways:
28398
28399 @enumerate
28400 @item If a zero-length bit-field is inserted between two bit-fields that
28401 are normally coalesced, the bit-fields are not coalesced.
28402
28403 For example:
28404
28405 @smallexample
28406 struct
28407 @{
28408 unsigned long bf_1 : 12;
28409 unsigned long : 0;
28410 unsigned long bf_2 : 12;
28411 @} t1;
28412 @end smallexample
28413
28414 @noindent
28415 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28416 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28417
28418 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28419 alignment of the zero-length bit-field is greater than the member that follows it,
28420 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28421
28422 For example:
28423
28424 @smallexample
28425 struct
28426 @{
28427 char foo : 4;
28428 short : 0;
28429 char bar;
28430 @} t2;
28431
28432 struct
28433 @{
28434 char foo : 4;
28435 short : 0;
28436 double bar;
28437 @} t3;
28438 @end smallexample
28439
28440 @noindent
28441 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28442 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28443 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28444 of the structure.
28445
28446 Taking this into account, it is important to note the following:
28447
28448 @enumerate
28449 @item If a zero-length bit-field follows a normal bit-field, the type of the
28450 zero-length bit-field may affect the alignment of the structure as whole. For
28451 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28452 normal bit-field, and is of type short.
28453
28454 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28455 still affect the alignment of the structure:
28456
28457 @smallexample
28458 struct
28459 @{
28460 char foo : 6;
28461 long : 0;
28462 @} t4;
28463 @end smallexample
28464
28465 @noindent
28466 Here, @code{t4} takes up 4 bytes.
28467 @end enumerate
28468
28469 @item Zero-length bit-fields following non-bit-field members are ignored:
28470
28471 @smallexample
28472 struct
28473 @{
28474 char foo;
28475 long : 0;
28476 char bar;
28477 @} t5;
28478 @end smallexample
28479
28480 @noindent
28481 Here, @code{t5} takes up 2 bytes.
28482 @end enumerate
28483
28484
28485 @item -mno-align-stringops
28486 @opindex mno-align-stringops
28487 @opindex malign-stringops
28488 Do not align the destination of inlined string operations. This switch reduces
28489 code size and improves performance in case the destination is already aligned,
28490 but GCC doesn't know about it.
28491
28492 @item -minline-all-stringops
28493 @opindex minline-all-stringops
28494 By default GCC inlines string operations only when the destination is
28495 known to be aligned to least a 4-byte boundary.
28496 This enables more inlining and increases code
28497 size, but may improve performance of code that depends on fast
28498 @code{memcpy}, @code{strlen},
28499 and @code{memset} for short lengths.
28500
28501 @item -minline-stringops-dynamically
28502 @opindex minline-stringops-dynamically
28503 For string operations of unknown size, use run-time checks with
28504 inline code for small blocks and a library call for large blocks.
28505
28506 @item -mstringop-strategy=@var{alg}
28507 @opindex mstringop-strategy=@var{alg}
28508 Override the internal decision heuristic for the particular algorithm to use
28509 for inlining string operations. The allowed values for @var{alg} are:
28510
28511 @table @samp
28512 @item rep_byte
28513 @itemx rep_4byte
28514 @itemx rep_8byte
28515 Expand using i386 @code{rep} prefix of the specified size.
28516
28517 @item byte_loop
28518 @itemx loop
28519 @itemx unrolled_loop
28520 Expand into an inline loop.
28521
28522 @item libcall
28523 Always use a library call.
28524 @end table
28525
28526 @item -mmemcpy-strategy=@var{strategy}
28527 @opindex mmemcpy-strategy=@var{strategy}
28528 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28529 should be inlined and what inline algorithm to use when the expected size
28530 of the copy operation is known. @var{strategy}
28531 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28532 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28533 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28534 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28535 in the list must be specified in increasing order. The minimal byte size for
28536 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28537 preceding range.
28538
28539 @item -mmemset-strategy=@var{strategy}
28540 @opindex mmemset-strategy=@var{strategy}
28541 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28542 @code{__builtin_memset} expansion.
28543
28544 @item -momit-leaf-frame-pointer
28545 @opindex momit-leaf-frame-pointer
28546 Don't keep the frame pointer in a register for leaf functions. This
28547 avoids the instructions to save, set up, and restore frame pointers and
28548 makes an extra register available in leaf functions. The option
28549 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28550 which might make debugging harder.
28551
28552 @item -mtls-direct-seg-refs
28553 @itemx -mno-tls-direct-seg-refs
28554 @opindex mtls-direct-seg-refs
28555 Controls whether TLS variables may be accessed with offsets from the
28556 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28557 or whether the thread base pointer must be added. Whether or not this
28558 is valid depends on the operating system, and whether it maps the
28559 segment to cover the entire TLS area.
28560
28561 For systems that use the GNU C Library, the default is on.
28562
28563 @item -msse2avx
28564 @itemx -mno-sse2avx
28565 @opindex msse2avx
28566 Specify that the assembler should encode SSE instructions with VEX
28567 prefix. The option @option{-mavx} turns this on by default.
28568
28569 @item -mfentry
28570 @itemx -mno-fentry
28571 @opindex mfentry
28572 If profiling is active (@option{-pg}), put the profiling
28573 counter call before the prologue.
28574 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28575 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28576
28577 @item -mrecord-mcount
28578 @itemx -mno-record-mcount
28579 @opindex mrecord-mcount
28580 If profiling is active (@option{-pg}), generate a __mcount_loc section
28581 that contains pointers to each profiling call. This is useful for
28582 automatically patching and out calls.
28583
28584 @item -mnop-mcount
28585 @itemx -mno-nop-mcount
28586 @opindex mnop-mcount
28587 If profiling is active (@option{-pg}), generate the calls to
28588 the profiling functions as NOPs. This is useful when they
28589 should be patched in later dynamically. This is likely only
28590 useful together with @option{-mrecord-mcount}.
28591
28592 @item -minstrument-return=@var{type}
28593 @opindex minstrument-return
28594 Instrument function exit in -pg -mfentry instrumented functions with
28595 call to specified function. This only instruments true returns ending
28596 with ret, but not sibling calls ending with jump. Valid types
28597 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28598 or @var{nop5} to generate a 5 byte nop.
28599
28600 @item -mrecord-return
28601 @itemx -mno-record-return
28602 @opindex mrecord-return
28603 Generate a __return_loc section pointing to all return instrumentation code.
28604
28605 @item -mfentry-name=@var{name}
28606 @opindex mfentry-name
28607 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28608
28609 @item -mfentry-section=@var{name}
28610 @opindex mfentry-section
28611 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28612
28613 @item -mskip-rax-setup
28614 @itemx -mno-skip-rax-setup
28615 @opindex mskip-rax-setup
28616 When generating code for the x86-64 architecture with SSE extensions
28617 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28618 register when there are no variable arguments passed in vector registers.
28619
28620 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28621 saving vector registers on stack when passing variable arguments, the
28622 impacts of this option are callees may waste some stack space,
28623 misbehave or jump to a random location. GCC 4.4 or newer don't have
28624 those issues, regardless the RAX register value.
28625
28626 @item -m8bit-idiv
28627 @itemx -mno-8bit-idiv
28628 @opindex m8bit-idiv
28629 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28630 much faster than 32-bit/64-bit integer divide. This option generates a
28631 run-time check. If both dividend and divisor are within range of 0
28632 to 255, 8-bit unsigned integer divide is used instead of
28633 32-bit/64-bit integer divide.
28634
28635 @item -mavx256-split-unaligned-load
28636 @itemx -mavx256-split-unaligned-store
28637 @opindex mavx256-split-unaligned-load
28638 @opindex mavx256-split-unaligned-store
28639 Split 32-byte AVX unaligned load and store.
28640
28641 @item -mstack-protector-guard=@var{guard}
28642 @itemx -mstack-protector-guard-reg=@var{reg}
28643 @itemx -mstack-protector-guard-offset=@var{offset}
28644 @opindex mstack-protector-guard
28645 @opindex mstack-protector-guard-reg
28646 @opindex mstack-protector-guard-offset
28647 Generate stack protection code using canary at @var{guard}. Supported
28648 locations are @samp{global} for global canary or @samp{tls} for per-thread
28649 canary in the TLS block (the default). This option has effect only when
28650 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28651
28652 With the latter choice the options
28653 @option{-mstack-protector-guard-reg=@var{reg}} and
28654 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28655 which segment register (@code{%fs} or @code{%gs}) to use as base register
28656 for reading the canary, and from what offset from that base register.
28657 The default for those is as specified in the relevant ABI.
28658
28659 @item -mgeneral-regs-only
28660 @opindex mgeneral-regs-only
28661 Generate code that uses only the general-purpose registers. This
28662 prevents the compiler from using floating-point, vector, mask and bound
28663 registers.
28664
28665 @item -mindirect-branch=@var{choice}
28666 @opindex mindirect-branch
28667 Convert indirect call and jump with @var{choice}. The default is
28668 @samp{keep}, which keeps indirect call and jump unmodified.
28669 @samp{thunk} converts indirect call and jump to call and return thunk.
28670 @samp{thunk-inline} converts indirect call and jump to inlined call
28671 and return thunk. @samp{thunk-extern} converts indirect call and jump
28672 to external call and return thunk provided in a separate object file.
28673 You can control this behavior for a specific function by using the
28674 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28675
28676 Note that @option{-mcmodel=large} is incompatible with
28677 @option{-mindirect-branch=thunk} and
28678 @option{-mindirect-branch=thunk-extern} since the thunk function may
28679 not be reachable in the large code model.
28680
28681 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28682 @option{-fcf-protection=branch} since the external thunk cannot be modified
28683 to disable control-flow check.
28684
28685 @item -mfunction-return=@var{choice}
28686 @opindex mfunction-return
28687 Convert function return with @var{choice}. The default is @samp{keep},
28688 which keeps function return unmodified. @samp{thunk} converts function
28689 return to call and return thunk. @samp{thunk-inline} converts function
28690 return to inlined call and return thunk. @samp{thunk-extern} converts
28691 function return to external call and return thunk provided in a separate
28692 object file. You can control this behavior for a specific function by
28693 using the function attribute @code{function_return}.
28694 @xref{Function Attributes}.
28695
28696 Note that @option{-mcmodel=large} is incompatible with
28697 @option{-mfunction-return=thunk} and
28698 @option{-mfunction-return=thunk-extern} since the thunk function may
28699 not be reachable in the large code model.
28700
28701
28702 @item -mindirect-branch-register
28703 @opindex mindirect-branch-register
28704 Force indirect call and jump via register.
28705
28706 @end table
28707
28708 These @samp{-m} switches are supported in addition to the above
28709 on x86-64 processors in 64-bit environments.
28710
28711 @table @gcctabopt
28712 @item -m32
28713 @itemx -m64
28714 @itemx -mx32
28715 @itemx -m16
28716 @itemx -miamcu
28717 @opindex m32
28718 @opindex m64
28719 @opindex mx32
28720 @opindex m16
28721 @opindex miamcu
28722 Generate code for a 16-bit, 32-bit or 64-bit environment.
28723 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28724 to 32 bits, and
28725 generates code that runs on any i386 system.
28726
28727 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28728 types to 64 bits, and generates code for the x86-64 architecture.
28729 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28730 and @option{-mdynamic-no-pic} options.
28731
28732 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28733 to 32 bits, and
28734 generates code for the x86-64 architecture.
28735
28736 The @option{-m16} option is the same as @option{-m32}, except for that
28737 it outputs the @code{.code16gcc} assembly directive at the beginning of
28738 the assembly output so that the binary can run in 16-bit mode.
28739
28740 The @option{-miamcu} option generates code which conforms to Intel MCU
28741 psABI. It requires the @option{-m32} option to be turned on.
28742
28743 @item -mno-red-zone
28744 @opindex mno-red-zone
28745 @opindex mred-zone
28746 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28747 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28748 stack pointer that is not modified by signal or interrupt handlers
28749 and therefore can be used for temporary data without adjusting the stack
28750 pointer. The flag @option{-mno-red-zone} disables this red zone.
28751
28752 @item -mcmodel=small
28753 @opindex mcmodel=small
28754 Generate code for the small code model: the program and its symbols must
28755 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28756 Programs can be statically or dynamically linked. This is the default
28757 code model.
28758
28759 @item -mcmodel=kernel
28760 @opindex mcmodel=kernel
28761 Generate code for the kernel code model. The kernel runs in the
28762 negative 2 GB of the address space.
28763 This model has to be used for Linux kernel code.
28764
28765 @item -mcmodel=medium
28766 @opindex mcmodel=medium
28767 Generate code for the medium model: the program is linked in the lower 2
28768 GB of the address space. Small symbols are also placed there. Symbols
28769 with sizes larger than @option{-mlarge-data-threshold} are put into
28770 large data or BSS sections and can be located above 2GB. Programs can
28771 be statically or dynamically linked.
28772
28773 @item -mcmodel=large
28774 @opindex mcmodel=large
28775 Generate code for the large model. This model makes no assumptions
28776 about addresses and sizes of sections.
28777
28778 @item -maddress-mode=long
28779 @opindex maddress-mode=long
28780 Generate code for long address mode. This is only supported for 64-bit
28781 and x32 environments. It is the default address mode for 64-bit
28782 environments.
28783
28784 @item -maddress-mode=short
28785 @opindex maddress-mode=short
28786 Generate code for short address mode. This is only supported for 32-bit
28787 and x32 environments. It is the default address mode for 32-bit and
28788 x32 environments.
28789 @end table
28790
28791 @node x86 Windows Options
28792 @subsection x86 Windows Options
28793 @cindex x86 Windows Options
28794 @cindex Windows Options for x86
28795
28796 These additional options are available for Microsoft Windows targets:
28797
28798 @table @gcctabopt
28799 @item -mconsole
28800 @opindex mconsole
28801 This option
28802 specifies that a console application is to be generated, by
28803 instructing the linker to set the PE header subsystem type
28804 required for console applications.
28805 This option is available for Cygwin and MinGW targets and is
28806 enabled by default on those targets.
28807
28808 @item -mdll
28809 @opindex mdll
28810 This option is available for Cygwin and MinGW targets. It
28811 specifies that a DLL---a dynamic link library---is to be
28812 generated, enabling the selection of the required runtime
28813 startup object and entry point.
28814
28815 @item -mnop-fun-dllimport
28816 @opindex mnop-fun-dllimport
28817 This option is available for Cygwin and MinGW targets. It
28818 specifies that the @code{dllimport} attribute should be ignored.
28819
28820 @item -mthread
28821 @opindex mthread
28822 This option is available for MinGW targets. It specifies
28823 that MinGW-specific thread support is to be used.
28824
28825 @item -municode
28826 @opindex municode
28827 This option is available for MinGW-w64 targets. It causes
28828 the @code{UNICODE} preprocessor macro to be predefined, and
28829 chooses Unicode-capable runtime startup code.
28830
28831 @item -mwin32
28832 @opindex mwin32
28833 This option is available for Cygwin and MinGW targets. It
28834 specifies that the typical Microsoft Windows predefined macros are to
28835 be set in the pre-processor, but does not influence the choice
28836 of runtime library/startup code.
28837
28838 @item -mwindows
28839 @opindex mwindows
28840 This option is available for Cygwin and MinGW targets. It
28841 specifies that a GUI application is to be generated by
28842 instructing the linker to set the PE header subsystem type
28843 appropriately.
28844
28845 @item -fno-set-stack-executable
28846 @opindex fno-set-stack-executable
28847 @opindex fset-stack-executable
28848 This option is available for MinGW targets. It specifies that
28849 the executable flag for the stack used by nested functions isn't
28850 set. This is necessary for binaries running in kernel mode of
28851 Microsoft Windows, as there the User32 API, which is used to set executable
28852 privileges, isn't available.
28853
28854 @item -fwritable-relocated-rdata
28855 @opindex fno-writable-relocated-rdata
28856 @opindex fwritable-relocated-rdata
28857 This option is available for MinGW and Cygwin targets. It specifies
28858 that relocated-data in read-only section is put into the @code{.data}
28859 section. This is a necessary for older runtimes not supporting
28860 modification of @code{.rdata} sections for pseudo-relocation.
28861
28862 @item -mpe-aligned-commons
28863 @opindex mpe-aligned-commons
28864 This option is available for Cygwin and MinGW targets. It
28865 specifies that the GNU extension to the PE file format that
28866 permits the correct alignment of COMMON variables should be
28867 used when generating code. It is enabled by default if
28868 GCC detects that the target assembler found during configuration
28869 supports the feature.
28870 @end table
28871
28872 See also under @ref{x86 Options} for standard options.
28873
28874 @node Xstormy16 Options
28875 @subsection Xstormy16 Options
28876 @cindex Xstormy16 Options
28877
28878 These options are defined for Xstormy16:
28879
28880 @table @gcctabopt
28881 @item -msim
28882 @opindex msim
28883 Choose startup files and linker script suitable for the simulator.
28884 @end table
28885
28886 @node Xtensa Options
28887 @subsection Xtensa Options
28888 @cindex Xtensa Options
28889
28890 These options are supported for Xtensa targets:
28891
28892 @table @gcctabopt
28893 @item -mconst16
28894 @itemx -mno-const16
28895 @opindex mconst16
28896 @opindex mno-const16
28897 Enable or disable use of @code{CONST16} instructions for loading
28898 constant values. The @code{CONST16} instruction is currently not a
28899 standard option from Tensilica. When enabled, @code{CONST16}
28900 instructions are always used in place of the standard @code{L32R}
28901 instructions. The use of @code{CONST16} is enabled by default only if
28902 the @code{L32R} instruction is not available.
28903
28904 @item -mfused-madd
28905 @itemx -mno-fused-madd
28906 @opindex mfused-madd
28907 @opindex mno-fused-madd
28908 Enable or disable use of fused multiply/add and multiply/subtract
28909 instructions in the floating-point option. This has no effect if the
28910 floating-point option is not also enabled. Disabling fused multiply/add
28911 and multiply/subtract instructions forces the compiler to use separate
28912 instructions for the multiply and add/subtract operations. This may be
28913 desirable in some cases where strict IEEE 754-compliant results are
28914 required: the fused multiply add/subtract instructions do not round the
28915 intermediate result, thereby producing results with @emph{more} bits of
28916 precision than specified by the IEEE standard. Disabling fused multiply
28917 add/subtract instructions also ensures that the program output is not
28918 sensitive to the compiler's ability to combine multiply and add/subtract
28919 operations.
28920
28921 @item -mserialize-volatile
28922 @itemx -mno-serialize-volatile
28923 @opindex mserialize-volatile
28924 @opindex mno-serialize-volatile
28925 When this option is enabled, GCC inserts @code{MEMW} instructions before
28926 @code{volatile} memory references to guarantee sequential consistency.
28927 The default is @option{-mserialize-volatile}. Use
28928 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28929
28930 @item -mforce-no-pic
28931 @opindex mforce-no-pic
28932 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28933 position-independent code (PIC), this option disables PIC for compiling
28934 kernel code.
28935
28936 @item -mtext-section-literals
28937 @itemx -mno-text-section-literals
28938 @opindex mtext-section-literals
28939 @opindex mno-text-section-literals
28940 These options control the treatment of literal pools. The default is
28941 @option{-mno-text-section-literals}, which places literals in a separate
28942 section in the output file. This allows the literal pool to be placed
28943 in a data RAM/ROM, and it also allows the linker to combine literal
28944 pools from separate object files to remove redundant literals and
28945 improve code size. With @option{-mtext-section-literals}, the literals
28946 are interspersed in the text section in order to keep them as close as
28947 possible to their references. This may be necessary for large assembly
28948 files. Literals for each function are placed right before that function.
28949
28950 @item -mauto-litpools
28951 @itemx -mno-auto-litpools
28952 @opindex mauto-litpools
28953 @opindex mno-auto-litpools
28954 These options control the treatment of literal pools. The default is
28955 @option{-mno-auto-litpools}, which places literals in a separate
28956 section in the output file unless @option{-mtext-section-literals} is
28957 used. With @option{-mauto-litpools} the literals are interspersed in
28958 the text section by the assembler. Compiler does not produce explicit
28959 @code{.literal} directives and loads literals into registers with
28960 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28961 do relaxation and place literals as necessary. This option allows
28962 assembler to create several literal pools per function and assemble
28963 very big functions, which may not be possible with
28964 @option{-mtext-section-literals}.
28965
28966 @item -mtarget-align
28967 @itemx -mno-target-align
28968 @opindex mtarget-align
28969 @opindex mno-target-align
28970 When this option is enabled, GCC instructs the assembler to
28971 automatically align instructions to reduce branch penalties at the
28972 expense of some code density. The assembler attempts to widen density
28973 instructions to align branch targets and the instructions following call
28974 instructions. If there are not enough preceding safe density
28975 instructions to align a target, no widening is performed. The
28976 default is @option{-mtarget-align}. These options do not affect the
28977 treatment of auto-aligned instructions like @code{LOOP}, which the
28978 assembler always aligns, either by widening density instructions or
28979 by inserting NOP instructions.
28980
28981 @item -mlongcalls
28982 @itemx -mno-longcalls
28983 @opindex mlongcalls
28984 @opindex mno-longcalls
28985 When this option is enabled, GCC instructs the assembler to translate
28986 direct calls to indirect calls unless it can determine that the target
28987 of a direct call is in the range allowed by the call instruction. This
28988 translation typically occurs for calls to functions in other source
28989 files. Specifically, the assembler translates a direct @code{CALL}
28990 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28991 The default is @option{-mno-longcalls}. This option should be used in
28992 programs where the call target can potentially be out of range. This
28993 option is implemented in the assembler, not the compiler, so the
28994 assembly code generated by GCC still shows direct call
28995 instructions---look at the disassembled object code to see the actual
28996 instructions. Note that the assembler uses an indirect call for
28997 every cross-file call, not just those that really are out of range.
28998 @end table
28999
29000 @node zSeries Options
29001 @subsection zSeries Options
29002 @cindex zSeries options
29003
29004 These are listed under @xref{S/390 and zSeries Options}.
29005
29006
29007 @c man end
29008
29009 @node Spec Files
29010 @section Specifying Subprocesses and the Switches to Pass to Them
29011 @cindex Spec Files
29012
29013 @command{gcc} is a driver program. It performs its job by invoking a
29014 sequence of other programs to do the work of compiling, assembling and
29015 linking. GCC interprets its command-line parameters and uses these to
29016 deduce which programs it should invoke, and which command-line options
29017 it ought to place on their command lines. This behavior is controlled
29018 by @dfn{spec strings}. In most cases there is one spec string for each
29019 program that GCC can invoke, but a few programs have multiple spec
29020 strings to control their behavior. The spec strings built into GCC can
29021 be overridden by using the @option{-specs=} command-line switch to specify
29022 a spec file.
29023
29024 @dfn{Spec files} are plain-text files that are used to construct spec
29025 strings. They consist of a sequence of directives separated by blank
29026 lines. The type of directive is determined by the first non-whitespace
29027 character on the line, which can be one of the following:
29028
29029 @table @code
29030 @item %@var{command}
29031 Issues a @var{command} to the spec file processor. The commands that can
29032 appear here are:
29033
29034 @table @code
29035 @item %include <@var{file}>
29036 @cindex @code{%include}
29037 Search for @var{file} and insert its text at the current point in the
29038 specs file.
29039
29040 @item %include_noerr <@var{file}>
29041 @cindex @code{%include_noerr}
29042 Just like @samp{%include}, but do not generate an error message if the include
29043 file cannot be found.
29044
29045 @item %rename @var{old_name} @var{new_name}
29046 @cindex @code{%rename}
29047 Rename the spec string @var{old_name} to @var{new_name}.
29048
29049 @end table
29050
29051 @item *[@var{spec_name}]:
29052 This tells the compiler to create, override or delete the named spec
29053 string. All lines after this directive up to the next directive or
29054 blank line are considered to be the text for the spec string. If this
29055 results in an empty string then the spec is deleted. (Or, if the
29056 spec did not exist, then nothing happens.) Otherwise, if the spec
29057 does not currently exist a new spec is created. If the spec does
29058 exist then its contents are overridden by the text of this
29059 directive, unless the first character of that text is the @samp{+}
29060 character, in which case the text is appended to the spec.
29061
29062 @item [@var{suffix}]:
29063 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29064 and up to the next directive or blank line are considered to make up the
29065 spec string for the indicated suffix. When the compiler encounters an
29066 input file with the named suffix, it processes the spec string in
29067 order to work out how to compile that file. For example:
29068
29069 @smallexample
29070 .ZZ:
29071 z-compile -input %i
29072 @end smallexample
29073
29074 This says that any input file whose name ends in @samp{.ZZ} should be
29075 passed to the program @samp{z-compile}, which should be invoked with the
29076 command-line switch @option{-input} and with the result of performing the
29077 @samp{%i} substitution. (See below.)
29078
29079 As an alternative to providing a spec string, the text following a
29080 suffix directive can be one of the following:
29081
29082 @table @code
29083 @item @@@var{language}
29084 This says that the suffix is an alias for a known @var{language}. This is
29085 similar to using the @option{-x} command-line switch to GCC to specify a
29086 language explicitly. For example:
29087
29088 @smallexample
29089 .ZZ:
29090 @@c++
29091 @end smallexample
29092
29093 Says that .ZZ files are, in fact, C++ source files.
29094
29095 @item #@var{name}
29096 This causes an error messages saying:
29097
29098 @smallexample
29099 @var{name} compiler not installed on this system.
29100 @end smallexample
29101 @end table
29102
29103 GCC already has an extensive list of suffixes built into it.
29104 This directive adds an entry to the end of the list of suffixes, but
29105 since the list is searched from the end backwards, it is effectively
29106 possible to override earlier entries using this technique.
29107
29108 @end table
29109
29110 GCC has the following spec strings built into it. Spec files can
29111 override these strings or create their own. Note that individual
29112 targets can also add their own spec strings to this list.
29113
29114 @smallexample
29115 asm Options to pass to the assembler
29116 asm_final Options to pass to the assembler post-processor
29117 cpp Options to pass to the C preprocessor
29118 cc1 Options to pass to the C compiler
29119 cc1plus Options to pass to the C++ compiler
29120 endfile Object files to include at the end of the link
29121 link Options to pass to the linker
29122 lib Libraries to include on the command line to the linker
29123 libgcc Decides which GCC support library to pass to the linker
29124 linker Sets the name of the linker
29125 predefines Defines to be passed to the C preprocessor
29126 signed_char Defines to pass to CPP to say whether @code{char} is signed
29127 by default
29128 startfile Object files to include at the start of the link
29129 @end smallexample
29130
29131 Here is a small example of a spec file:
29132
29133 @smallexample
29134 %rename lib old_lib
29135
29136 *lib:
29137 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29138 @end smallexample
29139
29140 This example renames the spec called @samp{lib} to @samp{old_lib} and
29141 then overrides the previous definition of @samp{lib} with a new one.
29142 The new definition adds in some extra command-line options before
29143 including the text of the old definition.
29144
29145 @dfn{Spec strings} are a list of command-line options to be passed to their
29146 corresponding program. In addition, the spec strings can contain
29147 @samp{%}-prefixed sequences to substitute variable text or to
29148 conditionally insert text into the command line. Using these constructs
29149 it is possible to generate quite complex command lines.
29150
29151 Here is a table of all defined @samp{%}-sequences for spec
29152 strings. Note that spaces are not generated automatically around the
29153 results of expanding these sequences. Therefore you can concatenate them
29154 together or combine them with constant text in a single argument.
29155
29156 @table @code
29157 @item %%
29158 Substitute one @samp{%} into the program name or argument.
29159
29160 @item %i
29161 Substitute the name of the input file being processed.
29162
29163 @item %b
29164 Substitute the basename of the input file being processed.
29165 This is the substring up to (and not including) the last period
29166 and not including the directory.
29167
29168 @item %B
29169 This is the same as @samp{%b}, but include the file suffix (text after
29170 the last period).
29171
29172 @item %d
29173 Marks the argument containing or following the @samp{%d} as a
29174 temporary file name, so that that file is deleted if GCC exits
29175 successfully. Unlike @samp{%g}, this contributes no text to the
29176 argument.
29177
29178 @item %g@var{suffix}
29179 Substitute a file name that has suffix @var{suffix} and is chosen
29180 once per compilation, and mark the argument in the same way as
29181 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29182 name is now chosen in a way that is hard to predict even when previously
29183 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29184 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29185 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29186 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29187 was simply substituted with a file name chosen once per compilation,
29188 without regard to any appended suffix (which was therefore treated
29189 just like ordinary text), making such attacks more likely to succeed.
29190
29191 @item %u@var{suffix}
29192 Like @samp{%g}, but generates a new temporary file name
29193 each time it appears instead of once per compilation.
29194
29195 @item %U@var{suffix}
29196 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29197 new one if there is no such last file name. In the absence of any
29198 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29199 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29200 involves the generation of two distinct file names, one
29201 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29202 simply substituted with a file name chosen for the previous @samp{%u},
29203 without regard to any appended suffix.
29204
29205 @item %j@var{suffix}
29206 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29207 writable, and if @option{-save-temps} is not used;
29208 otherwise, substitute the name
29209 of a temporary file, just like @samp{%u}. This temporary file is not
29210 meant for communication between processes, but rather as a junk
29211 disposal mechanism.
29212
29213 @item %|@var{suffix}
29214 @itemx %m@var{suffix}
29215 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29216 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29217 all. These are the two most common ways to instruct a program that it
29218 should read from standard input or write to standard output. If you
29219 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29220 construct: see for example @file{f/lang-specs.h}.
29221
29222 @item %.@var{SUFFIX}
29223 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29224 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29225 terminated by the next space or %.
29226
29227 @item %w
29228 Marks the argument containing or following the @samp{%w} as the
29229 designated output file of this compilation. This puts the argument
29230 into the sequence of arguments that @samp{%o} substitutes.
29231
29232 @item %o
29233 Substitutes the names of all the output files, with spaces
29234 automatically placed around them. You should write spaces
29235 around the @samp{%o} as well or the results are undefined.
29236 @samp{%o} is for use in the specs for running the linker.
29237 Input files whose names have no recognized suffix are not compiled
29238 at all, but they are included among the output files, so they are
29239 linked.
29240
29241 @item %O
29242 Substitutes the suffix for object files. Note that this is
29243 handled specially when it immediately follows @samp{%g, %u, or %U},
29244 because of the need for those to form complete file names. The
29245 handling is such that @samp{%O} is treated exactly as if it had already
29246 been substituted, except that @samp{%g, %u, and %U} do not currently
29247 support additional @var{suffix} characters following @samp{%O} as they do
29248 following, for example, @samp{.o}.
29249
29250 @item %p
29251 Substitutes the standard macro predefinitions for the
29252 current target machine. Use this when running @command{cpp}.
29253
29254 @item %P
29255 Like @samp{%p}, but puts @samp{__} before and after the name of each
29256 predefined macro, except for macros that start with @samp{__} or with
29257 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29258 C@.
29259
29260 @item %I
29261 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29262 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29263 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29264 and @option{-imultilib} as necessary.
29265
29266 @item %s
29267 Current argument is the name of a library or startup file of some sort.
29268 Search for that file in a standard list of directories and substitute
29269 the full name found. The current working directory is included in the
29270 list of directories scanned.
29271
29272 @item %T
29273 Current argument is the name of a linker script. Search for that file
29274 in the current list of directories to scan for libraries. If the file
29275 is located insert a @option{--script} option into the command line
29276 followed by the full path name found. If the file is not found then
29277 generate an error message. Note: the current working directory is not
29278 searched.
29279
29280 @item %e@var{str}
29281 Print @var{str} as an error message. @var{str} is terminated by a newline.
29282 Use this when inconsistent options are detected.
29283
29284 @item %(@var{name})
29285 Substitute the contents of spec string @var{name} at this point.
29286
29287 @item %x@{@var{option}@}
29288 Accumulate an option for @samp{%X}.
29289
29290 @item %X
29291 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29292 spec string.
29293
29294 @item %Y
29295 Output the accumulated assembler options specified by @option{-Wa}.
29296
29297 @item %Z
29298 Output the accumulated preprocessor options specified by @option{-Wp}.
29299
29300 @item %a
29301 Process the @code{asm} spec. This is used to compute the
29302 switches to be passed to the assembler.
29303
29304 @item %A
29305 Process the @code{asm_final} spec. This is a spec string for
29306 passing switches to an assembler post-processor, if such a program is
29307 needed.
29308
29309 @item %l
29310 Process the @code{link} spec. This is the spec for computing the
29311 command line passed to the linker. Typically it makes use of the
29312 @samp{%L %G %S %D and %E} sequences.
29313
29314 @item %D
29315 Dump out a @option{-L} option for each directory that GCC believes might
29316 contain startup files. If the target supports multilibs then the
29317 current multilib directory is prepended to each of these paths.
29318
29319 @item %L
29320 Process the @code{lib} spec. This is a spec string for deciding which
29321 libraries are included on the command line to the linker.
29322
29323 @item %G
29324 Process the @code{libgcc} spec. This is a spec string for deciding
29325 which GCC support library is included on the command line to the linker.
29326
29327 @item %S
29328 Process the @code{startfile} spec. This is a spec for deciding which
29329 object files are the first ones passed to the linker. Typically
29330 this might be a file named @file{crt0.o}.
29331
29332 @item %E
29333 Process the @code{endfile} spec. This is a spec string that specifies
29334 the last object files that are passed to the linker.
29335
29336 @item %C
29337 Process the @code{cpp} spec. This is used to construct the arguments
29338 to be passed to the C preprocessor.
29339
29340 @item %1
29341 Process the @code{cc1} spec. This is used to construct the options to be
29342 passed to the actual C compiler (@command{cc1}).
29343
29344 @item %2
29345 Process the @code{cc1plus} spec. This is used to construct the options to be
29346 passed to the actual C++ compiler (@command{cc1plus}).
29347
29348 @item %*
29349 Substitute the variable part of a matched option. See below.
29350 Note that each comma in the substituted string is replaced by
29351 a single space.
29352
29353 @item %<S
29354 Remove all occurrences of @code{-S} from the command line. Note---this
29355 command is position dependent. @samp{%} commands in the spec string
29356 before this one see @code{-S}, @samp{%} commands in the spec string
29357 after this one do not.
29358
29359 @item %:@var{function}(@var{args})
29360 Call the named function @var{function}, passing it @var{args}.
29361 @var{args} is first processed as a nested spec string, then split
29362 into an argument vector in the usual fashion. The function returns
29363 a string which is processed as if it had appeared literally as part
29364 of the current spec.
29365
29366 The following built-in spec functions are provided:
29367
29368 @table @code
29369 @item @code{getenv}
29370 The @code{getenv} spec function takes two arguments: an environment
29371 variable name and a string. If the environment variable is not
29372 defined, a fatal error is issued. Otherwise, the return value is the
29373 value of the environment variable concatenated with the string. For
29374 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29375
29376 @smallexample
29377 %:getenv(TOPDIR /include)
29378 @end smallexample
29379
29380 expands to @file{/path/to/top/include}.
29381
29382 @item @code{if-exists}
29383 The @code{if-exists} spec function takes one argument, an absolute
29384 pathname to a file. If the file exists, @code{if-exists} returns the
29385 pathname. Here is a small example of its usage:
29386
29387 @smallexample
29388 *startfile:
29389 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29390 @end smallexample
29391
29392 @item @code{if-exists-else}
29393 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29394 spec function, except that it takes two arguments. The first argument is
29395 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29396 returns the pathname. If it does not exist, it returns the second argument.
29397 This way, @code{if-exists-else} can be used to select one file or another,
29398 based on the existence of the first. Here is a small example of its usage:
29399
29400 @smallexample
29401 *startfile:
29402 crt0%O%s %:if-exists(crti%O%s) \
29403 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29404 @end smallexample
29405
29406 @item @code{replace-outfile}
29407 The @code{replace-outfile} spec function takes two arguments. It looks for the
29408 first argument in the outfiles array and replaces it with the second argument. Here
29409 is a small example of its usage:
29410
29411 @smallexample
29412 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29413 @end smallexample
29414
29415 @item @code{remove-outfile}
29416 The @code{remove-outfile} spec function takes one argument. It looks for the
29417 first argument in the outfiles array and removes it. Here is a small example
29418 its usage:
29419
29420 @smallexample
29421 %:remove-outfile(-lm)
29422 @end smallexample
29423
29424 @item @code{pass-through-libs}
29425 The @code{pass-through-libs} spec function takes any number of arguments. It
29426 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29427 assumes are the names of linker input library archive files) and returns a
29428 result containing all the found arguments each prepended by
29429 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29430 intended to be passed to the LTO linker plugin.
29431
29432 @smallexample
29433 %:pass-through-libs(%G %L %G)
29434 @end smallexample
29435
29436 @item @code{print-asm-header}
29437 The @code{print-asm-header} function takes no arguments and simply
29438 prints a banner like:
29439
29440 @smallexample
29441 Assembler options
29442 =================
29443
29444 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29445 @end smallexample
29446
29447 It is used to separate compiler options from assembler options
29448 in the @option{--target-help} output.
29449 @end table
29450
29451 @item %@{S@}
29452 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29453 If that switch is not specified, this substitutes nothing. Note that
29454 the leading dash is omitted when specifying this option, and it is
29455 automatically inserted if the substitution is performed. Thus the spec
29456 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29457 and outputs the command-line option @option{-foo}.
29458
29459 @item %W@{S@}
29460 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29461 deleted on failure.
29462
29463 @item %@{S*@}
29464 Substitutes all the switches specified to GCC whose names start
29465 with @code{-S}, but which also take an argument. This is used for
29466 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29467 GCC considers @option{-o foo} as being
29468 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29469 text, including the space. Thus two arguments are generated.
29470
29471 @item %@{S*&T*@}
29472 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29473 (the order of @code{S} and @code{T} in the spec is not significant).
29474 There can be any number of ampersand-separated variables; for each the
29475 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29476
29477 @item %@{S:X@}
29478 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29479
29480 @item %@{!S:X@}
29481 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29482
29483 @item %@{S*:X@}
29484 Substitutes @code{X} if one or more switches whose names start with
29485 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29486 once, no matter how many such switches appeared. However, if @code{%*}
29487 appears somewhere in @code{X}, then @code{X} is substituted once
29488 for each matching switch, with the @code{%*} replaced by the part of
29489 that switch matching the @code{*}.
29490
29491 If @code{%*} appears as the last part of a spec sequence then a space
29492 is added after the end of the last substitution. If there is more
29493 text in the sequence, however, then a space is not generated. This
29494 allows the @code{%*} substitution to be used as part of a larger
29495 string. For example, a spec string like this:
29496
29497 @smallexample
29498 %@{mcu=*:--script=%*/memory.ld@}
29499 @end smallexample
29500
29501 @noindent
29502 when matching an option like @option{-mcu=newchip} produces:
29503
29504 @smallexample
29505 --script=newchip/memory.ld
29506 @end smallexample
29507
29508 @item %@{.S:X@}
29509 Substitutes @code{X}, if processing a file with suffix @code{S}.
29510
29511 @item %@{!.S:X@}
29512 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29513
29514 @item %@{,S:X@}
29515 Substitutes @code{X}, if processing a file for language @code{S}.
29516
29517 @item %@{!,S:X@}
29518 Substitutes @code{X}, if not processing a file for language @code{S}.
29519
29520 @item %@{S|P:X@}
29521 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29522 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29523 @code{*} sequences as well, although they have a stronger binding than
29524 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29525 alternatives must be starred, and only the first matching alternative
29526 is substituted.
29527
29528 For example, a spec string like this:
29529
29530 @smallexample
29531 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29532 @end smallexample
29533
29534 @noindent
29535 outputs the following command-line options from the following input
29536 command-line options:
29537
29538 @smallexample
29539 fred.c -foo -baz
29540 jim.d -bar -boggle
29541 -d fred.c -foo -baz -boggle
29542 -d jim.d -bar -baz -boggle
29543 @end smallexample
29544
29545 @item %@{S:X; T:Y; :D@}
29546
29547 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29548 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29549 be as many clauses as you need. This may be combined with @code{.},
29550 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29551
29552
29553 @end table
29554
29555 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29556 or similar construct can use a backslash to ignore the special meaning
29557 of the character following it, thus allowing literal matching of a
29558 character that is otherwise specially treated. For example,
29559 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29560 @option{-std=iso9899:1999} option is given.
29561
29562 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29563 construct may contain other nested @samp{%} constructs or spaces, or
29564 even newlines. They are processed as usual, as described above.
29565 Trailing white space in @code{X} is ignored. White space may also
29566 appear anywhere on the left side of the colon in these constructs,
29567 except between @code{.} or @code{*} and the corresponding word.
29568
29569 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29570 handled specifically in these constructs. If another value of
29571 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29572 @option{-W} switch is found later in the command line, the earlier
29573 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29574 just one letter, which passes all matching options.
29575
29576 The character @samp{|} at the beginning of the predicate text is used to
29577 indicate that a command should be piped to the following command, but
29578 only if @option{-pipe} is specified.
29579
29580 It is built into GCC which switches take arguments and which do not.
29581 (You might think it would be useful to generalize this to allow each
29582 compiler's spec to say which switches take arguments. But this cannot
29583 be done in a consistent fashion. GCC cannot even decide which input
29584 files have been specified without knowing which switches take arguments,
29585 and it must know which input files to compile in order to tell which
29586 compilers to run).
29587
29588 GCC also knows implicitly that arguments starting in @option{-l} are to be
29589 treated as compiler output files, and passed to the linker in their
29590 proper position among the other output files.
29591
29592 @node Environment Variables
29593 @section Environment Variables Affecting GCC
29594 @cindex environment variables
29595
29596 @c man begin ENVIRONMENT
29597 This section describes several environment variables that affect how GCC
29598 operates. Some of them work by specifying directories or prefixes to use
29599 when searching for various kinds of files. Some are used to specify other
29600 aspects of the compilation environment.
29601
29602 Note that you can also specify places to search using options such as
29603 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29604 take precedence over places specified using environment variables, which
29605 in turn take precedence over those specified by the configuration of GCC@.
29606 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29607 GNU Compiler Collection (GCC) Internals}.
29608
29609 @table @env
29610 @item LANG
29611 @itemx LC_CTYPE
29612 @c @itemx LC_COLLATE
29613 @itemx LC_MESSAGES
29614 @c @itemx LC_MONETARY
29615 @c @itemx LC_NUMERIC
29616 @c @itemx LC_TIME
29617 @itemx LC_ALL
29618 @findex LANG
29619 @findex LC_CTYPE
29620 @c @findex LC_COLLATE
29621 @findex LC_MESSAGES
29622 @c @findex LC_MONETARY
29623 @c @findex LC_NUMERIC
29624 @c @findex LC_TIME
29625 @findex LC_ALL
29626 @cindex locale
29627 These environment variables control the way that GCC uses
29628 localization information which allows GCC to work with different
29629 national conventions. GCC inspects the locale categories
29630 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29631 so. These locale categories can be set to any value supported by your
29632 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29633 Kingdom encoded in UTF-8.
29634
29635 The @env{LC_CTYPE} environment variable specifies character
29636 classification. GCC uses it to determine the character boundaries in
29637 a string; this is needed for some multibyte encodings that contain quote
29638 and escape characters that are otherwise interpreted as a string
29639 end or escape.
29640
29641 The @env{LC_MESSAGES} environment variable specifies the language to
29642 use in diagnostic messages.
29643
29644 If the @env{LC_ALL} environment variable is set, it overrides the value
29645 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29646 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29647 environment variable. If none of these variables are set, GCC
29648 defaults to traditional C English behavior.
29649
29650 @item TMPDIR
29651 @findex TMPDIR
29652 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29653 files. GCC uses temporary files to hold the output of one stage of
29654 compilation which is to be used as input to the next stage: for example,
29655 the output of the preprocessor, which is the input to the compiler
29656 proper.
29657
29658 @item GCC_COMPARE_DEBUG
29659 @findex GCC_COMPARE_DEBUG
29660 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29661 @option{-fcompare-debug} to the compiler driver. See the documentation
29662 of this option for more details.
29663
29664 @item GCC_EXEC_PREFIX
29665 @findex GCC_EXEC_PREFIX
29666 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29667 names of the subprograms executed by the compiler. No slash is added
29668 when this prefix is combined with the name of a subprogram, but you can
29669 specify a prefix that ends with a slash if you wish.
29670
29671 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29672 an appropriate prefix to use based on the pathname it is invoked with.
29673
29674 If GCC cannot find the subprogram using the specified prefix, it
29675 tries looking in the usual places for the subprogram.
29676
29677 The default value of @env{GCC_EXEC_PREFIX} is
29678 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29679 the installed compiler. In many cases @var{prefix} is the value
29680 of @code{prefix} when you ran the @file{configure} script.
29681
29682 Other prefixes specified with @option{-B} take precedence over this prefix.
29683
29684 This prefix is also used for finding files such as @file{crt0.o} that are
29685 used for linking.
29686
29687 In addition, the prefix is used in an unusual way in finding the
29688 directories to search for header files. For each of the standard
29689 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29690 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29691 replacing that beginning with the specified prefix to produce an
29692 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29693 @file{foo/bar} just before it searches the standard directory
29694 @file{/usr/local/lib/bar}.
29695 If a standard directory begins with the configured
29696 @var{prefix} then the value of @var{prefix} is replaced by
29697 @env{GCC_EXEC_PREFIX} when looking for header files.
29698
29699 @item COMPILER_PATH
29700 @findex COMPILER_PATH
29701 The value of @env{COMPILER_PATH} is a colon-separated list of
29702 directories, much like @env{PATH}. GCC tries the directories thus
29703 specified when searching for subprograms, if it cannot find the
29704 subprograms using @env{GCC_EXEC_PREFIX}.
29705
29706 @item LIBRARY_PATH
29707 @findex LIBRARY_PATH
29708 The value of @env{LIBRARY_PATH} is a colon-separated list of
29709 directories, much like @env{PATH}. When configured as a native compiler,
29710 GCC tries the directories thus specified when searching for special
29711 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29712 using GCC also uses these directories when searching for ordinary
29713 libraries for the @option{-l} option (but directories specified with
29714 @option{-L} come first).
29715
29716 @item LANG
29717 @findex LANG
29718 @cindex locale definition
29719 This variable is used to pass locale information to the compiler. One way in
29720 which this information is used is to determine the character set to be used
29721 when character literals, string literals and comments are parsed in C and C++.
29722 When the compiler is configured to allow multibyte characters,
29723 the following values for @env{LANG} are recognized:
29724
29725 @table @samp
29726 @item C-JIS
29727 Recognize JIS characters.
29728 @item C-SJIS
29729 Recognize SJIS characters.
29730 @item C-EUCJP
29731 Recognize EUCJP characters.
29732 @end table
29733
29734 If @env{LANG} is not defined, or if it has some other value, then the
29735 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29736 recognize and translate multibyte characters.
29737 @end table
29738
29739 @noindent
29740 Some additional environment variables affect the behavior of the
29741 preprocessor.
29742
29743 @include cppenv.texi
29744
29745 @c man end
29746
29747 @node Precompiled Headers
29748 @section Using Precompiled Headers
29749 @cindex precompiled headers
29750 @cindex speed of compilation
29751
29752 Often large projects have many header files that are included in every
29753 source file. The time the compiler takes to process these header files
29754 over and over again can account for nearly all of the time required to
29755 build the project. To make builds faster, GCC allows you to
29756 @dfn{precompile} a header file.
29757
29758 To create a precompiled header file, simply compile it as you would any
29759 other file, if necessary using the @option{-x} option to make the driver
29760 treat it as a C or C++ header file. You may want to use a
29761 tool like @command{make} to keep the precompiled header up-to-date when
29762 the headers it contains change.
29763
29764 A precompiled header file is searched for when @code{#include} is
29765 seen in the compilation. As it searches for the included file
29766 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29767 compiler looks for a precompiled header in each directory just before it
29768 looks for the include file in that directory. The name searched for is
29769 the name specified in the @code{#include} with @samp{.gch} appended. If
29770 the precompiled header file cannot be used, it is ignored.
29771
29772 For instance, if you have @code{#include "all.h"}, and you have
29773 @file{all.h.gch} in the same directory as @file{all.h}, then the
29774 precompiled header file is used if possible, and the original
29775 header is used otherwise.
29776
29777 Alternatively, you might decide to put the precompiled header file in a
29778 directory and use @option{-I} to ensure that directory is searched
29779 before (or instead of) the directory containing the original header.
29780 Then, if you want to check that the precompiled header file is always
29781 used, you can put a file of the same name as the original header in this
29782 directory containing an @code{#error} command.
29783
29784 This also works with @option{-include}. So yet another way to use
29785 precompiled headers, good for projects not designed with precompiled
29786 header files in mind, is to simply take most of the header files used by
29787 a project, include them from another header file, precompile that header
29788 file, and @option{-include} the precompiled header. If the header files
29789 have guards against multiple inclusion, they are skipped because
29790 they've already been included (in the precompiled header).
29791
29792 If you need to precompile the same header file for different
29793 languages, targets, or compiler options, you can instead make a
29794 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29795 header in the directory, perhaps using @option{-o}. It doesn't matter
29796 what you call the files in the directory; every precompiled header in
29797 the directory is considered. The first precompiled header
29798 encountered in the directory that is valid for this compilation is
29799 used; they're searched in no particular order.
29800
29801 There are many other possibilities, limited only by your imagination,
29802 good sense, and the constraints of your build system.
29803
29804 A precompiled header file can be used only when these conditions apply:
29805
29806 @itemize
29807 @item
29808 Only one precompiled header can be used in a particular compilation.
29809
29810 @item
29811 A precompiled header cannot be used once the first C token is seen. You
29812 can have preprocessor directives before a precompiled header; you cannot
29813 include a precompiled header from inside another header.
29814
29815 @item
29816 The precompiled header file must be produced for the same language as
29817 the current compilation. You cannot use a C precompiled header for a C++
29818 compilation.
29819
29820 @item
29821 The precompiled header file must have been produced by the same compiler
29822 binary as the current compilation is using.
29823
29824 @item
29825 Any macros defined before the precompiled header is included must
29826 either be defined in the same way as when the precompiled header was
29827 generated, or must not affect the precompiled header, which usually
29828 means that they don't appear in the precompiled header at all.
29829
29830 The @option{-D} option is one way to define a macro before a
29831 precompiled header is included; using a @code{#define} can also do it.
29832 There are also some options that define macros implicitly, like
29833 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29834 defined this way.
29835
29836 @item If debugging information is output when using the precompiled
29837 header, using @option{-g} or similar, the same kind of debugging information
29838 must have been output when building the precompiled header. However,
29839 a precompiled header built using @option{-g} can be used in a compilation
29840 when no debugging information is being output.
29841
29842 @item The same @option{-m} options must generally be used when building
29843 and using the precompiled header. @xref{Submodel Options},
29844 for any cases where this rule is relaxed.
29845
29846 @item Each of the following options must be the same when building and using
29847 the precompiled header:
29848
29849 @gccoptlist{-fexceptions}
29850
29851 @item
29852 Some other command-line options starting with @option{-f},
29853 @option{-p}, or @option{-O} must be defined in the same way as when
29854 the precompiled header was generated. At present, it's not clear
29855 which options are safe to change and which are not; the safest choice
29856 is to use exactly the same options when generating and using the
29857 precompiled header. The following are known to be safe:
29858
29859 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29860 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29861 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29862 -pedantic-errors}
29863
29864 @end itemize
29865
29866 For all of these except the last, the compiler automatically
29867 ignores the precompiled header if the conditions aren't met. If you
29868 find an option combination that doesn't work and doesn't cause the
29869 precompiled header to be ignored, please consider filing a bug report,
29870 see @ref{Bugs}.
29871
29872 If you do use differing options when generating and using the
29873 precompiled header, the actual behavior is a mixture of the
29874 behavior for the options. For instance, if you use @option{-g} to
29875 generate the precompiled header but not when using it, you may or may
29876 not get debugging information for routines in the precompiled header.