]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Update copyright years.
[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 -fopenacc -fopenmp -fopenmp-simd @gol
201 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
202 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
203 -fsigned-bitfields -fsigned-char @gol
204 -funsigned-bitfields -funsigned-char}
205
206 @item C++ Language Options
207 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
208 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
209 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
210 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
211 -fno-elide-constructors @gol
212 -fno-enforce-eh-specs @gol
213 -fno-gnu-keywords @gol
214 -fno-implicit-templates @gol
215 -fno-implicit-inline-templates @gol
216 -fno-implement-inlines -fms-extensions @gol
217 -fnew-inheriting-ctors @gol
218 -fnew-ttp-matching @gol
219 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
220 -fno-optional-diags -fpermissive @gol
221 -fno-pretty-templates @gol
222 -frepo -fno-rtti -fsized-deallocation @gol
223 -ftemplate-backtrace-limit=@var{n} @gol
224 -ftemplate-depth=@var{n} @gol
225 -fno-threadsafe-statics -fuse-cxa-atexit @gol
226 -fno-weak -nostdinc++ @gol
227 -fvisibility-inlines-hidden @gol
228 -fvisibility-ms-compat @gol
229 -fext-numeric-literals @gol
230 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
231 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
232 -Wliteral-suffix @gol
233 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
234 -Wnamespaces -Wnarrowing @gol
235 -Wpessimizing-move -Wredundant-move @gol
236 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
237 -Wnon-virtual-dtor -Wreorder -Wregister @gol
238 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
239 -Wno-non-template-friend -Wold-style-cast @gol
240 -Woverloaded-virtual -Wno-pmf-conversions @gol
241 -Wno-class-conversion -Wno-terminate @gol
242 -Wsign-promo -Wvirtual-inheritance}
243
244 @item Objective-C and Objective-C++ Language Options
245 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
246 Objective-C and Objective-C++ Dialects}.
247 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
248 -fgnu-runtime -fnext-runtime @gol
249 -fno-nil-receivers @gol
250 -fobjc-abi-version=@var{n} @gol
251 -fobjc-call-cxx-cdtors @gol
252 -fobjc-direct-dispatch @gol
253 -fobjc-exceptions @gol
254 -fobjc-gc @gol
255 -fobjc-nilcheck @gol
256 -fobjc-std=objc1 @gol
257 -fno-local-ivars @gol
258 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
259 -freplace-objc-classes @gol
260 -fzero-link @gol
261 -gen-decls @gol
262 -Wassign-intercept @gol
263 -Wno-protocol -Wselector @gol
264 -Wstrict-selector-match @gol
265 -Wundeclared-selector}
266
267 @item Diagnostic Message Formatting Options
268 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
269 @gccoptlist{-fmessage-length=@var{n} @gol
270 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
271 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
272 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
273 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
274 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
275 -fdiagnostics-minimum-margin-width=@var{width} @gol
276 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
277 -fdiagnostics-show-template-tree -fno-elide-type @gol
278 -fno-show-column}
279
280 @item Warning Options
281 @xref{Warning Options,,Options to Request or Suppress Warnings}.
282 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
283 -pedantic-errors @gol
284 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
285 -Waggregate-return -Waligned-new @gol
286 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
287 -Walloca -Walloca-larger-than=@var{byte-size} @gol
288 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
289 -Wno-attributes -Wno-attribute-alias @gol
290 -Wbool-compare -Wbool-operation @gol
291 -Wno-builtin-declaration-mismatch @gol
292 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
293 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
294 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
295 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
296 -Wclobbered -Wcomment -Wconditionally-supported @gol
297 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
298 -Wdelete-incomplete @gol
299 -Wno-attribute-warning @gol
300 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
301 -Wdisabled-optimization @gol
302 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
303 -Wno-div-by-zero -Wdouble-promotion @gol
304 -Wduplicated-branches -Wduplicated-cond @gol
305 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
306 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
307 -Wfloat-equal -Wformat -Wformat=2 @gol
308 -Wno-format-contains-nul -Wno-format-extra-args @gol
309 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
310 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
311 -Wformat-y2k -Wframe-address @gol
312 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
313 -Wjump-misses-init @gol
314 -Whsa -Wif-not-aligned @gol
315 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
316 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
317 -Wimplicit-function-declaration -Wimplicit-int @gol
318 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
319 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
320 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
321 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
322 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
323 -Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol
324 -Wmissing-field-initializers -Wmissing-format-attribute @gol
325 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
326 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
327 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
328 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
329 -Woverride-init-side-effects -Woverlength-strings @gol
330 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
331 -Wparentheses -Wno-pedantic-ms-format @gol
332 -Wplacement-new -Wplacement-new=@var{n} @gol
333 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
334 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
335 -Wrestrict -Wno-return-local-addr @gol
336 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
337 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
338 -Wshift-overflow -Wshift-overflow=@var{n} @gol
339 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
340 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
341 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
342 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
343 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
344 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
345 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
346 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
347 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
348 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
349 -Wswitch-unreachable -Wsync-nand @gol
350 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
351 -Wtype-limits -Wundef @gol
352 -Wuninitialized -Wunknown-pragmas @gol
353 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
354 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
355 -Wunused-parameter -Wno-unused-result @gol
356 -Wunused-value -Wunused-variable @gol
357 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
358 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
359 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
360 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
361 -Wwrite-strings @gol
362 -Wzero-as-null-pointer-constant}
363
364 @item C and Objective-C-only Warning Options
365 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
366 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
367 -Wold-style-declaration -Wold-style-definition @gol
368 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
369 -Wdeclaration-after-statement -Wpointer-sign}
370
371 @item Debugging Options
372 @xref{Debugging Options,,Options for Debugging Your Program}.
373 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
374 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
375 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
376 -gas-loc-support -gno-as-loc-support @gol
377 -gas-locview-support -gno-as-locview-support @gol
378 -gcolumn-info -gno-column-info @gol
379 -gstatement-frontiers -gno-statement-frontiers @gol
380 -gvariable-location-views -gno-variable-location-views @gol
381 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
382 -ginline-points -gno-inline-points @gol
383 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
384 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
385 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
386 -fno-eliminate-unused-debug-types @gol
387 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
388 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
389 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
390 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
391 -fvar-tracking -fvar-tracking-assignments}
392
393 @item Optimization Options
394 @xref{Optimize Options,,Options that Control Optimization}.
395 @gccoptlist{-faggressive-loop-optimizations @gol
396 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
397 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
398 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
399 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
400 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
401 -fauto-inc-dec -fbranch-probabilities @gol
402 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
403 -fbtr-bb-exclusive -fcaller-saves @gol
404 -fcombine-stack-adjustments -fconserve-stack @gol
405 -fcompare-elim -fcprop-registers -fcrossjumping @gol
406 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
407 -fcx-limited-range @gol
408 -fdata-sections -fdce -fdelayed-branch @gol
409 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
410 -fdevirtualize-at-ltrans -fdse @gol
411 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
412 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
413 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
414 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
415 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
416 -fif-conversion2 -findirect-inlining @gol
417 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
418 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
419 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
420 -fipa-reference -fipa-reference-addressable @gol
421 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
422 -flive-patching=@var{level} @gol
423 -fira-region=@var{region} -fira-hoist-pressure @gol
424 -fira-loop-pressure -fno-ira-share-save-slots @gol
425 -fno-ira-share-spill-slots @gol
426 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
427 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
428 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
429 -floop-block -floop-interchange -floop-strip-mine @gol
430 -floop-unroll-and-jam -floop-nest-optimize @gol
431 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
432 -flto-partition=@var{alg} -fmerge-all-constants @gol
433 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
434 -fmove-loop-invariants -fno-branch-count-reg @gol
435 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
436 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
437 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
438 -fno-sched-spec -fno-signed-zeros @gol
439 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
440 -fomit-frame-pointer -foptimize-sibling-calls @gol
441 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
442 -fprefetch-loop-arrays @gol
443 -fprofile-correction @gol
444 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
445 -fprofile-reorder-functions @gol
446 -freciprocal-math -free -frename-registers -freorder-blocks @gol
447 -freorder-blocks-algorithm=@var{algorithm} @gol
448 -freorder-blocks-and-partition -freorder-functions @gol
449 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
450 -frounding-math -fsave-optimization-record @gol
451 -fsched2-use-superblocks -fsched-pressure @gol
452 -fsched-spec-load -fsched-spec-load-dangerous @gol
453 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
454 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
455 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
456 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
457 -fschedule-fusion @gol
458 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
459 -fselective-scheduling -fselective-scheduling2 @gol
460 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
461 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
462 -fsignaling-nans @gol
463 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
464 -fsplit-paths @gol
465 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
466 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
467 -fthread-jumps -ftracer -ftree-bit-ccp @gol
468 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
469 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
470 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
471 -ftree-loop-if-convert -ftree-loop-im @gol
472 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
473 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
474 -ftree-loop-vectorize @gol
475 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
476 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
477 -ftree-switch-conversion -ftree-tail-merge @gol
478 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
479 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
480 -funsafe-math-optimizations -funswitch-loops @gol
481 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
482 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
483 --param @var{name}=@var{value}
484 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
485
486 @item Program Instrumentation Options
487 @xref{Instrumentation Options,,Program Instrumentation Options}.
488 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
489 -fprofile-abs-path @gol
490 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
491 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
492 -fprofile-exclude-files=@var{regex} @gol
493 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
494 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
495 -fsanitize-undefined-trap-on-error -fbounds-check @gol
496 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
497 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
498 -fstack-protector-explicit -fstack-check @gol
499 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
500 -fno-stack-limit -fsplit-stack @gol
501 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
502 -fvtv-counts -fvtv-debug @gol
503 -finstrument-functions @gol
504 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
505 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
506
507 @item Preprocessor Options
508 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
509 @gccoptlist{-A@var{question}=@var{answer} @gol
510 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
511 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
512 -dD -dI -dM -dN -dU @gol
513 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
514 -fexec-charset=@var{charset} -fextended-identifiers @gol
515 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
516 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
517 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
518 -fwide-exec-charset=@var{charset} -fworking-directory @gol
519 -H -imacros @var{file} -include @var{file} @gol
520 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
521 -no-integrated-cpp -P -pthread -remap @gol
522 -traditional -traditional-cpp -trigraphs @gol
523 -U@var{macro} -undef @gol
524 -Wp,@var{option} -Xpreprocessor @var{option}}
525
526 @item Assembler Options
527 @xref{Assembler Options,,Passing Options to the Assembler}.
528 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
529
530 @item Linker Options
531 @xref{Link Options,,Options for Linking}.
532 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
533 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
534 -e @var{entry} --entry=@var{entry} @gol
535 -pie -pthread -r -rdynamic @gol
536 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
537 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
538 -shared -shared-libgcc -symbolic @gol
539 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
540 -u @var{symbol} -z @var{keyword}}
541
542 @item Directory Options
543 @xref{Directory Options,,Options for Directory Search}.
544 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
545 -idirafter @var{dir} @gol
546 -imacros @var{file} -imultilib @var{dir} @gol
547 -iplugindir=@var{dir} -iprefix @var{file} @gol
548 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
549 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
550 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
551 -nostdinc -nostdinc++ --sysroot=@var{dir}}
552
553 @item Code Generation Options
554 @xref{Code Gen Options,,Options for Code Generation Conventions}.
555 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
556 -ffixed-@var{reg} -fexceptions @gol
557 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
558 -fasynchronous-unwind-tables @gol
559 -fno-gnu-unique @gol
560 -finhibit-size-directive -fno-common -fno-ident @gol
561 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
562 -fno-jump-tables @gol
563 -frecord-gcc-switches @gol
564 -freg-struct-return -fshort-enums -fshort-wchar @gol
565 -fverbose-asm -fpack-struct[=@var{n}] @gol
566 -fleading-underscore -ftls-model=@var{model} @gol
567 -fstack-reuse=@var{reuse_level} @gol
568 -ftrampolines -ftrapv -fwrapv @gol
569 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
570 -fstrict-volatile-bitfields -fsync-libcalls}
571
572 @item Developer Options
573 @xref{Developer Options,,GCC Developer Options}.
574 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
575 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
576 -fdbg-cnt=@var{counter-value-list} @gol
577 -fdisable-ipa-@var{pass_name} @gol
578 -fdisable-rtl-@var{pass_name} @gol
579 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
580 -fdisable-tree-@var{pass_name} @gol
581 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
582 -fdump-debug -fdump-earlydebug @gol
583 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
584 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
585 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
586 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
587 -fdump-lang-all @gol
588 -fdump-lang-@var{switch} @gol
589 -fdump-lang-@var{switch}-@var{options} @gol
590 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
591 -fdump-passes @gol
592 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
593 -fdump-statistics @gol
594 -fdump-tree-all @gol
595 -fdump-tree-@var{switch} @gol
596 -fdump-tree-@var{switch}-@var{options} @gol
597 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
598 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
599 -fenable-@var{kind}-@var{pass} @gol
600 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
601 -fira-verbose=@var{n} @gol
602 -flto-report -flto-report-wpa -fmem-report-wpa @gol
603 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
604 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
605 -fprofile-report @gol
606 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
607 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
608 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
609 -fvar-tracking-assignments-toggle -gtoggle @gol
610 -print-file-name=@var{library} -print-libgcc-file-name @gol
611 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
612 -print-prog-name=@var{program} -print-search-dirs -Q @gol
613 -print-sysroot -print-sysroot-headers-suffix @gol
614 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
615
616 @item Machine-Dependent Options
617 @xref{Submodel Options,,Machine-Dependent Options}.
618 @c This list is ordered alphanumerically by subsection name.
619 @c Try and put the significant identifier (CPU or system) first,
620 @c so users have a clue at guessing where the ones they want will be.
621
622 @emph{AArch64 Options}
623 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
624 -mgeneral-regs-only @gol
625 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
626 -mstrict-align -mno-strict-align @gol
627 -momit-leaf-frame-pointer @gol
628 -mtls-dialect=desc -mtls-dialect=traditional @gol
629 -mtls-size=@var{size} @gol
630 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
631 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
632 -mpc-relative-literal-loads @gol
633 -msign-return-address=@var{scope} @gol
634 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
635 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
636
637 @emph{Adapteva Epiphany Options}
638 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
639 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
640 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
641 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
642 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
643 -msplit-vecmove-early -m1reg-@var{reg}}
644
645 @emph{ARC Options}
646 @gccoptlist{-mbarrel-shifter -mjli-always @gol
647 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
648 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
649 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
650 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
651 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
652 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
653 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
654 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
655 -mvolatile-cache -mtp-regno=@var{regno} @gol
656 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
657 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
658 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
659 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
660 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
661 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
662 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
663 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
664
665 @emph{ARM Options}
666 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
667 -mabi=@var{name} @gol
668 -mapcs-stack-check -mno-apcs-stack-check @gol
669 -mapcs-reentrant -mno-apcs-reentrant @gol
670 -msched-prolog -mno-sched-prolog @gol
671 -mlittle-endian -mbig-endian @gol
672 -mbe8 -mbe32 @gol
673 -mfloat-abi=@var{name} @gol
674 -mfp16-format=@var{name}
675 -mthumb-interwork -mno-thumb-interwork @gol
676 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
677 -mtune=@var{name} -mprint-tune-info @gol
678 -mstructure-size-boundary=@var{n} @gol
679 -mabort-on-noreturn @gol
680 -mlong-calls -mno-long-calls @gol
681 -msingle-pic-base -mno-single-pic-base @gol
682 -mpic-register=@var{reg} @gol
683 -mnop-fun-dllimport @gol
684 -mpoke-function-name @gol
685 -mthumb -marm -mflip-thumb @gol
686 -mtpcs-frame -mtpcs-leaf-frame @gol
687 -mcaller-super-interworking -mcallee-super-interworking @gol
688 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
689 -mword-relocations @gol
690 -mfix-cortex-m3-ldrd @gol
691 -munaligned-access @gol
692 -mneon-for-64bits @gol
693 -mslow-flash-data @gol
694 -masm-syntax-unified @gol
695 -mrestrict-it @gol
696 -mverbose-cost-dump @gol
697 -mpure-code @gol
698 -mcmse}
699
700 @emph{AVR Options}
701 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
702 -mbranch-cost=@var{cost} @gol
703 -mcall-prologues -mgas-isr-prologues -mint8 @gol
704 -mn_flash=@var{size} -mno-interrupts @gol
705 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
706 -mfract-convert-truncate @gol
707 -mshort-calls -nodevicelib @gol
708 -Waddr-space-convert -Wmisspelled-isr}
709
710 @emph{Blackfin Options}
711 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
712 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
713 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
714 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
715 -mno-id-shared-library -mshared-library-id=@var{n} @gol
716 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
717 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
718 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
719 -micplb}
720
721 @emph{C6X Options}
722 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
723 -msim -msdata=@var{sdata-type}}
724
725 @emph{CRIS Options}
726 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
727 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
728 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
729 -mstack-align -mdata-align -mconst-align @gol
730 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
731 -melf -maout -melinux -mlinux -sim -sim2 @gol
732 -mmul-bug-workaround -mno-mul-bug-workaround}
733
734 @emph{CR16 Options}
735 @gccoptlist{-mmac @gol
736 -mcr16cplus -mcr16c @gol
737 -msim -mint32 -mbit-ops
738 -mdata-model=@var{model}}
739
740 @emph{C-SKY Options}
741 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
742 -mbig-endian -EB -mlittle-endian -EL @gol
743 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
744 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
745 -mdsp -medsp -mvdsp @gol
746 -mdiv -msmart -mhigh-registers -manchor @gol
747 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
748 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
749
750 @emph{Darwin Options}
751 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
752 -arch_only -bind_at_load -bundle -bundle_loader @gol
753 -client_name -compatibility_version -current_version @gol
754 -dead_strip @gol
755 -dependency-file -dylib_file -dylinker_install_name @gol
756 -dynamic -dynamiclib -exported_symbols_list @gol
757 -filelist -flat_namespace -force_cpusubtype_ALL @gol
758 -force_flat_namespace -headerpad_max_install_names @gol
759 -iframework @gol
760 -image_base -init -install_name -keep_private_externs @gol
761 -multi_module -multiply_defined -multiply_defined_unused @gol
762 -noall_load -no_dead_strip_inits_and_terms @gol
763 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
764 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
765 -private_bundle -read_only_relocs -sectalign @gol
766 -sectobjectsymbols -whyload -seg1addr @gol
767 -sectcreate -sectobjectsymbols -sectorder @gol
768 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
769 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
770 -segprot -segs_read_only_addr -segs_read_write_addr @gol
771 -single_module -static -sub_library -sub_umbrella @gol
772 -twolevel_namespace -umbrella -undefined @gol
773 -unexported_symbols_list -weak_reference_mismatches @gol
774 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
775 -mkernel -mone-byte-bool}
776
777 @emph{DEC Alpha Options}
778 @gccoptlist{-mno-fp-regs -msoft-float @gol
779 -mieee -mieee-with-inexact -mieee-conformant @gol
780 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
781 -mtrap-precision=@var{mode} -mbuild-constants @gol
782 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
783 -mbwx -mmax -mfix -mcix @gol
784 -mfloat-vax -mfloat-ieee @gol
785 -mexplicit-relocs -msmall-data -mlarge-data @gol
786 -msmall-text -mlarge-text @gol
787 -mmemory-latency=@var{time}}
788
789 @emph{FR30 Options}
790 @gccoptlist{-msmall-model -mno-lsim}
791
792 @emph{FT32 Options}
793 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
794
795 @emph{FRV Options}
796 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
797 -mhard-float -msoft-float @gol
798 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
799 -mdouble -mno-double @gol
800 -mmedia -mno-media -mmuladd -mno-muladd @gol
801 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
802 -mlinked-fp -mlong-calls -malign-labels @gol
803 -mlibrary-pic -macc-4 -macc-8 @gol
804 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
805 -moptimize-membar -mno-optimize-membar @gol
806 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
807 -mvliw-branch -mno-vliw-branch @gol
808 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
809 -mno-nested-cond-exec -mtomcat-stats @gol
810 -mTLS -mtls @gol
811 -mcpu=@var{cpu}}
812
813 @emph{GNU/Linux Options}
814 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
815 -tno-android-cc -tno-android-ld}
816
817 @emph{H8/300 Options}
818 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
819
820 @emph{HPPA Options}
821 @gccoptlist{-march=@var{architecture-type} @gol
822 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
823 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
824 -mfixed-range=@var{register-range} @gol
825 -mjump-in-delay -mlinker-opt -mlong-calls @gol
826 -mlong-load-store -mno-disable-fpregs @gol
827 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
828 -mno-jump-in-delay -mno-long-load-store @gol
829 -mno-portable-runtime -mno-soft-float @gol
830 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
831 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
832 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
833 -munix=@var{unix-std} -nolibdld -static -threads}
834
835 @emph{IA-64 Options}
836 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
837 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
838 -mconstant-gp -mauto-pic -mfused-madd @gol
839 -minline-float-divide-min-latency @gol
840 -minline-float-divide-max-throughput @gol
841 -mno-inline-float-divide @gol
842 -minline-int-divide-min-latency @gol
843 -minline-int-divide-max-throughput @gol
844 -mno-inline-int-divide @gol
845 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
846 -mno-inline-sqrt @gol
847 -mdwarf2-asm -mearly-stop-bits @gol
848 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
849 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
850 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
851 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
852 -msched-spec-ldc -msched-spec-control-ldc @gol
853 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
854 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
855 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
856 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
857
858 @emph{LM32 Options}
859 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
860 -msign-extend-enabled -muser-enabled}
861
862 @emph{M32R/D Options}
863 @gccoptlist{-m32r2 -m32rx -m32r @gol
864 -mdebug @gol
865 -malign-loops -mno-align-loops @gol
866 -missue-rate=@var{number} @gol
867 -mbranch-cost=@var{number} @gol
868 -mmodel=@var{code-size-model-type} @gol
869 -msdata=@var{sdata-type} @gol
870 -mno-flush-func -mflush-func=@var{name} @gol
871 -mno-flush-trap -mflush-trap=@var{number} @gol
872 -G @var{num}}
873
874 @emph{M32C Options}
875 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
876
877 @emph{M680x0 Options}
878 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
879 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
880 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
881 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
882 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
883 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
884 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
885 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
886 -mxgot -mno-xgot -mlong-jump-table-offsets}
887
888 @emph{MCore Options}
889 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
890 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
891 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
892 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
893 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
894
895 @emph{MeP Options}
896 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
897 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
898 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
899 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
900 -mtiny=@var{n}}
901
902 @emph{MicroBlaze Options}
903 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
904 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
905 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
906 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
907 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
908 -mpic-data-is-text-relative}
909
910 @emph{MIPS Options}
911 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
912 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
913 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
914 -mips16 -mno-mips16 -mflip-mips16 @gol
915 -minterlink-compressed -mno-interlink-compressed @gol
916 -minterlink-mips16 -mno-interlink-mips16 @gol
917 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
918 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
919 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
920 -mno-float -msingle-float -mdouble-float @gol
921 -modd-spreg -mno-odd-spreg @gol
922 -mabs=@var{mode} -mnan=@var{encoding} @gol
923 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
924 -mmcu -mmno-mcu @gol
925 -meva -mno-eva @gol
926 -mvirt -mno-virt @gol
927 -mxpa -mno-xpa @gol
928 -mcrc -mno-crc @gol
929 -mginv -mno-ginv @gol
930 -mmicromips -mno-micromips @gol
931 -mmsa -mno-msa @gol
932 -mloongson-mmi -mno-loongson-mmi @gol
933 -mloongson-ext -mno-loongson-ext @gol
934 -mloongson-ext2 -mno-loongson-ext2 @gol
935 -mfpu=@var{fpu-type} @gol
936 -msmartmips -mno-smartmips @gol
937 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
938 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
939 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
940 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
941 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
942 -membedded-data -mno-embedded-data @gol
943 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
944 -mcode-readable=@var{setting} @gol
945 -msplit-addresses -mno-split-addresses @gol
946 -mexplicit-relocs -mno-explicit-relocs @gol
947 -mcheck-zero-division -mno-check-zero-division @gol
948 -mdivide-traps -mdivide-breaks @gol
949 -mload-store-pairs -mno-load-store-pairs @gol
950 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
951 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
952 -mfix-24k -mno-fix-24k @gol
953 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
954 -mfix-r5900 -mno-fix-r5900 @gol
955 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
956 -mfix-vr4120 -mno-fix-vr4120 @gol
957 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
958 -mflush-func=@var{func} -mno-flush-func @gol
959 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
960 -mcompact-branches=@var{policy} @gol
961 -mfp-exceptions -mno-fp-exceptions @gol
962 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
963 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
964 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
965 -mframe-header-opt -mno-frame-header-opt}
966
967 @emph{MMIX Options}
968 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
969 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
970 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
971 -mno-base-addresses -msingle-exit -mno-single-exit}
972
973 @emph{MN10300 Options}
974 @gccoptlist{-mmult-bug -mno-mult-bug @gol
975 -mno-am33 -mam33 -mam33-2 -mam34 @gol
976 -mtune=@var{cpu-type} @gol
977 -mreturn-pointer-on-d0 @gol
978 -mno-crt0 -mrelax -mliw -msetlb}
979
980 @emph{Moxie Options}
981 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
982
983 @emph{MSP430 Options}
984 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
985 -mwarn-mcu @gol
986 -mcode-region= -mdata-region= @gol
987 -msilicon-errata= -msilicon-errata-warn= @gol
988 -mhwmult= -minrt}
989
990 @emph{NDS32 Options}
991 @gccoptlist{-mbig-endian -mlittle-endian @gol
992 -mreduced-regs -mfull-regs @gol
993 -mcmov -mno-cmov @gol
994 -mext-perf -mno-ext-perf @gol
995 -mext-perf2 -mno-ext-perf2 @gol
996 -mext-string -mno-ext-string @gol
997 -mv3push -mno-v3push @gol
998 -m16bit -mno-16bit @gol
999 -misr-vector-size=@var{num} @gol
1000 -mcache-block-size=@var{num} @gol
1001 -march=@var{arch} @gol
1002 -mcmodel=@var{code-model} @gol
1003 -mctor-dtor -mrelax}
1004
1005 @emph{Nios II Options}
1006 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1007 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1008 -mel -meb @gol
1009 -mno-bypass-cache -mbypass-cache @gol
1010 -mno-cache-volatile -mcache-volatile @gol
1011 -mno-fast-sw-div -mfast-sw-div @gol
1012 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1013 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1014 -mcustom-fpu-cfg=@var{name} @gol
1015 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1016 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1017
1018 @emph{Nvidia PTX Options}
1019 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1020
1021 @emph{OpenRISC Options}
1022 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1023 -msoft-mul -msoft-div @gol
1024 -mcmov -mror -msext -msfimm -mshftimm}
1025
1026 @emph{PDP-11 Options}
1027 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1028 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1029 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1030
1031 @emph{picoChip Options}
1032 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1033 -msymbol-as-address -mno-inefficient-warnings}
1034
1035 @emph{PowerPC Options}
1036 See RS/6000 and PowerPC Options.
1037
1038 @emph{RISC-V Options}
1039 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1040 -mplt -mno-plt @gol
1041 -mabi=@var{ABI-string} @gol
1042 -mfdiv -mno-fdiv @gol
1043 -mdiv -mno-div @gol
1044 -march=@var{ISA-string} @gol
1045 -mtune=@var{processor-string} @gol
1046 -mpreferred-stack-boundary=@var{num} @gol
1047 -msmall-data-limit=@var{N-bytes} @gol
1048 -msave-restore -mno-save-restore @gol
1049 -mstrict-align -mno-strict-align @gol
1050 -mcmodel=medlow -mcmodel=medany @gol
1051 -mexplicit-relocs -mno-explicit-relocs @gol
1052 -mrelax -mno-relax}
1053
1054 @emph{RL78 Options}
1055 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1056 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1057 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1058
1059 @emph{RS/6000 and PowerPC Options}
1060 @gccoptlist{-mcpu=@var{cpu-type} @gol
1061 -mtune=@var{cpu-type} @gol
1062 -mcmodel=@var{code-model} @gol
1063 -mpowerpc64 @gol
1064 -maltivec -mno-altivec @gol
1065 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1066 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1067 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1068 -mfprnd -mno-fprnd @gol
1069 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1070 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1071 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1072 -malign-power -malign-natural @gol
1073 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1074 -mupdate -mno-update @gol
1075 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1076 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1077 -mstrict-align -mno-strict-align -mrelocatable @gol
1078 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1079 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1080 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1081 -mprioritize-restricted-insns=@var{priority} @gol
1082 -msched-costly-dep=@var{dependence_type} @gol
1083 -minsert-sched-nops=@var{scheme} @gol
1084 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1085 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1086 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1087 -mtraceback=@var{traceback_type} @gol
1088 -maix-struct-return -msvr4-struct-return @gol
1089 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1090 -mblock-move-inline-limit=@var{num} @gol
1091 -mblock-compare-inline-limit=@var{num} @gol
1092 -mblock-compare-inline-loop-limit=@var{num} @gol
1093 -mstring-compare-inline-limit=@var{num} @gol
1094 -misel -mno-isel @gol
1095 -mvrsave -mno-vrsave @gol
1096 -mmulhw -mno-mulhw @gol
1097 -mdlmzb -mno-dlmzb @gol
1098 -mprototype -mno-prototype @gol
1099 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1100 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1101 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1102 -mno-recip-precision @gol
1103 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1104 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1105 -msave-toc-indirect -mno-save-toc-indirect @gol
1106 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1107 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1108 -mquad-memory -mno-quad-memory @gol
1109 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1110 -mcompat-align-parm -mno-compat-align-parm @gol
1111 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1112 -mgnu-attribute -mno-gnu-attribute @gol
1113 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1114 -mstack-protector-guard-offset=@var{offset}}
1115
1116 @emph{RX Options}
1117 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1118 -mcpu=@gol
1119 -mbig-endian-data -mlittle-endian-data @gol
1120 -msmall-data @gol
1121 -msim -mno-sim@gol
1122 -mas100-syntax -mno-as100-syntax@gol
1123 -mrelax@gol
1124 -mmax-constant-size=@gol
1125 -mint-register=@gol
1126 -mpid@gol
1127 -mallow-string-insns -mno-allow-string-insns@gol
1128 -mjsr@gol
1129 -mno-warn-multiple-fast-interrupts@gol
1130 -msave-acc-in-interrupts}
1131
1132 @emph{S/390 and zSeries Options}
1133 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1134 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1135 -mlong-double-64 -mlong-double-128 @gol
1136 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1137 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1138 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1139 -mhtm -mvx -mzvector @gol
1140 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1141 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1142 -mhotpatch=@var{halfwords},@var{halfwords}}
1143
1144 @emph{Score Options}
1145 @gccoptlist{-meb -mel @gol
1146 -mnhwloop @gol
1147 -muls @gol
1148 -mmac @gol
1149 -mscore5 -mscore5u -mscore7 -mscore7d}
1150
1151 @emph{SH Options}
1152 @gccoptlist{-m1 -m2 -m2e @gol
1153 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1154 -m3 -m3e @gol
1155 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1156 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1157 -mb -ml -mdalign -mrelax @gol
1158 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1159 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1160 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1161 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1162 -maccumulate-outgoing-args @gol
1163 -matomic-model=@var{atomic-model} @gol
1164 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1165 -mcbranch-force-delay-slot @gol
1166 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1167 -mpretend-cmove -mtas}
1168
1169 @emph{Solaris 2 Options}
1170 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1171 -pthreads}
1172
1173 @emph{SPARC Options}
1174 @gccoptlist{-mcpu=@var{cpu-type} @gol
1175 -mtune=@var{cpu-type} @gol
1176 -mcmodel=@var{code-model} @gol
1177 -mmemory-model=@var{mem-model} @gol
1178 -m32 -m64 -mapp-regs -mno-app-regs @gol
1179 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1180 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1181 -mhard-quad-float -msoft-quad-float @gol
1182 -mstack-bias -mno-stack-bias @gol
1183 -mstd-struct-return -mno-std-struct-return @gol
1184 -munaligned-doubles -mno-unaligned-doubles @gol
1185 -muser-mode -mno-user-mode @gol
1186 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1187 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1188 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1189 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1190 -mpopc -mno-popc -msubxc -mno-subxc @gol
1191 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1192 -mlra -mno-lra}
1193
1194 @emph{SPU Options}
1195 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1196 -msafe-dma -munsafe-dma @gol
1197 -mbranch-hints @gol
1198 -msmall-mem -mlarge-mem -mstdmain @gol
1199 -mfixed-range=@var{register-range} @gol
1200 -mea32 -mea64 @gol
1201 -maddress-space-conversion -mno-address-space-conversion @gol
1202 -mcache-size=@var{cache-size} @gol
1203 -matomic-updates -mno-atomic-updates}
1204
1205 @emph{System V Options}
1206 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1207
1208 @emph{TILE-Gx Options}
1209 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1210 -mcmodel=@var{code-model}}
1211
1212 @emph{TILEPro Options}
1213 @gccoptlist{-mcpu=@var{cpu} -m32}
1214
1215 @emph{V850 Options}
1216 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1217 -mprolog-function -mno-prolog-function -mspace @gol
1218 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1219 -mapp-regs -mno-app-regs @gol
1220 -mdisable-callt -mno-disable-callt @gol
1221 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1222 -mv850e -mv850 -mv850e3v5 @gol
1223 -mloop @gol
1224 -mrelax @gol
1225 -mlong-jumps @gol
1226 -msoft-float @gol
1227 -mhard-float @gol
1228 -mgcc-abi @gol
1229 -mrh850-abi @gol
1230 -mbig-switch}
1231
1232 @emph{VAX Options}
1233 @gccoptlist{-mg -mgnu -munix}
1234
1235 @emph{Visium Options}
1236 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1237 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1238
1239 @emph{VMS Options}
1240 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1241 -mpointer-size=@var{size}}
1242
1243 @emph{VxWorks Options}
1244 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1245 -Xbind-lazy -Xbind-now}
1246
1247 @emph{x86 Options}
1248 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1249 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1250 -mfpmath=@var{unit} @gol
1251 -masm=@var{dialect} -mno-fancy-math-387 @gol
1252 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1253 -mno-wide-multiply -mrtd -malign-double @gol
1254 -mpreferred-stack-boundary=@var{num} @gol
1255 -mincoming-stack-boundary=@var{num} @gol
1256 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1257 -mrecip -mrecip=@var{opt} @gol
1258 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1259 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1260 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1261 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1262 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1263 -mptwrite -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1264 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1265 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1266 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1267 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 @gol
1268 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1269 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1270 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1271 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1272 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1273 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1274 -mregparm=@var{num} -msseregparm @gol
1275 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1276 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1277 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1278 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1279 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1280 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1281 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1282 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1283 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1284 -mstack-protector-guard-reg=@var{reg} @gol
1285 -mstack-protector-guard-offset=@var{offset} @gol
1286 -mstack-protector-guard-symbol=@var{symbol} @gol
1287 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1288 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1289 -mindirect-branch-register}
1290
1291 @emph{x86 Windows Options}
1292 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1293 -mnop-fun-dllimport -mthread @gol
1294 -municode -mwin32 -mwindows -fno-set-stack-executable}
1295
1296 @emph{Xstormy16 Options}
1297 @gccoptlist{-msim}
1298
1299 @emph{Xtensa Options}
1300 @gccoptlist{-mconst16 -mno-const16 @gol
1301 -mfused-madd -mno-fused-madd @gol
1302 -mforce-no-pic @gol
1303 -mserialize-volatile -mno-serialize-volatile @gol
1304 -mtext-section-literals -mno-text-section-literals @gol
1305 -mauto-litpools -mno-auto-litpools @gol
1306 -mtarget-align -mno-target-align @gol
1307 -mlongcalls -mno-longcalls}
1308
1309 @emph{zSeries Options}
1310 See S/390 and zSeries Options.
1311 @end table
1312
1313
1314 @node Overall Options
1315 @section Options Controlling the Kind of Output
1316
1317 Compilation can involve up to four stages: preprocessing, compilation
1318 proper, assembly and linking, always in that order. GCC is capable of
1319 preprocessing and compiling several files either into several
1320 assembler input files, or into one assembler input file; then each
1321 assembler input file produces an object file, and linking combines all
1322 the object files (those newly compiled, and those specified as input)
1323 into an executable file.
1324
1325 @cindex file name suffix
1326 For any given input file, the file name suffix determines what kind of
1327 compilation is done:
1328
1329 @table @gcctabopt
1330 @item @var{file}.c
1331 C source code that must be preprocessed.
1332
1333 @item @var{file}.i
1334 C source code that should not be preprocessed.
1335
1336 @item @var{file}.ii
1337 C++ source code that should not be preprocessed.
1338
1339 @item @var{file}.m
1340 Objective-C source code. Note that you must link with the @file{libobjc}
1341 library to make an Objective-C program work.
1342
1343 @item @var{file}.mi
1344 Objective-C source code that should not be preprocessed.
1345
1346 @item @var{file}.mm
1347 @itemx @var{file}.M
1348 Objective-C++ source code. Note that you must link with the @file{libobjc}
1349 library to make an Objective-C++ program work. Note that @samp{.M} refers
1350 to a literal capital M@.
1351
1352 @item @var{file}.mii
1353 Objective-C++ source code that should not be preprocessed.
1354
1355 @item @var{file}.h
1356 C, C++, Objective-C or Objective-C++ header file to be turned into a
1357 precompiled header (default), or C, C++ header file to be turned into an
1358 Ada spec (via the @option{-fdump-ada-spec} switch).
1359
1360 @item @var{file}.cc
1361 @itemx @var{file}.cp
1362 @itemx @var{file}.cxx
1363 @itemx @var{file}.cpp
1364 @itemx @var{file}.CPP
1365 @itemx @var{file}.c++
1366 @itemx @var{file}.C
1367 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1368 the last two letters must both be literally @samp{x}. Likewise,
1369 @samp{.C} refers to a literal capital C@.
1370
1371 @item @var{file}.mm
1372 @itemx @var{file}.M
1373 Objective-C++ source code that must be preprocessed.
1374
1375 @item @var{file}.mii
1376 Objective-C++ source code that should not be preprocessed.
1377
1378 @item @var{file}.hh
1379 @itemx @var{file}.H
1380 @itemx @var{file}.hp
1381 @itemx @var{file}.hxx
1382 @itemx @var{file}.hpp
1383 @itemx @var{file}.HPP
1384 @itemx @var{file}.h++
1385 @itemx @var{file}.tcc
1386 C++ header file to be turned into a precompiled header or Ada spec.
1387
1388 @item @var{file}.f
1389 @itemx @var{file}.for
1390 @itemx @var{file}.ftn
1391 Fixed form Fortran source code that should not be preprocessed.
1392
1393 @item @var{file}.F
1394 @itemx @var{file}.FOR
1395 @itemx @var{file}.fpp
1396 @itemx @var{file}.FPP
1397 @itemx @var{file}.FTN
1398 Fixed form Fortran source code that must be preprocessed (with the traditional
1399 preprocessor).
1400
1401 @item @var{file}.f90
1402 @itemx @var{file}.f95
1403 @itemx @var{file}.f03
1404 @itemx @var{file}.f08
1405 Free form Fortran source code that should not be preprocessed.
1406
1407 @item @var{file}.F90
1408 @itemx @var{file}.F95
1409 @itemx @var{file}.F03
1410 @itemx @var{file}.F08
1411 Free form Fortran source code that must be preprocessed (with the
1412 traditional preprocessor).
1413
1414 @item @var{file}.go
1415 Go source code.
1416
1417 @item @var{file}.brig
1418 BRIG files (binary representation of HSAIL).
1419
1420 @item @var{file}.d
1421 D source code.
1422
1423 @item @var{file}.di
1424 D interface file.
1425
1426 @item @var{file}.dd
1427 D documentation code (Ddoc).
1428
1429 @item @var{file}.ads
1430 Ada source code file that contains a library unit declaration (a
1431 declaration of a package, subprogram, or generic, or a generic
1432 instantiation), or a library unit renaming declaration (a package,
1433 generic, or subprogram renaming declaration). Such files are also
1434 called @dfn{specs}.
1435
1436 @item @var{file}.adb
1437 Ada source code file containing a library unit body (a subprogram or
1438 package body). Such files are also called @dfn{bodies}.
1439
1440 @c GCC also knows about some suffixes for languages not yet included:
1441 @c Ratfor:
1442 @c @var{file}.r
1443
1444 @item @var{file}.s
1445 Assembler code.
1446
1447 @item @var{file}.S
1448 @itemx @var{file}.sx
1449 Assembler code that must be preprocessed.
1450
1451 @item @var{other}
1452 An object file to be fed straight into linking.
1453 Any file name with no recognized suffix is treated this way.
1454 @end table
1455
1456 @opindex x
1457 You can specify the input language explicitly with the @option{-x} option:
1458
1459 @table @gcctabopt
1460 @item -x @var{language}
1461 Specify explicitly the @var{language} for the following input files
1462 (rather than letting the compiler choose a default based on the file
1463 name suffix). This option applies to all following input files until
1464 the next @option{-x} option. Possible values for @var{language} are:
1465 @smallexample
1466 c c-header cpp-output
1467 c++ c++-header c++-cpp-output
1468 objective-c objective-c-header objective-c-cpp-output
1469 objective-c++ objective-c++-header objective-c++-cpp-output
1470 assembler assembler-with-cpp
1471 ada
1472 d
1473 f77 f77-cpp-input f95 f95-cpp-input
1474 go
1475 brig
1476 @end smallexample
1477
1478 @item -x none
1479 Turn off any specification of a language, so that subsequent files are
1480 handled according to their file name suffixes (as they are if @option{-x}
1481 has not been used at all).
1482 @end table
1483
1484 If you only want some of the stages of compilation, you can use
1485 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1486 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1487 @command{gcc} is to stop. Note that some combinations (for example,
1488 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1489
1490 @table @gcctabopt
1491 @item -c
1492 @opindex c
1493 Compile or assemble the source files, but do not link. The linking
1494 stage simply is not done. The ultimate output is in the form of an
1495 object file for each source file.
1496
1497 By default, the object file name for a source file is made by replacing
1498 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1499
1500 Unrecognized input files, not requiring compilation or assembly, are
1501 ignored.
1502
1503 @item -S
1504 @opindex S
1505 Stop after the stage of compilation proper; do not assemble. The output
1506 is in the form of an assembler code file for each non-assembler input
1507 file specified.
1508
1509 By default, the assembler file name for a source file is made by
1510 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1511
1512 Input files that don't require compilation are ignored.
1513
1514 @item -E
1515 @opindex E
1516 Stop after the preprocessing stage; do not run the compiler proper. The
1517 output is in the form of preprocessed source code, which is sent to the
1518 standard output.
1519
1520 Input files that don't require preprocessing are ignored.
1521
1522 @cindex output file option
1523 @item -o @var{file}
1524 @opindex o
1525 Place output in file @var{file}. This applies to whatever
1526 sort of output is being produced, whether it be an executable file,
1527 an object file, an assembler file or preprocessed C code.
1528
1529 If @option{-o} is not specified, the default is to put an executable
1530 file in @file{a.out}, the object file for
1531 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1532 assembler file in @file{@var{source}.s}, a precompiled header file in
1533 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1534 standard output.
1535
1536 @item -v
1537 @opindex v
1538 Print (on standard error output) the commands executed to run the stages
1539 of compilation. Also print the version number of the compiler driver
1540 program and of the preprocessor and the compiler proper.
1541
1542 @item -###
1543 @opindex ###
1544 Like @option{-v} except the commands are not executed and arguments
1545 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1546 This is useful for shell scripts to capture the driver-generated command lines.
1547
1548 @item --help
1549 @opindex help
1550 Print (on the standard output) a description of the command-line options
1551 understood by @command{gcc}. If the @option{-v} option is also specified
1552 then @option{--help} is also passed on to the various processes
1553 invoked by @command{gcc}, so that they can display the command-line options
1554 they accept. If the @option{-Wextra} option has also been specified
1555 (prior to the @option{--help} option), then command-line options that
1556 have no documentation associated with them are also displayed.
1557
1558 @item --target-help
1559 @opindex target-help
1560 Print (on the standard output) a description of target-specific command-line
1561 options for each tool. For some targets extra target-specific
1562 information may also be printed.
1563
1564 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1565 Print (on the standard output) a description of the command-line
1566 options understood by the compiler that fit into all specified classes
1567 and qualifiers. These are the supported classes:
1568
1569 @table @asis
1570 @item @samp{optimizers}
1571 Display all of the optimization options supported by the
1572 compiler.
1573
1574 @item @samp{warnings}
1575 Display all of the options controlling warning messages
1576 produced by the compiler.
1577
1578 @item @samp{target}
1579 Display target-specific options. Unlike the
1580 @option{--target-help} option however, target-specific options of the
1581 linker and assembler are not displayed. This is because those
1582 tools do not currently support the extended @option{--help=} syntax.
1583
1584 @item @samp{params}
1585 Display the values recognized by the @option{--param}
1586 option.
1587
1588 @item @var{language}
1589 Display the options supported for @var{language}, where
1590 @var{language} is the name of one of the languages supported in this
1591 version of GCC@.
1592
1593 @item @samp{common}
1594 Display the options that are common to all languages.
1595 @end table
1596
1597 These are the supported qualifiers:
1598
1599 @table @asis
1600 @item @samp{undocumented}
1601 Display only those options that are undocumented.
1602
1603 @item @samp{joined}
1604 Display options taking an argument that appears after an equal
1605 sign in the same continuous piece of text, such as:
1606 @samp{--help=target}.
1607
1608 @item @samp{separate}
1609 Display options taking an argument that appears as a separate word
1610 following the original option, such as: @samp{-o output-file}.
1611 @end table
1612
1613 Thus for example to display all the undocumented target-specific
1614 switches supported by the compiler, use:
1615
1616 @smallexample
1617 --help=target,undocumented
1618 @end smallexample
1619
1620 The sense of a qualifier can be inverted by prefixing it with the
1621 @samp{^} character, so for example to display all binary warning
1622 options (i.e., ones that are either on or off and that do not take an
1623 argument) that have a description, use:
1624
1625 @smallexample
1626 --help=warnings,^joined,^undocumented
1627 @end smallexample
1628
1629 The argument to @option{--help=} should not consist solely of inverted
1630 qualifiers.
1631
1632 Combining several classes is possible, although this usually
1633 restricts the output so much that there is nothing to display. One
1634 case where it does work, however, is when one of the classes is
1635 @var{target}. For example, to display all the target-specific
1636 optimization options, use:
1637
1638 @smallexample
1639 --help=target,optimizers
1640 @end smallexample
1641
1642 The @option{--help=} option can be repeated on the command line. Each
1643 successive use displays its requested class of options, skipping
1644 those that have already been displayed. If @option{--help} is also
1645 specified anywhere on the command line then this takes precedence
1646 over any @option{--help=} option.
1647
1648 If the @option{-Q} option appears on the command line before the
1649 @option{--help=} option, then the descriptive text displayed by
1650 @option{--help=} is changed. Instead of describing the displayed
1651 options, an indication is given as to whether the option is enabled,
1652 disabled or set to a specific value (assuming that the compiler
1653 knows this at the point where the @option{--help=} option is used).
1654
1655 Here is a truncated example from the ARM port of @command{gcc}:
1656
1657 @smallexample
1658 % gcc -Q -mabi=2 --help=target -c
1659 The following options are target specific:
1660 -mabi= 2
1661 -mabort-on-noreturn [disabled]
1662 -mapcs [disabled]
1663 @end smallexample
1664
1665 The output is sensitive to the effects of previous command-line
1666 options, so for example it is possible to find out which optimizations
1667 are enabled at @option{-O2} by using:
1668
1669 @smallexample
1670 -Q -O2 --help=optimizers
1671 @end smallexample
1672
1673 Alternatively you can discover which binary optimizations are enabled
1674 by @option{-O3} by using:
1675
1676 @smallexample
1677 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1678 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1679 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1680 @end smallexample
1681
1682 @item --version
1683 @opindex version
1684 Display the version number and copyrights of the invoked GCC@.
1685
1686 @item -pass-exit-codes
1687 @opindex pass-exit-codes
1688 Normally the @command{gcc} program exits with the code of 1 if any
1689 phase of the compiler returns a non-success return code. If you specify
1690 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1691 the numerically highest error produced by any phase returning an error
1692 indication. The C, C++, and Fortran front ends return 4 if an internal
1693 compiler error is encountered.
1694
1695 @item -pipe
1696 @opindex pipe
1697 Use pipes rather than temporary files for communication between the
1698 various stages of compilation. This fails to work on some systems where
1699 the assembler is unable to read from a pipe; but the GNU assembler has
1700 no trouble.
1701
1702 @item -specs=@var{file}
1703 @opindex specs
1704 Process @var{file} after the compiler reads in the standard @file{specs}
1705 file, in order to override the defaults which the @command{gcc} driver
1706 program uses when determining what switches to pass to @command{cc1},
1707 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1708 @option{-specs=@var{file}} can be specified on the command line, and they
1709 are processed in order, from left to right. @xref{Spec Files}, for
1710 information about the format of the @var{file}.
1711
1712 @item -wrapper
1713 @opindex wrapper
1714 Invoke all subcommands under a wrapper program. The name of the
1715 wrapper program and its parameters are passed as a comma separated
1716 list.
1717
1718 @smallexample
1719 gcc -c t.c -wrapper gdb,--args
1720 @end smallexample
1721
1722 @noindent
1723 This invokes all subprograms of @command{gcc} under
1724 @samp{gdb --args}, thus the invocation of @command{cc1} is
1725 @samp{gdb --args cc1 @dots{}}.
1726
1727 @item -ffile-prefix-map=@var{old}=@var{new}
1728 @opindex ffile-prefix-map
1729 When compiling files residing in directory @file{@var{old}}, record
1730 any references to them in the result of the compilation as if the
1731 files resided in directory @file{@var{new}} instead. Specifying this
1732 option is equivalent to specifying all the individual
1733 @option{-f*-prefix-map} options. This can be used to make reproducible
1734 builds that are location independent. See also
1735 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1736
1737 @item -fplugin=@var{name}.so
1738 @opindex fplugin
1739 Load the plugin code in file @var{name}.so, assumed to be a
1740 shared object to be dlopen'd by the compiler. The base name of
1741 the shared object file is used to identify the plugin for the
1742 purposes of argument parsing (See
1743 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1744 Each plugin should define the callback functions specified in the
1745 Plugins API.
1746
1747 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1748 @opindex fplugin-arg
1749 Define an argument called @var{key} with a value of @var{value}
1750 for the plugin called @var{name}.
1751
1752 @item -fdump-ada-spec@r{[}-slim@r{]}
1753 @opindex fdump-ada-spec
1754 For C and C++ source and include files, generate corresponding Ada specs.
1755 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1756 GNAT User's Guide}, which provides detailed documentation on this feature.
1757
1758 @item -fada-spec-parent=@var{unit}
1759 @opindex fada-spec-parent
1760 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1761 Ada specs as child units of parent @var{unit}.
1762
1763 @item -fdump-go-spec=@var{file}
1764 @opindex fdump-go-spec
1765 For input files in any language, generate corresponding Go
1766 declarations in @var{file}. This generates Go @code{const},
1767 @code{type}, @code{var}, and @code{func} declarations which may be a
1768 useful way to start writing a Go interface to code written in some
1769 other language.
1770
1771 @include @value{srcdir}/../libiberty/at-file.texi
1772 @end table
1773
1774 @node Invoking G++
1775 @section Compiling C++ Programs
1776
1777 @cindex suffixes for C++ source
1778 @cindex C++ source file suffixes
1779 C++ source files conventionally use one of the suffixes @samp{.C},
1780 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1781 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1782 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1783 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1784 files with these names and compiles them as C++ programs even if you
1785 call the compiler the same way as for compiling C programs (usually
1786 with the name @command{gcc}).
1787
1788 @findex g++
1789 @findex c++
1790 However, the use of @command{gcc} does not add the C++ library.
1791 @command{g++} is a program that calls GCC and automatically specifies linking
1792 against the C++ library. It treats @samp{.c},
1793 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1794 files unless @option{-x} is used. This program is also useful when
1795 precompiling a C header file with a @samp{.h} extension for use in C++
1796 compilations. On many systems, @command{g++} is also installed with
1797 the name @command{c++}.
1798
1799 @cindex invoking @command{g++}
1800 When you compile C++ programs, you may specify many of the same
1801 command-line options that you use for compiling programs in any
1802 language; or command-line options meaningful for C and related
1803 languages; or options that are meaningful only for C++ programs.
1804 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1805 explanations of options for languages related to C@.
1806 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1807 explanations of options that are meaningful only for C++ programs.
1808
1809 @node C Dialect Options
1810 @section Options Controlling C Dialect
1811 @cindex dialect options
1812 @cindex language dialect options
1813 @cindex options, dialect
1814
1815 The following options control the dialect of C (or languages derived
1816 from C, such as C++, Objective-C and Objective-C++) that the compiler
1817 accepts:
1818
1819 @table @gcctabopt
1820 @cindex ANSI support
1821 @cindex ISO support
1822 @item -ansi
1823 @opindex ansi
1824 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1825 equivalent to @option{-std=c++98}.
1826
1827 This turns off certain features of GCC that are incompatible with ISO
1828 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1829 such as the @code{asm} and @code{typeof} keywords, and
1830 predefined macros such as @code{unix} and @code{vax} that identify the
1831 type of system you are using. It also enables the undesirable and
1832 rarely used ISO trigraph feature. For the C compiler,
1833 it disables recognition of C++ style @samp{//} comments as well as
1834 the @code{inline} keyword.
1835
1836 The alternate keywords @code{__asm__}, @code{__extension__},
1837 @code{__inline__} and @code{__typeof__} continue to work despite
1838 @option{-ansi}. You would not want to use them in an ISO C program, of
1839 course, but it is useful to put them in header files that might be included
1840 in compilations done with @option{-ansi}. Alternate predefined macros
1841 such as @code{__unix__} and @code{__vax__} are also available, with or
1842 without @option{-ansi}.
1843
1844 The @option{-ansi} option does not cause non-ISO programs to be
1845 rejected gratuitously. For that, @option{-Wpedantic} is required in
1846 addition to @option{-ansi}. @xref{Warning Options}.
1847
1848 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1849 option is used. Some header files may notice this macro and refrain
1850 from declaring certain functions or defining certain macros that the
1851 ISO standard doesn't call for; this is to avoid interfering with any
1852 programs that might use these names for other things.
1853
1854 Functions that are normally built in but do not have semantics
1855 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1856 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1857 built-in functions provided by GCC}, for details of the functions
1858 affected.
1859
1860 @item -std=
1861 @opindex std
1862 Determine the language standard. @xref{Standards,,Language Standards
1863 Supported by GCC}, for details of these standard versions. This option
1864 is currently only supported when compiling C or C++.
1865
1866 The compiler can accept several base standards, such as @samp{c90} or
1867 @samp{c++98}, and GNU dialects of those standards, such as
1868 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1869 compiler accepts all programs following that standard plus those
1870 using GNU extensions that do not contradict it. For example,
1871 @option{-std=c90} turns off certain features of GCC that are
1872 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1873 keywords, but not other GNU extensions that do not have a meaning in
1874 ISO C90, such as omitting the middle term of a @code{?:}
1875 expression. On the other hand, when a GNU dialect of a standard is
1876 specified, all features supported by the compiler are enabled, even when
1877 those features change the meaning of the base standard. As a result, some
1878 strict-conforming programs may be rejected. The particular standard
1879 is used by @option{-Wpedantic} to identify which features are GNU
1880 extensions given that version of the standard. For example
1881 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1882 comments, while @option{-std=gnu99 -Wpedantic} does not.
1883
1884 A value for this option must be provided; possible values are
1885
1886 @table @samp
1887 @item c90
1888 @itemx c89
1889 @itemx iso9899:1990
1890 Support all ISO C90 programs (certain GNU extensions that conflict
1891 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1892
1893 @item iso9899:199409
1894 ISO C90 as modified in amendment 1.
1895
1896 @item c99
1897 @itemx c9x
1898 @itemx iso9899:1999
1899 @itemx iso9899:199x
1900 ISO C99. This standard is substantially completely supported, modulo
1901 bugs and floating-point issues
1902 (mainly but not entirely relating to optional C99 features from
1903 Annexes F and G). See
1904 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1905 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1906
1907 @item c11
1908 @itemx c1x
1909 @itemx iso9899:2011
1910 ISO C11, the 2011 revision of the ISO C standard. This standard is
1911 substantially completely supported, modulo bugs, floating-point issues
1912 (mainly but not entirely relating to optional C11 features from
1913 Annexes F and G) and the optional Annexes K (Bounds-checking
1914 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1915
1916 @item c17
1917 @itemx c18
1918 @itemx iso9899:2017
1919 @itemx iso9899:2018
1920 ISO C17, the 2017 revision of the ISO C standard
1921 (published in 2018). This standard is
1922 same as C11 except for corrections of defects (all of which are also
1923 applied with @option{-std=c11}) and a new value of
1924 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1925
1926 @item c2x
1927 The next version of the ISO C standard, still under development. The
1928 support for this version is experimental and incomplete.
1929
1930 @item gnu90
1931 @itemx gnu89
1932 GNU dialect of ISO C90 (including some C99 features).
1933
1934 @item gnu99
1935 @itemx gnu9x
1936 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1937
1938 @item gnu11
1939 @itemx gnu1x
1940 GNU dialect of ISO C11.
1941 The name @samp{gnu1x} is deprecated.
1942
1943 @item gnu17
1944 @itemx gnu18
1945 GNU dialect of ISO C17. This is the default for C code.
1946
1947 @item gnu2x
1948 The next version of the ISO C standard, still under development, plus
1949 GNU extensions. The support for this version is experimental and
1950 incomplete.
1951
1952 @item c++98
1953 @itemx c++03
1954 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1955 additional defect reports. Same as @option{-ansi} for C++ code.
1956
1957 @item gnu++98
1958 @itemx gnu++03
1959 GNU dialect of @option{-std=c++98}.
1960
1961 @item c++11
1962 @itemx c++0x
1963 The 2011 ISO C++ standard plus amendments.
1964 The name @samp{c++0x} is deprecated.
1965
1966 @item gnu++11
1967 @itemx gnu++0x
1968 GNU dialect of @option{-std=c++11}.
1969 The name @samp{gnu++0x} is deprecated.
1970
1971 @item c++14
1972 @itemx c++1y
1973 The 2014 ISO C++ standard plus amendments.
1974 The name @samp{c++1y} is deprecated.
1975
1976 @item gnu++14
1977 @itemx gnu++1y
1978 GNU dialect of @option{-std=c++14}.
1979 This is the default for C++ code.
1980 The name @samp{gnu++1y} is deprecated.
1981
1982 @item c++17
1983 @itemx c++1z
1984 The 2017 ISO C++ standard plus amendments.
1985 The name @samp{c++1z} is deprecated.
1986
1987 @item gnu++17
1988 @itemx gnu++1z
1989 GNU dialect of @option{-std=c++17}.
1990 The name @samp{gnu++1z} is deprecated.
1991
1992 @item c++2a
1993 The next revision of the ISO C++ standard, tentatively planned for
1994 2020. Support is highly experimental, and will almost certainly
1995 change in incompatible ways in future releases.
1996
1997 @item gnu++2a
1998 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1999 and will almost certainly change in incompatible ways in future
2000 releases.
2001 @end table
2002
2003 @item -fgnu89-inline
2004 @opindex fgnu89-inline
2005 The option @option{-fgnu89-inline} tells GCC to use the traditional
2006 GNU semantics for @code{inline} functions when in C99 mode.
2007 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2008 Using this option is roughly equivalent to adding the
2009 @code{gnu_inline} function attribute to all inline functions
2010 (@pxref{Function Attributes}).
2011
2012 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2013 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2014 specifies the default behavior).
2015 This option is not supported in @option{-std=c90} or
2016 @option{-std=gnu90} mode.
2017
2018 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2019 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2020 in effect for @code{inline} functions. @xref{Common Predefined
2021 Macros,,,cpp,The C Preprocessor}.
2022
2023 @item -fpermitted-flt-eval-methods=@var{style}
2024 @opindex fpermitted-flt-eval-methods
2025 @opindex fpermitted-flt-eval-methods=c11
2026 @opindex fpermitted-flt-eval-methods=ts-18661-3
2027 ISO/IEC TS 18661-3 defines new permissible values for
2028 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2029 a semantic type that is an interchange or extended format should be
2030 evaluated to the precision and range of that type. These new values are
2031 a superset of those permitted under C99/C11, which does not specify the
2032 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2033 conforming to C11 may not have been written expecting the possibility of
2034 the new values.
2035
2036 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2037 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2038 or the extended set of values specified in ISO/IEC TS 18661-3.
2039
2040 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2041
2042 The default when in a standards compliant mode (@option{-std=c11} or similar)
2043 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2044 dialect (@option{-std=gnu11} or similar) is
2045 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2046
2047 @item -aux-info @var{filename}
2048 @opindex aux-info
2049 Output to the given filename prototyped declarations for all functions
2050 declared and/or defined in a translation unit, including those in header
2051 files. This option is silently ignored in any language other than C@.
2052
2053 Besides declarations, the file indicates, in comments, the origin of
2054 each declaration (source file and line), whether the declaration was
2055 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2056 @samp{O} for old, respectively, in the first character after the line
2057 number and the colon), and whether it came from a declaration or a
2058 definition (@samp{C} or @samp{F}, respectively, in the following
2059 character). In the case of function definitions, a K&R-style list of
2060 arguments followed by their declarations is also provided, inside
2061 comments, after the declaration.
2062
2063 @item -fallow-parameterless-variadic-functions
2064 @opindex fallow-parameterless-variadic-functions
2065 Accept variadic functions without named parameters.
2066
2067 Although it is possible to define such a function, this is not very
2068 useful as it is not possible to read the arguments. This is only
2069 supported for C as this construct is allowed by C++.
2070
2071 @item -fno-asm
2072 @opindex fno-asm
2073 @opindex fasm
2074 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2075 keyword, so that code can use these words as identifiers. You can use
2076 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2077 instead. @option{-ansi} implies @option{-fno-asm}.
2078
2079 In C++, this switch only affects the @code{typeof} keyword, since
2080 @code{asm} and @code{inline} are standard keywords. You may want to
2081 use the @option{-fno-gnu-keywords} flag instead, which has the same
2082 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2083 switch only affects the @code{asm} and @code{typeof} keywords, since
2084 @code{inline} is a standard keyword in ISO C99.
2085
2086 @item -fno-builtin
2087 @itemx -fno-builtin-@var{function}
2088 @opindex fno-builtin
2089 @opindex fbuiltin
2090 @cindex built-in functions
2091 Don't recognize built-in functions that do not begin with
2092 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2093 functions provided by GCC}, for details of the functions affected,
2094 including those which are not built-in functions when @option{-ansi} or
2095 @option{-std} options for strict ISO C conformance are used because they
2096 do not have an ISO standard meaning.
2097
2098 GCC normally generates special code to handle certain built-in functions
2099 more efficiently; for instance, calls to @code{alloca} may become single
2100 instructions which adjust the stack directly, and calls to @code{memcpy}
2101 may become inline copy loops. The resulting code is often both smaller
2102 and faster, but since the function calls no longer appear as such, you
2103 cannot set a breakpoint on those calls, nor can you change the behavior
2104 of the functions by linking with a different library. In addition,
2105 when a function is recognized as a built-in function, GCC may use
2106 information about that function to warn about problems with calls to
2107 that function, or to generate more efficient code, even if the
2108 resulting code still contains calls to that function. For example,
2109 warnings are given with @option{-Wformat} for bad calls to
2110 @code{printf} when @code{printf} is built in and @code{strlen} is
2111 known not to modify global memory.
2112
2113 With the @option{-fno-builtin-@var{function}} option
2114 only the built-in function @var{function} is
2115 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2116 function is named that is not built-in in this version of GCC, this
2117 option is ignored. There is no corresponding
2118 @option{-fbuiltin-@var{function}} option; if you wish to enable
2119 built-in functions selectively when using @option{-fno-builtin} or
2120 @option{-ffreestanding}, you may define macros such as:
2121
2122 @smallexample
2123 #define abs(n) __builtin_abs ((n))
2124 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2125 @end smallexample
2126
2127 @item -fgimple
2128 @opindex fgimple
2129
2130 Enable parsing of function definitions marked with @code{__GIMPLE}.
2131 This is an experimental feature that allows unit testing of GIMPLE
2132 passes.
2133
2134 @item -fhosted
2135 @opindex fhosted
2136 @cindex hosted environment
2137
2138 Assert that compilation targets a hosted environment. This implies
2139 @option{-fbuiltin}. A hosted environment is one in which the
2140 entire standard library is available, and in which @code{main} has a return
2141 type of @code{int}. Examples are nearly everything except a kernel.
2142 This is equivalent to @option{-fno-freestanding}.
2143
2144 @item -ffreestanding
2145 @opindex ffreestanding
2146 @cindex hosted environment
2147
2148 Assert that compilation targets a freestanding environment. This
2149 implies @option{-fno-builtin}. A freestanding environment
2150 is one in which the standard library may not exist, and program startup may
2151 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2152 This is equivalent to @option{-fno-hosted}.
2153
2154 @xref{Standards,,Language Standards Supported by GCC}, for details of
2155 freestanding and hosted environments.
2156
2157 @item -fopenacc
2158 @opindex fopenacc
2159 @cindex OpenACC accelerator programming
2160 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2161 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2162 compiler generates accelerated code according to the OpenACC Application
2163 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2164 implies @option{-pthread}, and thus is only supported on targets that
2165 have support for @option{-pthread}.
2166
2167 @item -fopenacc-dim=@var{geom}
2168 @opindex fopenacc-dim
2169 @cindex OpenACC accelerator programming
2170 Specify default compute dimensions for parallel offload regions that do
2171 not explicitly specify. The @var{geom} value is a triple of
2172 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2173 can be omitted, to use a target-specific default value.
2174
2175 @item -fopenmp
2176 @opindex fopenmp
2177 @cindex OpenMP parallel
2178 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2179 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2180 compiler generates parallel code according to the OpenMP Application
2181 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2182 implies @option{-pthread}, and thus is only supported on targets that
2183 have support for @option{-pthread}. @option{-fopenmp} implies
2184 @option{-fopenmp-simd}.
2185
2186 @item -fopenmp-simd
2187 @opindex fopenmp-simd
2188 @cindex OpenMP SIMD
2189 @cindex SIMD
2190 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2191 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2192 are ignored.
2193
2194 @item -fgnu-tm
2195 @opindex fgnu-tm
2196 When the option @option{-fgnu-tm} is specified, the compiler
2197 generates code for the Linux variant of Intel's current Transactional
2198 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2199 an experimental feature whose interface may change in future versions
2200 of GCC, as the official specification changes. Please note that not
2201 all architectures are supported for this feature.
2202
2203 For more information on GCC's support for transactional memory,
2204 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2205 Transactional Memory Library}.
2206
2207 Note that the transactional memory feature is not supported with
2208 non-call exceptions (@option{-fnon-call-exceptions}).
2209
2210 @item -fms-extensions
2211 @opindex fms-extensions
2212 Accept some non-standard constructs used in Microsoft header files.
2213
2214 In C++ code, this allows member names in structures to be similar
2215 to previous types declarations.
2216
2217 @smallexample
2218 typedef int UOW;
2219 struct ABC @{
2220 UOW UOW;
2221 @};
2222 @end smallexample
2223
2224 Some cases of unnamed fields in structures and unions are only
2225 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2226 fields within structs/unions}, for details.
2227
2228 Note that this option is off for all targets but x86
2229 targets using ms-abi.
2230
2231 @item -fplan9-extensions
2232 @opindex fplan9-extensions
2233 Accept some non-standard constructs used in Plan 9 code.
2234
2235 This enables @option{-fms-extensions}, permits passing pointers to
2236 structures with anonymous fields to functions that expect pointers to
2237 elements of the type of the field, and permits referring to anonymous
2238 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2239 struct/union fields within structs/unions}, for details. This is only
2240 supported for C, not C++.
2241
2242 @item -fcond-mismatch
2243 @opindex fcond-mismatch
2244 Allow conditional expressions with mismatched types in the second and
2245 third arguments. The value of such an expression is void. This option
2246 is not supported for C++.
2247
2248 @item -flax-vector-conversions
2249 @opindex flax-vector-conversions
2250 Allow implicit conversions between vectors with differing numbers of
2251 elements and/or incompatible element types. This option should not be
2252 used for new code.
2253
2254 @item -funsigned-char
2255 @opindex funsigned-char
2256 Let the type @code{char} be unsigned, like @code{unsigned char}.
2257
2258 Each kind of machine has a default for what @code{char} should
2259 be. It is either like @code{unsigned char} by default or like
2260 @code{signed char} by default.
2261
2262 Ideally, a portable program should always use @code{signed char} or
2263 @code{unsigned char} when it depends on the signedness of an object.
2264 But many programs have been written to use plain @code{char} and
2265 expect it to be signed, or expect it to be unsigned, depending on the
2266 machines they were written for. This option, and its inverse, let you
2267 make such a program work with the opposite default.
2268
2269 The type @code{char} is always a distinct type from each of
2270 @code{signed char} or @code{unsigned char}, even though its behavior
2271 is always just like one of those two.
2272
2273 @item -fsigned-char
2274 @opindex fsigned-char
2275 Let the type @code{char} be signed, like @code{signed char}.
2276
2277 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2278 the negative form of @option{-funsigned-char}. Likewise, the option
2279 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2280
2281 @item -fsigned-bitfields
2282 @itemx -funsigned-bitfields
2283 @itemx -fno-signed-bitfields
2284 @itemx -fno-unsigned-bitfields
2285 @opindex fsigned-bitfields
2286 @opindex funsigned-bitfields
2287 @opindex fno-signed-bitfields
2288 @opindex fno-unsigned-bitfields
2289 These options control whether a bit-field is signed or unsigned, when the
2290 declaration does not use either @code{signed} or @code{unsigned}. By
2291 default, such a bit-field is signed, because this is consistent: the
2292 basic integer types such as @code{int} are signed types.
2293
2294 @item -fsso-struct=@var{endianness}
2295 @opindex fsso-struct
2296 Set the default scalar storage order of structures and unions to the
2297 specified endianness. The accepted values are @samp{big-endian},
2298 @samp{little-endian} and @samp{native} for the native endianness of
2299 the target (the default). This option is not supported for C++.
2300
2301 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2302 code that is not binary compatible with code generated without it if the
2303 specified endianness is not the native endianness of the target.
2304 @end table
2305
2306 @node C++ Dialect Options
2307 @section Options Controlling C++ Dialect
2308
2309 @cindex compiler options, C++
2310 @cindex C++ options, command-line
2311 @cindex options, C++
2312 This section describes the command-line options that are only meaningful
2313 for C++ programs. You can also use most of the GNU compiler options
2314 regardless of what language your program is in. For example, you
2315 might compile a file @file{firstClass.C} like this:
2316
2317 @smallexample
2318 g++ -g -fstrict-enums -O -c firstClass.C
2319 @end smallexample
2320
2321 @noindent
2322 In this example, only @option{-fstrict-enums} is an option meant
2323 only for C++ programs; you can use the other options with any
2324 language supported by GCC@.
2325
2326 Some options for compiling C programs, such as @option{-std}, are also
2327 relevant for C++ programs.
2328 @xref{C Dialect Options,,Options Controlling C Dialect}.
2329
2330 Here is a list of options that are @emph{only} for compiling C++ programs:
2331
2332 @table @gcctabopt
2333
2334 @item -fabi-version=@var{n}
2335 @opindex fabi-version
2336 Use version @var{n} of the C++ ABI@. The default is version 0.
2337
2338 Version 0 refers to the version conforming most closely to
2339 the C++ ABI specification. Therefore, the ABI obtained using version 0
2340 will change in different versions of G++ as ABI bugs are fixed.
2341
2342 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2343
2344 Version 2 is the version of the C++ ABI that first appeared in G++
2345 3.4, and was the default through G++ 4.9.
2346
2347 Version 3 corrects an error in mangling a constant address as a
2348 template argument.
2349
2350 Version 4, which first appeared in G++ 4.5, implements a standard
2351 mangling for vector types.
2352
2353 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2354 attribute const/volatile on function pointer types, decltype of a
2355 plain decl, and use of a function parameter in the declaration of
2356 another parameter.
2357
2358 Version 6, which first appeared in G++ 4.7, corrects the promotion
2359 behavior of C++11 scoped enums and the mangling of template argument
2360 packs, const/static_cast, prefix ++ and --, and a class scope function
2361 used as a template argument.
2362
2363 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2364 builtin type and corrects the mangling of lambdas in default argument
2365 scope.
2366
2367 Version 8, which first appeared in G++ 4.9, corrects the substitution
2368 behavior of function types with function-cv-qualifiers.
2369
2370 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2371 @code{nullptr_t}.
2372
2373 Version 10, which first appeared in G++ 6.1, adds mangling of
2374 attributes that affect type identity, such as ia32 calling convention
2375 attributes (e.g.@: @samp{stdcall}).
2376
2377 Version 11, which first appeared in G++ 7, corrects the mangling of
2378 sizeof... expressions and operator names. For multiple entities with
2379 the same name within a function, that are declared in different scopes,
2380 the mangling now changes starting with the twelfth occurrence. It also
2381 implies @option{-fnew-inheriting-ctors}.
2382
2383 Version 12, which first appeared in G++ 8, corrects the calling
2384 conventions for empty classes on the x86_64 target and for classes
2385 with only deleted copy/move constructors. It accidentally changes the
2386 calling convention for classes with a deleted copy constructor and a
2387 trivial move constructor.
2388
2389 Version 13, which first appeared in G++ 8.2, fixes the accidental
2390 change in version 12.
2391
2392 See also @option{-Wabi}.
2393
2394 @item -fabi-compat-version=@var{n}
2395 @opindex fabi-compat-version
2396 On targets that support strong aliases, G++
2397 works around mangling changes by creating an alias with the correct
2398 mangled name when defining a symbol with an incorrect mangled name.
2399 This switch specifies which ABI version to use for the alias.
2400
2401 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2402 compatibility). If another ABI version is explicitly selected, this
2403 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2404 use @option{-fabi-compat-version=2}.
2405
2406 If this option is not provided but @option{-Wabi=@var{n}} is, that
2407 version is used for compatibility aliases. If this option is provided
2408 along with @option{-Wabi} (without the version), the version from this
2409 option is used for the warning.
2410
2411 @item -fno-access-control
2412 @opindex fno-access-control
2413 @opindex faccess-control
2414 Turn off all access checking. This switch is mainly useful for working
2415 around bugs in the access control code.
2416
2417 @item -faligned-new
2418 @opindex faligned-new
2419 Enable support for C++17 @code{new} of types that require more
2420 alignment than @code{void* ::operator new(std::size_t)} provides. A
2421 numeric argument such as @code{-faligned-new=32} can be used to
2422 specify how much alignment (in bytes) is provided by that function,
2423 but few users will need to override the default of
2424 @code{alignof(std::max_align_t)}.
2425
2426 This flag is enabled by default for @option{-std=c++17}.
2427
2428 @item -fcheck-new
2429 @opindex fcheck-new
2430 Check that the pointer returned by @code{operator new} is non-null
2431 before attempting to modify the storage allocated. This check is
2432 normally unnecessary because the C++ standard specifies that
2433 @code{operator new} only returns @code{0} if it is declared
2434 @code{throw()}, in which case the compiler always checks the
2435 return value even without this option. In all other cases, when
2436 @code{operator new} has a non-empty exception specification, memory
2437 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2438 @samp{new (nothrow)}.
2439
2440 @item -fconcepts
2441 @opindex fconcepts
2442 Enable support for the C++ Extensions for Concepts Technical
2443 Specification, ISO 19217 (2015), which allows code like
2444
2445 @smallexample
2446 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2447 template <Addable T> T add (T a, T b) @{ return a + b; @}
2448 @end smallexample
2449
2450 @item -fconstexpr-depth=@var{n}
2451 @opindex fconstexpr-depth
2452 Set the maximum nested evaluation depth for C++11 constexpr functions
2453 to @var{n}. A limit is needed to detect endless recursion during
2454 constant expression evaluation. The minimum specified by the standard
2455 is 512.
2456
2457 @item -fconstexpr-loop-limit=@var{n}
2458 @opindex fconstexpr-loop-limit
2459 Set the maximum number of iterations for a loop in C++14 constexpr functions
2460 to @var{n}. A limit is needed to detect infinite loops during
2461 constant expression evaluation. The default is 262144 (1<<18).
2462
2463 @item -fdeduce-init-list
2464 @opindex fdeduce-init-list
2465 Enable deduction of a template type parameter as
2466 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2467
2468 @smallexample
2469 template <class T> auto forward(T t) -> decltype (realfn (t))
2470 @{
2471 return realfn (t);
2472 @}
2473
2474 void f()
2475 @{
2476 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2477 @}
2478 @end smallexample
2479
2480 This deduction was implemented as a possible extension to the
2481 originally proposed semantics for the C++11 standard, but was not part
2482 of the final standard, so it is disabled by default. This option is
2483 deprecated, and may be removed in a future version of G++.
2484
2485 @item -fno-elide-constructors
2486 @opindex fno-elide-constructors
2487 @opindex felide-constructors
2488 The C++ standard allows an implementation to omit creating a temporary
2489 that is only used to initialize another object of the same type.
2490 Specifying this option disables that optimization, and forces G++ to
2491 call the copy constructor in all cases. This option also causes G++
2492 to call trivial member functions which otherwise would be expanded inline.
2493
2494 In C++17, the compiler is required to omit these temporaries, but this
2495 option still affects trivial member functions.
2496
2497 @item -fno-enforce-eh-specs
2498 @opindex fno-enforce-eh-specs
2499 @opindex fenforce-eh-specs
2500 Don't generate code to check for violation of exception specifications
2501 at run time. This option violates the C++ standard, but may be useful
2502 for reducing code size in production builds, much like defining
2503 @code{NDEBUG}. This does not give user code permission to throw
2504 exceptions in violation of the exception specifications; the compiler
2505 still optimizes based on the specifications, so throwing an
2506 unexpected exception results in undefined behavior at run time.
2507
2508 @item -fextern-tls-init
2509 @itemx -fno-extern-tls-init
2510 @opindex fextern-tls-init
2511 @opindex fno-extern-tls-init
2512 The C++11 and OpenMP standards allow @code{thread_local} and
2513 @code{threadprivate} variables to have dynamic (runtime)
2514 initialization. To support this, any use of such a variable goes
2515 through a wrapper function that performs any necessary initialization.
2516 When the use and definition of the variable are in the same
2517 translation unit, this overhead can be optimized away, but when the
2518 use is in a different translation unit there is significant overhead
2519 even if the variable doesn't actually need dynamic initialization. If
2520 the programmer can be sure that no use of the variable in a
2521 non-defining TU needs to trigger dynamic initialization (either
2522 because the variable is statically initialized, or a use of the
2523 variable in the defining TU will be executed before any uses in
2524 another TU), they can avoid this overhead with the
2525 @option{-fno-extern-tls-init} option.
2526
2527 On targets that support symbol aliases, the default is
2528 @option{-fextern-tls-init}. On targets that do not support symbol
2529 aliases, the default is @option{-fno-extern-tls-init}.
2530
2531 @item -fno-gnu-keywords
2532 @opindex fno-gnu-keywords
2533 @opindex fgnu-keywords
2534 Do not recognize @code{typeof} as a keyword, so that code can use this
2535 word as an identifier. You can use the keyword @code{__typeof__} instead.
2536 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2537 @option{-std=c++98}, @option{-std=c++11}, etc.
2538
2539 @item -fno-implicit-templates
2540 @opindex fno-implicit-templates
2541 @opindex fimplicit-templates
2542 Never emit code for non-inline templates that are instantiated
2543 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2544 If you use this option, you must take care to structure your code to
2545 include all the necessary explicit instantiations to avoid getting
2546 undefined symbols at link time.
2547 @xref{Template Instantiation}, for more information.
2548
2549 @item -fno-implicit-inline-templates
2550 @opindex fno-implicit-inline-templates
2551 @opindex fimplicit-inline-templates
2552 Don't emit code for implicit instantiations of inline templates, either.
2553 The default is to handle inlines differently so that compiles with and
2554 without optimization need the same set of explicit instantiations.
2555
2556 @item -fno-implement-inlines
2557 @opindex fno-implement-inlines
2558 @opindex fimplement-inlines
2559 To save space, do not emit out-of-line copies of inline functions
2560 controlled by @code{#pragma implementation}. This causes linker
2561 errors if these functions are not inlined everywhere they are called.
2562
2563 @item -fms-extensions
2564 @opindex fms-extensions
2565 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2566 int and getting a pointer to member function via non-standard syntax.
2567
2568 @item -fnew-inheriting-ctors
2569 @opindex fnew-inheriting-ctors
2570 Enable the P0136 adjustment to the semantics of C++11 constructor
2571 inheritance. This is part of C++17 but also considered to be a Defect
2572 Report against C++11 and C++14. This flag is enabled by default
2573 unless @option{-fabi-version=10} or lower is specified.
2574
2575 @item -fnew-ttp-matching
2576 @opindex fnew-ttp-matching
2577 Enable the P0522 resolution to Core issue 150, template template
2578 parameters and default arguments: this allows a template with default
2579 template arguments as an argument for a template template parameter
2580 with fewer template parameters. This flag is enabled by default for
2581 @option{-std=c++17}.
2582
2583 @item -fno-nonansi-builtins
2584 @opindex fno-nonansi-builtins
2585 @opindex fnonansi-builtins
2586 Disable built-in declarations of functions that are not mandated by
2587 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2588 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2589
2590 @item -fnothrow-opt
2591 @opindex fnothrow-opt
2592 Treat a @code{throw()} exception specification as if it were a
2593 @code{noexcept} specification to reduce or eliminate the text size
2594 overhead relative to a function with no exception specification. If
2595 the function has local variables of types with non-trivial
2596 destructors, the exception specification actually makes the
2597 function smaller because the EH cleanups for those variables can be
2598 optimized away. The semantic effect is that an exception thrown out of
2599 a function with such an exception specification results in a call
2600 to @code{terminate} rather than @code{unexpected}.
2601
2602 @item -fno-operator-names
2603 @opindex fno-operator-names
2604 @opindex foperator-names
2605 Do not treat the operator name keywords @code{and}, @code{bitand},
2606 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2607 synonyms as keywords.
2608
2609 @item -fno-optional-diags
2610 @opindex fno-optional-diags
2611 @opindex foptional-diags
2612 Disable diagnostics that the standard says a compiler does not need to
2613 issue. Currently, the only such diagnostic issued by G++ is the one for
2614 a name having multiple meanings within a class.
2615
2616 @item -fpermissive
2617 @opindex fpermissive
2618 Downgrade some diagnostics about nonconformant code from errors to
2619 warnings. Thus, using @option{-fpermissive} allows some
2620 nonconforming code to compile.
2621
2622 @item -fno-pretty-templates
2623 @opindex fno-pretty-templates
2624 @opindex fpretty-templates
2625 When an error message refers to a specialization of a function
2626 template, the compiler normally prints the signature of the
2627 template followed by the template arguments and any typedefs or
2628 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2629 rather than @code{void f(int)}) so that it's clear which template is
2630 involved. When an error message refers to a specialization of a class
2631 template, the compiler omits any template arguments that match
2632 the default template arguments for that template. If either of these
2633 behaviors make it harder to understand the error message rather than
2634 easier, you can use @option{-fno-pretty-templates} to disable them.
2635
2636 @item -frepo
2637 @opindex frepo
2638 Enable automatic template instantiation at link time. This option also
2639 implies @option{-fno-implicit-templates}. @xref{Template
2640 Instantiation}, for more information.
2641
2642 @item -fno-rtti
2643 @opindex fno-rtti
2644 @opindex frtti
2645 Disable generation of information about every class with virtual
2646 functions for use by the C++ run-time type identification features
2647 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2648 of the language, you can save some space by using this flag. Note that
2649 exception handling uses the same information, but G++ generates it as
2650 needed. The @code{dynamic_cast} operator can still be used for casts that
2651 do not require run-time type information, i.e.@: casts to @code{void *} or to
2652 unambiguous base classes.
2653
2654 Mixing code compiled with @option{-frtti} with that compiled with
2655 @option{-fno-rtti} may not work. For example, programs may
2656 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2657 for a class compiled with @option{-frtti}.
2658
2659 @item -fsized-deallocation
2660 @opindex fsized-deallocation
2661 Enable the built-in global declarations
2662 @smallexample
2663 void operator delete (void *, std::size_t) noexcept;
2664 void operator delete[] (void *, std::size_t) noexcept;
2665 @end smallexample
2666 as introduced in C++14. This is useful for user-defined replacement
2667 deallocation functions that, for example, use the size of the object
2668 to make deallocation faster. Enabled by default under
2669 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2670 warns about places that might want to add a definition.
2671
2672 @item -fstrict-enums
2673 @opindex fstrict-enums
2674 Allow the compiler to optimize using the assumption that a value of
2675 enumerated type can only be one of the values of the enumeration (as
2676 defined in the C++ standard; basically, a value that can be
2677 represented in the minimum number of bits needed to represent all the
2678 enumerators). This assumption may not be valid if the program uses a
2679 cast to convert an arbitrary integer value to the enumerated type.
2680
2681 @item -fstrong-eval-order
2682 @opindex fstrong-eval-order
2683 Evaluate member access, array subscripting, and shift expressions in
2684 left-to-right order, and evaluate assignment in right-to-left order,
2685 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2686 @option{-fstrong-eval-order=some} enables just the ordering of member
2687 access and shift expressions, and is the default without
2688 @option{-std=c++17}.
2689
2690 @item -ftemplate-backtrace-limit=@var{n}
2691 @opindex ftemplate-backtrace-limit
2692 Set the maximum number of template instantiation notes for a single
2693 warning or error to @var{n}. The default value is 10.
2694
2695 @item -ftemplate-depth=@var{n}
2696 @opindex ftemplate-depth
2697 Set the maximum instantiation depth for template classes to @var{n}.
2698 A limit on the template instantiation depth is needed to detect
2699 endless recursions during template class instantiation. ANSI/ISO C++
2700 conforming programs must not rely on a maximum depth greater than 17
2701 (changed to 1024 in C++11). The default value is 900, as the compiler
2702 can run out of stack space before hitting 1024 in some situations.
2703
2704 @item -fno-threadsafe-statics
2705 @opindex fno-threadsafe-statics
2706 @opindex fthreadsafe-statics
2707 Do not emit the extra code to use the routines specified in the C++
2708 ABI for thread-safe initialization of local statics. You can use this
2709 option to reduce code size slightly in code that doesn't need to be
2710 thread-safe.
2711
2712 @item -fuse-cxa-atexit
2713 @opindex fuse-cxa-atexit
2714 Register destructors for objects with static storage duration with the
2715 @code{__cxa_atexit} function rather than the @code{atexit} function.
2716 This option is required for fully standards-compliant handling of static
2717 destructors, but only works if your C library supports
2718 @code{__cxa_atexit}.
2719
2720 @item -fno-use-cxa-get-exception-ptr
2721 @opindex fno-use-cxa-get-exception-ptr
2722 @opindex fuse-cxa-get-exception-ptr
2723 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2724 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2725 if the runtime routine is not available.
2726
2727 @item -fvisibility-inlines-hidden
2728 @opindex fvisibility-inlines-hidden
2729 This switch declares that the user does not attempt to compare
2730 pointers to inline functions or methods where the addresses of the two functions
2731 are taken in different shared objects.
2732
2733 The effect of this is that GCC may, effectively, mark inline methods with
2734 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2735 appear in the export table of a DSO and do not require a PLT indirection
2736 when used within the DSO@. Enabling this option can have a dramatic effect
2737 on load and link times of a DSO as it massively reduces the size of the
2738 dynamic export table when the library makes heavy use of templates.
2739
2740 The behavior of this switch is not quite the same as marking the
2741 methods as hidden directly, because it does not affect static variables
2742 local to the function or cause the compiler to deduce that
2743 the function is defined in only one shared object.
2744
2745 You may mark a method as having a visibility explicitly to negate the
2746 effect of the switch for that method. For example, if you do want to
2747 compare pointers to a particular inline method, you might mark it as
2748 having default visibility. Marking the enclosing class with explicit
2749 visibility has no effect.
2750
2751 Explicitly instantiated inline methods are unaffected by this option
2752 as their linkage might otherwise cross a shared library boundary.
2753 @xref{Template Instantiation}.
2754
2755 @item -fvisibility-ms-compat
2756 @opindex fvisibility-ms-compat
2757 This flag attempts to use visibility settings to make GCC's C++
2758 linkage model compatible with that of Microsoft Visual Studio.
2759
2760 The flag makes these changes to GCC's linkage model:
2761
2762 @enumerate
2763 @item
2764 It sets the default visibility to @code{hidden}, like
2765 @option{-fvisibility=hidden}.
2766
2767 @item
2768 Types, but not their members, are not hidden by default.
2769
2770 @item
2771 The One Definition Rule is relaxed for types without explicit
2772 visibility specifications that are defined in more than one
2773 shared object: those declarations are permitted if they are
2774 permitted when this option is not used.
2775 @end enumerate
2776
2777 In new code it is better to use @option{-fvisibility=hidden} and
2778 export those classes that are intended to be externally visible.
2779 Unfortunately it is possible for code to rely, perhaps accidentally,
2780 on the Visual Studio behavior.
2781
2782 Among the consequences of these changes are that static data members
2783 of the same type with the same name but defined in different shared
2784 objects are different, so changing one does not change the other;
2785 and that pointers to function members defined in different shared
2786 objects may not compare equal. When this flag is given, it is a
2787 violation of the ODR to define types with the same name differently.
2788
2789 @item -fno-weak
2790 @opindex fno-weak
2791 @opindex fweak
2792 Do not use weak symbol support, even if it is provided by the linker.
2793 By default, G++ uses weak symbols if they are available. This
2794 option exists only for testing, and should not be used by end-users;
2795 it results in inferior code and has no benefits. This option may
2796 be removed in a future release of G++.
2797
2798 @item -nostdinc++
2799 @opindex nostdinc++
2800 Do not search for header files in the standard directories specific to
2801 C++, but do still search the other standard directories. (This option
2802 is used when building the C++ library.)
2803 @end table
2804
2805 In addition, these optimization, warning, and code generation options
2806 have meanings only for C++ programs:
2807
2808 @table @gcctabopt
2809 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2810 @opindex Wabi
2811 @opindex Wno-abi
2812 Warn when G++ it generates code that is probably not compatible with
2813 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2814 ABI with each major release, normally @option{-Wabi} will warn only if
2815 there is a check added later in a release series for an ABI issue
2816 discovered since the initial release. @option{-Wabi} will warn about
2817 more things if an older ABI version is selected (with
2818 @option{-fabi-version=@var{n}}).
2819
2820 @option{-Wabi} can also be used with an explicit version number to
2821 warn about compatibility with a particular @option{-fabi-version}
2822 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2823 @option{-fabi-version=2}.
2824
2825 If an explicit version number is provided and
2826 @option{-fabi-compat-version} is not specified, the version number
2827 from this option is used for compatibility aliases. If no explicit
2828 version number is provided with this option, but
2829 @option{-fabi-compat-version} is specified, that version number is
2830 used for ABI warnings.
2831
2832 Although an effort has been made to warn about
2833 all such cases, there are probably some cases that are not warned about,
2834 even though G++ is generating incompatible code. There may also be
2835 cases where warnings are emitted even though the code that is generated
2836 is compatible.
2837
2838 You should rewrite your code to avoid these warnings if you are
2839 concerned about the fact that code generated by G++ may not be binary
2840 compatible with code generated by other compilers.
2841
2842 Known incompatibilities in @option{-fabi-version=2} (which was the
2843 default from GCC 3.4 to 4.9) include:
2844
2845 @itemize @bullet
2846
2847 @item
2848 A template with a non-type template parameter of reference type was
2849 mangled incorrectly:
2850 @smallexample
2851 extern int N;
2852 template <int &> struct S @{@};
2853 void n (S<N>) @{2@}
2854 @end smallexample
2855
2856 This was fixed in @option{-fabi-version=3}.
2857
2858 @item
2859 SIMD vector types declared using @code{__attribute ((vector_size))} were
2860 mangled in a non-standard way that does not allow for overloading of
2861 functions taking vectors of different sizes.
2862
2863 The mangling was changed in @option{-fabi-version=4}.
2864
2865 @item
2866 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2867 qualifiers, and @code{decltype} of a plain declaration was folded away.
2868
2869 These mangling issues were fixed in @option{-fabi-version=5}.
2870
2871 @item
2872 Scoped enumerators passed as arguments to a variadic function are
2873 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2874 On most targets this does not actually affect the parameter passing
2875 ABI, as there is no way to pass an argument smaller than @code{int}.
2876
2877 Also, the ABI changed the mangling of template argument packs,
2878 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2879 a class scope function used as a template argument.
2880
2881 These issues were corrected in @option{-fabi-version=6}.
2882
2883 @item
2884 Lambdas in default argument scope were mangled incorrectly, and the
2885 ABI changed the mangling of @code{nullptr_t}.
2886
2887 These issues were corrected in @option{-fabi-version=7}.
2888
2889 @item
2890 When mangling a function type with function-cv-qualifiers, the
2891 un-qualified function type was incorrectly treated as a substitution
2892 candidate.
2893
2894 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2895
2896 @item
2897 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2898 unaligned accesses. Note that this did not affect the ABI of a
2899 function with a @code{nullptr_t} parameter, as parameters have a
2900 minimum alignment.
2901
2902 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2903
2904 @item
2905 Target-specific attributes that affect the identity of a type, such as
2906 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2907 did not affect the mangled name, leading to name collisions when
2908 function pointers were used as template arguments.
2909
2910 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2911
2912 @end itemize
2913
2914 It also warns about psABI-related changes. The known psABI changes at this
2915 point include:
2916
2917 @itemize @bullet
2918
2919 @item
2920 For SysV/x86-64, unions with @code{long double} members are
2921 passed in memory as specified in psABI. For example:
2922
2923 @smallexample
2924 union U @{
2925 long double ld;
2926 int i;
2927 @};
2928 @end smallexample
2929
2930 @noindent
2931 @code{union U} is always passed in memory.
2932
2933 @end itemize
2934
2935 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2936 @opindex Wabi-tag
2937 @opindex Wabi-tag
2938 Warn when a type with an ABI tag is used in a context that does not
2939 have that ABI tag. See @ref{C++ Attributes} for more information
2940 about ABI tags.
2941
2942 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2943 @opindex Wctor-dtor-privacy
2944 @opindex Wno-ctor-dtor-privacy
2945 Warn when a class seems unusable because all the constructors or
2946 destructors in that class are private, and it has neither friends nor
2947 public static member functions. Also warn if there are no non-private
2948 methods, and there's at least one private member function that isn't
2949 a constructor or destructor.
2950
2951 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2952 @opindex Wdelete-non-virtual-dtor
2953 @opindex Wno-delete-non-virtual-dtor
2954 Warn when @code{delete} is used to destroy an instance of a class that
2955 has virtual functions and non-virtual destructor. It is unsafe to delete
2956 an instance of a derived class through a pointer to a base class if the
2957 base class does not have a virtual destructor. This warning is enabled
2958 by @option{-Wall}.
2959
2960 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2961 @opindex Wdeprecated-copy
2962 @opindex Wno-deprecated-copy
2963 Warn that the implicit declaration of a copy constructor or copy
2964 assignment operator is deprecated if the class has a user-provided
2965 copy constructor or copy assignment operator, in C++11 and up. This
2966 warning is enabled by @option{-Wextra}. With
2967 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
2968 user-provided destructor.
2969
2970 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2971 @opindex Winit-list-lifetime
2972 @opindex Wno-init-list-lifetime
2973 Do not warn about uses of @code{std::initializer_list} that are likely
2974 to result in dangling pointers. Since the underlying array for an
2975 @code{initializer_list} is handled like a normal C++ temporary object,
2976 it is easy to inadvertently keep a pointer to the array past the end
2977 of the array's lifetime. For example:
2978
2979 @itemize @bullet
2980 @item
2981 If a function returns a temporary @code{initializer_list}, or a local
2982 @code{initializer_list} variable, the array's lifetime ends at the end
2983 of the return statement, so the value returned has a dangling pointer.
2984
2985 @item
2986 If a new-expression creates an @code{initializer_list}, the array only
2987 lives until the end of the enclosing full-expression, so the
2988 @code{initializer_list} in the heap has a dangling pointer.
2989
2990 @item
2991 When an @code{initializer_list} variable is assigned from a
2992 brace-enclosed initializer list, the temporary array created for the
2993 right side of the assignment only lives until the end of the
2994 full-expression, so at the next statement the @code{initializer_list}
2995 variable has a dangling pointer.
2996
2997 @smallexample
2998 // li's initial underlying array lives as long as li
2999 std::initializer_list<int> li = @{ 1,2,3 @};
3000 // assignment changes li to point to a temporary array
3001 li = @{ 4, 5 @};
3002 // now the temporary is gone and li has a dangling pointer
3003 int i = li.begin()[0] // undefined behavior
3004 @end smallexample
3005
3006 @item
3007 When a list constructor stores the @code{begin} pointer from the
3008 @code{initializer_list} argument, this doesn't extend the lifetime of
3009 the array, so if a class variable is constructed from a temporary
3010 @code{initializer_list}, the pointer is left dangling by the end of
3011 the variable declaration statement.
3012
3013 @end itemize
3014
3015 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3016 @opindex Wliteral-suffix
3017 @opindex Wno-literal-suffix
3018 Warn when a string or character literal is followed by a ud-suffix which does
3019 not begin with an underscore. As a conforming extension, GCC treats such
3020 suffixes as separate preprocessing tokens in order to maintain backwards
3021 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3022 For example:
3023
3024 @smallexample
3025 #define __STDC_FORMAT_MACROS
3026 #include <inttypes.h>
3027 #include <stdio.h>
3028
3029 int main() @{
3030 int64_t i64 = 123;
3031 printf("My int64: %" PRId64"\n", i64);
3032 @}
3033 @end smallexample
3034
3035 In this case, @code{PRId64} is treated as a separate preprocessing token.
3036
3037 Additionally, warn when a user-defined literal operator is declared with
3038 a literal suffix identifier that doesn't begin with an underscore. Literal
3039 suffix identifiers that don't begin with an underscore are reserved for
3040 future standardization.
3041
3042 This warning is enabled by default.
3043
3044 @item -Wlto-type-mismatch
3045 @opindex Wlto-type-mismatch
3046 @opindex Wno-lto-type-mismatch
3047
3048 During the link-time optimization warn about type mismatches in
3049 global declarations from different compilation units.
3050 Requires @option{-flto} to be enabled. Enabled by default.
3051
3052 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3053 @opindex Wnarrowing
3054 @opindex Wno-narrowing
3055 For C++11 and later standards, narrowing conversions are diagnosed by default,
3056 as required by the standard. A narrowing conversion from a constant produces
3057 an error, and a narrowing conversion from a non-constant produces a warning,
3058 but @option{-Wno-narrowing} suppresses the diagnostic.
3059 Note that this does not affect the meaning of well-formed code;
3060 narrowing conversions are still considered ill-formed in SFINAE contexts.
3061
3062 With @option{-Wnarrowing} in C++98, warn when a narrowing
3063 conversion prohibited by C++11 occurs within
3064 @samp{@{ @}}, e.g.
3065
3066 @smallexample
3067 int i = @{ 2.2 @}; // error: narrowing from double to int
3068 @end smallexample
3069
3070 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3071
3072 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3073 @opindex Wnoexcept
3074 @opindex Wno-noexcept
3075 Warn when a noexcept-expression evaluates to false because of a call
3076 to a function that does not have a non-throwing exception
3077 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3078 the compiler to never throw an exception.
3079
3080 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3081 @opindex Wnoexcept-type
3082 @opindex Wno-noexcept-type
3083 Warn if the C++17 feature making @code{noexcept} part of a function
3084 type changes the mangled name of a symbol relative to C++14. Enabled
3085 by @option{-Wabi} and @option{-Wc++17-compat}.
3086
3087 As an example:
3088
3089 @smallexample
3090 template <class T> void f(T t) @{ t(); @};
3091 void g() noexcept;
3092 void h() @{ f(g); @}
3093 @end smallexample
3094
3095 @noindent
3096 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3097 C++17 it calls @code{f<void(*)()noexcept>}.
3098
3099 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3100 @opindex Wclass-memaccess
3101 @opindex Wno-class-memaccess
3102 Warn when the destination of a call to a raw memory function such as
3103 @code{memset} or @code{memcpy} is an object of class type, and when writing
3104 into such an object might bypass the class non-trivial or deleted constructor
3105 or copy assignment, violate const-correctness or encapsulation, or corrupt
3106 virtual table pointers. Modifying the representation of such objects may
3107 violate invariants maintained by member functions of the class. For example,
3108 the call to @code{memset} below is undefined because it modifies a non-trivial
3109 class object and is, therefore, diagnosed. The safe way to either initialize
3110 or clear the storage of objects of such types is by using the appropriate
3111 constructor or assignment operator, if one is available.
3112 @smallexample
3113 std::string str = "abc";
3114 memset (&str, 0, sizeof str);
3115 @end smallexample
3116 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3117 Explicitly casting the pointer to the class object to @code{void *} or
3118 to a type that can be safely accessed by the raw memory function suppresses
3119 the warning.
3120
3121 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3122 @opindex Wnon-virtual-dtor
3123 @opindex Wno-non-virtual-dtor
3124 Warn when a class has virtual functions and an accessible non-virtual
3125 destructor itself or in an accessible polymorphic base class, in which
3126 case it is possible but unsafe to delete an instance of a derived
3127 class through a pointer to the class itself or base class. This
3128 warning is automatically enabled if @option{-Weffc++} is specified.
3129
3130 @item -Wregister @r{(C++ and Objective-C++ only)}
3131 @opindex Wregister
3132 @opindex Wno-register
3133 Warn on uses of the @code{register} storage class specifier, except
3134 when it is part of the GNU @ref{Explicit Register Variables} extension.
3135 The use of the @code{register} keyword as storage class specifier has
3136 been deprecated in C++11 and removed in C++17.
3137 Enabled by default with @option{-std=c++17}.
3138
3139 @item -Wreorder @r{(C++ and Objective-C++ only)}
3140 @opindex Wreorder
3141 @opindex Wno-reorder
3142 @cindex reordering, warning
3143 @cindex warning for reordering of member initializers
3144 Warn when the order of member initializers given in the code does not
3145 match the order in which they must be executed. For instance:
3146
3147 @smallexample
3148 struct A @{
3149 int i;
3150 int j;
3151 A(): j (0), i (1) @{ @}
3152 @};
3153 @end smallexample
3154
3155 @noindent
3156 The compiler rearranges the member initializers for @code{i}
3157 and @code{j} to match the declaration order of the members, emitting
3158 a warning to that effect. This warning is enabled by @option{-Wall}.
3159
3160 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3161 @opindex Wpessimizing-move
3162 @opindex Wno-pessimizing-move
3163 This warning warns when a call to @code{std::move} prevents copy
3164 elision. A typical scenario when copy elision can occur is when returning in
3165 a function with a class return type, when the expression being returned is the
3166 name of a non-volatile automatic object, and is not a function parameter, and
3167 has the same type as the function return type.
3168
3169 @smallexample
3170 struct T @{
3171 @dots{}
3172 @};
3173 T fn()
3174 @{
3175 T t;
3176 @dots{}
3177 return std::move (t);
3178 @}
3179 @end smallexample
3180
3181 But in this example, the @code{std::move} call prevents copy elision.
3182
3183 This warning is enabled by @option{-Wall}.
3184
3185 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3186 @opindex Wredundant-move
3187 @opindex Wno-redundant-move
3188 This warning warns about redundant calls to @code{std::move}; that is, when
3189 a move operation would have been performed even without the @code{std::move}
3190 call. This happens because the compiler is forced to treat the object as if
3191 it were an rvalue in certain situations such as returning a local variable,
3192 where copy elision isn't applicable. Consider:
3193
3194 @smallexample
3195 struct T @{
3196 @dots{}
3197 @};
3198 T fn(T t)
3199 @{
3200 @dots{}
3201 return std::move (t);
3202 @}
3203 @end smallexample
3204
3205 Here, the @code{std::move} call is redundant. Because G++ implements Core
3206 Issue 1579, another example is:
3207
3208 @smallexample
3209 struct T @{ // convertible to U
3210 @dots{}
3211 @};
3212 struct U @{
3213 @dots{}
3214 @};
3215 U fn()
3216 @{
3217 T t;
3218 @dots{}
3219 return std::move (t);
3220 @}
3221 @end smallexample
3222 In this example, copy elision isn't applicable because the type of the
3223 expression being returned and the function return type differ, yet G++
3224 treats the return value as if it were designated by an rvalue.
3225
3226 This warning is enabled by @option{-Wextra}.
3227
3228 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3229 @opindex fext-numeric-literals
3230 @opindex fno-ext-numeric-literals
3231 Accept imaginary, fixed-point, or machine-defined
3232 literal number suffixes as GNU extensions.
3233 When this option is turned off these suffixes are treated
3234 as C++11 user-defined literal numeric suffixes.
3235 This is on by default for all pre-C++11 dialects and all GNU dialects:
3236 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3237 @option{-std=gnu++14}.
3238 This option is off by default
3239 for ISO C++11 onwards (@option{-std=c++11}, ...).
3240 @end table
3241
3242 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3243
3244 @table @gcctabopt
3245 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3246 @opindex Weffc++
3247 @opindex Wno-effc++
3248 Warn about violations of the following style guidelines from Scott Meyers'
3249 @cite{Effective C++} series of books:
3250
3251 @itemize @bullet
3252 @item
3253 Define a copy constructor and an assignment operator for classes
3254 with dynamically-allocated memory.
3255
3256 @item
3257 Prefer initialization to assignment in constructors.
3258
3259 @item
3260 Have @code{operator=} return a reference to @code{*this}.
3261
3262 @item
3263 Don't try to return a reference when you must return an object.
3264
3265 @item
3266 Distinguish between prefix and postfix forms of increment and
3267 decrement operators.
3268
3269 @item
3270 Never overload @code{&&}, @code{||}, or @code{,}.
3271
3272 @end itemize
3273
3274 This option also enables @option{-Wnon-virtual-dtor}, which is also
3275 one of the effective C++ recommendations. However, the check is
3276 extended to warn about the lack of virtual destructor in accessible
3277 non-polymorphic bases classes too.
3278
3279 When selecting this option, be aware that the standard library
3280 headers do not obey all of these guidelines; use @samp{grep -v}
3281 to filter out those warnings.
3282
3283 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3284 @opindex Wstrict-null-sentinel
3285 @opindex Wno-strict-null-sentinel
3286 Warn about the use of an uncasted @code{NULL} as sentinel. When
3287 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3288 to @code{__null}. Although it is a null pointer constant rather than a
3289 null pointer, it is guaranteed to be of the same size as a pointer.
3290 But this use is not portable across different compilers.
3291
3292 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3293 @opindex Wno-non-template-friend
3294 @opindex Wnon-template-friend
3295 Disable warnings when non-template friend functions are declared
3296 within a template. In very old versions of GCC that predate implementation
3297 of the ISO standard, declarations such as
3298 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3299 could be interpreted as a particular specialization of a template
3300 function; the warning exists to diagnose compatibility problems,
3301 and is enabled by default.
3302
3303 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3304 @opindex Wold-style-cast
3305 @opindex Wno-old-style-cast
3306 Warn if an old-style (C-style) cast to a non-void type is used within
3307 a C++ program. The new-style casts (@code{dynamic_cast},
3308 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3309 less vulnerable to unintended effects and much easier to search for.
3310
3311 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3312 @opindex Woverloaded-virtual
3313 @opindex Wno-overloaded-virtual
3314 @cindex overloaded virtual function, warning
3315 @cindex warning for overloaded virtual function
3316 Warn when a function declaration hides virtual functions from a
3317 base class. For example, in:
3318
3319 @smallexample
3320 struct A @{
3321 virtual void f();
3322 @};
3323
3324 struct B: public A @{
3325 void f(int);
3326 @};
3327 @end smallexample
3328
3329 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3330 like:
3331
3332 @smallexample
3333 B* b;
3334 b->f();
3335 @end smallexample
3336
3337 @noindent
3338 fails to compile.
3339
3340 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3341 @opindex Wno-pmf-conversions
3342 @opindex Wpmf-conversions
3343 Disable the diagnostic for converting a bound pointer to member function
3344 to a plain pointer.
3345
3346 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3347 @opindex Wsign-promo
3348 @opindex Wno-sign-promo
3349 Warn when overload resolution chooses a promotion from unsigned or
3350 enumerated type to a signed type, over a conversion to an unsigned type of
3351 the same size. Previous versions of G++ tried to preserve
3352 unsignedness, but the standard mandates the current behavior.
3353
3354 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3355 @opindex Wtemplates
3356 @opindex Wno-templates
3357 Warn when a primary template declaration is encountered. Some coding
3358 rules disallow templates, and this may be used to enforce that rule.
3359 The warning is inactive inside a system header file, such as the STL, so
3360 one can still use the STL. One may also instantiate or specialize
3361 templates.
3362
3363 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3364 @opindex Wmultiple-inheritance
3365 @opindex Wno-multiple-inheritance
3366 Warn when a class is defined with multiple direct base classes. Some
3367 coding rules disallow multiple inheritance, and this may be used to
3368 enforce that rule. The warning is inactive inside a system header file,
3369 such as the STL, so one can still use the STL. One may also define
3370 classes that indirectly use multiple inheritance.
3371
3372 @item -Wvirtual-inheritance
3373 @opindex Wvirtual-inheritance
3374 @opindex Wno-virtual-inheritance
3375 Warn when a class is defined with a virtual direct base class. Some
3376 coding rules disallow multiple inheritance, and this may be used to
3377 enforce that rule. The warning is inactive inside a system header file,
3378 such as the STL, so one can still use the STL. One may also define
3379 classes that indirectly use virtual inheritance.
3380
3381 @item -Wnamespaces
3382 @opindex Wnamespaces
3383 @opindex Wno-namespaces
3384 Warn when a namespace definition is opened. Some coding rules disallow
3385 namespaces, and this may be used to enforce that rule. The warning is
3386 inactive inside a system header file, such as the STL, so one can still
3387 use the STL. One may also use using directives and qualified names.
3388
3389 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3390 @opindex Wterminate
3391 @opindex Wno-terminate
3392 Disable the warning about a throw-expression that will immediately
3393 result in a call to @code{terminate}.
3394
3395 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3396 @opindex Wno-class-conversion
3397 @opindex Wclass-conversion
3398 Disable the warning about the case when a conversion function converts an
3399 object to the same type, to a base class of that type, or to void; such
3400 a conversion function will never be called.
3401 @end table
3402
3403 @node Objective-C and Objective-C++ Dialect Options
3404 @section Options Controlling Objective-C and Objective-C++ Dialects
3405
3406 @cindex compiler options, Objective-C and Objective-C++
3407 @cindex Objective-C and Objective-C++ options, command-line
3408 @cindex options, Objective-C and Objective-C++
3409 (NOTE: This manual does not describe the Objective-C and Objective-C++
3410 languages themselves. @xref{Standards,,Language Standards
3411 Supported by GCC}, for references.)
3412
3413 This section describes the command-line options that are only meaningful
3414 for Objective-C and Objective-C++ programs. You can also use most of
3415 the language-independent GNU compiler options.
3416 For example, you might compile a file @file{some_class.m} like this:
3417
3418 @smallexample
3419 gcc -g -fgnu-runtime -O -c some_class.m
3420 @end smallexample
3421
3422 @noindent
3423 In this example, @option{-fgnu-runtime} is an option meant only for
3424 Objective-C and Objective-C++ programs; you can use the other options with
3425 any language supported by GCC@.
3426
3427 Note that since Objective-C is an extension of the C language, Objective-C
3428 compilations may also use options specific to the C front-end (e.g.,
3429 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3430 C++-specific options (e.g., @option{-Wabi}).
3431
3432 Here is a list of options that are @emph{only} for compiling Objective-C
3433 and Objective-C++ programs:
3434
3435 @table @gcctabopt
3436 @item -fconstant-string-class=@var{class-name}
3437 @opindex fconstant-string-class
3438 Use @var{class-name} as the name of the class to instantiate for each
3439 literal string specified with the syntax @code{@@"@dots{}"}. The default
3440 class name is @code{NXConstantString} if the GNU runtime is being used, and
3441 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3442 @option{-fconstant-cfstrings} option, if also present, overrides the
3443 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3444 to be laid out as constant CoreFoundation strings.
3445
3446 @item -fgnu-runtime
3447 @opindex fgnu-runtime
3448 Generate object code compatible with the standard GNU Objective-C
3449 runtime. This is the default for most types of systems.
3450
3451 @item -fnext-runtime
3452 @opindex fnext-runtime
3453 Generate output compatible with the NeXT runtime. This is the default
3454 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3455 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3456 used.
3457
3458 @item -fno-nil-receivers
3459 @opindex fno-nil-receivers
3460 @opindex fnil-receivers
3461 Assume that all Objective-C message dispatches (@code{[receiver
3462 message:arg]}) in this translation unit ensure that the receiver is
3463 not @code{nil}. This allows for more efficient entry points in the
3464 runtime to be used. This option is only available in conjunction with
3465 the NeXT runtime and ABI version 0 or 1.
3466
3467 @item -fobjc-abi-version=@var{n}
3468 @opindex fobjc-abi-version
3469 Use version @var{n} of the Objective-C ABI for the selected runtime.
3470 This option is currently supported only for the NeXT runtime. In that
3471 case, Version 0 is the traditional (32-bit) ABI without support for
3472 properties and other Objective-C 2.0 additions. Version 1 is the
3473 traditional (32-bit) ABI with support for properties and other
3474 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3475 nothing is specified, the default is Version 0 on 32-bit target
3476 machines, and Version 2 on 64-bit target machines.
3477
3478 @item -fobjc-call-cxx-cdtors
3479 @opindex fobjc-call-cxx-cdtors
3480 For each Objective-C class, check if any of its instance variables is a
3481 C++ object with a non-trivial default constructor. If so, synthesize a
3482 special @code{- (id) .cxx_construct} instance method which runs
3483 non-trivial default constructors on any such instance variables, in order,
3484 and then return @code{self}. Similarly, check if any instance variable
3485 is a C++ object with a non-trivial destructor, and if so, synthesize a
3486 special @code{- (void) .cxx_destruct} method which runs
3487 all such default destructors, in reverse order.
3488
3489 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3490 methods thusly generated only operate on instance variables
3491 declared in the current Objective-C class, and not those inherited
3492 from superclasses. It is the responsibility of the Objective-C
3493 runtime to invoke all such methods in an object's inheritance
3494 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3495 by the runtime immediately after a new object instance is allocated;
3496 the @code{- (void) .cxx_destruct} methods are invoked immediately
3497 before the runtime deallocates an object instance.
3498
3499 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3500 support for invoking the @code{- (id) .cxx_construct} and
3501 @code{- (void) .cxx_destruct} methods.
3502
3503 @item -fobjc-direct-dispatch
3504 @opindex fobjc-direct-dispatch
3505 Allow fast jumps to the message dispatcher. On Darwin this is
3506 accomplished via the comm page.
3507
3508 @item -fobjc-exceptions
3509 @opindex fobjc-exceptions
3510 Enable syntactic support for structured exception handling in
3511 Objective-C, similar to what is offered by C++. This option
3512 is required to use the Objective-C keywords @code{@@try},
3513 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3514 @code{@@synchronized}. This option is available with both the GNU
3515 runtime and the NeXT runtime (but not available in conjunction with
3516 the NeXT runtime on Mac OS X 10.2 and earlier).
3517
3518 @item -fobjc-gc
3519 @opindex fobjc-gc
3520 Enable garbage collection (GC) in Objective-C and Objective-C++
3521 programs. This option is only available with the NeXT runtime; the
3522 GNU runtime has a different garbage collection implementation that
3523 does not require special compiler flags.
3524
3525 @item -fobjc-nilcheck
3526 @opindex fobjc-nilcheck
3527 For the NeXT runtime with version 2 of the ABI, check for a nil
3528 receiver in method invocations before doing the actual method call.
3529 This is the default and can be disabled using
3530 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3531 checked for nil in this way no matter what this flag is set to.
3532 Currently this flag does nothing when the GNU runtime, or an older
3533 version of the NeXT runtime ABI, is used.
3534
3535 @item -fobjc-std=objc1
3536 @opindex fobjc-std
3537 Conform to the language syntax of Objective-C 1.0, the language
3538 recognized by GCC 4.0. This only affects the Objective-C additions to
3539 the C/C++ language; it does not affect conformance to C/C++ standards,
3540 which is controlled by the separate C/C++ dialect option flags. When
3541 this option is used with the Objective-C or Objective-C++ compiler,
3542 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3543 This is useful if you need to make sure that your Objective-C code can
3544 be compiled with older versions of GCC@.
3545
3546 @item -freplace-objc-classes
3547 @opindex freplace-objc-classes
3548 Emit a special marker instructing @command{ld(1)} not to statically link in
3549 the resulting object file, and allow @command{dyld(1)} to load it in at
3550 run time instead. This is used in conjunction with the Fix-and-Continue
3551 debugging mode, where the object file in question may be recompiled and
3552 dynamically reloaded in the course of program execution, without the need
3553 to restart the program itself. Currently, Fix-and-Continue functionality
3554 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3555 and later.
3556
3557 @item -fzero-link
3558 @opindex fzero-link
3559 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3560 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3561 compile time) with static class references that get initialized at load time,
3562 which improves run-time performance. Specifying the @option{-fzero-link} flag
3563 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3564 to be retained. This is useful in Zero-Link debugging mode, since it allows
3565 for individual class implementations to be modified during program execution.
3566 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3567 regardless of command-line options.
3568
3569 @item -fno-local-ivars
3570 @opindex fno-local-ivars
3571 @opindex flocal-ivars
3572 By default instance variables in Objective-C can be accessed as if
3573 they were local variables from within the methods of the class they're
3574 declared in. This can lead to shadowing between instance variables
3575 and other variables declared either locally inside a class method or
3576 globally with the same name. Specifying the @option{-fno-local-ivars}
3577 flag disables this behavior thus avoiding variable shadowing issues.
3578
3579 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3580 @opindex fivar-visibility
3581 Set the default instance variable visibility to the specified option
3582 so that instance variables declared outside the scope of any access
3583 modifier directives default to the specified visibility.
3584
3585 @item -gen-decls
3586 @opindex gen-decls
3587 Dump interface declarations for all classes seen in the source file to a
3588 file named @file{@var{sourcename}.decl}.
3589
3590 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3591 @opindex Wassign-intercept
3592 @opindex Wno-assign-intercept
3593 Warn whenever an Objective-C assignment is being intercepted by the
3594 garbage collector.
3595
3596 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3597 @opindex Wno-protocol
3598 @opindex Wprotocol
3599 If a class is declared to implement a protocol, a warning is issued for
3600 every method in the protocol that is not implemented by the class. The
3601 default behavior is to issue a warning for every method not explicitly
3602 implemented in the class, even if a method implementation is inherited
3603 from the superclass. If you use the @option{-Wno-protocol} option, then
3604 methods inherited from the superclass are considered to be implemented,
3605 and no warning is issued for them.
3606
3607 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3608 @opindex Wselector
3609 @opindex Wno-selector
3610 Warn if multiple methods of different types for the same selector are
3611 found during compilation. The check is performed on the list of methods
3612 in the final stage of compilation. Additionally, a check is performed
3613 for each selector appearing in a @code{@@selector(@dots{})}
3614 expression, and a corresponding method for that selector has been found
3615 during compilation. Because these checks scan the method table only at
3616 the end of compilation, these warnings are not produced if the final
3617 stage of compilation is not reached, for example because an error is
3618 found during compilation, or because the @option{-fsyntax-only} option is
3619 being used.
3620
3621 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3622 @opindex Wstrict-selector-match
3623 @opindex Wno-strict-selector-match
3624 Warn if multiple methods with differing argument and/or return types are
3625 found for a given selector when attempting to send a message using this
3626 selector to a receiver of type @code{id} or @code{Class}. When this flag
3627 is off (which is the default behavior), the compiler omits such warnings
3628 if any differences found are confined to types that share the same size
3629 and alignment.
3630
3631 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3632 @opindex Wundeclared-selector
3633 @opindex Wno-undeclared-selector
3634 Warn if a @code{@@selector(@dots{})} expression referring to an
3635 undeclared selector is found. A selector is considered undeclared if no
3636 method with that name has been declared before the
3637 @code{@@selector(@dots{})} expression, either explicitly in an
3638 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3639 an @code{@@implementation} section. This option always performs its
3640 checks as soon as a @code{@@selector(@dots{})} expression is found,
3641 while @option{-Wselector} only performs its checks in the final stage of
3642 compilation. This also enforces the coding style convention
3643 that methods and selectors must be declared before being used.
3644
3645 @item -print-objc-runtime-info
3646 @opindex print-objc-runtime-info
3647 Generate C header describing the largest structure that is passed by
3648 value, if any.
3649
3650 @end table
3651
3652 @node Diagnostic Message Formatting Options
3653 @section Options to Control Diagnostic Messages Formatting
3654 @cindex options to control diagnostics formatting
3655 @cindex diagnostic messages
3656 @cindex message formatting
3657
3658 Traditionally, diagnostic messages have been formatted irrespective of
3659 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3660 options described below
3661 to control the formatting algorithm for diagnostic messages,
3662 e.g.@: how many characters per line, how often source location
3663 information should be reported. Note that some language front ends may not
3664 honor these options.
3665
3666 @table @gcctabopt
3667 @item -fmessage-length=@var{n}
3668 @opindex fmessage-length
3669 Try to format error messages so that they fit on lines of about
3670 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3671 done; each error message appears on a single line. This is the
3672 default for all front ends.
3673
3674 Note - this option also affects the display of the @samp{#error} and
3675 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3676 function/type/variable attribute. It does not however affect the
3677 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3678
3679 @item -fdiagnostics-show-location=once
3680 @opindex fdiagnostics-show-location
3681 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3682 reporter to emit source location information @emph{once}; that is, in
3683 case the message is too long to fit on a single physical line and has to
3684 be wrapped, the source location won't be emitted (as prefix) again,
3685 over and over, in subsequent continuation lines. This is the default
3686 behavior.
3687
3688 @item -fdiagnostics-show-location=every-line
3689 Only meaningful in line-wrapping mode. Instructs the diagnostic
3690 messages reporter to emit the same source location information (as
3691 prefix) for physical lines that result from the process of breaking
3692 a message which is too long to fit on a single line.
3693
3694 @item -fdiagnostics-color[=@var{WHEN}]
3695 @itemx -fno-diagnostics-color
3696 @opindex fdiagnostics-color
3697 @cindex highlight, color
3698 @vindex GCC_COLORS @r{environment variable}
3699 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3700 or @samp{auto}. The default depends on how the compiler has been configured,
3701 it can be any of the above @var{WHEN} options or also @samp{never}
3702 if @env{GCC_COLORS} environment variable isn't present in the environment,
3703 and @samp{auto} otherwise.
3704 @samp{auto} means to use color only when the standard error is a terminal.
3705 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3706 aliases for @option{-fdiagnostics-color=always} and
3707 @option{-fdiagnostics-color=never}, respectively.
3708
3709 The colors are defined by the environment variable @env{GCC_COLORS}.
3710 Its value is a colon-separated list of capabilities and Select Graphic
3711 Rendition (SGR) substrings. SGR commands are interpreted by the
3712 terminal or terminal emulator. (See the section in the documentation
3713 of your text terminal for permitted values and their meanings as
3714 character attributes.) These substring values are integers in decimal
3715 representation and can be concatenated with semicolons.
3716 Common values to concatenate include
3717 @samp{1} for bold,
3718 @samp{4} for underline,
3719 @samp{5} for blink,
3720 @samp{7} for inverse,
3721 @samp{39} for default foreground color,
3722 @samp{30} to @samp{37} for foreground colors,
3723 @samp{90} to @samp{97} for 16-color mode foreground colors,
3724 @samp{38;5;0} to @samp{38;5;255}
3725 for 88-color and 256-color modes foreground colors,
3726 @samp{49} for default background color,
3727 @samp{40} to @samp{47} for background colors,
3728 @samp{100} to @samp{107} for 16-color mode background colors,
3729 and @samp{48;5;0} to @samp{48;5;255}
3730 for 88-color and 256-color modes background colors.
3731
3732 The default @env{GCC_COLORS} is
3733 @smallexample
3734 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3735 quote=01:fixit-insert=32:fixit-delete=31:\
3736 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3737 type-diff=01;32
3738 @end smallexample
3739 @noindent
3740 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3741 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3742 @samp{01} is bold, and @samp{31} is red.
3743 Setting @env{GCC_COLORS} to the empty string disables colors.
3744 Supported capabilities are as follows.
3745
3746 @table @code
3747 @item error=
3748 @vindex error GCC_COLORS @r{capability}
3749 SGR substring for error: markers.
3750
3751 @item warning=
3752 @vindex warning GCC_COLORS @r{capability}
3753 SGR substring for warning: markers.
3754
3755 @item note=
3756 @vindex note GCC_COLORS @r{capability}
3757 SGR substring for note: markers.
3758
3759 @item range1=
3760 @vindex range1 GCC_COLORS @r{capability}
3761 SGR substring for first additional range.
3762
3763 @item range2=
3764 @vindex range2 GCC_COLORS @r{capability}
3765 SGR substring for second additional range.
3766
3767 @item locus=
3768 @vindex locus GCC_COLORS @r{capability}
3769 SGR substring for location information, @samp{file:line} or
3770 @samp{file:line:column} etc.
3771
3772 @item quote=
3773 @vindex quote GCC_COLORS @r{capability}
3774 SGR substring for information printed within quotes.
3775
3776 @item fixit-insert=
3777 @vindex fixit-insert GCC_COLORS @r{capability}
3778 SGR substring for fix-it hints suggesting text to
3779 be inserted or replaced.
3780
3781 @item fixit-delete=
3782 @vindex fixit-delete GCC_COLORS @r{capability}
3783 SGR substring for fix-it hints suggesting text to
3784 be deleted.
3785
3786 @item diff-filename=
3787 @vindex diff-filename GCC_COLORS @r{capability}
3788 SGR substring for filename headers within generated patches.
3789
3790 @item diff-hunk=
3791 @vindex diff-hunk GCC_COLORS @r{capability}
3792 SGR substring for the starts of hunks within generated patches.
3793
3794 @item diff-delete=
3795 @vindex diff-delete GCC_COLORS @r{capability}
3796 SGR substring for deleted lines within generated patches.
3797
3798 @item diff-insert=
3799 @vindex diff-insert GCC_COLORS @r{capability}
3800 SGR substring for inserted lines within generated patches.
3801
3802 @item type-diff=
3803 @vindex type-diff GCC_COLORS @r{capability}
3804 SGR substring for highlighting mismatching types within template
3805 arguments in the C++ frontend.
3806 @end table
3807
3808 @item -fno-diagnostics-show-option
3809 @opindex fno-diagnostics-show-option
3810 @opindex fdiagnostics-show-option
3811 By default, each diagnostic emitted includes text indicating the
3812 command-line option that directly controls the diagnostic (if such an
3813 option is known to the diagnostic machinery). Specifying the
3814 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3815
3816 @item -fno-diagnostics-show-caret
3817 @opindex fno-diagnostics-show-caret
3818 @opindex fdiagnostics-show-caret
3819 By default, each diagnostic emitted includes the original source line
3820 and a caret @samp{^} indicating the column. This option suppresses this
3821 information. The source line is truncated to @var{n} characters, if
3822 the @option{-fmessage-length=n} option is given. When the output is done
3823 to the terminal, the width is limited to the width given by the
3824 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3825
3826 @item -fno-diagnostics-show-labels
3827 @opindex fno-diagnostics-show-labels
3828 @opindex fdiagnostics-show-labels
3829 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3830 diagnostics can label ranges of source code with pertinent information, such
3831 as the types of expressions:
3832
3833 @smallexample
3834 printf ("foo %s bar", long_i + long_j);
3835 ~^ ~~~~~~~~~~~~~~~
3836 | |
3837 char * long int
3838 @end smallexample
3839
3840 This option suppresses the printing of these labels (in the example above,
3841 the vertical bars and the ``char *'' and ``long int'' text).
3842
3843 @item -fno-diagnostics-show-line-numbers
3844 @opindex fno-diagnostics-show-line-numbers
3845 @opindex fdiagnostics-show-line-numbers
3846 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3847 a left margin is printed, showing line numbers. This option suppresses this
3848 left margin.
3849
3850 @item -fdiagnostics-minimum-margin-width=@var{width}
3851 @opindex fdiagnostics-minimum-margin-width
3852 This option controls the minimum width of the left margin printed by
3853 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3854
3855 @item -fdiagnostics-parseable-fixits
3856 @opindex fdiagnostics-parseable-fixits
3857 Emit fix-it hints in a machine-parseable format, suitable for consumption
3858 by IDEs. For each fix-it, a line will be printed after the relevant
3859 diagnostic, starting with the string ``fix-it:''. For example:
3860
3861 @smallexample
3862 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3863 @end smallexample
3864
3865 The location is expressed as a half-open range, expressed as a count of
3866 bytes, starting at byte 1 for the initial column. In the above example,
3867 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3868 given string:
3869
3870 @smallexample
3871 00000000011111111112222222222
3872 12345678901234567890123456789
3873 gtk_widget_showall (dlg);
3874 ^^^^^^^^^^^^^^^^^^
3875 gtk_widget_show_all
3876 @end smallexample
3877
3878 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3879 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3880 (e.g. vertical tab as ``\013'').
3881
3882 An empty replacement string indicates that the given range is to be removed.
3883 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3884 be inserted at the given position.
3885
3886 @item -fdiagnostics-generate-patch
3887 @opindex fdiagnostics-generate-patch
3888 Print fix-it hints to stderr in unified diff format, after any diagnostics
3889 are printed. For example:
3890
3891 @smallexample
3892 --- test.c
3893 +++ test.c
3894 @@ -42,5 +42,5 @@
3895
3896 void show_cb(GtkDialog *dlg)
3897 @{
3898 - gtk_widget_showall(dlg);
3899 + gtk_widget_show_all(dlg);
3900 @}
3901
3902 @end smallexample
3903
3904 The diff may or may not be colorized, following the same rules
3905 as for diagnostics (see @option{-fdiagnostics-color}).
3906
3907 @item -fdiagnostics-show-template-tree
3908 @opindex fdiagnostics-show-template-tree
3909
3910 In the C++ frontend, when printing diagnostics showing mismatching
3911 template types, such as:
3912
3913 @smallexample
3914 could not convert 'std::map<int, std::vector<double> >()'
3915 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3916 @end smallexample
3917
3918 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3919 tree-like structure showing the common and differing parts of the types,
3920 such as:
3921
3922 @smallexample
3923 map<
3924 [...],
3925 vector<
3926 [double != float]>>
3927 @end smallexample
3928
3929 The parts that differ are highlighted with color (``double'' and
3930 ``float'' in this case).
3931
3932 @item -fno-elide-type
3933 @opindex fno-elide-type
3934 @opindex felide-type
3935 By default when the C++ frontend prints diagnostics showing mismatching
3936 template types, common parts of the types are printed as ``[...]'' to
3937 simplify the error message. For example:
3938
3939 @smallexample
3940 could not convert 'std::map<int, std::vector<double> >()'
3941 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3942 @end smallexample
3943
3944 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3945 This flag also affects the output of the
3946 @option{-fdiagnostics-show-template-tree} flag.
3947
3948 @item -fno-show-column
3949 @opindex fno-show-column
3950 @opindex fshow-column
3951 Do not print column numbers in diagnostics. This may be necessary if
3952 diagnostics are being scanned by a program that does not understand the
3953 column numbers, such as @command{dejagnu}.
3954
3955 @item -fdiagnostics-format=@var{FORMAT}
3956 @opindex fdiagnostics-format
3957 Select a different format for printing diagnostics.
3958 @var{FORMAT} is @samp{text} or @samp{json}.
3959 The default is @samp{text}.
3960
3961 The @samp{json} format consists of a top-level JSON array containing JSON
3962 objects representing the diagnostics.
3963
3964 The JSON is emitted as one line, without formatting; the examples below
3965 have been formatted for clarity.
3966
3967 Diagnostics can have child diagnostics. For example, this error and note:
3968
3969 @smallexample
3970 misleading-indentation.c:15:3: warning: this 'if' clause does not
3971 guard... [-Wmisleading-indentation]
3972 15 | if (flag)
3973 | ^~
3974 misleading-indentation.c:17:5: note: ...this statement, but the latter
3975 is misleadingly indented as if it were guarded by the 'if'
3976 17 | y = 2;
3977 | ^
3978 @end smallexample
3979
3980 @noindent
3981 might be printed in JSON form (after formatting) like this:
3982
3983 @smallexample
3984 [
3985 @{
3986 "kind": "warning",
3987 "locations": [
3988 @{
3989 "caret": @{
3990 "column": 3,
3991 "file": "misleading-indentation.c",
3992 "line": 15
3993 @},
3994 "finish": @{
3995 "column": 4,
3996 "file": "misleading-indentation.c",
3997 "line": 15
3998 @}
3999 @}
4000 ],
4001 "message": "this \u2018if\u2019 clause does not guard...",
4002 "option": "-Wmisleading-indentation",
4003 "children": [
4004 @{
4005 "kind": "note",
4006 "locations": [
4007 @{
4008 "caret": @{
4009 "column": 5,
4010 "file": "misleading-indentation.c",
4011 "line": 17
4012 @}
4013 @}
4014 ],
4015 "message": "...this statement, but the latter is @dots{}"
4016 @}
4017 ]
4018 @},
4019 @dots{}
4020 ]
4021 @end smallexample
4022
4023 @noindent
4024 where the @code{note} is a child of the @code{warning}.
4025
4026 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4027 an @code{option} key describing the command-line option controlling the
4028 warning.
4029
4030 A diagnostic can contain zero or more locations. Each location has up
4031 to three positions within it: a @code{caret} position and optional
4032 @code{start} and @code{finish} positions. A location can also have
4033 an optional @code{label} string. For example, this error:
4034
4035 @smallexample
4036 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4037 'struct s'@} and 'T' @{aka 'struct t'@})
4038 64 | return callee_4a () + callee_4b ();
4039 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4040 | | |
4041 | | T @{aka struct t@}
4042 | S @{aka struct s@}
4043 @end smallexample
4044
4045 @noindent
4046 has three locations. Its primary location is at the ``+'' token at column
4047 23. It has two secondary locations, describing the left and right-hand sides
4048 of the expression, which have labels. It might be printed in JSON form as:
4049
4050 @smallexample
4051 @{
4052 "children": [],
4053 "kind": "error",
4054 "locations": [
4055 @{
4056 "caret": @{
4057 "column": 23, "file": "bad-binary-ops.c", "line": 64
4058 @}
4059 @},
4060 @{
4061 "caret": @{
4062 "column": 10, "file": "bad-binary-ops.c", "line": 64
4063 @},
4064 "finish": @{
4065 "column": 21, "file": "bad-binary-ops.c", "line": 64
4066 @},
4067 "label": "S @{aka struct s@}"
4068 @},
4069 @{
4070 "caret": @{
4071 "column": 25, "file": "bad-binary-ops.c", "line": 64
4072 @},
4073 "finish": @{
4074 "column": 36, "file": "bad-binary-ops.c", "line": 64
4075 @},
4076 "label": "T @{aka struct t@}"
4077 @}
4078 ],
4079 "message": "invalid operands to binary + @dots{}"
4080 @}
4081 @end smallexample
4082
4083 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4084 consisting of half-open intervals, similar to the output of
4085 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4086 with a replacement fix-it hint:
4087
4088 @smallexample
4089 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4090 mean 'color'?
4091 8 | return ptr->colour;
4092 | ^~~~~~
4093 | color
4094 @end smallexample
4095
4096 @noindent
4097 might be printed in JSON form as:
4098
4099 @smallexample
4100 @{
4101 "children": [],
4102 "fixits": [
4103 @{
4104 "next": @{
4105 "column": 21,
4106 "file": "demo.c",
4107 "line": 8
4108 @},
4109 "start": @{
4110 "column": 15,
4111 "file": "demo.c",
4112 "line": 8
4113 @},
4114 "string": "color"
4115 @}
4116 ],
4117 "kind": "error",
4118 "locations": [
4119 @{
4120 "caret": @{
4121 "column": 15,
4122 "file": "demo.c",
4123 "line": 8
4124 @},
4125 "finish": @{
4126 "column": 20,
4127 "file": "demo.c",
4128 "line": 8
4129 @}
4130 @}
4131 ],
4132 "message": "\u2018struct s\u2019 has no member named @dots{}"
4133 @}
4134 @end smallexample
4135
4136 @noindent
4137 where the fix-it hint suggests replacing the text from @code{start} up
4138 to but not including @code{next} with @code{string}'s value. Deletions
4139 are expressed via an empty value for @code{string}, insertions by
4140 having @code{start} equal @code{next}.
4141
4142 @end table
4143
4144 @node Warning Options
4145 @section Options to Request or Suppress Warnings
4146 @cindex options to control warnings
4147 @cindex warning messages
4148 @cindex messages, warning
4149 @cindex suppressing warnings
4150
4151 Warnings are diagnostic messages that report constructions that
4152 are not inherently erroneous but that are risky or suggest there
4153 may have been an error.
4154
4155 The following language-independent options do not enable specific
4156 warnings but control the kinds of diagnostics produced by GCC@.
4157
4158 @table @gcctabopt
4159 @cindex syntax checking
4160 @item -fsyntax-only
4161 @opindex fsyntax-only
4162 Check the code for syntax errors, but don't do anything beyond that.
4163
4164 @item -fmax-errors=@var{n}
4165 @opindex fmax-errors
4166 Limits the maximum number of error messages to @var{n}, at which point
4167 GCC bails out rather than attempting to continue processing the source
4168 code. If @var{n} is 0 (the default), there is no limit on the number
4169 of error messages produced. If @option{-Wfatal-errors} is also
4170 specified, then @option{-Wfatal-errors} takes precedence over this
4171 option.
4172
4173 @item -w
4174 @opindex w
4175 Inhibit all warning messages.
4176
4177 @item -Werror
4178 @opindex Werror
4179 @opindex Wno-error
4180 Make all warnings into errors.
4181
4182 @item -Werror=
4183 @opindex Werror=
4184 @opindex Wno-error=
4185 Make the specified warning into an error. The specifier for a warning
4186 is appended; for example @option{-Werror=switch} turns the warnings
4187 controlled by @option{-Wswitch} into errors. This switch takes a
4188 negative form, to be used to negate @option{-Werror} for specific
4189 warnings; for example @option{-Wno-error=switch} makes
4190 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4191 is in effect.
4192
4193 The warning message for each controllable warning includes the
4194 option that controls the warning. That option can then be used with
4195 @option{-Werror=} and @option{-Wno-error=} as described above.
4196 (Printing of the option in the warning message can be disabled using the
4197 @option{-fno-diagnostics-show-option} flag.)
4198
4199 Note that specifying @option{-Werror=}@var{foo} automatically implies
4200 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4201 imply anything.
4202
4203 @item -Wfatal-errors
4204 @opindex Wfatal-errors
4205 @opindex Wno-fatal-errors
4206 This option causes the compiler to abort compilation on the first error
4207 occurred rather than trying to keep going and printing further error
4208 messages.
4209
4210 @end table
4211
4212 You can request many specific warnings with options beginning with
4213 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4214 implicit declarations. Each of these specific warning options also
4215 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4216 example, @option{-Wno-implicit}. This manual lists only one of the
4217 two forms, whichever is not the default. For further
4218 language-specific options also refer to @ref{C++ Dialect Options} and
4219 @ref{Objective-C and Objective-C++ Dialect Options}.
4220
4221 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4222 options, such as @option{-Wunused}, which may turn on further options,
4223 such as @option{-Wunused-value}. The combined effect of positive and
4224 negative forms is that more specific options have priority over less
4225 specific ones, independently of their position in the command-line. For
4226 options of the same specificity, the last one takes effect. Options
4227 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4228 as if they appeared at the end of the command-line.
4229
4230 When an unrecognized warning option is requested (e.g.,
4231 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4232 that the option is not recognized. However, if the @option{-Wno-} form
4233 is used, the behavior is slightly different: no diagnostic is
4234 produced for @option{-Wno-unknown-warning} unless other diagnostics
4235 are being produced. This allows the use of new @option{-Wno-} options
4236 with old compilers, but if something goes wrong, the compiler
4237 warns that an unrecognized option is present.
4238
4239 @table @gcctabopt
4240 @item -Wpedantic
4241 @itemx -pedantic
4242 @opindex pedantic
4243 @opindex Wpedantic
4244 @opindex Wno-pedantic
4245 Issue all the warnings demanded by strict ISO C and ISO C++;
4246 reject all programs that use forbidden extensions, and some other
4247 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4248 version of the ISO C standard specified by any @option{-std} option used.
4249
4250 Valid ISO C and ISO C++ programs should compile properly with or without
4251 this option (though a rare few require @option{-ansi} or a
4252 @option{-std} option specifying the required version of ISO C)@. However,
4253 without this option, certain GNU extensions and traditional C and C++
4254 features are supported as well. With this option, they are rejected.
4255
4256 @option{-Wpedantic} does not cause warning messages for use of the
4257 alternate keywords whose names begin and end with @samp{__}. Pedantic
4258 warnings are also disabled in the expression that follows
4259 @code{__extension__}. However, only system header files should use
4260 these escape routes; application programs should avoid them.
4261 @xref{Alternate Keywords}.
4262
4263 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4264 C conformance. They soon find that it does not do quite what they want:
4265 it finds some non-ISO practices, but not all---only those for which
4266 ISO C @emph{requires} a diagnostic, and some others for which
4267 diagnostics have been added.
4268
4269 A feature to report any failure to conform to ISO C might be useful in
4270 some instances, but would require considerable additional work and would
4271 be quite different from @option{-Wpedantic}. We don't have plans to
4272 support such a feature in the near future.
4273
4274 Where the standard specified with @option{-std} represents a GNU
4275 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4276 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4277 extended dialect is based. Warnings from @option{-Wpedantic} are given
4278 where they are required by the base standard. (It does not make sense
4279 for such warnings to be given only for features not in the specified GNU
4280 C dialect, since by definition the GNU dialects of C include all
4281 features the compiler supports with the given option, and there would be
4282 nothing to warn about.)
4283
4284 @item -pedantic-errors
4285 @opindex pedantic-errors
4286 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4287 requires a diagnostic, in some cases where there is undefined behavior
4288 at compile-time and in some other cases that do not prevent compilation
4289 of programs that are valid according to the standard. This is not
4290 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4291 by this option and not enabled by the latter and vice versa.
4292
4293 @item -Wall
4294 @opindex Wall
4295 @opindex Wno-all
4296 This enables all the warnings about constructions that some users
4297 consider questionable, and that are easy to avoid (or modify to
4298 prevent the warning), even in conjunction with macros. This also
4299 enables some language-specific warnings described in @ref{C++ Dialect
4300 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4301
4302 @option{-Wall} turns on the following warning flags:
4303
4304 @gccoptlist{-Waddress @gol
4305 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4306 -Wbool-compare @gol
4307 -Wbool-operation @gol
4308 -Wc++11-compat -Wc++14-compat @gol
4309 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4310 -Wchar-subscripts @gol
4311 -Wcomment @gol
4312 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4313 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4314 -Wformat @gol
4315 -Wint-in-bool-context @gol
4316 -Wimplicit @r{(C and Objective-C only)} @gol
4317 -Wimplicit-int @r{(C and Objective-C only)} @gol
4318 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4319 -Winit-self @r{(only for C++)} @gol
4320 -Wlogical-not-parentheses @gol
4321 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4322 -Wmaybe-uninitialized @gol
4323 -Wmemset-elt-size @gol
4324 -Wmemset-transposed-args @gol
4325 -Wmisleading-indentation @r{(only for C/C++)} @gol
4326 -Wmissing-attributes @gol
4327 -Wmissing-braces @r{(only for C/ObjC)} @gol
4328 -Wmultistatement-macros @gol
4329 -Wnarrowing @r{(only for C++)} @gol
4330 -Wnonnull @gol
4331 -Wnonnull-compare @gol
4332 -Wopenmp-simd @gol
4333 -Wparentheses @gol
4334 -Wpessimizing-move @r{(only for C++)} @gol
4335 -Wpointer-sign @gol
4336 -Wreorder @gol
4337 -Wrestrict @gol
4338 -Wreturn-type @gol
4339 -Wsequence-point @gol
4340 -Wsign-compare @r{(only in C++)} @gol
4341 -Wsizeof-pointer-div @gol
4342 -Wsizeof-pointer-memaccess @gol
4343 -Wstrict-aliasing @gol
4344 -Wstrict-overflow=1 @gol
4345 -Wswitch @gol
4346 -Wtautological-compare @gol
4347 -Wtrigraphs @gol
4348 -Wuninitialized @gol
4349 -Wunknown-pragmas @gol
4350 -Wunused-function @gol
4351 -Wunused-label @gol
4352 -Wunused-value @gol
4353 -Wunused-variable @gol
4354 -Wvolatile-register-var}
4355
4356 Note that some warning flags are not implied by @option{-Wall}. Some of
4357 them warn about constructions that users generally do not consider
4358 questionable, but which occasionally you might wish to check for;
4359 others warn about constructions that are necessary or hard to avoid in
4360 some cases, and there is no simple way to modify the code to suppress
4361 the warning. Some of them are enabled by @option{-Wextra} but many of
4362 them must be enabled individually.
4363
4364 @item -Wextra
4365 @opindex W
4366 @opindex Wextra
4367 @opindex Wno-extra
4368 This enables some extra warning flags that are not enabled by
4369 @option{-Wall}. (This option used to be called @option{-W}. The older
4370 name is still supported, but the newer name is more descriptive.)
4371
4372 @gccoptlist{-Wclobbered @gol
4373 -Wcast-function-type @gol
4374 -Wdeprecated-copy @r{(C++ only)} @gol
4375 -Wempty-body @gol
4376 -Wignored-qualifiers @gol
4377 -Wimplicit-fallthrough=3 @gol
4378 -Wmissing-field-initializers @gol
4379 -Wmissing-parameter-type @r{(C only)} @gol
4380 -Wold-style-declaration @r{(C only)} @gol
4381 -Woverride-init @gol
4382 -Wsign-compare @r{(C only)} @gol
4383 -Wredundant-move @r{(only for C++)} @gol
4384 -Wtype-limits @gol
4385 -Wuninitialized @gol
4386 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4387 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4388 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4389
4390
4391 The option @option{-Wextra} also prints warning messages for the
4392 following cases:
4393
4394 @itemize @bullet
4395
4396 @item
4397 A pointer is compared against integer zero with @code{<}, @code{<=},
4398 @code{>}, or @code{>=}.
4399
4400 @item
4401 (C++ only) An enumerator and a non-enumerator both appear in a
4402 conditional expression.
4403
4404 @item
4405 (C++ only) Ambiguous virtual bases.
4406
4407 @item
4408 (C++ only) Subscripting an array that has been declared @code{register}.
4409
4410 @item
4411 (C++ only) Taking the address of a variable that has been declared
4412 @code{register}.
4413
4414 @item
4415 (C++ only) A base class is not initialized in the copy constructor
4416 of a derived class.
4417
4418 @end itemize
4419
4420 @item -Wchar-subscripts
4421 @opindex Wchar-subscripts
4422 @opindex Wno-char-subscripts
4423 Warn if an array subscript has type @code{char}. This is a common cause
4424 of error, as programmers often forget that this type is signed on some
4425 machines.
4426 This warning is enabled by @option{-Wall}.
4427
4428 @item -Wchkp
4429 @opindex Wchkp
4430 @opindex Wno-chkp
4431 Warn about an invalid memory access that is found by Pointer Bounds Checker
4432 (@option{-fcheck-pointer-bounds}).
4433
4434 @item -Wno-coverage-mismatch
4435 @opindex Wno-coverage-mismatch
4436 @opindex Wcoverage-mismatch
4437 Warn if feedback profiles do not match when using the
4438 @option{-fprofile-use} option.
4439 If a source file is changed between compiling with @option{-fprofile-generate}
4440 and with @option{-fprofile-use}, the files with the profile feedback can fail
4441 to match the source file and GCC cannot use the profile feedback
4442 information. By default, this warning is enabled and is treated as an
4443 error. @option{-Wno-coverage-mismatch} can be used to disable the
4444 warning or @option{-Wno-error=coverage-mismatch} can be used to
4445 disable the error. Disabling the error for this warning can result in
4446 poorly optimized code and is useful only in the
4447 case of very minor changes such as bug fixes to an existing code-base.
4448 Completely disabling the warning is not recommended.
4449
4450 @item -Wno-cpp
4451 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4452
4453 Suppress warning messages emitted by @code{#warning} directives.
4454
4455 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4456 @opindex Wdouble-promotion
4457 @opindex Wno-double-promotion
4458 Give a warning when a value of type @code{float} is implicitly
4459 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4460 floating-point unit implement @code{float} in hardware, but emulate
4461 @code{double} in software. On such a machine, doing computations
4462 using @code{double} values is much more expensive because of the
4463 overhead required for software emulation.
4464
4465 It is easy to accidentally do computations with @code{double} because
4466 floating-point literals are implicitly of type @code{double}. For
4467 example, in:
4468 @smallexample
4469 @group
4470 float area(float radius)
4471 @{
4472 return 3.14159 * radius * radius;
4473 @}
4474 @end group
4475 @end smallexample
4476 the compiler performs the entire computation with @code{double}
4477 because the floating-point literal is a @code{double}.
4478
4479 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4480 @opindex Wduplicate-decl-specifier
4481 @opindex Wno-duplicate-decl-specifier
4482 Warn if a declaration has duplicate @code{const}, @code{volatile},
4483 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4484 @option{-Wall}.
4485
4486 @item -Wformat
4487 @itemx -Wformat=@var{n}
4488 @opindex Wformat
4489 @opindex Wno-format
4490 @opindex ffreestanding
4491 @opindex fno-builtin
4492 @opindex Wformat=
4493 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4494 the arguments supplied have types appropriate to the format string
4495 specified, and that the conversions specified in the format string make
4496 sense. This includes standard functions, and others specified by format
4497 attributes (@pxref{Function Attributes}), in the @code{printf},
4498 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4499 not in the C standard) families (or other target-specific families).
4500 Which functions are checked without format attributes having been
4501 specified depends on the standard version selected, and such checks of
4502 functions without the attribute specified are disabled by
4503 @option{-ffreestanding} or @option{-fno-builtin}.
4504
4505 The formats are checked against the format features supported by GNU
4506 libc version 2.2. These include all ISO C90 and C99 features, as well
4507 as features from the Single Unix Specification and some BSD and GNU
4508 extensions. Other library implementations may not support all these
4509 features; GCC does not support warning about features that go beyond a
4510 particular library's limitations. However, if @option{-Wpedantic} is used
4511 with @option{-Wformat}, warnings are given about format features not
4512 in the selected standard version (but not for @code{strfmon} formats,
4513 since those are not in any version of the C standard). @xref{C Dialect
4514 Options,,Options Controlling C Dialect}.
4515
4516 @table @gcctabopt
4517 @item -Wformat=1
4518 @itemx -Wformat
4519 @opindex Wformat
4520 @opindex Wformat=1
4521 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4522 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4523 @option{-Wformat} also checks for null format arguments for several
4524 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4525 aspects of this level of format checking can be disabled by the
4526 options: @option{-Wno-format-contains-nul},
4527 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4528 @option{-Wformat} is enabled by @option{-Wall}.
4529
4530 @item -Wno-format-contains-nul
4531 @opindex Wno-format-contains-nul
4532 @opindex Wformat-contains-nul
4533 If @option{-Wformat} is specified, do not warn about format strings that
4534 contain NUL bytes.
4535
4536 @item -Wno-format-extra-args
4537 @opindex Wno-format-extra-args
4538 @opindex Wformat-extra-args
4539 If @option{-Wformat} is specified, do not warn about excess arguments to a
4540 @code{printf} or @code{scanf} format function. The C standard specifies
4541 that such arguments are ignored.
4542
4543 Where the unused arguments lie between used arguments that are
4544 specified with @samp{$} operand number specifications, normally
4545 warnings are still given, since the implementation could not know what
4546 type to pass to @code{va_arg} to skip the unused arguments. However,
4547 in the case of @code{scanf} formats, this option suppresses the
4548 warning if the unused arguments are all pointers, since the Single
4549 Unix Specification says that such unused arguments are allowed.
4550
4551 @item -Wformat-overflow
4552 @itemx -Wformat-overflow=@var{level}
4553 @opindex Wformat-overflow
4554 @opindex Wno-format-overflow
4555 Warn about calls to formatted input/output functions such as @code{sprintf}
4556 and @code{vsprintf} that might overflow the destination buffer. When the
4557 exact number of bytes written by a format directive cannot be determined
4558 at compile-time it is estimated based on heuristics that depend on the
4559 @var{level} argument and on optimization. While enabling optimization
4560 will in most cases improve the accuracy of the warning, it may also
4561 result in false positives.
4562
4563 @table @gcctabopt
4564 @item -Wformat-overflow
4565 @itemx -Wformat-overflow=1
4566 @opindex Wformat-overflow
4567 @opindex Wno-format-overflow
4568 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4569 employs a conservative approach that warns only about calls that most
4570 likely overflow the buffer. At this level, numeric arguments to format
4571 directives with unknown values are assumed to have the value of one, and
4572 strings of unknown length to be empty. Numeric arguments that are known
4573 to be bounded to a subrange of their type, or string arguments whose output
4574 is bounded either by their directive's precision or by a finite set of
4575 string literals, are assumed to take on the value within the range that
4576 results in the most bytes on output. For example, the call to @code{sprintf}
4577 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4578 the terminating NUL character (@code{'\0'}) appended by the function
4579 to the destination buffer will be written past its end. Increasing
4580 the size of the buffer by a single byte is sufficient to avoid the
4581 warning, though it may not be sufficient to avoid the overflow.
4582
4583 @smallexample
4584 void f (int a, int b)
4585 @{
4586 char buf [13];
4587 sprintf (buf, "a = %i, b = %i\n", a, b);
4588 @}
4589 @end smallexample
4590
4591 @item -Wformat-overflow=2
4592 Level @var{2} warns also about calls that might overflow the destination
4593 buffer given an argument of sufficient length or magnitude. At level
4594 @var{2}, unknown numeric arguments are assumed to have the minimum
4595 representable value for signed types with a precision greater than 1, and
4596 the maximum representable value otherwise. Unknown string arguments whose
4597 length cannot be assumed to be bounded either by the directive's precision,
4598 or by a finite set of string literals they may evaluate to, or the character
4599 array they may point to, are assumed to be 1 character long.
4600
4601 At level @var{2}, the call in the example above is again diagnosed, but
4602 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4603 @code{%i} directive will write some of its digits beyond the end of
4604 the destination buffer. To make the call safe regardless of the values
4605 of the two variables, the size of the destination buffer must be increased
4606 to at least 34 bytes. GCC includes the minimum size of the buffer in
4607 an informational note following the warning.
4608
4609 An alternative to increasing the size of the destination buffer is to
4610 constrain the range of formatted values. The maximum length of string
4611 arguments can be bounded by specifying the precision in the format
4612 directive. When numeric arguments of format directives can be assumed
4613 to be bounded by less than the precision of their type, choosing
4614 an appropriate length modifier to the format specifier will reduce
4615 the required buffer size. For example, if @var{a} and @var{b} in the
4616 example above can be assumed to be within the precision of
4617 the @code{short int} type then using either the @code{%hi} format
4618 directive or casting the argument to @code{short} reduces the maximum
4619 required size of the buffer to 24 bytes.
4620
4621 @smallexample
4622 void f (int a, int b)
4623 @{
4624 char buf [23];
4625 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4626 @}
4627 @end smallexample
4628 @end table
4629
4630 @item -Wno-format-zero-length
4631 @opindex Wno-format-zero-length
4632 @opindex Wformat-zero-length
4633 If @option{-Wformat} is specified, do not warn about zero-length formats.
4634 The C standard specifies that zero-length formats are allowed.
4635
4636
4637 @item -Wformat=2
4638 @opindex Wformat=2
4639 Enable @option{-Wformat} plus additional format checks. Currently
4640 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4641 -Wformat-y2k}.
4642
4643 @item -Wformat-nonliteral
4644 @opindex Wformat-nonliteral
4645 @opindex Wno-format-nonliteral
4646 If @option{-Wformat} is specified, also warn if the format string is not a
4647 string literal and so cannot be checked, unless the format function
4648 takes its format arguments as a @code{va_list}.
4649
4650 @item -Wformat-security
4651 @opindex Wformat-security
4652 @opindex Wno-format-security
4653 If @option{-Wformat} is specified, also warn about uses of format
4654 functions that represent possible security problems. At present, this
4655 warns about calls to @code{printf} and @code{scanf} functions where the
4656 format string is not a string literal and there are no format arguments,
4657 as in @code{printf (foo);}. This may be a security hole if the format
4658 string came from untrusted input and contains @samp{%n}. (This is
4659 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4660 in future warnings may be added to @option{-Wformat-security} that are not
4661 included in @option{-Wformat-nonliteral}.)
4662
4663 @item -Wformat-signedness
4664 @opindex Wformat-signedness
4665 @opindex Wno-format-signedness
4666 If @option{-Wformat} is specified, also warn if the format string
4667 requires an unsigned argument and the argument is signed and vice versa.
4668
4669 @item -Wformat-truncation
4670 @itemx -Wformat-truncation=@var{level}
4671 @opindex Wformat-truncation
4672 @opindex Wno-format-truncation
4673 Warn about calls to formatted input/output functions such as @code{snprintf}
4674 and @code{vsnprintf} that might result in output truncation. When the exact
4675 number of bytes written by a format directive cannot be determined at
4676 compile-time it is estimated based on heuristics that depend on
4677 the @var{level} argument and on optimization. While enabling optimization
4678 will in most cases improve the accuracy of the warning, it may also result
4679 in false positives. Except as noted otherwise, the option uses the same
4680 logic @option{-Wformat-overflow}.
4681
4682 @table @gcctabopt
4683 @item -Wformat-truncation
4684 @itemx -Wformat-truncation=1
4685 @opindex Wformat-truncation
4686 @opindex Wno-format-truncation
4687 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4688 employs a conservative approach that warns only about calls to bounded
4689 functions whose return value is unused and that will most likely result
4690 in output truncation.
4691
4692 @item -Wformat-truncation=2
4693 Level @var{2} warns also about calls to bounded functions whose return
4694 value is used and that might result in truncation given an argument of
4695 sufficient length or magnitude.
4696 @end table
4697
4698 @item -Wformat-y2k
4699 @opindex Wformat-y2k
4700 @opindex Wno-format-y2k
4701 If @option{-Wformat} is specified, also warn about @code{strftime}
4702 formats that may yield only a two-digit year.
4703 @end table
4704
4705 @item -Wnonnull
4706 @opindex Wnonnull
4707 @opindex Wno-nonnull
4708 Warn about passing a null pointer for arguments marked as
4709 requiring a non-null value by the @code{nonnull} function attribute.
4710
4711 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4712 can be disabled with the @option{-Wno-nonnull} option.
4713
4714 @item -Wnonnull-compare
4715 @opindex Wnonnull-compare
4716 @opindex Wno-nonnull-compare
4717 Warn when comparing an argument marked with the @code{nonnull}
4718 function attribute against null inside the function.
4719
4720 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4721 can be disabled with the @option{-Wno-nonnull-compare} option.
4722
4723 @item -Wnull-dereference
4724 @opindex Wnull-dereference
4725 @opindex Wno-null-dereference
4726 Warn if the compiler detects paths that trigger erroneous or
4727 undefined behavior due to dereferencing a null pointer. This option
4728 is only active when @option{-fdelete-null-pointer-checks} is active,
4729 which is enabled by optimizations in most targets. The precision of
4730 the warnings depends on the optimization options used.
4731
4732 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4733 @opindex Winit-self
4734 @opindex Wno-init-self
4735 Warn about uninitialized variables that are initialized with themselves.
4736 Note this option can only be used with the @option{-Wuninitialized} option.
4737
4738 For example, GCC warns about @code{i} being uninitialized in the
4739 following snippet only when @option{-Winit-self} has been specified:
4740 @smallexample
4741 @group
4742 int f()
4743 @{
4744 int i = i;
4745 return i;
4746 @}
4747 @end group
4748 @end smallexample
4749
4750 This warning is enabled by @option{-Wall} in C++.
4751
4752 @item -Wimplicit-int @r{(C and Objective-C only)}
4753 @opindex Wimplicit-int
4754 @opindex Wno-implicit-int
4755 Warn when a declaration does not specify a type.
4756 This warning is enabled by @option{-Wall}.
4757
4758 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4759 @opindex Wimplicit-function-declaration
4760 @opindex Wno-implicit-function-declaration
4761 Give a warning whenever a function is used before being declared. In
4762 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4763 enabled by default and it is made into an error by
4764 @option{-pedantic-errors}. This warning is also enabled by
4765 @option{-Wall}.
4766
4767 @item -Wimplicit @r{(C and Objective-C only)}
4768 @opindex Wimplicit
4769 @opindex Wno-implicit
4770 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4771 This warning is enabled by @option{-Wall}.
4772
4773 @item -Wimplicit-fallthrough
4774 @opindex Wimplicit-fallthrough
4775 @opindex Wno-implicit-fallthrough
4776 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4777 and @option{-Wno-implicit-fallthrough} is the same as
4778 @option{-Wimplicit-fallthrough=0}.
4779
4780 @item -Wimplicit-fallthrough=@var{n}
4781 @opindex Wimplicit-fallthrough=
4782 Warn when a switch case falls through. For example:
4783
4784 @smallexample
4785 @group
4786 switch (cond)
4787 @{
4788 case 1:
4789 a = 1;
4790 break;
4791 case 2:
4792 a = 2;
4793 case 3:
4794 a = 3;
4795 break;
4796 @}
4797 @end group
4798 @end smallexample
4799
4800 This warning does not warn when the last statement of a case cannot
4801 fall through, e.g. when there is a return statement or a call to function
4802 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4803 also takes into account control flow statements, such as ifs, and only
4804 warns when appropriate. E.g.@:
4805
4806 @smallexample
4807 @group
4808 switch (cond)
4809 @{
4810 case 1:
4811 if (i > 3) @{
4812 bar (5);
4813 break;
4814 @} else if (i < 1) @{
4815 bar (0);
4816 @} else
4817 return;
4818 default:
4819 @dots{}
4820 @}
4821 @end group
4822 @end smallexample
4823
4824 Since there are occasions where a switch case fall through is desirable,
4825 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4826 to be used along with a null statement to suppress this warning that
4827 would normally occur:
4828
4829 @smallexample
4830 @group
4831 switch (cond)
4832 @{
4833 case 1:
4834 bar (0);
4835 __attribute__ ((fallthrough));
4836 default:
4837 @dots{}
4838 @}
4839 @end group
4840 @end smallexample
4841
4842 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4843 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4844 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4845 Instead of these attributes, it is also possible to add a fallthrough comment
4846 to silence the warning. The whole body of the C or C++ style comment should
4847 match the given regular expressions listed below. The option argument @var{n}
4848 specifies what kind of comments are accepted:
4849
4850 @itemize @bullet
4851
4852 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4853
4854 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4855 expression, any comment is used as fallthrough comment.
4856
4857 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4858 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4859
4860 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4861 following regular expressions:
4862
4863 @itemize @bullet
4864
4865 @item @code{-fallthrough}
4866
4867 @item @code{@@fallthrough@@}
4868
4869 @item @code{lint -fallthrough[ \t]*}
4870
4871 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4872
4873 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4874
4875 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4876
4877 @end itemize
4878
4879 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4880 following regular expressions:
4881
4882 @itemize @bullet
4883
4884 @item @code{-fallthrough}
4885
4886 @item @code{@@fallthrough@@}
4887
4888 @item @code{lint -fallthrough[ \t]*}
4889
4890 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4891
4892 @end itemize
4893
4894 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4895 fallthrough comments, only attributes disable the warning.
4896
4897 @end itemize
4898
4899 The comment needs to be followed after optional whitespace and other comments
4900 by @code{case} or @code{default} keywords or by a user label that precedes some
4901 @code{case} or @code{default} label.
4902
4903 @smallexample
4904 @group
4905 switch (cond)
4906 @{
4907 case 1:
4908 bar (0);
4909 /* FALLTHRU */
4910 default:
4911 @dots{}
4912 @}
4913 @end group
4914 @end smallexample
4915
4916 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4917
4918 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4919 @opindex Wif-not-aligned
4920 @opindex Wno-if-not-aligned
4921 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4922 should be issued. This is enabled by default.
4923 Use @option{-Wno-if-not-aligned} to disable it.
4924
4925 @item -Wignored-qualifiers @r{(C and C++ only)}
4926 @opindex Wignored-qualifiers
4927 @opindex Wno-ignored-qualifiers
4928 Warn if the return type of a function has a type qualifier
4929 such as @code{const}. For ISO C such a type qualifier has no effect,
4930 since the value returned by a function is not an lvalue.
4931 For C++, the warning is only emitted for scalar types or @code{void}.
4932 ISO C prohibits qualified @code{void} return types on function
4933 definitions, so such return types always receive a warning
4934 even without this option.
4935
4936 This warning is also enabled by @option{-Wextra}.
4937
4938 @item -Wignored-attributes @r{(C and C++ only)}
4939 @opindex Wignored-attributes
4940 @opindex Wno-ignored-attributes
4941 Warn when an attribute is ignored. This is different from the
4942 @option{-Wattributes} option in that it warns whenever the compiler decides
4943 to drop an attribute, not that the attribute is either unknown, used in a
4944 wrong place, etc. This warning is enabled by default.
4945
4946 @item -Wmain
4947 @opindex Wmain
4948 @opindex Wno-main
4949 Warn if the type of @code{main} is suspicious. @code{main} should be
4950 a function with external linkage, returning int, taking either zero
4951 arguments, two, or three arguments of appropriate types. This warning
4952 is enabled by default in C++ and is enabled by either @option{-Wall}
4953 or @option{-Wpedantic}.
4954
4955 @item -Wmisleading-indentation @r{(C and C++ only)}
4956 @opindex Wmisleading-indentation
4957 @opindex Wno-misleading-indentation
4958 Warn when the indentation of the code does not reflect the block structure.
4959 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4960 @code{for} clauses with a guarded statement that does not use braces,
4961 followed by an unguarded statement with the same indentation.
4962
4963 In the following example, the call to ``bar'' is misleadingly indented as
4964 if it were guarded by the ``if'' conditional.
4965
4966 @smallexample
4967 if (some_condition ())
4968 foo ();
4969 bar (); /* Gotcha: this is not guarded by the "if". */
4970 @end smallexample
4971
4972 In the case of mixed tabs and spaces, the warning uses the
4973 @option{-ftabstop=} option to determine if the statements line up
4974 (defaulting to 8).
4975
4976 The warning is not issued for code involving multiline preprocessor logic
4977 such as the following example.
4978
4979 @smallexample
4980 if (flagA)
4981 foo (0);
4982 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4983 if (flagB)
4984 #endif
4985 foo (1);
4986 @end smallexample
4987
4988 The warning is not issued after a @code{#line} directive, since this
4989 typically indicates autogenerated code, and no assumptions can be made
4990 about the layout of the file that the directive references.
4991
4992 This warning is enabled by @option{-Wall} in C and C++.
4993
4994 @item -Wno-missing-attributes
4995 @opindex Wmissing-attributes
4996 @opindex Wno-missing-attributes
4997 Warn when a declaration of a function is missing one or more attributes
4998 that a related function is declared with and whose absence may adversely
4999 affect the correctness or efficiency of generated code. For example,
5000 the warning is issued for declarations of aliases that use attributes
5001 to specify less restrictive requirements than those of their targets.
5002 This typically represents a potential optimization oportunity rather
5003 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
5004 issued for mismatches between declarations of aliases and their targets
5005 that might be indicative of code generation bugs.
5006 Attributes considered include @code{alloc_align}, @code{alloc_size},
5007 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5008 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5009 @code{returns_nonnull}, and @code{returns_twice}.
5010
5011 In C++, the warning is issued when an explicit specialization of a primary
5012 template declared with attribute @code{alloc_align}, @code{alloc_size},
5013 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5014 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5015 @code{error}, and @code{warning} suppress the warning.
5016 (@pxref{Function Attributes}).
5017
5018 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5019
5020 For example, since the declaration of the primary function template
5021 below makes use of both attribute @code{malloc} and @code{alloc_size}
5022 the declaration of the explicit specialization of the template is
5023 diagnosed because it is missing one of the attributes.
5024
5025 @smallexample
5026 template <class T>
5027 T* __attribute__ ((malloc, alloc_size (1)))
5028 allocate (size_t);
5029
5030 template <>
5031 void* __attribute__ ((malloc)) // missing alloc_size
5032 allocate<void> (size_t);
5033 @end smallexample
5034
5035 @item -Wmissing-braces
5036 @opindex Wmissing-braces
5037 @opindex Wno-missing-braces
5038 Warn if an aggregate or union initializer is not fully bracketed. In
5039 the following example, the initializer for @code{a} is not fully
5040 bracketed, but that for @code{b} is fully bracketed. This warning is
5041 enabled by @option{-Wall} in C.
5042
5043 @smallexample
5044 int a[2][2] = @{ 0, 1, 2, 3 @};
5045 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5046 @end smallexample
5047
5048 This warning is enabled by @option{-Wall}.
5049
5050 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5051 @opindex Wmissing-include-dirs
5052 @opindex Wno-missing-include-dirs
5053 Warn if a user-supplied include directory does not exist.
5054
5055 @item -Wmissing-profile
5056 @opindex Wmissing-profile
5057 @opindex Wno-missing-profile
5058 Warn if feedback profiles are missing when using the
5059 @option{-fprofile-use} option.
5060 This option diagnoses those cases where a new function or a new file is added
5061 to the user code between compiling with @option{-fprofile-generate} and with
5062 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5063 profile feedback data files do not contain any profile feedback information for
5064 the newly added function or file respectively. Also, in the case when profile
5065 count data (.gcda) files are removed, GCC cannot use any profile feedback
5066 information. In all these cases, warnings are issued to inform the user that a
5067 profile generation step is due. @option{-Wno-missing-profile} can be used to
5068 disable the warning. Ignoring the warning can result in poorly optimized code.
5069 Completely disabling the warning is not recommended and should be done only
5070 when non-existent profile data is justified.
5071
5072 @item -Wmultistatement-macros
5073 @opindex Wmultistatement-macros
5074 @opindex Wno-multistatement-macros
5075 Warn about unsafe multiple statement macros that appear to be guarded
5076 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5077 @code{while}, in which only the first statement is actually guarded after
5078 the macro is expanded.
5079
5080 For example:
5081
5082 @smallexample
5083 #define DOIT x++; y++
5084 if (c)
5085 DOIT;
5086 @end smallexample
5087
5088 will increment @code{y} unconditionally, not just when @code{c} holds.
5089 The can usually be fixed by wrapping the macro in a do-while loop:
5090 @smallexample
5091 #define DOIT do @{ x++; y++; @} while (0)
5092 if (c)
5093 DOIT;
5094 @end smallexample
5095
5096 This warning is enabled by @option{-Wall} in C and C++.
5097
5098 @item -Wparentheses
5099 @opindex Wparentheses
5100 @opindex Wno-parentheses
5101 Warn if parentheses are omitted in certain contexts, such
5102 as when there is an assignment in a context where a truth value
5103 is expected, or when operators are nested whose precedence people
5104 often get confused about.
5105
5106 Also warn if a comparison like @code{x<=y<=z} appears; this is
5107 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5108 interpretation from that of ordinary mathematical notation.
5109
5110 Also warn for dangerous uses of the GNU extension to
5111 @code{?:} with omitted middle operand. When the condition
5112 in the @code{?}: operator is a boolean expression, the omitted value is
5113 always 1. Often programmers expect it to be a value computed
5114 inside the conditional expression instead.
5115
5116 For C++ this also warns for some cases of unnecessary parentheses in
5117 declarations, which can indicate an attempt at a function call instead
5118 of a declaration:
5119 @smallexample
5120 @{
5121 // Declares a local variable called mymutex.
5122 std::unique_lock<std::mutex> (mymutex);
5123 // User meant std::unique_lock<std::mutex> lock (mymutex);
5124 @}
5125 @end smallexample
5126
5127 This warning is enabled by @option{-Wall}.
5128
5129 @item -Wsequence-point
5130 @opindex Wsequence-point
5131 @opindex Wno-sequence-point
5132 Warn about code that may have undefined semantics because of violations
5133 of sequence point rules in the C and C++ standards.
5134
5135 The C and C++ standards define the order in which expressions in a C/C++
5136 program are evaluated in terms of @dfn{sequence points}, which represent
5137 a partial ordering between the execution of parts of the program: those
5138 executed before the sequence point, and those executed after it. These
5139 occur after the evaluation of a full expression (one which is not part
5140 of a larger expression), after the evaluation of the first operand of a
5141 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5142 function is called (but after the evaluation of its arguments and the
5143 expression denoting the called function), and in certain other places.
5144 Other than as expressed by the sequence point rules, the order of
5145 evaluation of subexpressions of an expression is not specified. All
5146 these rules describe only a partial order rather than a total order,
5147 since, for example, if two functions are called within one expression
5148 with no sequence point between them, the order in which the functions
5149 are called is not specified. However, the standards committee have
5150 ruled that function calls do not overlap.
5151
5152 It is not specified when between sequence points modifications to the
5153 values of objects take effect. Programs whose behavior depends on this
5154 have undefined behavior; the C and C++ standards specify that ``Between
5155 the previous and next sequence point an object shall have its stored
5156 value modified at most once by the evaluation of an expression.
5157 Furthermore, the prior value shall be read only to determine the value
5158 to be stored.''. If a program breaks these rules, the results on any
5159 particular implementation are entirely unpredictable.
5160
5161 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5162 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5163 diagnosed by this option, and it may give an occasional false positive
5164 result, but in general it has been found fairly effective at detecting
5165 this sort of problem in programs.
5166
5167 The C++17 standard will define the order of evaluation of operands in
5168 more cases: in particular it requires that the right-hand side of an
5169 assignment be evaluated before the left-hand side, so the above
5170 examples are no longer undefined. But this warning will still warn
5171 about them, to help people avoid writing code that is undefined in C
5172 and earlier revisions of C++.
5173
5174 The standard is worded confusingly, therefore there is some debate
5175 over the precise meaning of the sequence point rules in subtle cases.
5176 Links to discussions of the problem, including proposed formal
5177 definitions, may be found on the GCC readings page, at
5178 @uref{http://gcc.gnu.org/@/readings.html}.
5179
5180 This warning is enabled by @option{-Wall} for C and C++.
5181
5182 @item -Wno-return-local-addr
5183 @opindex Wno-return-local-addr
5184 @opindex Wreturn-local-addr
5185 Do not warn about returning a pointer (or in C++, a reference) to a
5186 variable that goes out of scope after the function returns.
5187
5188 @item -Wreturn-type
5189 @opindex Wreturn-type
5190 @opindex Wno-return-type
5191 Warn whenever a function is defined with a return type that defaults
5192 to @code{int}. Also warn about any @code{return} statement with no
5193 return value in a function whose return type is not @code{void}
5194 (falling off the end of the function body is considered returning
5195 without a value).
5196
5197 For C only, warn about a @code{return} statement with an expression in a
5198 function whose return type is @code{void}, unless the expression type is
5199 also @code{void}. As a GNU extension, the latter case is accepted
5200 without a warning unless @option{-Wpedantic} is used.
5201
5202 For C++, a function without return type always produces a diagnostic
5203 message, even when @option{-Wno-return-type} is specified. The only
5204 exceptions are @code{main} and functions defined in system headers.
5205
5206 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5207
5208 @item -Wshift-count-negative
5209 @opindex Wshift-count-negative
5210 @opindex Wno-shift-count-negative
5211 Warn if shift count is negative. This warning is enabled by default.
5212
5213 @item -Wshift-count-overflow
5214 @opindex Wshift-count-overflow
5215 @opindex Wno-shift-count-overflow
5216 Warn if shift count >= width of type. This warning is enabled by default.
5217
5218 @item -Wshift-negative-value
5219 @opindex Wshift-negative-value
5220 @opindex Wno-shift-negative-value
5221 Warn if left shifting a negative value. This warning is enabled by
5222 @option{-Wextra} in C99 and C++11 modes (and newer).
5223
5224 @item -Wshift-overflow
5225 @itemx -Wshift-overflow=@var{n}
5226 @opindex Wshift-overflow
5227 @opindex Wno-shift-overflow
5228 Warn about left shift overflows. This warning is enabled by
5229 default in C99 and C++11 modes (and newer).
5230
5231 @table @gcctabopt
5232 @item -Wshift-overflow=1
5233 This is the warning level of @option{-Wshift-overflow} and is enabled
5234 by default in C99 and C++11 modes (and newer). This warning level does
5235 not warn about left-shifting 1 into the sign bit. (However, in C, such
5236 an overflow is still rejected in contexts where an integer constant expression
5237 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5238 shifts always wrap.
5239
5240 @item -Wshift-overflow=2
5241 This warning level also warns about left-shifting 1 into the sign bit,
5242 unless C++14 mode (or newer) is active.
5243 @end table
5244
5245 @item -Wswitch
5246 @opindex Wswitch
5247 @opindex Wno-switch
5248 Warn whenever a @code{switch} statement has an index of enumerated type
5249 and lacks a @code{case} for one or more of the named codes of that
5250 enumeration. (The presence of a @code{default} label prevents this
5251 warning.) @code{case} labels outside the enumeration range also
5252 provoke warnings when this option is used (even if there is a
5253 @code{default} label).
5254 This warning is enabled by @option{-Wall}.
5255
5256 @item -Wswitch-default
5257 @opindex Wswitch-default
5258 @opindex Wno-switch-default
5259 Warn whenever a @code{switch} statement does not have a @code{default}
5260 case.
5261
5262 @item -Wswitch-enum
5263 @opindex Wswitch-enum
5264 @opindex Wno-switch-enum
5265 Warn whenever a @code{switch} statement has an index of enumerated type
5266 and lacks a @code{case} for one or more of the named codes of that
5267 enumeration. @code{case} labels outside the enumeration range also
5268 provoke warnings when this option is used. The only difference
5269 between @option{-Wswitch} and this option is that this option gives a
5270 warning about an omitted enumeration code even if there is a
5271 @code{default} label.
5272
5273 @item -Wswitch-bool
5274 @opindex Wswitch-bool
5275 @opindex Wno-switch-bool
5276 Warn whenever a @code{switch} statement has an index of boolean type
5277 and the case values are outside the range of a boolean type.
5278 It is possible to suppress this warning by casting the controlling
5279 expression to a type other than @code{bool}. For example:
5280 @smallexample
5281 @group
5282 switch ((int) (a == 4))
5283 @{
5284 @dots{}
5285 @}
5286 @end group
5287 @end smallexample
5288 This warning is enabled by default for C and C++ programs.
5289
5290 @item -Wswitch-unreachable
5291 @opindex Wswitch-unreachable
5292 @opindex Wno-switch-unreachable
5293 Warn whenever a @code{switch} statement contains statements between the
5294 controlling expression and the first case label, which will never be
5295 executed. For example:
5296 @smallexample
5297 @group
5298 switch (cond)
5299 @{
5300 i = 15;
5301 @dots{}
5302 case 5:
5303 @dots{}
5304 @}
5305 @end group
5306 @end smallexample
5307 @option{-Wswitch-unreachable} does not warn if the statement between the
5308 controlling expression and the first case label is just a declaration:
5309 @smallexample
5310 @group
5311 switch (cond)
5312 @{
5313 int i;
5314 @dots{}
5315 case 5:
5316 i = 5;
5317 @dots{}
5318 @}
5319 @end group
5320 @end smallexample
5321 This warning is enabled by default for C and C++ programs.
5322
5323 @item -Wsync-nand @r{(C and C++ only)}
5324 @opindex Wsync-nand
5325 @opindex Wno-sync-nand
5326 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5327 built-in functions are used. These functions changed semantics in GCC 4.4.
5328
5329 @item -Wunused-but-set-parameter
5330 @opindex Wunused-but-set-parameter
5331 @opindex Wno-unused-but-set-parameter
5332 Warn whenever a function parameter is assigned to, but otherwise unused
5333 (aside from its declaration).
5334
5335 To suppress this warning use the @code{unused} attribute
5336 (@pxref{Variable Attributes}).
5337
5338 This warning is also enabled by @option{-Wunused} together with
5339 @option{-Wextra}.
5340
5341 @item -Wunused-but-set-variable
5342 @opindex Wunused-but-set-variable
5343 @opindex Wno-unused-but-set-variable
5344 Warn whenever a local variable is assigned to, but otherwise unused
5345 (aside from its declaration).
5346 This warning is enabled by @option{-Wall}.
5347
5348 To suppress this warning use the @code{unused} attribute
5349 (@pxref{Variable Attributes}).
5350
5351 This warning is also enabled by @option{-Wunused}, which is enabled
5352 by @option{-Wall}.
5353
5354 @item -Wunused-function
5355 @opindex Wunused-function
5356 @opindex Wno-unused-function
5357 Warn whenever a static function is declared but not defined or a
5358 non-inline static function is unused.
5359 This warning is enabled by @option{-Wall}.
5360
5361 @item -Wunused-label
5362 @opindex Wunused-label
5363 @opindex Wno-unused-label
5364 Warn whenever a label is declared but not used.
5365 This warning is enabled by @option{-Wall}.
5366
5367 To suppress this warning use the @code{unused} attribute
5368 (@pxref{Variable Attributes}).
5369
5370 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5371 @opindex Wunused-local-typedefs
5372 @opindex Wno-unused-local-typedefs
5373 Warn when a typedef locally defined in a function is not used.
5374 This warning is enabled by @option{-Wall}.
5375
5376 @item -Wunused-parameter
5377 @opindex Wunused-parameter
5378 @opindex Wno-unused-parameter
5379 Warn whenever a function parameter is unused aside from its declaration.
5380
5381 To suppress this warning use the @code{unused} attribute
5382 (@pxref{Variable Attributes}).
5383
5384 @item -Wno-unused-result
5385 @opindex Wunused-result
5386 @opindex Wno-unused-result
5387 Do not warn if a caller of a function marked with attribute
5388 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5389 its return value. The default is @option{-Wunused-result}.
5390
5391 @item -Wunused-variable
5392 @opindex Wunused-variable
5393 @opindex Wno-unused-variable
5394 Warn whenever a local or static variable is unused aside from its
5395 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5396 but not for C++. This warning is enabled by @option{-Wall}.
5397
5398 To suppress this warning use the @code{unused} attribute
5399 (@pxref{Variable Attributes}).
5400
5401 @item -Wunused-const-variable
5402 @itemx -Wunused-const-variable=@var{n}
5403 @opindex Wunused-const-variable
5404 @opindex Wno-unused-const-variable
5405 Warn whenever a constant static variable is unused aside from its declaration.
5406 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5407 for C, but not for C++. In C this declares variable storage, but in C++ this
5408 is not an error since const variables take the place of @code{#define}s.
5409
5410 To suppress this warning use the @code{unused} attribute
5411 (@pxref{Variable Attributes}).
5412
5413 @table @gcctabopt
5414 @item -Wunused-const-variable=1
5415 This is the warning level that is enabled by @option{-Wunused-variable} for
5416 C. It warns only about unused static const variables defined in the main
5417 compilation unit, but not about static const variables declared in any
5418 header included.
5419
5420 @item -Wunused-const-variable=2
5421 This warning level also warns for unused constant static variables in
5422 headers (excluding system headers). This is the warning level of
5423 @option{-Wunused-const-variable} and must be explicitly requested since
5424 in C++ this isn't an error and in C it might be harder to clean up all
5425 headers included.
5426 @end table
5427
5428 @item -Wunused-value
5429 @opindex Wunused-value
5430 @opindex Wno-unused-value
5431 Warn whenever a statement computes a result that is explicitly not
5432 used. To suppress this warning cast the unused expression to
5433 @code{void}. This includes an expression-statement or the left-hand
5434 side of a comma expression that contains no side effects. For example,
5435 an expression such as @code{x[i,j]} causes a warning, while
5436 @code{x[(void)i,j]} does not.
5437
5438 This warning is enabled by @option{-Wall}.
5439
5440 @item -Wunused
5441 @opindex Wunused
5442 @opindex Wno-unused
5443 All the above @option{-Wunused} options combined.
5444
5445 In order to get a warning about an unused function parameter, you must
5446 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5447 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5448
5449 @item -Wuninitialized
5450 @opindex Wuninitialized
5451 @opindex Wno-uninitialized
5452 Warn if an automatic variable is used without first being initialized
5453 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5454 warn if a non-static reference or non-static @code{const} member
5455 appears in a class without constructors.
5456
5457 If you want to warn about code that uses the uninitialized value of the
5458 variable in its own initializer, use the @option{-Winit-self} option.
5459
5460 These warnings occur for individual uninitialized or clobbered
5461 elements of structure, union or array variables as well as for
5462 variables that are uninitialized or clobbered as a whole. They do
5463 not occur for variables or elements declared @code{volatile}. Because
5464 these warnings depend on optimization, the exact variables or elements
5465 for which there are warnings depends on the precise optimization
5466 options and version of GCC used.
5467
5468 Note that there may be no warning about a variable that is used only
5469 to compute a value that itself is never used, because such
5470 computations may be deleted by data flow analysis before the warnings
5471 are printed.
5472
5473 @item -Winvalid-memory-model
5474 @opindex Winvalid-memory-model
5475 @opindex Wno-invalid-memory-model
5476 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5477 and the C11 atomic generic functions with a memory consistency argument
5478 that is either invalid for the operation or outside the range of values
5479 of the @code{memory_order} enumeration. For example, since the
5480 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5481 defined for the relaxed, release, and sequentially consistent memory
5482 orders the following code is diagnosed:
5483
5484 @smallexample
5485 void store (int *i)
5486 @{
5487 __atomic_store_n (i, 0, memory_order_consume);
5488 @}
5489 @end smallexample
5490
5491 @option{-Winvalid-memory-model} is enabled by default.
5492
5493 @item -Wmaybe-uninitialized
5494 @opindex Wmaybe-uninitialized
5495 @opindex Wno-maybe-uninitialized
5496 For an automatic (i.e.@: local) variable, if there exists a path from the
5497 function entry to a use of the variable that is initialized, but there exist
5498 some other paths for which the variable is not initialized, the compiler
5499 emits a warning if it cannot prove the uninitialized paths are not
5500 executed at run time.
5501
5502 These warnings are only possible in optimizing compilation, because otherwise
5503 GCC does not keep track of the state of variables.
5504
5505 These warnings are made optional because GCC may not be able to determine when
5506 the code is correct in spite of appearing to have an error. Here is one
5507 example of how this can happen:
5508
5509 @smallexample
5510 @group
5511 @{
5512 int x;
5513 switch (y)
5514 @{
5515 case 1: x = 1;
5516 break;
5517 case 2: x = 4;
5518 break;
5519 case 3: x = 5;
5520 @}
5521 foo (x);
5522 @}
5523 @end group
5524 @end smallexample
5525
5526 @noindent
5527 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5528 always initialized, but GCC doesn't know this. To suppress the
5529 warning, you need to provide a default case with assert(0) or
5530 similar code.
5531
5532 @cindex @code{longjmp} warnings
5533 This option also warns when a non-volatile automatic variable might be
5534 changed by a call to @code{longjmp}.
5535 The compiler sees only the calls to @code{setjmp}. It cannot know
5536 where @code{longjmp} will be called; in fact, a signal handler could
5537 call it at any point in the code. As a result, you may get a warning
5538 even when there is in fact no problem because @code{longjmp} cannot
5539 in fact be called at the place that would cause a problem.
5540
5541 Some spurious warnings can be avoided if you declare all the functions
5542 you use that never return as @code{noreturn}. @xref{Function
5543 Attributes}.
5544
5545 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5546
5547 @item -Wunknown-pragmas
5548 @opindex Wunknown-pragmas
5549 @opindex Wno-unknown-pragmas
5550 @cindex warning for unknown pragmas
5551 @cindex unknown pragmas, warning
5552 @cindex pragmas, warning of unknown
5553 Warn when a @code{#pragma} directive is encountered that is not understood by
5554 GCC@. If this command-line option is used, warnings are even issued
5555 for unknown pragmas in system header files. This is not the case if
5556 the warnings are only enabled by the @option{-Wall} command-line option.
5557
5558 @item -Wno-pragmas
5559 @opindex Wno-pragmas
5560 @opindex Wpragmas
5561 Do not warn about misuses of pragmas, such as incorrect parameters,
5562 invalid syntax, or conflicts between pragmas. See also
5563 @option{-Wunknown-pragmas}.
5564
5565 @item -Wno-prio-ctor-dtor
5566 @opindex Wno-prio-ctor-dtor
5567 @opindex Wprio-ctor-dtor
5568 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5569 The use of constructor and destructor attributes allow you to assign a
5570 priority to the constructor/destructor to control its order of execution
5571 before @code{main} is called or after it returns. The priority values must be
5572 greater than 100 as the compiler reserves priority values between 0--100 for
5573 the implementation.
5574
5575 @item -Wstrict-aliasing
5576 @opindex Wstrict-aliasing
5577 @opindex Wno-strict-aliasing
5578 This option is only active when @option{-fstrict-aliasing} is active.
5579 It warns about code that might break the strict aliasing rules that the
5580 compiler is using for optimization. The warning does not catch all
5581 cases, but does attempt to catch the more common pitfalls. It is
5582 included in @option{-Wall}.
5583 It is equivalent to @option{-Wstrict-aliasing=3}
5584
5585 @item -Wstrict-aliasing=n
5586 @opindex Wstrict-aliasing=n
5587 This option is only active when @option{-fstrict-aliasing} is active.
5588 It warns about code that might break the strict aliasing rules that the
5589 compiler is using for optimization.
5590 Higher levels correspond to higher accuracy (fewer false positives).
5591 Higher levels also correspond to more effort, similar to the way @option{-O}
5592 works.
5593 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5594
5595 Level 1: Most aggressive, quick, least accurate.
5596 Possibly useful when higher levels
5597 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5598 false negatives. However, it has many false positives.
5599 Warns for all pointer conversions between possibly incompatible types,
5600 even if never dereferenced. Runs in the front end only.
5601
5602 Level 2: Aggressive, quick, not too precise.
5603 May still have many false positives (not as many as level 1 though),
5604 and few false negatives (but possibly more than level 1).
5605 Unlike level 1, it only warns when an address is taken. Warns about
5606 incomplete types. Runs in the front end only.
5607
5608 Level 3 (default for @option{-Wstrict-aliasing}):
5609 Should have very few false positives and few false
5610 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5611 Takes care of the common pun+dereference pattern in the front end:
5612 @code{*(int*)&some_float}.
5613 If optimization is enabled, it also runs in the back end, where it deals
5614 with multiple statement cases using flow-sensitive points-to information.
5615 Only warns when the converted pointer is dereferenced.
5616 Does not warn about incomplete types.
5617
5618 @item -Wstrict-overflow
5619 @itemx -Wstrict-overflow=@var{n}
5620 @opindex Wstrict-overflow
5621 @opindex Wno-strict-overflow
5622 This option is only active when signed overflow is undefined.
5623 It warns about cases where the compiler optimizes based on the
5624 assumption that signed overflow does not occur. Note that it does not
5625 warn about all cases where the code might overflow: it only warns
5626 about cases where the compiler implements some optimization. Thus
5627 this warning depends on the optimization level.
5628
5629 An optimization that assumes that signed overflow does not occur is
5630 perfectly safe if the values of the variables involved are such that
5631 overflow never does, in fact, occur. Therefore this warning can
5632 easily give a false positive: a warning about code that is not
5633 actually a problem. To help focus on important issues, several
5634 warning levels are defined. No warnings are issued for the use of
5635 undefined signed overflow when estimating how many iterations a loop
5636 requires, in particular when determining whether a loop will be
5637 executed at all.
5638
5639 @table @gcctabopt
5640 @item -Wstrict-overflow=1
5641 Warn about cases that are both questionable and easy to avoid. For
5642 example the compiler simplifies
5643 @code{x + 1 > x} to @code{1}. This level of
5644 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5645 are not, and must be explicitly requested.
5646
5647 @item -Wstrict-overflow=2
5648 Also warn about other cases where a comparison is simplified to a
5649 constant. For example: @code{abs (x) >= 0}. This can only be
5650 simplified when signed integer overflow is undefined, because
5651 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5652 zero. @option{-Wstrict-overflow} (with no level) is the same as
5653 @option{-Wstrict-overflow=2}.
5654
5655 @item -Wstrict-overflow=3
5656 Also warn about other cases where a comparison is simplified. For
5657 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5658
5659 @item -Wstrict-overflow=4
5660 Also warn about other simplifications not covered by the above cases.
5661 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5662
5663 @item -Wstrict-overflow=5
5664 Also warn about cases where the compiler reduces the magnitude of a
5665 constant involved in a comparison. For example: @code{x + 2 > y} is
5666 simplified to @code{x + 1 >= y}. This is reported only at the
5667 highest warning level because this simplification applies to many
5668 comparisons, so this warning level gives a very large number of
5669 false positives.
5670 @end table
5671
5672 @item -Wstringop-overflow
5673 @itemx -Wstringop-overflow=@var{type}
5674 @opindex Wstringop-overflow
5675 @opindex Wno-stringop-overflow
5676 Warn for calls to string manipulation functions such as @code{memcpy} and
5677 @code{strcpy} that are determined to overflow the destination buffer. The
5678 optional argument is one greater than the type of Object Size Checking to
5679 perform to determine the size of the destination. @xref{Object Size Checking}.
5680 The argument is meaningful only for functions that operate on character arrays
5681 but not for raw memory functions like @code{memcpy} which always make use
5682 of Object Size type-0. The option also warns for calls that specify a size
5683 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5684 The option produces the best results with optimization enabled but can detect
5685 a small subset of simple buffer overflows even without optimization in
5686 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5687 correspond to the standard functions. In any case, the option warns about
5688 just a subset of buffer overflows detected by the corresponding overflow
5689 checking built-ins. For example, the option will issue a warning for
5690 the @code{strcpy} call below because it copies at least 5 characters
5691 (the string @code{"blue"} including the terminating NUL) into the buffer
5692 of size 4.
5693
5694 @smallexample
5695 enum Color @{ blue, purple, yellow @};
5696 const char* f (enum Color clr)
5697 @{
5698 static char buf [4];
5699 const char *str;
5700 switch (clr)
5701 @{
5702 case blue: str = "blue"; break;
5703 case purple: str = "purple"; break;
5704 case yellow: str = "yellow"; break;
5705 @}
5706
5707 return strcpy (buf, str); // warning here
5708 @}
5709 @end smallexample
5710
5711 Option @option{-Wstringop-overflow=2} is enabled by default.
5712
5713 @table @gcctabopt
5714 @item -Wstringop-overflow
5715 @itemx -Wstringop-overflow=1
5716 @opindex Wstringop-overflow
5717 @opindex Wno-stringop-overflow
5718 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5719 to determine the sizes of destination objects. This is the default setting
5720 of the option. At this setting the option will not warn for writes past
5721 the end of subobjects of larger objects accessed by pointers unless the
5722 size of the largest surrounding object is known. When the destination may
5723 be one of several objects it is assumed to be the largest one of them. On
5724 Linux systems, when optimization is enabled at this setting the option warns
5725 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5726 a non-zero value.
5727
5728 @item -Wstringop-overflow=2
5729 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5730 to determine the sizes of destination objects. At this setting the option
5731 will warn about overflows when writing to members of the largest complete
5732 objects whose exact size is known. It will, however, not warn for excessive
5733 writes to the same members of unknown objects referenced by pointers since
5734 they may point to arrays containing unknown numbers of elements.
5735
5736 @item -Wstringop-overflow=3
5737 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5738 to determine the sizes of destination objects. At this setting the option
5739 warns about overflowing the smallest object or data member. This is the
5740 most restrictive setting of the option that may result in warnings for safe
5741 code.
5742
5743 @item -Wstringop-overflow=4
5744 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5745 to determine the sizes of destination objects. At this setting the option
5746 will warn about overflowing any data members, and when the destination is
5747 one of several objects it uses the size of the largest of them to decide
5748 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5749 setting of the option may result in warnings for benign code.
5750 @end table
5751
5752 @item -Wstringop-truncation
5753 @opindex Wstringop-truncation
5754 @opindex Wno-stringop-truncation
5755 Warn for calls to bounded string manipulation functions such as @code{strncat},
5756 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5757 or leave the destination unchanged.
5758
5759 In the following example, the call to @code{strncat} specifies a bound that
5760 is less than the length of the source string. As a result, the copy of
5761 the source will be truncated and so the call is diagnosed. To avoid the
5762 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5763
5764 @smallexample
5765 void append (char *buf, size_t bufsize)
5766 @{
5767 strncat (buf, ".txt", 3);
5768 @}
5769 @end smallexample
5770
5771 As another example, the following call to @code{strncpy} results in copying
5772 to @code{d} just the characters preceding the terminating NUL, without
5773 appending the NUL to the end. Assuming the result of @code{strncpy} is
5774 necessarily a NUL-terminated string is a common mistake, and so the call
5775 is diagnosed. To avoid the warning when the result is not expected to be
5776 NUL-terminated, call @code{memcpy} instead.
5777
5778 @smallexample
5779 void copy (char *d, const char *s)
5780 @{
5781 strncpy (d, s, strlen (s));
5782 @}
5783 @end smallexample
5784
5785 In the following example, the call to @code{strncpy} specifies the size
5786 of the destination buffer as the bound. If the length of the source
5787 string is equal to or greater than this size the result of the copy will
5788 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5789 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5790 element of the buffer to @code{NUL}.
5791
5792 @smallexample
5793 void copy (const char *s)
5794 @{
5795 char buf[80];
5796 strncpy (buf, s, sizeof buf);
5797 @dots{}
5798 @}
5799 @end smallexample
5800
5801 In situations where a character array is intended to store a sequence
5802 of bytes with no terminating @code{NUL} such an array may be annotated
5803 with attribute @code{nonstring} to avoid this warning. Such arrays,
5804 however, are not suitable arguments to functions that expect
5805 @code{NUL}-terminated strings. To help detect accidental misuses of
5806 such arrays GCC issues warnings unless it can prove that the use is
5807 safe. @xref{Common Variable Attributes}.
5808
5809 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5810 @opindex Wsuggest-attribute=
5811 @opindex Wno-suggest-attribute=
5812 Warn for cases where adding an attribute may be beneficial. The
5813 attributes currently supported are listed below.
5814
5815 @table @gcctabopt
5816 @item -Wsuggest-attribute=pure
5817 @itemx -Wsuggest-attribute=const
5818 @itemx -Wsuggest-attribute=noreturn
5819 @itemx -Wmissing-noreturn
5820 @itemx -Wsuggest-attribute=malloc
5821 @opindex Wsuggest-attribute=pure
5822 @opindex Wno-suggest-attribute=pure
5823 @opindex Wsuggest-attribute=const
5824 @opindex Wno-suggest-attribute=const
5825 @opindex Wsuggest-attribute=noreturn
5826 @opindex Wno-suggest-attribute=noreturn
5827 @opindex Wmissing-noreturn
5828 @opindex Wno-missing-noreturn
5829 @opindex Wsuggest-attribute=malloc
5830 @opindex Wno-suggest-attribute=malloc
5831
5832 Warn about functions that might be candidates for attributes
5833 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5834 only warns for functions visible in other compilation units or (in the case of
5835 @code{pure} and @code{const}) if it cannot prove that the function returns
5836 normally. A function returns normally if it doesn't contain an infinite loop or
5837 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5838 requires option @option{-fipa-pure-const}, which is enabled by default at
5839 @option{-O} and higher. Higher optimization levels improve the accuracy
5840 of the analysis.
5841
5842 @item -Wsuggest-attribute=format
5843 @itemx -Wmissing-format-attribute
5844 @opindex Wsuggest-attribute=format
5845 @opindex Wmissing-format-attribute
5846 @opindex Wno-suggest-attribute=format
5847 @opindex Wno-missing-format-attribute
5848 @opindex Wformat
5849 @opindex Wno-format
5850
5851 Warn about function pointers that might be candidates for @code{format}
5852 attributes. Note these are only possible candidates, not absolute ones.
5853 GCC guesses that function pointers with @code{format} attributes that
5854 are used in assignment, initialization, parameter passing or return
5855 statements should have a corresponding @code{format} attribute in the
5856 resulting type. I.e.@: the left-hand side of the assignment or
5857 initialization, the type of the parameter variable, or the return type
5858 of the containing function respectively should also have a @code{format}
5859 attribute to avoid the warning.
5860
5861 GCC also warns about function definitions that might be
5862 candidates for @code{format} attributes. Again, these are only
5863 possible candidates. GCC guesses that @code{format} attributes
5864 might be appropriate for any function that calls a function like
5865 @code{vprintf} or @code{vscanf}, but this might not always be the
5866 case, and some functions for which @code{format} attributes are
5867 appropriate may not be detected.
5868
5869 @item -Wsuggest-attribute=cold
5870 @opindex Wsuggest-attribute=cold
5871 @opindex Wno-suggest-attribute=cold
5872
5873 Warn about functions that might be candidates for @code{cold} attribute. This
5874 is based on static detection and generally will only warn about functions which
5875 always leads to a call to another @code{cold} function such as wrappers of
5876 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5877 @end table
5878
5879 @item -Wsuggest-final-types
5880 @opindex Wno-suggest-final-types
5881 @opindex Wsuggest-final-types
5882 Warn about types with virtual methods where code quality would be improved
5883 if the type were declared with the C++11 @code{final} specifier,
5884 or, if possible,
5885 declared in an anonymous namespace. This allows GCC to more aggressively
5886 devirtualize the polymorphic calls. This warning is more effective with link
5887 time optimization, where the information about the class hierarchy graph is
5888 more complete.
5889
5890 @item -Wsuggest-final-methods
5891 @opindex Wno-suggest-final-methods
5892 @opindex Wsuggest-final-methods
5893 Warn about virtual methods where code quality would be improved if the method
5894 were declared with the C++11 @code{final} specifier,
5895 or, if possible, its type were
5896 declared in an anonymous namespace or with the @code{final} specifier.
5897 This warning is
5898 more effective with link-time optimization, where the information about the
5899 class hierarchy graph is more complete. It is recommended to first consider
5900 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5901 annotations.
5902
5903 @item -Wsuggest-override
5904 Warn about overriding virtual functions that are not marked with the override
5905 keyword.
5906
5907 @item -Walloc-zero
5908 @opindex Wno-alloc-zero
5909 @opindex Walloc-zero
5910 Warn about calls to allocation functions decorated with attribute
5911 @code{alloc_size} that specify zero bytes, including those to the built-in
5912 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5913 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5914 when called with a zero size differs among implementations (and in the case
5915 of @code{realloc} has been deprecated) relying on it may result in subtle
5916 portability bugs and should be avoided.
5917
5918 @item -Walloc-size-larger-than=@var{byte-size}
5919 @opindex Walloc-size-larger-than=
5920 @opindex Wno-alloc-size-larger-than
5921 Warn about calls to functions decorated with attribute @code{alloc_size}
5922 that attempt to allocate objects larger than the specified number of bytes,
5923 or where the result of the size computation in an integer type with infinite
5924 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5925 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5926 Warnings controlled by the option can be disabled either by specifying
5927 @var{byte-size} of @samp{SIZE_MAX} or more or by
5928 @option{-Wno-alloc-size-larger-than}.
5929 @xref{Function Attributes}.
5930
5931 @item -Wno-alloc-size-larger-than
5932 @opindex Wno-alloc-size-larger-than
5933 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5934 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5935 larger.
5936
5937 @item -Walloca
5938 @opindex Wno-alloca
5939 @opindex Walloca
5940 This option warns on all uses of @code{alloca} in the source.
5941
5942 @item -Walloca-larger-than=@var{byte-size}
5943 @opindex Walloca-larger-than=
5944 @opindex Wno-alloca-larger-than
5945 This option warns on calls to @code{alloca} with an integer argument whose
5946 value is either zero, or that is not bounded by a controlling predicate
5947 that limits its value to at most @var{byte-size}. It also warns for calls
5948 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5949 types are considered unbounded even if they appear to be constrained to
5950 the expected range.
5951
5952 For example, a bounded case of @code{alloca} could be:
5953
5954 @smallexample
5955 void func (size_t n)
5956 @{
5957 void *p;
5958 if (n <= 1000)
5959 p = alloca (n);
5960 else
5961 p = malloc (n);
5962 f (p);
5963 @}
5964 @end smallexample
5965
5966 In the above example, passing @code{-Walloca-larger-than=1000} would not
5967 issue a warning because the call to @code{alloca} is known to be at most
5968 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5969 the compiler would emit a warning.
5970
5971 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5972 controlling predicate constraining its integer argument. For example:
5973
5974 @smallexample
5975 void func ()
5976 @{
5977 void *p = alloca (n);
5978 f (p);
5979 @}
5980 @end smallexample
5981
5982 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5983 a warning, but this time because of the lack of bounds checking.
5984
5985 Note, that even seemingly correct code involving signed integers could
5986 cause a warning:
5987
5988 @smallexample
5989 void func (signed int n)
5990 @{
5991 if (n < 500)
5992 @{
5993 p = alloca (n);
5994 f (p);
5995 @}
5996 @}
5997 @end smallexample
5998
5999 In the above example, @var{n} could be negative, causing a larger than
6000 expected argument to be implicitly cast into the @code{alloca} call.
6001
6002 This option also warns when @code{alloca} is used in a loop.
6003
6004 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6005 but is usually only effective when @option{-ftree-vrp} is active (default
6006 for @option{-O2} and above).
6007
6008 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6009
6010 @item -Wno-alloca-larger-than
6011 @opindex Wno-alloca-larger-than
6012 Disable @option{-Walloca-larger-than=} warnings. The option is
6013 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6014
6015 @item -Warray-bounds
6016 @itemx -Warray-bounds=@var{n}
6017 @opindex Wno-array-bounds
6018 @opindex Warray-bounds
6019 This option is only active when @option{-ftree-vrp} is active
6020 (default for @option{-O2} and above). It warns about subscripts to arrays
6021 that are always out of bounds. This warning is enabled by @option{-Wall}.
6022
6023 @table @gcctabopt
6024 @item -Warray-bounds=1
6025 This is the warning level of @option{-Warray-bounds} and is enabled
6026 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6027
6028 @item -Warray-bounds=2
6029 This warning level also warns about out of bounds access for
6030 arrays at the end of a struct and for arrays accessed through
6031 pointers. This warning level may give a larger number of
6032 false positives and is deactivated by default.
6033 @end table
6034
6035 @item -Wattribute-alias=@var{n}
6036 @itemx -Wno-attribute-alias
6037 @opindex -Wattribute-alias
6038 @opindex -Wno-attribute-alias
6039 Warn about declarations using the @code{alias} and similar attributes whose
6040 target is incompatible with the type of the alias.
6041 @xref{Function Attributes,,Declaring Attributes of Functions}.
6042 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
6043
6044 @table @gcctabopt
6045 @item -Wattribute-alias=1
6046 The default warning level of the @option{-Wattribute-alias} option diagnoses
6047 incompatibilities between the type of the alias declaration and that of its
6048 target. Such incompatibilities are typically indicative of bugs.
6049
6050 @item -Wattribute-alias=2
6051 At this level @option{-Wattribute-alias} also diagnoses mismatches between
6052 the set of attributes of the alias declaration and the attributes applied
6053 to its target. Although in some cases such mismatches may indicate bugs,
6054 in other cases they may be benign and could be resolved simply by adding
6055 the missing attribute to the target.
6056 @end table
6057
6058 @item -Wbool-compare
6059 @opindex Wno-bool-compare
6060 @opindex Wbool-compare
6061 Warn about boolean expression compared with an integer value different from
6062 @code{true}/@code{false}. For instance, the following comparison is
6063 always false:
6064 @smallexample
6065 int n = 5;
6066 @dots{}
6067 if ((n > 1) == 2) @{ @dots{} @}
6068 @end smallexample
6069 This warning is enabled by @option{-Wall}.
6070
6071 @item -Wbool-operation
6072 @opindex Wno-bool-operation
6073 @opindex Wbool-operation
6074 Warn about suspicious operations on expressions of a boolean type. For
6075 instance, bitwise negation of a boolean is very likely a bug in the program.
6076 For C, this warning also warns about incrementing or decrementing a boolean,
6077 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6078 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6079
6080 This warning is enabled by @option{-Wall}.
6081
6082 @item -Wduplicated-branches
6083 @opindex Wno-duplicated-branches
6084 @opindex Wduplicated-branches
6085 Warn when an if-else has identical branches. This warning detects cases like
6086 @smallexample
6087 if (p != NULL)
6088 return 0;
6089 else
6090 return 0;
6091 @end smallexample
6092 It doesn't warn when both branches contain just a null statement. This warning
6093 also warn for conditional operators:
6094 @smallexample
6095 int i = x ? *p : *p;
6096 @end smallexample
6097
6098 @item -Wduplicated-cond
6099 @opindex Wno-duplicated-cond
6100 @opindex Wduplicated-cond
6101 Warn about duplicated conditions in an if-else-if chain. For instance,
6102 warn for the following code:
6103 @smallexample
6104 if (p->q != NULL) @{ @dots{} @}
6105 else if (p->q != NULL) @{ @dots{} @}
6106 @end smallexample
6107
6108 @item -Wframe-address
6109 @opindex Wno-frame-address
6110 @opindex Wframe-address
6111 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6112 is called with an argument greater than 0. Such calls may return indeterminate
6113 values or crash the program. The warning is included in @option{-Wall}.
6114
6115 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6116 @opindex Wno-discarded-qualifiers
6117 @opindex Wdiscarded-qualifiers
6118 Do not warn if type qualifiers on pointers are being discarded.
6119 Typically, the compiler warns if a @code{const char *} variable is
6120 passed to a function that takes a @code{char *} parameter. This option
6121 can be used to suppress such a warning.
6122
6123 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6124 @opindex Wno-discarded-array-qualifiers
6125 @opindex Wdiscarded-array-qualifiers
6126 Do not warn if type qualifiers on arrays which are pointer targets
6127 are being discarded. Typically, the compiler warns if a
6128 @code{const int (*)[]} variable is passed to a function that
6129 takes a @code{int (*)[]} parameter. This option can be used to
6130 suppress such a warning.
6131
6132 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6133 @opindex Wno-incompatible-pointer-types
6134 @opindex Wincompatible-pointer-types
6135 Do not warn when there is a conversion between pointers that have incompatible
6136 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6137 which warns for pointer argument passing or assignment with different
6138 signedness.
6139
6140 @item -Wno-int-conversion @r{(C and Objective-C only)}
6141 @opindex Wno-int-conversion
6142 @opindex Wint-conversion
6143 Do not warn about incompatible integer to pointer and pointer to integer
6144 conversions. This warning is about implicit conversions; for explicit
6145 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6146 @option{-Wno-pointer-to-int-cast} may be used.
6147
6148 @item -Wno-div-by-zero
6149 @opindex Wno-div-by-zero
6150 @opindex Wdiv-by-zero
6151 Do not warn about compile-time integer division by zero. Floating-point
6152 division by zero is not warned about, as it can be a legitimate way of
6153 obtaining infinities and NaNs.
6154
6155 @item -Wsystem-headers
6156 @opindex Wsystem-headers
6157 @opindex Wno-system-headers
6158 @cindex warnings from system headers
6159 @cindex system headers, warnings from
6160 Print warning messages for constructs found in system header files.
6161 Warnings from system headers are normally suppressed, on the assumption
6162 that they usually do not indicate real problems and would only make the
6163 compiler output harder to read. Using this command-line option tells
6164 GCC to emit warnings from system headers as if they occurred in user
6165 code. However, note that using @option{-Wall} in conjunction with this
6166 option does @emph{not} warn about unknown pragmas in system
6167 headers---for that, @option{-Wunknown-pragmas} must also be used.
6168
6169 @item -Wtautological-compare
6170 @opindex Wtautological-compare
6171 @opindex Wno-tautological-compare
6172 Warn if a self-comparison always evaluates to true or false. This
6173 warning detects various mistakes such as:
6174 @smallexample
6175 int i = 1;
6176 @dots{}
6177 if (i > i) @{ @dots{} @}
6178 @end smallexample
6179
6180 This warning also warns about bitwise comparisons that always evaluate
6181 to true or false, for instance:
6182 @smallexample
6183 if ((a & 16) == 10) @{ @dots{} @}
6184 @end smallexample
6185 will always be false.
6186
6187 This warning is enabled by @option{-Wall}.
6188
6189 @item -Wtrampolines
6190 @opindex Wtrampolines
6191 @opindex Wno-trampolines
6192 Warn about trampolines generated for pointers to nested functions.
6193 A trampoline is a small piece of data or code that is created at run
6194 time on the stack when the address of a nested function is taken, and is
6195 used to call the nested function indirectly. For some targets, it is
6196 made up of data only and thus requires no special treatment. But, for
6197 most targets, it is made up of code and thus requires the stack to be
6198 made executable in order for the program to work properly.
6199
6200 @item -Wfloat-equal
6201 @opindex Wfloat-equal
6202 @opindex Wno-float-equal
6203 Warn if floating-point values are used in equality comparisons.
6204
6205 The idea behind this is that sometimes it is convenient (for the
6206 programmer) to consider floating-point values as approximations to
6207 infinitely precise real numbers. If you are doing this, then you need
6208 to compute (by analyzing the code, or in some other way) the maximum or
6209 likely maximum error that the computation introduces, and allow for it
6210 when performing comparisons (and when producing output, but that's a
6211 different problem). In particular, instead of testing for equality, you
6212 should check to see whether the two values have ranges that overlap; and
6213 this is done with the relational operators, so equality comparisons are
6214 probably mistaken.
6215
6216 @item -Wtraditional @r{(C and Objective-C only)}
6217 @opindex Wtraditional
6218 @opindex Wno-traditional
6219 Warn about certain constructs that behave differently in traditional and
6220 ISO C@. Also warn about ISO C constructs that have no traditional C
6221 equivalent, and/or problematic constructs that should be avoided.
6222
6223 @itemize @bullet
6224 @item
6225 Macro parameters that appear within string literals in the macro body.
6226 In traditional C macro replacement takes place within string literals,
6227 but in ISO C it does not.
6228
6229 @item
6230 In traditional C, some preprocessor directives did not exist.
6231 Traditional preprocessors only considered a line to be a directive
6232 if the @samp{#} appeared in column 1 on the line. Therefore
6233 @option{-Wtraditional} warns about directives that traditional C
6234 understands but ignores because the @samp{#} does not appear as the
6235 first character on the line. It also suggests you hide directives like
6236 @code{#pragma} not understood by traditional C by indenting them. Some
6237 traditional implementations do not recognize @code{#elif}, so this option
6238 suggests avoiding it altogether.
6239
6240 @item
6241 A function-like macro that appears without arguments.
6242
6243 @item
6244 The unary plus operator.
6245
6246 @item
6247 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6248 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6249 constants.) Note, these suffixes appear in macros defined in the system
6250 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6251 Use of these macros in user code might normally lead to spurious
6252 warnings, however GCC's integrated preprocessor has enough context to
6253 avoid warning in these cases.
6254
6255 @item
6256 A function declared external in one block and then used after the end of
6257 the block.
6258
6259 @item
6260 A @code{switch} statement has an operand of type @code{long}.
6261
6262 @item
6263 A non-@code{static} function declaration follows a @code{static} one.
6264 This construct is not accepted by some traditional C compilers.
6265
6266 @item
6267 The ISO type of an integer constant has a different width or
6268 signedness from its traditional type. This warning is only issued if
6269 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6270 typically represent bit patterns, are not warned about.
6271
6272 @item
6273 Usage of ISO string concatenation is detected.
6274
6275 @item
6276 Initialization of automatic aggregates.
6277
6278 @item
6279 Identifier conflicts with labels. Traditional C lacks a separate
6280 namespace for labels.
6281
6282 @item
6283 Initialization of unions. If the initializer is zero, the warning is
6284 omitted. This is done under the assumption that the zero initializer in
6285 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6286 initializer warnings and relies on default initialization to zero in the
6287 traditional C case.
6288
6289 @item
6290 Conversions by prototypes between fixed/floating-point values and vice
6291 versa. The absence of these prototypes when compiling with traditional
6292 C causes serious problems. This is a subset of the possible
6293 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6294
6295 @item
6296 Use of ISO C style function definitions. This warning intentionally is
6297 @emph{not} issued for prototype declarations or variadic functions
6298 because these ISO C features appear in your code when using
6299 libiberty's traditional C compatibility macros, @code{PARAMS} and
6300 @code{VPARAMS}. This warning is also bypassed for nested functions
6301 because that feature is already a GCC extension and thus not relevant to
6302 traditional C compatibility.
6303 @end itemize
6304
6305 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6306 @opindex Wtraditional-conversion
6307 @opindex Wno-traditional-conversion
6308 Warn if a prototype causes a type conversion that is different from what
6309 would happen to the same argument in the absence of a prototype. This
6310 includes conversions of fixed point to floating and vice versa, and
6311 conversions changing the width or signedness of a fixed-point argument
6312 except when the same as the default promotion.
6313
6314 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6315 @opindex Wdeclaration-after-statement
6316 @opindex Wno-declaration-after-statement
6317 Warn when a declaration is found after a statement in a block. This
6318 construct, known from C++, was introduced with ISO C99 and is by default
6319 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6320
6321 @item -Wshadow
6322 @opindex Wshadow
6323 @opindex Wno-shadow
6324 Warn whenever a local variable or type declaration shadows another
6325 variable, parameter, type, class member (in C++), or instance variable
6326 (in Objective-C) or whenever a built-in function is shadowed. Note
6327 that in C++, the compiler warns if a local variable shadows an
6328 explicit typedef, but not if it shadows a struct/class/enum.
6329 Same as @option{-Wshadow=global}.
6330
6331 @item -Wno-shadow-ivar @r{(Objective-C only)}
6332 @opindex Wno-shadow-ivar
6333 @opindex Wshadow-ivar
6334 Do not warn whenever a local variable shadows an instance variable in an
6335 Objective-C method.
6336
6337 @item -Wshadow=global
6338 @opindex Wshadow=local
6339 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6340
6341 @item -Wshadow=local
6342 @opindex Wshadow=local
6343 Warn when a local variable shadows another local variable or parameter.
6344 This warning is enabled by @option{-Wshadow=global}.
6345
6346 @item -Wshadow=compatible-local
6347 @opindex Wshadow=compatible-local
6348 Warn when a local variable shadows another local variable or parameter
6349 whose type is compatible with that of the shadowing variable. In C++,
6350 type compatibility here means the type of the shadowing variable can be
6351 converted to that of the shadowed variable. The creation of this flag
6352 (in addition to @option{-Wshadow=local}) is based on the idea that when
6353 a local variable shadows another one of incompatible type, it is most
6354 likely intentional, not a bug or typo, as shown in the following example:
6355
6356 @smallexample
6357 @group
6358 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6359 @{
6360 for (int i = 0; i < N; ++i)
6361 @{
6362 ...
6363 @}
6364 ...
6365 @}
6366 @end group
6367 @end smallexample
6368
6369 Since the two variable @code{i} in the example above have incompatible types,
6370 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6371 Because their types are incompatible, if a programmer accidentally uses one
6372 in place of the other, type checking will catch that and emit an error or
6373 warning. So not warning (about shadowing) in this case will not lead to
6374 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6375 possibly reduce the number of warnings triggered by intentional shadowing.
6376
6377 This warning is enabled by @option{-Wshadow=local}.
6378
6379 @item -Wlarger-than=@var{byte-size}
6380 @opindex Wlarger-than=
6381 @opindex Wlarger-than-@var{byte-size}
6382 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6383 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6384 Warnings controlled by the option can be disabled either by specifying
6385 @var{byte-size} of @samp{SIZE_MAX} or more or by
6386 @option{-Wno-larger-than}.
6387
6388 @item -Wno-larger-than
6389 @opindex Wno-larger-than
6390 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6391 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6392
6393 @item -Wframe-larger-than=@var{byte-size}
6394 @opindex Wframe-larger-than=
6395 @opindex Wno-frame-larger-than
6396 Warn if the size of a function frame exceeds @var{byte-size}.
6397 The computation done to determine the stack frame size is approximate
6398 and not conservative.
6399 The actual requirements may be somewhat greater than @var{byte-size}
6400 even if you do not get a warning. In addition, any space allocated
6401 via @code{alloca}, variable-length arrays, or related constructs
6402 is not included by the compiler when determining
6403 whether or not to issue a warning.
6404 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6405 Warnings controlled by the option can be disabled either by specifying
6406 @var{byte-size} of @samp{SIZE_MAX} or more or by
6407 @option{-Wno-frame-larger-than}.
6408
6409 @item -Wno-frame-larger-than
6410 @opindex Wno-frame-larger-than
6411 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6412 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6413
6414 @item -Wno-free-nonheap-object
6415 @opindex Wno-free-nonheap-object
6416 @opindex Wfree-nonheap-object
6417 Do not warn when attempting to free an object that was not allocated
6418 on the heap.
6419
6420 @item -Wstack-usage=@var{byte-size}
6421 @opindex Wstack-usage
6422 @opindex Wno-stack-usage
6423 Warn if the stack usage of a function might exceed @var{byte-size}.
6424 The computation done to determine the stack usage is conservative.
6425 Any space allocated via @code{alloca}, variable-length arrays, or related
6426 constructs is included by the compiler when determining whether or not to
6427 issue a warning.
6428
6429 The message is in keeping with the output of @option{-fstack-usage}.
6430
6431 @itemize
6432 @item
6433 If the stack usage is fully static but exceeds the specified amount, it's:
6434
6435 @smallexample
6436 warning: stack usage is 1120 bytes
6437 @end smallexample
6438 @item
6439 If the stack usage is (partly) dynamic but bounded, it's:
6440
6441 @smallexample
6442 warning: stack usage might be 1648 bytes
6443 @end smallexample
6444 @item
6445 If the stack usage is (partly) dynamic and not bounded, it's:
6446
6447 @smallexample
6448 warning: stack usage might be unbounded
6449 @end smallexample
6450 @end itemize
6451
6452 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6453 Warnings controlled by the option can be disabled either by specifying
6454 @var{byte-size} of @samp{SIZE_MAX} or more or by
6455 @option{-Wno-stack-usage}.
6456
6457 @item -Wno-stack-usage
6458 @opindex Wno-stack-usage
6459 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6460 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6461
6462 @item -Wunsafe-loop-optimizations
6463 @opindex Wunsafe-loop-optimizations
6464 @opindex Wno-unsafe-loop-optimizations
6465 Warn if the loop cannot be optimized because the compiler cannot
6466 assume anything on the bounds of the loop indices. With
6467 @option{-funsafe-loop-optimizations} warn if the compiler makes
6468 such assumptions.
6469
6470 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6471 @opindex Wno-pedantic-ms-format
6472 @opindex Wpedantic-ms-format
6473 When used in combination with @option{-Wformat}
6474 and @option{-pedantic} without GNU extensions, this option
6475 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6476 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6477 which depend on the MS runtime.
6478
6479 @item -Waligned-new
6480 @opindex Waligned-new
6481 @opindex Wno-aligned-new
6482 Warn about a new-expression of a type that requires greater alignment
6483 than the @code{alignof(std::max_align_t)} but uses an allocation
6484 function without an explicit alignment parameter. This option is
6485 enabled by @option{-Wall}.
6486
6487 Normally this only warns about global allocation functions, but
6488 @option{-Waligned-new=all} also warns about class member allocation
6489 functions.
6490
6491 @item -Wplacement-new
6492 @itemx -Wplacement-new=@var{n}
6493 @opindex Wplacement-new
6494 @opindex Wno-placement-new
6495 Warn about placement new expressions with undefined behavior, such as
6496 constructing an object in a buffer that is smaller than the type of
6497 the object. For example, the placement new expression below is diagnosed
6498 because it attempts to construct an array of 64 integers in a buffer only
6499 64 bytes large.
6500 @smallexample
6501 char buf [64];
6502 new (buf) int[64];
6503 @end smallexample
6504 This warning is enabled by default.
6505
6506 @table @gcctabopt
6507 @item -Wplacement-new=1
6508 This is the default warning level of @option{-Wplacement-new}. At this
6509 level the warning is not issued for some strictly undefined constructs that
6510 GCC allows as extensions for compatibility with legacy code. For example,
6511 the following @code{new} expression is not diagnosed at this level even
6512 though it has undefined behavior according to the C++ standard because
6513 it writes past the end of the one-element array.
6514 @smallexample
6515 struct S @{ int n, a[1]; @};
6516 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6517 new (s->a)int [32]();
6518 @end smallexample
6519
6520 @item -Wplacement-new=2
6521 At this level, in addition to diagnosing all the same constructs as at level
6522 1, a diagnostic is also issued for placement new expressions that construct
6523 an object in the last member of structure whose type is an array of a single
6524 element and whose size is less than the size of the object being constructed.
6525 While the previous example would be diagnosed, the following construct makes
6526 use of the flexible member array extension to avoid the warning at level 2.
6527 @smallexample
6528 struct S @{ int n, a[]; @};
6529 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6530 new (s->a)int [32]();
6531 @end smallexample
6532
6533 @end table
6534
6535 @item -Wpointer-arith
6536 @opindex Wpointer-arith
6537 @opindex Wno-pointer-arith
6538 Warn about anything that depends on the ``size of'' a function type or
6539 of @code{void}. GNU C assigns these types a size of 1, for
6540 convenience in calculations with @code{void *} pointers and pointers
6541 to functions. In C++, warn also when an arithmetic operation involves
6542 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6543
6544 @item -Wpointer-compare
6545 @opindex Wpointer-compare
6546 @opindex Wno-pointer-compare
6547 Warn if a pointer is compared with a zero character constant. This usually
6548 means that the pointer was meant to be dereferenced. For example:
6549
6550 @smallexample
6551 const char *p = foo ();
6552 if (p == '\0')
6553 return 42;
6554 @end smallexample
6555
6556 Note that the code above is invalid in C++11.
6557
6558 This warning is enabled by default.
6559
6560 @item -Wtype-limits
6561 @opindex Wtype-limits
6562 @opindex Wno-type-limits
6563 Warn if a comparison is always true or always false due to the limited
6564 range of the data type, but do not warn for constant expressions. For
6565 example, warn if an unsigned variable is compared against zero with
6566 @code{<} or @code{>=}. This warning is also enabled by
6567 @option{-Wextra}.
6568
6569 @item -Wabsolute-value @r{(C and Objective-C only)}
6570 @opindex Wabsolute-value
6571 @opindex Wno-absolute-value
6572 Warn when a wrong absolute value function seems to be used or when it
6573 does not have any effect because its argument is an unsigned type.
6574 This warning be suppressed with an explicit type cast and it is also
6575 enabled by @option{-Wextra}.
6576
6577 @include cppwarnopts.texi
6578
6579 @item -Wbad-function-cast @r{(C and Objective-C only)}
6580 @opindex Wbad-function-cast
6581 @opindex Wno-bad-function-cast
6582 Warn when a function call is cast to a non-matching type.
6583 For example, warn if a call to a function returning an integer type
6584 is cast to a pointer type.
6585
6586 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6587 @opindex Wc90-c99-compat
6588 @opindex Wno-c90-c99-compat
6589 Warn about features not present in ISO C90, but present in ISO C99.
6590 For instance, warn about use of variable length arrays, @code{long long}
6591 type, @code{bool} type, compound literals, designated initializers, and so
6592 on. This option is independent of the standards mode. Warnings are disabled
6593 in the expression that follows @code{__extension__}.
6594
6595 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6596 @opindex Wc99-c11-compat
6597 @opindex Wno-c99-c11-compat
6598 Warn about features not present in ISO C99, but present in ISO C11.
6599 For instance, warn about use of anonymous structures and unions,
6600 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6601 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6602 and so on. This option is independent of the standards mode. Warnings are
6603 disabled in the expression that follows @code{__extension__}.
6604
6605 @item -Wc++-compat @r{(C and Objective-C only)}
6606 @opindex Wc++-compat
6607 @opindex Wno-c++-compat
6608 Warn about ISO C constructs that are outside of the common subset of
6609 ISO C and ISO C++, e.g.@: request for implicit conversion from
6610 @code{void *} to a pointer to non-@code{void} type.
6611
6612 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6613 @opindex Wc++11-compat
6614 @opindex Wno-c++11-compat
6615 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6616 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6617 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6618 enabled by @option{-Wall}.
6619
6620 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6621 @opindex Wc++14-compat
6622 @opindex Wno-c++14-compat
6623 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6624 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6625
6626 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6627 @opindex Wc++17-compat
6628 @opindex Wno-c++17-compat
6629 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6630 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6631
6632 @item -Wcast-qual
6633 @opindex Wcast-qual
6634 @opindex Wno-cast-qual
6635 Warn whenever a pointer is cast so as to remove a type qualifier from
6636 the target type. For example, warn if a @code{const char *} is cast
6637 to an ordinary @code{char *}.
6638
6639 Also warn when making a cast that introduces a type qualifier in an
6640 unsafe way. For example, casting @code{char **} to @code{const char **}
6641 is unsafe, as in this example:
6642
6643 @smallexample
6644 /* p is char ** value. */
6645 const char **q = (const char **) p;
6646 /* Assignment of readonly string to const char * is OK. */
6647 *q = "string";
6648 /* Now char** pointer points to read-only memory. */
6649 **p = 'b';
6650 @end smallexample
6651
6652 @item -Wcast-align
6653 @opindex Wcast-align
6654 @opindex Wno-cast-align
6655 Warn whenever a pointer is cast such that the required alignment of the
6656 target is increased. For example, warn if a @code{char *} is cast to
6657 an @code{int *} on machines where integers can only be accessed at
6658 two- or four-byte boundaries.
6659
6660 @item -Wcast-align=strict
6661 @opindex Wcast-align=strict
6662 Warn whenever a pointer is cast such that the required alignment of the
6663 target is increased. For example, warn if a @code{char *} is cast to
6664 an @code{int *} regardless of the target machine.
6665
6666 @item -Wcast-function-type
6667 @opindex Wcast-function-type
6668 @opindex Wno-cast-function-type
6669 Warn when a function pointer is cast to an incompatible function pointer.
6670 In a cast involving function types with a variable argument list only
6671 the types of initial arguments that are provided are considered.
6672 Any parameter of pointer-type matches any other pointer-type. Any benign
6673 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6674 on ILP32 targets. Likewise type qualifiers are ignored. The function
6675 type @code{void (*) (void)} is special and matches everything, which can
6676 be used to suppress this warning.
6677 In a cast involving pointer to member types this warning warns whenever
6678 the type cast is changing the pointer to member type.
6679 This warning is enabled by @option{-Wextra}.
6680
6681 @item -Wwrite-strings
6682 @opindex Wwrite-strings
6683 @opindex Wno-write-strings
6684 When compiling C, give string constants the type @code{const
6685 char[@var{length}]} so that copying the address of one into a
6686 non-@code{const} @code{char *} pointer produces a warning. These
6687 warnings help you find at compile time code that can try to write
6688 into a string constant, but only if you have been very careful about
6689 using @code{const} in declarations and prototypes. Otherwise, it is
6690 just a nuisance. This is why we did not make @option{-Wall} request
6691 these warnings.
6692
6693 When compiling C++, warn about the deprecated conversion from string
6694 literals to @code{char *}. This warning is enabled by default for C++
6695 programs.
6696
6697 @item -Wcatch-value
6698 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6699 @opindex Wcatch-value
6700 @opindex Wno-catch-value
6701 Warn about catch handlers that do not catch via reference.
6702 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6703 warn about polymorphic class types that are caught by value.
6704 With @option{-Wcatch-value=2} warn about all class types that are caught
6705 by value. With @option{-Wcatch-value=3} warn about all types that are
6706 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6707
6708 @item -Wclobbered
6709 @opindex Wclobbered
6710 @opindex Wno-clobbered
6711 Warn for variables that might be changed by @code{longjmp} or
6712 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6713
6714 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6715 @opindex Wconditionally-supported
6716 @opindex Wno-conditionally-supported
6717 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6718
6719 @item -Wconversion
6720 @opindex Wconversion
6721 @opindex Wno-conversion
6722 Warn for implicit conversions that may alter a value. This includes
6723 conversions between real and integer, like @code{abs (x)} when
6724 @code{x} is @code{double}; conversions between signed and unsigned,
6725 like @code{unsigned ui = -1}; and conversions to smaller types, like
6726 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6727 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6728 changed by the conversion like in @code{abs (2.0)}. Warnings about
6729 conversions between signed and unsigned integers can be disabled by
6730 using @option{-Wno-sign-conversion}.
6731
6732 For C++, also warn for confusing overload resolution for user-defined
6733 conversions; and conversions that never use a type conversion
6734 operator: conversions to @code{void}, the same type, a base class or a
6735 reference to them. Warnings about conversions between signed and
6736 unsigned integers are disabled by default in C++ unless
6737 @option{-Wsign-conversion} is explicitly enabled.
6738
6739 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6740 @opindex Wconversion-null
6741 @opindex Wno-conversion-null
6742 Do not warn for conversions between @code{NULL} and non-pointer
6743 types. @option{-Wconversion-null} is enabled by default.
6744
6745 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6746 @opindex Wzero-as-null-pointer-constant
6747 @opindex Wno-zero-as-null-pointer-constant
6748 Warn when a literal @samp{0} is used as null pointer constant. This can
6749 be useful to facilitate the conversion to @code{nullptr} in C++11.
6750
6751 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6752 @opindex Wsubobject-linkage
6753 @opindex Wno-subobject-linkage
6754 Warn if a class type has a base or a field whose type uses the anonymous
6755 namespace or depends on a type with no linkage. If a type A depends on
6756 a type B with no or internal linkage, defining it in multiple
6757 translation units would be an ODR violation because the meaning of B
6758 is different in each translation unit. If A only appears in a single
6759 translation unit, the best way to silence the warning is to give it
6760 internal linkage by putting it in an anonymous namespace as well. The
6761 compiler doesn't give this warning for types defined in the main .C
6762 file, as those are unlikely to have multiple definitions.
6763 @option{-Wsubobject-linkage} is enabled by default.
6764
6765 @item -Wdangling-else
6766 @opindex Wdangling-else
6767 @opindex Wno-dangling-else
6768 Warn about constructions where there may be confusion to which
6769 @code{if} statement an @code{else} branch belongs. Here is an example of
6770 such a case:
6771
6772 @smallexample
6773 @group
6774 @{
6775 if (a)
6776 if (b)
6777 foo ();
6778 else
6779 bar ();
6780 @}
6781 @end group
6782 @end smallexample
6783
6784 In C/C++, every @code{else} branch belongs to the innermost possible
6785 @code{if} statement, which in this example is @code{if (b)}. This is
6786 often not what the programmer expected, as illustrated in the above
6787 example by indentation the programmer chose. When there is the
6788 potential for this confusion, GCC issues a warning when this flag
6789 is specified. To eliminate the warning, add explicit braces around
6790 the innermost @code{if} statement so there is no way the @code{else}
6791 can belong to the enclosing @code{if}. The resulting code
6792 looks like this:
6793
6794 @smallexample
6795 @group
6796 @{
6797 if (a)
6798 @{
6799 if (b)
6800 foo ();
6801 else
6802 bar ();
6803 @}
6804 @}
6805 @end group
6806 @end smallexample
6807
6808 This warning is enabled by @option{-Wparentheses}.
6809
6810 @item -Wdate-time
6811 @opindex Wdate-time
6812 @opindex Wno-date-time
6813 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6814 are encountered as they might prevent bit-wise-identical reproducible
6815 compilations.
6816
6817 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6818 @opindex Wdelete-incomplete
6819 @opindex Wno-delete-incomplete
6820 Warn when deleting a pointer to incomplete type, which may cause
6821 undefined behavior at runtime. This warning is enabled by default.
6822
6823 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6824 @opindex Wuseless-cast
6825 @opindex Wno-useless-cast
6826 Warn when an expression is casted to its own type.
6827
6828 @item -Wempty-body
6829 @opindex Wempty-body
6830 @opindex Wno-empty-body
6831 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6832 while} statement. This warning is also enabled by @option{-Wextra}.
6833
6834 @item -Wenum-compare
6835 @opindex Wenum-compare
6836 @opindex Wno-enum-compare
6837 Warn about a comparison between values of different enumerated types.
6838 In C++ enumerated type mismatches in conditional expressions are also
6839 diagnosed and the warning is enabled by default. In C this warning is
6840 enabled by @option{-Wall}.
6841
6842 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6843 @opindex Wextra-semi
6844 @opindex Wno-extra-semi
6845 Warn about redundant semicolon after in-class function definition.
6846
6847 @item -Wjump-misses-init @r{(C, Objective-C only)}
6848 @opindex Wjump-misses-init
6849 @opindex Wno-jump-misses-init
6850 Warn if a @code{goto} statement or a @code{switch} statement jumps
6851 forward across the initialization of a variable, or jumps backward to a
6852 label after the variable has been initialized. This only warns about
6853 variables that are initialized when they are declared. This warning is
6854 only supported for C and Objective-C; in C++ this sort of branch is an
6855 error in any case.
6856
6857 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6858 can be disabled with the @option{-Wno-jump-misses-init} option.
6859
6860 @item -Wsign-compare
6861 @opindex Wsign-compare
6862 @opindex Wno-sign-compare
6863 @cindex warning for comparison of signed and unsigned values
6864 @cindex comparison of signed and unsigned values, warning
6865 @cindex signed and unsigned values, comparison warning
6866 Warn when a comparison between signed and unsigned values could produce
6867 an incorrect result when the signed value is converted to unsigned.
6868 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6869 also enabled by @option{-Wextra}.
6870
6871 @item -Wsign-conversion
6872 @opindex Wsign-conversion
6873 @opindex Wno-sign-conversion
6874 Warn for implicit conversions that may change the sign of an integer
6875 value, like assigning a signed integer expression to an unsigned
6876 integer variable. An explicit cast silences the warning. In C, this
6877 option is enabled also by @option{-Wconversion}.
6878
6879 @item -Wfloat-conversion
6880 @opindex Wfloat-conversion
6881 @opindex Wno-float-conversion
6882 Warn for implicit conversions that reduce the precision of a real value.
6883 This includes conversions from real to integer, and from higher precision
6884 real to lower precision real values. This option is also enabled by
6885 @option{-Wconversion}.
6886
6887 @item -Wno-scalar-storage-order
6888 @opindex Wno-scalar-storage-order
6889 @opindex Wscalar-storage-order
6890 Do not warn on suspicious constructs involving reverse scalar storage order.
6891
6892 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6893 @opindex Wsized-deallocation
6894 @opindex Wno-sized-deallocation
6895 Warn about a definition of an unsized deallocation function
6896 @smallexample
6897 void operator delete (void *) noexcept;
6898 void operator delete[] (void *) noexcept;
6899 @end smallexample
6900 without a definition of the corresponding sized deallocation function
6901 @smallexample
6902 void operator delete (void *, std::size_t) noexcept;
6903 void operator delete[] (void *, std::size_t) noexcept;
6904 @end smallexample
6905 or vice versa. Enabled by @option{-Wextra} along with
6906 @option{-fsized-deallocation}.
6907
6908 @item -Wsizeof-pointer-div
6909 @opindex Wsizeof-pointer-div
6910 @opindex Wno-sizeof-pointer-div
6911 Warn for suspicious divisions of two sizeof expressions that divide
6912 the pointer size by the element size, which is the usual way to compute
6913 the array size but won't work out correctly with pointers. This warning
6914 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6915 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6916
6917 @item -Wsizeof-pointer-memaccess
6918 @opindex Wsizeof-pointer-memaccess
6919 @opindex Wno-sizeof-pointer-memaccess
6920 Warn for suspicious length parameters to certain string and memory built-in
6921 functions if the argument uses @code{sizeof}. This warning triggers for
6922 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6923 an array, but a pointer, and suggests a possible fix, or about
6924 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6925 also warns about calls to bounded string copy functions like @code{strncat}
6926 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6927 the source array. For example, in the following function the call to
6928 @code{strncat} specifies the size of the source string as the bound. That
6929 is almost certainly a mistake and so the call is diagnosed.
6930 @smallexample
6931 void make_file (const char *name)
6932 @{
6933 char path[PATH_MAX];
6934 strncpy (path, name, sizeof path - 1);
6935 strncat (path, ".text", sizeof ".text");
6936 @dots{}
6937 @}
6938 @end smallexample
6939
6940 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6941
6942 @item -Wsizeof-array-argument
6943 @opindex Wsizeof-array-argument
6944 @opindex Wno-sizeof-array-argument
6945 Warn when the @code{sizeof} operator is applied to a parameter that is
6946 declared as an array in a function definition. This warning is enabled by
6947 default for C and C++ programs.
6948
6949 @item -Wmemset-elt-size
6950 @opindex Wmemset-elt-size
6951 @opindex Wno-memset-elt-size
6952 Warn for suspicious calls to the @code{memset} built-in function, if the
6953 first argument references an array, and the third argument is a number
6954 equal to the number of elements, but not equal to the size of the array
6955 in memory. This indicates that the user has omitted a multiplication by
6956 the element size. This warning is enabled by @option{-Wall}.
6957
6958 @item -Wmemset-transposed-args
6959 @opindex Wmemset-transposed-args
6960 @opindex Wno-memset-transposed-args
6961 Warn for suspicious calls to the @code{memset} built-in function, if the
6962 second argument is not zero and the third argument is zero. This warns e.g.@:
6963 about @code{memset (buf, sizeof buf, 0)} where most probably
6964 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6965 is only emitted if the third argument is literal zero. If it is some
6966 expression that is folded to zero, a cast of zero to some type, etc.,
6967 it is far less likely that the user has mistakenly exchanged the arguments
6968 and no warning is emitted. This warning is enabled by @option{-Wall}.
6969
6970 @item -Waddress
6971 @opindex Waddress
6972 @opindex Wno-address
6973 Warn about suspicious uses of memory addresses. These include using
6974 the address of a function in a conditional expression, such as
6975 @code{void func(void); if (func)}, and comparisons against the memory
6976 address of a string literal, such as @code{if (x == "abc")}. Such
6977 uses typically indicate a programmer error: the address of a function
6978 always evaluates to true, so their use in a conditional usually
6979 indicate that the programmer forgot the parentheses in a function
6980 call; and comparisons against string literals result in unspecified
6981 behavior and are not portable in C, so they usually indicate that the
6982 programmer intended to use @code{strcmp}. This warning is enabled by
6983 @option{-Wall}.
6984
6985 @item -Waddress-of-packed-member
6986 @opindex Waddress-of-packed-member
6987 @opindex Wno-address-of-packed-member
6988 Warn when the address of packed member of struct or union is taken,
6989 which usually results in an unaligned pointer value. This is
6990 enabled by default.
6991
6992 @item -Wlogical-op
6993 @opindex Wlogical-op
6994 @opindex Wno-logical-op
6995 Warn about suspicious uses of logical operators in expressions.
6996 This includes using logical operators in contexts where a
6997 bit-wise operator is likely to be expected. Also warns when
6998 the operands of a logical operator are the same:
6999 @smallexample
7000 extern int a;
7001 if (a < 0 && a < 0) @{ @dots{} @}
7002 @end smallexample
7003
7004 @item -Wlogical-not-parentheses
7005 @opindex Wlogical-not-parentheses
7006 @opindex Wno-logical-not-parentheses
7007 Warn about logical not used on the left hand side operand of a comparison.
7008 This option does not warn if the right operand is considered to be a boolean
7009 expression. Its purpose is to detect suspicious code like the following:
7010 @smallexample
7011 int a;
7012 @dots{}
7013 if (!a > 1) @{ @dots{} @}
7014 @end smallexample
7015
7016 It is possible to suppress the warning by wrapping the LHS into
7017 parentheses:
7018 @smallexample
7019 if ((!a) > 1) @{ @dots{} @}
7020 @end smallexample
7021
7022 This warning is enabled by @option{-Wall}.
7023
7024 @item -Waggregate-return
7025 @opindex Waggregate-return
7026 @opindex Wno-aggregate-return
7027 Warn if any functions that return structures or unions are defined or
7028 called. (In languages where you can return an array, this also elicits
7029 a warning.)
7030
7031 @item -Wno-aggressive-loop-optimizations
7032 @opindex Wno-aggressive-loop-optimizations
7033 @opindex Waggressive-loop-optimizations
7034 Warn if in a loop with constant number of iterations the compiler detects
7035 undefined behavior in some statement during one or more of the iterations.
7036
7037 @item -Wno-attributes
7038 @opindex Wno-attributes
7039 @opindex Wattributes
7040 Do not warn if an unexpected @code{__attribute__} is used, such as
7041 unrecognized attributes, function attributes applied to variables,
7042 etc. This does not stop errors for incorrect use of supported
7043 attributes.
7044
7045 @item -Wno-builtin-declaration-mismatch
7046 @opindex Wno-builtin-declaration-mismatch
7047 @opindex Wbuiltin-declaration-mismatch
7048 Warn if a built-in function is declared with an incompatible signature
7049 or as a non-function, or when a built-in function declared with a type
7050 that does not include a prototype is called with arguments whose promoted
7051 types do not match those expected by the function. When @option{-Wextra}
7052 is specified, also warn when a built-in function that takes arguments is
7053 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7054 warning is enabled by default. To avoid the warning include the appropriate
7055 header to bring the prototypes of built-in functions into scope.
7056
7057 For example, the call to @code{memset} below is diagnosed by the warning
7058 because the function expects a value of type @code{size_t} as its argument
7059 but the type of @code{32} is @code{int}. With @option{-Wextra},
7060 the declaration of the function is diagnosed as well.
7061 @smallexample
7062 extern void* memset ();
7063 void f (void *d)
7064 @{
7065 memset (d, '\0', 32);
7066 @}
7067 @end smallexample
7068
7069 @item -Wno-builtin-macro-redefined
7070 @opindex Wno-builtin-macro-redefined
7071 @opindex Wbuiltin-macro-redefined
7072 Do not warn if certain built-in macros are redefined. This suppresses
7073 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7074 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7075
7076 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7077 @opindex Wstrict-prototypes
7078 @opindex Wno-strict-prototypes
7079 Warn if a function is declared or defined without specifying the
7080 argument types. (An old-style function definition is permitted without
7081 a warning if preceded by a declaration that specifies the argument
7082 types.)
7083
7084 @item -Wold-style-declaration @r{(C and Objective-C only)}
7085 @opindex Wold-style-declaration
7086 @opindex Wno-old-style-declaration
7087 Warn for obsolescent usages, according to the C Standard, in a
7088 declaration. For example, warn if storage-class specifiers like
7089 @code{static} are not the first things in a declaration. This warning
7090 is also enabled by @option{-Wextra}.
7091
7092 @item -Wold-style-definition @r{(C and Objective-C only)}
7093 @opindex Wold-style-definition
7094 @opindex Wno-old-style-definition
7095 Warn if an old-style function definition is used. A warning is given
7096 even if there is a previous prototype.
7097
7098 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7099 @opindex Wmissing-parameter-type
7100 @opindex Wno-missing-parameter-type
7101 A function parameter is declared without a type specifier in K&R-style
7102 functions:
7103
7104 @smallexample
7105 void foo(bar) @{ @}
7106 @end smallexample
7107
7108 This warning is also enabled by @option{-Wextra}.
7109
7110 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7111 @opindex Wmissing-prototypes
7112 @opindex Wno-missing-prototypes
7113 Warn if a global function is defined without a previous prototype
7114 declaration. This warning is issued even if the definition itself
7115 provides a prototype. Use this option to detect global functions
7116 that do not have a matching prototype declaration in a header file.
7117 This option is not valid for C++ because all function declarations
7118 provide prototypes and a non-matching declaration declares an
7119 overload rather than conflict with an earlier declaration.
7120 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7121
7122 @item -Wmissing-declarations
7123 @opindex Wmissing-declarations
7124 @opindex Wno-missing-declarations
7125 Warn if a global function is defined without a previous declaration.
7126 Do so even if the definition itself provides a prototype.
7127 Use this option to detect global functions that are not declared in
7128 header files. In C, no warnings are issued for functions with previous
7129 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7130 missing prototypes. In C++, no warnings are issued for function templates,
7131 or for inline functions, or for functions in anonymous namespaces.
7132
7133 @item -Wmissing-field-initializers
7134 @opindex Wmissing-field-initializers
7135 @opindex Wno-missing-field-initializers
7136 @opindex W
7137 @opindex Wextra
7138 @opindex Wno-extra
7139 Warn if a structure's initializer has some fields missing. For
7140 example, the following code causes such a warning, because
7141 @code{x.h} is implicitly zero:
7142
7143 @smallexample
7144 struct s @{ int f, g, h; @};
7145 struct s x = @{ 3, 4 @};
7146 @end smallexample
7147
7148 This option does not warn about designated initializers, so the following
7149 modification does not trigger a warning:
7150
7151 @smallexample
7152 struct s @{ int f, g, h; @};
7153 struct s x = @{ .f = 3, .g = 4 @};
7154 @end smallexample
7155
7156 In C this option does not warn about the universal zero initializer
7157 @samp{@{ 0 @}}:
7158
7159 @smallexample
7160 struct s @{ int f, g, h; @};
7161 struct s x = @{ 0 @};
7162 @end smallexample
7163
7164 Likewise, in C++ this option does not warn about the empty @{ @}
7165 initializer, for example:
7166
7167 @smallexample
7168 struct s @{ int f, g, h; @};
7169 s x = @{ @};
7170 @end smallexample
7171
7172 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7173 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7174
7175 @item -Wno-multichar
7176 @opindex Wno-multichar
7177 @opindex Wmultichar
7178 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7179 Usually they indicate a typo in the user's code, as they have
7180 implementation-defined values, and should not be used in portable code.
7181
7182 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7183 @opindex Wnormalized=
7184 @opindex Wnormalized
7185 @opindex Wno-normalized
7186 @cindex NFC
7187 @cindex NFKC
7188 @cindex character set, input normalization
7189 In ISO C and ISO C++, two identifiers are different if they are
7190 different sequences of characters. However, sometimes when characters
7191 outside the basic ASCII character set are used, you can have two
7192 different character sequences that look the same. To avoid confusion,
7193 the ISO 10646 standard sets out some @dfn{normalization rules} which
7194 when applied ensure that two sequences that look the same are turned into
7195 the same sequence. GCC can warn you if you are using identifiers that
7196 have not been normalized; this option controls that warning.
7197
7198 There are four levels of warning supported by GCC@. The default is
7199 @option{-Wnormalized=nfc}, which warns about any identifier that is
7200 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7201 recommended form for most uses. It is equivalent to
7202 @option{-Wnormalized}.
7203
7204 Unfortunately, there are some characters allowed in identifiers by
7205 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7206 identifiers. That is, there's no way to use these symbols in portable
7207 ISO C or C++ and have all your identifiers in NFC@.
7208 @option{-Wnormalized=id} suppresses the warning for these characters.
7209 It is hoped that future versions of the standards involved will correct
7210 this, which is why this option is not the default.
7211
7212 You can switch the warning off for all characters by writing
7213 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7214 only do this if you are using some other normalization scheme (like
7215 ``D''), because otherwise you can easily create bugs that are
7216 literally impossible to see.
7217
7218 Some characters in ISO 10646 have distinct meanings but look identical
7219 in some fonts or display methodologies, especially once formatting has
7220 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7221 LETTER N'', displays just like a regular @code{n} that has been
7222 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7223 normalization scheme to convert all these into a standard form as
7224 well, and GCC warns if your code is not in NFKC if you use
7225 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7226 about every identifier that contains the letter O because it might be
7227 confused with the digit 0, and so is not the default, but may be
7228 useful as a local coding convention if the programming environment
7229 cannot be fixed to display these characters distinctly.
7230
7231 @item -Wno-attribute-warning
7232 @opindex Wno-attribute-warning
7233 @opindex Wattribute-warning
7234 Do not warn about usage of functions (@pxref{Function Attributes})
7235 declared with @code{warning} attribute. By default, this warning is
7236 enabled. @option{-Wno-attribute-warning} can be used to disable the
7237 warning or @option{-Wno-error=attribute-warning} can be used to
7238 disable the error when compiled with @option{-Werror} flag.
7239
7240 @item -Wno-deprecated
7241 @opindex Wno-deprecated
7242 @opindex Wdeprecated
7243 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7244
7245 @item -Wno-deprecated-declarations
7246 @opindex Wno-deprecated-declarations
7247 @opindex Wdeprecated-declarations
7248 Do not warn about uses of functions (@pxref{Function Attributes}),
7249 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7250 Attributes}) marked as deprecated by using the @code{deprecated}
7251 attribute.
7252
7253 @item -Wno-overflow
7254 @opindex Wno-overflow
7255 @opindex Woverflow
7256 Do not warn about compile-time overflow in constant expressions.
7257
7258 @item -Wno-odr
7259 @opindex Wno-odr
7260 @opindex Wodr
7261 Warn about One Definition Rule violations during link-time optimization.
7262 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7263
7264 @item -Wopenmp-simd
7265 @opindex Wopenmp-simd
7266 @opindex Wno-openmp-simd
7267 Warn if the vectorizer cost model overrides the OpenMP
7268 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7269 option can be used to relax the cost model.
7270
7271 @item -Woverride-init @r{(C and Objective-C only)}
7272 @opindex Woverride-init
7273 @opindex Wno-override-init
7274 @opindex W
7275 @opindex Wextra
7276 @opindex Wno-extra
7277 Warn if an initialized field without side effects is overridden when
7278 using designated initializers (@pxref{Designated Inits, , Designated
7279 Initializers}).
7280
7281 This warning is included in @option{-Wextra}. To get other
7282 @option{-Wextra} warnings without this one, use @option{-Wextra
7283 -Wno-override-init}.
7284
7285 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7286 @opindex Woverride-init-side-effects
7287 @opindex Wno-override-init-side-effects
7288 Warn if an initialized field with side effects is overridden when
7289 using designated initializers (@pxref{Designated Inits, , Designated
7290 Initializers}). This warning is enabled by default.
7291
7292 @item -Wpacked
7293 @opindex Wpacked
7294 @opindex Wno-packed
7295 Warn if a structure is given the packed attribute, but the packed
7296 attribute has no effect on the layout or size of the structure.
7297 Such structures may be mis-aligned for little benefit. For
7298 instance, in this code, the variable @code{f.x} in @code{struct bar}
7299 is misaligned even though @code{struct bar} does not itself
7300 have the packed attribute:
7301
7302 @smallexample
7303 @group
7304 struct foo @{
7305 int x;
7306 char a, b, c, d;
7307 @} __attribute__((packed));
7308 struct bar @{
7309 char z;
7310 struct foo f;
7311 @};
7312 @end group
7313 @end smallexample
7314
7315 @item -Wpacked-bitfield-compat
7316 @opindex Wpacked-bitfield-compat
7317 @opindex Wno-packed-bitfield-compat
7318 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7319 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7320 the change can lead to differences in the structure layout. GCC
7321 informs you when the offset of such a field has changed in GCC 4.4.
7322 For example there is no longer a 4-bit padding between field @code{a}
7323 and @code{b} in this structure:
7324
7325 @smallexample
7326 struct foo
7327 @{
7328 char a:4;
7329 char b:8;
7330 @} __attribute__ ((packed));
7331 @end smallexample
7332
7333 This warning is enabled by default. Use
7334 @option{-Wno-packed-bitfield-compat} to disable this warning.
7335
7336 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7337 @opindex Wpacked-not-aligned
7338 @opindex Wno-packed-not-aligned
7339 Warn if a structure field with explicitly specified alignment in a
7340 packed struct or union is misaligned. For example, a warning will
7341 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7342 'struct S' is less than 8}, in this code:
7343
7344 @smallexample
7345 @group
7346 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7347 struct __attribute__ ((packed)) S @{
7348 struct S8 s8;
7349 @};
7350 @end group
7351 @end smallexample
7352
7353 This warning is enabled by @option{-Wall}.
7354
7355 @item -Wpadded
7356 @opindex Wpadded
7357 @opindex Wno-padded
7358 Warn if padding is included in a structure, either to align an element
7359 of the structure or to align the whole structure. Sometimes when this
7360 happens it is possible to rearrange the fields of the structure to
7361 reduce the padding and so make the structure smaller.
7362
7363 @item -Wredundant-decls
7364 @opindex Wredundant-decls
7365 @opindex Wno-redundant-decls
7366 Warn if anything is declared more than once in the same scope, even in
7367 cases where multiple declaration is valid and changes nothing.
7368
7369 @item -Wno-restrict
7370 @opindex Wrestrict
7371 @opindex Wno-restrict
7372 Warn when an object referenced by a @code{restrict}-qualified parameter
7373 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7374 argument, or when copies between such objects overlap. For example,
7375 the call to the @code{strcpy} function below attempts to truncate the string
7376 by replacing its initial characters with the last four. However, because
7377 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7378 the call is diagnosed.
7379
7380 @smallexample
7381 void foo (void)
7382 @{
7383 char a[] = "abcd1234";
7384 strcpy (a, a + 4);
7385 @dots{}
7386 @}
7387 @end smallexample
7388 The @option{-Wrestrict} option detects some instances of simple overlap
7389 even without optimization but works best at @option{-O2} and above. It
7390 is included in @option{-Wall}.
7391
7392 @item -Wnested-externs @r{(C and Objective-C only)}
7393 @opindex Wnested-externs
7394 @opindex Wno-nested-externs
7395 Warn if an @code{extern} declaration is encountered within a function.
7396
7397 @item -Wno-inherited-variadic-ctor
7398 @opindex Winherited-variadic-ctor
7399 @opindex Wno-inherited-variadic-ctor
7400 Suppress warnings about use of C++11 inheriting constructors when the
7401 base class inherited from has a C variadic constructor; the warning is
7402 on by default because the ellipsis is not inherited.
7403
7404 @item -Winline
7405 @opindex Winline
7406 @opindex Wno-inline
7407 Warn if a function that is declared as inline cannot be inlined.
7408 Even with this option, the compiler does not warn about failures to
7409 inline functions declared in system headers.
7410
7411 The compiler uses a variety of heuristics to determine whether or not
7412 to inline a function. For example, the compiler takes into account
7413 the size of the function being inlined and the amount of inlining
7414 that has already been done in the current function. Therefore,
7415 seemingly insignificant changes in the source program can cause the
7416 warnings produced by @option{-Winline} to appear or disappear.
7417
7418 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7419 @opindex Wno-invalid-offsetof
7420 @opindex Winvalid-offsetof
7421 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7422 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7423 to a non-standard-layout type is undefined. In existing C++ implementations,
7424 however, @code{offsetof} typically gives meaningful results.
7425 This flag is for users who are aware that they are
7426 writing nonportable code and who have deliberately chosen to ignore the
7427 warning about it.
7428
7429 The restrictions on @code{offsetof} may be relaxed in a future version
7430 of the C++ standard.
7431
7432 @item -Wint-in-bool-context
7433 @opindex Wint-in-bool-context
7434 @opindex Wno-int-in-bool-context
7435 Warn for suspicious use of integer values where boolean values are expected,
7436 such as conditional expressions (?:) using non-boolean integer constants in
7437 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7438 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7439 for all kinds of multiplications regardless of the data type.
7440 This warning is enabled by @option{-Wall}.
7441
7442 @item -Wno-int-to-pointer-cast
7443 @opindex Wno-int-to-pointer-cast
7444 @opindex Wint-to-pointer-cast
7445 Suppress warnings from casts to pointer type of an integer of a
7446 different size. In C++, casting to a pointer type of smaller size is
7447 an error. @option{Wint-to-pointer-cast} is enabled by default.
7448
7449
7450 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7451 @opindex Wno-pointer-to-int-cast
7452 @opindex Wpointer-to-int-cast
7453 Suppress warnings from casts from a pointer to an integer type of a
7454 different size.
7455
7456 @item -Winvalid-pch
7457 @opindex Winvalid-pch
7458 @opindex Wno-invalid-pch
7459 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7460 the search path but cannot be used.
7461
7462 @item -Wlong-long
7463 @opindex Wlong-long
7464 @opindex Wno-long-long
7465 Warn if @code{long long} type is used. This is enabled by either
7466 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7467 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7468
7469 @item -Wvariadic-macros
7470 @opindex Wvariadic-macros
7471 @opindex Wno-variadic-macros
7472 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7473 alternate syntax is used in ISO C99 mode. This is enabled by either
7474 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7475 messages, use @option{-Wno-variadic-macros}.
7476
7477 @item -Wvarargs
7478 @opindex Wvarargs
7479 @opindex Wno-varargs
7480 Warn upon questionable usage of the macros used to handle variable
7481 arguments like @code{va_start}. This is default. To inhibit the
7482 warning messages, use @option{-Wno-varargs}.
7483
7484 @item -Wvector-operation-performance
7485 @opindex Wvector-operation-performance
7486 @opindex Wno-vector-operation-performance
7487 Warn if vector operation is not implemented via SIMD capabilities of the
7488 architecture. Mainly useful for the performance tuning.
7489 Vector operation can be implemented @code{piecewise}, which means that the
7490 scalar operation is performed on every vector element;
7491 @code{in parallel}, which means that the vector operation is implemented
7492 using scalars of wider type, which normally is more performance efficient;
7493 and @code{as a single scalar}, which means that vector fits into a
7494 scalar type.
7495
7496 @item -Wno-virtual-move-assign
7497 @opindex Wvirtual-move-assign
7498 @opindex Wno-virtual-move-assign
7499 Suppress warnings about inheriting from a virtual base with a
7500 non-trivial C++11 move assignment operator. This is dangerous because
7501 if the virtual base is reachable along more than one path, it is
7502 moved multiple times, which can mean both objects end up in the
7503 moved-from state. If the move assignment operator is written to avoid
7504 moving from a moved-from object, this warning can be disabled.
7505
7506 @item -Wvla
7507 @opindex Wvla
7508 @opindex Wno-vla
7509 Warn if a variable-length array is used in the code.
7510 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7511 the variable-length array.
7512
7513 @item -Wvla-larger-than=@var{byte-size}
7514 @opindex Wvla-larger-than=
7515 @opindex Wno-vla-larger-than
7516 If this option is used, the compiler will warn for declarations of
7517 variable-length arrays whose size is either unbounded, or bounded
7518 by an argument that allows the array size to exceed @var{byte-size}
7519 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7520 works, but with variable-length arrays.
7521
7522 Note that GCC may optimize small variable-length arrays of a known
7523 value into plain arrays, so this warning may not get triggered for
7524 such arrays.
7525
7526 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7527 is typically only effective when @option{-ftree-vrp} is active (default
7528 for @option{-O2} and above).
7529
7530 See also @option{-Walloca-larger-than=@var{byte-size}}.
7531
7532 @item -Wno-vla-larger-than
7533 @opindex Wno-vla-larger-than
7534 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7535 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7536
7537 @item -Wvolatile-register-var
7538 @opindex Wvolatile-register-var
7539 @opindex Wno-volatile-register-var
7540 Warn if a register variable is declared volatile. The volatile
7541 modifier does not inhibit all optimizations that may eliminate reads
7542 and/or writes to register variables. This warning is enabled by
7543 @option{-Wall}.
7544
7545 @item -Wdisabled-optimization
7546 @opindex Wdisabled-optimization
7547 @opindex Wno-disabled-optimization
7548 Warn if a requested optimization pass is disabled. This warning does
7549 not generally indicate that there is anything wrong with your code; it
7550 merely indicates that GCC's optimizers are unable to handle the code
7551 effectively. Often, the problem is that your code is too big or too
7552 complex; GCC refuses to optimize programs when the optimization
7553 itself is likely to take inordinate amounts of time.
7554
7555 @item -Wpointer-sign @r{(C and Objective-C only)}
7556 @opindex Wpointer-sign
7557 @opindex Wno-pointer-sign
7558 Warn for pointer argument passing or assignment with different signedness.
7559 This option is only supported for C and Objective-C@. It is implied by
7560 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7561 @option{-Wno-pointer-sign}.
7562
7563 @item -Wstack-protector
7564 @opindex Wstack-protector
7565 @opindex Wno-stack-protector
7566 This option is only active when @option{-fstack-protector} is active. It
7567 warns about functions that are not protected against stack smashing.
7568
7569 @item -Woverlength-strings
7570 @opindex Woverlength-strings
7571 @opindex Wno-overlength-strings
7572 Warn about string constants that are longer than the ``minimum
7573 maximum'' length specified in the C standard. Modern compilers
7574 generally allow string constants that are much longer than the
7575 standard's minimum limit, but very portable programs should avoid
7576 using longer strings.
7577
7578 The limit applies @emph{after} string constant concatenation, and does
7579 not count the trailing NUL@. In C90, the limit was 509 characters; in
7580 C99, it was raised to 4095. C++98 does not specify a normative
7581 minimum maximum, so we do not diagnose overlength strings in C++@.
7582
7583 This option is implied by @option{-Wpedantic}, and can be disabled with
7584 @option{-Wno-overlength-strings}.
7585
7586 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7587 @opindex Wunsuffixed-float-constants
7588 @opindex Wno-unsuffixed-float-constants
7589
7590 Issue a warning for any floating constant that does not have
7591 a suffix. When used together with @option{-Wsystem-headers} it
7592 warns about such constants in system header files. This can be useful
7593 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7594 from the decimal floating-point extension to C99.
7595
7596 @item -Wno-designated-init @r{(C and Objective-C only)}
7597 Suppress warnings when a positional initializer is used to initialize
7598 a structure that has been marked with the @code{designated_init}
7599 attribute.
7600
7601 @item -Whsa
7602 Issue a warning when HSAIL cannot be emitted for the compiled function or
7603 OpenMP construct.
7604
7605 @end table
7606
7607 @node Debugging Options
7608 @section Options for Debugging Your Program
7609 @cindex options, debugging
7610 @cindex debugging information options
7611
7612 To tell GCC to emit extra information for use by a debugger, in almost
7613 all cases you need only to add @option{-g} to your other options.
7614
7615 GCC allows you to use @option{-g} with
7616 @option{-O}. The shortcuts taken by optimized code may occasionally
7617 be surprising: some variables you declared may not exist
7618 at all; flow of control may briefly move where you did not expect it;
7619 some statements may not be executed because they compute constant
7620 results or their values are already at hand; some statements may
7621 execute in different places because they have been moved out of loops.
7622 Nevertheless it is possible to debug optimized output. This makes
7623 it reasonable to use the optimizer for programs that might have bugs.
7624
7625 If you are not using some other optimization option, consider
7626 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7627 With no @option{-O} option at all, some compiler passes that collect
7628 information useful for debugging do not run at all, so that
7629 @option{-Og} may result in a better debugging experience.
7630
7631 @table @gcctabopt
7632 @item -g
7633 @opindex g
7634 Produce debugging information in the operating system's native format
7635 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7636 information.
7637
7638 On most systems that use stabs format, @option{-g} enables use of extra
7639 debugging information that only GDB can use; this extra information
7640 makes debugging work better in GDB but probably makes other debuggers
7641 crash or
7642 refuse to read the program. If you want to control for certain whether
7643 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7644 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7645
7646 @item -ggdb
7647 @opindex ggdb
7648 Produce debugging information for use by GDB@. This means to use the
7649 most expressive format available (DWARF, stabs, or the native format
7650 if neither of those are supported), including GDB extensions if at all
7651 possible.
7652
7653 @item -gdwarf
7654 @itemx -gdwarf-@var{version}
7655 @opindex gdwarf
7656 Produce debugging information in DWARF format (if that is supported).
7657 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7658 for most targets is 4. DWARF Version 5 is only experimental.
7659
7660 Note that with DWARF Version 2, some ports require and always
7661 use some non-conflicting DWARF 3 extensions in the unwind tables.
7662
7663 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7664 for maximum benefit.
7665
7666 GCC no longer supports DWARF Version 1, which is substantially
7667 different than Version 2 and later. For historical reasons, some
7668 other DWARF-related options such as
7669 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7670 in their names, but apply to all currently-supported versions of DWARF.
7671
7672 @item -gstabs
7673 @opindex gstabs
7674 Produce debugging information in stabs format (if that is supported),
7675 without GDB extensions. This is the format used by DBX on most BSD
7676 systems. On MIPS, Alpha and System V Release 4 systems this option
7677 produces stabs debugging output that is not understood by DBX@.
7678 On System V Release 4 systems this option requires the GNU assembler.
7679
7680 @item -gstabs+
7681 @opindex gstabs+
7682 Produce debugging information in stabs format (if that is supported),
7683 using GNU extensions understood only by the GNU debugger (GDB)@. The
7684 use of these extensions is likely to make other debuggers crash or
7685 refuse to read the program.
7686
7687 @item -gxcoff
7688 @opindex gxcoff
7689 Produce debugging information in XCOFF format (if that is supported).
7690 This is the format used by the DBX debugger on IBM RS/6000 systems.
7691
7692 @item -gxcoff+
7693 @opindex gxcoff+
7694 Produce debugging information in XCOFF format (if that is supported),
7695 using GNU extensions understood only by the GNU debugger (GDB)@. The
7696 use of these extensions is likely to make other debuggers crash or
7697 refuse to read the program, and may cause assemblers other than the GNU
7698 assembler (GAS) to fail with an error.
7699
7700 @item -gvms
7701 @opindex gvms
7702 Produce debugging information in Alpha/VMS debug format (if that is
7703 supported). This is the format used by DEBUG on Alpha/VMS systems.
7704
7705 @item -g@var{level}
7706 @itemx -ggdb@var{level}
7707 @itemx -gstabs@var{level}
7708 @itemx -gxcoff@var{level}
7709 @itemx -gvms@var{level}
7710 Request debugging information and also use @var{level} to specify how
7711 much information. The default level is 2.
7712
7713 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7714 @option{-g}.
7715
7716 Level 1 produces minimal information, enough for making backtraces in
7717 parts of the program that you don't plan to debug. This includes
7718 descriptions of functions and external variables, and line number
7719 tables, but no information about local variables.
7720
7721 Level 3 includes extra information, such as all the macro definitions
7722 present in the program. Some debuggers support macro expansion when
7723 you use @option{-g3}.
7724
7725 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7726 confusion with @option{-gdwarf-@var{level}}.
7727 Instead use an additional @option{-g@var{level}} option to change the
7728 debug level for DWARF.
7729
7730 @item -feliminate-unused-debug-symbols
7731 @opindex feliminate-unused-debug-symbols
7732 Produce debugging information in stabs format (if that is supported),
7733 for only symbols that are actually used.
7734
7735 @item -femit-class-debug-always
7736 @opindex femit-class-debug-always
7737 Instead of emitting debugging information for a C++ class in only one
7738 object file, emit it in all object files using the class. This option
7739 should be used only with debuggers that are unable to handle the way GCC
7740 normally emits debugging information for classes because using this
7741 option increases the size of debugging information by as much as a
7742 factor of two.
7743
7744 @item -fno-merge-debug-strings
7745 @opindex fmerge-debug-strings
7746 @opindex fno-merge-debug-strings
7747 Direct the linker to not merge together strings in the debugging
7748 information that are identical in different object files. Merging is
7749 not supported by all assemblers or linkers. Merging decreases the size
7750 of the debug information in the output file at the cost of increasing
7751 link processing time. Merging is enabled by default.
7752
7753 @item -fdebug-prefix-map=@var{old}=@var{new}
7754 @opindex fdebug-prefix-map
7755 When compiling files residing in directory @file{@var{old}}, record
7756 debugging information describing them as if the files resided in
7757 directory @file{@var{new}} instead. This can be used to replace a
7758 build-time path with an install-time path in the debug info. It can
7759 also be used to change an absolute path to a relative path by using
7760 @file{.} for @var{new}. This can give more reproducible builds, which
7761 are location independent, but may require an extra command to tell GDB
7762 where to find the source files. See also @option{-ffile-prefix-map}.
7763
7764 @item -fvar-tracking
7765 @opindex fvar-tracking
7766 Run variable tracking pass. It computes where variables are stored at each
7767 position in code. Better debugging information is then generated
7768 (if the debugging information format supports this information).
7769
7770 It is enabled by default when compiling with optimization (@option{-Os},
7771 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7772 the debug info format supports it.
7773
7774 @item -fvar-tracking-assignments
7775 @opindex fvar-tracking-assignments
7776 @opindex fno-var-tracking-assignments
7777 Annotate assignments to user variables early in the compilation and
7778 attempt to carry the annotations over throughout the compilation all the
7779 way to the end, in an attempt to improve debug information while
7780 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7781
7782 It can be enabled even if var-tracking is disabled, in which case
7783 annotations are created and maintained, but discarded at the end.
7784 By default, this flag is enabled together with @option{-fvar-tracking},
7785 except when selective scheduling is enabled.
7786
7787 @item -gsplit-dwarf
7788 @opindex gsplit-dwarf
7789 Separate as much DWARF debugging information as possible into a
7790 separate output file with the extension @file{.dwo}. This option allows
7791 the build system to avoid linking files with debug information. To
7792 be useful, this option requires a debugger capable of reading @file{.dwo}
7793 files.
7794
7795 @item -gdescribe-dies
7796 @opindex gdescribe-dies
7797 Add description attributes to some DWARF DIEs that have no name attribute,
7798 such as artificial variables, external references and call site
7799 parameter DIEs.
7800
7801 @item -gpubnames
7802 @opindex gpubnames
7803 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7804
7805 @item -ggnu-pubnames
7806 @opindex ggnu-pubnames
7807 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7808 suitable for conversion into a GDB@ index. This option is only useful
7809 with a linker that can produce GDB@ index version 7.
7810
7811 @item -fdebug-types-section
7812 @opindex fdebug-types-section
7813 @opindex fno-debug-types-section
7814 When using DWARF Version 4 or higher, type DIEs can be put into
7815 their own @code{.debug_types} section instead of making them part of the
7816 @code{.debug_info} section. It is more efficient to put them in a separate
7817 comdat section since the linker can then remove duplicates.
7818 But not all DWARF consumers support @code{.debug_types} sections yet
7819 and on some objects @code{.debug_types} produces larger instead of smaller
7820 debugging information.
7821
7822 @item -grecord-gcc-switches
7823 @itemx -gno-record-gcc-switches
7824 @opindex grecord-gcc-switches
7825 @opindex gno-record-gcc-switches
7826 This switch causes the command-line options used to invoke the
7827 compiler that may affect code generation to be appended to the
7828 DW_AT_producer attribute in DWARF debugging information. The options
7829 are concatenated with spaces separating them from each other and from
7830 the compiler version.
7831 It is enabled by default.
7832 See also @option{-frecord-gcc-switches} for another
7833 way of storing compiler options into the object file.
7834
7835 @item -gstrict-dwarf
7836 @opindex gstrict-dwarf
7837 Disallow using extensions of later DWARF standard version than selected
7838 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7839 DWARF extensions from later standard versions is allowed.
7840
7841 @item -gno-strict-dwarf
7842 @opindex gno-strict-dwarf
7843 Allow using extensions of later DWARF standard version than selected with
7844 @option{-gdwarf-@var{version}}.
7845
7846 @item -gas-loc-support
7847 @opindex gas-loc-support
7848 Inform the compiler that the assembler supports @code{.loc} directives.
7849 It may then use them for the assembler to generate DWARF2+ line number
7850 tables.
7851
7852 This is generally desirable, because assembler-generated line-number
7853 tables are a lot more compact than those the compiler can generate
7854 itself.
7855
7856 This option will be enabled by default if, at GCC configure time, the
7857 assembler was found to support such directives.
7858
7859 @item -gno-as-loc-support
7860 @opindex gno-as-loc-support
7861 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7862 line number tables are to be generated.
7863
7864 @item gas-locview-support
7865 @opindex gas-locview-support
7866 Inform the compiler that the assembler supports @code{view} assignment
7867 and reset assertion checking in @code{.loc} directives.
7868
7869 This option will be enabled by default if, at GCC configure time, the
7870 assembler was found to support them.
7871
7872 @item gno-as-locview-support
7873 Force GCC to assign view numbers internally, if
7874 @option{-gvariable-location-views} are explicitly requested.
7875
7876 @item -gcolumn-info
7877 @itemx -gno-column-info
7878 @opindex gcolumn-info
7879 @opindex gno-column-info
7880 Emit location column information into DWARF debugging information, rather
7881 than just file and line.
7882 This option is enabled by default.
7883
7884 @item -gstatement-frontiers
7885 @itemx -gno-statement-frontiers
7886 @opindex gstatement-frontiers
7887 @opindex gno-statement-frontiers
7888 This option causes GCC to create markers in the internal representation
7889 at the beginning of statements, and to keep them roughly in place
7890 throughout compilation, using them to guide the output of @code{is_stmt}
7891 markers in the line number table. This is enabled by default when
7892 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7893 @dots{}), and outputting DWARF 2 debug information at the normal level.
7894
7895 @item -gvariable-location-views
7896 @itemx -gvariable-location-views=incompat5
7897 @itemx -gno-variable-location-views
7898 @opindex gvariable-location-views
7899 @opindex gvariable-location-views=incompat5
7900 @opindex gno-variable-location-views
7901 Augment variable location lists with progressive view numbers implied
7902 from the line number table. This enables debug information consumers to
7903 inspect state at certain points of the program, even if no instructions
7904 associated with the corresponding source locations are present at that
7905 point. If the assembler lacks support for view numbers in line number
7906 tables, this will cause the compiler to emit the line number table,
7907 which generally makes them somewhat less compact. The augmented line
7908 number tables and location lists are fully backward-compatible, so they
7909 can be consumed by debug information consumers that are not aware of
7910 these augmentations, but they won't derive any benefit from them either.
7911
7912 This is enabled by default when outputting DWARF 2 debug information at
7913 the normal level, as long as there is assembler support,
7914 @option{-fvar-tracking-assignments} is enabled and
7915 @option{-gstrict-dwarf} is not. When assembler support is not
7916 available, this may still be enabled, but it will force GCC to output
7917 internal line number tables, and if
7918 @option{-ginternal-reset-location-views} is not enabled, that will most
7919 certainly lead to silently mismatching location views.
7920
7921 There is a proposed representation for view numbers that is not backward
7922 compatible with the location list format introduced in DWARF 5, that can
7923 be enabled with @option{-gvariable-location-views=incompat5}. This
7924 option may be removed in the future, is only provided as a reference
7925 implementation of the proposed representation. Debug information
7926 consumers are not expected to support this extended format, and they
7927 would be rendered unable to decode location lists using it.
7928
7929 @item -ginternal-reset-location-views
7930 @itemx -gnointernal-reset-location-views
7931 @opindex ginternal-reset-location-views
7932 @opindex gno-internal-reset-location-views
7933 Attempt to determine location views that can be omitted from location
7934 view lists. This requires the compiler to have very accurate insn
7935 length estimates, which isn't always the case, and it may cause
7936 incorrect view lists to be generated silently when using an assembler
7937 that does not support location view lists. The GNU assembler will flag
7938 any such error as a @code{view number mismatch}. This is only enabled
7939 on ports that define a reliable estimation function.
7940
7941 @item -ginline-points
7942 @itemx -gno-inline-points
7943 @opindex ginline-points
7944 @opindex gno-inline-points
7945 Generate extended debug information for inlined functions. Location
7946 view tracking markers are inserted at inlined entry points, so that
7947 address and view numbers can be computed and output in debug
7948 information. This can be enabled independently of location views, in
7949 which case the view numbers won't be output, but it can only be enabled
7950 along with statement frontiers, and it is only enabled by default if
7951 location views are enabled.
7952
7953 @item -gz@r{[}=@var{type}@r{]}
7954 @opindex gz
7955 Produce compressed debug sections in DWARF format, if that is supported.
7956 If @var{type} is not given, the default type depends on the capabilities
7957 of the assembler and linker used. @var{type} may be one of
7958 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7959 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7960 compression in traditional GNU format). If the linker doesn't support
7961 writing compressed debug sections, the option is rejected. Otherwise,
7962 if the assembler does not support them, @option{-gz} is silently ignored
7963 when producing object files.
7964
7965 @item -femit-struct-debug-baseonly
7966 @opindex femit-struct-debug-baseonly
7967 Emit debug information for struct-like types
7968 only when the base name of the compilation source file
7969 matches the base name of file in which the struct is defined.
7970
7971 This option substantially reduces the size of debugging information,
7972 but at significant potential loss in type information to the debugger.
7973 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7974 See @option{-femit-struct-debug-detailed} for more detailed control.
7975
7976 This option works only with DWARF debug output.
7977
7978 @item -femit-struct-debug-reduced
7979 @opindex femit-struct-debug-reduced
7980 Emit debug information for struct-like types
7981 only when the base name of the compilation source file
7982 matches the base name of file in which the type is defined,
7983 unless the struct is a template or defined in a system header.
7984
7985 This option significantly reduces the size of debugging information,
7986 with some potential loss in type information to the debugger.
7987 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7988 See @option{-femit-struct-debug-detailed} for more detailed control.
7989
7990 This option works only with DWARF debug output.
7991
7992 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7993 @opindex femit-struct-debug-detailed
7994 Specify the struct-like types
7995 for which the compiler generates debug information.
7996 The intent is to reduce duplicate struct debug information
7997 between different object files within the same program.
7998
7999 This option is a detailed version of
8000 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8001 which serves for most needs.
8002
8003 A specification has the syntax@*
8004 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8005
8006 The optional first word limits the specification to
8007 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8008 A struct type is used directly when it is the type of a variable, member.
8009 Indirect uses arise through pointers to structs.
8010 That is, when use of an incomplete struct is valid, the use is indirect.
8011 An example is
8012 @samp{struct one direct; struct two * indirect;}.
8013
8014 The optional second word limits the specification to
8015 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8016 Generic structs are a bit complicated to explain.
8017 For C++, these are non-explicit specializations of template classes,
8018 or non-template classes within the above.
8019 Other programming languages have generics,
8020 but @option{-femit-struct-debug-detailed} does not yet implement them.
8021
8022 The third word specifies the source files for those
8023 structs for which the compiler should emit debug information.
8024 The values @samp{none} and @samp{any} have the normal meaning.
8025 The value @samp{base} means that
8026 the base of name of the file in which the type declaration appears
8027 must match the base of the name of the main compilation file.
8028 In practice, this means that when compiling @file{foo.c}, debug information
8029 is generated for types declared in that file and @file{foo.h},
8030 but not other header files.
8031 The value @samp{sys} means those types satisfying @samp{base}
8032 or declared in system or compiler headers.
8033
8034 You may need to experiment to determine the best settings for your application.
8035
8036 The default is @option{-femit-struct-debug-detailed=all}.
8037
8038 This option works only with DWARF debug output.
8039
8040 @item -fno-dwarf2-cfi-asm
8041 @opindex fdwarf2-cfi-asm
8042 @opindex fno-dwarf2-cfi-asm
8043 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8044 instead of using GAS @code{.cfi_*} directives.
8045
8046 @item -fno-eliminate-unused-debug-types
8047 @opindex feliminate-unused-debug-types
8048 @opindex fno-eliminate-unused-debug-types
8049 Normally, when producing DWARF output, GCC avoids producing debug symbol
8050 output for types that are nowhere used in the source file being compiled.
8051 Sometimes it is useful to have GCC emit debugging
8052 information for all types declared in a compilation
8053 unit, regardless of whether or not they are actually used
8054 in that compilation unit, for example
8055 if, in the debugger, you want to cast a value to a type that is
8056 not actually used in your program (but is declared). More often,
8057 however, this results in a significant amount of wasted space.
8058 @end table
8059
8060 @node Optimize Options
8061 @section Options That Control Optimization
8062 @cindex optimize options
8063 @cindex options, optimization
8064
8065 These options control various sorts of optimizations.
8066
8067 Without any optimization option, the compiler's goal is to reduce the
8068 cost of compilation and to make debugging produce the expected
8069 results. Statements are independent: if you stop the program with a
8070 breakpoint between statements, you can then assign a new value to any
8071 variable or change the program counter to any other statement in the
8072 function and get exactly the results you expect from the source
8073 code.
8074
8075 Turning on optimization flags makes the compiler attempt to improve
8076 the performance and/or code size at the expense of compilation time
8077 and possibly the ability to debug the program.
8078
8079 The compiler performs optimization based on the knowledge it has of the
8080 program. Compiling multiple files at once to a single output file mode allows
8081 the compiler to use information gained from all of the files when compiling
8082 each of them.
8083
8084 Not all optimizations are controlled directly by a flag. Only
8085 optimizations that have a flag are listed in this section.
8086
8087 Most optimizations are completely disabled at @option{-O0} or if an
8088 @option{-O} level is not set on the command line, even if individual
8089 optimization flags are specified. Similarly, @option{-Og} suppresses
8090 many optimization passes.
8091
8092 Depending on the target and how GCC was configured, a slightly different
8093 set of optimizations may be enabled at each @option{-O} level than
8094 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8095 to find out the exact set of optimizations that are enabled at each level.
8096 @xref{Overall Options}, for examples.
8097
8098 @table @gcctabopt
8099 @item -O
8100 @itemx -O1
8101 @opindex O
8102 @opindex O1
8103 Optimize. Optimizing compilation takes somewhat more time, and a lot
8104 more memory for a large function.
8105
8106 With @option{-O}, the compiler tries to reduce code size and execution
8107 time, without performing any optimizations that take a great deal of
8108 compilation time.
8109
8110 @c Note that in addition to the default_options_table list in opts.c,
8111 @c several optimization flags default to true but control optimization
8112 @c passes that are explicitly disabled at -O0.
8113
8114 @option{-O} turns on the following optimization flags:
8115
8116 @c Please keep the following list alphabetized.
8117 @gccoptlist{-fauto-inc-dec @gol
8118 -fbranch-count-reg @gol
8119 -fcombine-stack-adjustments @gol
8120 -fcompare-elim @gol
8121 -fcprop-registers @gol
8122 -fdce @gol
8123 -fdefer-pop @gol
8124 -fdelayed-branch @gol
8125 -fdse @gol
8126 -fforward-propagate @gol
8127 -fguess-branch-probability @gol
8128 -fif-conversion @gol
8129 -fif-conversion2 @gol
8130 -finline-functions-called-once @gol
8131 -fipa-profile @gol
8132 -fipa-pure-const @gol
8133 -fipa-reference @gol
8134 -fipa-reference-addressable @gol
8135 -fmerge-constants @gol
8136 -fmove-loop-invariants @gol
8137 -fomit-frame-pointer @gol
8138 -freorder-blocks @gol
8139 -fshrink-wrap @gol
8140 -fshrink-wrap-separate @gol
8141 -fsplit-wide-types @gol
8142 -fssa-backprop @gol
8143 -fssa-phiopt @gol
8144 -ftree-bit-ccp @gol
8145 -ftree-ccp @gol
8146 -ftree-ch @gol
8147 -ftree-coalesce-vars @gol
8148 -ftree-copy-prop @gol
8149 -ftree-dce @gol
8150 -ftree-dominator-opts @gol
8151 -ftree-dse @gol
8152 -ftree-forwprop @gol
8153 -ftree-fre @gol
8154 -ftree-phiprop @gol
8155 -ftree-pta @gol
8156 -ftree-scev-cprop @gol
8157 -ftree-sink @gol
8158 -ftree-slsr @gol
8159 -ftree-sra @gol
8160 -ftree-ter @gol
8161 -funit-at-a-time}
8162
8163 @item -O2
8164 @opindex O2
8165 Optimize even more. GCC performs nearly all supported optimizations
8166 that do not involve a space-speed tradeoff.
8167 As compared to @option{-O}, this option increases both compilation time
8168 and the performance of the generated code.
8169
8170 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8171 also turns on the following optimization flags:
8172
8173 @c Please keep the following list alphabetized!
8174 @gccoptlist{-falign-functions -falign-jumps @gol
8175 -falign-labels -falign-loops @gol
8176 -fcaller-saves @gol
8177 -fcode-hoisting @gol
8178 -fcrossjumping @gol
8179 -fcse-follow-jumps -fcse-skip-blocks @gol
8180 -fdelete-null-pointer-checks @gol
8181 -fdevirtualize -fdevirtualize-speculatively @gol
8182 -fexpensive-optimizations @gol
8183 -fgcse -fgcse-lm @gol
8184 -fhoist-adjacent-loads @gol
8185 -finline-small-functions @gol
8186 -findirect-inlining @gol
8187 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8188 -fipa-ra -fipa-sra -fipa-vrp @gol
8189 -fisolate-erroneous-paths-dereference @gol
8190 -flra-remat @gol
8191 -foptimize-sibling-calls @gol
8192 -foptimize-strlen @gol
8193 -fpartial-inlining @gol
8194 -fpeephole2 @gol
8195 -freorder-blocks-algorithm=stc @gol
8196 -freorder-blocks-and-partition -freorder-functions @gol
8197 -frerun-cse-after-loop @gol
8198 -fschedule-insns -fschedule-insns2 @gol
8199 -fsched-interblock -fsched-spec @gol
8200 -fstore-merging @gol
8201 -fstrict-aliasing @gol
8202 -fthread-jumps @gol
8203 -ftree-builtin-call-dce @gol
8204 -ftree-pre @gol
8205 -ftree-switch-conversion -ftree-tail-merge @gol
8206 -ftree-vrp}
8207
8208 Please note the warning under @option{-fgcse} about
8209 invoking @option{-O2} on programs that use computed gotos.
8210
8211 @item -O3
8212 @opindex O3
8213 Optimize yet more. @option{-O3} turns on all optimizations specified
8214 by @option{-O2} and also turns on the following optimization flags:
8215
8216 @c Please keep the following list alphabetized!
8217 @gccoptlist{-fgcse-after-reload @gol
8218 -finline-functions @gol
8219 -fipa-cp-clone
8220 -floop-interchange @gol
8221 -floop-unroll-and-jam @gol
8222 -fpeel-loops @gol
8223 -fpredictive-commoning @gol
8224 -fsplit-paths @gol
8225 -ftree-loop-distribute-patterns @gol
8226 -ftree-loop-distribution @gol
8227 -ftree-loop-vectorize @gol
8228 -ftree-partial-pre @gol
8229 -ftree-slp-vectorize @gol
8230 -funswitch-loops @gol
8231 -fvect-cost-model @gol
8232 -fversion-loops-for-strides}
8233
8234 @item -O0
8235 @opindex O0
8236 Reduce compilation time and make debugging produce the expected
8237 results. This is the default.
8238
8239 @item -Os
8240 @opindex Os
8241 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8242 except those that often increase code size:
8243
8244 @gccoptlist{-falign-functions -falign-jumps @gol
8245 -falign-labels -falign-loops @gol
8246 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8247
8248 It also enables @option{-finline-functions}, causes the compiler to tune for
8249 code size rather than execution speed, and performs further optimizations
8250 designed to reduce code size.
8251
8252 @item -Ofast
8253 @opindex Ofast
8254 Disregard strict standards compliance. @option{-Ofast} enables all
8255 @option{-O3} optimizations. It also enables optimizations that are not
8256 valid for all standard-compliant programs.
8257 It turns on @option{-ffast-math} and the Fortran-specific
8258 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8259 specified, and @option{-fno-protect-parens}.
8260
8261 @item -Og
8262 @opindex Og
8263 Optimize debugging experience. @option{-Og} should be the optimization
8264 level of choice for the standard edit-compile-debug cycle, offering
8265 a reasonable level of optimization while maintaining fast compilation
8266 and a good debugging experience. It is a better choice than @option{-O0}
8267 for producing debuggable code because some compiler passes
8268 that collect debug information are disabled at @option{-O0}.
8269
8270 Like @option{-O0}, @option{-Og} completely disables a number of
8271 optimization passes so that individual options controlling them have
8272 no effect. Otherwise @option{-Og} enables all @option{-O1}
8273 optimization flags except for those that may interfere with debugging:
8274
8275 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8276 -fif-conversion -fif-conversion2 @gol
8277 -finline-functions-called-once @gol
8278 -fmove-loop-invariants -fssa-phiopt @gol
8279 -ftree-bit-ccp -ftree-pta -ftree-sra}
8280
8281 @end table
8282
8283 If you use multiple @option{-O} options, with or without level numbers,
8284 the last such option is the one that is effective.
8285
8286 Options of the form @option{-f@var{flag}} specify machine-independent
8287 flags. Most flags have both positive and negative forms; the negative
8288 form of @option{-ffoo} is @option{-fno-foo}. In the table
8289 below, only one of the forms is listed---the one you typically
8290 use. You can figure out the other form by either removing @samp{no-}
8291 or adding it.
8292
8293 The following options control specific optimizations. They are either
8294 activated by @option{-O} options or are related to ones that are. You
8295 can use the following flags in the rare cases when ``fine-tuning'' of
8296 optimizations to be performed is desired.
8297
8298 @table @gcctabopt
8299 @item -fno-defer-pop
8300 @opindex fno-defer-pop
8301 @opindex fdefer-pop
8302 For machines that must pop arguments after a function call, always pop
8303 the arguments as soon as each function returns.
8304 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8305 this allows the compiler to let arguments accumulate on the stack for several
8306 function calls and pop them all at once.
8307
8308 @item -fforward-propagate
8309 @opindex fforward-propagate
8310 Perform a forward propagation pass on RTL@. The pass tries to combine two
8311 instructions and checks if the result can be simplified. If loop unrolling
8312 is active, two passes are performed and the second is scheduled after
8313 loop unrolling.
8314
8315 This option is enabled by default at optimization levels @option{-O},
8316 @option{-O2}, @option{-O3}, @option{-Os}.
8317
8318 @item -ffp-contract=@var{style}
8319 @opindex ffp-contract
8320 @option{-ffp-contract=off} disables floating-point expression contraction.
8321 @option{-ffp-contract=fast} enables floating-point expression contraction
8322 such as forming of fused multiply-add operations if the target has
8323 native support for them.
8324 @option{-ffp-contract=on} enables floating-point expression contraction
8325 if allowed by the language standard. This is currently not implemented
8326 and treated equal to @option{-ffp-contract=off}.
8327
8328 The default is @option{-ffp-contract=fast}.
8329
8330 @item -fomit-frame-pointer
8331 @opindex fomit-frame-pointer
8332 Omit the frame pointer in functions that don't need one. This avoids the
8333 instructions to save, set up and restore the frame pointer; on many targets
8334 it also makes an extra register available.
8335
8336 On some targets this flag has no effect because the standard calling sequence
8337 always uses a frame pointer, so it cannot be omitted.
8338
8339 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8340 is used in all functions. Several targets always omit the frame pointer in
8341 leaf functions.
8342
8343 Enabled by default at @option{-O} and higher.
8344
8345 @item -foptimize-sibling-calls
8346 @opindex foptimize-sibling-calls
8347 Optimize sibling and tail recursive calls.
8348
8349 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8350
8351 @item -foptimize-strlen
8352 @opindex foptimize-strlen
8353 Optimize various standard C string functions (e.g.@: @code{strlen},
8354 @code{strchr} or @code{strcpy}) and
8355 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8356
8357 Enabled at levels @option{-O2}, @option{-O3}.
8358
8359 @item -fno-inline
8360 @opindex fno-inline
8361 @opindex finline
8362 Do not expand any functions inline apart from those marked with
8363 the @code{always_inline} attribute. This is the default when not
8364 optimizing.
8365
8366 Single functions can be exempted from inlining by marking them
8367 with the @code{noinline} attribute.
8368
8369 @item -finline-small-functions
8370 @opindex finline-small-functions
8371 Integrate functions into their callers when their body is smaller than expected
8372 function call code (so overall size of program gets smaller). The compiler
8373 heuristically decides which functions are simple enough to be worth integrating
8374 in this way. This inlining applies to all functions, even those not declared
8375 inline.
8376
8377 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8378
8379 @item -findirect-inlining
8380 @opindex findirect-inlining
8381 Inline also indirect calls that are discovered to be known at compile
8382 time thanks to previous inlining. This option has any effect only
8383 when inlining itself is turned on by the @option{-finline-functions}
8384 or @option{-finline-small-functions} options.
8385
8386 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8387
8388 @item -finline-functions
8389 @opindex finline-functions
8390 Consider all functions for inlining, even if they are not declared inline.
8391 The compiler heuristically decides which functions are worth integrating
8392 in this way.
8393
8394 If all calls to a given function are integrated, and the function is
8395 declared @code{static}, then the function is normally not output as
8396 assembler code in its own right.
8397
8398 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8399 by @option{-fprofile-use} and @option{-fauto-profile}.
8400
8401 @item -finline-functions-called-once
8402 @opindex finline-functions-called-once
8403 Consider all @code{static} functions called once for inlining into their
8404 caller even if they are not marked @code{inline}. If a call to a given
8405 function is integrated, then the function is not output as assembler code
8406 in its own right.
8407
8408 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8409 but not @option{-Og}.
8410
8411 @item -fearly-inlining
8412 @opindex fearly-inlining
8413 Inline functions marked by @code{always_inline} and functions whose body seems
8414 smaller than the function call overhead early before doing
8415 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8416 makes profiling significantly cheaper and usually inlining faster on programs
8417 having large chains of nested wrapper functions.
8418
8419 Enabled by default.
8420
8421 @item -fipa-sra
8422 @opindex fipa-sra
8423 Perform interprocedural scalar replacement of aggregates, removal of
8424 unused parameters and replacement of parameters passed by reference
8425 by parameters passed by value.
8426
8427 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8428
8429 @item -finline-limit=@var{n}
8430 @opindex finline-limit
8431 By default, GCC limits the size of functions that can be inlined. This flag
8432 allows coarse control of this limit. @var{n} is the size of functions that
8433 can be inlined in number of pseudo instructions.
8434
8435 Inlining is actually controlled by a number of parameters, which may be
8436 specified individually by using @option{--param @var{name}=@var{value}}.
8437 The @option{-finline-limit=@var{n}} option sets some of these parameters
8438 as follows:
8439
8440 @table @gcctabopt
8441 @item max-inline-insns-single
8442 is set to @var{n}/2.
8443 @item max-inline-insns-auto
8444 is set to @var{n}/2.
8445 @end table
8446
8447 See below for a documentation of the individual
8448 parameters controlling inlining and for the defaults of these parameters.
8449
8450 @emph{Note:} there may be no value to @option{-finline-limit} that results
8451 in default behavior.
8452
8453 @emph{Note:} pseudo instruction represents, in this particular context, an
8454 abstract measurement of function's size. In no way does it represent a count
8455 of assembly instructions and as such its exact meaning might change from one
8456 release to an another.
8457
8458 @item -fno-keep-inline-dllexport
8459 @opindex fno-keep-inline-dllexport
8460 @opindex fkeep-inline-dllexport
8461 This is a more fine-grained version of @option{-fkeep-inline-functions},
8462 which applies only to functions that are declared using the @code{dllexport}
8463 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8464 Functions}.
8465
8466 @item -fkeep-inline-functions
8467 @opindex fkeep-inline-functions
8468 In C, emit @code{static} functions that are declared @code{inline}
8469 into the object file, even if the function has been inlined into all
8470 of its callers. This switch does not affect functions using the
8471 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8472 inline functions into the object file.
8473
8474 @item -fkeep-static-functions
8475 @opindex fkeep-static-functions
8476 Emit @code{static} functions into the object file, even if the function
8477 is never used.
8478
8479 @item -fkeep-static-consts
8480 @opindex fkeep-static-consts
8481 Emit variables declared @code{static const} when optimization isn't turned
8482 on, even if the variables aren't referenced.
8483
8484 GCC enables this option by default. If you want to force the compiler to
8485 check if a variable is referenced, regardless of whether or not
8486 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8487
8488 @item -fmerge-constants
8489 @opindex fmerge-constants
8490 Attempt to merge identical constants (string constants and floating-point
8491 constants) across compilation units.
8492
8493 This option is the default for optimized compilation if the assembler and
8494 linker support it. Use @option{-fno-merge-constants} to inhibit this
8495 behavior.
8496
8497 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8498
8499 @item -fmerge-all-constants
8500 @opindex fmerge-all-constants
8501 Attempt to merge identical constants and identical variables.
8502
8503 This option implies @option{-fmerge-constants}. In addition to
8504 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8505 arrays or initialized constant variables with integral or floating-point
8506 types. Languages like C or C++ require each variable, including multiple
8507 instances of the same variable in recursive calls, to have distinct locations,
8508 so using this option results in non-conforming
8509 behavior.
8510
8511 @item -fmodulo-sched
8512 @opindex fmodulo-sched
8513 Perform swing modulo scheduling immediately before the first scheduling
8514 pass. This pass looks at innermost loops and reorders their
8515 instructions by overlapping different iterations.
8516
8517 @item -fmodulo-sched-allow-regmoves
8518 @opindex fmodulo-sched-allow-regmoves
8519 Perform more aggressive SMS-based modulo scheduling with register moves
8520 allowed. By setting this flag certain anti-dependences edges are
8521 deleted, which triggers the generation of reg-moves based on the
8522 life-range analysis. This option is effective only with
8523 @option{-fmodulo-sched} enabled.
8524
8525 @item -fno-branch-count-reg
8526 @opindex fno-branch-count-reg
8527 @opindex fbranch-count-reg
8528 Disable the optimization pass that scans for opportunities to use
8529 ``decrement and branch'' instructions on a count register instead of
8530 instruction sequences that decrement a register, compare it against zero, and
8531 then branch based upon the result. This option is only meaningful on
8532 architectures that support such instructions, which include x86, PowerPC,
8533 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8534 doesn't remove the decrement and branch instructions from the generated
8535 instruction stream introduced by other optimization passes.
8536
8537 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8538 except for @option{-Og}.
8539
8540 @item -fno-function-cse
8541 @opindex fno-function-cse
8542 @opindex ffunction-cse
8543 Do not put function addresses in registers; make each instruction that
8544 calls a constant function contain the function's address explicitly.
8545
8546 This option results in less efficient code, but some strange hacks
8547 that alter the assembler output may be confused by the optimizations
8548 performed when this option is not used.
8549
8550 The default is @option{-ffunction-cse}
8551
8552 @item -fno-zero-initialized-in-bss
8553 @opindex fno-zero-initialized-in-bss
8554 @opindex fzero-initialized-in-bss
8555 If the target supports a BSS section, GCC by default puts variables that
8556 are initialized to zero into BSS@. This can save space in the resulting
8557 code.
8558
8559 This option turns off this behavior because some programs explicitly
8560 rely on variables going to the data section---e.g., so that the
8561 resulting executable can find the beginning of that section and/or make
8562 assumptions based on that.
8563
8564 The default is @option{-fzero-initialized-in-bss}.
8565
8566 @item -fthread-jumps
8567 @opindex fthread-jumps
8568 Perform optimizations that check to see if a jump branches to a
8569 location where another comparison subsumed by the first is found. If
8570 so, the first branch is redirected to either the destination of the
8571 second branch or a point immediately following it, depending on whether
8572 the condition is known to be true or false.
8573
8574 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8575
8576 @item -fsplit-wide-types
8577 @opindex fsplit-wide-types
8578 When using a type that occupies multiple registers, such as @code{long
8579 long} on a 32-bit system, split the registers apart and allocate them
8580 independently. This normally generates better code for those types,
8581 but may make debugging more difficult.
8582
8583 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8584 @option{-Os}.
8585
8586 @item -fcse-follow-jumps
8587 @opindex fcse-follow-jumps
8588 In common subexpression elimination (CSE), scan through jump instructions
8589 when the target of the jump is not reached by any other path. For
8590 example, when CSE encounters an @code{if} statement with an
8591 @code{else} clause, CSE follows the jump when the condition
8592 tested is false.
8593
8594 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8595
8596 @item -fcse-skip-blocks
8597 @opindex fcse-skip-blocks
8598 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8599 follow jumps that conditionally skip over blocks. When CSE
8600 encounters a simple @code{if} statement with no else clause,
8601 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8602 body of the @code{if}.
8603
8604 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8605
8606 @item -frerun-cse-after-loop
8607 @opindex frerun-cse-after-loop
8608 Re-run common subexpression elimination after loop optimizations are
8609 performed.
8610
8611 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8612
8613 @item -fgcse
8614 @opindex fgcse
8615 Perform a global common subexpression elimination pass.
8616 This pass also performs global constant and copy propagation.
8617
8618 @emph{Note:} When compiling a program using computed gotos, a GCC
8619 extension, you may get better run-time performance if you disable
8620 the global common subexpression elimination pass by adding
8621 @option{-fno-gcse} to the command line.
8622
8623 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8624
8625 @item -fgcse-lm
8626 @opindex fgcse-lm
8627 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8628 attempts to move loads that are only killed by stores into themselves. This
8629 allows a loop containing a load/store sequence to be changed to a load outside
8630 the loop, and a copy/store within the loop.
8631
8632 Enabled by default when @option{-fgcse} is enabled.
8633
8634 @item -fgcse-sm
8635 @opindex fgcse-sm
8636 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8637 global common subexpression elimination. This pass attempts to move
8638 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8639 loops containing a load/store sequence can be changed to a load before
8640 the loop and a store after the loop.
8641
8642 Not enabled at any optimization level.
8643
8644 @item -fgcse-las
8645 @opindex fgcse-las
8646 When @option{-fgcse-las} is enabled, the global common subexpression
8647 elimination pass eliminates redundant loads that come after stores to the
8648 same memory location (both partial and full redundancies).
8649
8650 Not enabled at any optimization level.
8651
8652 @item -fgcse-after-reload
8653 @opindex fgcse-after-reload
8654 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8655 pass is performed after reload. The purpose of this pass is to clean up
8656 redundant spilling.
8657
8658 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8659
8660 @item -faggressive-loop-optimizations
8661 @opindex faggressive-loop-optimizations
8662 This option tells the loop optimizer to use language constraints to
8663 derive bounds for the number of iterations of a loop. This assumes that
8664 loop code does not invoke undefined behavior by for example causing signed
8665 integer overflows or out-of-bound array accesses. The bounds for the
8666 number of iterations of a loop are used to guide loop unrolling and peeling
8667 and loop exit test optimizations.
8668 This option is enabled by default.
8669
8670 @item -funconstrained-commons
8671 @opindex funconstrained-commons
8672 This option tells the compiler that variables declared in common blocks
8673 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8674 prevents certain optimizations that depend on knowing the array bounds.
8675
8676 @item -fcrossjumping
8677 @opindex fcrossjumping
8678 Perform cross-jumping transformation.
8679 This transformation unifies equivalent code and saves code size. The
8680 resulting code may or may not perform better than without cross-jumping.
8681
8682 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8683
8684 @item -fauto-inc-dec
8685 @opindex fauto-inc-dec
8686 Combine increments or decrements of addresses with memory accesses.
8687 This pass is always skipped on architectures that do not have
8688 instructions to support this. Enabled by default at @option{-O} and
8689 higher on architectures that support this.
8690
8691 @item -fdce
8692 @opindex fdce
8693 Perform dead code elimination (DCE) on RTL@.
8694 Enabled by default at @option{-O} and higher.
8695
8696 @item -fdse
8697 @opindex fdse
8698 Perform dead store elimination (DSE) on RTL@.
8699 Enabled by default at @option{-O} and higher.
8700
8701 @item -fif-conversion
8702 @opindex fif-conversion
8703 Attempt to transform conditional jumps into branch-less equivalents. This
8704 includes use of conditional moves, min, max, set flags and abs instructions, and
8705 some tricks doable by standard arithmetics. The use of conditional execution
8706 on chips where it is available is controlled by @option{-fif-conversion2}.
8707
8708 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8709 not with @option{-Og}.
8710
8711 @item -fif-conversion2
8712 @opindex fif-conversion2
8713 Use conditional execution (where available) to transform conditional jumps into
8714 branch-less equivalents.
8715
8716 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8717 not with @option{-Og}.
8718
8719 @item -fdeclone-ctor-dtor
8720 @opindex fdeclone-ctor-dtor
8721 The C++ ABI requires multiple entry points for constructors and
8722 destructors: one for a base subobject, one for a complete object, and
8723 one for a virtual destructor that calls operator delete afterwards.
8724 For a hierarchy with virtual bases, the base and complete variants are
8725 clones, which means two copies of the function. With this option, the
8726 base and complete variants are changed to be thunks that call a common
8727 implementation.
8728
8729 Enabled by @option{-Os}.
8730
8731 @item -fdelete-null-pointer-checks
8732 @opindex fdelete-null-pointer-checks
8733 Assume that programs cannot safely dereference null pointers, and that
8734 no code or data element resides at address zero.
8735 This option enables simple constant
8736 folding optimizations at all optimization levels. In addition, other
8737 optimization passes in GCC use this flag to control global dataflow
8738 analyses that eliminate useless checks for null pointers; these assume
8739 that a memory access to address zero always results in a trap, so
8740 that if a pointer is checked after it has already been dereferenced,
8741 it cannot be null.
8742
8743 Note however that in some environments this assumption is not true.
8744 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8745 for programs that depend on that behavior.
8746
8747 This option is enabled by default on most targets. On Nios II ELF, it
8748 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8749
8750 Passes that use the dataflow information
8751 are enabled independently at different optimization levels.
8752
8753 @item -fdevirtualize
8754 @opindex fdevirtualize
8755 Attempt to convert calls to virtual functions to direct calls. This
8756 is done both within a procedure and interprocedurally as part of
8757 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8758 propagation (@option{-fipa-cp}).
8759 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8760
8761 @item -fdevirtualize-speculatively
8762 @opindex fdevirtualize-speculatively
8763 Attempt to convert calls to virtual functions to speculative direct calls.
8764 Based on the analysis of the type inheritance graph, determine for a given call
8765 the set of likely targets. If the set is small, preferably of size 1, change
8766 the call into a conditional deciding between direct and indirect calls. The
8767 speculative calls enable more optimizations, such as inlining. When they seem
8768 useless after further optimization, they are converted back into original form.
8769
8770 @item -fdevirtualize-at-ltrans
8771 @opindex fdevirtualize-at-ltrans
8772 Stream extra information needed for aggressive devirtualization when running
8773 the link-time optimizer in local transformation mode.
8774 This option enables more devirtualization but
8775 significantly increases the size of streamed data. For this reason it is
8776 disabled by default.
8777
8778 @item -fexpensive-optimizations
8779 @opindex fexpensive-optimizations
8780 Perform a number of minor optimizations that are relatively expensive.
8781
8782 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8783
8784 @item -free
8785 @opindex free
8786 Attempt to remove redundant extension instructions. This is especially
8787 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8788 registers after writing to their lower 32-bit half.
8789
8790 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8791 @option{-O3}, @option{-Os}.
8792
8793 @item -fno-lifetime-dse
8794 @opindex fno-lifetime-dse
8795 @opindex flifetime-dse
8796 In C++ the value of an object is only affected by changes within its
8797 lifetime: when the constructor begins, the object has an indeterminate
8798 value, and any changes during the lifetime of the object are dead when
8799 the object is destroyed. Normally dead store elimination will take
8800 advantage of this; if your code relies on the value of the object
8801 storage persisting beyond the lifetime of the object, you can use this
8802 flag to disable this optimization. To preserve stores before the
8803 constructor starts (e.g.@: because your operator new clears the object
8804 storage) but still treat the object as dead after the destructor you,
8805 can use @option{-flifetime-dse=1}. The default behavior can be
8806 explicitly selected with @option{-flifetime-dse=2}.
8807 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8808
8809 @item -flive-range-shrinkage
8810 @opindex flive-range-shrinkage
8811 Attempt to decrease register pressure through register live range
8812 shrinkage. This is helpful for fast processors with small or moderate
8813 size register sets.
8814
8815 @item -fira-algorithm=@var{algorithm}
8816 @opindex fira-algorithm
8817 Use the specified coloring algorithm for the integrated register
8818 allocator. The @var{algorithm} argument can be @samp{priority}, which
8819 specifies Chow's priority coloring, or @samp{CB}, which specifies
8820 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8821 for all architectures, but for those targets that do support it, it is
8822 the default because it generates better code.
8823
8824 @item -fira-region=@var{region}
8825 @opindex fira-region
8826 Use specified regions for the integrated register allocator. The
8827 @var{region} argument should be one of the following:
8828
8829 @table @samp
8830
8831 @item all
8832 Use all loops as register allocation regions.
8833 This can give the best results for machines with a small and/or
8834 irregular register set.
8835
8836 @item mixed
8837 Use all loops except for loops with small register pressure
8838 as the regions. This value usually gives
8839 the best results in most cases and for most architectures,
8840 and is enabled by default when compiling with optimization for speed
8841 (@option{-O}, @option{-O2}, @dots{}).
8842
8843 @item one
8844 Use all functions as a single region.
8845 This typically results in the smallest code size, and is enabled by default for
8846 @option{-Os} or @option{-O0}.
8847
8848 @end table
8849
8850 @item -fira-hoist-pressure
8851 @opindex fira-hoist-pressure
8852 Use IRA to evaluate register pressure in the code hoisting pass for
8853 decisions to hoist expressions. This option usually results in smaller
8854 code, but it can slow the compiler down.
8855
8856 This option is enabled at level @option{-Os} for all targets.
8857
8858 @item -fira-loop-pressure
8859 @opindex fira-loop-pressure
8860 Use IRA to evaluate register pressure in loops for decisions to move
8861 loop invariants. This option usually results in generation
8862 of faster and smaller code on machines with large register files (>= 32
8863 registers), but it can slow the compiler down.
8864
8865 This option is enabled at level @option{-O3} for some targets.
8866
8867 @item -fno-ira-share-save-slots
8868 @opindex fno-ira-share-save-slots
8869 @opindex fira-share-save-slots
8870 Disable sharing of stack slots used for saving call-used hard
8871 registers living through a call. Each hard register gets a
8872 separate stack slot, and as a result function stack frames are
8873 larger.
8874
8875 @item -fno-ira-share-spill-slots
8876 @opindex fno-ira-share-spill-slots
8877 @opindex fira-share-spill-slots
8878 Disable sharing of stack slots allocated for pseudo-registers. Each
8879 pseudo-register that does not get a hard register gets a separate
8880 stack slot, and as a result function stack frames are larger.
8881
8882 @item -flra-remat
8883 @opindex flra-remat
8884 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8885 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8886 values if it is profitable.
8887
8888 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8889
8890 @item -fdelayed-branch
8891 @opindex fdelayed-branch
8892 If supported for the target machine, attempt to reorder instructions
8893 to exploit instruction slots available after delayed branch
8894 instructions.
8895
8896 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8897 but not at @option{-Og}.
8898
8899 @item -fschedule-insns
8900 @opindex fschedule-insns
8901 If supported for the target machine, attempt to reorder instructions to
8902 eliminate execution stalls due to required data being unavailable. This
8903 helps machines that have slow floating point or memory load instructions
8904 by allowing other instructions to be issued until the result of the load
8905 or floating-point instruction is required.
8906
8907 Enabled at levels @option{-O2}, @option{-O3}.
8908
8909 @item -fschedule-insns2
8910 @opindex fschedule-insns2
8911 Similar to @option{-fschedule-insns}, but requests an additional pass of
8912 instruction scheduling after register allocation has been done. This is
8913 especially useful on machines with a relatively small number of
8914 registers and where memory load instructions take more than one cycle.
8915
8916 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8917
8918 @item -fno-sched-interblock
8919 @opindex fno-sched-interblock
8920 @opindex fsched-interblock
8921 Disable instruction scheduling across basic blocks, which
8922 is normally enabled when scheduling before register allocation, i.e.@:
8923 with @option{-fschedule-insns} or at @option{-O2} or higher.
8924
8925 @item -fno-sched-spec
8926 @opindex fno-sched-spec
8927 @opindex fsched-spec
8928 Disable speculative motion of non-load instructions, which
8929 is normally enabled when scheduling before register allocation, i.e.@:
8930 with @option{-fschedule-insns} or at @option{-O2} or higher.
8931
8932 @item -fsched-pressure
8933 @opindex fsched-pressure
8934 Enable register pressure sensitive insn scheduling before register
8935 allocation. This only makes sense when scheduling before register
8936 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8937 @option{-O2} or higher. Usage of this option can improve the
8938 generated code and decrease its size by preventing register pressure
8939 increase above the number of available hard registers and subsequent
8940 spills in register allocation.
8941
8942 @item -fsched-spec-load
8943 @opindex fsched-spec-load
8944 Allow speculative motion of some load instructions. This only makes
8945 sense when scheduling before register allocation, i.e.@: with
8946 @option{-fschedule-insns} or at @option{-O2} or higher.
8947
8948 @item -fsched-spec-load-dangerous
8949 @opindex fsched-spec-load-dangerous
8950 Allow speculative motion of more load instructions. This only makes
8951 sense when scheduling before register allocation, i.e.@: with
8952 @option{-fschedule-insns} or at @option{-O2} or higher.
8953
8954 @item -fsched-stalled-insns
8955 @itemx -fsched-stalled-insns=@var{n}
8956 @opindex fsched-stalled-insns
8957 Define how many insns (if any) can be moved prematurely from the queue
8958 of stalled insns into the ready list during the second scheduling pass.
8959 @option{-fno-sched-stalled-insns} means that no insns are moved
8960 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8961 on how many queued insns can be moved prematurely.
8962 @option{-fsched-stalled-insns} without a value is equivalent to
8963 @option{-fsched-stalled-insns=1}.
8964
8965 @item -fsched-stalled-insns-dep
8966 @itemx -fsched-stalled-insns-dep=@var{n}
8967 @opindex fsched-stalled-insns-dep
8968 Define how many insn groups (cycles) are examined for a dependency
8969 on a stalled insn that is a candidate for premature removal from the queue
8970 of stalled insns. This has an effect only during the second scheduling pass,
8971 and only if @option{-fsched-stalled-insns} is used.
8972 @option{-fno-sched-stalled-insns-dep} is equivalent to
8973 @option{-fsched-stalled-insns-dep=0}.
8974 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8975 @option{-fsched-stalled-insns-dep=1}.
8976
8977 @item -fsched2-use-superblocks
8978 @opindex fsched2-use-superblocks
8979 When scheduling after register allocation, use superblock scheduling.
8980 This allows motion across basic block boundaries,
8981 resulting in faster schedules. This option is experimental, as not all machine
8982 descriptions used by GCC model the CPU closely enough to avoid unreliable
8983 results from the algorithm.
8984
8985 This only makes sense when scheduling after register allocation, i.e.@: with
8986 @option{-fschedule-insns2} or at @option{-O2} or higher.
8987
8988 @item -fsched-group-heuristic
8989 @opindex fsched-group-heuristic
8990 Enable the group heuristic in the scheduler. This heuristic favors
8991 the instruction that belongs to a schedule group. This is enabled
8992 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8993 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8994
8995 @item -fsched-critical-path-heuristic
8996 @opindex fsched-critical-path-heuristic
8997 Enable the critical-path heuristic in the scheduler. This heuristic favors
8998 instructions on the critical path. This is enabled by default when
8999 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9000 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9001
9002 @item -fsched-spec-insn-heuristic
9003 @opindex fsched-spec-insn-heuristic
9004 Enable the speculative instruction heuristic in the scheduler. This
9005 heuristic favors speculative instructions with greater dependency weakness.
9006 This is enabled by default when scheduling is enabled, i.e.@:
9007 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9008 or at @option{-O2} or higher.
9009
9010 @item -fsched-rank-heuristic
9011 @opindex fsched-rank-heuristic
9012 Enable the rank heuristic in the scheduler. This heuristic favors
9013 the instruction belonging to a basic block with greater size or frequency.
9014 This is enabled by default when scheduling is enabled, i.e.@:
9015 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9016 at @option{-O2} or higher.
9017
9018 @item -fsched-last-insn-heuristic
9019 @opindex fsched-last-insn-heuristic
9020 Enable the last-instruction heuristic in the scheduler. This heuristic
9021 favors the instruction that is less dependent on the last instruction
9022 scheduled. This is enabled by default when scheduling is enabled,
9023 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9024 at @option{-O2} or higher.
9025
9026 @item -fsched-dep-count-heuristic
9027 @opindex fsched-dep-count-heuristic
9028 Enable the dependent-count heuristic in the scheduler. This heuristic
9029 favors the instruction that has more instructions depending on it.
9030 This is enabled by default when scheduling is enabled, i.e.@:
9031 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9032 at @option{-O2} or higher.
9033
9034 @item -freschedule-modulo-scheduled-loops
9035 @opindex freschedule-modulo-scheduled-loops
9036 Modulo scheduling is performed before traditional scheduling. If a loop
9037 is modulo scheduled, later scheduling passes may change its schedule.
9038 Use this option to control that behavior.
9039
9040 @item -fselective-scheduling
9041 @opindex fselective-scheduling
9042 Schedule instructions using selective scheduling algorithm. Selective
9043 scheduling runs instead of the first scheduler pass.
9044
9045 @item -fselective-scheduling2
9046 @opindex fselective-scheduling2
9047 Schedule instructions using selective scheduling algorithm. Selective
9048 scheduling runs instead of the second scheduler pass.
9049
9050 @item -fsel-sched-pipelining
9051 @opindex fsel-sched-pipelining
9052 Enable software pipelining of innermost loops during selective scheduling.
9053 This option has no effect unless one of @option{-fselective-scheduling} or
9054 @option{-fselective-scheduling2} is turned on.
9055
9056 @item -fsel-sched-pipelining-outer-loops
9057 @opindex fsel-sched-pipelining-outer-loops
9058 When pipelining loops during selective scheduling, also pipeline outer loops.
9059 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9060
9061 @item -fsemantic-interposition
9062 @opindex fsemantic-interposition
9063 Some object formats, like ELF, allow interposing of symbols by the
9064 dynamic linker.
9065 This means that for symbols exported from the DSO, the compiler cannot perform
9066 interprocedural propagation, inlining and other optimizations in anticipation
9067 that the function or variable in question may change. While this feature is
9068 useful, for example, to rewrite memory allocation functions by a debugging
9069 implementation, it is expensive in the terms of code quality.
9070 With @option{-fno-semantic-interposition} the compiler assumes that
9071 if interposition happens for functions the overwriting function will have
9072 precisely the same semantics (and side effects).
9073 Similarly if interposition happens
9074 for variables, the constructor of the variable will be the same. The flag
9075 has no effect for functions explicitly declared inline
9076 (where it is never allowed for interposition to change semantics)
9077 and for symbols explicitly declared weak.
9078
9079 @item -fshrink-wrap
9080 @opindex fshrink-wrap
9081 Emit function prologues only before parts of the function that need it,
9082 rather than at the top of the function. This flag is enabled by default at
9083 @option{-O} and higher.
9084
9085 @item -fshrink-wrap-separate
9086 @opindex fshrink-wrap-separate
9087 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9088 those parts are only executed when needed.
9089 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9090 is also turned on and the target supports this.
9091
9092 @item -fcaller-saves
9093 @opindex fcaller-saves
9094 Enable allocation of values to registers that are clobbered by
9095 function calls, by emitting extra instructions to save and restore the
9096 registers around such calls. Such allocation is done only when it
9097 seems to result in better code.
9098
9099 This option is always enabled by default on certain machines, usually
9100 those which have no call-preserved registers to use instead.
9101
9102 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9103
9104 @item -fcombine-stack-adjustments
9105 @opindex fcombine-stack-adjustments
9106 Tracks stack adjustments (pushes and pops) and stack memory references
9107 and then tries to find ways to combine them.
9108
9109 Enabled by default at @option{-O1} and higher.
9110
9111 @item -fipa-ra
9112 @opindex fipa-ra
9113 Use caller save registers for allocation if those registers are not used by
9114 any called function. In that case it is not necessary to save and restore
9115 them around calls. This is only possible if called functions are part of
9116 same compilation unit as current function and they are compiled before it.
9117
9118 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9119 is disabled if generated code will be instrumented for profiling
9120 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9121 exactly (this happens on targets that do not expose prologues
9122 and epilogues in RTL).
9123
9124 @item -fconserve-stack
9125 @opindex fconserve-stack
9126 Attempt to minimize stack usage. The compiler attempts to use less
9127 stack space, even if that makes the program slower. This option
9128 implies setting the @option{large-stack-frame} parameter to 100
9129 and the @option{large-stack-frame-growth} parameter to 400.
9130
9131 @item -ftree-reassoc
9132 @opindex ftree-reassoc
9133 Perform reassociation on trees. This flag is enabled by default
9134 at @option{-O} and higher.
9135
9136 @item -fcode-hoisting
9137 @opindex fcode-hoisting
9138 Perform code hoisting. Code hoisting tries to move the
9139 evaluation of expressions executed on all paths to the function exit
9140 as early as possible. This is especially useful as a code size
9141 optimization, but it often helps for code speed as well.
9142 This flag is enabled by default at @option{-O2} and higher.
9143
9144 @item -ftree-pre
9145 @opindex ftree-pre
9146 Perform partial redundancy elimination (PRE) on trees. This flag is
9147 enabled by default at @option{-O2} and @option{-O3}.
9148
9149 @item -ftree-partial-pre
9150 @opindex ftree-partial-pre
9151 Make partial redundancy elimination (PRE) more aggressive. This flag is
9152 enabled by default at @option{-O3}.
9153
9154 @item -ftree-forwprop
9155 @opindex ftree-forwprop
9156 Perform forward propagation on trees. This flag is enabled by default
9157 at @option{-O} and higher.
9158
9159 @item -ftree-fre
9160 @opindex ftree-fre
9161 Perform full redundancy elimination (FRE) on trees. The difference
9162 between FRE and PRE is that FRE only considers expressions
9163 that are computed on all paths leading to the redundant computation.
9164 This analysis is faster than PRE, though it exposes fewer redundancies.
9165 This flag is enabled by default at @option{-O} and higher.
9166
9167 @item -ftree-phiprop
9168 @opindex ftree-phiprop
9169 Perform hoisting of loads from conditional pointers on trees. This
9170 pass is enabled by default at @option{-O} and higher.
9171
9172 @item -fhoist-adjacent-loads
9173 @opindex fhoist-adjacent-loads
9174 Speculatively hoist loads from both branches of an if-then-else if the
9175 loads are from adjacent locations in the same structure and the target
9176 architecture has a conditional move instruction. This flag is enabled
9177 by default at @option{-O2} and higher.
9178
9179 @item -ftree-copy-prop
9180 @opindex ftree-copy-prop
9181 Perform copy propagation on trees. This pass eliminates unnecessary
9182 copy operations. This flag is enabled by default at @option{-O} and
9183 higher.
9184
9185 @item -fipa-pure-const
9186 @opindex fipa-pure-const
9187 Discover which functions are pure or constant.
9188 Enabled by default at @option{-O} and higher.
9189
9190 @item -fipa-reference
9191 @opindex fipa-reference
9192 Discover which static variables do not escape the
9193 compilation unit.
9194 Enabled by default at @option{-O} and higher.
9195
9196 @item -fipa-reference-addressable
9197 @opindex fipa-reference-addressable
9198 Discover read-only, write-only and non-addressable static variables.
9199 Enabled by default at @option{-O} and higher.
9200
9201 @item -fipa-stack-alignment
9202 @opindex fipa-stack-alignment
9203 Reduce stack alignment on call sites if possible.
9204 Enabled by default.
9205
9206 @item -fipa-pta
9207 @opindex fipa-pta
9208 Perform interprocedural pointer analysis and interprocedural modification
9209 and reference analysis. This option can cause excessive memory and
9210 compile-time usage on large compilation units. It is not enabled by
9211 default at any optimization level.
9212
9213 @item -fipa-profile
9214 @opindex fipa-profile
9215 Perform interprocedural profile propagation. The functions called only from
9216 cold functions are marked as cold. Also functions executed once (such as
9217 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9218 functions and loop less parts of functions executed once are then optimized for
9219 size.
9220 Enabled by default at @option{-O} and higher.
9221
9222 @item -fipa-cp
9223 @opindex fipa-cp
9224 Perform interprocedural constant propagation.
9225 This optimization analyzes the program to determine when values passed
9226 to functions are constants and then optimizes accordingly.
9227 This optimization can substantially increase performance
9228 if the application has constants passed to functions.
9229 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9230 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9231
9232 @item -fipa-cp-clone
9233 @opindex fipa-cp-clone
9234 Perform function cloning to make interprocedural constant propagation stronger.
9235 When enabled, interprocedural constant propagation performs function cloning
9236 when externally visible function can be called with constant arguments.
9237 Because this optimization can create multiple copies of functions,
9238 it may significantly increase code size
9239 (see @option{--param ipcp-unit-growth=@var{value}}).
9240 This flag is enabled by default at @option{-O3}.
9241 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9242
9243 @item -fipa-bit-cp
9244 @opindex fipa-bit-cp
9245 When enabled, perform interprocedural bitwise constant
9246 propagation. This flag is enabled by default at @option{-O2} and
9247 by @option{-fprofile-use} and @option{-fauto-profile}.
9248 It requires that @option{-fipa-cp} is enabled.
9249
9250 @item -fipa-vrp
9251 @opindex fipa-vrp
9252 When enabled, perform interprocedural propagation of value
9253 ranges. This flag is enabled by default at @option{-O2}. It requires
9254 that @option{-fipa-cp} is enabled.
9255
9256 @item -fipa-icf
9257 @opindex fipa-icf
9258 Perform Identical Code Folding for functions and read-only variables.
9259 The optimization reduces code size and may disturb unwind stacks by replacing
9260 a function by equivalent one with a different name. The optimization works
9261 more effectively with link-time optimization enabled.
9262
9263 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9264 works on different levels and thus the optimizations are not same - there are
9265 equivalences that are found only by GCC and equivalences found only by Gold.
9266
9267 This flag is enabled by default at @option{-O2} and @option{-Os}.
9268
9269 @item -flive-patching=@var{level}
9270 @opindex flive-patching
9271 Control GCC's optimizations to provide a safe compilation for live-patching.
9272
9273 If the compiler's optimization uses a function's body or information extracted
9274 from its body to optimize/change another function, the latter is called an
9275 impacted function of the former. If a function is patched, its impacted
9276 functions should be patched too.
9277
9278 The impacted functions are decided by the compiler's interprocedural
9279 optimizations. For example, inlining a function into its caller, cloning
9280 a function and changing its caller to call this new clone, or extracting
9281 a function's pureness/constness information to optimize its direct or
9282 indirect callers, etc.
9283
9284 Usually, the more IPA optimizations enabled, the larger the number of
9285 impacted functions for each function. In order to control the number of
9286 impacted functions and computed the list of impacted function easily,
9287 we provide control to partially enable IPA optimizations on two different
9288 levels.
9289
9290 The @var{level} argument should be one of the following:
9291
9292 @table @samp
9293
9294 @item inline-clone
9295
9296 Only enable inlining and cloning optimizations, which includes inlining,
9297 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9298 As a result, when patching a function, all its callers and its clones'
9299 callers need to be patched as well.
9300
9301 @option{-flive-patching=inline-clone} disables the following optimization flags:
9302 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9303 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9304 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9305 -fipa-stack-alignment}
9306
9307 @item inline-only-static
9308
9309 Only enable inlining of static functions.
9310 As a result, when patching a static function, all its callers need to be
9311 patches as well.
9312
9313 In addition to all the flags that -flive-patching=inline-clone disables,
9314 @option{-flive-patching=inline-only-static} disables the following additional
9315 optimization flags:
9316 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9317
9318 @end table
9319
9320 When -flive-patching specified without any value, the default value
9321 is "inline-clone".
9322
9323 This flag is disabled by default.
9324
9325 Note that -flive-patching is not supported with link-time optimizer.
9326 (@option{-flto}).
9327
9328 @item -fisolate-erroneous-paths-dereference
9329 @opindex fisolate-erroneous-paths-dereference
9330 Detect paths that trigger erroneous or undefined behavior due to
9331 dereferencing a null pointer. Isolate those paths from the main control
9332 flow and turn the statement with erroneous or undefined behavior into a trap.
9333 This flag is enabled by default at @option{-O2} and higher and depends on
9334 @option{-fdelete-null-pointer-checks} also being enabled.
9335
9336 @item -fisolate-erroneous-paths-attribute
9337 @opindex fisolate-erroneous-paths-attribute
9338 Detect paths that trigger erroneous or undefined behavior due to a null value
9339 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9340 attribute. Isolate those paths from the main control flow and turn the
9341 statement with erroneous or undefined behavior into a trap. This is not
9342 currently enabled, but may be enabled by @option{-O2} in the future.
9343
9344 @item -ftree-sink
9345 @opindex ftree-sink
9346 Perform forward store motion on trees. This flag is
9347 enabled by default at @option{-O} and higher.
9348
9349 @item -ftree-bit-ccp
9350 @opindex ftree-bit-ccp
9351 Perform sparse conditional bit constant propagation on trees and propagate
9352 pointer alignment information.
9353 This pass only operates on local scalar variables and is enabled by default
9354 at @option{-O1} and higher, except for @option{-Og}.
9355 It requires that @option{-ftree-ccp} is enabled.
9356
9357 @item -ftree-ccp
9358 @opindex ftree-ccp
9359 Perform sparse conditional constant propagation (CCP) on trees. This
9360 pass only operates on local scalar variables and is enabled by default
9361 at @option{-O} and higher.
9362
9363 @item -fssa-backprop
9364 @opindex fssa-backprop
9365 Propagate information about uses of a value up the definition chain
9366 in order to simplify the definitions. For example, this pass strips
9367 sign operations if the sign of a value never matters. The flag is
9368 enabled by default at @option{-O} and higher.
9369
9370 @item -fssa-phiopt
9371 @opindex fssa-phiopt
9372 Perform pattern matching on SSA PHI nodes to optimize conditional
9373 code. This pass is enabled by default at @option{-O1} and higher,
9374 except for @option{-Og}.
9375
9376 @item -ftree-switch-conversion
9377 @opindex ftree-switch-conversion
9378 Perform conversion of simple initializations in a switch to
9379 initializations from a scalar array. This flag is enabled by default
9380 at @option{-O2} and higher.
9381
9382 @item -ftree-tail-merge
9383 @opindex ftree-tail-merge
9384 Look for identical code sequences. When found, replace one with a jump to the
9385 other. This optimization is known as tail merging or cross jumping. This flag
9386 is enabled by default at @option{-O2} and higher. The compilation time
9387 in this pass can
9388 be limited using @option{max-tail-merge-comparisons} parameter and
9389 @option{max-tail-merge-iterations} parameter.
9390
9391 @item -ftree-dce
9392 @opindex ftree-dce
9393 Perform dead code elimination (DCE) on trees. This flag is enabled by
9394 default at @option{-O} and higher.
9395
9396 @item -ftree-builtin-call-dce
9397 @opindex ftree-builtin-call-dce
9398 Perform conditional dead code elimination (DCE) for calls to built-in functions
9399 that may set @code{errno} but are otherwise free of side effects. This flag is
9400 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9401 specified.
9402
9403 @item -ftree-dominator-opts
9404 @opindex ftree-dominator-opts
9405 Perform a variety of simple scalar cleanups (constant/copy
9406 propagation, redundancy elimination, range propagation and expression
9407 simplification) based on a dominator tree traversal. This also
9408 performs jump threading (to reduce jumps to jumps). This flag is
9409 enabled by default at @option{-O} and higher.
9410
9411 @item -ftree-dse
9412 @opindex ftree-dse
9413 Perform dead store elimination (DSE) on trees. A dead store is a store into
9414 a memory location that is later overwritten by another store without
9415 any intervening loads. In this case the earlier store can be deleted. This
9416 flag is enabled by default at @option{-O} and higher.
9417
9418 @item -ftree-ch
9419 @opindex ftree-ch
9420 Perform loop header copying on trees. This is beneficial since it increases
9421 effectiveness of code motion optimizations. It also saves one jump. This flag
9422 is enabled by default at @option{-O} and higher. It is not enabled
9423 for @option{-Os}, since it usually increases code size.
9424
9425 @item -ftree-loop-optimize
9426 @opindex ftree-loop-optimize
9427 Perform loop optimizations on trees. This flag is enabled by default
9428 at @option{-O} and higher.
9429
9430 @item -ftree-loop-linear
9431 @itemx -floop-strip-mine
9432 @itemx -floop-block
9433 @opindex ftree-loop-linear
9434 @opindex floop-strip-mine
9435 @opindex floop-block
9436 Perform loop nest optimizations. Same as
9437 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9438 to be configured with @option{--with-isl} to enable the Graphite loop
9439 transformation infrastructure.
9440
9441 @item -fgraphite-identity
9442 @opindex fgraphite-identity
9443 Enable the identity transformation for graphite. For every SCoP we generate
9444 the polyhedral representation and transform it back to gimple. Using
9445 @option{-fgraphite-identity} we can check the costs or benefits of the
9446 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9447 are also performed by the code generator isl, like index splitting and
9448 dead code elimination in loops.
9449
9450 @item -floop-nest-optimize
9451 @opindex floop-nest-optimize
9452 Enable the isl based loop nest optimizer. This is a generic loop nest
9453 optimizer based on the Pluto optimization algorithms. It calculates a loop
9454 structure optimized for data-locality and parallelism. This option
9455 is experimental.
9456
9457 @item -floop-parallelize-all
9458 @opindex floop-parallelize-all
9459 Use the Graphite data dependence analysis to identify loops that can
9460 be parallelized. Parallelize all the loops that can be analyzed to
9461 not contain loop carried dependences without checking that it is
9462 profitable to parallelize the loops.
9463
9464 @item -ftree-coalesce-vars
9465 @opindex ftree-coalesce-vars
9466 While transforming the program out of the SSA representation, attempt to
9467 reduce copying by coalescing versions of different user-defined
9468 variables, instead of just compiler temporaries. This may severely
9469 limit the ability to debug an optimized program compiled with
9470 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9471 prevents SSA coalescing of user variables. This option is enabled by
9472 default if optimization is enabled, and it does very little otherwise.
9473
9474 @item -ftree-loop-if-convert
9475 @opindex ftree-loop-if-convert
9476 Attempt to transform conditional jumps in the innermost loops to
9477 branch-less equivalents. The intent is to remove control-flow from
9478 the innermost loops in order to improve the ability of the
9479 vectorization pass to handle these loops. This is enabled by default
9480 if vectorization is enabled.
9481
9482 @item -ftree-loop-distribution
9483 @opindex ftree-loop-distribution
9484 Perform loop distribution. This flag can improve cache performance on
9485 big loop bodies and allow further loop optimizations, like
9486 parallelization or vectorization, to take place. For example, the loop
9487 @smallexample
9488 DO I = 1, N
9489 A(I) = B(I) + C
9490 D(I) = E(I) * F
9491 ENDDO
9492 @end smallexample
9493 is transformed to
9494 @smallexample
9495 DO I = 1, N
9496 A(I) = B(I) + C
9497 ENDDO
9498 DO I = 1, N
9499 D(I) = E(I) * F
9500 ENDDO
9501 @end smallexample
9502
9503 @item -ftree-loop-distribute-patterns
9504 @opindex ftree-loop-distribute-patterns
9505 Perform loop distribution of patterns that can be code generated with
9506 calls to a library. This flag is enabled by default at @option{-O3}, and
9507 by @option{-fprofile-use} and @option{-fauto-profile}.
9508
9509 This pass distributes the initialization loops and generates a call to
9510 memset zero. For example, the loop
9511 @smallexample
9512 DO I = 1, N
9513 A(I) = 0
9514 B(I) = A(I) + I
9515 ENDDO
9516 @end smallexample
9517 is transformed to
9518 @smallexample
9519 DO I = 1, N
9520 A(I) = 0
9521 ENDDO
9522 DO I = 1, N
9523 B(I) = A(I) + I
9524 ENDDO
9525 @end smallexample
9526 and the initialization loop is transformed into a call to memset zero.
9527
9528 @item -floop-interchange
9529 @opindex floop-interchange
9530 Perform loop interchange outside of graphite. This flag can improve cache
9531 performance on loop nest and allow further loop optimizations, like
9532 vectorization, to take place. For example, the loop
9533 @smallexample
9534 for (int i = 0; i < N; i++)
9535 for (int j = 0; j < N; j++)
9536 for (int k = 0; k < N; k++)
9537 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9538 @end smallexample
9539 is transformed to
9540 @smallexample
9541 for (int i = 0; i < N; i++)
9542 for (int k = 0; k < N; k++)
9543 for (int j = 0; j < N; j++)
9544 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9545 @end smallexample
9546 This flag is enabled by default at @option{-O3}.
9547
9548 @item -floop-unroll-and-jam
9549 @opindex floop-unroll-and-jam
9550 Apply unroll and jam transformations on feasible loops. In a loop
9551 nest this unrolls the outer loop by some factor and fuses the resulting
9552 multiple inner loops. This flag is enabled by default at @option{-O3}.
9553
9554 @item -ftree-loop-im
9555 @opindex ftree-loop-im
9556 Perform loop invariant motion on trees. This pass moves only invariants that
9557 are hard to handle at RTL level (function calls, operations that expand to
9558 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9559 operands of conditions that are invariant out of the loop, so that we can use
9560 just trivial invariantness analysis in loop unswitching. The pass also includes
9561 store motion.
9562
9563 @item -ftree-loop-ivcanon
9564 @opindex ftree-loop-ivcanon
9565 Create a canonical counter for number of iterations in loops for which
9566 determining number of iterations requires complicated analysis. Later
9567 optimizations then may determine the number easily. Useful especially
9568 in connection with unrolling.
9569
9570 @item -ftree-scev-cprop
9571 @opindex ftree-scev-cprop
9572 Perform final value replacement. If a variable is modified in a loop
9573 in such a way that its value when exiting the loop can be determined using
9574 only its initial value and the number of loop iterations, replace uses of
9575 the final value by such a computation, provided it is sufficiently cheap.
9576 This reduces data dependencies and may allow further simplifications.
9577 Enabled by default at @option{-O} and higher.
9578
9579 @item -fivopts
9580 @opindex fivopts
9581 Perform induction variable optimizations (strength reduction, induction
9582 variable merging and induction variable elimination) on trees.
9583
9584 @item -ftree-parallelize-loops=n
9585 @opindex ftree-parallelize-loops
9586 Parallelize loops, i.e., split their iteration space to run in n threads.
9587 This is only possible for loops whose iterations are independent
9588 and can be arbitrarily reordered. The optimization is only
9589 profitable on multiprocessor machines, for loops that are CPU-intensive,
9590 rather than constrained e.g.@: by memory bandwidth. This option
9591 implies @option{-pthread}, and thus is only supported on targets
9592 that have support for @option{-pthread}.
9593
9594 @item -ftree-pta
9595 @opindex ftree-pta
9596 Perform function-local points-to analysis on trees. This flag is
9597 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9598
9599 @item -ftree-sra
9600 @opindex ftree-sra
9601 Perform scalar replacement of aggregates. This pass replaces structure
9602 references with scalars to prevent committing structures to memory too
9603 early. This flag is enabled by default at @option{-O1} and higher,
9604 except for @option{-Og}.
9605
9606 @item -fstore-merging
9607 @opindex fstore-merging
9608 Perform merging of narrow stores to consecutive memory addresses. This pass
9609 merges contiguous stores of immediate values narrower than a word into fewer
9610 wider stores to reduce the number of instructions. This is enabled by default
9611 at @option{-O2} and higher as well as @option{-Os}.
9612
9613 @item -ftree-ter
9614 @opindex ftree-ter
9615 Perform temporary expression replacement during the SSA->normal phase. Single
9616 use/single def temporaries are replaced at their use location with their
9617 defining expression. This results in non-GIMPLE code, but gives the expanders
9618 much more complex trees to work on resulting in better RTL generation. This is
9619 enabled by default at @option{-O} and higher.
9620
9621 @item -ftree-slsr
9622 @opindex ftree-slsr
9623 Perform straight-line strength reduction on trees. This recognizes related
9624 expressions involving multiplications and replaces them by less expensive
9625 calculations when possible. This is enabled by default at @option{-O} and
9626 higher.
9627
9628 @item -ftree-vectorize
9629 @opindex ftree-vectorize
9630 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9631 and @option{-ftree-slp-vectorize} if not explicitly specified.
9632
9633 @item -ftree-loop-vectorize
9634 @opindex ftree-loop-vectorize
9635 Perform loop vectorization on trees. This flag is enabled by default at
9636 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9637 and @option{-fauto-profile}.
9638
9639 @item -ftree-slp-vectorize
9640 @opindex ftree-slp-vectorize
9641 Perform basic block vectorization on trees. This flag is enabled by default at
9642 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9643 and @option{-fauto-profile}.
9644
9645 @item -fvect-cost-model=@var{model}
9646 @opindex fvect-cost-model
9647 Alter the cost model used for vectorization. The @var{model} argument
9648 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9649 With the @samp{unlimited} model the vectorized code-path is assumed
9650 to be profitable while with the @samp{dynamic} model a runtime check
9651 guards the vectorized code-path to enable it only for iteration
9652 counts that will likely execute faster than when executing the original
9653 scalar loop. The @samp{cheap} model disables vectorization of
9654 loops where doing so would be cost prohibitive for example due to
9655 required runtime checks for data dependence or alignment but otherwise
9656 is equal to the @samp{dynamic} model.
9657 The default cost model depends on other optimization flags and is
9658 either @samp{dynamic} or @samp{cheap}.
9659
9660 @item -fsimd-cost-model=@var{model}
9661 @opindex fsimd-cost-model
9662 Alter the cost model used for vectorization of loops marked with the OpenMP
9663 simd directive. The @var{model} argument should be one of
9664 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9665 have the same meaning as described in @option{-fvect-cost-model} and by
9666 default a cost model defined with @option{-fvect-cost-model} is used.
9667
9668 @item -ftree-vrp
9669 @opindex ftree-vrp
9670 Perform Value Range Propagation on trees. This is similar to the
9671 constant propagation pass, but instead of values, ranges of values are
9672 propagated. This allows the optimizers to remove unnecessary range
9673 checks like array bound checks and null pointer checks. This is
9674 enabled by default at @option{-O2} and higher. Null pointer check
9675 elimination is only done if @option{-fdelete-null-pointer-checks} is
9676 enabled.
9677
9678 @item -fsplit-paths
9679 @opindex fsplit-paths
9680 Split paths leading to loop backedges. This can improve dead code
9681 elimination and common subexpression elimination. This is enabled by
9682 default at @option{-O2} and above.
9683
9684 @item -fsplit-ivs-in-unroller
9685 @opindex fsplit-ivs-in-unroller
9686 Enables expression of values of induction variables in later iterations
9687 of the unrolled loop using the value in the first iteration. This breaks
9688 long dependency chains, thus improving efficiency of the scheduling passes.
9689
9690 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9691 same effect. However, that is not reliable in cases where the loop body
9692 is more complicated than a single basic block. It also does not work at all
9693 on some architectures due to restrictions in the CSE pass.
9694
9695 This optimization is enabled by default.
9696
9697 @item -fvariable-expansion-in-unroller
9698 @opindex fvariable-expansion-in-unroller
9699 With this option, the compiler creates multiple copies of some
9700 local variables when unrolling a loop, which can result in superior code.
9701
9702 @item -fpartial-inlining
9703 @opindex fpartial-inlining
9704 Inline parts of functions. This option has any effect only
9705 when inlining itself is turned on by the @option{-finline-functions}
9706 or @option{-finline-small-functions} options.
9707
9708 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9709
9710 @item -fpredictive-commoning
9711 @opindex fpredictive-commoning
9712 Perform predictive commoning optimization, i.e., reusing computations
9713 (especially memory loads and stores) performed in previous
9714 iterations of loops.
9715
9716 This option is enabled at level @option{-O3}.
9717 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9718
9719 @item -fprefetch-loop-arrays
9720 @opindex fprefetch-loop-arrays
9721 If supported by the target machine, generate instructions to prefetch
9722 memory to improve the performance of loops that access large arrays.
9723
9724 This option may generate better or worse code; results are highly
9725 dependent on the structure of loops within the source code.
9726
9727 Disabled at level @option{-Os}.
9728
9729 @item -fno-printf-return-value
9730 @opindex fno-printf-return-value
9731 @opindex fprintf-return-value
9732 Do not substitute constants for known return value of formatted output
9733 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9734 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9735 transformation allows GCC to optimize or even eliminate branches based
9736 on the known return value of these functions called with arguments that
9737 are either constant, or whose values are known to be in a range that
9738 makes determining the exact return value possible. For example, when
9739 @option{-fprintf-return-value} is in effect, both the branch and the
9740 body of the @code{if} statement (but not the call to @code{snprint})
9741 can be optimized away when @code{i} is a 32-bit or smaller integer
9742 because the return value is guaranteed to be at most 8.
9743
9744 @smallexample
9745 char buf[9];
9746 if (snprintf (buf, "%08x", i) >= sizeof buf)
9747 @dots{}
9748 @end smallexample
9749
9750 The @option{-fprintf-return-value} option relies on other optimizations
9751 and yields best results with @option{-O2} and above. It works in tandem
9752 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9753 options. The @option{-fprintf-return-value} option is enabled by default.
9754
9755 @item -fno-peephole
9756 @itemx -fno-peephole2
9757 @opindex fno-peephole
9758 @opindex fpeephole
9759 @opindex fno-peephole2
9760 @opindex fpeephole2
9761 Disable any machine-specific peephole optimizations. The difference
9762 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9763 are implemented in the compiler; some targets use one, some use the
9764 other, a few use both.
9765
9766 @option{-fpeephole} is enabled by default.
9767 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9768
9769 @item -fno-guess-branch-probability
9770 @opindex fno-guess-branch-probability
9771 @opindex fguess-branch-probability
9772 Do not guess branch probabilities using heuristics.
9773
9774 GCC uses heuristics to guess branch probabilities if they are
9775 not provided by profiling feedback (@option{-fprofile-arcs}). These
9776 heuristics are based on the control flow graph. If some branch probabilities
9777 are specified by @code{__builtin_expect}, then the heuristics are
9778 used to guess branch probabilities for the rest of the control flow graph,
9779 taking the @code{__builtin_expect} info into account. The interactions
9780 between the heuristics and @code{__builtin_expect} can be complex, and in
9781 some cases, it may be useful to disable the heuristics so that the effects
9782 of @code{__builtin_expect} are easier to understand.
9783
9784 It is also possible to specify expected probability of the expression
9785 with @code{__builtin_expect_with_probability} built-in function.
9786
9787 The default is @option{-fguess-branch-probability} at levels
9788 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9789
9790 @item -freorder-blocks
9791 @opindex freorder-blocks
9792 Reorder basic blocks in the compiled function in order to reduce number of
9793 taken branches and improve code locality.
9794
9795 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9796
9797 @item -freorder-blocks-algorithm=@var{algorithm}
9798 @opindex freorder-blocks-algorithm
9799 Use the specified algorithm for basic block reordering. The
9800 @var{algorithm} argument can be @samp{simple}, which does not increase
9801 code size (except sometimes due to secondary effects like alignment),
9802 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9803 put all often executed code together, minimizing the number of branches
9804 executed by making extra copies of code.
9805
9806 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9807 @samp{stc} at levels @option{-O2}, @option{-O3}.
9808
9809 @item -freorder-blocks-and-partition
9810 @opindex freorder-blocks-and-partition
9811 In addition to reordering basic blocks in the compiled function, in order
9812 to reduce number of taken branches, partitions hot and cold basic blocks
9813 into separate sections of the assembly and @file{.o} files, to improve
9814 paging and cache locality performance.
9815
9816 This optimization is automatically turned off in the presence of
9817 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9818 section attribute and on any architecture that does not support named
9819 sections. When @option{-fsplit-stack} is used this option is not
9820 enabled by default (to avoid linker errors), but may be enabled
9821 explicitly (if using a working linker).
9822
9823 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9824
9825 @item -freorder-functions
9826 @opindex freorder-functions
9827 Reorder functions in the object file in order to
9828 improve code locality. This is implemented by using special
9829 subsections @code{.text.hot} for most frequently executed functions and
9830 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9831 the linker so object file format must support named sections and linker must
9832 place them in a reasonable way.
9833
9834 This option isn't effective unless you either provide profile feedback
9835 (see @option{-fprofile-arcs} for details) or manually annotate functions with
9836 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9837
9838 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9839
9840 @item -fstrict-aliasing
9841 @opindex fstrict-aliasing
9842 Allow the compiler to assume the strictest aliasing rules applicable to
9843 the language being compiled. For C (and C++), this activates
9844 optimizations based on the type of expressions. In particular, an
9845 object of one type is assumed never to reside at the same address as an
9846 object of a different type, unless the types are almost the same. For
9847 example, an @code{unsigned int} can alias an @code{int}, but not a
9848 @code{void*} or a @code{double}. A character type may alias any other
9849 type.
9850
9851 @anchor{Type-punning}Pay special attention to code like this:
9852 @smallexample
9853 union a_union @{
9854 int i;
9855 double d;
9856 @};
9857
9858 int f() @{
9859 union a_union t;
9860 t.d = 3.0;
9861 return t.i;
9862 @}
9863 @end smallexample
9864 The practice of reading from a different union member than the one most
9865 recently written to (called ``type-punning'') is common. Even with
9866 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9867 is accessed through the union type. So, the code above works as
9868 expected. @xref{Structures unions enumerations and bit-fields
9869 implementation}. However, this code might not:
9870 @smallexample
9871 int f() @{
9872 union a_union t;
9873 int* ip;
9874 t.d = 3.0;
9875 ip = &t.i;
9876 return *ip;
9877 @}
9878 @end smallexample
9879
9880 Similarly, access by taking the address, casting the resulting pointer
9881 and dereferencing the result has undefined behavior, even if the cast
9882 uses a union type, e.g.:
9883 @smallexample
9884 int f() @{
9885 double d = 3.0;
9886 return ((union a_union *) &d)->i;
9887 @}
9888 @end smallexample
9889
9890 The @option{-fstrict-aliasing} option is enabled at levels
9891 @option{-O2}, @option{-O3}, @option{-Os}.
9892
9893 @item -falign-functions
9894 @itemx -falign-functions=@var{n}
9895 @itemx -falign-functions=@var{n}:@var{m}
9896 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9897 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9898 @opindex falign-functions
9899 Align the start of functions to the next power-of-two greater than
9900 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9901 the first @var{m} bytes of the function can be fetched by the CPU
9902 without crossing an @var{n}-byte alignment boundary.
9903
9904 If @var{m} is not specified, it defaults to @var{n}.
9905
9906 Examples: @option{-falign-functions=32} aligns functions to the next
9907 32-byte boundary, @option{-falign-functions=24} aligns to the next
9908 32-byte boundary only if this can be done by skipping 23 bytes or less,
9909 @option{-falign-functions=32:7} aligns to the next
9910 32-byte boundary only if this can be done by skipping 6 bytes or less.
9911
9912 The second pair of @var{n2}:@var{m2} values allows you to specify
9913 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9914 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9915 otherwise aligns to the next 32-byte boundary if this can be done
9916 by skipping 2 bytes or less.
9917 If @var{m2} is not specified, it defaults to @var{n2}.
9918
9919 Some assemblers only support this flag when @var{n} is a power of two;
9920 in that case, it is rounded up.
9921
9922 @option{-fno-align-functions} and @option{-falign-functions=1} are
9923 equivalent and mean that functions are not aligned.
9924
9925 If @var{n} is not specified or is zero, use a machine-dependent default.
9926 The maximum allowed @var{n} option value is 65536.
9927
9928 Enabled at levels @option{-O2}, @option{-O3}.
9929
9930 @item -flimit-function-alignment
9931 If this option is enabled, the compiler tries to avoid unnecessarily
9932 overaligning functions. It attempts to instruct the assembler to align
9933 by the amount specified by @option{-falign-functions}, but not to
9934 skip more bytes than the size of the function.
9935
9936 @item -falign-labels
9937 @itemx -falign-labels=@var{n}
9938 @itemx -falign-labels=@var{n}:@var{m}
9939 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9940 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9941 @opindex falign-labels
9942 Align all branch targets to a power-of-two boundary.
9943
9944 Parameters of this option are analogous to the @option{-falign-functions} option.
9945 @option{-fno-align-labels} and @option{-falign-labels=1} are
9946 equivalent and mean that labels are not aligned.
9947
9948 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9949 are greater than this value, then their values are used instead.
9950
9951 If @var{n} is not specified or is zero, use a machine-dependent default
9952 which is very likely to be @samp{1}, meaning no alignment.
9953 The maximum allowed @var{n} option value is 65536.
9954
9955 Enabled at levels @option{-O2}, @option{-O3}.
9956
9957 @item -falign-loops
9958 @itemx -falign-loops=@var{n}
9959 @itemx -falign-loops=@var{n}:@var{m}
9960 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9961 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9962 @opindex falign-loops
9963 Align loops to a power-of-two boundary. If the loops are executed
9964 many times, this makes up for any execution of the dummy padding
9965 instructions.
9966
9967 Parameters of this option are analogous to the @option{-falign-functions} option.
9968 @option{-fno-align-loops} and @option{-falign-loops=1} are
9969 equivalent and mean that loops are not aligned.
9970 The maximum allowed @var{n} option value is 65536.
9971
9972 If @var{n} is not specified or is zero, use a machine-dependent default.
9973
9974 Enabled at levels @option{-O2}, @option{-O3}.
9975
9976 @item -falign-jumps
9977 @itemx -falign-jumps=@var{n}
9978 @itemx -falign-jumps=@var{n}:@var{m}
9979 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9980 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9981 @opindex falign-jumps
9982 Align branch targets to a power-of-two boundary, for branch targets
9983 where the targets can only be reached by jumping. In this case,
9984 no dummy operations need be executed.
9985
9986 Parameters of this option are analogous to the @option{-falign-functions} option.
9987 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9988 equivalent and mean that loops are not aligned.
9989
9990 If @var{n} is not specified or is zero, use a machine-dependent default.
9991 The maximum allowed @var{n} option value is 65536.
9992
9993 Enabled at levels @option{-O2}, @option{-O3}.
9994
9995 @item -funit-at-a-time
9996 @opindex funit-at-a-time
9997 This option is left for compatibility reasons. @option{-funit-at-a-time}
9998 has no effect, while @option{-fno-unit-at-a-time} implies
9999 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10000
10001 Enabled by default.
10002
10003 @item -fno-toplevel-reorder
10004 @opindex fno-toplevel-reorder
10005 @opindex ftoplevel-reorder
10006 Do not reorder top-level functions, variables, and @code{asm}
10007 statements. Output them in the same order that they appear in the
10008 input file. When this option is used, unreferenced static variables
10009 are not removed. This option is intended to support existing code
10010 that relies on a particular ordering. For new code, it is better to
10011 use attributes when possible.
10012
10013 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10014 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10015 Additionally @option{-fno-toplevel-reorder} implies
10016 @option{-fno-section-anchors}.
10017
10018 @item -fweb
10019 @opindex fweb
10020 Constructs webs as commonly used for register allocation purposes and assign
10021 each web individual pseudo register. This allows the register allocation pass
10022 to operate on pseudos directly, but also strengthens several other optimization
10023 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10024 however, make debugging impossible, since variables no longer stay in a
10025 ``home register''.
10026
10027 Enabled by default with @option{-funroll-loops}.
10028
10029 @item -fwhole-program
10030 @opindex fwhole-program
10031 Assume that the current compilation unit represents the whole program being
10032 compiled. All public functions and variables with the exception of @code{main}
10033 and those merged by attribute @code{externally_visible} become static functions
10034 and in effect are optimized more aggressively by interprocedural optimizers.
10035
10036 This option should not be used in combination with @option{-flto}.
10037 Instead relying on a linker plugin should provide safer and more precise
10038 information.
10039
10040 @item -flto[=@var{n}]
10041 @opindex flto
10042 This option runs the standard link-time optimizer. When invoked
10043 with source code, it generates GIMPLE (one of GCC's internal
10044 representations) and writes it to special ELF sections in the object
10045 file. When the object files are linked together, all the function
10046 bodies are read from these ELF sections and instantiated as if they
10047 had been part of the same translation unit.
10048
10049 To use the link-time optimizer, @option{-flto} and optimization
10050 options should be specified at compile time and during the final link.
10051 It is recommended that you compile all the files participating in the
10052 same link with the same options and also specify those options at
10053 link time.
10054 For example:
10055
10056 @smallexample
10057 gcc -c -O2 -flto foo.c
10058 gcc -c -O2 -flto bar.c
10059 gcc -o myprog -flto -O2 foo.o bar.o
10060 @end smallexample
10061
10062 The first two invocations to GCC save a bytecode representation
10063 of GIMPLE into special ELF sections inside @file{foo.o} and
10064 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10065 @file{foo.o} and @file{bar.o}, merges the two files into a single
10066 internal image, and compiles the result as usual. Since both
10067 @file{foo.o} and @file{bar.o} are merged into a single image, this
10068 causes all the interprocedural analyses and optimizations in GCC to
10069 work across the two files as if they were a single one. This means,
10070 for example, that the inliner is able to inline functions in
10071 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10072
10073 Another (simpler) way to enable link-time optimization is:
10074
10075 @smallexample
10076 gcc -o myprog -flto -O2 foo.c bar.c
10077 @end smallexample
10078
10079 The above generates bytecode for @file{foo.c} and @file{bar.c},
10080 merges them together into a single GIMPLE representation and optimizes
10081 them as usual to produce @file{myprog}.
10082
10083 The important thing to keep in mind is that to enable link-time
10084 optimizations you need to use the GCC driver to perform the link step.
10085 GCC automatically performs link-time optimization if any of the
10086 objects involved were compiled with the @option{-flto} command-line option.
10087 You can always override
10088 the automatic decision to do link-time optimization
10089 by passing @option{-fno-lto} to the link command.
10090
10091 To make whole program optimization effective, it is necessary to make
10092 certain whole program assumptions. The compiler needs to know
10093 what functions and variables can be accessed by libraries and runtime
10094 outside of the link-time optimized unit. When supported by the linker,
10095 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10096 to the compiler about used and externally visible symbols. When
10097 the linker plugin is not available, @option{-fwhole-program} should be
10098 used to allow the compiler to make these assumptions, which leads
10099 to more aggressive optimization decisions.
10100
10101 When a file is compiled with @option{-flto} without
10102 @option{-fuse-linker-plugin}, the generated object file is larger than
10103 a regular object file because it contains GIMPLE bytecodes and the usual
10104 final code (see @option{-ffat-lto-objects}. This means that
10105 object files with LTO information can be linked as normal object
10106 files; if @option{-fno-lto} is passed to the linker, no
10107 interprocedural optimizations are applied. Note that when
10108 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10109 but you cannot perform a regular, non-LTO link on them.
10110
10111 When producing the final binary, GCC only
10112 applies link-time optimizations to those files that contain bytecode.
10113 Therefore, you can mix and match object files and libraries with
10114 GIMPLE bytecodes and final object code. GCC automatically selects
10115 which files to optimize in LTO mode and which files to link without
10116 further processing.
10117
10118 Generally, options specified at link time override those
10119 specified at compile time, although in some cases GCC attempts to infer
10120 link-time options from the settings used to compile the input files.
10121
10122 If you do not specify an optimization level option @option{-O} at
10123 link time, then GCC uses the highest optimization level
10124 used when compiling the object files. Note that it is generally
10125 ineffective to specify an optimization level option only at link time and
10126 not at compile time, for two reasons. First, compiling without
10127 optimization suppresses compiler passes that gather information
10128 needed for effective optimization at link time. Second, some early
10129 optimization passes can be performed only at compile time and
10130 not at link time.
10131
10132 There are some code generation flags preserved by GCC when
10133 generating bytecodes, as they need to be used during the final link.
10134 Currently, the following options and their settings are taken from
10135 the first object file that explicitly specifies them:
10136 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10137 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10138 and all the @option{-m} target flags.
10139
10140 Certain ABI-changing flags are required to match in all compilation units,
10141 and trying to override this at link time with a conflicting value
10142 is ignored. This includes options such as @option{-freg-struct-return}
10143 and @option{-fpcc-struct-return}.
10144
10145 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10146 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10147 are passed through to the link stage and merged conservatively for
10148 conflicting translation units. Specifically
10149 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10150 precedence; and for example @option{-ffp-contract=off} takes precedence
10151 over @option{-ffp-contract=fast}. You can override them at link time.
10152
10153 If LTO encounters objects with C linkage declared with incompatible
10154 types in separate translation units to be linked together (undefined
10155 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10156 issued. The behavior is still undefined at run time. Similar
10157 diagnostics may be raised for other languages.
10158
10159 Another feature of LTO is that it is possible to apply interprocedural
10160 optimizations on files written in different languages:
10161
10162 @smallexample
10163 gcc -c -flto foo.c
10164 g++ -c -flto bar.cc
10165 gfortran -c -flto baz.f90
10166 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10167 @end smallexample
10168
10169 Notice that the final link is done with @command{g++} to get the C++
10170 runtime libraries and @option{-lgfortran} is added to get the Fortran
10171 runtime libraries. In general, when mixing languages in LTO mode, you
10172 should use the same link command options as when mixing languages in a
10173 regular (non-LTO) compilation.
10174
10175 If object files containing GIMPLE bytecode are stored in a library archive, say
10176 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10177 are using a linker with plugin support. To create static libraries suitable
10178 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10179 and @command{ranlib};
10180 to show the symbols of object files with GIMPLE bytecode, use
10181 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10182 and @command{nm} have been compiled with plugin support. At link time, use the
10183 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10184 the LTO optimization process:
10185
10186 @smallexample
10187 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10188 @end smallexample
10189
10190 With the linker plugin enabled, the linker extracts the needed
10191 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10192 to make them part of the aggregated GIMPLE image to be optimized.
10193
10194 If you are not using a linker with plugin support and/or do not
10195 enable the linker plugin, then the objects inside @file{libfoo.a}
10196 are extracted and linked as usual, but they do not participate
10197 in the LTO optimization process. In order to make a static library suitable
10198 for both LTO optimization and usual linkage, compile its object files with
10199 @option{-flto} @option{-ffat-lto-objects}.
10200
10201 Link-time optimizations do not require the presence of the whole program to
10202 operate. If the program does not require any symbols to be exported, it is
10203 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10204 the interprocedural optimizers to use more aggressive assumptions which may
10205 lead to improved optimization opportunities.
10206 Use of @option{-fwhole-program} is not needed when linker plugin is
10207 active (see @option{-fuse-linker-plugin}).
10208
10209 The current implementation of LTO makes no
10210 attempt to generate bytecode that is portable between different
10211 types of hosts. The bytecode files are versioned and there is a
10212 strict version check, so bytecode files generated in one version of
10213 GCC do not work with an older or newer version of GCC.
10214
10215 Link-time optimization does not work well with generation of debugging
10216 information on systems other than those using a combination of ELF and
10217 DWARF.
10218
10219 If you specify the optional @var{n}, the optimization and code
10220 generation done at link time is executed in parallel using @var{n}
10221 parallel jobs by utilizing an installed @command{make} program. The
10222 environment variable @env{MAKE} may be used to override the program
10223 used. The default value for @var{n} is 1.
10224
10225 You can also specify @option{-flto=jobserver} to use GNU make's
10226 job server mode to determine the number of parallel jobs. This
10227 is useful when the Makefile calling GCC is already executing in parallel.
10228 You must prepend a @samp{+} to the command recipe in the parent Makefile
10229 for this to work. This option likely only works if @env{MAKE} is
10230 GNU make.
10231
10232 @item -flto-partition=@var{alg}
10233 @opindex flto-partition
10234 Specify the partitioning algorithm used by the link-time optimizer.
10235 The value is either @samp{1to1} to specify a partitioning mirroring
10236 the original source files or @samp{balanced} to specify partitioning
10237 into equally sized chunks (whenever possible) or @samp{max} to create
10238 new partition for every symbol where possible. Specifying @samp{none}
10239 as an algorithm disables partitioning and streaming completely.
10240 The default value is @samp{balanced}. While @samp{1to1} can be used
10241 as an workaround for various code ordering issues, the @samp{max}
10242 partitioning is intended for internal testing only.
10243 The value @samp{one} specifies that exactly one partition should be
10244 used while the value @samp{none} bypasses partitioning and executes
10245 the link-time optimization step directly from the WPA phase.
10246
10247 @item -flto-odr-type-merging
10248 @opindex flto-odr-type-merging
10249 Enable streaming of mangled types names of C++ types and their unification
10250 at link time. This increases size of LTO object files, but enables
10251 diagnostics about One Definition Rule violations.
10252
10253 @item -flto-compression-level=@var{n}
10254 @opindex flto-compression-level
10255 This option specifies the level of compression used for intermediate
10256 language written to LTO object files, and is only meaningful in
10257 conjunction with LTO mode (@option{-flto}). Valid
10258 values are 0 (no compression) to 9 (maximum compression). Values
10259 outside this range are clamped to either 0 or 9. If the option is not
10260 given, a default balanced compression setting is used.
10261
10262 @item -fuse-linker-plugin
10263 @opindex fuse-linker-plugin
10264 Enables the use of a linker plugin during link-time optimization. This
10265 option relies on plugin support in the linker, which is available in gold
10266 or in GNU ld 2.21 or newer.
10267
10268 This option enables the extraction of object files with GIMPLE bytecode out
10269 of library archives. This improves the quality of optimization by exposing
10270 more code to the link-time optimizer. This information specifies what
10271 symbols can be accessed externally (by non-LTO object or during dynamic
10272 linking). Resulting code quality improvements on binaries (and shared
10273 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10274 See @option{-flto} for a description of the effect of this flag and how to
10275 use it.
10276
10277 This option is enabled by default when LTO support in GCC is enabled
10278 and GCC was configured for use with
10279 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10280
10281 @item -ffat-lto-objects
10282 @opindex ffat-lto-objects
10283 Fat LTO objects are object files that contain both the intermediate language
10284 and the object code. This makes them usable for both LTO linking and normal
10285 linking. This option is effective only when compiling with @option{-flto}
10286 and is ignored at link time.
10287
10288 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10289 requires the complete toolchain to be aware of LTO. It requires a linker with
10290 linker plugin support for basic functionality. Additionally,
10291 @command{nm}, @command{ar} and @command{ranlib}
10292 need to support linker plugins to allow a full-featured build environment
10293 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10294 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10295 to these tools. With non fat LTO makefiles need to be modified to use them.
10296
10297 Note that modern binutils provide plugin auto-load mechanism.
10298 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10299 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10300 @command{gcc-ranlib}).
10301
10302 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10303 support.
10304
10305 @item -fcompare-elim
10306 @opindex fcompare-elim
10307 After register allocation and post-register allocation instruction splitting,
10308 identify arithmetic instructions that compute processor flags similar to a
10309 comparison operation based on that arithmetic. If possible, eliminate the
10310 explicit comparison operation.
10311
10312 This pass only applies to certain targets that cannot explicitly represent
10313 the comparison operation before register allocation is complete.
10314
10315 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10316
10317 @item -fcprop-registers
10318 @opindex fcprop-registers
10319 After register allocation and post-register allocation instruction splitting,
10320 perform a copy-propagation pass to try to reduce scheduling dependencies
10321 and occasionally eliminate the copy.
10322
10323 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10324
10325 @item -fprofile-correction
10326 @opindex fprofile-correction
10327 Profiles collected using an instrumented binary for multi-threaded programs may
10328 be inconsistent due to missed counter updates. When this option is specified,
10329 GCC uses heuristics to correct or smooth out such inconsistencies. By
10330 default, GCC emits an error message when an inconsistent profile is detected.
10331
10332 This option is enabled by @option{-fauto-profile}.
10333
10334 @item -fprofile-use
10335 @itemx -fprofile-use=@var{path}
10336 @opindex fprofile-use
10337 Enable profile feedback-directed optimizations,
10338 and the following optimizations, many of which
10339 are generally profitable only with profile feedback available:
10340
10341 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10342 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10343 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10344 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10345 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10346 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10347 -fprofile-reorder-functions}
10348
10349 Before you can use this option, you must first generate profiling information.
10350 @xref{Instrumentation Options}, for information about the
10351 @option{-fprofile-generate} option.
10352
10353 By default, GCC emits an error message if the feedback profiles do not
10354 match the source code. This error can be turned into a warning by using
10355 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10356 optimized code. Additionally, by default, GCC also emits a warning message if
10357 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10358
10359 If @var{path} is specified, GCC looks at the @var{path} to find
10360 the profile feedback data files. See @option{-fprofile-dir}.
10361
10362 @item -fauto-profile
10363 @itemx -fauto-profile=@var{path}
10364 @opindex fauto-profile
10365 Enable sampling-based feedback-directed optimizations,
10366 and the following optimizations,
10367 many of which are generally profitable only with profile feedback available:
10368
10369 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10370 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10371 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10372 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10373 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10374 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10375 -fprofile-correction}
10376
10377 @var{path} is the name of a file containing AutoFDO profile information.
10378 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10379
10380 Producing an AutoFDO profile data file requires running your program
10381 with the @command{perf} utility on a supported GNU/Linux target system.
10382 For more information, see @uref{https://perf.wiki.kernel.org/}.
10383
10384 E.g.
10385 @smallexample
10386 perf record -e br_inst_retired:near_taken -b -o perf.data \
10387 -- your_program
10388 @end smallexample
10389
10390 Then use the @command{create_gcov} tool to convert the raw profile data
10391 to a format that can be used by GCC.@ You must also supply the
10392 unstripped binary for your program to this tool.
10393 See @uref{https://github.com/google/autofdo}.
10394
10395 E.g.
10396 @smallexample
10397 create_gcov --binary=your_program.unstripped --profile=perf.data \
10398 --gcov=profile.afdo
10399 @end smallexample
10400 @end table
10401
10402 The following options control compiler behavior regarding floating-point
10403 arithmetic. These options trade off between speed and
10404 correctness. All must be specifically enabled.
10405
10406 @table @gcctabopt
10407 @item -ffloat-store
10408 @opindex ffloat-store
10409 Do not store floating-point variables in registers, and inhibit other
10410 options that might change whether a floating-point value is taken from a
10411 register or memory.
10412
10413 @cindex floating-point precision
10414 This option prevents undesirable excess precision on machines such as
10415 the 68000 where the floating registers (of the 68881) keep more
10416 precision than a @code{double} is supposed to have. Similarly for the
10417 x86 architecture. For most programs, the excess precision does only
10418 good, but a few programs rely on the precise definition of IEEE floating
10419 point. Use @option{-ffloat-store} for such programs, after modifying
10420 them to store all pertinent intermediate computations into variables.
10421
10422 @item -fexcess-precision=@var{style}
10423 @opindex fexcess-precision
10424 This option allows further control over excess precision on machines
10425 where floating-point operations occur in a format with more precision or
10426 range than the IEEE standard and interchange floating-point types. By
10427 default, @option{-fexcess-precision=fast} is in effect; this means that
10428 operations may be carried out in a wider precision than the types specified
10429 in the source if that would result in faster code, and it is unpredictable
10430 when rounding to the types specified in the source code takes place.
10431 When compiling C, if @option{-fexcess-precision=standard} is specified then
10432 excess precision follows the rules specified in ISO C99; in particular,
10433 both casts and assignments cause values to be rounded to their
10434 semantic types (whereas @option{-ffloat-store} only affects
10435 assignments). This option is enabled by default for C if a strict
10436 conformance option such as @option{-std=c99} is used.
10437 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10438 regardless of whether a strict conformance option is used.
10439
10440 @opindex mfpmath
10441 @option{-fexcess-precision=standard} is not implemented for languages
10442 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10443 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10444 semantics apply without excess precision, and in the latter, rounding
10445 is unpredictable.
10446
10447 @item -ffast-math
10448 @opindex ffast-math
10449 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10450 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10451 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10452 @option{-fexcess-precision=fast}.
10453
10454 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10455
10456 This option is not turned on by any @option{-O} option besides
10457 @option{-Ofast} since it can result in incorrect output for programs
10458 that depend on an exact implementation of IEEE or ISO rules/specifications
10459 for math functions. It may, however, yield faster code for programs
10460 that do not require the guarantees of these specifications.
10461
10462 @item -fno-math-errno
10463 @opindex fno-math-errno
10464 @opindex fmath-errno
10465 Do not set @code{errno} after calling math functions that are executed
10466 with a single instruction, e.g., @code{sqrt}. A program that relies on
10467 IEEE exceptions for math error handling may want to use this flag
10468 for speed while maintaining IEEE arithmetic compatibility.
10469
10470 This option is not turned on by any @option{-O} option since
10471 it can result in incorrect output for programs that depend on
10472 an exact implementation of IEEE or ISO rules/specifications for
10473 math functions. It may, however, yield faster code for programs
10474 that do not require the guarantees of these specifications.
10475
10476 The default is @option{-fmath-errno}.
10477
10478 On Darwin systems, the math library never sets @code{errno}. There is
10479 therefore no reason for the compiler to consider the possibility that
10480 it might, and @option{-fno-math-errno} is the default.
10481
10482 @item -funsafe-math-optimizations
10483 @opindex funsafe-math-optimizations
10484
10485 Allow optimizations for floating-point arithmetic that (a) assume
10486 that arguments and results are valid and (b) may violate IEEE or
10487 ANSI standards. When used at link time, it may include libraries
10488 or startup files that change the default FPU control word or other
10489 similar optimizations.
10490
10491 This option is not turned on by any @option{-O} option since
10492 it can result in incorrect output for programs that depend on
10493 an exact implementation of IEEE or ISO rules/specifications for
10494 math functions. It may, however, yield faster code for programs
10495 that do not require the guarantees of these specifications.
10496 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10497 @option{-fassociative-math} and @option{-freciprocal-math}.
10498
10499 The default is @option{-fno-unsafe-math-optimizations}.
10500
10501 @item -fassociative-math
10502 @opindex fassociative-math
10503
10504 Allow re-association of operands in series of floating-point operations.
10505 This violates the ISO C and C++ language standard by possibly changing
10506 computation result. NOTE: re-ordering may change the sign of zero as
10507 well as ignore NaNs and inhibit or create underflow or overflow (and
10508 thus cannot be used on code that relies on rounding behavior like
10509 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10510 and thus may not be used when ordered comparisons are required.
10511 This option requires that both @option{-fno-signed-zeros} and
10512 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10513 much sense with @option{-frounding-math}. For Fortran the option
10514 is automatically enabled when both @option{-fno-signed-zeros} and
10515 @option{-fno-trapping-math} are in effect.
10516
10517 The default is @option{-fno-associative-math}.
10518
10519 @item -freciprocal-math
10520 @opindex freciprocal-math
10521
10522 Allow the reciprocal of a value to be used instead of dividing by
10523 the value if this enables optimizations. For example @code{x / y}
10524 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10525 is subject to common subexpression elimination. Note that this loses
10526 precision and increases the number of flops operating on the value.
10527
10528 The default is @option{-fno-reciprocal-math}.
10529
10530 @item -ffinite-math-only
10531 @opindex ffinite-math-only
10532 Allow optimizations for floating-point arithmetic that assume
10533 that arguments and results are not NaNs or +-Infs.
10534
10535 This option is not turned on by any @option{-O} option since
10536 it can result in incorrect output for programs that depend on
10537 an exact implementation of IEEE or ISO rules/specifications for
10538 math functions. It may, however, yield faster code for programs
10539 that do not require the guarantees of these specifications.
10540
10541 The default is @option{-fno-finite-math-only}.
10542
10543 @item -fno-signed-zeros
10544 @opindex fno-signed-zeros
10545 @opindex fsigned-zeros
10546 Allow optimizations for floating-point arithmetic that ignore the
10547 signedness of zero. IEEE arithmetic specifies the behavior of
10548 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10549 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10550 This option implies that the sign of a zero result isn't significant.
10551
10552 The default is @option{-fsigned-zeros}.
10553
10554 @item -fno-trapping-math
10555 @opindex fno-trapping-math
10556 @opindex ftrapping-math
10557 Compile code assuming that floating-point operations cannot generate
10558 user-visible traps. These traps include division by zero, overflow,
10559 underflow, inexact result and invalid operation. This option requires
10560 that @option{-fno-signaling-nans} be in effect. Setting this option may
10561 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10562
10563 This option should never be turned on by any @option{-O} option since
10564 it can result in incorrect output for programs that depend on
10565 an exact implementation of IEEE or ISO rules/specifications for
10566 math functions.
10567
10568 The default is @option{-ftrapping-math}.
10569
10570 @item -frounding-math
10571 @opindex frounding-math
10572 Disable transformations and optimizations that assume default floating-point
10573 rounding behavior. This is round-to-zero for all floating point
10574 to integer conversions, and round-to-nearest for all other arithmetic
10575 truncations. This option should be specified for programs that change
10576 the FP rounding mode dynamically, or that may be executed with a
10577 non-default rounding mode. This option disables constant folding of
10578 floating-point expressions at compile time (which may be affected by
10579 rounding mode) and arithmetic transformations that are unsafe in the
10580 presence of sign-dependent rounding modes.
10581
10582 The default is @option{-fno-rounding-math}.
10583
10584 This option is experimental and does not currently guarantee to
10585 disable all GCC optimizations that are affected by rounding mode.
10586 Future versions of GCC may provide finer control of this setting
10587 using C99's @code{FENV_ACCESS} pragma. This command-line option
10588 will be used to specify the default state for @code{FENV_ACCESS}.
10589
10590 @item -fsignaling-nans
10591 @opindex fsignaling-nans
10592 Compile code assuming that IEEE signaling NaNs may generate user-visible
10593 traps during floating-point operations. Setting this option disables
10594 optimizations that may change the number of exceptions visible with
10595 signaling NaNs. This option implies @option{-ftrapping-math}.
10596
10597 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10598 be defined.
10599
10600 The default is @option{-fno-signaling-nans}.
10601
10602 This option is experimental and does not currently guarantee to
10603 disable all GCC optimizations that affect signaling NaN behavior.
10604
10605 @item -fno-fp-int-builtin-inexact
10606 @opindex fno-fp-int-builtin-inexact
10607 @opindex ffp-int-builtin-inexact
10608 Do not allow the built-in functions @code{ceil}, @code{floor},
10609 @code{round} and @code{trunc}, and their @code{float} and @code{long
10610 double} variants, to generate code that raises the ``inexact''
10611 floating-point exception for noninteger arguments. ISO C99 and C11
10612 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10613 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10614 functions to do so.
10615
10616 The default is @option{-ffp-int-builtin-inexact}, allowing the
10617 exception to be raised. This option does nothing unless
10618 @option{-ftrapping-math} is in effect.
10619
10620 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10621 generate a call to a library function then the ``inexact'' exception
10622 may be raised if the library implementation does not follow TS 18661.
10623
10624 @item -fsingle-precision-constant
10625 @opindex fsingle-precision-constant
10626 Treat floating-point constants as single precision instead of
10627 implicitly converting them to double-precision constants.
10628
10629 @item -fcx-limited-range
10630 @opindex fcx-limited-range
10631 When enabled, this option states that a range reduction step is not
10632 needed when performing complex division. Also, there is no checking
10633 whether the result of a complex multiplication or division is @code{NaN
10634 + I*NaN}, with an attempt to rescue the situation in that case. The
10635 default is @option{-fno-cx-limited-range}, but is enabled by
10636 @option{-ffast-math}.
10637
10638 This option controls the default setting of the ISO C99
10639 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10640 all languages.
10641
10642 @item -fcx-fortran-rules
10643 @opindex fcx-fortran-rules
10644 Complex multiplication and division follow Fortran rules. Range
10645 reduction is done as part of complex division, but there is no checking
10646 whether the result of a complex multiplication or division is @code{NaN
10647 + I*NaN}, with an attempt to rescue the situation in that case.
10648
10649 The default is @option{-fno-cx-fortran-rules}.
10650
10651 @end table
10652
10653 The following options control optimizations that may improve
10654 performance, but are not enabled by any @option{-O} options. This
10655 section includes experimental options that may produce broken code.
10656
10657 @table @gcctabopt
10658 @item -fbranch-probabilities
10659 @opindex fbranch-probabilities
10660 After running a program compiled with @option{-fprofile-arcs}
10661 (@pxref{Instrumentation Options}),
10662 you can compile it a second time using
10663 @option{-fbranch-probabilities}, to improve optimizations based on
10664 the number of times each branch was taken. When a program
10665 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10666 counts to a file called @file{@var{sourcename}.gcda} for each source
10667 file. The information in this data file is very dependent on the
10668 structure of the generated code, so you must use the same source code
10669 and the same optimization options for both compilations.
10670
10671 With @option{-fbranch-probabilities}, GCC puts a
10672 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10673 These can be used to improve optimization. Currently, they are only
10674 used in one place: in @file{reorg.c}, instead of guessing which path a
10675 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10676 exactly determine which path is taken more often.
10677
10678 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10679
10680 @item -fprofile-values
10681 @opindex fprofile-values
10682 If combined with @option{-fprofile-arcs}, it adds code so that some
10683 data about values of expressions in the program is gathered.
10684
10685 With @option{-fbranch-probabilities}, it reads back the data gathered
10686 from profiling values of expressions for usage in optimizations.
10687
10688 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10689 @option{-fauto-profile}.
10690
10691 @item -fprofile-reorder-functions
10692 @opindex fprofile-reorder-functions
10693 Function reordering based on profile instrumentation collects
10694 first time of execution of a function and orders these functions
10695 in ascending order.
10696
10697 Enabled with @option{-fprofile-use}.
10698
10699 @item -fvpt
10700 @opindex fvpt
10701 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10702 to add code to gather information about values of expressions.
10703
10704 With @option{-fbranch-probabilities}, it reads back the data gathered
10705 and actually performs the optimizations based on them.
10706 Currently the optimizations include specialization of division operations
10707 using the knowledge about the value of the denominator.
10708
10709 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10710
10711 @item -frename-registers
10712 @opindex frename-registers
10713 Attempt to avoid false dependencies in scheduled code by making use
10714 of registers left over after register allocation. This optimization
10715 most benefits processors with lots of registers. Depending on the
10716 debug information format adopted by the target, however, it can
10717 make debugging impossible, since variables no longer stay in
10718 a ``home register''.
10719
10720 Enabled by default with @option{-funroll-loops}.
10721
10722 @item -fschedule-fusion
10723 @opindex fschedule-fusion
10724 Performs a target dependent pass over the instruction stream to schedule
10725 instructions of same type together because target machine can execute them
10726 more efficiently if they are adjacent to each other in the instruction flow.
10727
10728 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10729
10730 @item -ftracer
10731 @opindex ftracer
10732 Perform tail duplication to enlarge superblock size. This transformation
10733 simplifies the control flow of the function allowing other optimizations to do
10734 a better job.
10735
10736 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10737
10738 @item -funroll-loops
10739 @opindex funroll-loops
10740 Unroll loops whose number of iterations can be determined at compile time or
10741 upon entry to the loop. @option{-funroll-loops} implies
10742 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10743 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10744 a small constant number of iterations). This option makes code larger, and may
10745 or may not make it run faster.
10746
10747 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10748
10749 @item -funroll-all-loops
10750 @opindex funroll-all-loops
10751 Unroll all loops, even if their number of iterations is uncertain when
10752 the loop is entered. This usually makes programs run more slowly.
10753 @option{-funroll-all-loops} implies the same options as
10754 @option{-funroll-loops}.
10755
10756 @item -fpeel-loops
10757 @opindex fpeel-loops
10758 Peels loops for which there is enough information that they do not
10759 roll much (from profile feedback or static analysis). It also turns on
10760 complete loop peeling (i.e.@: complete removal of loops with small constant
10761 number of iterations).
10762
10763 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10764
10765 @item -fmove-loop-invariants
10766 @opindex fmove-loop-invariants
10767 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10768 at level @option{-O1} and higher, except for @option{-Og}.
10769
10770 @item -fsplit-loops
10771 @opindex fsplit-loops
10772 Split a loop into two if it contains a condition that's always true
10773 for one side of the iteration space and false for the other.
10774
10775 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10776
10777 @item -funswitch-loops
10778 @opindex funswitch-loops
10779 Move branches with loop invariant conditions out of the loop, with duplicates
10780 of the loop on both branches (modified according to result of the condition).
10781
10782 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10783
10784 @item -fversion-loops-for-strides
10785 @opindex fversion-loops-for-strides
10786 If a loop iterates over an array with a variable stride, create another
10787 version of the loop that assumes the stride is always one. For example:
10788
10789 @smallexample
10790 for (int i = 0; i < n; ++i)
10791 x[i * stride] = @dots{};
10792 @end smallexample
10793
10794 becomes:
10795
10796 @smallexample
10797 if (stride == 1)
10798 for (int i = 0; i < n; ++i)
10799 x[i] = @dots{};
10800 else
10801 for (int i = 0; i < n; ++i)
10802 x[i * stride] = @dots{};
10803 @end smallexample
10804
10805 This is particularly useful for assumed-shape arrays in Fortran where
10806 (for example) it allows better vectorization assuming contiguous accesses.
10807
10808 @item -ffunction-sections
10809 @itemx -fdata-sections
10810 @opindex ffunction-sections
10811 @opindex fdata-sections
10812 Place each function or data item into its own section in the output
10813 file if the target supports arbitrary sections. The name of the
10814 function or the name of the data item determines the section's name
10815 in the output file.
10816
10817 Use these options on systems where the linker can perform optimizations to
10818 improve locality of reference in the instruction space. Most systems using the
10819 ELF object format have linkers with such optimizations. On AIX, the linker
10820 rearranges sections (CSECTs) based on the call graph. The performance impact
10821 varies.
10822
10823 Together with a linker garbage collection (linker @option{--gc-sections}
10824 option) these options may lead to smaller statically-linked executables (after
10825 stripping).
10826
10827 On ELF/DWARF systems these options do not degenerate the quality of the debug
10828 information. There could be issues with other object files/debug info formats.
10829
10830 Only use these options when there are significant benefits from doing so. When
10831 you specify these options, the assembler and linker create larger object and
10832 executable files and are also slower. These options affect code generation.
10833 They prevent optimizations by the compiler and assembler using relative
10834 locations inside a translation unit since the locations are unknown until
10835 link time. An example of such an optimization is relaxing calls to short call
10836 instructions.
10837
10838 @item -fbranch-target-load-optimize
10839 @opindex fbranch-target-load-optimize
10840 Perform branch target register load optimization before prologue / epilogue
10841 threading.
10842 The use of target registers can typically be exposed only during reload,
10843 thus hoisting loads out of loops and doing inter-block scheduling needs
10844 a separate optimization pass.
10845
10846 @item -fbranch-target-load-optimize2
10847 @opindex fbranch-target-load-optimize2
10848 Perform branch target register load optimization after prologue / epilogue
10849 threading.
10850
10851 @item -fbtr-bb-exclusive
10852 @opindex fbtr-bb-exclusive
10853 When performing branch target register load optimization, don't reuse
10854 branch target registers within any basic block.
10855
10856 @item -fstdarg-opt
10857 @opindex fstdarg-opt
10858 Optimize the prologue of variadic argument functions with respect to usage of
10859 those arguments.
10860
10861 @item -fsection-anchors
10862 @opindex fsection-anchors
10863 Try to reduce the number of symbolic address calculations by using
10864 shared ``anchor'' symbols to address nearby objects. This transformation
10865 can help to reduce the number of GOT entries and GOT accesses on some
10866 targets.
10867
10868 For example, the implementation of the following function @code{foo}:
10869
10870 @smallexample
10871 static int a, b, c;
10872 int foo (void) @{ return a + b + c; @}
10873 @end smallexample
10874
10875 @noindent
10876 usually calculates the addresses of all three variables, but if you
10877 compile it with @option{-fsection-anchors}, it accesses the variables
10878 from a common anchor point instead. The effect is similar to the
10879 following pseudocode (which isn't valid C):
10880
10881 @smallexample
10882 int foo (void)
10883 @{
10884 register int *xr = &x;
10885 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10886 @}
10887 @end smallexample
10888
10889 Not all targets support this option.
10890
10891 @item --param @var{name}=@var{value}
10892 @opindex param
10893 In some places, GCC uses various constants to control the amount of
10894 optimization that is done. For example, GCC does not inline functions
10895 that contain more than a certain number of instructions. You can
10896 control some of these constants on the command line using the
10897 @option{--param} option.
10898
10899 The names of specific parameters, and the meaning of the values, are
10900 tied to the internals of the compiler, and are subject to change
10901 without notice in future releases.
10902
10903 In order to get minimal, maximal and default value of a parameter,
10904 one can use @option{--help=param -Q} options.
10905
10906 In each case, the @var{value} is an integer. The allowable choices for
10907 @var{name} are:
10908
10909 @table @gcctabopt
10910 @item predictable-branch-outcome
10911 When branch is predicted to be taken with probability lower than this threshold
10912 (in percent), then it is considered well predictable.
10913
10914 @item max-rtl-if-conversion-insns
10915 RTL if-conversion tries to remove conditional branches around a block and
10916 replace them with conditionally executed instructions. This parameter
10917 gives the maximum number of instructions in a block which should be
10918 considered for if-conversion. The compiler will
10919 also use other heuristics to decide whether if-conversion is likely to be
10920 profitable.
10921
10922 @item max-rtl-if-conversion-predictable-cost
10923 @itemx max-rtl-if-conversion-unpredictable-cost
10924 RTL if-conversion will try to remove conditional branches around a block
10925 and replace them with conditionally executed instructions. These parameters
10926 give the maximum permissible cost for the sequence that would be generated
10927 by if-conversion depending on whether the branch is statically determined
10928 to be predictable or not. The units for this parameter are the same as
10929 those for the GCC internal seq_cost metric. The compiler will try to
10930 provide a reasonable default for this parameter using the BRANCH_COST
10931 target macro.
10932
10933 @item max-crossjump-edges
10934 The maximum number of incoming edges to consider for cross-jumping.
10935 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10936 the number of edges incoming to each block. Increasing values mean
10937 more aggressive optimization, making the compilation time increase with
10938 probably small improvement in executable size.
10939
10940 @item min-crossjump-insns
10941 The minimum number of instructions that must be matched at the end
10942 of two blocks before cross-jumping is performed on them. This
10943 value is ignored in the case where all instructions in the block being
10944 cross-jumped from are matched.
10945
10946 @item max-grow-copy-bb-insns
10947 The maximum code size expansion factor when copying basic blocks
10948 instead of jumping. The expansion is relative to a jump instruction.
10949
10950 @item max-goto-duplication-insns
10951 The maximum number of instructions to duplicate to a block that jumps
10952 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10953 passes, GCC factors computed gotos early in the compilation process,
10954 and unfactors them as late as possible. Only computed jumps at the
10955 end of a basic blocks with no more than max-goto-duplication-insns are
10956 unfactored.
10957
10958 @item max-delay-slot-insn-search
10959 The maximum number of instructions to consider when looking for an
10960 instruction to fill a delay slot. If more than this arbitrary number of
10961 instructions are searched, the time savings from filling the delay slot
10962 are minimal, so stop searching. Increasing values mean more
10963 aggressive optimization, making the compilation time increase with probably
10964 small improvement in execution time.
10965
10966 @item max-delay-slot-live-search
10967 When trying to fill delay slots, the maximum number of instructions to
10968 consider when searching for a block with valid live register
10969 information. Increasing this arbitrarily chosen value means more
10970 aggressive optimization, increasing the compilation time. This parameter
10971 should be removed when the delay slot code is rewritten to maintain the
10972 control-flow graph.
10973
10974 @item max-gcse-memory
10975 The approximate maximum amount of memory that can be allocated in
10976 order to perform the global common subexpression elimination
10977 optimization. If more memory than specified is required, the
10978 optimization is not done.
10979
10980 @item max-gcse-insertion-ratio
10981 If the ratio of expression insertions to deletions is larger than this value
10982 for any expression, then RTL PRE inserts or removes the expression and thus
10983 leaves partially redundant computations in the instruction stream.
10984
10985 @item max-pending-list-length
10986 The maximum number of pending dependencies scheduling allows
10987 before flushing the current state and starting over. Large functions
10988 with few branches or calls can create excessively large lists which
10989 needlessly consume memory and resources.
10990
10991 @item max-modulo-backtrack-attempts
10992 The maximum number of backtrack attempts the scheduler should make
10993 when modulo scheduling a loop. Larger values can exponentially increase
10994 compilation time.
10995
10996 @item max-inline-insns-single
10997 Several parameters control the tree inliner used in GCC@.
10998 This number sets the maximum number of instructions (counted in GCC's
10999 internal representation) in a single function that the tree inliner
11000 considers for inlining. This only affects functions declared
11001 inline and methods implemented in a class declaration (C++).
11002
11003 @item max-inline-insns-auto
11004 When you use @option{-finline-functions} (included in @option{-O3}),
11005 a lot of functions that would otherwise not be considered for inlining
11006 by the compiler are investigated. To those functions, a different
11007 (more restrictive) limit compared to functions declared inline can
11008 be applied.
11009
11010 @item inline-min-speedup
11011 When estimated performance improvement of caller + callee runtime exceeds this
11012 threshold (in percent), the function can be inlined regardless of the limit on
11013 @option{--param max-inline-insns-single} and @option{--param
11014 max-inline-insns-auto}.
11015
11016 @item large-function-insns
11017 The limit specifying really large functions. For functions larger than this
11018 limit after inlining, inlining is constrained by
11019 @option{--param large-function-growth}. This parameter is useful primarily
11020 to avoid extreme compilation time caused by non-linear algorithms used by the
11021 back end.
11022
11023 @item large-function-growth
11024 Specifies maximal growth of large function caused by inlining in percents.
11025 For example, parameter value 100 limits large function growth to 2.0 times
11026 the original size.
11027
11028 @item large-unit-insns
11029 The limit specifying large translation unit. Growth caused by inlining of
11030 units larger than this limit is limited by @option{--param inline-unit-growth}.
11031 For small units this might be too tight.
11032 For example, consider a unit consisting of function A
11033 that is inline and B that just calls A three times. If B is small relative to
11034 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11035 large units consisting of small inlineable functions, however, the overall unit
11036 growth limit is needed to avoid exponential explosion of code size. Thus for
11037 smaller units, the size is increased to @option{--param large-unit-insns}
11038 before applying @option{--param inline-unit-growth}.
11039
11040 @item inline-unit-growth
11041 Specifies maximal overall growth of the compilation unit caused by inlining.
11042 For example, parameter value 20 limits unit growth to 1.2 times the original
11043 size. Cold functions (either marked cold via an attribute or by profile
11044 feedback) are not accounted into the unit size.
11045
11046 @item ipcp-unit-growth
11047 Specifies maximal overall growth of the compilation unit caused by
11048 interprocedural constant propagation. For example, parameter value 10 limits
11049 unit growth to 1.1 times the original size.
11050
11051 @item large-stack-frame
11052 The limit specifying large stack frames. While inlining the algorithm is trying
11053 to not grow past this limit too much.
11054
11055 @item large-stack-frame-growth
11056 Specifies maximal growth of large stack frames caused by inlining in percents.
11057 For example, parameter value 1000 limits large stack frame growth to 11 times
11058 the original size.
11059
11060 @item max-inline-insns-recursive
11061 @itemx max-inline-insns-recursive-auto
11062 Specifies the maximum number of instructions an out-of-line copy of a
11063 self-recursive inline
11064 function can grow into by performing recursive inlining.
11065
11066 @option{--param max-inline-insns-recursive} applies to functions
11067 declared inline.
11068 For functions not declared inline, recursive inlining
11069 happens only when @option{-finline-functions} (included in @option{-O3}) is
11070 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11071
11072 @item max-inline-recursive-depth
11073 @itemx max-inline-recursive-depth-auto
11074 Specifies the maximum recursion depth used for recursive inlining.
11075
11076 @option{--param max-inline-recursive-depth} applies to functions
11077 declared inline. For functions not declared inline, recursive inlining
11078 happens only when @option{-finline-functions} (included in @option{-O3}) is
11079 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11080
11081 @item min-inline-recursive-probability
11082 Recursive inlining is profitable only for function having deep recursion
11083 in average and can hurt for function having little recursion depth by
11084 increasing the prologue size or complexity of function body to other
11085 optimizers.
11086
11087 When profile feedback is available (see @option{-fprofile-generate}) the actual
11088 recursion depth can be guessed from the probability that function recurses
11089 via a given call expression. This parameter limits inlining only to call
11090 expressions whose probability exceeds the given threshold (in percents).
11091
11092 @item early-inlining-insns
11093 Specify growth that the early inliner can make. In effect it increases
11094 the amount of inlining for code having a large abstraction penalty.
11095
11096 @item max-early-inliner-iterations
11097 Limit of iterations of the early inliner. This basically bounds
11098 the number of nested indirect calls the early inliner can resolve.
11099 Deeper chains are still handled by late inlining.
11100
11101 @item comdat-sharing-probability
11102 Probability (in percent) that C++ inline function with comdat visibility
11103 are shared across multiple compilation units.
11104
11105 @item profile-func-internal-id
11106 A parameter to control whether to use function internal id in profile
11107 database lookup. If the value is 0, the compiler uses an id that
11108 is based on function assembler name and filename, which makes old profile
11109 data more tolerant to source changes such as function reordering etc.
11110
11111 @item min-vect-loop-bound
11112 The minimum number of iterations under which loops are not vectorized
11113 when @option{-ftree-vectorize} is used. The number of iterations after
11114 vectorization needs to be greater than the value specified by this option
11115 to allow vectorization.
11116
11117 @item gcse-cost-distance-ratio
11118 Scaling factor in calculation of maximum distance an expression
11119 can be moved by GCSE optimizations. This is currently supported only in the
11120 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11121 is with simple expressions, i.e., the expressions that have cost
11122 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11123 hoisting of simple expressions.
11124
11125 @item gcse-unrestricted-cost
11126 Cost, roughly measured as the cost of a single typical machine
11127 instruction, at which GCSE optimizations do not constrain
11128 the distance an expression can travel. This is currently
11129 supported only in the code hoisting pass. The lesser the cost,
11130 the more aggressive code hoisting is. Specifying 0
11131 allows all expressions to travel unrestricted distances.
11132
11133 @item max-hoist-depth
11134 The depth of search in the dominator tree for expressions to hoist.
11135 This is used to avoid quadratic behavior in hoisting algorithm.
11136 The value of 0 does not limit on the search, but may slow down compilation
11137 of huge functions.
11138
11139 @item max-tail-merge-comparisons
11140 The maximum amount of similar bbs to compare a bb with. This is used to
11141 avoid quadratic behavior in tree tail merging.
11142
11143 @item max-tail-merge-iterations
11144 The maximum amount of iterations of the pass over the function. This is used to
11145 limit compilation time in tree tail merging.
11146
11147 @item store-merging-allow-unaligned
11148 Allow the store merging pass to introduce unaligned stores if it is legal to
11149 do so.
11150
11151 @item max-stores-to-merge
11152 The maximum number of stores to attempt to merge into wider stores in the store
11153 merging pass.
11154
11155 @item max-unrolled-insns
11156 The maximum number of instructions that a loop may have to be unrolled.
11157 If a loop is unrolled, this parameter also determines how many times
11158 the loop code is unrolled.
11159
11160 @item max-average-unrolled-insns
11161 The maximum number of instructions biased by probabilities of their execution
11162 that a loop may have to be unrolled. If a loop is unrolled,
11163 this parameter also determines how many times the loop code is unrolled.
11164
11165 @item max-unroll-times
11166 The maximum number of unrollings of a single loop.
11167
11168 @item max-peeled-insns
11169 The maximum number of instructions that a loop may have to be peeled.
11170 If a loop is peeled, this parameter also determines how many times
11171 the loop code is peeled.
11172
11173 @item max-peel-times
11174 The maximum number of peelings of a single loop.
11175
11176 @item max-peel-branches
11177 The maximum number of branches on the hot path through the peeled sequence.
11178
11179 @item max-completely-peeled-insns
11180 The maximum number of insns of a completely peeled loop.
11181
11182 @item max-completely-peel-times
11183 The maximum number of iterations of a loop to be suitable for complete peeling.
11184
11185 @item max-completely-peel-loop-nest-depth
11186 The maximum depth of a loop nest suitable for complete peeling.
11187
11188 @item max-unswitch-insns
11189 The maximum number of insns of an unswitched loop.
11190
11191 @item max-unswitch-level
11192 The maximum number of branches unswitched in a single loop.
11193
11194 @item lim-expensive
11195 The minimum cost of an expensive expression in the loop invariant motion.
11196
11197 @item iv-consider-all-candidates-bound
11198 Bound on number of candidates for induction variables, below which
11199 all candidates are considered for each use in induction variable
11200 optimizations. If there are more candidates than this,
11201 only the most relevant ones are considered to avoid quadratic time complexity.
11202
11203 @item iv-max-considered-uses
11204 The induction variable optimizations give up on loops that contain more
11205 induction variable uses.
11206
11207 @item iv-always-prune-cand-set-bound
11208 If the number of candidates in the set is smaller than this value,
11209 always try to remove unnecessary ivs from the set
11210 when adding a new one.
11211
11212 @item avg-loop-niter
11213 Average number of iterations of a loop.
11214
11215 @item dse-max-object-size
11216 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11217 Larger values may result in larger compilation times.
11218
11219 @item dse-max-alias-queries-per-store
11220 Maximum number of queries into the alias oracle per store.
11221 Larger values result in larger compilation times and may result in more
11222 removed dead stores.
11223
11224 @item scev-max-expr-size
11225 Bound on size of expressions used in the scalar evolutions analyzer.
11226 Large expressions slow the analyzer.
11227
11228 @item scev-max-expr-complexity
11229 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11230 Complex expressions slow the analyzer.
11231
11232 @item max-tree-if-conversion-phi-args
11233 Maximum number of arguments in a PHI supported by TREE if conversion
11234 unless the loop is marked with simd pragma.
11235
11236 @item vect-max-version-for-alignment-checks
11237 The maximum number of run-time checks that can be performed when
11238 doing loop versioning for alignment in the vectorizer.
11239
11240 @item vect-max-version-for-alias-checks
11241 The maximum number of run-time checks that can be performed when
11242 doing loop versioning for alias in the vectorizer.
11243
11244 @item vect-max-peeling-for-alignment
11245 The maximum number of loop peels to enhance access alignment
11246 for vectorizer. Value -1 means no limit.
11247
11248 @item max-iterations-to-track
11249 The maximum number of iterations of a loop the brute-force algorithm
11250 for analysis of the number of iterations of the loop tries to evaluate.
11251
11252 @item hot-bb-count-ws-permille
11253 A basic block profile count is considered hot if it contributes to
11254 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11255
11256 @item hot-bb-frequency-fraction
11257 Select fraction of the entry block frequency of executions of basic block in
11258 function given basic block needs to have to be considered hot.
11259
11260 @item max-predicted-iterations
11261 The maximum number of loop iterations we predict statically. This is useful
11262 in cases where a function contains a single loop with known bound and
11263 another loop with unknown bound.
11264 The known number of iterations is predicted correctly, while
11265 the unknown number of iterations average to roughly 10. This means that the
11266 loop without bounds appears artificially cold relative to the other one.
11267
11268 @item builtin-expect-probability
11269 Control the probability of the expression having the specified value. This
11270 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11271
11272 @item builtin-string-cmp-inline-length
11273 The maximum length of a constant string for a builtin string cmp call
11274 eligible for inlining.
11275
11276 @item align-threshold
11277
11278 Select fraction of the maximal frequency of executions of a basic block in
11279 a function to align the basic block.
11280
11281 @item align-loop-iterations
11282
11283 A loop expected to iterate at least the selected number of iterations is
11284 aligned.
11285
11286 @item tracer-dynamic-coverage
11287 @itemx tracer-dynamic-coverage-feedback
11288
11289 This value is used to limit superblock formation once the given percentage of
11290 executed instructions is covered. This limits unnecessary code size
11291 expansion.
11292
11293 The @option{tracer-dynamic-coverage-feedback} parameter
11294 is used only when profile
11295 feedback is available. The real profiles (as opposed to statically estimated
11296 ones) are much less balanced allowing the threshold to be larger value.
11297
11298 @item tracer-max-code-growth
11299 Stop tail duplication once code growth has reached given percentage. This is
11300 a rather artificial limit, as most of the duplicates are eliminated later in
11301 cross jumping, so it may be set to much higher values than is the desired code
11302 growth.
11303
11304 @item tracer-min-branch-ratio
11305
11306 Stop reverse growth when the reverse probability of best edge is less than this
11307 threshold (in percent).
11308
11309 @item tracer-min-branch-probability
11310 @itemx tracer-min-branch-probability-feedback
11311
11312 Stop forward growth if the best edge has probability lower than this
11313 threshold.
11314
11315 Similarly to @option{tracer-dynamic-coverage} two parameters are
11316 provided. @option{tracer-min-branch-probability-feedback} is used for
11317 compilation with profile feedback and @option{tracer-min-branch-probability}
11318 compilation without. The value for compilation with profile feedback
11319 needs to be more conservative (higher) in order to make tracer
11320 effective.
11321
11322 @item stack-clash-protection-guard-size
11323 Specify the size of the operating system provided stack guard as
11324 2 raised to @var{num} bytes. Higher values may reduce the
11325 number of explicit probes, but a value larger than the operating system
11326 provided guard will leave code vulnerable to stack clash style attacks.
11327
11328 @item stack-clash-protection-probe-interval
11329 Stack clash protection involves probing stack space as it is allocated. This
11330 param controls the maximum distance between probes into the stack as 2 raised
11331 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11332 larger than the operating system provided guard will leave code vulnerable to
11333 stack clash style attacks.
11334
11335 @item max-cse-path-length
11336
11337 The maximum number of basic blocks on path that CSE considers.
11338
11339 @item max-cse-insns
11340 The maximum number of instructions CSE processes before flushing.
11341
11342 @item ggc-min-expand
11343
11344 GCC uses a garbage collector to manage its own memory allocation. This
11345 parameter specifies the minimum percentage by which the garbage
11346 collector's heap should be allowed to expand between collections.
11347 Tuning this may improve compilation speed; it has no effect on code
11348 generation.
11349
11350 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11351 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11352 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11353 GCC is not able to calculate RAM on a particular platform, the lower
11354 bound of 30% is used. Setting this parameter and
11355 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11356 every opportunity. This is extremely slow, but can be useful for
11357 debugging.
11358
11359 @item ggc-min-heapsize
11360
11361 Minimum size of the garbage collector's heap before it begins bothering
11362 to collect garbage. The first collection occurs after the heap expands
11363 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11364 tuning this may improve compilation speed, and has no effect on code
11365 generation.
11366
11367 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11368 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11369 with a lower bound of 4096 (four megabytes) and an upper bound of
11370 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11371 particular platform, the lower bound is used. Setting this parameter
11372 very large effectively disables garbage collection. Setting this
11373 parameter and @option{ggc-min-expand} to zero causes a full collection
11374 to occur at every opportunity.
11375
11376 @item max-reload-search-insns
11377 The maximum number of instruction reload should look backward for equivalent
11378 register. Increasing values mean more aggressive optimization, making the
11379 compilation time increase with probably slightly better performance.
11380
11381 @item max-cselib-memory-locations
11382 The maximum number of memory locations cselib should take into account.
11383 Increasing values mean more aggressive optimization, making the compilation time
11384 increase with probably slightly better performance.
11385
11386 @item max-sched-ready-insns
11387 The maximum number of instructions ready to be issued the scheduler should
11388 consider at any given time during the first scheduling pass. Increasing
11389 values mean more thorough searches, making the compilation time increase
11390 with probably little benefit.
11391
11392 @item max-sched-region-blocks
11393 The maximum number of blocks in a region to be considered for
11394 interblock scheduling.
11395
11396 @item max-pipeline-region-blocks
11397 The maximum number of blocks in a region to be considered for
11398 pipelining in the selective scheduler.
11399
11400 @item max-sched-region-insns
11401 The maximum number of insns in a region to be considered for
11402 interblock scheduling.
11403
11404 @item max-pipeline-region-insns
11405 The maximum number of insns in a region to be considered for
11406 pipelining in the selective scheduler.
11407
11408 @item min-spec-prob
11409 The minimum probability (in percents) of reaching a source block
11410 for interblock speculative scheduling.
11411
11412 @item max-sched-extend-regions-iters
11413 The maximum number of iterations through CFG to extend regions.
11414 A value of 0 disables region extensions.
11415
11416 @item max-sched-insn-conflict-delay
11417 The maximum conflict delay for an insn to be considered for speculative motion.
11418
11419 @item sched-spec-prob-cutoff
11420 The minimal probability of speculation success (in percents), so that
11421 speculative insns are scheduled.
11422
11423 @item sched-state-edge-prob-cutoff
11424 The minimum probability an edge must have for the scheduler to save its
11425 state across it.
11426
11427 @item sched-mem-true-dep-cost
11428 Minimal distance (in CPU cycles) between store and load targeting same
11429 memory locations.
11430
11431 @item selsched-max-lookahead
11432 The maximum size of the lookahead window of selective scheduling. It is a
11433 depth of search for available instructions.
11434
11435 @item selsched-max-sched-times
11436 The maximum number of times that an instruction is scheduled during
11437 selective scheduling. This is the limit on the number of iterations
11438 through which the instruction may be pipelined.
11439
11440 @item selsched-insns-to-rename
11441 The maximum number of best instructions in the ready list that are considered
11442 for renaming in the selective scheduler.
11443
11444 @item sms-min-sc
11445 The minimum value of stage count that swing modulo scheduler
11446 generates.
11447
11448 @item max-last-value-rtl
11449 The maximum size measured as number of RTLs that can be recorded in an expression
11450 in combiner for a pseudo register as last known value of that register.
11451
11452 @item max-combine-insns
11453 The maximum number of instructions the RTL combiner tries to combine.
11454
11455 @item integer-share-limit
11456 Small integer constants can use a shared data structure, reducing the
11457 compiler's memory usage and increasing its speed. This sets the maximum
11458 value of a shared integer constant.
11459
11460 @item ssp-buffer-size
11461 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11462 protection when @option{-fstack-protection} is used.
11463
11464 @item min-size-for-stack-sharing
11465 The minimum size of variables taking part in stack slot sharing when not
11466 optimizing.
11467
11468 @item max-jump-thread-duplication-stmts
11469 Maximum number of statements allowed in a block that needs to be
11470 duplicated when threading jumps.
11471
11472 @item max-fields-for-field-sensitive
11473 Maximum number of fields in a structure treated in
11474 a field sensitive manner during pointer analysis.
11475
11476 @item prefetch-latency
11477 Estimate on average number of instructions that are executed before
11478 prefetch finishes. The distance prefetched ahead is proportional
11479 to this constant. Increasing this number may also lead to less
11480 streams being prefetched (see @option{simultaneous-prefetches}).
11481
11482 @item simultaneous-prefetches
11483 Maximum number of prefetches that can run at the same time.
11484
11485 @item l1-cache-line-size
11486 The size of cache line in L1 data cache, in bytes.
11487
11488 @item l1-cache-size
11489 The size of L1 data cache, in kilobytes.
11490
11491 @item l2-cache-size
11492 The size of L2 data cache, in kilobytes.
11493
11494 @item prefetch-dynamic-strides
11495 Whether the loop array prefetch pass should issue software prefetch hints
11496 for strides that are non-constant. In some cases this may be
11497 beneficial, though the fact the stride is non-constant may make it
11498 hard to predict when there is clear benefit to issuing these hints.
11499
11500 Set to 1 if the prefetch hints should be issued for non-constant
11501 strides. Set to 0 if prefetch hints should be issued only for strides that
11502 are known to be constant and below @option{prefetch-minimum-stride}.
11503
11504 @item prefetch-minimum-stride
11505 Minimum constant stride, in bytes, to start using prefetch hints for. If
11506 the stride is less than this threshold, prefetch hints will not be issued.
11507
11508 This setting is useful for processors that have hardware prefetchers, in
11509 which case there may be conflicts between the hardware prefetchers and
11510 the software prefetchers. If the hardware prefetchers have a maximum
11511 stride they can handle, it should be used here to improve the use of
11512 software prefetchers.
11513
11514 A value of -1 means we don't have a threshold and therefore
11515 prefetch hints can be issued for any constant stride.
11516
11517 This setting is only useful for strides that are known and constant.
11518
11519 @item loop-interchange-max-num-stmts
11520 The maximum number of stmts in a loop to be interchanged.
11521
11522 @item loop-interchange-stride-ratio
11523 The minimum ratio between stride of two loops for interchange to be profitable.
11524
11525 @item min-insn-to-prefetch-ratio
11526 The minimum ratio between the number of instructions and the
11527 number of prefetches to enable prefetching in a loop.
11528
11529 @item prefetch-min-insn-to-mem-ratio
11530 The minimum ratio between the number of instructions and the
11531 number of memory references to enable prefetching in a loop.
11532
11533 @item use-canonical-types
11534 Whether the compiler should use the ``canonical'' type system.
11535 Should always be 1, which uses a more efficient internal
11536 mechanism for comparing types in C++ and Objective-C++. However, if
11537 bugs in the canonical type system are causing compilation failures,
11538 set this value to 0 to disable canonical types.
11539
11540 @item switch-conversion-max-branch-ratio
11541 Switch initialization conversion refuses to create arrays that are
11542 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11543 branches in the switch.
11544
11545 @item max-partial-antic-length
11546 Maximum length of the partial antic set computed during the tree
11547 partial redundancy elimination optimization (@option{-ftree-pre}) when
11548 optimizing at @option{-O3} and above. For some sorts of source code
11549 the enhanced partial redundancy elimination optimization can run away,
11550 consuming all of the memory available on the host machine. This
11551 parameter sets a limit on the length of the sets that are computed,
11552 which prevents the runaway behavior. Setting a value of 0 for
11553 this parameter allows an unlimited set length.
11554
11555 @item rpo-vn-max-loop-depth
11556 Maximum loop depth that is value-numbered optimistically.
11557 When the limit hits the innermost
11558 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11559 loop nest are value-numbered optimistically and the remaining ones not.
11560
11561 @item sccvn-max-alias-queries-per-access
11562 Maximum number of alias-oracle queries we perform when looking for
11563 redundancies for loads and stores. If this limit is hit the search
11564 is aborted and the load or store is not considered redundant. The
11565 number of queries is algorithmically limited to the number of
11566 stores on all paths from the load to the function entry.
11567
11568 @item ira-max-loops-num
11569 IRA uses regional register allocation by default. If a function
11570 contains more loops than the number given by this parameter, only at most
11571 the given number of the most frequently-executed loops form regions
11572 for regional register allocation.
11573
11574 @item ira-max-conflict-table-size
11575 Although IRA uses a sophisticated algorithm to compress the conflict
11576 table, the table can still require excessive amounts of memory for
11577 huge functions. If the conflict table for a function could be more
11578 than the size in MB given by this parameter, the register allocator
11579 instead uses a faster, simpler, and lower-quality
11580 algorithm that does not require building a pseudo-register conflict table.
11581
11582 @item ira-loop-reserved-regs
11583 IRA can be used to evaluate more accurate register pressure in loops
11584 for decisions to move loop invariants (see @option{-O3}). The number
11585 of available registers reserved for some other purposes is given
11586 by this parameter. Default of the parameter
11587 is the best found from numerous experiments.
11588
11589 @item lra-inheritance-ebb-probability-cutoff
11590 LRA tries to reuse values reloaded in registers in subsequent insns.
11591 This optimization is called inheritance. EBB is used as a region to
11592 do this optimization. The parameter defines a minimal fall-through
11593 edge probability in percentage used to add BB to inheritance EBB in
11594 LRA. The default value was chosen
11595 from numerous runs of SPEC2000 on x86-64.
11596
11597 @item loop-invariant-max-bbs-in-loop
11598 Loop invariant motion can be very expensive, both in compilation time and
11599 in amount of needed compile-time memory, with very large loops. Loops
11600 with more basic blocks than this parameter won't have loop invariant
11601 motion optimization performed on them.
11602
11603 @item loop-max-datarefs-for-datadeps
11604 Building data dependencies is expensive for very large loops. This
11605 parameter limits the number of data references in loops that are
11606 considered for data dependence analysis. These large loops are no
11607 handled by the optimizations using loop data dependencies.
11608
11609 @item max-vartrack-size
11610 Sets a maximum number of hash table slots to use during variable
11611 tracking dataflow analysis of any function. If this limit is exceeded
11612 with variable tracking at assignments enabled, analysis for that
11613 function is retried without it, after removing all debug insns from
11614 the function. If the limit is exceeded even without debug insns, var
11615 tracking analysis is completely disabled for the function. Setting
11616 the parameter to zero makes it unlimited.
11617
11618 @item max-vartrack-expr-depth
11619 Sets a maximum number of recursion levels when attempting to map
11620 variable names or debug temporaries to value expressions. This trades
11621 compilation time for more complete debug information. If this is set too
11622 low, value expressions that are available and could be represented in
11623 debug information may end up not being used; setting this higher may
11624 enable the compiler to find more complex debug expressions, but compile
11625 time and memory use may grow.
11626
11627 @item max-debug-marker-count
11628 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11629 markers) to avoid complexity explosion at inlining or expanding to RTL.
11630 If a function has more such gimple stmts than the set limit, such stmts
11631 will be dropped from the inlined copy of a function, and from its RTL
11632 expansion.
11633
11634 @item min-nondebug-insn-uid
11635 Use uids starting at this parameter for nondebug insns. The range below
11636 the parameter is reserved exclusively for debug insns created by
11637 @option{-fvar-tracking-assignments}, but debug insns may get
11638 (non-overlapping) uids above it if the reserved range is exhausted.
11639
11640 @item ipa-sra-ptr-growth-factor
11641 IPA-SRA replaces a pointer to an aggregate with one or more new
11642 parameters only when their cumulative size is less or equal to
11643 @option{ipa-sra-ptr-growth-factor} times the size of the original
11644 pointer parameter.
11645
11646 @item sra-max-scalarization-size-Ospeed
11647 @itemx sra-max-scalarization-size-Osize
11648 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11649 replace scalar parts of aggregates with uses of independent scalar
11650 variables. These parameters control the maximum size, in storage units,
11651 of aggregate which is considered for replacement when compiling for
11652 speed
11653 (@option{sra-max-scalarization-size-Ospeed}) or size
11654 (@option{sra-max-scalarization-size-Osize}) respectively.
11655
11656 @item tm-max-aggregate-size
11657 When making copies of thread-local variables in a transaction, this
11658 parameter specifies the size in bytes after which variables are
11659 saved with the logging functions as opposed to save/restore code
11660 sequence pairs. This option only applies when using
11661 @option{-fgnu-tm}.
11662
11663 @item graphite-max-nb-scop-params
11664 To avoid exponential effects in the Graphite loop transforms, the
11665 number of parameters in a Static Control Part (SCoP) is bounded.
11666 A value of zero can be used to lift
11667 the bound. A variable whose value is unknown at compilation time and
11668 defined outside a SCoP is a parameter of the SCoP.
11669
11670 @item loop-block-tile-size
11671 Loop blocking or strip mining transforms, enabled with
11672 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11673 loop in the loop nest by a given number of iterations. The strip
11674 length can be changed using the @option{loop-block-tile-size}
11675 parameter.
11676
11677 @item ipa-cp-value-list-size
11678 IPA-CP attempts to track all possible values and types passed to a function's
11679 parameter in order to propagate them and perform devirtualization.
11680 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11681 stores per one formal parameter of a function.
11682
11683 @item ipa-cp-eval-threshold
11684 IPA-CP calculates its own score of cloning profitability heuristics
11685 and performs those cloning opportunities with scores that exceed
11686 @option{ipa-cp-eval-threshold}.
11687
11688 @item ipa-cp-recursion-penalty
11689 Percentage penalty the recursive functions will receive when they
11690 are evaluated for cloning.
11691
11692 @item ipa-cp-single-call-penalty
11693 Percentage penalty functions containing a single call to another
11694 function will receive when they are evaluated for cloning.
11695
11696 @item ipa-max-agg-items
11697 IPA-CP is also capable to propagate a number of scalar values passed
11698 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11699 number of such values per one parameter.
11700
11701 @item ipa-cp-loop-hint-bonus
11702 When IPA-CP determines that a cloning candidate would make the number
11703 of iterations of a loop known, it adds a bonus of
11704 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11705 the candidate.
11706
11707 @item ipa-cp-array-index-hint-bonus
11708 When IPA-CP determines that a cloning candidate would make the index of
11709 an array access known, it adds a bonus of
11710 @option{ipa-cp-array-index-hint-bonus} to the profitability
11711 score of the candidate.
11712
11713 @item ipa-max-aa-steps
11714 During its analysis of function bodies, IPA-CP employs alias analysis
11715 in order to track values pointed to by function parameters. In order
11716 not spend too much time analyzing huge functions, it gives up and
11717 consider all memory clobbered after examining
11718 @option{ipa-max-aa-steps} statements modifying memory.
11719
11720 @item lto-partitions
11721 Specify desired number of partitions produced during WHOPR compilation.
11722 The number of partitions should exceed the number of CPUs used for compilation.
11723
11724 @item lto-min-partition
11725 Size of minimal partition for WHOPR (in estimated instructions).
11726 This prevents expenses of splitting very small programs into too many
11727 partitions.
11728
11729 @item lto-max-partition
11730 Size of max partition for WHOPR (in estimated instructions).
11731 to provide an upper bound for individual size of partition.
11732 Meant to be used only with balanced partitioning.
11733
11734 @item cxx-max-namespaces-for-diagnostic-help
11735 The maximum number of namespaces to consult for suggestions when C++
11736 name lookup fails for an identifier.
11737
11738 @item sink-frequency-threshold
11739 The maximum relative execution frequency (in percents) of the target block
11740 relative to a statement's original block to allow statement sinking of a
11741 statement. Larger numbers result in more aggressive statement sinking.
11742 A small positive adjustment is applied for
11743 statements with memory operands as those are even more profitable so sink.
11744
11745 @item max-stores-to-sink
11746 The maximum number of conditional store pairs that can be sunk. Set to 0
11747 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11748 (@option{-ftree-loop-if-convert}) is disabled.
11749
11750 @item allow-store-data-races
11751 Allow optimizers to introduce new data races on stores.
11752 Set to 1 to allow, otherwise to 0.
11753
11754 @item case-values-threshold
11755 The smallest number of different values for which it is best to use a
11756 jump-table instead of a tree of conditional branches. If the value is
11757 0, use the default for the machine.
11758
11759 @item tree-reassoc-width
11760 Set the maximum number of instructions executed in parallel in
11761 reassociated tree. This parameter overrides target dependent
11762 heuristics used by default if has non zero value.
11763
11764 @item sched-pressure-algorithm
11765 Choose between the two available implementations of
11766 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11767 and is the more likely to prevent instructions from being reordered.
11768 Algorithm 2 was designed to be a compromise between the relatively
11769 conservative approach taken by algorithm 1 and the rather aggressive
11770 approach taken by the default scheduler. It relies more heavily on
11771 having a regular register file and accurate register pressure classes.
11772 See @file{haifa-sched.c} in the GCC sources for more details.
11773
11774 The default choice depends on the target.
11775
11776 @item max-slsr-cand-scan
11777 Set the maximum number of existing candidates that are considered when
11778 seeking a basis for a new straight-line strength reduction candidate.
11779
11780 @item asan-globals
11781 Enable buffer overflow detection for global objects. This kind
11782 of protection is enabled by default if you are using
11783 @option{-fsanitize=address} option.
11784 To disable global objects protection use @option{--param asan-globals=0}.
11785
11786 @item asan-stack
11787 Enable buffer overflow detection for stack objects. This kind of
11788 protection is enabled by default when using @option{-fsanitize=address}.
11789 To disable stack protection use @option{--param asan-stack=0} option.
11790
11791 @item asan-instrument-reads
11792 Enable buffer overflow detection for memory reads. This kind of
11793 protection is enabled by default when using @option{-fsanitize=address}.
11794 To disable memory reads protection use
11795 @option{--param asan-instrument-reads=0}.
11796
11797 @item asan-instrument-writes
11798 Enable buffer overflow detection for memory writes. This kind of
11799 protection is enabled by default when using @option{-fsanitize=address}.
11800 To disable memory writes protection use
11801 @option{--param asan-instrument-writes=0} option.
11802
11803 @item asan-memintrin
11804 Enable detection for built-in functions. This kind of protection
11805 is enabled by default when using @option{-fsanitize=address}.
11806 To disable built-in functions protection use
11807 @option{--param asan-memintrin=0}.
11808
11809 @item asan-use-after-return
11810 Enable detection of use-after-return. This kind of protection
11811 is enabled by default when using the @option{-fsanitize=address} option.
11812 To disable it use @option{--param asan-use-after-return=0}.
11813
11814 Note: By default the check is disabled at run time. To enable it,
11815 add @code{detect_stack_use_after_return=1} to the environment variable
11816 @env{ASAN_OPTIONS}.
11817
11818 @item asan-instrumentation-with-call-threshold
11819 If number of memory accesses in function being instrumented
11820 is greater or equal to this number, use callbacks instead of inline checks.
11821 E.g. to disable inline code use
11822 @option{--param asan-instrumentation-with-call-threshold=0}.
11823
11824 @item use-after-scope-direct-emission-threshold
11825 If the size of a local variable in bytes is smaller or equal to this
11826 number, directly poison (or unpoison) shadow memory instead of using
11827 run-time callbacks.
11828
11829 @item max-fsm-thread-path-insns
11830 Maximum number of instructions to copy when duplicating blocks on a
11831 finite state automaton jump thread path.
11832
11833 @item max-fsm-thread-length
11834 Maximum number of basic blocks on a finite state automaton jump thread
11835 path.
11836
11837 @item max-fsm-thread-paths
11838 Maximum number of new jump thread paths to create for a finite state
11839 automaton.
11840
11841 @item parloops-chunk-size
11842 Chunk size of omp schedule for loops parallelized by parloops.
11843
11844 @item parloops-schedule
11845 Schedule type of omp schedule for loops parallelized by parloops (static,
11846 dynamic, guided, auto, runtime).
11847
11848 @item parloops-min-per-thread
11849 The minimum number of iterations per thread of an innermost parallelized
11850 loop for which the parallelized variant is preferred over the single threaded
11851 one. Note that for a parallelized loop nest the
11852 minimum number of iterations of the outermost loop per thread is two.
11853
11854 @item max-ssa-name-query-depth
11855 Maximum depth of recursion when querying properties of SSA names in things
11856 like fold routines. One level of recursion corresponds to following a
11857 use-def chain.
11858
11859 @item hsa-gen-debug-stores
11860 Enable emission of special debug stores within HSA kernels which are
11861 then read and reported by libgomp plugin. Generation of these stores
11862 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11863 enable it.
11864
11865 @item max-speculative-devirt-maydefs
11866 The maximum number of may-defs we analyze when looking for a must-def
11867 specifying the dynamic type of an object that invokes a virtual call
11868 we may be able to devirtualize speculatively.
11869
11870 @item max-vrp-switch-assertions
11871 The maximum number of assertions to add along the default edge of a switch
11872 statement during VRP.
11873
11874 @item unroll-jam-min-percent
11875 The minimum percentage of memory references that must be optimized
11876 away for the unroll-and-jam transformation to be considered profitable.
11877
11878 @item unroll-jam-max-unroll
11879 The maximum number of times the outer loop should be unrolled by
11880 the unroll-and-jam transformation.
11881
11882 @item max-rtl-if-conversion-unpredictable-cost
11883 Maximum permissible cost for the sequence that would be generated
11884 by the RTL if-conversion pass for a branch that is considered unpredictable.
11885
11886 @item max-variable-expansions-in-unroller
11887 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11888 of times that an individual variable will be expanded during loop unrolling.
11889
11890 @item tracer-min-branch-probability-feedback
11891 Stop forward growth if the probability of best edge is less than
11892 this threshold (in percent). Used when profile feedback is available.
11893
11894 @item partial-inlining-entry-probability
11895 Maximum probability of the entry BB of split region
11896 (in percent relative to entry BB of the function)
11897 to make partial inlining happen.
11898
11899 @item max-tracked-strlens
11900 Maximum number of strings for which strlen optimization pass will
11901 track string lengths.
11902
11903 @item gcse-after-reload-partial-fraction
11904 The threshold ratio for performing partial redundancy
11905 elimination after reload.
11906
11907 @item gcse-after-reload-critical-fraction
11908 The threshold ratio of critical edges execution count that
11909 permit performing redundancy elimination after reload.
11910
11911 @item max-loop-header-insns
11912 The maximum number of insns in loop header duplicated
11913 by the copy loop headers pass.
11914
11915 @item vect-epilogues-nomask
11916 Enable loop epilogue vectorization using smaller vector size.
11917
11918 @item slp-max-insns-in-bb
11919 Maximum number of instructions in basic block to be
11920 considered for SLP vectorization.
11921
11922 @item avoid-fma-max-bits
11923 Maximum number of bits for which we avoid creating FMAs.
11924
11925 @item sms-loop-average-count-threshold
11926 A threshold on the average loop count considered by the swing modulo scheduler.
11927
11928 @item sms-dfa-history
11929 The number of cycles the swing modulo scheduler considers when checking
11930 conflicts using DFA.
11931
11932 @item hot-bb-count-fraction
11933 Select fraction of the maximal count of repetitions of basic block
11934 in program given basic block needs
11935 to have to be considered hot (used in non-LTO mode)
11936
11937 @item max-inline-insns-recursive-auto
11938 The maximum number of instructions non-inline function
11939 can grow to via recursive inlining.
11940
11941 @item graphite-allow-codegen-errors
11942 Whether codegen errors should be ICEs when @option{-fchecking}.
11943
11944 @item sms-max-ii-factor
11945 A factor for tuning the upper bound that swing modulo scheduler
11946 uses for scheduling a loop.
11947
11948 @item lra-max-considered-reload-pseudos
11949 The max number of reload pseudos which are considered during
11950 spilling a non-reload pseudo.
11951
11952 @item max-pow-sqrt-depth
11953 Maximum depth of sqrt chains to use when synthesizing exponentiation
11954 by a real constant.
11955
11956 @item max-dse-active-local-stores
11957 Maximum number of active local stores in RTL dead store elimination.
11958
11959 @item asan-instrument-allocas
11960 Enable asan allocas/VLAs protection.
11961
11962 @item max-iterations-computation-cost
11963 Bound on the cost of an expression to compute the number of iterations.
11964
11965 @item max-isl-operations
11966 Maximum number of isl operations, 0 means unlimited.
11967
11968 @item graphite-max-arrays-per-scop
11969 Maximum number of arrays per scop.
11970
11971 @item max-vartrack-reverse-op-size
11972 Max. size of loc list for which reverse ops should be added.
11973
11974 @item unlikely-bb-count-fraction
11975 The minimum fraction of profile runs a given basic block execution count
11976 must be not to be considered unlikely.
11977
11978 @item tracer-dynamic-coverage-feedback
11979 The percentage of function, weighted by execution frequency,
11980 that must be covered by trace formation.
11981 Used when profile feedback is available.
11982
11983 @item max-inline-recursive-depth-auto
11984 The maximum depth of recursive inlining for non-inline functions.
11985
11986 @item fsm-scale-path-stmts
11987 Scale factor to apply to the number of statements in a threading path
11988 when comparing to the number of (scaled) blocks.
11989
11990 @item fsm-maximum-phi-arguments
11991 Maximum number of arguments a PHI may have before the FSM threader
11992 will not try to thread through its block.
11993
11994 @item uninit-control-dep-attempts
11995 Maximum number of nested calls to search for control dependencies
11996 during uninitialized variable analysis.
11997
11998 @item indir-call-topn-profile
11999 Track top N target addresses in indirect-call profile.
12000
12001 @item max-once-peeled-insns
12002 The maximum number of insns of a peeled loop that rolls only once.
12003
12004 @item sra-max-scalarization-size-Osize
12005 Maximum size, in storage units, of an aggregate
12006 which should be considered for scalarization when compiling for size.
12007
12008 @item fsm-scale-path-blocks
12009 Scale factor to apply to the number of blocks in a threading path
12010 when comparing to the number of (scaled) statements.
12011
12012 @item sched-autopref-queue-depth
12013 Hardware autoprefetcher scheduler model control flag.
12014 Number of lookahead cycles the model looks into; at '
12015 ' only enable instruction sorting heuristic.
12016
12017 @item loop-versioning-max-inner-insns
12018 The maximum number of instructions that an inner loop can have
12019 before the loop versioning pass considers it too big to copy.
12020
12021 @item loop-versioning-max-outer-insns
12022 The maximum number of instructions that an outer loop can have
12023 before the loop versioning pass considers it too big to copy,
12024 discounting any instructions in inner loops that directly benefit
12025 from versioning.
12026
12027 @end table
12028 @end table
12029
12030 @node Instrumentation Options
12031 @section Program Instrumentation Options
12032 @cindex instrumentation options
12033 @cindex program instrumentation options
12034 @cindex run-time error checking options
12035 @cindex profiling options
12036 @cindex options, program instrumentation
12037 @cindex options, run-time error checking
12038 @cindex options, profiling
12039
12040 GCC supports a number of command-line options that control adding
12041 run-time instrumentation to the code it normally generates.
12042 For example, one purpose of instrumentation is collect profiling
12043 statistics for use in finding program hot spots, code coverage
12044 analysis, or profile-guided optimizations.
12045 Another class of program instrumentation is adding run-time checking
12046 to detect programming errors like invalid pointer
12047 dereferences or out-of-bounds array accesses, as well as deliberately
12048 hostile attacks such as stack smashing or C++ vtable hijacking.
12049 There is also a general hook which can be used to implement other
12050 forms of tracing or function-level instrumentation for debug or
12051 program analysis purposes.
12052
12053 @table @gcctabopt
12054 @cindex @command{prof}
12055 @cindex @command{gprof}
12056 @item -p
12057 @itemx -pg
12058 @opindex p
12059 @opindex pg
12060 Generate extra code to write profile information suitable for the
12061 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12062 (for @option{-pg}). You must use this option when compiling
12063 the source files you want data about, and you must also use it when
12064 linking.
12065
12066 You can use the function attribute @code{no_instrument_function} to
12067 suppress profiling of individual functions when compiling with these options.
12068 @xref{Common Function Attributes}.
12069
12070 @item -fprofile-arcs
12071 @opindex fprofile-arcs
12072 Add code so that program flow @dfn{arcs} are instrumented. During
12073 execution the program records how many times each branch and call is
12074 executed and how many times it is taken or returns. On targets that support
12075 constructors with priority support, profiling properly handles constructors,
12076 destructors and C++ constructors (and destructors) of classes which are used
12077 as a type of a global variable.
12078
12079 When the compiled
12080 program exits it saves this data to a file called
12081 @file{@var{auxname}.gcda} for each source file. The data may be used for
12082 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12083 test coverage analysis (@option{-ftest-coverage}). Each object file's
12084 @var{auxname} is generated from the name of the output file, if
12085 explicitly specified and it is not the final executable, otherwise it is
12086 the basename of the source file. In both cases any suffix is removed
12087 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12088 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12089 @xref{Cross-profiling}.
12090
12091 @cindex @command{gcov}
12092 @item --coverage
12093 @opindex coverage
12094
12095 This option is used to compile and link code instrumented for coverage
12096 analysis. The option is a synonym for @option{-fprofile-arcs}
12097 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12098 linking). See the documentation for those options for more details.
12099
12100 @itemize
12101
12102 @item
12103 Compile the source files with @option{-fprofile-arcs} plus optimization
12104 and code generation options. For test coverage analysis, use the
12105 additional @option{-ftest-coverage} option. You do not need to profile
12106 every source file in a program.
12107
12108 @item
12109 Compile the source files additionally with @option{-fprofile-abs-path}
12110 to create absolute path names in the @file{.gcno} files. This allows
12111 @command{gcov} to find the correct sources in projects where compilations
12112 occur with different working directories.
12113
12114 @item
12115 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12116 (the latter implies the former).
12117
12118 @item
12119 Run the program on a representative workload to generate the arc profile
12120 information. This may be repeated any number of times. You can run
12121 concurrent instances of your program, and provided that the file system
12122 supports locking, the data files will be correctly updated. Unless
12123 a strict ISO C dialect option is in effect, @code{fork} calls are
12124 detected and correctly handled without double counting.
12125
12126 @item
12127 For profile-directed optimizations, compile the source files again with
12128 the same optimization and code generation options plus
12129 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12130 Control Optimization}).
12131
12132 @item
12133 For test coverage analysis, use @command{gcov} to produce human readable
12134 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12135 @command{gcov} documentation for further information.
12136
12137 @end itemize
12138
12139 With @option{-fprofile-arcs}, for each function of your program GCC
12140 creates a program flow graph, then finds a spanning tree for the graph.
12141 Only arcs that are not on the spanning tree have to be instrumented: the
12142 compiler adds code to count the number of times that these arcs are
12143 executed. When an arc is the only exit or only entrance to a block, the
12144 instrumentation code can be added to the block; otherwise, a new basic
12145 block must be created to hold the instrumentation code.
12146
12147 @need 2000
12148 @item -ftest-coverage
12149 @opindex ftest-coverage
12150 Produce a notes file that the @command{gcov} code-coverage utility
12151 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12152 show program coverage. Each source file's note file is called
12153 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12154 above for a description of @var{auxname} and instructions on how to
12155 generate test coverage data. Coverage data matches the source files
12156 more closely if you do not optimize.
12157
12158 @item -fprofile-abs-path
12159 @opindex fprofile-abs-path
12160 Automatically convert relative source file names to absolute path names
12161 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12162 sources in projects where compilations occur with different working
12163 directories.
12164
12165 @item -fprofile-dir=@var{path}
12166 @opindex fprofile-dir
12167
12168 Set the directory to search for the profile data files in to @var{path}.
12169 This option affects only the profile data generated by
12170 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12171 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12172 and its related options. Both absolute and relative paths can be used.
12173 By default, GCC uses the current directory as @var{path}, thus the
12174 profile data file appears in the same directory as the object file.
12175 In order to prevent the file name clashing, if the object file name is
12176 not an absolute path, we mangle the absolute path of the
12177 @file{@var{sourcename}.gcda} file and use it as the file name of a
12178 @file{.gcda} file.
12179
12180 When an executable is run in a massive parallel environment, it is recommended
12181 to save profile to different folders. That can be done with variables
12182 in @var{path} that are exported during run-time:
12183
12184 @table @gcctabopt
12185
12186 @item %p
12187 process ID.
12188
12189 @item %q@{VAR@}
12190 value of environment variable @var{VAR}
12191
12192 @end table
12193
12194 @item -fprofile-generate
12195 @itemx -fprofile-generate=@var{path}
12196 @opindex fprofile-generate
12197
12198 Enable options usually used for instrumenting application to produce
12199 profile useful for later recompilation with profile feedback based
12200 optimization. You must use @option{-fprofile-generate} both when
12201 compiling and when linking your program.
12202
12203 The following options are enabled:
12204 @option{-fprofile-arcs}, @option{-fprofile-values},
12205 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12206
12207 If @var{path} is specified, GCC looks at the @var{path} to find
12208 the profile feedback data files. See @option{-fprofile-dir}.
12209
12210 To optimize the program based on the collected profile information, use
12211 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12212
12213 @item -fprofile-update=@var{method}
12214 @opindex fprofile-update
12215
12216 Alter the update method for an application instrumented for profile
12217 feedback based optimization. The @var{method} argument should be one of
12218 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12219 The first one is useful for single-threaded applications,
12220 while the second one prevents profile corruption by emitting thread-safe code.
12221
12222 @strong{Warning:} When an application does not properly join all threads
12223 (or creates an detached thread), a profile file can be still corrupted.
12224
12225 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12226 when supported by a target, or to @samp{single} otherwise. The GCC driver
12227 automatically selects @samp{prefer-atomic} when @option{-pthread}
12228 is present in the command line.
12229
12230 @item -fprofile-filter-files=@var{regex}
12231 @opindex fprofile-filter-files
12232
12233 Instrument only functions from files where names match
12234 any regular expression (separated by a semi-colon).
12235
12236 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12237 only @file{main.c} and all C files starting with 'module'.
12238
12239 @item -fprofile-exclude-files=@var{regex}
12240 @opindex fprofile-exclude-files
12241
12242 Instrument only functions from files where names do not match
12243 all the regular expressions (separated by a semi-colon).
12244
12245 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12246 of all files that are located in @file{/usr/} folder.
12247
12248 @item -fsanitize=address
12249 @opindex fsanitize=address
12250 Enable AddressSanitizer, a fast memory error detector.
12251 Memory access instructions are instrumented to detect
12252 out-of-bounds and use-after-free bugs.
12253 The option enables @option{-fsanitize-address-use-after-scope}.
12254 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12255 more details. The run-time behavior can be influenced using the
12256 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12257 the available options are shown at startup of the instrumented program. See
12258 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12259 for a list of supported options.
12260 The option cannot be combined with @option{-fsanitize=thread}.
12261
12262 @item -fsanitize=kernel-address
12263 @opindex fsanitize=kernel-address
12264 Enable AddressSanitizer for Linux kernel.
12265 See @uref{https://github.com/google/kasan/wiki} for more details.
12266
12267 @item -fsanitize=pointer-compare
12268 @opindex fsanitize=pointer-compare
12269 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12270 The option must be combined with either @option{-fsanitize=kernel-address} or
12271 @option{-fsanitize=address}
12272 The option cannot be combined with @option{-fsanitize=thread}.
12273 Note: By default the check is disabled at run time. To enable it,
12274 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12275 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12276 invalid operation only when both pointers are non-null.
12277
12278 @item -fsanitize=pointer-subtract
12279 @opindex fsanitize=pointer-subtract
12280 Instrument subtraction with pointer operands.
12281 The option must be combined with either @option{-fsanitize=kernel-address} or
12282 @option{-fsanitize=address}
12283 The option cannot be combined with @option{-fsanitize=thread}.
12284 Note: By default the check is disabled at run time. To enable it,
12285 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12286 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12287 invalid operation only when both pointers are non-null.
12288
12289 @item -fsanitize=thread
12290 @opindex fsanitize=thread
12291 Enable ThreadSanitizer, a fast data race detector.
12292 Memory access instructions are instrumented to detect
12293 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12294 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12295 environment variable; see
12296 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12297 supported options.
12298 The option cannot be combined with @option{-fsanitize=address},
12299 @option{-fsanitize=leak}.
12300
12301 Note that sanitized atomic builtins cannot throw exceptions when
12302 operating on invalid memory addresses with non-call exceptions
12303 (@option{-fnon-call-exceptions}).
12304
12305 @item -fsanitize=leak
12306 @opindex fsanitize=leak
12307 Enable LeakSanitizer, a memory leak detector.
12308 This option only matters for linking of executables and
12309 the executable is linked against a library that overrides @code{malloc}
12310 and other allocator functions. See
12311 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12312 details. The run-time behavior can be influenced using the
12313 @env{LSAN_OPTIONS} environment variable.
12314 The option cannot be combined with @option{-fsanitize=thread}.
12315
12316 @item -fsanitize=undefined
12317 @opindex fsanitize=undefined
12318 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12319 Various computations are instrumented to detect undefined behavior
12320 at runtime. Current suboptions are:
12321
12322 @table @gcctabopt
12323
12324 @item -fsanitize=shift
12325 @opindex fsanitize=shift
12326 This option enables checking that the result of a shift operation is
12327 not undefined. Note that what exactly is considered undefined differs
12328 slightly between C and C++, as well as between ISO C90 and C99, etc.
12329 This option has two suboptions, @option{-fsanitize=shift-base} and
12330 @option{-fsanitize=shift-exponent}.
12331
12332 @item -fsanitize=shift-exponent
12333 @opindex fsanitize=shift-exponent
12334 This option enables checking that the second argument of a shift operation
12335 is not negative and is smaller than the precision of the promoted first
12336 argument.
12337
12338 @item -fsanitize=shift-base
12339 @opindex fsanitize=shift-base
12340 If the second argument of a shift operation is within range, check that the
12341 result of a shift operation is not undefined. Note that what exactly is
12342 considered undefined differs slightly between C and C++, as well as between
12343 ISO C90 and C99, etc.
12344
12345 @item -fsanitize=integer-divide-by-zero
12346 @opindex fsanitize=integer-divide-by-zero
12347 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12348
12349 @item -fsanitize=unreachable
12350 @opindex fsanitize=unreachable
12351 With this option, the compiler turns the @code{__builtin_unreachable}
12352 call into a diagnostics message call instead. When reaching the
12353 @code{__builtin_unreachable} call, the behavior is undefined.
12354
12355 @item -fsanitize=vla-bound
12356 @opindex fsanitize=vla-bound
12357 This option instructs the compiler to check that the size of a variable
12358 length array is positive.
12359
12360 @item -fsanitize=null
12361 @opindex fsanitize=null
12362 This option enables pointer checking. Particularly, the application
12363 built with this option turned on will issue an error message when it
12364 tries to dereference a NULL pointer, or if a reference (possibly an
12365 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12366 on an object pointed by a NULL pointer.
12367
12368 @item -fsanitize=return
12369 @opindex fsanitize=return
12370 This option enables return statement checking. Programs
12371 built with this option turned on will issue an error message
12372 when the end of a non-void function is reached without actually
12373 returning a value. This option works in C++ only.
12374
12375 @item -fsanitize=signed-integer-overflow
12376 @opindex fsanitize=signed-integer-overflow
12377 This option enables signed integer overflow checking. We check that
12378 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12379 does not overflow in the signed arithmetics. Note, integer promotion
12380 rules must be taken into account. That is, the following is not an
12381 overflow:
12382 @smallexample
12383 signed char a = SCHAR_MAX;
12384 a++;
12385 @end smallexample
12386
12387 @item -fsanitize=bounds
12388 @opindex fsanitize=bounds
12389 This option enables instrumentation of array bounds. Various out of bounds
12390 accesses are detected. Flexible array members, flexible array member-like
12391 arrays, and initializers of variables with static storage are not instrumented.
12392
12393 @item -fsanitize=bounds-strict
12394 @opindex fsanitize=bounds-strict
12395 This option enables strict instrumentation of array bounds. Most out of bounds
12396 accesses are detected, including flexible array members and flexible array
12397 member-like arrays. Initializers of variables with static storage are not
12398 instrumented.
12399
12400 @item -fsanitize=alignment
12401 @opindex fsanitize=alignment
12402
12403 This option enables checking of alignment of pointers when they are
12404 dereferenced, or when a reference is bound to insufficiently aligned target,
12405 or when a method or constructor is invoked on insufficiently aligned object.
12406
12407 @item -fsanitize=object-size
12408 @opindex fsanitize=object-size
12409 This option enables instrumentation of memory references using the
12410 @code{__builtin_object_size} function. Various out of bounds pointer
12411 accesses are detected.
12412
12413 @item -fsanitize=float-divide-by-zero
12414 @opindex fsanitize=float-divide-by-zero
12415 Detect floating-point division by zero. Unlike other similar options,
12416 @option{-fsanitize=float-divide-by-zero} is not enabled by
12417 @option{-fsanitize=undefined}, since floating-point division by zero can
12418 be a legitimate way of obtaining infinities and NaNs.
12419
12420 @item -fsanitize=float-cast-overflow
12421 @opindex fsanitize=float-cast-overflow
12422 This option enables floating-point type to integer conversion checking.
12423 We check that the result of the conversion does not overflow.
12424 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12425 not enabled by @option{-fsanitize=undefined}.
12426 This option does not work well with @code{FE_INVALID} exceptions enabled.
12427
12428 @item -fsanitize=nonnull-attribute
12429 @opindex fsanitize=nonnull-attribute
12430
12431 This option enables instrumentation of calls, checking whether null values
12432 are not passed to arguments marked as requiring a non-null value by the
12433 @code{nonnull} function attribute.
12434
12435 @item -fsanitize=returns-nonnull-attribute
12436 @opindex fsanitize=returns-nonnull-attribute
12437
12438 This option enables instrumentation of return statements in functions
12439 marked with @code{returns_nonnull} function attribute, to detect returning
12440 of null values from such functions.
12441
12442 @item -fsanitize=bool
12443 @opindex fsanitize=bool
12444
12445 This option enables instrumentation of loads from bool. If a value other
12446 than 0/1 is loaded, a run-time error is issued.
12447
12448 @item -fsanitize=enum
12449 @opindex fsanitize=enum
12450
12451 This option enables instrumentation of loads from an enum type. If
12452 a value outside the range of values for the enum type is loaded,
12453 a run-time error is issued.
12454
12455 @item -fsanitize=vptr
12456 @opindex fsanitize=vptr
12457
12458 This option enables instrumentation of C++ member function calls, member
12459 accesses and some conversions between pointers to base and derived classes,
12460 to verify the referenced object has the correct dynamic type.
12461
12462 @item -fsanitize=pointer-overflow
12463 @opindex fsanitize=pointer-overflow
12464
12465 This option enables instrumentation of pointer arithmetics. If the pointer
12466 arithmetics overflows, a run-time error is issued.
12467
12468 @item -fsanitize=builtin
12469 @opindex fsanitize=builtin
12470
12471 This option enables instrumentation of arguments to selected builtin
12472 functions. If an invalid value is passed to such arguments, a run-time
12473 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12474 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12475 by this option.
12476
12477 @end table
12478
12479 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12480 @option{-fsanitize=undefined} gives a diagnostic message.
12481 This currently works only for the C family of languages.
12482
12483 @item -fno-sanitize=all
12484 @opindex fno-sanitize=all
12485
12486 This option disables all previously enabled sanitizers.
12487 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12488 together.
12489
12490 @item -fasan-shadow-offset=@var{number}
12491 @opindex fasan-shadow-offset
12492 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12493 It is useful for experimenting with different shadow memory layouts in
12494 Kernel AddressSanitizer.
12495
12496 @item -fsanitize-sections=@var{s1},@var{s2},...
12497 @opindex fsanitize-sections
12498 Sanitize global variables in selected user-defined sections. @var{si} may
12499 contain wildcards.
12500
12501 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12502 @opindex fsanitize-recover
12503 @opindex fno-sanitize-recover
12504 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12505 mentioned in comma-separated list of @var{opts}. Enabling this option
12506 for a sanitizer component causes it to attempt to continue
12507 running the program as if no error happened. This means multiple
12508 runtime errors can be reported in a single program run, and the exit
12509 code of the program may indicate success even when errors
12510 have been reported. The @option{-fno-sanitize-recover=} option
12511 can be used to alter
12512 this behavior: only the first detected error is reported
12513 and program then exits with a non-zero exit code.
12514
12515 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12516 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12517 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12518 @option{-fsanitize=bounds-strict},
12519 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12520 For these sanitizers error recovery is turned on by default,
12521 except @option{-fsanitize=address}, for which this feature is experimental.
12522 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12523 accepted, the former enables recovery for all sanitizers that support it,
12524 the latter disables recovery for all sanitizers that support it.
12525
12526 Even if a recovery mode is turned on the compiler side, it needs to be also
12527 enabled on the runtime library side, otherwise the failures are still fatal.
12528 The runtime library defaults to @code{halt_on_error=0} for
12529 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12530 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12531 setting the @code{halt_on_error} flag in the corresponding environment variable.
12532
12533 Syntax without an explicit @var{opts} parameter is deprecated. It is
12534 equivalent to specifying an @var{opts} list of:
12535
12536 @smallexample
12537 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12538 @end smallexample
12539
12540 @item -fsanitize-address-use-after-scope
12541 @opindex fsanitize-address-use-after-scope
12542 Enable sanitization of local variables to detect use-after-scope bugs.
12543 The option sets @option{-fstack-reuse} to @samp{none}.
12544
12545 @item -fsanitize-undefined-trap-on-error
12546 @opindex fsanitize-undefined-trap-on-error
12547 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12548 report undefined behavior using @code{__builtin_trap} rather than
12549 a @code{libubsan} library routine. The advantage of this is that the
12550 @code{libubsan} library is not needed and is not linked in, so this
12551 is usable even in freestanding environments.
12552
12553 @item -fsanitize-coverage=trace-pc
12554 @opindex fsanitize-coverage=trace-pc
12555 Enable coverage-guided fuzzing code instrumentation.
12556 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12557
12558 @item -fsanitize-coverage=trace-cmp
12559 @opindex fsanitize-coverage=trace-cmp
12560 Enable dataflow guided fuzzing code instrumentation.
12561 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12562 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12563 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12564 variable or @code{__sanitizer_cov_trace_const_cmp1},
12565 @code{__sanitizer_cov_trace_const_cmp2},
12566 @code{__sanitizer_cov_trace_const_cmp4} or
12567 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12568 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12569 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12570 @code{__sanitizer_cov_trace_switch} for switch statements.
12571
12572 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12573 @opindex fcf-protection
12574 Enable code instrumentation of control-flow transfers to increase
12575 program security by checking that target addresses of control-flow
12576 transfer instructions (such as indirect function call, function return,
12577 indirect jump) are valid. This prevents diverting the flow of control
12578 to an unexpected target. This is intended to protect against such
12579 threats as Return-oriented Programming (ROP), and similarly
12580 call/jmp-oriented programming (COP/JOP).
12581
12582 The value @code{branch} tells the compiler to implement checking of
12583 validity of control-flow transfer at the point of indirect branch
12584 instructions, i.e.@: call/jmp instructions. The value @code{return}
12585 implements checking of validity at the point of returning from a
12586 function. The value @code{full} is an alias for specifying both
12587 @code{branch} and @code{return}. The value @code{none} turns off
12588 instrumentation.
12589
12590 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12591 used. The first bit of @code{__CET__} is set to 1 for the value
12592 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12593 the @code{return}.
12594
12595 You can also use the @code{nocf_check} attribute to identify
12596 which functions and calls should be skipped from instrumentation
12597 (@pxref{Function Attributes}).
12598
12599 Currently the x86 GNU/Linux target provides an implementation based
12600 on Intel Control-flow Enforcement Technology (CET).
12601
12602 @item -fstack-protector
12603 @opindex fstack-protector
12604 Emit extra code to check for buffer overflows, such as stack smashing
12605 attacks. This is done by adding a guard variable to functions with
12606 vulnerable objects. This includes functions that call @code{alloca}, and
12607 functions with buffers larger than 8 bytes. The guards are initialized
12608 when a function is entered and then checked when the function exits.
12609 If a guard check fails, an error message is printed and the program exits.
12610
12611 @item -fstack-protector-all
12612 @opindex fstack-protector-all
12613 Like @option{-fstack-protector} except that all functions are protected.
12614
12615 @item -fstack-protector-strong
12616 @opindex fstack-protector-strong
12617 Like @option{-fstack-protector} but includes additional functions to
12618 be protected --- those that have local array definitions, or have
12619 references to local frame addresses.
12620
12621 @item -fstack-protector-explicit
12622 @opindex fstack-protector-explicit
12623 Like @option{-fstack-protector} but only protects those functions which
12624 have the @code{stack_protect} attribute.
12625
12626 @item -fstack-check
12627 @opindex fstack-check
12628 Generate code to verify that you do not go beyond the boundary of the
12629 stack. You should specify this flag if you are running in an
12630 environment with multiple threads, but you only rarely need to specify it in
12631 a single-threaded environment since stack overflow is automatically
12632 detected on nearly all systems if there is only one stack.
12633
12634 Note that this switch does not actually cause checking to be done; the
12635 operating system or the language runtime must do that. The switch causes
12636 generation of code to ensure that they see the stack being extended.
12637
12638 You can additionally specify a string parameter: @samp{no} means no
12639 checking, @samp{generic} means force the use of old-style checking,
12640 @samp{specific} means use the best checking method and is equivalent
12641 to bare @option{-fstack-check}.
12642
12643 Old-style checking is a generic mechanism that requires no specific
12644 target support in the compiler but comes with the following drawbacks:
12645
12646 @enumerate
12647 @item
12648 Modified allocation strategy for large objects: they are always
12649 allocated dynamically if their size exceeds a fixed threshold. Note this
12650 may change the semantics of some code.
12651
12652 @item
12653 Fixed limit on the size of the static frame of functions: when it is
12654 topped by a particular function, stack checking is not reliable and
12655 a warning is issued by the compiler.
12656
12657 @item
12658 Inefficiency: because of both the modified allocation strategy and the
12659 generic implementation, code performance is hampered.
12660 @end enumerate
12661
12662 Note that old-style stack checking is also the fallback method for
12663 @samp{specific} if no target support has been added in the compiler.
12664
12665 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12666 and stack overflows. @samp{specific} is an excellent choice when compiling
12667 Ada code. It is not generally sufficient to protect against stack-clash
12668 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12669
12670 @item -fstack-clash-protection
12671 @opindex fstack-clash-protection
12672 Generate code to prevent stack clash style attacks. When this option is
12673 enabled, the compiler will only allocate one page of stack space at a time
12674 and each page is accessed immediately after allocation. Thus, it prevents
12675 allocations from jumping over any stack guard page provided by the
12676 operating system.
12677
12678 Most targets do not fully support stack clash protection. However, on
12679 those targets @option{-fstack-clash-protection} will protect dynamic stack
12680 allocations. @option{-fstack-clash-protection} may also provide limited
12681 protection for static stack allocations if the target supports
12682 @option{-fstack-check=specific}.
12683
12684 @item -fstack-limit-register=@var{reg}
12685 @itemx -fstack-limit-symbol=@var{sym}
12686 @itemx -fno-stack-limit
12687 @opindex fstack-limit-register
12688 @opindex fstack-limit-symbol
12689 @opindex fno-stack-limit
12690 Generate code to ensure that the stack does not grow beyond a certain value,
12691 either the value of a register or the address of a symbol. If a larger
12692 stack is required, a signal is raised at run time. For most targets,
12693 the signal is raised before the stack overruns the boundary, so
12694 it is possible to catch the signal without taking special precautions.
12695
12696 For instance, if the stack starts at absolute address @samp{0x80000000}
12697 and grows downwards, you can use the flags
12698 @option{-fstack-limit-symbol=__stack_limit} and
12699 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12700 of 128KB@. Note that this may only work with the GNU linker.
12701
12702 You can locally override stack limit checking by using the
12703 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12704
12705 @item -fsplit-stack
12706 @opindex fsplit-stack
12707 Generate code to automatically split the stack before it overflows.
12708 The resulting program has a discontiguous stack which can only
12709 overflow if the program is unable to allocate any more memory. This
12710 is most useful when running threaded programs, as it is no longer
12711 necessary to calculate a good stack size to use for each thread. This
12712 is currently only implemented for the x86 targets running
12713 GNU/Linux.
12714
12715 When code compiled with @option{-fsplit-stack} calls code compiled
12716 without @option{-fsplit-stack}, there may not be much stack space
12717 available for the latter code to run. If compiling all code,
12718 including library code, with @option{-fsplit-stack} is not an option,
12719 then the linker can fix up these calls so that the code compiled
12720 without @option{-fsplit-stack} always has a large stack. Support for
12721 this is implemented in the gold linker in GNU binutils release 2.21
12722 and later.
12723
12724 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12725 @opindex fvtable-verify
12726 This option is only available when compiling C++ code.
12727 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12728 feature that verifies at run time, for every virtual call, that
12729 the vtable pointer through which the call is made is valid for the type of
12730 the object, and has not been corrupted or overwritten. If an invalid vtable
12731 pointer is detected at run time, an error is reported and execution of the
12732 program is immediately halted.
12733
12734 This option causes run-time data structures to be built at program startup,
12735 which are used for verifying the vtable pointers.
12736 The options @samp{std} and @samp{preinit}
12737 control the timing of when these data structures are built. In both cases the
12738 data structures are built before execution reaches @code{main}. Using
12739 @option{-fvtable-verify=std} causes the data structures to be built after
12740 shared libraries have been loaded and initialized.
12741 @option{-fvtable-verify=preinit} causes them to be built before shared
12742 libraries have been loaded and initialized.
12743
12744 If this option appears multiple times in the command line with different
12745 values specified, @samp{none} takes highest priority over both @samp{std} and
12746 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12747
12748 @item -fvtv-debug
12749 @opindex fvtv-debug
12750 When used in conjunction with @option{-fvtable-verify=std} or
12751 @option{-fvtable-verify=preinit}, causes debug versions of the
12752 runtime functions for the vtable verification feature to be called.
12753 This flag also causes the compiler to log information about which
12754 vtable pointers it finds for each class.
12755 This information is written to a file named @file{vtv_set_ptr_data.log}
12756 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12757 if that is defined or the current working directory otherwise.
12758
12759 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12760 file, be sure to delete any existing one.
12761
12762 @item -fvtv-counts
12763 @opindex fvtv-counts
12764 This is a debugging flag. When used in conjunction with
12765 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12766 causes the compiler to keep track of the total number of virtual calls
12767 it encounters and the number of verifications it inserts. It also
12768 counts the number of calls to certain run-time library functions
12769 that it inserts and logs this information for each compilation unit.
12770 The compiler writes this information to a file named
12771 @file{vtv_count_data.log} in the directory named by the environment
12772 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12773 directory otherwise. It also counts the size of the vtable pointer sets
12774 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12775 in the same directory.
12776
12777 Note: This feature @emph{appends} data to the log files. To get fresh log
12778 files, be sure to delete any existing ones.
12779
12780 @item -finstrument-functions
12781 @opindex finstrument-functions
12782 Generate instrumentation calls for entry and exit to functions. Just
12783 after function entry and just before function exit, the following
12784 profiling functions are called with the address of the current
12785 function and its call site. (On some platforms,
12786 @code{__builtin_return_address} does not work beyond the current
12787 function, so the call site information may not be available to the
12788 profiling functions otherwise.)
12789
12790 @smallexample
12791 void __cyg_profile_func_enter (void *this_fn,
12792 void *call_site);
12793 void __cyg_profile_func_exit (void *this_fn,
12794 void *call_site);
12795 @end smallexample
12796
12797 The first argument is the address of the start of the current function,
12798 which may be looked up exactly in the symbol table.
12799
12800 This instrumentation is also done for functions expanded inline in other
12801 functions. The profiling calls indicate where, conceptually, the
12802 inline function is entered and exited. This means that addressable
12803 versions of such functions must be available. If all your uses of a
12804 function are expanded inline, this may mean an additional expansion of
12805 code size. If you use @code{extern inline} in your C code, an
12806 addressable version of such functions must be provided. (This is
12807 normally the case anyway, but if you get lucky and the optimizer always
12808 expands the functions inline, you might have gotten away without
12809 providing static copies.)
12810
12811 A function may be given the attribute @code{no_instrument_function}, in
12812 which case this instrumentation is not done. This can be used, for
12813 example, for the profiling functions listed above, high-priority
12814 interrupt routines, and any functions from which the profiling functions
12815 cannot safely be called (perhaps signal handlers, if the profiling
12816 routines generate output or allocate memory).
12817 @xref{Common Function Attributes}.
12818
12819 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12820 @opindex finstrument-functions-exclude-file-list
12821
12822 Set the list of functions that are excluded from instrumentation (see
12823 the description of @option{-finstrument-functions}). If the file that
12824 contains a function definition matches with one of @var{file}, then
12825 that function is not instrumented. The match is done on substrings:
12826 if the @var{file} parameter is a substring of the file name, it is
12827 considered to be a match.
12828
12829 For example:
12830
12831 @smallexample
12832 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12833 @end smallexample
12834
12835 @noindent
12836 excludes any inline function defined in files whose pathnames
12837 contain @file{/bits/stl} or @file{include/sys}.
12838
12839 If, for some reason, you want to include letter @samp{,} in one of
12840 @var{sym}, write @samp{\,}. For example,
12841 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12842 (note the single quote surrounding the option).
12843
12844 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12845 @opindex finstrument-functions-exclude-function-list
12846
12847 This is similar to @option{-finstrument-functions-exclude-file-list},
12848 but this option sets the list of function names to be excluded from
12849 instrumentation. The function name to be matched is its user-visible
12850 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12851 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12852 match is done on substrings: if the @var{sym} parameter is a substring
12853 of the function name, it is considered to be a match. For C99 and C++
12854 extended identifiers, the function name must be given in UTF-8, not
12855 using universal character names.
12856
12857 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12858 @opindex fpatchable-function-entry
12859 Generate @var{N} NOPs right at the beginning
12860 of each function, with the function entry point before the @var{M}th NOP.
12861 If @var{M} is omitted, it defaults to @code{0} so the
12862 function entry points to the address just at the first NOP.
12863 The NOP instructions reserve extra space which can be used to patch in
12864 any desired instrumentation at run time, provided that the code segment
12865 is writable. The amount of space is controllable indirectly via
12866 the number of NOPs; the NOP instruction used corresponds to the instruction
12867 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12868 is target-specific and may also depend on the architecture variant and/or
12869 other compilation options.
12870
12871 For run-time identification, the starting addresses of these areas,
12872 which correspond to their respective function entries minus @var{M},
12873 are additionally collected in the @code{__patchable_function_entries}
12874 section of the resulting binary.
12875
12876 Note that the value of @code{__attribute__ ((patchable_function_entry
12877 (N,M)))} takes precedence over command-line option
12878 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12879 the area size or to remove it completely on a single function.
12880 If @code{N=0}, no pad location is recorded.
12881
12882 The NOP instructions are inserted at---and maybe before, depending on
12883 @var{M}---the function entry address, even before the prologue.
12884
12885 @end table
12886
12887
12888 @node Preprocessor Options
12889 @section Options Controlling the Preprocessor
12890 @cindex preprocessor options
12891 @cindex options, preprocessor
12892
12893 These options control the C preprocessor, which is run on each C source
12894 file before actual compilation.
12895
12896 If you use the @option{-E} option, nothing is done except preprocessing.
12897 Some of these options make sense only together with @option{-E} because
12898 they cause the preprocessor output to be unsuitable for actual
12899 compilation.
12900
12901 In addition to the options listed here, there are a number of options
12902 to control search paths for include files documented in
12903 @ref{Directory Options}.
12904 Options to control preprocessor diagnostics are listed in
12905 @ref{Warning Options}.
12906
12907 @table @gcctabopt
12908 @include cppopts.texi
12909
12910 @item -Wp,@var{option}
12911 @opindex Wp
12912 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12913 and pass @var{option} directly through to the preprocessor. If
12914 @var{option} contains commas, it is split into multiple options at the
12915 commas. However, many options are modified, translated or interpreted
12916 by the compiler driver before being passed to the preprocessor, and
12917 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12918 interface is undocumented and subject to change, so whenever possible
12919 you should avoid using @option{-Wp} and let the driver handle the
12920 options instead.
12921
12922 @item -Xpreprocessor @var{option}
12923 @opindex Xpreprocessor
12924 Pass @var{option} as an option to the preprocessor. You can use this to
12925 supply system-specific preprocessor options that GCC does not
12926 recognize.
12927
12928 If you want to pass an option that takes an argument, you must use
12929 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12930
12931 @item -no-integrated-cpp
12932 @opindex no-integrated-cpp
12933 Perform preprocessing as a separate pass before compilation.
12934 By default, GCC performs preprocessing as an integrated part of
12935 input tokenization and parsing.
12936 If this option is provided, the appropriate language front end
12937 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12938 and Objective-C, respectively) is instead invoked twice,
12939 once for preprocessing only and once for actual compilation
12940 of the preprocessed input.
12941 This option may be useful in conjunction with the @option{-B} or
12942 @option{-wrapper} options to specify an alternate preprocessor or
12943 perform additional processing of the program source between
12944 normal preprocessing and compilation.
12945
12946 @end table
12947
12948 @node Assembler Options
12949 @section Passing Options to the Assembler
12950
12951 @c prevent bad page break with this line
12952 You can pass options to the assembler.
12953
12954 @table @gcctabopt
12955 @item -Wa,@var{option}
12956 @opindex Wa
12957 Pass @var{option} as an option to the assembler. If @var{option}
12958 contains commas, it is split into multiple options at the commas.
12959
12960 @item -Xassembler @var{option}
12961 @opindex Xassembler
12962 Pass @var{option} as an option to the assembler. You can use this to
12963 supply system-specific assembler options that GCC does not
12964 recognize.
12965
12966 If you want to pass an option that takes an argument, you must use
12967 @option{-Xassembler} twice, once for the option and once for the argument.
12968
12969 @end table
12970
12971 @node Link Options
12972 @section Options for Linking
12973 @cindex link options
12974 @cindex options, linking
12975
12976 These options come into play when the compiler links object files into
12977 an executable output file. They are meaningless if the compiler is
12978 not doing a link step.
12979
12980 @table @gcctabopt
12981 @cindex file names
12982 @item @var{object-file-name}
12983 A file name that does not end in a special recognized suffix is
12984 considered to name an object file or library. (Object files are
12985 distinguished from libraries by the linker according to the file
12986 contents.) If linking is done, these object files are used as input
12987 to the linker.
12988
12989 @item -c
12990 @itemx -S
12991 @itemx -E
12992 @opindex c
12993 @opindex S
12994 @opindex E
12995 If any of these options is used, then the linker is not run, and
12996 object file names should not be used as arguments. @xref{Overall
12997 Options}.
12998
12999 @item -flinker-output=@var{type}
13000 @opindex flinker-output
13001 This option controls the code generation of the link time optimizer. By
13002 default the linker output is determined by the linker plugin automatically. For
13003 debugging the compiler and in the case of incremental linking to non-lto object
13004 file is desired, it may be useful to control the type manually.
13005
13006 If @var{type} is @samp{exec} the code generation is configured to produce static
13007 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
13008
13009 If @var{type} is @samp{dyn} the code generation is configured to produce shared
13010 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
13011 enabled automatically. This makes it possible to build shared libraries without
13012 position independent code on architectures this is possible, i.e.@: on x86.
13013
13014 If @var{type} is @samp{pie} the code generation is configured to produce
13015 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
13016 except that @option{-fpie} is not disabled if specified at compilation time.
13017
13018 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13019 done. The sections containing intermediate code for link-time optimization are
13020 merged, pre-optimized, and output to the resulting object file. In addition, if
13021 @option{-ffat-lto-objects} is specified the binary code is produced for future
13022 non-lto linking. The object file produced by incremental linking will be smaller
13023 than a static library produced from the same object files. At link-time the
13024 result of incremental linking will also load faster to compiler than a static
13025 library assuming that majority of objects in the library are used.
13026
13027 Finally @samp{nolto-rel} configure compiler to for incremental linking where
13028 code generation is forced, final binary is produced and the intermediate code
13029 for later link-time optimization is stripped. When multiple object files are
13030 linked together the resulting code will be optimized better than with link time
13031 optimizations disabled (for example, the cross-module inlining will happen),
13032 most of benefits of whole program optimizations are however lost.
13033
13034 During the incremental link (by @option{-r}) the linker plugin will default to
13035 @option{rel}. With current interfaces to GNU Binutils it is however not
13036 possible to link incrementally LTO objects and non-LTO objects into a single
13037 mixed object file. In the case any of object files in incremental link can not
13038 be used for link-time optimization the linker plugin will output warning and
13039 use @samp{nolto-rel}. To maintain the whole program optimization it is
13040 recommended to link such objects into static library instead. Alternatively it
13041 is possible to use H.J. Lu's binutils with support for mixed objects.
13042
13043 @item -fuse-ld=bfd
13044 @opindex fuse-ld=bfd
13045 Use the @command{bfd} linker instead of the default linker.
13046
13047 @item -fuse-ld=gold
13048 @opindex fuse-ld=gold
13049 Use the @command{gold} linker instead of the default linker.
13050
13051 @item -fuse-ld=lld
13052 @opindex fuse-ld=lld
13053 Use the LLVM @command{lld} linker instead of the default linker.
13054
13055 @cindex Libraries
13056 @item -l@var{library}
13057 @itemx -l @var{library}
13058 @opindex l
13059 Search the library named @var{library} when linking. (The second
13060 alternative with the library as a separate argument is only for
13061 POSIX compliance and is not recommended.)
13062
13063 The @option{-l} option is passed directly to the linker by GCC. Refer
13064 to your linker documentation for exact details. The general
13065 description below applies to the GNU linker.
13066
13067 The linker searches a standard list of directories for the library.
13068 The directories searched include several standard system directories
13069 plus any that you specify with @option{-L}.
13070
13071 Static libraries are archives of object files, and have file names
13072 like @file{lib@var{library}.a}. Some targets also support shared
13073 libraries, which typically have names like @file{lib@var{library}.so}.
13074 If both static and shared libraries are found, the linker gives
13075 preference to linking with the shared library unless the
13076 @option{-static} option is used.
13077
13078 It makes a difference where in the command you write this option; the
13079 linker searches and processes libraries and object files in the order they
13080 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13081 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13082 to functions in @samp{z}, those functions may not be loaded.
13083
13084 @item -lobjc
13085 @opindex lobjc
13086 You need this special case of the @option{-l} option in order to
13087 link an Objective-C or Objective-C++ program.
13088
13089 @item -nostartfiles
13090 @opindex nostartfiles
13091 Do not use the standard system startup files when linking.
13092 The standard system libraries are used normally, unless @option{-nostdlib},
13093 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13094
13095 @item -nodefaultlibs
13096 @opindex nodefaultlibs
13097 Do not use the standard system libraries when linking.
13098 Only the libraries you specify are passed to the linker, and options
13099 specifying linkage of the system libraries, such as @option{-static-libgcc}
13100 or @option{-shared-libgcc}, are ignored.
13101 The standard startup files are used normally, unless @option{-nostartfiles}
13102 is used.
13103
13104 The compiler may generate calls to @code{memcmp},
13105 @code{memset}, @code{memcpy} and @code{memmove}.
13106 These entries are usually resolved by entries in
13107 libc. These entry points should be supplied through some other
13108 mechanism when this option is specified.
13109
13110 @item -nolibc
13111 @opindex nolibc
13112 Do not use the C library or system libraries tightly coupled with it when
13113 linking. Still link with the startup files, @file{libgcc} or toolchain
13114 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13115 or @file{libstdc++} unless options preventing their inclusion are used as
13116 well. This typically removes @option{-lc} from the link command line, as well
13117 as system libraries that normally go with it and become meaningless when
13118 absence of a C library is assumed, for example @option{-lpthread} or
13119 @option{-lm} in some configurations. This is intended for bare-board
13120 targets when there is indeed no C library available.
13121
13122 @item -nostdlib
13123 @opindex nostdlib
13124 Do not use the standard system startup files or libraries when linking.
13125 No startup files and only the libraries you specify are passed to
13126 the linker, and options specifying linkage of the system libraries, such as
13127 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13128
13129 The compiler may generate calls to @code{memcmp}, @code{memset},
13130 @code{memcpy} and @code{memmove}.
13131 These entries are usually resolved by entries in
13132 libc. These entry points should be supplied through some other
13133 mechanism when this option is specified.
13134
13135 @cindex @option{-lgcc}, use with @option{-nostdlib}
13136 @cindex @option{-nostdlib} and unresolved references
13137 @cindex unresolved references and @option{-nostdlib}
13138 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13139 @cindex @option{-nodefaultlibs} and unresolved references
13140 @cindex unresolved references and @option{-nodefaultlibs}
13141 One of the standard libraries bypassed by @option{-nostdlib} and
13142 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13143 which GCC uses to overcome shortcomings of particular machines, or special
13144 needs for some languages.
13145 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13146 Collection (GCC) Internals},
13147 for more discussion of @file{libgcc.a}.)
13148 In most cases, you need @file{libgcc.a} even when you want to avoid
13149 other standard libraries. In other words, when you specify @option{-nostdlib}
13150 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13151 This ensures that you have no unresolved references to internal GCC
13152 library subroutines.
13153 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13154 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13155 GNU Compiler Collection (GCC) Internals}.)
13156
13157 @item -e @var{entry}
13158 @itemx --entry=@var{entry}
13159 @opindex e
13160 @opindex entry
13161
13162 Specify that the program entry point is @var{entry}. The argument is
13163 interpreted by the linker; the GNU linker accepts either a symbol name
13164 or an address.
13165
13166 @item -pie
13167 @opindex pie
13168 Produce a dynamically linked position independent executable on targets
13169 that support it. For predictable results, you must also specify the same
13170 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13171 or model suboptions) when you specify this linker option.
13172
13173 @item -no-pie
13174 @opindex no-pie
13175 Don't produce a dynamically linked position independent executable.
13176
13177 @item -static-pie
13178 @opindex static-pie
13179 Produce a static position independent executable on targets that support
13180 it. A static position independent executable is similar to a static
13181 executable, but can be loaded at any address without a dynamic linker.
13182 For predictable results, you must also specify the same set of options
13183 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13184 suboptions) when you specify this linker option.
13185
13186 @item -pthread
13187 @opindex pthread
13188 Link with the POSIX threads library. This option is supported on
13189 GNU/Linux targets, most other Unix derivatives, and also on
13190 x86 Cygwin and MinGW targets. On some targets this option also sets
13191 flags for the preprocessor, so it should be used consistently for both
13192 compilation and linking.
13193
13194 @item -r
13195 @opindex r
13196 Produce a relocatable object as output. This is also known as partial
13197 linking.
13198
13199 @item -rdynamic
13200 @opindex rdynamic
13201 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13202 that support it. This instructs the linker to add all symbols, not
13203 only used ones, to the dynamic symbol table. This option is needed
13204 for some uses of @code{dlopen} or to allow obtaining backtraces
13205 from within a program.
13206
13207 @item -s
13208 @opindex s
13209 Remove all symbol table and relocation information from the executable.
13210
13211 @item -static
13212 @opindex static
13213 On systems that support dynamic linking, this overrides @option{-pie}
13214 and prevents linking with the shared libraries. On other systems, this
13215 option has no effect.
13216
13217 @item -shared
13218 @opindex shared
13219 Produce a shared object which can then be linked with other objects to
13220 form an executable. Not all systems support this option. For predictable
13221 results, you must also specify the same set of options used for compilation
13222 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13223 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13224 needs to build supplementary stub code for constructors to work. On
13225 multi-libbed systems, @samp{gcc -shared} must select the correct support
13226 libraries to link against. Failing to supply the correct flags may lead
13227 to subtle defects. Supplying them in cases where they are not necessary
13228 is innocuous.}
13229
13230 @item -shared-libgcc
13231 @itemx -static-libgcc
13232 @opindex shared-libgcc
13233 @opindex static-libgcc
13234 On systems that provide @file{libgcc} as a shared library, these options
13235 force the use of either the shared or static version, respectively.
13236 If no shared version of @file{libgcc} was built when the compiler was
13237 configured, these options have no effect.
13238
13239 There are several situations in which an application should use the
13240 shared @file{libgcc} instead of the static version. The most common
13241 of these is when the application wishes to throw and catch exceptions
13242 across different shared libraries. In that case, each of the libraries
13243 as well as the application itself should use the shared @file{libgcc}.
13244
13245 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13246 whenever you build a shared library or a main executable, because C++
13247 programs typically use exceptions, so this is the right thing to do.
13248
13249 If, instead, you use the GCC driver to create shared libraries, you may
13250 find that they are not always linked with the shared @file{libgcc}.
13251 If GCC finds, at its configuration time, that you have a non-GNU linker
13252 or a GNU linker that does not support option @option{--eh-frame-hdr},
13253 it links the shared version of @file{libgcc} into shared libraries
13254 by default. Otherwise, it takes advantage of the linker and optimizes
13255 away the linking with the shared version of @file{libgcc}, linking with
13256 the static version of libgcc by default. This allows exceptions to
13257 propagate through such shared libraries, without incurring relocation
13258 costs at library load time.
13259
13260 However, if a library or main executable is supposed to throw or catch
13261 exceptions, you must link it using the G++ driver, or using the option
13262 @option{-shared-libgcc}, such that it is linked with the shared
13263 @file{libgcc}.
13264
13265 @item -static-libasan
13266 @opindex static-libasan
13267 When the @option{-fsanitize=address} option is used to link a program,
13268 the GCC driver automatically links against @option{libasan}. If
13269 @file{libasan} is available as a shared library, and the @option{-static}
13270 option is not used, then this links against the shared version of
13271 @file{libasan}. The @option{-static-libasan} option directs the GCC
13272 driver to link @file{libasan} statically, without necessarily linking
13273 other libraries statically.
13274
13275 @item -static-libtsan
13276 @opindex static-libtsan
13277 When the @option{-fsanitize=thread} option is used to link a program,
13278 the GCC driver automatically links against @option{libtsan}. If
13279 @file{libtsan} is available as a shared library, and the @option{-static}
13280 option is not used, then this links against the shared version of
13281 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13282 driver to link @file{libtsan} statically, without necessarily linking
13283 other libraries statically.
13284
13285 @item -static-liblsan
13286 @opindex static-liblsan
13287 When the @option{-fsanitize=leak} option is used to link a program,
13288 the GCC driver automatically links against @option{liblsan}. If
13289 @file{liblsan} is available as a shared library, and the @option{-static}
13290 option is not used, then this links against the shared version of
13291 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13292 driver to link @file{liblsan} statically, without necessarily linking
13293 other libraries statically.
13294
13295 @item -static-libubsan
13296 @opindex static-libubsan
13297 When the @option{-fsanitize=undefined} option is used to link a program,
13298 the GCC driver automatically links against @option{libubsan}. If
13299 @file{libubsan} is available as a shared library, and the @option{-static}
13300 option is not used, then this links against the shared version of
13301 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13302 driver to link @file{libubsan} statically, without necessarily linking
13303 other libraries statically.
13304
13305 @item -static-libstdc++
13306 @opindex static-libstdc++
13307 When the @command{g++} program is used to link a C++ program, it
13308 normally automatically links against @option{libstdc++}. If
13309 @file{libstdc++} is available as a shared library, and the
13310 @option{-static} option is not used, then this links against the
13311 shared version of @file{libstdc++}. That is normally fine. However, it
13312 is sometimes useful to freeze the version of @file{libstdc++} used by
13313 the program without going all the way to a fully static link. The
13314 @option{-static-libstdc++} option directs the @command{g++} driver to
13315 link @file{libstdc++} statically, without necessarily linking other
13316 libraries statically.
13317
13318 @item -symbolic
13319 @opindex symbolic
13320 Bind references to global symbols when building a shared object. Warn
13321 about any unresolved references (unless overridden by the link editor
13322 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13323 this option.
13324
13325 @item -T @var{script}
13326 @opindex T
13327 @cindex linker script
13328 Use @var{script} as the linker script. This option is supported by most
13329 systems using the GNU linker. On some targets, such as bare-board
13330 targets without an operating system, the @option{-T} option may be required
13331 when linking to avoid references to undefined symbols.
13332
13333 @item -Xlinker @var{option}
13334 @opindex Xlinker
13335 Pass @var{option} as an option to the linker. You can use this to
13336 supply system-specific linker options that GCC does not recognize.
13337
13338 If you want to pass an option that takes a separate argument, you must use
13339 @option{-Xlinker} twice, once for the option and once for the argument.
13340 For example, to pass @option{-assert definitions}, you must write
13341 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13342 @option{-Xlinker "-assert definitions"}, because this passes the entire
13343 string as a single argument, which is not what the linker expects.
13344
13345 When using the GNU linker, it is usually more convenient to pass
13346 arguments to linker options using the @option{@var{option}=@var{value}}
13347 syntax than as separate arguments. For example, you can specify
13348 @option{-Xlinker -Map=output.map} rather than
13349 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13350 this syntax for command-line options.
13351
13352 @item -Wl,@var{option}
13353 @opindex Wl
13354 Pass @var{option} as an option to the linker. If @var{option} contains
13355 commas, it is split into multiple options at the commas. You can use this
13356 syntax to pass an argument to the option.
13357 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13358 linker. When using the GNU linker, you can also get the same effect with
13359 @option{-Wl,-Map=output.map}.
13360
13361 @item -u @var{symbol}
13362 @opindex u
13363 Pretend the symbol @var{symbol} is undefined, to force linking of
13364 library modules to define it. You can use @option{-u} multiple times with
13365 different symbols to force loading of additional library modules.
13366
13367 @item -z @var{keyword}
13368 @opindex z
13369 @option{-z} is passed directly on to the linker along with the keyword
13370 @var{keyword}. See the section in the documentation of your linker for
13371 permitted values and their meanings.
13372 @end table
13373
13374 @node Directory Options
13375 @section Options for Directory Search
13376 @cindex directory options
13377 @cindex options, directory search
13378 @cindex search path
13379
13380 These options specify directories to search for header files, for
13381 libraries and for parts of the compiler:
13382
13383 @table @gcctabopt
13384 @include cppdiropts.texi
13385
13386 @item -iplugindir=@var{dir}
13387 @opindex iplugindir=
13388 Set the directory to search for plugins that are passed
13389 by @option{-fplugin=@var{name}} instead of
13390 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13391 to be used by the user, but only passed by the driver.
13392
13393 @item -L@var{dir}
13394 @opindex L
13395 Add directory @var{dir} to the list of directories to be searched
13396 for @option{-l}.
13397
13398 @item -B@var{prefix}
13399 @opindex B
13400 This option specifies where to find the executables, libraries,
13401 include files, and data files of the compiler itself.
13402
13403 The compiler driver program runs one or more of the subprograms
13404 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13405 @var{prefix} as a prefix for each program it tries to run, both with and
13406 without @samp{@var{machine}/@var{version}/} for the corresponding target
13407 machine and compiler version.
13408
13409 For each subprogram to be run, the compiler driver first tries the
13410 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13411 is not specified, the driver tries two standard prefixes,
13412 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13413 those results in a file name that is found, the unmodified program
13414 name is searched for using the directories specified in your
13415 @env{PATH} environment variable.
13416
13417 The compiler checks to see if the path provided by @option{-B}
13418 refers to a directory, and if necessary it adds a directory
13419 separator character at the end of the path.
13420
13421 @option{-B} prefixes that effectively specify directory names also apply
13422 to libraries in the linker, because the compiler translates these
13423 options into @option{-L} options for the linker. They also apply to
13424 include files in the preprocessor, because the compiler translates these
13425 options into @option{-isystem} options for the preprocessor. In this case,
13426 the compiler appends @samp{include} to the prefix.
13427
13428 The runtime support file @file{libgcc.a} can also be searched for using
13429 the @option{-B} prefix, if needed. If it is not found there, the two
13430 standard prefixes above are tried, and that is all. The file is left
13431 out of the link if it is not found by those means.
13432
13433 Another way to specify a prefix much like the @option{-B} prefix is to use
13434 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13435 Variables}.
13436
13437 As a special kludge, if the path provided by @option{-B} is
13438 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13439 9, then it is replaced by @file{[dir/]include}. This is to help
13440 with boot-strapping the compiler.
13441
13442 @item -no-canonical-prefixes
13443 @opindex no-canonical-prefixes
13444 Do not expand any symbolic links, resolve references to @samp{/../}
13445 or @samp{/./}, or make the path absolute when generating a relative
13446 prefix.
13447
13448 @item --sysroot=@var{dir}
13449 @opindex sysroot
13450 Use @var{dir} as the logical root directory for headers and libraries.
13451 For example, if the compiler normally searches for headers in
13452 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13453 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13454
13455 If you use both this option and the @option{-isysroot} option, then
13456 the @option{--sysroot} option applies to libraries, but the
13457 @option{-isysroot} option applies to header files.
13458
13459 The GNU linker (beginning with version 2.16) has the necessary support
13460 for this option. If your linker does not support this option, the
13461 header file aspect of @option{--sysroot} still works, but the
13462 library aspect does not.
13463
13464 @item --no-sysroot-suffix
13465 @opindex no-sysroot-suffix
13466 For some targets, a suffix is added to the root directory specified
13467 with @option{--sysroot}, depending on the other options used, so that
13468 headers may for example be found in
13469 @file{@var{dir}/@var{suffix}/usr/include} instead of
13470 @file{@var{dir}/usr/include}. This option disables the addition of
13471 such a suffix.
13472
13473 @end table
13474
13475 @node Code Gen Options
13476 @section Options for Code Generation Conventions
13477 @cindex code generation conventions
13478 @cindex options, code generation
13479 @cindex run-time options
13480
13481 These machine-independent options control the interface conventions
13482 used in code generation.
13483
13484 Most of them have both positive and negative forms; the negative form
13485 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13486 one of the forms is listed---the one that is not the default. You
13487 can figure out the other form by either removing @samp{no-} or adding
13488 it.
13489
13490 @table @gcctabopt
13491 @item -fstack-reuse=@var{reuse-level}
13492 @opindex fstack_reuse
13493 This option controls stack space reuse for user declared local/auto variables
13494 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13495 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13496 local variables and temporaries, @samp{named_vars} enables the reuse only for
13497 user defined local variables with names, and @samp{none} disables stack reuse
13498 completely. The default value is @samp{all}. The option is needed when the
13499 program extends the lifetime of a scoped local variable or a compiler generated
13500 temporary beyond the end point defined by the language. When a lifetime of
13501 a variable ends, and if the variable lives in memory, the optimizing compiler
13502 has the freedom to reuse its stack space with other temporaries or scoped
13503 local variables whose live range does not overlap with it. Legacy code extending
13504 local lifetime is likely to break with the stack reuse optimization.
13505
13506 For example,
13507
13508 @smallexample
13509 int *p;
13510 @{
13511 int local1;
13512
13513 p = &local1;
13514 local1 = 10;
13515 ....
13516 @}
13517 @{
13518 int local2;
13519 local2 = 20;
13520 ...
13521 @}
13522
13523 if (*p == 10) // out of scope use of local1
13524 @{
13525
13526 @}
13527 @end smallexample
13528
13529 Another example:
13530 @smallexample
13531
13532 struct A
13533 @{
13534 A(int k) : i(k), j(k) @{ @}
13535 int i;
13536 int j;
13537 @};
13538
13539 A *ap;
13540
13541 void foo(const A& ar)
13542 @{
13543 ap = &ar;
13544 @}
13545
13546 void bar()
13547 @{
13548 foo(A(10)); // temp object's lifetime ends when foo returns
13549
13550 @{
13551 A a(20);
13552 ....
13553 @}
13554 ap->i+= 10; // ap references out of scope temp whose space
13555 // is reused with a. What is the value of ap->i?
13556 @}
13557
13558 @end smallexample
13559
13560 The lifetime of a compiler generated temporary is well defined by the C++
13561 standard. When a lifetime of a temporary ends, and if the temporary lives
13562 in memory, the optimizing compiler has the freedom to reuse its stack
13563 space with other temporaries or scoped local variables whose live range
13564 does not overlap with it. However some of the legacy code relies on
13565 the behavior of older compilers in which temporaries' stack space is
13566 not reused, the aggressive stack reuse can lead to runtime errors. This
13567 option is used to control the temporary stack reuse optimization.
13568
13569 @item -ftrapv
13570 @opindex ftrapv
13571 This option generates traps for signed overflow on addition, subtraction,
13572 multiplication operations.
13573 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13574 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13575 @option{-fwrapv} being effective. Note that only active options override, so
13576 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13577 results in @option{-ftrapv} being effective.
13578
13579 @item -fwrapv
13580 @opindex fwrapv
13581 This option instructs the compiler to assume that signed arithmetic
13582 overflow of addition, subtraction and multiplication wraps around
13583 using twos-complement representation. This flag enables some optimizations
13584 and disables others.
13585 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13586 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13587 @option{-fwrapv} being effective. Note that only active options override, so
13588 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13589 results in @option{-ftrapv} being effective.
13590
13591 @item -fwrapv-pointer
13592 @opindex fwrapv-pointer
13593 This option instructs the compiler to assume that pointer arithmetic
13594 overflow on addition and subtraction wraps around using twos-complement
13595 representation. This flag disables some optimizations which assume
13596 pointer overflow is invalid.
13597
13598 @item -fstrict-overflow
13599 @opindex fstrict-overflow
13600 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13601 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13602
13603 @item -fexceptions
13604 @opindex fexceptions
13605 Enable exception handling. Generates extra code needed to propagate
13606 exceptions. For some targets, this implies GCC generates frame
13607 unwind information for all functions, which can produce significant data
13608 size overhead, although it does not affect execution. If you do not
13609 specify this option, GCC enables it by default for languages like
13610 C++ that normally require exception handling, and disables it for
13611 languages like C that do not normally require it. However, you may need
13612 to enable this option when compiling C code that needs to interoperate
13613 properly with exception handlers written in C++. You may also wish to
13614 disable this option if you are compiling older C++ programs that don't
13615 use exception handling.
13616
13617 @item -fnon-call-exceptions
13618 @opindex fnon-call-exceptions
13619 Generate code that allows trapping instructions to throw exceptions.
13620 Note that this requires platform-specific runtime support that does
13621 not exist everywhere. Moreover, it only allows @emph{trapping}
13622 instructions to throw exceptions, i.e.@: memory references or floating-point
13623 instructions. It does not allow exceptions to be thrown from
13624 arbitrary signal handlers such as @code{SIGALRM}.
13625
13626 @item -fdelete-dead-exceptions
13627 @opindex fdelete-dead-exceptions
13628 Consider that instructions that may throw exceptions but don't otherwise
13629 contribute to the execution of the program can be optimized away.
13630 This option is enabled by default for the Ada front end, as permitted by
13631 the Ada language specification.
13632 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13633
13634 @item -funwind-tables
13635 @opindex funwind-tables
13636 Similar to @option{-fexceptions}, except that it just generates any needed
13637 static data, but does not affect the generated code in any other way.
13638 You normally do not need to enable this option; instead, a language processor
13639 that needs this handling enables it on your behalf.
13640
13641 @item -fasynchronous-unwind-tables
13642 @opindex fasynchronous-unwind-tables
13643 Generate unwind table in DWARF format, if supported by target machine. The
13644 table is exact at each instruction boundary, so it can be used for stack
13645 unwinding from asynchronous events (such as debugger or garbage collector).
13646
13647 @item -fno-gnu-unique
13648 @opindex fno-gnu-unique
13649 @opindex fgnu-unique
13650 On systems with recent GNU assembler and C library, the C++ compiler
13651 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13652 of template static data members and static local variables in inline
13653 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13654 is necessary to avoid problems with a library used by two different
13655 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13656 therefore disagreeing with the other one about the binding of the
13657 symbol. But this causes @code{dlclose} to be ignored for affected
13658 DSOs; if your program relies on reinitialization of a DSO via
13659 @code{dlclose} and @code{dlopen}, you can use
13660 @option{-fno-gnu-unique}.
13661
13662 @item -fpcc-struct-return
13663 @opindex fpcc-struct-return
13664 Return ``short'' @code{struct} and @code{union} values in memory like
13665 longer ones, rather than in registers. This convention is less
13666 efficient, but it has the advantage of allowing intercallability between
13667 GCC-compiled files and files compiled with other compilers, particularly
13668 the Portable C Compiler (pcc).
13669
13670 The precise convention for returning structures in memory depends
13671 on the target configuration macros.
13672
13673 Short structures and unions are those whose size and alignment match
13674 that of some integer type.
13675
13676 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13677 switch is not binary compatible with code compiled with the
13678 @option{-freg-struct-return} switch.
13679 Use it to conform to a non-default application binary interface.
13680
13681 @item -freg-struct-return
13682 @opindex freg-struct-return
13683 Return @code{struct} and @code{union} values in registers when possible.
13684 This is more efficient for small structures than
13685 @option{-fpcc-struct-return}.
13686
13687 If you specify neither @option{-fpcc-struct-return} nor
13688 @option{-freg-struct-return}, GCC defaults to whichever convention is
13689 standard for the target. If there is no standard convention, GCC
13690 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13691 the principal compiler. In those cases, we can choose the standard, and
13692 we chose the more efficient register return alternative.
13693
13694 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13695 switch is not binary compatible with code compiled with the
13696 @option{-fpcc-struct-return} switch.
13697 Use it to conform to a non-default application binary interface.
13698
13699 @item -fshort-enums
13700 @opindex fshort-enums
13701 Allocate to an @code{enum} type only as many bytes as it needs for the
13702 declared range of possible values. Specifically, the @code{enum} type
13703 is equivalent to the smallest integer type that has enough room.
13704
13705 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13706 code that is not binary compatible with code generated without that switch.
13707 Use it to conform to a non-default application binary interface.
13708
13709 @item -fshort-wchar
13710 @opindex fshort-wchar
13711 Override the underlying type for @code{wchar_t} to be @code{short
13712 unsigned int} instead of the default for the target. This option is
13713 useful for building programs to run under WINE@.
13714
13715 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13716 code that is not binary compatible with code generated without that switch.
13717 Use it to conform to a non-default application binary interface.
13718
13719 @item -fno-common
13720 @opindex fno-common
13721 @opindex fcommon
13722 @cindex tentative definitions
13723 In C code, this option controls the placement of global variables
13724 defined without an initializer, known as @dfn{tentative definitions}
13725 in the C standard. Tentative definitions are distinct from declarations
13726 of a variable with the @code{extern} keyword, which do not allocate storage.
13727
13728 Unix C compilers have traditionally allocated storage for
13729 uninitialized global variables in a common block. This allows the
13730 linker to resolve all tentative definitions of the same variable
13731 in different compilation units to the same object, or to a non-tentative
13732 definition.
13733 This is the behavior specified by @option{-fcommon}, and is the default for
13734 GCC on most targets.
13735 On the other hand, this behavior is not required by ISO
13736 C, and on some targets may carry a speed or code size penalty on
13737 variable references.
13738
13739 The @option{-fno-common} option specifies that the compiler should instead
13740 place uninitialized global variables in the BSS section of the object file.
13741 This inhibits the merging of tentative definitions by the linker so
13742 you get a multiple-definition error if the same
13743 variable is defined in more than one compilation unit.
13744 Compiling with @option{-fno-common} is useful on targets for which
13745 it provides better performance, or if you wish to verify that the
13746 program will work on other systems that always treat uninitialized
13747 variable definitions this way.
13748
13749 @item -fno-ident
13750 @opindex fno-ident
13751 @opindex fident
13752 Ignore the @code{#ident} directive.
13753
13754 @item -finhibit-size-directive
13755 @opindex finhibit-size-directive
13756 Don't output a @code{.size} assembler directive, or anything else that
13757 would cause trouble if the function is split in the middle, and the
13758 two halves are placed at locations far apart in memory. This option is
13759 used when compiling @file{crtstuff.c}; you should not need to use it
13760 for anything else.
13761
13762 @item -fverbose-asm
13763 @opindex fverbose-asm
13764 Put extra commentary information in the generated assembly code to
13765 make it more readable. This option is generally only of use to those
13766 who actually need to read the generated assembly code (perhaps while
13767 debugging the compiler itself).
13768
13769 @option{-fno-verbose-asm}, the default, causes the
13770 extra information to be omitted and is useful when comparing two assembler
13771 files.
13772
13773 The added comments include:
13774
13775 @itemize @bullet
13776
13777 @item
13778 information on the compiler version and command-line options,
13779
13780 @item
13781 the source code lines associated with the assembly instructions,
13782 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13783
13784 @item
13785 hints on which high-level expressions correspond to
13786 the various assembly instruction operands.
13787
13788 @end itemize
13789
13790 For example, given this C source file:
13791
13792 @smallexample
13793 int test (int n)
13794 @{
13795 int i;
13796 int total = 0;
13797
13798 for (i = 0; i < n; i++)
13799 total += i * i;
13800
13801 return total;
13802 @}
13803 @end smallexample
13804
13805 compiling to (x86_64) assembly via @option{-S} and emitting the result
13806 direct to stdout via @option{-o} @option{-}
13807
13808 @smallexample
13809 gcc -S test.c -fverbose-asm -Os -o -
13810 @end smallexample
13811
13812 gives output similar to this:
13813
13814 @smallexample
13815 .file "test.c"
13816 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13817 [...snip...]
13818 # options passed:
13819 [...snip...]
13820
13821 .text
13822 .globl test
13823 .type test, @@function
13824 test:
13825 .LFB0:
13826 .cfi_startproc
13827 # test.c:4: int total = 0;
13828 xorl %eax, %eax # <retval>
13829 # test.c:6: for (i = 0; i < n; i++)
13830 xorl %edx, %edx # i
13831 .L2:
13832 # test.c:6: for (i = 0; i < n; i++)
13833 cmpl %edi, %edx # n, i
13834 jge .L5 #,
13835 # test.c:7: total += i * i;
13836 movl %edx, %ecx # i, tmp92
13837 imull %edx, %ecx # i, tmp92
13838 # test.c:6: for (i = 0; i < n; i++)
13839 incl %edx # i
13840 # test.c:7: total += i * i;
13841 addl %ecx, %eax # tmp92, <retval>
13842 jmp .L2 #
13843 .L5:
13844 # test.c:10: @}
13845 ret
13846 .cfi_endproc
13847 .LFE0:
13848 .size test, .-test
13849 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13850 .section .note.GNU-stack,"",@@progbits
13851 @end smallexample
13852
13853 The comments are intended for humans rather than machines and hence the
13854 precise format of the comments is subject to change.
13855
13856 @item -frecord-gcc-switches
13857 @opindex frecord-gcc-switches
13858 This switch causes the command line used to invoke the
13859 compiler to be recorded into the object file that is being created.
13860 This switch is only implemented on some targets and the exact format
13861 of the recording is target and binary file format dependent, but it
13862 usually takes the form of a section containing ASCII text. This
13863 switch is related to the @option{-fverbose-asm} switch, but that
13864 switch only records information in the assembler output file as
13865 comments, so it never reaches the object file.
13866 See also @option{-grecord-gcc-switches} for another
13867 way of storing compiler options into the object file.
13868
13869 @item -fpic
13870 @opindex fpic
13871 @cindex global offset table
13872 @cindex PIC
13873 Generate position-independent code (PIC) suitable for use in a shared
13874 library, if supported for the target machine. Such code accesses all
13875 constant addresses through a global offset table (GOT)@. The dynamic
13876 loader resolves the GOT entries when the program starts (the dynamic
13877 loader is not part of GCC; it is part of the operating system). If
13878 the GOT size for the linked executable exceeds a machine-specific
13879 maximum size, you get an error message from the linker indicating that
13880 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13881 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13882 on the m68k and RS/6000. The x86 has no such limit.)
13883
13884 Position-independent code requires special support, and therefore works
13885 only on certain machines. For the x86, GCC supports PIC for System V
13886 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13887 position-independent.
13888
13889 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13890 are defined to 1.
13891
13892 @item -fPIC
13893 @opindex fPIC
13894 If supported for the target machine, emit position-independent code,
13895 suitable for dynamic linking and avoiding any limit on the size of the
13896 global offset table. This option makes a difference on AArch64, m68k,
13897 PowerPC and SPARC@.
13898
13899 Position-independent code requires special support, and therefore works
13900 only on certain machines.
13901
13902 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13903 are defined to 2.
13904
13905 @item -fpie
13906 @itemx -fPIE
13907 @opindex fpie
13908 @opindex fPIE
13909 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13910 generated position-independent code can be only linked into executables.
13911 Usually these options are used to compile code that will be linked using
13912 the @option{-pie} GCC option.
13913
13914 @option{-fpie} and @option{-fPIE} both define the macros
13915 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13916 for @option{-fpie} and 2 for @option{-fPIE}.
13917
13918 @item -fno-plt
13919 @opindex fno-plt
13920 @opindex fplt
13921 Do not use the PLT for external function calls in position-independent code.
13922 Instead, load the callee address at call sites from the GOT and branch to it.
13923 This leads to more efficient code by eliminating PLT stubs and exposing
13924 GOT loads to optimizations. On architectures such as 32-bit x86 where
13925 PLT stubs expect the GOT pointer in a specific register, this gives more
13926 register allocation freedom to the compiler.
13927 Lazy binding requires use of the PLT;
13928 with @option{-fno-plt} all external symbols are resolved at load time.
13929
13930 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13931 through the PLT for specific external functions.
13932
13933 In position-dependent code, a few targets also convert calls to
13934 functions that are marked to not use the PLT to use the GOT instead.
13935
13936 @item -fno-jump-tables
13937 @opindex fno-jump-tables
13938 @opindex fjump-tables
13939 Do not use jump tables for switch statements even where it would be
13940 more efficient than other code generation strategies. This option is
13941 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13942 building code that forms part of a dynamic linker and cannot
13943 reference the address of a jump table. On some targets, jump tables
13944 do not require a GOT and this option is not needed.
13945
13946 @item -ffixed-@var{reg}
13947 @opindex ffixed
13948 Treat the register named @var{reg} as a fixed register; generated code
13949 should never refer to it (except perhaps as a stack pointer, frame
13950 pointer or in some other fixed role).
13951
13952 @var{reg} must be the name of a register. The register names accepted
13953 are machine-specific and are defined in the @code{REGISTER_NAMES}
13954 macro in the machine description macro file.
13955
13956 This flag does not have a negative form, because it specifies a
13957 three-way choice.
13958
13959 @item -fcall-used-@var{reg}
13960 @opindex fcall-used
13961 Treat the register named @var{reg} as an allocable register that is
13962 clobbered by function calls. It may be allocated for temporaries or
13963 variables that do not live across a call. Functions compiled this way
13964 do not save and restore the register @var{reg}.
13965
13966 It is an error to use this flag with the frame pointer or stack pointer.
13967 Use of this flag for other registers that have fixed pervasive roles in
13968 the machine's execution model produces disastrous results.
13969
13970 This flag does not have a negative form, because it specifies a
13971 three-way choice.
13972
13973 @item -fcall-saved-@var{reg}
13974 @opindex fcall-saved
13975 Treat the register named @var{reg} as an allocable register saved by
13976 functions. It may be allocated even for temporaries or variables that
13977 live across a call. Functions compiled this way save and restore
13978 the register @var{reg} if they use it.
13979
13980 It is an error to use this flag with the frame pointer or stack pointer.
13981 Use of this flag for other registers that have fixed pervasive roles in
13982 the machine's execution model produces disastrous results.
13983
13984 A different sort of disaster results from the use of this flag for
13985 a register in which function values may be returned.
13986
13987 This flag does not have a negative form, because it specifies a
13988 three-way choice.
13989
13990 @item -fpack-struct[=@var{n}]
13991 @opindex fpack-struct
13992 Without a value specified, pack all structure members together without
13993 holes. When a value is specified (which must be a small power of two), pack
13994 structure members according to this value, representing the maximum
13995 alignment (that is, objects with default alignment requirements larger than
13996 this are output potentially unaligned at the next fitting location.
13997
13998 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13999 code that is not binary compatible with code generated without that switch.
14000 Additionally, it makes the code suboptimal.
14001 Use it to conform to a non-default application binary interface.
14002
14003 @item -fleading-underscore
14004 @opindex fleading-underscore
14005 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14006 change the way C symbols are represented in the object file. One use
14007 is to help link with legacy assembly code.
14008
14009 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14010 generate code that is not binary compatible with code generated without that
14011 switch. Use it to conform to a non-default application binary interface.
14012 Not all targets provide complete support for this switch.
14013
14014 @item -ftls-model=@var{model}
14015 @opindex ftls-model
14016 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14017 The @var{model} argument should be one of @samp{global-dynamic},
14018 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14019 Note that the choice is subject to optimization: the compiler may use
14020 a more efficient model for symbols not visible outside of the translation
14021 unit, or if @option{-fpic} is not given on the command line.
14022
14023 The default without @option{-fpic} is @samp{initial-exec}; with
14024 @option{-fpic} the default is @samp{global-dynamic}.
14025
14026 @item -ftrampolines
14027 @opindex ftrampolines
14028 For targets that normally need trampolines for nested functions, always
14029 generate them instead of using descriptors. Otherwise, for targets that
14030 do not need them, like for example HP-PA or IA-64, do nothing.
14031
14032 A trampoline is a small piece of code that is created at run time on the
14033 stack when the address of a nested function is taken, and is used to call
14034 the nested function indirectly. Therefore, it requires the stack to be
14035 made executable in order for the program to work properly.
14036
14037 @option{-fno-trampolines} is enabled by default on a language by language
14038 basis to let the compiler avoid generating them, if it computes that this
14039 is safe, and replace them with descriptors. Descriptors are made up of data
14040 only, but the generated code must be prepared to deal with them. As of this
14041 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14042
14043 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14044 @option{-fno-trampolines} are not binary compatible if nested functions are
14045 present. This option must therefore be used on a program-wide basis and be
14046 manipulated with extreme care.
14047
14048 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14049 @opindex fvisibility
14050 Set the default ELF image symbol visibility to the specified option---all
14051 symbols are marked with this unless overridden within the code.
14052 Using this feature can very substantially improve linking and
14053 load times of shared object libraries, produce more optimized
14054 code, provide near-perfect API export and prevent symbol clashes.
14055 It is @strong{strongly} recommended that you use this in any shared objects
14056 you distribute.
14057
14058 Despite the nomenclature, @samp{default} always means public; i.e.,
14059 available to be linked against from outside the shared object.
14060 @samp{protected} and @samp{internal} are pretty useless in real-world
14061 usage so the only other commonly used option is @samp{hidden}.
14062 The default if @option{-fvisibility} isn't specified is
14063 @samp{default}, i.e., make every symbol public.
14064
14065 A good explanation of the benefits offered by ensuring ELF
14066 symbols have the correct visibility is given by ``How To Write
14067 Shared Libraries'' by Ulrich Drepper (which can be found at
14068 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14069 solution made possible by this option to marking things hidden when
14070 the default is public is to make the default hidden and mark things
14071 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14072 and @code{__attribute__ ((visibility("default")))} instead of
14073 @code{__declspec(dllexport)} you get almost identical semantics with
14074 identical syntax. This is a great boon to those working with
14075 cross-platform projects.
14076
14077 For those adding visibility support to existing code, you may find
14078 @code{#pragma GCC visibility} of use. This works by you enclosing
14079 the declarations you wish to set visibility for with (for example)
14080 @code{#pragma GCC visibility push(hidden)} and
14081 @code{#pragma GCC visibility pop}.
14082 Bear in mind that symbol visibility should be viewed @strong{as
14083 part of the API interface contract} and thus all new code should
14084 always specify visibility when it is not the default; i.e., declarations
14085 only for use within the local DSO should @strong{always} be marked explicitly
14086 as hidden as so to avoid PLT indirection overheads---making this
14087 abundantly clear also aids readability and self-documentation of the code.
14088 Note that due to ISO C++ specification requirements, @code{operator new} and
14089 @code{operator delete} must always be of default visibility.
14090
14091 Be aware that headers from outside your project, in particular system
14092 headers and headers from any other library you use, may not be
14093 expecting to be compiled with visibility other than the default. You
14094 may need to explicitly say @code{#pragma GCC visibility push(default)}
14095 before including any such headers.
14096
14097 @code{extern} declarations are not affected by @option{-fvisibility}, so
14098 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14099 no modifications. However, this means that calls to @code{extern}
14100 functions with no explicit visibility use the PLT, so it is more
14101 effective to use @code{__attribute ((visibility))} and/or
14102 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14103 declarations should be treated as hidden.
14104
14105 Note that @option{-fvisibility} does affect C++ vague linkage
14106 entities. This means that, for instance, an exception class that is
14107 be thrown between DSOs must be explicitly marked with default
14108 visibility so that the @samp{type_info} nodes are unified between
14109 the DSOs.
14110
14111 An overview of these techniques, their benefits and how to use them
14112 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14113
14114 @item -fstrict-volatile-bitfields
14115 @opindex fstrict-volatile-bitfields
14116 This option should be used if accesses to volatile bit-fields (or other
14117 structure fields, although the compiler usually honors those types
14118 anyway) should use a single access of the width of the
14119 field's type, aligned to a natural alignment if possible. For
14120 example, targets with memory-mapped peripheral registers might require
14121 all such accesses to be 16 bits wide; with this flag you can
14122 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14123 is 16 bits on these targets) to force GCC to use 16-bit accesses
14124 instead of, perhaps, a more efficient 32-bit access.
14125
14126 If this option is disabled, the compiler uses the most efficient
14127 instruction. In the previous example, that might be a 32-bit load
14128 instruction, even though that accesses bytes that do not contain
14129 any portion of the bit-field, or memory-mapped registers unrelated to
14130 the one being updated.
14131
14132 In some cases, such as when the @code{packed} attribute is applied to a
14133 structure field, it may not be possible to access the field with a single
14134 read or write that is correctly aligned for the target machine. In this
14135 case GCC falls back to generating multiple accesses rather than code that
14136 will fault or truncate the result at run time.
14137
14138 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14139 not allowed to touch non bit-field members. It is therefore recommended
14140 to define all bits of the field's type as bit-field members.
14141
14142 The default value of this option is determined by the application binary
14143 interface for the target processor.
14144
14145 @item -fsync-libcalls
14146 @opindex fsync-libcalls
14147 This option controls whether any out-of-line instance of the @code{__sync}
14148 family of functions may be used to implement the C++11 @code{__atomic}
14149 family of functions.
14150
14151 The default value of this option is enabled, thus the only useful form
14152 of the option is @option{-fno-sync-libcalls}. This option is used in
14153 the implementation of the @file{libatomic} runtime library.
14154
14155 @end table
14156
14157 @node Developer Options
14158 @section GCC Developer Options
14159 @cindex developer options
14160 @cindex debugging GCC
14161 @cindex debug dump options
14162 @cindex dump options
14163 @cindex compilation statistics
14164
14165 This section describes command-line options that are primarily of
14166 interest to GCC developers, including options to support compiler
14167 testing and investigation of compiler bugs and compile-time
14168 performance problems. This includes options that produce debug dumps
14169 at various points in the compilation; that print statistics such as
14170 memory use and execution time; and that print information about GCC's
14171 configuration, such as where it searches for libraries. You should
14172 rarely need to use any of these options for ordinary compilation and
14173 linking tasks.
14174
14175 Many developer options that cause GCC to dump output to a file take an
14176 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14177 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14178 error.
14179
14180 If @samp{=@var{filename}} is omitted, a default dump file name is
14181 constructed by concatenating the base dump file name, a pass number,
14182 phase letter, and pass name. The base dump file name is the name of
14183 output file produced by the compiler if explicitly specified and not
14184 an executable; otherwise it is the source file name.
14185 The pass number is determined by the order passes are registered with
14186 the compiler's pass manager.
14187 This is generally the same as the order of execution, but passes
14188 registered by plugins, target-specific passes, or passes that are
14189 otherwise registered late are numbered higher than the pass named
14190 @samp{final}, even if they are executed earlier. The phase letter is
14191 one of @samp{i} (inter-procedural analysis), @samp{l}
14192 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14193 The files are created in the directory of the output file.
14194
14195 @table @gcctabopt
14196
14197 @item -d@var{letters}
14198 @itemx -fdump-rtl-@var{pass}
14199 @itemx -fdump-rtl-@var{pass}=@var{filename}
14200 @opindex d
14201 @opindex fdump-rtl-@var{pass}
14202 Says to make debugging dumps during compilation at times specified by
14203 @var{letters}. This is used for debugging the RTL-based passes of the
14204 compiler.
14205
14206 Some @option{-d@var{letters}} switches have different meaning when
14207 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14208 for information about preprocessor-specific dump options.
14209
14210 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14211 @option{-d} option @var{letters}. Here are the possible
14212 letters for use in @var{pass} and @var{letters}, and their meanings:
14213
14214 @table @gcctabopt
14215
14216 @item -fdump-rtl-alignments
14217 @opindex fdump-rtl-alignments
14218 Dump after branch alignments have been computed.
14219
14220 @item -fdump-rtl-asmcons
14221 @opindex fdump-rtl-asmcons
14222 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14223
14224 @item -fdump-rtl-auto_inc_dec
14225 @opindex fdump-rtl-auto_inc_dec
14226 Dump after auto-inc-dec discovery. This pass is only run on
14227 architectures that have auto inc or auto dec instructions.
14228
14229 @item -fdump-rtl-barriers
14230 @opindex fdump-rtl-barriers
14231 Dump after cleaning up the barrier instructions.
14232
14233 @item -fdump-rtl-bbpart
14234 @opindex fdump-rtl-bbpart
14235 Dump after partitioning hot and cold basic blocks.
14236
14237 @item -fdump-rtl-bbro
14238 @opindex fdump-rtl-bbro
14239 Dump after block reordering.
14240
14241 @item -fdump-rtl-btl1
14242 @itemx -fdump-rtl-btl2
14243 @opindex fdump-rtl-btl2
14244 @opindex fdump-rtl-btl2
14245 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14246 after the two branch
14247 target load optimization passes.
14248
14249 @item -fdump-rtl-bypass
14250 @opindex fdump-rtl-bypass
14251 Dump after jump bypassing and control flow optimizations.
14252
14253 @item -fdump-rtl-combine
14254 @opindex fdump-rtl-combine
14255 Dump after the RTL instruction combination pass.
14256
14257 @item -fdump-rtl-compgotos
14258 @opindex fdump-rtl-compgotos
14259 Dump after duplicating the computed gotos.
14260
14261 @item -fdump-rtl-ce1
14262 @itemx -fdump-rtl-ce2
14263 @itemx -fdump-rtl-ce3
14264 @opindex fdump-rtl-ce1
14265 @opindex fdump-rtl-ce2
14266 @opindex fdump-rtl-ce3
14267 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14268 @option{-fdump-rtl-ce3} enable dumping after the three
14269 if conversion passes.
14270
14271 @item -fdump-rtl-cprop_hardreg
14272 @opindex fdump-rtl-cprop_hardreg
14273 Dump after hard register copy propagation.
14274
14275 @item -fdump-rtl-csa
14276 @opindex fdump-rtl-csa
14277 Dump after combining stack adjustments.
14278
14279 @item -fdump-rtl-cse1
14280 @itemx -fdump-rtl-cse2
14281 @opindex fdump-rtl-cse1
14282 @opindex fdump-rtl-cse2
14283 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14284 the two common subexpression elimination passes.
14285
14286 @item -fdump-rtl-dce
14287 @opindex fdump-rtl-dce
14288 Dump after the standalone dead code elimination passes.
14289
14290 @item -fdump-rtl-dbr
14291 @opindex fdump-rtl-dbr
14292 Dump after delayed branch scheduling.
14293
14294 @item -fdump-rtl-dce1
14295 @itemx -fdump-rtl-dce2
14296 @opindex fdump-rtl-dce1
14297 @opindex fdump-rtl-dce2
14298 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14299 the two dead store elimination passes.
14300
14301 @item -fdump-rtl-eh
14302 @opindex fdump-rtl-eh
14303 Dump after finalization of EH handling code.
14304
14305 @item -fdump-rtl-eh_ranges
14306 @opindex fdump-rtl-eh_ranges
14307 Dump after conversion of EH handling range regions.
14308
14309 @item -fdump-rtl-expand
14310 @opindex fdump-rtl-expand
14311 Dump after RTL generation.
14312
14313 @item -fdump-rtl-fwprop1
14314 @itemx -fdump-rtl-fwprop2
14315 @opindex fdump-rtl-fwprop1
14316 @opindex fdump-rtl-fwprop2
14317 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14318 dumping after the two forward propagation passes.
14319
14320 @item -fdump-rtl-gcse1
14321 @itemx -fdump-rtl-gcse2
14322 @opindex fdump-rtl-gcse1
14323 @opindex fdump-rtl-gcse2
14324 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14325 after global common subexpression elimination.
14326
14327 @item -fdump-rtl-init-regs
14328 @opindex fdump-rtl-init-regs
14329 Dump after the initialization of the registers.
14330
14331 @item -fdump-rtl-initvals
14332 @opindex fdump-rtl-initvals
14333 Dump after the computation of the initial value sets.
14334
14335 @item -fdump-rtl-into_cfglayout
14336 @opindex fdump-rtl-into_cfglayout
14337 Dump after converting to cfglayout mode.
14338
14339 @item -fdump-rtl-ira
14340 @opindex fdump-rtl-ira
14341 Dump after iterated register allocation.
14342
14343 @item -fdump-rtl-jump
14344 @opindex fdump-rtl-jump
14345 Dump after the second jump optimization.
14346
14347 @item -fdump-rtl-loop2
14348 @opindex fdump-rtl-loop2
14349 @option{-fdump-rtl-loop2} enables dumping after the rtl
14350 loop optimization passes.
14351
14352 @item -fdump-rtl-mach
14353 @opindex fdump-rtl-mach
14354 Dump after performing the machine dependent reorganization pass, if that
14355 pass exists.
14356
14357 @item -fdump-rtl-mode_sw
14358 @opindex fdump-rtl-mode_sw
14359 Dump after removing redundant mode switches.
14360
14361 @item -fdump-rtl-rnreg
14362 @opindex fdump-rtl-rnreg
14363 Dump after register renumbering.
14364
14365 @item -fdump-rtl-outof_cfglayout
14366 @opindex fdump-rtl-outof_cfglayout
14367 Dump after converting from cfglayout mode.
14368
14369 @item -fdump-rtl-peephole2
14370 @opindex fdump-rtl-peephole2
14371 Dump after the peephole pass.
14372
14373 @item -fdump-rtl-postreload
14374 @opindex fdump-rtl-postreload
14375 Dump after post-reload optimizations.
14376
14377 @item -fdump-rtl-pro_and_epilogue
14378 @opindex fdump-rtl-pro_and_epilogue
14379 Dump after generating the function prologues and epilogues.
14380
14381 @item -fdump-rtl-sched1
14382 @itemx -fdump-rtl-sched2
14383 @opindex fdump-rtl-sched1
14384 @opindex fdump-rtl-sched2
14385 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14386 after the basic block scheduling passes.
14387
14388 @item -fdump-rtl-ree
14389 @opindex fdump-rtl-ree
14390 Dump after sign/zero extension elimination.
14391
14392 @item -fdump-rtl-seqabstr
14393 @opindex fdump-rtl-seqabstr
14394 Dump after common sequence discovery.
14395
14396 @item -fdump-rtl-shorten
14397 @opindex fdump-rtl-shorten
14398 Dump after shortening branches.
14399
14400 @item -fdump-rtl-sibling
14401 @opindex fdump-rtl-sibling
14402 Dump after sibling call optimizations.
14403
14404 @item -fdump-rtl-split1
14405 @itemx -fdump-rtl-split2
14406 @itemx -fdump-rtl-split3
14407 @itemx -fdump-rtl-split4
14408 @itemx -fdump-rtl-split5
14409 @opindex fdump-rtl-split1
14410 @opindex fdump-rtl-split2
14411 @opindex fdump-rtl-split3
14412 @opindex fdump-rtl-split4
14413 @opindex fdump-rtl-split5
14414 These options enable dumping after five rounds of
14415 instruction splitting.
14416
14417 @item -fdump-rtl-sms
14418 @opindex fdump-rtl-sms
14419 Dump after modulo scheduling. This pass is only run on some
14420 architectures.
14421
14422 @item -fdump-rtl-stack
14423 @opindex fdump-rtl-stack
14424 Dump after conversion from GCC's ``flat register file'' registers to the
14425 x87's stack-like registers. This pass is only run on x86 variants.
14426
14427 @item -fdump-rtl-subreg1
14428 @itemx -fdump-rtl-subreg2
14429 @opindex fdump-rtl-subreg1
14430 @opindex fdump-rtl-subreg2
14431 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14432 the two subreg expansion passes.
14433
14434 @item -fdump-rtl-unshare
14435 @opindex fdump-rtl-unshare
14436 Dump after all rtl has been unshared.
14437
14438 @item -fdump-rtl-vartrack
14439 @opindex fdump-rtl-vartrack
14440 Dump after variable tracking.
14441
14442 @item -fdump-rtl-vregs
14443 @opindex fdump-rtl-vregs
14444 Dump after converting virtual registers to hard registers.
14445
14446 @item -fdump-rtl-web
14447 @opindex fdump-rtl-web
14448 Dump after live range splitting.
14449
14450 @item -fdump-rtl-regclass
14451 @itemx -fdump-rtl-subregs_of_mode_init
14452 @itemx -fdump-rtl-subregs_of_mode_finish
14453 @itemx -fdump-rtl-dfinit
14454 @itemx -fdump-rtl-dfinish
14455 @opindex fdump-rtl-regclass
14456 @opindex fdump-rtl-subregs_of_mode_init
14457 @opindex fdump-rtl-subregs_of_mode_finish
14458 @opindex fdump-rtl-dfinit
14459 @opindex fdump-rtl-dfinish
14460 These dumps are defined but always produce empty files.
14461
14462 @item -da
14463 @itemx -fdump-rtl-all
14464 @opindex da
14465 @opindex fdump-rtl-all
14466 Produce all the dumps listed above.
14467
14468 @item -dA
14469 @opindex dA
14470 Annotate the assembler output with miscellaneous debugging information.
14471
14472 @item -dD
14473 @opindex dD
14474 Dump all macro definitions, at the end of preprocessing, in addition to
14475 normal output.
14476
14477 @item -dH
14478 @opindex dH
14479 Produce a core dump whenever an error occurs.
14480
14481 @item -dp
14482 @opindex dp
14483 Annotate the assembler output with a comment indicating which
14484 pattern and alternative is used. The length and cost of each instruction are
14485 also printed.
14486
14487 @item -dP
14488 @opindex dP
14489 Dump the RTL in the assembler output as a comment before each instruction.
14490 Also turns on @option{-dp} annotation.
14491
14492 @item -dx
14493 @opindex dx
14494 Just generate RTL for a function instead of compiling it. Usually used
14495 with @option{-fdump-rtl-expand}.
14496 @end table
14497
14498 @item -fdump-debug
14499 @opindex fdump-debug
14500 Dump debugging information generated during the debug
14501 generation phase.
14502
14503 @item -fdump-earlydebug
14504 @opindex fdump-earlydebug
14505 Dump debugging information generated during the early debug
14506 generation phase.
14507
14508 @item -fdump-noaddr
14509 @opindex fdump-noaddr
14510 When doing debugging dumps, suppress address output. This makes it more
14511 feasible to use diff on debugging dumps for compiler invocations with
14512 different compiler binaries and/or different
14513 text / bss / data / heap / stack / dso start locations.
14514
14515 @item -freport-bug
14516 @opindex freport-bug
14517 Collect and dump debug information into a temporary file if an
14518 internal compiler error (ICE) occurs.
14519
14520 @item -fdump-unnumbered
14521 @opindex fdump-unnumbered
14522 When doing debugging dumps, suppress instruction numbers and address output.
14523 This makes it more feasible to use diff on debugging dumps for compiler
14524 invocations with different options, in particular with and without
14525 @option{-g}.
14526
14527 @item -fdump-unnumbered-links
14528 @opindex fdump-unnumbered-links
14529 When doing debugging dumps (see @option{-d} option above), suppress
14530 instruction numbers for the links to the previous and next instructions
14531 in a sequence.
14532
14533 @item -fdump-ipa-@var{switch}
14534 @itemx -fdump-ipa-@var{switch}-@var{options}
14535 @opindex fdump-ipa
14536 Control the dumping at various stages of inter-procedural analysis
14537 language tree to a file. The file name is generated by appending a
14538 switch specific suffix to the source file name, and the file is created
14539 in the same directory as the output file. The following dumps are
14540 possible:
14541
14542 @table @samp
14543 @item all
14544 Enables all inter-procedural analysis dumps.
14545
14546 @item cgraph
14547 Dumps information about call-graph optimization, unused function removal,
14548 and inlining decisions.
14549
14550 @item inline
14551 Dump after function inlining.
14552
14553 @end table
14554
14555 Additionally, the options @option{-optimized}, @option{-missed},
14556 @option{-note}, and @option{-all} can be provided, with the same meaning
14557 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14558
14559 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14560 information on callsites that were inlined, along with callsites
14561 that were not inlined.
14562
14563 By default, the dump will contain messages about successful
14564 optimizations (equivalent to @option{-optimized}) together with
14565 low-level details about the analysis.
14566
14567 @item -fdump-lang-all
14568 @itemx -fdump-lang-@var{switch}
14569 @itemx -fdump-lang-@var{switch}-@var{options}
14570 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14571 @opindex fdump-lang-all
14572 @opindex fdump-lang
14573 Control the dumping of language-specific information. The @var{options}
14574 and @var{filename} portions behave as described in the
14575 @option{-fdump-tree} option. The following @var{switch} values are
14576 accepted:
14577
14578 @table @samp
14579 @item all
14580
14581 Enable all language-specific dumps.
14582
14583 @item class
14584 Dump class hierarchy information. Virtual table information is emitted
14585 unless '@option{slim}' is specified. This option is applicable to C++ only.
14586
14587 @item raw
14588 Dump the raw internal tree data. This option is applicable to C++ only.
14589
14590 @end table
14591
14592 @item -fdump-passes
14593 @opindex fdump-passes
14594 Print on @file{stderr} the list of optimization passes that are turned
14595 on and off by the current command-line options.
14596
14597 @item -fdump-statistics-@var{option}
14598 @opindex fdump-statistics
14599 Enable and control dumping of pass statistics in a separate file. The
14600 file name is generated by appending a suffix ending in
14601 @samp{.statistics} to the source file name, and the file is created in
14602 the same directory as the output file. If the @samp{-@var{option}}
14603 form is used, @samp{-stats} causes counters to be summed over the
14604 whole compilation unit while @samp{-details} dumps every event as
14605 the passes generate them. The default with no option is to sum
14606 counters for each function compiled.
14607
14608 @item -fdump-tree-all
14609 @itemx -fdump-tree-@var{switch}
14610 @itemx -fdump-tree-@var{switch}-@var{options}
14611 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14612 @opindex fdump-tree-all
14613 @opindex fdump-tree
14614 Control the dumping at various stages of processing the intermediate
14615 language tree to a file. If the @samp{-@var{options}}
14616 form is used, @var{options} is a list of @samp{-} separated options
14617 which control the details of the dump. Not all options are applicable
14618 to all dumps; those that are not meaningful are ignored. The
14619 following options are available
14620
14621 @table @samp
14622 @item address
14623 Print the address of each node. Usually this is not meaningful as it
14624 changes according to the environment and source file. Its primary use
14625 is for tying up a dump file with a debug environment.
14626 @item asmname
14627 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14628 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14629 use working backward from mangled names in the assembly file.
14630 @item slim
14631 When dumping front-end intermediate representations, inhibit dumping
14632 of members of a scope or body of a function merely because that scope
14633 has been reached. Only dump such items when they are directly reachable
14634 by some other path.
14635
14636 When dumping pretty-printed trees, this option inhibits dumping the
14637 bodies of control structures.
14638
14639 When dumping RTL, print the RTL in slim (condensed) form instead of
14640 the default LISP-like representation.
14641 @item raw
14642 Print a raw representation of the tree. By default, trees are
14643 pretty-printed into a C-like representation.
14644 @item details
14645 Enable more detailed dumps (not honored by every dump option). Also
14646 include information from the optimization passes.
14647 @item stats
14648 Enable dumping various statistics about the pass (not honored by every dump
14649 option).
14650 @item blocks
14651 Enable showing basic block boundaries (disabled in raw dumps).
14652 @item graph
14653 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14654 dump a representation of the control flow graph suitable for viewing with
14655 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14656 the file is pretty-printed as a subgraph, so that GraphViz can render them
14657 all in a single plot.
14658
14659 This option currently only works for RTL dumps, and the RTL is always
14660 dumped in slim form.
14661 @item vops
14662 Enable showing virtual operands for every statement.
14663 @item lineno
14664 Enable showing line numbers for statements.
14665 @item uid
14666 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14667 @item verbose
14668 Enable showing the tree dump for each statement.
14669 @item eh
14670 Enable showing the EH region number holding each statement.
14671 @item scev
14672 Enable showing scalar evolution analysis details.
14673 @item optimized
14674 Enable showing optimization information (only available in certain
14675 passes).
14676 @item missed
14677 Enable showing missed optimization information (only available in certain
14678 passes).
14679 @item note
14680 Enable other detailed optimization information (only available in
14681 certain passes).
14682 @item all
14683 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14684 and @option{lineno}.
14685 @item optall
14686 Turn on all optimization options, i.e., @option{optimized},
14687 @option{missed}, and @option{note}.
14688 @end table
14689
14690 To determine what tree dumps are available or find the dump for a pass
14691 of interest follow the steps below.
14692
14693 @enumerate
14694 @item
14695 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14696 look for a code that corresponds to the pass you are interested in.
14697 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14698 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14699 The number at the end distinguishes distinct invocations of the same pass.
14700 @item
14701 To enable the creation of the dump file, append the pass code to
14702 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14703 to enable the dump from the Early Value Range Propagation pass, invoke
14704 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14705 specify the name of the dump file. If you don't specify one, GCC
14706 creates as described below.
14707 @item
14708 Find the pass dump in a file whose name is composed of three components
14709 separated by a period: the name of the source file GCC was invoked to
14710 compile, a numeric suffix indicating the pass number followed by the
14711 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14712 and finally the pass code. For example, the Early VRP pass dump might
14713 be in a file named @file{myfile.c.038t.evrp} in the current working
14714 directory. Note that the numeric codes are not stable and may change
14715 from one version of GCC to another.
14716 @end enumerate
14717
14718 @item -fopt-info
14719 @itemx -fopt-info-@var{options}
14720 @itemx -fopt-info-@var{options}=@var{filename}
14721 @opindex fopt-info
14722 Controls optimization dumps from various optimization passes. If the
14723 @samp{-@var{options}} form is used, @var{options} is a list of
14724 @samp{-} separated option keywords to select the dump details and
14725 optimizations.
14726
14727 The @var{options} can be divided into three groups:
14728 @enumerate
14729 @item
14730 options describing what kinds of messages should be emitted,
14731 @item
14732 options describing the verbosity of the dump, and
14733 @item
14734 options describing which optimizations should be included.
14735 @end enumerate
14736 The options from each group can be freely mixed as they are
14737 non-overlapping. However, in case of any conflicts,
14738 the later options override the earlier options on the command
14739 line.
14740
14741 The following options control which kinds of messages should be emitted:
14742
14743 @table @samp
14744 @item optimized
14745 Print information when an optimization is successfully applied. It is
14746 up to a pass to decide which information is relevant. For example, the
14747 vectorizer passes print the source location of loops which are
14748 successfully vectorized.
14749 @item missed
14750 Print information about missed optimizations. Individual passes
14751 control which information to include in the output.
14752 @item note
14753 Print verbose information about optimizations, such as certain
14754 transformations, more detailed messages about decisions etc.
14755 @item all
14756 Print detailed optimization information. This includes
14757 @samp{optimized}, @samp{missed}, and @samp{note}.
14758 @end table
14759
14760 The following option controls the dump verbosity:
14761
14762 @table @samp
14763 @item internals
14764 By default, only ``high-level'' messages are emitted. This option enables
14765 additional, more detailed, messages, which are likely to only be of interest
14766 to GCC developers.
14767 @end table
14768
14769 One or more of the following option keywords can be used to describe a
14770 group of optimizations:
14771
14772 @table @samp
14773 @item ipa
14774 Enable dumps from all interprocedural optimizations.
14775 @item loop
14776 Enable dumps from all loop optimizations.
14777 @item inline
14778 Enable dumps from all inlining optimizations.
14779 @item omp
14780 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14781 @item vec
14782 Enable dumps from all vectorization optimizations.
14783 @item optall
14784 Enable dumps from all optimizations. This is a superset of
14785 the optimization groups listed above.
14786 @end table
14787
14788 If @var{options} is
14789 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14790 about successful optimizations from all the passes, omitting messages
14791 that are treated as ``internals''.
14792
14793 If the @var{filename} is provided, then the dumps from all the
14794 applicable optimizations are concatenated into the @var{filename}.
14795 Otherwise the dump is output onto @file{stderr}. Though multiple
14796 @option{-fopt-info} options are accepted, only one of them can include
14797 a @var{filename}. If other filenames are provided then all but the
14798 first such option are ignored.
14799
14800 Note that the output @var{filename} is overwritten
14801 in case of multiple translation units. If a combined output from
14802 multiple translation units is desired, @file{stderr} should be used
14803 instead.
14804
14805 In the following example, the optimization info is output to
14806 @file{stderr}:
14807
14808 @smallexample
14809 gcc -O3 -fopt-info
14810 @end smallexample
14811
14812 This example:
14813 @smallexample
14814 gcc -O3 -fopt-info-missed=missed.all
14815 @end smallexample
14816
14817 @noindent
14818 outputs missed optimization report from all the passes into
14819 @file{missed.all}, and this one:
14820
14821 @smallexample
14822 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14823 @end smallexample
14824
14825 @noindent
14826 prints information about missed optimization opportunities from
14827 vectorization passes on @file{stderr}.
14828 Note that @option{-fopt-info-vec-missed} is equivalent to
14829 @option{-fopt-info-missed-vec}. The order of the optimization group
14830 names and message types listed after @option{-fopt-info} does not matter.
14831
14832 As another example,
14833 @smallexample
14834 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14835 @end smallexample
14836
14837 @noindent
14838 outputs information about missed optimizations as well as
14839 optimized locations from all the inlining passes into
14840 @file{inline.txt}.
14841
14842 Finally, consider:
14843
14844 @smallexample
14845 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14846 @end smallexample
14847
14848 @noindent
14849 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14850 in conflict since only one output file is allowed. In this case, only
14851 the first option takes effect and the subsequent options are
14852 ignored. Thus only @file{vec.miss} is produced which contains
14853 dumps from the vectorizer about missed opportunities.
14854
14855 @item -fsave-optimization-record
14856 @opindex fsave-optimization-record
14857 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
14858 were performed, for those optimizations that support @option{-fopt-info}.
14859
14860 This option is experimental and the format of the data within the
14861 compressed JSON file is subject to change.
14862
14863 It is roughly equivalent to a machine-readable version of
14864 @option{-fopt-info-all}, as a collection of messages with source file,
14865 line number and column number, with the following additional data for
14866 each message:
14867
14868 @itemize @bullet
14869
14870 @item
14871 the execution count of the code being optimized, along with metadata about
14872 whether this was from actual profile data, or just an estimate, allowing
14873 consumers to prioritize messages by code hotness,
14874
14875 @item
14876 the function name of the code being optimized, where applicable,
14877
14878 @item
14879 the ``inlining chain'' for the code being optimized, so that when
14880 a function is inlined into several different places (which might
14881 themselves be inlined), the reader can distinguish between the copies,
14882
14883 @item
14884 objects identifying those parts of the message that refer to expressions,
14885 statements or symbol-table nodes, which of these categories they are, and,
14886 when available, their source code location,
14887
14888 @item
14889 the GCC pass that emitted the message, and
14890
14891 @item
14892 the location in GCC's own code from which the message was emitted
14893
14894 @end itemize
14895
14896 Additionally, some messages are logically nested within other
14897 messages, reflecting implementation details of the optimization
14898 passes.
14899
14900 @item -fsched-verbose=@var{n}
14901 @opindex fsched-verbose
14902 On targets that use instruction scheduling, this option controls the
14903 amount of debugging output the scheduler prints to the dump files.
14904
14905 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14906 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14907 For @var{n} greater than one, it also output basic block probabilities,
14908 detailed ready list information and unit/insn info. For @var{n} greater
14909 than two, it includes RTL at abort point, control-flow and regions info.
14910 And for @var{n} over four, @option{-fsched-verbose} also includes
14911 dependence info.
14912
14913
14914
14915 @item -fenable-@var{kind}-@var{pass}
14916 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14917 @opindex fdisable-
14918 @opindex fenable-
14919
14920 This is a set of options that are used to explicitly disable/enable
14921 optimization passes. These options are intended for use for debugging GCC.
14922 Compiler users should use regular options for enabling/disabling
14923 passes instead.
14924
14925 @table @gcctabopt
14926
14927 @item -fdisable-ipa-@var{pass}
14928 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14929 statically invoked in the compiler multiple times, the pass name should be
14930 appended with a sequential number starting from 1.
14931
14932 @item -fdisable-rtl-@var{pass}
14933 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14934 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14935 statically invoked in the compiler multiple times, the pass name should be
14936 appended with a sequential number starting from 1. @var{range-list} is a
14937 comma-separated list of function ranges or assembler names. Each range is a number
14938 pair separated by a colon. The range is inclusive in both ends. If the range
14939 is trivial, the number pair can be simplified as a single number. If the
14940 function's call graph node's @var{uid} falls within one of the specified ranges,
14941 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14942 function header of a dump file, and the pass names can be dumped by using
14943 option @option{-fdump-passes}.
14944
14945 @item -fdisable-tree-@var{pass}
14946 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14947 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14948 option arguments.
14949
14950 @item -fenable-ipa-@var{pass}
14951 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14952 statically invoked in the compiler multiple times, the pass name should be
14953 appended with a sequential number starting from 1.
14954
14955 @item -fenable-rtl-@var{pass}
14956 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14957 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14958 description and examples.
14959
14960 @item -fenable-tree-@var{pass}
14961 @itemx -fenable-tree-@var{pass}=@var{range-list}
14962 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14963 of option arguments.
14964
14965 @end table
14966
14967 Here are some examples showing uses of these options.
14968
14969 @smallexample
14970
14971 # disable ccp1 for all functions
14972 -fdisable-tree-ccp1
14973 # disable complete unroll for function whose cgraph node uid is 1
14974 -fenable-tree-cunroll=1
14975 # disable gcse2 for functions at the following ranges [1,1],
14976 # [300,400], and [400,1000]
14977 # disable gcse2 for functions foo and foo2
14978 -fdisable-rtl-gcse2=foo,foo2
14979 # disable early inlining
14980 -fdisable-tree-einline
14981 # disable ipa inlining
14982 -fdisable-ipa-inline
14983 # enable tree full unroll
14984 -fenable-tree-unroll
14985
14986 @end smallexample
14987
14988 @item -fchecking
14989 @itemx -fchecking=@var{n}
14990 @opindex fchecking
14991 @opindex fno-checking
14992 Enable internal consistency checking. The default depends on
14993 the compiler configuration. @option{-fchecking=2} enables further
14994 internal consistency checking that might affect code generation.
14995
14996 @item -frandom-seed=@var{string}
14997 @opindex frandom-seed
14998 This option provides a seed that GCC uses in place of
14999 random numbers in generating certain symbol names
15000 that have to be different in every compiled file. It is also used to
15001 place unique stamps in coverage data files and the object files that
15002 produce them. You can use the @option{-frandom-seed} option to produce
15003 reproducibly identical object files.
15004
15005 The @var{string} can either be a number (decimal, octal or hex) or an
15006 arbitrary string (in which case it's converted to a number by
15007 computing CRC32).
15008
15009 The @var{string} should be different for every file you compile.
15010
15011 @item -save-temps
15012 @itemx -save-temps=cwd
15013 @opindex save-temps
15014 Store the usual ``temporary'' intermediate files permanently; place them
15015 in the current directory and name them based on the source file. Thus,
15016 compiling @file{foo.c} with @option{-c -save-temps} produces files
15017 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15018 preprocessed @file{foo.i} output file even though the compiler now
15019 normally uses an integrated preprocessor.
15020
15021 When used in combination with the @option{-x} command-line option,
15022 @option{-save-temps} is sensible enough to avoid over writing an
15023 input source file with the same extension as an intermediate file.
15024 The corresponding intermediate file may be obtained by renaming the
15025 source file before using @option{-save-temps}.
15026
15027 If you invoke GCC in parallel, compiling several different source
15028 files that share a common base name in different subdirectories or the
15029 same source file compiled for multiple output destinations, it is
15030 likely that the different parallel compilers will interfere with each
15031 other, and overwrite the temporary files. For instance:
15032
15033 @smallexample
15034 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15035 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15036 @end smallexample
15037
15038 may result in @file{foo.i} and @file{foo.o} being written to
15039 simultaneously by both compilers.
15040
15041 @item -save-temps=obj
15042 @opindex save-temps=obj
15043 Store the usual ``temporary'' intermediate files permanently. If the
15044 @option{-o} option is used, the temporary files are based on the
15045 object file. If the @option{-o} option is not used, the
15046 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15047
15048 For example:
15049
15050 @smallexample
15051 gcc -save-temps=obj -c foo.c
15052 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15053 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15054 @end smallexample
15055
15056 @noindent
15057 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15058 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15059 @file{dir2/yfoobar.o}.
15060
15061 @item -time@r{[}=@var{file}@r{]}
15062 @opindex time
15063 Report the CPU time taken by each subprocess in the compilation
15064 sequence. For C source files, this is the compiler proper and assembler
15065 (plus the linker if linking is done).
15066
15067 Without the specification of an output file, the output looks like this:
15068
15069 @smallexample
15070 # cc1 0.12 0.01
15071 # as 0.00 0.01
15072 @end smallexample
15073
15074 The first number on each line is the ``user time'', that is time spent
15075 executing the program itself. The second number is ``system time'',
15076 time spent executing operating system routines on behalf of the program.
15077 Both numbers are in seconds.
15078
15079 With the specification of an output file, the output is appended to the
15080 named file, and it looks like this:
15081
15082 @smallexample
15083 0.12 0.01 cc1 @var{options}
15084 0.00 0.01 as @var{options}
15085 @end smallexample
15086
15087 The ``user time'' and the ``system time'' are moved before the program
15088 name, and the options passed to the program are displayed, so that one
15089 can later tell what file was being compiled, and with which options.
15090
15091 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15092 @opindex fdump-final-insns
15093 Dump the final internal representation (RTL) to @var{file}. If the
15094 optional argument is omitted (or if @var{file} is @code{.}), the name
15095 of the dump file is determined by appending @code{.gkd} to the
15096 compilation output file name.
15097
15098 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15099 @opindex fcompare-debug
15100 @opindex fno-compare-debug
15101 If no error occurs during compilation, run the compiler a second time,
15102 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15103 passed to the second compilation. Dump the final internal
15104 representation in both compilations, and print an error if they differ.
15105
15106 If the equal sign is omitted, the default @option{-gtoggle} is used.
15107
15108 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15109 and nonzero, implicitly enables @option{-fcompare-debug}. If
15110 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15111 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15112 is used.
15113
15114 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15115 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15116 of the final representation and the second compilation, preventing even
15117 @env{GCC_COMPARE_DEBUG} from taking effect.
15118
15119 To verify full coverage during @option{-fcompare-debug} testing, set
15120 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15121 which GCC rejects as an invalid option in any actual compilation
15122 (rather than preprocessing, assembly or linking). To get just a
15123 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15124 not overridden} will do.
15125
15126 @item -fcompare-debug-second
15127 @opindex fcompare-debug-second
15128 This option is implicitly passed to the compiler for the second
15129 compilation requested by @option{-fcompare-debug}, along with options to
15130 silence warnings, and omitting other options that would cause the compiler
15131 to produce output to files or to standard output as a side effect. Dump
15132 files and preserved temporary files are renamed so as to contain the
15133 @code{.gk} additional extension during the second compilation, to avoid
15134 overwriting those generated by the first.
15135
15136 When this option is passed to the compiler driver, it causes the
15137 @emph{first} compilation to be skipped, which makes it useful for little
15138 other than debugging the compiler proper.
15139
15140 @item -gtoggle
15141 @opindex gtoggle
15142 Turn off generation of debug info, if leaving out this option
15143 generates it, or turn it on at level 2 otherwise. The position of this
15144 argument in the command line does not matter; it takes effect after all
15145 other options are processed, and it does so only once, no matter how
15146 many times it is given. This is mainly intended to be used with
15147 @option{-fcompare-debug}.
15148
15149 @item -fvar-tracking-assignments-toggle
15150 @opindex fvar-tracking-assignments-toggle
15151 @opindex fno-var-tracking-assignments-toggle
15152 Toggle @option{-fvar-tracking-assignments}, in the same way that
15153 @option{-gtoggle} toggles @option{-g}.
15154
15155 @item -Q
15156 @opindex Q
15157 Makes the compiler print out each function name as it is compiled, and
15158 print some statistics about each pass when it finishes.
15159
15160 @item -ftime-report
15161 @opindex ftime-report
15162 Makes the compiler print some statistics about the time consumed by each
15163 pass when it finishes.
15164
15165 @item -ftime-report-details
15166 @opindex ftime-report-details
15167 Record the time consumed by infrastructure parts separately for each pass.
15168
15169 @item -fira-verbose=@var{n}
15170 @opindex fira-verbose
15171 Control the verbosity of the dump file for the integrated register allocator.
15172 The default value is 5. If the value @var{n} is greater or equal to 10,
15173 the dump output is sent to stderr using the same format as @var{n} minus 10.
15174
15175 @item -flto-report
15176 @opindex flto-report
15177 Prints a report with internal details on the workings of the link-time
15178 optimizer. The contents of this report vary from version to version.
15179 It is meant to be useful to GCC developers when processing object
15180 files in LTO mode (via @option{-flto}).
15181
15182 Disabled by default.
15183
15184 @item -flto-report-wpa
15185 @opindex flto-report-wpa
15186 Like @option{-flto-report}, but only print for the WPA phase of Link
15187 Time Optimization.
15188
15189 @item -fmem-report
15190 @opindex fmem-report
15191 Makes the compiler print some statistics about permanent memory
15192 allocation when it finishes.
15193
15194 @item -fmem-report-wpa
15195 @opindex fmem-report-wpa
15196 Makes the compiler print some statistics about permanent memory
15197 allocation for the WPA phase only.
15198
15199 @item -fpre-ipa-mem-report
15200 @opindex fpre-ipa-mem-report
15201 @item -fpost-ipa-mem-report
15202 @opindex fpost-ipa-mem-report
15203 Makes the compiler print some statistics about permanent memory
15204 allocation before or after interprocedural optimization.
15205
15206 @item -fprofile-report
15207 @opindex fprofile-report
15208 Makes the compiler print some statistics about consistency of the
15209 (estimated) profile and effect of individual passes.
15210
15211 @item -fstack-usage
15212 @opindex fstack-usage
15213 Makes the compiler output stack usage information for the program, on a
15214 per-function basis. The filename for the dump is made by appending
15215 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15216 the output file, if explicitly specified and it is not an executable,
15217 otherwise it is the basename of the source file. An entry is made up
15218 of three fields:
15219
15220 @itemize
15221 @item
15222 The name of the function.
15223 @item
15224 A number of bytes.
15225 @item
15226 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15227 @end itemize
15228
15229 The qualifier @code{static} means that the function manipulates the stack
15230 statically: a fixed number of bytes are allocated for the frame on function
15231 entry and released on function exit; no stack adjustments are otherwise made
15232 in the function. The second field is this fixed number of bytes.
15233
15234 The qualifier @code{dynamic} means that the function manipulates the stack
15235 dynamically: in addition to the static allocation described above, stack
15236 adjustments are made in the body of the function, for example to push/pop
15237 arguments around function calls. If the qualifier @code{bounded} is also
15238 present, the amount of these adjustments is bounded at compile time and
15239 the second field is an upper bound of the total amount of stack used by
15240 the function. If it is not present, the amount of these adjustments is
15241 not bounded at compile time and the second field only represents the
15242 bounded part.
15243
15244 @item -fstats
15245 @opindex fstats
15246 Emit statistics about front-end processing at the end of the compilation.
15247 This option is supported only by the C++ front end, and
15248 the information is generally only useful to the G++ development team.
15249
15250 @item -fdbg-cnt-list
15251 @opindex fdbg-cnt-list
15252 Print the name and the counter upper bound for all debug counters.
15253
15254
15255 @item -fdbg-cnt=@var{counter-value-list}
15256 @opindex fdbg-cnt
15257 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15258 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15259 tuples which sets the lower and the upper bound of each debug
15260 counter @var{name}. The @var{lower_bound} is optional and is zero
15261 initialized if not set.
15262 All debug counters have the initial upper bound of @code{UINT_MAX};
15263 thus @code{dbg_cnt} returns true always unless the upper bound
15264 is set by this option.
15265 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15266 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15267 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15268
15269 @item -print-file-name=@var{library}
15270 @opindex print-file-name
15271 Print the full absolute name of the library file @var{library} that
15272 would be used when linking---and don't do anything else. With this
15273 option, GCC does not compile or link anything; it just prints the
15274 file name.
15275
15276 @item -print-multi-directory
15277 @opindex print-multi-directory
15278 Print the directory name corresponding to the multilib selected by any
15279 other switches present in the command line. This directory is supposed
15280 to exist in @env{GCC_EXEC_PREFIX}.
15281
15282 @item -print-multi-lib
15283 @opindex print-multi-lib
15284 Print the mapping from multilib directory names to compiler switches
15285 that enable them. The directory name is separated from the switches by
15286 @samp{;}, and each switch starts with an @samp{@@} instead of the
15287 @samp{-}, without spaces between multiple switches. This is supposed to
15288 ease shell processing.
15289
15290 @item -print-multi-os-directory
15291 @opindex print-multi-os-directory
15292 Print the path to OS libraries for the selected
15293 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15294 present in the @file{lib} subdirectory and no multilibs are used, this is
15295 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15296 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15297 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15298 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15299
15300 @item -print-multiarch
15301 @opindex print-multiarch
15302 Print the path to OS libraries for the selected multiarch,
15303 relative to some @file{lib} subdirectory.
15304
15305 @item -print-prog-name=@var{program}
15306 @opindex print-prog-name
15307 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15308
15309 @item -print-libgcc-file-name
15310 @opindex print-libgcc-file-name
15311 Same as @option{-print-file-name=libgcc.a}.
15312
15313 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15314 but you do want to link with @file{libgcc.a}. You can do:
15315
15316 @smallexample
15317 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15318 @end smallexample
15319
15320 @item -print-search-dirs
15321 @opindex print-search-dirs
15322 Print the name of the configured installation directory and a list of
15323 program and library directories @command{gcc} searches---and don't do anything else.
15324
15325 This is useful when @command{gcc} prints the error message
15326 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15327 To resolve this you either need to put @file{cpp0} and the other compiler
15328 components where @command{gcc} expects to find them, or you can set the environment
15329 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15330 Don't forget the trailing @samp{/}.
15331 @xref{Environment Variables}.
15332
15333 @item -print-sysroot
15334 @opindex print-sysroot
15335 Print the target sysroot directory that is used during
15336 compilation. This is the target sysroot specified either at configure
15337 time or using the @option{--sysroot} option, possibly with an extra
15338 suffix that depends on compilation options. If no target sysroot is
15339 specified, the option prints nothing.
15340
15341 @item -print-sysroot-headers-suffix
15342 @opindex print-sysroot-headers-suffix
15343 Print the suffix added to the target sysroot when searching for
15344 headers, or give an error if the compiler is not configured with such
15345 a suffix---and don't do anything else.
15346
15347 @item -dumpmachine
15348 @opindex dumpmachine
15349 Print the compiler's target machine (for example,
15350 @samp{i686-pc-linux-gnu})---and don't do anything else.
15351
15352 @item -dumpversion
15353 @opindex dumpversion
15354 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15355 anything else. This is the compiler version used in filesystem paths and
15356 specs. Depending on how the compiler has been configured it can be just
15357 a single number (major version), two numbers separated by a dot (major and
15358 minor version) or three numbers separated by dots (major, minor and patchlevel
15359 version).
15360
15361 @item -dumpfullversion
15362 @opindex dumpfullversion
15363 Print the full compiler version---and don't do anything else. The output is
15364 always three numbers separated by dots, major, minor and patchlevel version.
15365
15366 @item -dumpspecs
15367 @opindex dumpspecs
15368 Print the compiler's built-in specs---and don't do anything else. (This
15369 is used when GCC itself is being built.) @xref{Spec Files}.
15370 @end table
15371
15372 @node Submodel Options
15373 @section Machine-Dependent Options
15374 @cindex submodel options
15375 @cindex specifying hardware config
15376 @cindex hardware models and configurations, specifying
15377 @cindex target-dependent options
15378 @cindex machine-dependent options
15379
15380 Each target machine supported by GCC can have its own options---for
15381 example, to allow you to compile for a particular processor variant or
15382 ABI, or to control optimizations specific to that machine. By
15383 convention, the names of machine-specific options start with
15384 @samp{-m}.
15385
15386 Some configurations of the compiler also support additional target-specific
15387 options, usually for compatibility with other compilers on the same
15388 platform.
15389
15390 @c This list is ordered alphanumerically by subsection name.
15391 @c It should be the same order and spelling as these options are listed
15392 @c in Machine Dependent Options
15393
15394 @menu
15395 * AArch64 Options::
15396 * Adapteva Epiphany Options::
15397 * ARC Options::
15398 * ARM Options::
15399 * AVR Options::
15400 * Blackfin Options::
15401 * C6X Options::
15402 * CRIS Options::
15403 * CR16 Options::
15404 * C-SKY Options::
15405 * Darwin Options::
15406 * DEC Alpha Options::
15407 * FR30 Options::
15408 * FT32 Options::
15409 * FRV Options::
15410 * GNU/Linux Options::
15411 * H8/300 Options::
15412 * HPPA Options::
15413 * IA-64 Options::
15414 * LM32 Options::
15415 * M32C Options::
15416 * M32R/D Options::
15417 * M680x0 Options::
15418 * MCore Options::
15419 * MeP Options::
15420 * MicroBlaze Options::
15421 * MIPS Options::
15422 * MMIX Options::
15423 * MN10300 Options::
15424 * Moxie Options::
15425 * MSP430 Options::
15426 * NDS32 Options::
15427 * Nios II Options::
15428 * Nvidia PTX Options::
15429 * OpenRISC Options::
15430 * PDP-11 Options::
15431 * picoChip Options::
15432 * PowerPC Options::
15433 * RISC-V Options::
15434 * RL78 Options::
15435 * RS/6000 and PowerPC Options::
15436 * RX Options::
15437 * S/390 and zSeries Options::
15438 * Score Options::
15439 * SH Options::
15440 * Solaris 2 Options::
15441 * SPARC Options::
15442 * SPU Options::
15443 * System V Options::
15444 * TILE-Gx Options::
15445 * TILEPro Options::
15446 * V850 Options::
15447 * VAX Options::
15448 * Visium Options::
15449 * VMS Options::
15450 * VxWorks Options::
15451 * x86 Options::
15452 * x86 Windows Options::
15453 * Xstormy16 Options::
15454 * Xtensa Options::
15455 * zSeries Options::
15456 @end menu
15457
15458 @node AArch64 Options
15459 @subsection AArch64 Options
15460 @cindex AArch64 Options
15461
15462 These options are defined for AArch64 implementations:
15463
15464 @table @gcctabopt
15465
15466 @item -mabi=@var{name}
15467 @opindex mabi
15468 Generate code for the specified data model. Permissible values
15469 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15470 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15471 but long int and pointers are 64 bits.
15472
15473 The default depends on the specific target configuration. Note that
15474 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15475 entire program with the same ABI, and link with a compatible set of libraries.
15476
15477 @item -mbig-endian
15478 @opindex mbig-endian
15479 Generate big-endian code. This is the default when GCC is configured for an
15480 @samp{aarch64_be-*-*} target.
15481
15482 @item -mgeneral-regs-only
15483 @opindex mgeneral-regs-only
15484 Generate code which uses only the general-purpose registers. This will prevent
15485 the compiler from using floating-point and Advanced SIMD registers but will not
15486 impose any restrictions on the assembler.
15487
15488 @item -mlittle-endian
15489 @opindex mlittle-endian
15490 Generate little-endian code. This is the default when GCC is configured for an
15491 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15492
15493 @item -mcmodel=tiny
15494 @opindex mcmodel=tiny
15495 Generate code for the tiny code model. The program and its statically defined
15496 symbols must be within 1MB of each other. Programs can be statically or
15497 dynamically linked.
15498
15499 @item -mcmodel=small
15500 @opindex mcmodel=small
15501 Generate code for the small code model. The program and its statically defined
15502 symbols must be within 4GB of each other. Programs can be statically or
15503 dynamically linked. This is the default code model.
15504
15505 @item -mcmodel=large
15506 @opindex mcmodel=large
15507 Generate code for the large code model. This makes no assumptions about
15508 addresses and sizes of sections. Programs can be statically linked only.
15509
15510 @item -mstrict-align
15511 @itemx -mno-strict-align
15512 @opindex mstrict-align
15513 @opindex mno-strict-align
15514 Avoid or allow generating memory accesses that may not be aligned on a natural
15515 object boundary as described in the architecture specification.
15516
15517 @item -momit-leaf-frame-pointer
15518 @itemx -mno-omit-leaf-frame-pointer
15519 @opindex momit-leaf-frame-pointer
15520 @opindex mno-omit-leaf-frame-pointer
15521 Omit or keep the frame pointer in leaf functions. The former behavior is the
15522 default.
15523
15524 @item -mtls-dialect=desc
15525 @opindex mtls-dialect=desc
15526 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15527 of TLS variables. This is the default.
15528
15529 @item -mtls-dialect=traditional
15530 @opindex mtls-dialect=traditional
15531 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15532 of TLS variables.
15533
15534 @item -mtls-size=@var{size}
15535 @opindex mtls-size
15536 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15537 This option requires binutils 2.26 or newer.
15538
15539 @item -mfix-cortex-a53-835769
15540 @itemx -mno-fix-cortex-a53-835769
15541 @opindex mfix-cortex-a53-835769
15542 @opindex mno-fix-cortex-a53-835769
15543 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15544 This involves inserting a NOP instruction between memory instructions and
15545 64-bit integer multiply-accumulate instructions.
15546
15547 @item -mfix-cortex-a53-843419
15548 @itemx -mno-fix-cortex-a53-843419
15549 @opindex mfix-cortex-a53-843419
15550 @opindex mno-fix-cortex-a53-843419
15551 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15552 This erratum workaround is made at link time and this will only pass the
15553 corresponding flag to the linker.
15554
15555 @item -mlow-precision-recip-sqrt
15556 @itemx -mno-low-precision-recip-sqrt
15557 @opindex mlow-precision-recip-sqrt
15558 @opindex mno-low-precision-recip-sqrt
15559 Enable or disable the reciprocal square root approximation.
15560 This option only has an effect if @option{-ffast-math} or
15561 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15562 precision of reciprocal square root results to about 16 bits for
15563 single precision and to 32 bits for double precision.
15564
15565 @item -mlow-precision-sqrt
15566 @itemx -mno-low-precision-sqrt
15567 @opindex mlow-precision-sqrt
15568 @opindex mno-low-precision-sqrt
15569 Enable or disable the square root approximation.
15570 This option only has an effect if @option{-ffast-math} or
15571 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15572 precision of square root results to about 16 bits for
15573 single precision and to 32 bits for double precision.
15574 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15575
15576 @item -mlow-precision-div
15577 @itemx -mno-low-precision-div
15578 @opindex mlow-precision-div
15579 @opindex mno-low-precision-div
15580 Enable or disable the division approximation.
15581 This option only has an effect if @option{-ffast-math} or
15582 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15583 precision of division results to about 16 bits for
15584 single precision and to 32 bits for double precision.
15585
15586 @item -mtrack-speculation
15587 @itemx -mno-track-speculation
15588 Enable or disable generation of additional code to track speculative
15589 execution through conditional branches. The tracking state can then
15590 be used by the compiler when expanding calls to
15591 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15592 sequence to be generated.
15593
15594 @item -march=@var{name}
15595 @opindex march
15596 Specify the name of the target architecture and, optionally, one or
15597 more feature modifiers. This option has the form
15598 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15599
15600 The permissible values for @var{arch} are @samp{armv8-a},
15601 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15602 or @var{native}.
15603
15604 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15605 support for the ARMv8.4-A architecture extensions.
15606
15607 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15608 support for the ARMv8.3-A architecture extensions.
15609
15610 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15611 support for the ARMv8.2-A architecture extensions.
15612
15613 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15614 support for the ARMv8.1-A architecture extension. In particular, it
15615 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15616
15617 The value @samp{native} is available on native AArch64 GNU/Linux and
15618 causes the compiler to pick the architecture of the host system. This
15619 option has no effect if the compiler is unable to recognize the
15620 architecture of the host system,
15621
15622 The permissible values for @var{feature} are listed in the sub-section
15623 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15624 Feature Modifiers}. Where conflicting feature modifiers are
15625 specified, the right-most feature is used.
15626
15627 GCC uses @var{name} to determine what kind of instructions it can emit
15628 when generating assembly code. If @option{-march} is specified
15629 without either of @option{-mtune} or @option{-mcpu} also being
15630 specified, the code is tuned to perform well across a range of target
15631 processors implementing the target architecture.
15632
15633 @item -mtune=@var{name}
15634 @opindex mtune
15635 Specify the name of the target processor for which GCC should tune the
15636 performance of the code. Permissible values for this option are:
15637 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15638 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15639 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15640 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15641 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
15642 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15643 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15644 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15645 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15646 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15647 @samp{native}.
15648
15649 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15650 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15651 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15652 should tune for a big.LITTLE system.
15653
15654 Additionally on native AArch64 GNU/Linux systems the value
15655 @samp{native} tunes performance to the host system. This option has no effect
15656 if the compiler is unable to recognize the processor of the host system.
15657
15658 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15659 are specified, the code is tuned to perform well across a range
15660 of target processors.
15661
15662 This option cannot be suffixed by feature modifiers.
15663
15664 @item -mcpu=@var{name}
15665 @opindex mcpu
15666 Specify the name of the target processor, optionally suffixed by one
15667 or more feature modifiers. This option has the form
15668 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15669 the permissible values for @var{cpu} are the same as those available
15670 for @option{-mtune}. The permissible values for @var{feature} are
15671 documented in the sub-section on
15672 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15673 Feature Modifiers}. Where conflicting feature modifiers are
15674 specified, the right-most feature is used.
15675
15676 GCC uses @var{name} to determine what kind of instructions it can emit when
15677 generating assembly code (as if by @option{-march}) and to determine
15678 the target processor for which to tune for performance (as if
15679 by @option{-mtune}). Where this option is used in conjunction
15680 with @option{-march} or @option{-mtune}, those options take precedence
15681 over the appropriate part of this option.
15682
15683 @item -moverride=@var{string}
15684 @opindex moverride
15685 Override tuning decisions made by the back-end in response to a
15686 @option{-mtune=} switch. The syntax, semantics, and accepted values
15687 for @var{string} in this option are not guaranteed to be consistent
15688 across releases.
15689
15690 This option is only intended to be useful when developing GCC.
15691
15692 @item -mverbose-cost-dump
15693 @opindex mverbose-cost-dump
15694 Enable verbose cost model dumping in the debug dump files. This option is
15695 provided for use in debugging the compiler.
15696
15697 @item -mpc-relative-literal-loads
15698 @itemx -mno-pc-relative-literal-loads
15699 @opindex mpc-relative-literal-loads
15700 @opindex mno-pc-relative-literal-loads
15701 Enable or disable PC-relative literal loads. With this option literal pools are
15702 accessed using a single instruction and emitted after each function. This
15703 limits the maximum size of functions to 1MB. This is enabled by default for
15704 @option{-mcmodel=tiny}.
15705
15706 @item -msign-return-address=@var{scope}
15707 @opindex msign-return-address
15708 Select the function scope on which return address signing will be applied.
15709 Permissible values are @samp{none}, which disables return address signing,
15710 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15711 functions, and @samp{all}, which enables pointer signing for all functions. The
15712 default value is @samp{none}.
15713
15714 @item -msve-vector-bits=@var{bits}
15715 @opindex msve-vector-bits
15716 Specify the number of bits in an SVE vector register. This option only has
15717 an effect when SVE is enabled.
15718
15719 GCC supports two forms of SVE code generation: ``vector-length
15720 agnostic'' output that works with any size of vector register and
15721 ``vector-length specific'' output that allows GCC to make assumptions
15722 about the vector length when it is useful for optimization reasons.
15723 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15724 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15725 Specifying @samp{scalable} selects vector-length agnostic
15726 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15727 agnostic output. All other values generate vector-length specific code.
15728 The behavior of these values may change in future releases and no value except
15729 @samp{scalable} should be relied on for producing code that is portable across
15730 different hardware SVE vector lengths.
15731
15732 The default is @samp{-msve-vector-bits=scalable}, which produces
15733 vector-length agnostic code.
15734 @end table
15735
15736 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15737 @anchor{aarch64-feature-modifiers}
15738 @cindex @option{-march} feature modifiers
15739 @cindex @option{-mcpu} feature modifiers
15740 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15741 the following and their inverses @option{no@var{feature}}:
15742
15743 @table @samp
15744 @item crc
15745 Enable CRC extension. This is on by default for
15746 @option{-march=armv8.1-a}.
15747 @item crypto
15748 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15749 instructions.
15750 @item fp
15751 Enable floating-point instructions. This is on by default for all possible
15752 values for options @option{-march} and @option{-mcpu}.
15753 @item simd
15754 Enable Advanced SIMD instructions. This also enables floating-point
15755 instructions. This is on by default for all possible values for options
15756 @option{-march} and @option{-mcpu}.
15757 @item sve
15758 Enable Scalable Vector Extension instructions. This also enables Advanced
15759 SIMD and floating-point instructions.
15760 @item lse
15761 Enable Large System Extension instructions. This is on by default for
15762 @option{-march=armv8.1-a}.
15763 @item rdma
15764 Enable Round Double Multiply Accumulate instructions. This is on by default
15765 for @option{-march=armv8.1-a}.
15766 @item fp16
15767 Enable FP16 extension. This also enables floating-point instructions.
15768 @item fp16fml
15769 Enable FP16 fmla extension. This also enables FP16 extensions and
15770 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.
15771
15772 @item rcpc
15773 Enable the RcPc extension. This does not change code generation from GCC,
15774 but is passed on to the assembler, enabling inline asm statements to use
15775 instructions from the RcPc extension.
15776 @item dotprod
15777 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15778 @item aes
15779 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15780 SIMD instructions.
15781 @item sha2
15782 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15783 @item sha3
15784 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15785 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15786 @item sm4
15787 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15788 Use of this option with architectures prior to Armv8.2-A is not supported.
15789 @item profile
15790 Enable the Statistical Profiling extension. This option is only to enable the
15791 extension at the assembler level and does not affect code generation.
15792
15793 @end table
15794
15795 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15796 which implies @option{fp}.
15797 Conversely, @option{nofp} implies @option{nosimd}, which implies
15798 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15799
15800 @node Adapteva Epiphany Options
15801 @subsection Adapteva Epiphany Options
15802
15803 These @samp{-m} options are defined for Adapteva Epiphany:
15804
15805 @table @gcctabopt
15806 @item -mhalf-reg-file
15807 @opindex mhalf-reg-file
15808 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15809 That allows code to run on hardware variants that lack these registers.
15810
15811 @item -mprefer-short-insn-regs
15812 @opindex mprefer-short-insn-regs
15813 Preferentially allocate registers that allow short instruction generation.
15814 This can result in increased instruction count, so this may either reduce or
15815 increase overall code size.
15816
15817 @item -mbranch-cost=@var{num}
15818 @opindex mbranch-cost
15819 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15820 This cost is only a heuristic and is not guaranteed to produce
15821 consistent results across releases.
15822
15823 @item -mcmove
15824 @opindex mcmove
15825 Enable the generation of conditional moves.
15826
15827 @item -mnops=@var{num}
15828 @opindex mnops
15829 Emit @var{num} NOPs before every other generated instruction.
15830
15831 @item -mno-soft-cmpsf
15832 @opindex mno-soft-cmpsf
15833 @opindex msoft-cmpsf
15834 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15835 and test the flags. This is faster than a software comparison, but can
15836 get incorrect results in the presence of NaNs, or when two different small
15837 numbers are compared such that their difference is calculated as zero.
15838 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15839 software comparisons.
15840
15841 @item -mstack-offset=@var{num}
15842 @opindex mstack-offset
15843 Set the offset between the top of the stack and the stack pointer.
15844 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15845 can be used by leaf functions without stack allocation.
15846 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15847 Note also that this option changes the ABI; compiling a program with a
15848 different stack offset than the libraries have been compiled with
15849 generally does not work.
15850 This option can be useful if you want to evaluate if a different stack
15851 offset would give you better code, but to actually use a different stack
15852 offset to build working programs, it is recommended to configure the
15853 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15854
15855 @item -mno-round-nearest
15856 @opindex mno-round-nearest
15857 @opindex mround-nearest
15858 Make the scheduler assume that the rounding mode has been set to
15859 truncating. The default is @option{-mround-nearest}.
15860
15861 @item -mlong-calls
15862 @opindex mlong-calls
15863 If not otherwise specified by an attribute, assume all calls might be beyond
15864 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15865 function address into a register before performing a (otherwise direct) call.
15866 This is the default.
15867
15868 @item -mshort-calls
15869 @opindex short-calls
15870 If not otherwise specified by an attribute, assume all direct calls are
15871 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15872 for direct calls. The default is @option{-mlong-calls}.
15873
15874 @item -msmall16
15875 @opindex msmall16
15876 Assume addresses can be loaded as 16-bit unsigned values. This does not
15877 apply to function addresses for which @option{-mlong-calls} semantics
15878 are in effect.
15879
15880 @item -mfp-mode=@var{mode}
15881 @opindex mfp-mode
15882 Set the prevailing mode of the floating-point unit.
15883 This determines the floating-point mode that is provided and expected
15884 at function call and return time. Making this mode match the mode you
15885 predominantly need at function start can make your programs smaller and
15886 faster by avoiding unnecessary mode switches.
15887
15888 @var{mode} can be set to one the following values:
15889
15890 @table @samp
15891 @item caller
15892 Any mode at function entry is valid, and retained or restored when
15893 the function returns, and when it calls other functions.
15894 This mode is useful for compiling libraries or other compilation units
15895 you might want to incorporate into different programs with different
15896 prevailing FPU modes, and the convenience of being able to use a single
15897 object file outweighs the size and speed overhead for any extra
15898 mode switching that might be needed, compared with what would be needed
15899 with a more specific choice of prevailing FPU mode.
15900
15901 @item truncate
15902 This is the mode used for floating-point calculations with
15903 truncating (i.e.@: round towards zero) rounding mode. That includes
15904 conversion from floating point to integer.
15905
15906 @item round-nearest
15907 This is the mode used for floating-point calculations with
15908 round-to-nearest-or-even rounding mode.
15909
15910 @item int
15911 This is the mode used to perform integer calculations in the FPU, e.g.@:
15912 integer multiply, or integer multiply-and-accumulate.
15913 @end table
15914
15915 The default is @option{-mfp-mode=caller}
15916
15917 @item -mno-split-lohi
15918 @itemx -mno-postinc
15919 @itemx -mno-postmodify
15920 @opindex mno-split-lohi
15921 @opindex msplit-lohi
15922 @opindex mno-postinc
15923 @opindex mpostinc
15924 @opindex mno-postmodify
15925 @opindex mpostmodify
15926 Code generation tweaks that disable, respectively, splitting of 32-bit
15927 loads, generation of post-increment addresses, and generation of
15928 post-modify addresses. The defaults are @option{msplit-lohi},
15929 @option{-mpost-inc}, and @option{-mpost-modify}.
15930
15931 @item -mnovect-double
15932 @opindex mno-vect-double
15933 @opindex mvect-double
15934 Change the preferred SIMD mode to SImode. The default is
15935 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15936
15937 @item -max-vect-align=@var{num}
15938 @opindex max-vect-align
15939 The maximum alignment for SIMD vector mode types.
15940 @var{num} may be 4 or 8. The default is 8.
15941 Note that this is an ABI change, even though many library function
15942 interfaces are unaffected if they don't use SIMD vector modes
15943 in places that affect size and/or alignment of relevant types.
15944
15945 @item -msplit-vecmove-early
15946 @opindex msplit-vecmove-early
15947 Split vector moves into single word moves before reload. In theory this
15948 can give better register allocation, but so far the reverse seems to be
15949 generally the case.
15950
15951 @item -m1reg-@var{reg}
15952 @opindex m1reg-
15953 Specify a register to hold the constant @minus{}1, which makes loading small negative
15954 constants and certain bitmasks faster.
15955 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15956 which specify use of that register as a fixed register,
15957 and @samp{none}, which means that no register is used for this
15958 purpose. The default is @option{-m1reg-none}.
15959
15960 @end table
15961
15962 @node ARC Options
15963 @subsection ARC Options
15964 @cindex ARC options
15965
15966 The following options control the architecture variant for which code
15967 is being compiled:
15968
15969 @c architecture variants
15970 @table @gcctabopt
15971
15972 @item -mbarrel-shifter
15973 @opindex mbarrel-shifter
15974 Generate instructions supported by barrel shifter. This is the default
15975 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15976
15977 @item -mjli-always
15978 @opindex mjli-alawys
15979 Force to call a function using jli_s instruction. This option is
15980 valid only for ARCv2 architecture.
15981
15982 @item -mcpu=@var{cpu}
15983 @opindex mcpu
15984 Set architecture type, register usage, and instruction scheduling
15985 parameters for @var{cpu}. There are also shortcut alias options
15986 available for backward compatibility and convenience. Supported
15987 values for @var{cpu} are
15988
15989 @table @samp
15990 @opindex mA6
15991 @opindex mARC600
15992 @item arc600
15993 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15994
15995 @item arc601
15996 @opindex mARC601
15997 Compile for ARC601. Alias: @option{-mARC601}.
15998
15999 @item arc700
16000 @opindex mA7
16001 @opindex mARC700
16002 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16003 This is the default when configured with @option{--with-cpu=arc700}@.
16004
16005 @item arcem
16006 Compile for ARC EM.
16007
16008 @item archs
16009 Compile for ARC HS.
16010
16011 @item em
16012 Compile for ARC EM CPU with no hardware extensions.
16013
16014 @item em4
16015 Compile for ARC EM4 CPU.
16016
16017 @item em4_dmips
16018 Compile for ARC EM4 DMIPS CPU.
16019
16020 @item em4_fpus
16021 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16022 extension.
16023
16024 @item em4_fpuda
16025 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16026 double assist instructions.
16027
16028 @item hs
16029 Compile for ARC HS CPU with no hardware extensions except the atomic
16030 instructions.
16031
16032 @item hs34
16033 Compile for ARC HS34 CPU.
16034
16035 @item hs38
16036 Compile for ARC HS38 CPU.
16037
16038 @item hs38_linux
16039 Compile for ARC HS38 CPU with all hardware extensions on.
16040
16041 @item arc600_norm
16042 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16043
16044 @item arc600_mul32x16
16045 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16046 instructions enabled.
16047
16048 @item arc600_mul64
16049 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16050 instructions enabled.
16051
16052 @item arc601_norm
16053 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16054
16055 @item arc601_mul32x16
16056 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16057 instructions enabled.
16058
16059 @item arc601_mul64
16060 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16061 instructions enabled.
16062
16063 @item nps400
16064 Compile for ARC 700 on NPS400 chip.
16065
16066 @item em_mini
16067 Compile for ARC EM minimalist configuration featuring reduced register
16068 set.
16069
16070 @end table
16071
16072 @item -mdpfp
16073 @opindex mdpfp
16074 @itemx -mdpfp-compact
16075 @opindex mdpfp-compact
16076 Generate double-precision FPX instructions, tuned for the compact
16077 implementation.
16078
16079 @item -mdpfp-fast
16080 @opindex mdpfp-fast
16081 Generate double-precision FPX instructions, tuned for the fast
16082 implementation.
16083
16084 @item -mno-dpfp-lrsr
16085 @opindex mno-dpfp-lrsr
16086 Disable @code{lr} and @code{sr} instructions from using FPX extension
16087 aux registers.
16088
16089 @item -mea
16090 @opindex mea
16091 Generate extended arithmetic instructions. Currently only
16092 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16093 supported. This is always enabled for @option{-mcpu=ARC700}.
16094
16095 @item -mno-mpy
16096 @opindex mno-mpy
16097 @opindex mmpy
16098 Do not generate @code{mpy}-family instructions for ARC700. This option is
16099 deprecated.
16100
16101 @item -mmul32x16
16102 @opindex mmul32x16
16103 Generate 32x16-bit multiply and multiply-accumulate instructions.
16104
16105 @item -mmul64
16106 @opindex mmul64
16107 Generate @code{mul64} and @code{mulu64} instructions.
16108 Only valid for @option{-mcpu=ARC600}.
16109
16110 @item -mnorm
16111 @opindex mnorm
16112 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16113 is in effect.
16114
16115 @item -mspfp
16116 @opindex mspfp
16117 @itemx -mspfp-compact
16118 @opindex mspfp-compact
16119 Generate single-precision FPX instructions, tuned for the compact
16120 implementation.
16121
16122 @item -mspfp-fast
16123 @opindex mspfp-fast
16124 Generate single-precision FPX instructions, tuned for the fast
16125 implementation.
16126
16127 @item -msimd
16128 @opindex msimd
16129 Enable generation of ARC SIMD instructions via target-specific
16130 builtins. Only valid for @option{-mcpu=ARC700}.
16131
16132 @item -msoft-float
16133 @opindex msoft-float
16134 This option ignored; it is provided for compatibility purposes only.
16135 Software floating-point code is emitted by default, and this default
16136 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16137 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16138 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16139
16140 @item -mswap
16141 @opindex mswap
16142 Generate @code{swap} instructions.
16143
16144 @item -matomic
16145 @opindex matomic
16146 This enables use of the locked load/store conditional extension to implement
16147 atomic memory built-in functions. Not available for ARC 6xx or ARC
16148 EM cores.
16149
16150 @item -mdiv-rem
16151 @opindex mdiv-rem
16152 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16153
16154 @item -mcode-density
16155 @opindex mcode-density
16156 Enable code density instructions for ARC EM.
16157 This option is on by default for ARC HS.
16158
16159 @item -mll64
16160 @opindex mll64
16161 Enable double load/store operations for ARC HS cores.
16162
16163 @item -mtp-regno=@var{regno}
16164 @opindex mtp-regno
16165 Specify thread pointer register number.
16166
16167 @item -mmpy-option=@var{multo}
16168 @opindex mmpy-option
16169 Compile ARCv2 code with a multiplier design option. You can specify
16170 the option using either a string or numeric value for @var{multo}.
16171 @samp{wlh1} is the default value. The recognized values are:
16172
16173 @table @samp
16174 @item 0
16175 @itemx none
16176 No multiplier available.
16177
16178 @item 1
16179 @itemx w
16180 16x16 multiplier, fully pipelined.
16181 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16182
16183 @item 2
16184 @itemx wlh1
16185 32x32 multiplier, fully
16186 pipelined (1 stage). The following instructions are additionally
16187 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16188
16189 @item 3
16190 @itemx wlh2
16191 32x32 multiplier, fully pipelined
16192 (2 stages). The following instructions are additionally enabled: @code{mpy},
16193 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16194
16195 @item 4
16196 @itemx wlh3
16197 Two 16x16 multipliers, blocking,
16198 sequential. The following instructions are additionally enabled: @code{mpy},
16199 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16200
16201 @item 5
16202 @itemx wlh4
16203 One 16x16 multiplier, blocking,
16204 sequential. The following instructions are additionally enabled: @code{mpy},
16205 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16206
16207 @item 6
16208 @itemx wlh5
16209 One 32x4 multiplier, blocking,
16210 sequential. The following instructions are additionally enabled: @code{mpy},
16211 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16212
16213 @item 7
16214 @itemx plus_dmpy
16215 ARC HS SIMD support.
16216
16217 @item 8
16218 @itemx plus_macd
16219 ARC HS SIMD support.
16220
16221 @item 9
16222 @itemx plus_qmacw
16223 ARC HS SIMD support.
16224
16225 @end table
16226
16227 This option is only available for ARCv2 cores@.
16228
16229 @item -mfpu=@var{fpu}
16230 @opindex mfpu
16231 Enables support for specific floating-point hardware extensions for ARCv2
16232 cores. Supported values for @var{fpu} are:
16233
16234 @table @samp
16235
16236 @item fpus
16237 Enables support for single-precision floating-point hardware
16238 extensions@.
16239
16240 @item fpud
16241 Enables support for double-precision floating-point hardware
16242 extensions. The single-precision floating-point extension is also
16243 enabled. Not available for ARC EM@.
16244
16245 @item fpuda
16246 Enables support for double-precision floating-point hardware
16247 extensions using double-precision assist instructions. The single-precision
16248 floating-point extension is also enabled. This option is
16249 only available for ARC EM@.
16250
16251 @item fpuda_div
16252 Enables support for double-precision floating-point hardware
16253 extensions using double-precision assist instructions.
16254 The single-precision floating-point, square-root, and divide
16255 extensions are also enabled. This option is
16256 only available for ARC EM@.
16257
16258 @item fpuda_fma
16259 Enables support for double-precision floating-point hardware
16260 extensions using double-precision assist instructions.
16261 The single-precision floating-point and fused multiply and add
16262 hardware extensions are also enabled. This option is
16263 only available for ARC EM@.
16264
16265 @item fpuda_all
16266 Enables support for double-precision floating-point hardware
16267 extensions using double-precision assist instructions.
16268 All single-precision floating-point hardware extensions are also
16269 enabled. This option is only available for ARC EM@.
16270
16271 @item fpus_div
16272 Enables support for single-precision floating-point, square-root and divide
16273 hardware extensions@.
16274
16275 @item fpud_div
16276 Enables support for double-precision floating-point, square-root and divide
16277 hardware extensions. This option
16278 includes option @samp{fpus_div}. Not available for ARC EM@.
16279
16280 @item fpus_fma
16281 Enables support for single-precision floating-point and
16282 fused multiply and add hardware extensions@.
16283
16284 @item fpud_fma
16285 Enables support for double-precision floating-point and
16286 fused multiply and add hardware extensions. This option
16287 includes option @samp{fpus_fma}. Not available for ARC EM@.
16288
16289 @item fpus_all
16290 Enables support for all single-precision floating-point hardware
16291 extensions@.
16292
16293 @item fpud_all
16294 Enables support for all single- and double-precision floating-point
16295 hardware extensions. Not available for ARC EM@.
16296
16297 @end table
16298
16299 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16300 @opindex mirq-ctrl-saved
16301 Specifies general-purposes registers that the processor automatically
16302 saves/restores on interrupt entry and exit. @var{register-range} is
16303 specified as two registers separated by a dash. The register range
16304 always starts with @code{r0}, the upper limit is @code{fp} register.
16305 @var{blink} and @var{lp_count} are optional. This option is only
16306 valid for ARC EM and ARC HS cores.
16307
16308 @item -mrgf-banked-regs=@var{number}
16309 @opindex mrgf-banked-regs
16310 Specifies the number of registers replicated in second register bank
16311 on entry to fast interrupt. Fast interrupts are interrupts with the
16312 highest priority level P0. These interrupts save only PC and STATUS32
16313 registers to avoid memory transactions during interrupt entry and exit
16314 sequences. Use this option when you are using fast interrupts in an
16315 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16316
16317 @item -mlpc-width=@var{width}
16318 @opindex mlpc-width
16319 Specify the width of the @code{lp_count} register. Valid values for
16320 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16321 fixed to 32 bits. If the width is less than 32, the compiler does not
16322 attempt to transform loops in your program to use the zero-delay loop
16323 mechanism unless it is known that the @code{lp_count} register can
16324 hold the required loop-counter value. Depending on the width
16325 specified, the compiler and run-time library might continue to use the
16326 loop mechanism for various needs. This option defines macro
16327 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16328
16329 @item -mrf16
16330 @opindex mrf16
16331 This option instructs the compiler to generate code for a 16-entry
16332 register file. This option defines the @code{__ARC_RF16__}
16333 preprocessor macro.
16334
16335 @item -mbranch-index
16336 @opindex mbranch-index
16337 Enable use of @code{bi} or @code{bih} instructions to implement jump
16338 tables.
16339
16340 @end table
16341
16342 The following options are passed through to the assembler, and also
16343 define preprocessor macro symbols.
16344
16345 @c Flags used by the assembler, but for which we define preprocessor
16346 @c macro symbols as well.
16347 @table @gcctabopt
16348 @item -mdsp-packa
16349 @opindex mdsp-packa
16350 Passed down to the assembler to enable the DSP Pack A extensions.
16351 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16352 deprecated.
16353
16354 @item -mdvbf
16355 @opindex mdvbf
16356 Passed down to the assembler to enable the dual Viterbi butterfly
16357 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16358 option is deprecated.
16359
16360 @c ARC700 4.10 extension instruction
16361 @item -mlock
16362 @opindex mlock
16363 Passed down to the assembler to enable the locked load/store
16364 conditional extension. Also sets the preprocessor symbol
16365 @code{__Xlock}.
16366
16367 @item -mmac-d16
16368 @opindex mmac-d16
16369 Passed down to the assembler. Also sets the preprocessor symbol
16370 @code{__Xxmac_d16}. This option is deprecated.
16371
16372 @item -mmac-24
16373 @opindex mmac-24
16374 Passed down to the assembler. Also sets the preprocessor symbol
16375 @code{__Xxmac_24}. This option is deprecated.
16376
16377 @c ARC700 4.10 extension instruction
16378 @item -mrtsc
16379 @opindex mrtsc
16380 Passed down to the assembler to enable the 64-bit time-stamp counter
16381 extension instruction. Also sets the preprocessor symbol
16382 @code{__Xrtsc}. This option is deprecated.
16383
16384 @c ARC700 4.10 extension instruction
16385 @item -mswape
16386 @opindex mswape
16387 Passed down to the assembler to enable the swap byte ordering
16388 extension instruction. Also sets the preprocessor symbol
16389 @code{__Xswape}.
16390
16391 @item -mtelephony
16392 @opindex mtelephony
16393 Passed down to the assembler to enable dual- and single-operand
16394 instructions for telephony. Also sets the preprocessor symbol
16395 @code{__Xtelephony}. This option is deprecated.
16396
16397 @item -mxy
16398 @opindex mxy
16399 Passed down to the assembler to enable the XY memory extension. Also
16400 sets the preprocessor symbol @code{__Xxy}.
16401
16402 @end table
16403
16404 The following options control how the assembly code is annotated:
16405
16406 @c Assembly annotation options
16407 @table @gcctabopt
16408 @item -misize
16409 @opindex misize
16410 Annotate assembler instructions with estimated addresses.
16411
16412 @item -mannotate-align
16413 @opindex mannotate-align
16414 Explain what alignment considerations lead to the decision to make an
16415 instruction short or long.
16416
16417 @end table
16418
16419 The following options are passed through to the linker:
16420
16421 @c options passed through to the linker
16422 @table @gcctabopt
16423 @item -marclinux
16424 @opindex marclinux
16425 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16426 This option is enabled by default in tool chains built for
16427 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16428 when profiling is not requested.
16429
16430 @item -marclinux_prof
16431 @opindex marclinux_prof
16432 Passed through to the linker, to specify use of the
16433 @code{arclinux_prof} emulation. This option is enabled by default in
16434 tool chains built for @w{@code{arc-linux-uclibc}} and
16435 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16436
16437 @end table
16438
16439 The following options control the semantics of generated code:
16440
16441 @c semantically relevant code generation options
16442 @table @gcctabopt
16443 @item -mlong-calls
16444 @opindex mlong-calls
16445 Generate calls as register indirect calls, thus providing access
16446 to the full 32-bit address range.
16447
16448 @item -mmedium-calls
16449 @opindex mmedium-calls
16450 Don't use less than 25-bit addressing range for calls, which is the
16451 offset available for an unconditional branch-and-link
16452 instruction. Conditional execution of function calls is suppressed, to
16453 allow use of the 25-bit range, rather than the 21-bit range with
16454 conditional branch-and-link. This is the default for tool chains built
16455 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16456
16457 @item -G @var{num}
16458 @opindex G
16459 Put definitions of externally-visible data in a small data section if
16460 that data is no bigger than @var{num} bytes. The default value of
16461 @var{num} is 4 for any ARC configuration, or 8 when we have double
16462 load/store operations.
16463
16464 @item -mno-sdata
16465 @opindex mno-sdata
16466 @opindex msdata
16467 Do not generate sdata references. This is the default for tool chains
16468 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16469 targets.
16470
16471 @item -mvolatile-cache
16472 @opindex mvolatile-cache
16473 Use ordinarily cached memory accesses for volatile references. This is the
16474 default.
16475
16476 @item -mno-volatile-cache
16477 @opindex mno-volatile-cache
16478 @opindex mvolatile-cache
16479 Enable cache bypass for volatile references.
16480
16481 @end table
16482
16483 The following options fine tune code generation:
16484 @c code generation tuning options
16485 @table @gcctabopt
16486 @item -malign-call
16487 @opindex malign-call
16488 Do alignment optimizations for call instructions.
16489
16490 @item -mauto-modify-reg
16491 @opindex mauto-modify-reg
16492 Enable the use of pre/post modify with register displacement.
16493
16494 @item -mbbit-peephole
16495 @opindex mbbit-peephole
16496 Enable bbit peephole2.
16497
16498 @item -mno-brcc
16499 @opindex mno-brcc
16500 This option disables a target-specific pass in @file{arc_reorg} to
16501 generate compare-and-branch (@code{br@var{cc}}) instructions.
16502 It has no effect on
16503 generation of these instructions driven by the combiner pass.
16504
16505 @item -mcase-vector-pcrel
16506 @opindex mcase-vector-pcrel
16507 Use PC-relative switch case tables to enable case table shortening.
16508 This is the default for @option{-Os}.
16509
16510 @item -mcompact-casesi
16511 @opindex mcompact-casesi
16512 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16513 and only available for ARCv1 cores. This option is deprecated.
16514
16515 @item -mno-cond-exec
16516 @opindex mno-cond-exec
16517 Disable the ARCompact-specific pass to generate conditional
16518 execution instructions.
16519
16520 Due to delay slot scheduling and interactions between operand numbers,
16521 literal sizes, instruction lengths, and the support for conditional execution,
16522 the target-independent pass to generate conditional execution is often lacking,
16523 so the ARC port has kept a special pass around that tries to find more
16524 conditional execution generation opportunities after register allocation,
16525 branch shortening, and delay slot scheduling have been done. This pass
16526 generally, but not always, improves performance and code size, at the cost of
16527 extra compilation time, which is why there is an option to switch it off.
16528 If you have a problem with call instructions exceeding their allowable
16529 offset range because they are conditionalized, you should consider using
16530 @option{-mmedium-calls} instead.
16531
16532 @item -mearly-cbranchsi
16533 @opindex mearly-cbranchsi
16534 Enable pre-reload use of the @code{cbranchsi} pattern.
16535
16536 @item -mexpand-adddi
16537 @opindex mexpand-adddi
16538 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16539 @code{add.f}, @code{adc} etc. This option is deprecated.
16540
16541 @item -mindexed-loads
16542 @opindex mindexed-loads
16543 Enable the use of indexed loads. This can be problematic because some
16544 optimizers then assume that indexed stores exist, which is not
16545 the case.
16546
16547 @item -mlra
16548 @opindex mlra
16549 Enable Local Register Allocation. This is still experimental for ARC,
16550 so by default the compiler uses standard reload
16551 (i.e.@: @option{-mno-lra}).
16552
16553 @item -mlra-priority-none
16554 @opindex mlra-priority-none
16555 Don't indicate any priority for target registers.
16556
16557 @item -mlra-priority-compact
16558 @opindex mlra-priority-compact
16559 Indicate target register priority for r0..r3 / r12..r15.
16560
16561 @item -mlra-priority-noncompact
16562 @opindex mlra-priority-noncompact
16563 Reduce target register priority for r0..r3 / r12..r15.
16564
16565 @item -mmillicode
16566 @opindex mmillicode
16567 When optimizing for size (using @option{-Os}), prologues and epilogues
16568 that have to save or restore a large number of registers are often
16569 shortened by using call to a special function in libgcc; this is
16570 referred to as a @emph{millicode} call. As these calls can pose
16571 performance issues, and/or cause linking issues when linking in a
16572 nonstandard way, this option is provided to turn on or off millicode
16573 call generation.
16574
16575 @item -mcode-density-frame
16576 @opindex mcode-density-frame
16577 This option enable the compiler to emit @code{enter} and @code{leave}
16578 instructions. These instructions are only valid for CPUs with
16579 code-density feature.
16580
16581 @item -mmixed-code
16582 @opindex mmixed-code
16583 Tweak register allocation to help 16-bit instruction generation.
16584 This generally has the effect of decreasing the average instruction size
16585 while increasing the instruction count.
16586
16587 @item -mq-class
16588 @opindex mq-class
16589 Enable @samp{q} instruction alternatives.
16590 This is the default for @option{-Os}.
16591
16592 @item -mRcq
16593 @opindex mRcq
16594 Enable @samp{Rcq} constraint handling.
16595 Most short code generation depends on this.
16596 This is the default.
16597
16598 @item -mRcw
16599 @opindex mRcw
16600 Enable @samp{Rcw} constraint handling.
16601 Most ccfsm condexec mostly depends on this.
16602 This is the default.
16603
16604 @item -msize-level=@var{level}
16605 @opindex msize-level
16606 Fine-tune size optimization with regards to instruction lengths and alignment.
16607 The recognized values for @var{level} are:
16608 @table @samp
16609 @item 0
16610 No size optimization. This level is deprecated and treated like @samp{1}.
16611
16612 @item 1
16613 Short instructions are used opportunistically.
16614
16615 @item 2
16616 In addition, alignment of loops and of code after barriers are dropped.
16617
16618 @item 3
16619 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16620
16621 @end table
16622
16623 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16624 the behavior when this is not set is equivalent to level @samp{1}.
16625
16626 @item -mtune=@var{cpu}
16627 @opindex mtune
16628 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16629 by @option{-mcpu=}.
16630
16631 Supported values for @var{cpu} are
16632
16633 @table @samp
16634 @item ARC600
16635 Tune for ARC600 CPU.
16636
16637 @item ARC601
16638 Tune for ARC601 CPU.
16639
16640 @item ARC700
16641 Tune for ARC700 CPU with standard multiplier block.
16642
16643 @item ARC700-xmac
16644 Tune for ARC700 CPU with XMAC block.
16645
16646 @item ARC725D
16647 Tune for ARC725D CPU.
16648
16649 @item ARC750D
16650 Tune for ARC750D CPU.
16651
16652 @end table
16653
16654 @item -mmultcost=@var{num}
16655 @opindex mmultcost
16656 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16657 normal instruction.
16658
16659 @item -munalign-prob-threshold=@var{probability}
16660 @opindex munalign-prob-threshold
16661 Set probability threshold for unaligning branches.
16662 When tuning for @samp{ARC700} and optimizing for speed, branches without
16663 filled delay slot are preferably emitted unaligned and long, unless
16664 profiling indicates that the probability for the branch to be taken
16665 is below @var{probability}. @xref{Cross-profiling}.
16666 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16667
16668 @end table
16669
16670 The following options are maintained for backward compatibility, but
16671 are now deprecated and will be removed in a future release:
16672
16673 @c Deprecated options
16674 @table @gcctabopt
16675
16676 @item -margonaut
16677 @opindex margonaut
16678 Obsolete FPX.
16679
16680 @item -mbig-endian
16681 @opindex mbig-endian
16682 @itemx -EB
16683 @opindex EB
16684 Compile code for big-endian targets. Use of these options is now
16685 deprecated. Big-endian code is supported by configuring GCC to build
16686 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16687 for which big endian is the default.
16688
16689 @item -mlittle-endian
16690 @opindex mlittle-endian
16691 @itemx -EL
16692 @opindex EL
16693 Compile code for little-endian targets. Use of these options is now
16694 deprecated. Little-endian code is supported by configuring GCC to build
16695 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16696 for which little endian is the default.
16697
16698 @item -mbarrel_shifter
16699 @opindex mbarrel_shifter
16700 Replaced by @option{-mbarrel-shifter}.
16701
16702 @item -mdpfp_compact
16703 @opindex mdpfp_compact
16704 Replaced by @option{-mdpfp-compact}.
16705
16706 @item -mdpfp_fast
16707 @opindex mdpfp_fast
16708 Replaced by @option{-mdpfp-fast}.
16709
16710 @item -mdsp_packa
16711 @opindex mdsp_packa
16712 Replaced by @option{-mdsp-packa}.
16713
16714 @item -mEA
16715 @opindex mEA
16716 Replaced by @option{-mea}.
16717
16718 @item -mmac_24
16719 @opindex mmac_24
16720 Replaced by @option{-mmac-24}.
16721
16722 @item -mmac_d16
16723 @opindex mmac_d16
16724 Replaced by @option{-mmac-d16}.
16725
16726 @item -mspfp_compact
16727 @opindex mspfp_compact
16728 Replaced by @option{-mspfp-compact}.
16729
16730 @item -mspfp_fast
16731 @opindex mspfp_fast
16732 Replaced by @option{-mspfp-fast}.
16733
16734 @item -mtune=@var{cpu}
16735 @opindex mtune
16736 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16737 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16738 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16739
16740 @item -multcost=@var{num}
16741 @opindex multcost
16742 Replaced by @option{-mmultcost}.
16743
16744 @end table
16745
16746 @node ARM Options
16747 @subsection ARM Options
16748 @cindex ARM options
16749
16750 These @samp{-m} options are defined for the ARM port:
16751
16752 @table @gcctabopt
16753 @item -mabi=@var{name}
16754 @opindex mabi
16755 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16756 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16757
16758 @item -mapcs-frame
16759 @opindex mapcs-frame
16760 Generate a stack frame that is compliant with the ARM Procedure Call
16761 Standard for all functions, even if this is not strictly necessary for
16762 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16763 with this option causes the stack frames not to be generated for
16764 leaf functions. The default is @option{-mno-apcs-frame}.
16765 This option is deprecated.
16766
16767 @item -mapcs
16768 @opindex mapcs
16769 This is a synonym for @option{-mapcs-frame} and is deprecated.
16770
16771 @ignore
16772 @c not currently implemented
16773 @item -mapcs-stack-check
16774 @opindex mapcs-stack-check
16775 Generate code to check the amount of stack space available upon entry to
16776 every function (that actually uses some stack space). If there is
16777 insufficient space available then either the function
16778 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16779 called, depending upon the amount of stack space required. The runtime
16780 system is required to provide these functions. The default is
16781 @option{-mno-apcs-stack-check}, since this produces smaller code.
16782
16783 @c not currently implemented
16784 @item -mapcs-reentrant
16785 @opindex mapcs-reentrant
16786 Generate reentrant, position-independent code. The default is
16787 @option{-mno-apcs-reentrant}.
16788 @end ignore
16789
16790 @item -mthumb-interwork
16791 @opindex mthumb-interwork
16792 Generate code that supports calling between the ARM and Thumb
16793 instruction sets. Without this option, on pre-v5 architectures, the
16794 two instruction sets cannot be reliably used inside one program. The
16795 default is @option{-mno-thumb-interwork}, since slightly larger code
16796 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16797 configurations this option is meaningless.
16798
16799 @item -mno-sched-prolog
16800 @opindex mno-sched-prolog
16801 @opindex msched-prolog
16802 Prevent the reordering of instructions in the function prologue, or the
16803 merging of those instruction with the instructions in the function's
16804 body. This means that all functions start with a recognizable set
16805 of instructions (or in fact one of a choice from a small set of
16806 different function prologues), and this information can be used to
16807 locate the start of functions inside an executable piece of code. The
16808 default is @option{-msched-prolog}.
16809
16810 @item -mfloat-abi=@var{name}
16811 @opindex mfloat-abi
16812 Specifies which floating-point ABI to use. Permissible values
16813 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16814
16815 Specifying @samp{soft} causes GCC to generate output containing
16816 library calls for floating-point operations.
16817 @samp{softfp} allows the generation of code using hardware floating-point
16818 instructions, but still uses the soft-float calling conventions.
16819 @samp{hard} allows generation of floating-point instructions
16820 and uses FPU-specific calling conventions.
16821
16822 The default depends on the specific target configuration. Note that
16823 the hard-float and soft-float ABIs are not link-compatible; you must
16824 compile your entire program with the same ABI, and link with a
16825 compatible set of libraries.
16826
16827 @item -mlittle-endian
16828 @opindex mlittle-endian
16829 Generate code for a processor running in little-endian mode. This is
16830 the default for all standard configurations.
16831
16832 @item -mbig-endian
16833 @opindex mbig-endian
16834 Generate code for a processor running in big-endian mode; the default is
16835 to compile code for a little-endian processor.
16836
16837 @item -mbe8
16838 @itemx -mbe32
16839 @opindex mbe8
16840 When linking a big-endian image select between BE8 and BE32 formats.
16841 The option has no effect for little-endian images and is ignored. The
16842 default is dependent on the selected target architecture. For ARMv6
16843 and later architectures the default is BE8, for older architectures
16844 the default is BE32. BE32 format has been deprecated by ARM.
16845
16846 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16847 @opindex march
16848 This specifies the name of the target ARM architecture. GCC uses this
16849 name to determine what kind of instructions it can emit when generating
16850 assembly code. This option can be used in conjunction with or instead
16851 of the @option{-mcpu=} option.
16852
16853 Permissible names are:
16854 @samp{armv4t},
16855 @samp{armv5t}, @samp{armv5te},
16856 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16857 @samp{armv6z}, @samp{armv6zk},
16858 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16859 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16860 @samp{armv8.4-a},
16861 @samp{armv8.5-a},
16862 @samp{armv7-r},
16863 @samp{armv8-r},
16864 @samp{armv6-m}, @samp{armv6s-m},
16865 @samp{armv7-m}, @samp{armv7e-m},
16866 @samp{armv8-m.base}, @samp{armv8-m.main},
16867 @samp{iwmmxt} and @samp{iwmmxt2}.
16868
16869 Additionally, the following architectures, which lack support for the
16870 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16871
16872 Many of the architectures support extensions. These can be added by
16873 appending @samp{+@var{extension}} to the architecture name. Extension
16874 options are processed in order and capabilities accumulate. An extension
16875 will also enable any necessary base extensions
16876 upon which it depends. For example, the @samp{+crypto} extension
16877 will always enable the @samp{+simd} extension. The exception to the
16878 additive construction is for extensions that are prefixed with
16879 @samp{+no@dots{}}: these extensions disable the specified option and
16880 any other extensions that may depend on the presence of that
16881 extension.
16882
16883 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16884 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16885 entirely disabled by the @samp{+nofp} option that follows it.
16886
16887 Most extension names are generically named, but have an effect that is
16888 dependent upon the architecture to which it is applied. For example,
16889 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16890 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16891 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16892 variant for @samp{armv8-a}.
16893
16894 The table below lists the supported extensions for each architecture.
16895 Architectures not mentioned do not support any extensions.
16896
16897 @table @samp
16898 @item armv5te
16899 @itemx armv6
16900 @itemx armv6j
16901 @itemx armv6k
16902 @itemx armv6kz
16903 @itemx armv6t2
16904 @itemx armv6z
16905 @itemx armv6zk
16906 @table @samp
16907 @item +fp
16908 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16909 used as an alias for this extension.
16910
16911 @item +nofp
16912 Disable the floating-point instructions.
16913 @end table
16914
16915 @item armv7
16916 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16917 @table @samp
16918 @item +fp
16919 The VFPv3 floating-point instructions, with 16 double-precision
16920 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16921 for this extension. Note that floating-point is not supported by the
16922 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16923 ARMv7-R architectures.
16924
16925 @item +nofp
16926 Disable the floating-point instructions.
16927 @end table
16928
16929 @item armv7-a
16930 @table @samp
16931 @item +fp
16932 The VFPv3 floating-point instructions, with 16 double-precision
16933 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16934 for this extension.
16935
16936 @item +simd
16937 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16938 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16939 for this extension.
16940
16941 @item +vfpv3
16942 The VFPv3 floating-point instructions, with 32 double-precision
16943 registers.
16944
16945 @item +vfpv3-d16-fp16
16946 The VFPv3 floating-point instructions, with 16 double-precision
16947 registers and the half-precision floating-point conversion operations.
16948
16949 @item +vfpv3-fp16
16950 The VFPv3 floating-point instructions, with 32 double-precision
16951 registers and the half-precision floating-point conversion operations.
16952
16953 @item +vfpv4-d16
16954 The VFPv4 floating-point instructions, with 16 double-precision
16955 registers.
16956
16957 @item +vfpv4
16958 The VFPv4 floating-point instructions, with 32 double-precision
16959 registers.
16960
16961 @item +neon-fp16
16962 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16963 the half-precision floating-point conversion operations.
16964
16965 @item +neon-vfpv4
16966 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16967
16968 @item +nosimd
16969 Disable the Advanced SIMD instructions (does not disable floating point).
16970
16971 @item +nofp
16972 Disable the floating-point and Advanced SIMD instructions.
16973 @end table
16974
16975 @item armv7ve
16976 The extended version of the ARMv7-A architecture with support for
16977 virtualization.
16978 @table @samp
16979 @item +fp
16980 The VFPv4 floating-point instructions, with 16 double-precision registers.
16981 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16982
16983 @item +simd
16984 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16985 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16986
16987 @item +vfpv3-d16
16988 The VFPv3 floating-point instructions, with 16 double-precision
16989 registers.
16990
16991 @item +vfpv3
16992 The VFPv3 floating-point instructions, with 32 double-precision
16993 registers.
16994
16995 @item +vfpv3-d16-fp16
16996 The VFPv3 floating-point instructions, with 16 double-precision
16997 registers and the half-precision floating-point conversion operations.
16998
16999 @item +vfpv3-fp16
17000 The VFPv3 floating-point instructions, with 32 double-precision
17001 registers and the half-precision floating-point conversion operations.
17002
17003 @item +vfpv4-d16
17004 The VFPv4 floating-point instructions, with 16 double-precision
17005 registers.
17006
17007 @item +vfpv4
17008 The VFPv4 floating-point instructions, with 32 double-precision
17009 registers.
17010
17011 @item +neon
17012 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17013 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17014
17015 @item +neon-fp16
17016 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17017 the half-precision floating-point conversion operations.
17018
17019 @item +nosimd
17020 Disable the Advanced SIMD instructions (does not disable floating point).
17021
17022 @item +nofp
17023 Disable the floating-point and Advanced SIMD instructions.
17024 @end table
17025
17026 @item armv8-a
17027 @table @samp
17028 @item +crc
17029 The Cyclic Redundancy Check (CRC) instructions.
17030 @item +simd
17031 The ARMv8-A Advanced SIMD and floating-point instructions.
17032 @item +crypto
17033 The cryptographic instructions.
17034 @item +nocrypto
17035 Disable the cryptographic instructions.
17036 @item +nofp
17037 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17038 @item +sb
17039 Speculation Barrier Instruction.
17040 @item +predres
17041 Execution and Data Prediction Restriction Instructions.
17042 @end table
17043
17044 @item armv8.1-a
17045 @table @samp
17046 @item +simd
17047 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17048
17049 @item +crypto
17050 The cryptographic instructions. This also enables the Advanced SIMD and
17051 floating-point instructions.
17052
17053 @item +nocrypto
17054 Disable the cryptographic instructions.
17055
17056 @item +nofp
17057 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17058
17059 @item +sb
17060 Speculation Barrier Instruction.
17061
17062 @item +predres
17063 Execution and Data Prediction Restriction Instructions.
17064 @end table
17065
17066 @item armv8.2-a
17067 @itemx armv8.3-a
17068 @table @samp
17069 @item +fp16
17070 The half-precision floating-point data processing instructions.
17071 This also enables the Advanced SIMD and floating-point instructions.
17072
17073 @item +fp16fml
17074 The half-precision floating-point fmla extension. This also enables
17075 the half-precision floating-point extension and Advanced SIMD and
17076 floating-point instructions.
17077
17078 @item +simd
17079 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17080
17081 @item +crypto
17082 The cryptographic instructions. This also enables the Advanced SIMD and
17083 floating-point instructions.
17084
17085 @item +dotprod
17086 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17087
17088 @item +nocrypto
17089 Disable the cryptographic extension.
17090
17091 @item +nofp
17092 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17093
17094 @item +sb
17095 Speculation Barrier Instruction.
17096
17097 @item +predres
17098 Execution and Data Prediction Restriction Instructions.
17099 @end table
17100
17101 @item armv8.4-a
17102 @table @samp
17103 @item +fp16
17104 The half-precision floating-point data processing instructions.
17105 This also enables the Advanced SIMD and floating-point instructions as well
17106 as the Dot Product extension and the half-precision floating-point fmla
17107 extension.
17108
17109 @item +simd
17110 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17111 Dot Product extension.
17112
17113 @item +crypto
17114 The cryptographic instructions. This also enables the Advanced SIMD and
17115 floating-point instructions as well as the Dot Product extension.
17116
17117 @item +nocrypto
17118 Disable the cryptographic extension.
17119
17120 @item +nofp
17121 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17122
17123 @item +sb
17124 Speculation Barrier Instruction.
17125
17126 @item +predres
17127 Execution and Data Prediction Restriction Instructions.
17128 @end table
17129
17130 @item armv8.5-a
17131 @table @samp
17132 @item +fp16
17133 The half-precision floating-point data processing instructions.
17134 This also enables the Advanced SIMD and floating-point instructions as well
17135 as the Dot Product extension and the half-precision floating-point fmla
17136 extension.
17137
17138 @item +simd
17139 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17140 Dot Product extension.
17141
17142 @item +crypto
17143 The cryptographic instructions. This also enables the Advanced SIMD and
17144 floating-point instructions as well as the Dot Product extension.
17145
17146 @item +nocrypto
17147 Disable the cryptographic extension.
17148
17149 @item +nofp
17150 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17151 @end table
17152
17153 @item armv7-r
17154 @table @samp
17155 @item +fp.sp
17156 The single-precision VFPv3 floating-point instructions. The extension
17157 @samp{+vfpv3xd} can be used as an alias for this extension.
17158
17159 @item +fp
17160 The VFPv3 floating-point instructions with 16 double-precision registers.
17161 The extension +vfpv3-d16 can be used as an alias for this extension.
17162
17163 @item +vfpv3xd-d16-fp16
17164 The single-precision VFPv3 floating-point instructions with 16 double-precision
17165 registers and the half-precision floating-point conversion operations.
17166
17167 @item +vfpv3-d16-fp16
17168 The VFPv3 floating-point instructions with 16 double-precision
17169 registers and the half-precision floating-point conversion operations.
17170
17171 @item +nofp
17172 Disable the floating-point extension.
17173
17174 @item +idiv
17175 The ARM-state integer division instructions.
17176
17177 @item +noidiv
17178 Disable the ARM-state integer division extension.
17179 @end table
17180
17181 @item armv7e-m
17182 @table @samp
17183 @item +fp
17184 The single-precision VFPv4 floating-point instructions.
17185
17186 @item +fpv5
17187 The single-precision FPv5 floating-point instructions.
17188
17189 @item +fp.dp
17190 The single- and double-precision FPv5 floating-point instructions.
17191
17192 @item +nofp
17193 Disable the floating-point extensions.
17194 @end table
17195
17196 @item armv8-m.main
17197 @table @samp
17198 @item +dsp
17199 The DSP instructions.
17200
17201 @item +nodsp
17202 Disable the DSP extension.
17203
17204 @item +fp
17205 The single-precision floating-point instructions.
17206
17207 @item +fp.dp
17208 The single- and double-precision floating-point instructions.
17209
17210 @item +nofp
17211 Disable the floating-point extension.
17212 @end table
17213
17214 @item armv8-r
17215 @table @samp
17216 @item +crc
17217 The Cyclic Redundancy Check (CRC) instructions.
17218 @item +fp.sp
17219 The single-precision FPv5 floating-point instructions.
17220 @item +simd
17221 The ARMv8-A Advanced SIMD and floating-point instructions.
17222 @item +crypto
17223 The cryptographic instructions.
17224 @item +nocrypto
17225 Disable the cryptographic instructions.
17226 @item +nofp
17227 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17228 @end table
17229
17230 @end table
17231
17232 @option{-march=native} causes the compiler to auto-detect the architecture
17233 of the build computer. At present, this feature is only supported on
17234 GNU/Linux, and not all architectures are recognized. If the auto-detect
17235 is unsuccessful the option has no effect.
17236
17237 @item -mtune=@var{name}
17238 @opindex mtune
17239 This option specifies the name of the target ARM processor for
17240 which GCC should tune the performance of the code.
17241 For some ARM implementations better performance can be obtained by using
17242 this option.
17243 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17244 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17245 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17246 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17247 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17248 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17249 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17250 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17251 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17252 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17253 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17254 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17255 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17256 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17257 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17258 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17259 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17260 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17261 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17262 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526},
17263 @samp{fa626}, @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
17264 @samp{xgene1}.
17265
17266 Additionally, this option can specify that GCC should tune the performance
17267 of the code for a big.LITTLE system. Permissible names are:
17268 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17269 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17270 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17271 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17272
17273 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17274 performance for a blend of processors within architecture @var{arch}.
17275 The aim is to generate code that run well on the current most popular
17276 processors, balancing between optimizations that benefit some CPUs in the
17277 range, and avoiding performance pitfalls of other CPUs. The effects of
17278 this option may change in future GCC versions as CPU models come and go.
17279
17280 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17281 the extension options do not affect the tuning of the generated code.
17282
17283 @option{-mtune=native} causes the compiler to auto-detect the CPU
17284 of the build computer. At present, this feature is only supported on
17285 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17286 unsuccessful the option has no effect.
17287
17288 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17289 @opindex mcpu
17290 This specifies the name of the target ARM processor. GCC uses this name
17291 to derive the name of the target ARM architecture (as if specified
17292 by @option{-march}) and the ARM processor type for which to tune for
17293 performance (as if specified by @option{-mtune}). Where this option
17294 is used in conjunction with @option{-march} or @option{-mtune},
17295 those options take precedence over the appropriate part of this option.
17296
17297 Many of the supported CPUs implement optional architectural
17298 extensions. Where this is so the architectural extensions are
17299 normally enabled by default. If implementations that lack the
17300 extension exist, then the extension syntax can be used to disable
17301 those extensions that have been omitted. For floating-point and
17302 Advanced SIMD (Neon) instructions, the settings of the options
17303 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17304 floating-point and Advanced SIMD instructions will only be used if
17305 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17306 @option{-mfpu} other than @samp{auto} will override the available
17307 floating-point and SIMD extension instructions.
17308
17309 For example, @samp{cortex-a9} can be found in three major
17310 configurations: integer only, with just a floating-point unit or with
17311 floating-point and Advanced SIMD. The default is to enable all the
17312 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17313 be used to disable just the SIMD or both the SIMD and floating-point
17314 instructions respectively.
17315
17316 Permissible names for this option are the same as those for
17317 @option{-mtune}.
17318
17319 The following extension options are common to the listed CPUs:
17320
17321 @table @samp
17322 @item +nodsp
17323 Disable the DSP instructions on @samp{cortex-m33}.
17324
17325 @item +nofp
17326 Disables the floating-point instructions on @samp{arm9e},
17327 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17328 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17329 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17330 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17331 Disables the floating-point and SIMD instructions on
17332 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17333 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17334 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17335 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17336 @samp{cortex-a53} and @samp{cortex-a55}.
17337
17338 @item +nofp.dp
17339 Disables the double-precision component of the floating-point instructions
17340 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17341 @samp{cortex-m7}.
17342
17343 @item +nosimd
17344 Disables the SIMD (but not floating-point) instructions on
17345 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17346 and @samp{cortex-a9}.
17347
17348 @item +crypto
17349 Enables the cryptographic instructions on @samp{cortex-a32},
17350 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17351 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17352 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17353 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17354 @samp{cortex-a75.cortex-a55}.
17355 @end table
17356
17357 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17358 VFPv3 with 16 double-precision registers. It supports the following
17359 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
17360 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
17361 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
17362 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
17363 @option{-march=armv7-a}.
17364
17365 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17366 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17367 See @option{-mtune} for more information.
17368
17369 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17370 of the build computer. At present, this feature is only supported on
17371 GNU/Linux, and not all architectures are recognized. If the auto-detect
17372 is unsuccessful the option has no effect.
17373
17374 @item -mfpu=@var{name}
17375 @opindex mfpu
17376 This specifies what floating-point hardware (or hardware emulation) is
17377 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17378 @samp{vfpv3},
17379 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17380 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17381 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17382 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17383 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17384 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17385 is an alias for @samp{vfpv2}.
17386
17387 The setting @samp{auto} is the default and is special. It causes the
17388 compiler to select the floating-point and Advanced SIMD instructions
17389 based on the settings of @option{-mcpu} and @option{-march}.
17390
17391 If the selected floating-point hardware includes the NEON extension
17392 (e.g.@: @option{-mfpu=neon}), note that floating-point
17393 operations are not generated by GCC's auto-vectorization pass unless
17394 @option{-funsafe-math-optimizations} is also specified. This is
17395 because NEON hardware does not fully implement the IEEE 754 standard for
17396 floating-point arithmetic (in particular denormal values are treated as
17397 zero), so the use of NEON instructions may lead to a loss of precision.
17398
17399 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}).
17400
17401 @item -mfp16-format=@var{name}
17402 @opindex mfp16-format
17403 Specify the format of the @code{__fp16} half-precision floating-point type.
17404 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17405 the default is @samp{none}, in which case the @code{__fp16} type is not
17406 defined. @xref{Half-Precision}, for more information.
17407
17408 @item -mstructure-size-boundary=@var{n}
17409 @opindex mstructure-size-boundary
17410 The sizes of all structures and unions are rounded up to a multiple
17411 of the number of bits set by this option. Permissible values are 8, 32
17412 and 64. The default value varies for different toolchains. For the COFF
17413 targeted toolchain the default value is 8. A value of 64 is only allowed
17414 if the underlying ABI supports it.
17415
17416 Specifying a larger number can produce faster, more efficient code, but
17417 can also increase the size of the program. Different values are potentially
17418 incompatible. Code compiled with one value cannot necessarily expect to
17419 work with code or libraries compiled with another value, if they exchange
17420 information using structures or unions.
17421
17422 This option is deprecated.
17423
17424 @item -mabort-on-noreturn
17425 @opindex mabort-on-noreturn
17426 Generate a call to the function @code{abort} at the end of a
17427 @code{noreturn} function. It is executed if the function tries to
17428 return.
17429
17430 @item -mlong-calls
17431 @itemx -mno-long-calls
17432 @opindex mlong-calls
17433 @opindex mno-long-calls
17434 Tells the compiler to perform function calls by first loading the
17435 address of the function into a register and then performing a subroutine
17436 call on this register. This switch is needed if the target function
17437 lies outside of the 64-megabyte addressing range of the offset-based
17438 version of subroutine call instruction.
17439
17440 Even if this switch is enabled, not all function calls are turned
17441 into long calls. The heuristic is that static functions, functions
17442 that have the @code{short_call} attribute, functions that are inside
17443 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17444 definitions have already been compiled within the current compilation
17445 unit are not turned into long calls. The exceptions to this rule are
17446 that weak function definitions, functions with the @code{long_call}
17447 attribute or the @code{section} attribute, and functions that are within
17448 the scope of a @code{#pragma long_calls} directive are always
17449 turned into long calls.
17450
17451 This feature is not enabled by default. Specifying
17452 @option{-mno-long-calls} restores the default behavior, as does
17453 placing the function calls within the scope of a @code{#pragma
17454 long_calls_off} directive. Note these switches have no effect on how
17455 the compiler generates code to handle function calls via function
17456 pointers.
17457
17458 @item -msingle-pic-base
17459 @opindex msingle-pic-base
17460 Treat the register used for PIC addressing as read-only, rather than
17461 loading it in the prologue for each function. The runtime system is
17462 responsible for initializing this register with an appropriate value
17463 before execution begins.
17464
17465 @item -mpic-register=@var{reg}
17466 @opindex mpic-register
17467 Specify the register to be used for PIC addressing.
17468 For standard PIC base case, the default is any suitable register
17469 determined by compiler. For single PIC base case, the default is
17470 @samp{R9} if target is EABI based or stack-checking is enabled,
17471 otherwise the default is @samp{R10}.
17472
17473 @item -mpic-data-is-text-relative
17474 @opindex mpic-data-is-text-relative
17475 Assume that the displacement between the text and data segments is fixed
17476 at static link time. This permits using PC-relative addressing
17477 operations to access data known to be in the data segment. For
17478 non-VxWorks RTP targets, this option is enabled by default. When
17479 disabled on such targets, it will enable @option{-msingle-pic-base} by
17480 default.
17481
17482 @item -mpoke-function-name
17483 @opindex mpoke-function-name
17484 Write the name of each function into the text section, directly
17485 preceding the function prologue. The generated code is similar to this:
17486
17487 @smallexample
17488 t0
17489 .ascii "arm_poke_function_name", 0
17490 .align
17491 t1
17492 .word 0xff000000 + (t1 - t0)
17493 arm_poke_function_name
17494 mov ip, sp
17495 stmfd sp!, @{fp, ip, lr, pc@}
17496 sub fp, ip, #4
17497 @end smallexample
17498
17499 When performing a stack backtrace, code can inspect the value of
17500 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17501 location @code{pc - 12} and the top 8 bits are set, then we know that
17502 there is a function name embedded immediately preceding this location
17503 and has length @code{((pc[-3]) & 0xff000000)}.
17504
17505 @item -mthumb
17506 @itemx -marm
17507 @opindex marm
17508 @opindex mthumb
17509
17510 Select between generating code that executes in ARM and Thumb
17511 states. The default for most configurations is to generate code
17512 that executes in ARM state, but the default can be changed by
17513 configuring GCC with the @option{--with-mode=}@var{state}
17514 configure option.
17515
17516 You can also override the ARM and Thumb mode for each function
17517 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17518 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17519
17520 @item -mflip-thumb
17521 @opindex mflip-thumb
17522 Switch ARM/Thumb modes on alternating functions.
17523 This option is provided for regression testing of mixed Thumb/ARM code
17524 generation, and is not intended for ordinary use in compiling code.
17525
17526 @item -mtpcs-frame
17527 @opindex mtpcs-frame
17528 Generate a stack frame that is compliant with the Thumb Procedure Call
17529 Standard for all non-leaf functions. (A leaf function is one that does
17530 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17531
17532 @item -mtpcs-leaf-frame
17533 @opindex mtpcs-leaf-frame
17534 Generate a stack frame that is compliant with the Thumb Procedure Call
17535 Standard for all leaf functions. (A leaf function is one that does
17536 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17537
17538 @item -mcallee-super-interworking
17539 @opindex mcallee-super-interworking
17540 Gives all externally visible functions in the file being compiled an ARM
17541 instruction set header which switches to Thumb mode before executing the
17542 rest of the function. This allows these functions to be called from
17543 non-interworking code. This option is not valid in AAPCS configurations
17544 because interworking is enabled by default.
17545
17546 @item -mcaller-super-interworking
17547 @opindex mcaller-super-interworking
17548 Allows calls via function pointers (including virtual functions) to
17549 execute correctly regardless of whether the target code has been
17550 compiled for interworking or not. There is a small overhead in the cost
17551 of executing a function pointer if this option is enabled. This option
17552 is not valid in AAPCS configurations because interworking is enabled
17553 by default.
17554
17555 @item -mtp=@var{name}
17556 @opindex mtp
17557 Specify the access model for the thread local storage pointer. The valid
17558 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17559 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17560 (supported in the arm6k architecture), and @samp{auto}, which uses the
17561 best available method for the selected processor. The default setting is
17562 @samp{auto}.
17563
17564 @item -mtls-dialect=@var{dialect}
17565 @opindex mtls-dialect
17566 Specify the dialect to use for accessing thread local storage. Two
17567 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17568 @samp{gnu} dialect selects the original GNU scheme for supporting
17569 local and global dynamic TLS models. The @samp{gnu2} dialect
17570 selects the GNU descriptor scheme, which provides better performance
17571 for shared libraries. The GNU descriptor scheme is compatible with
17572 the original scheme, but does require new assembler, linker and
17573 library support. Initial and local exec TLS models are unaffected by
17574 this option and always use the original scheme.
17575
17576 @item -mword-relocations
17577 @opindex mword-relocations
17578 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17579 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17580 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17581 is specified. This option conflicts with @option{-mslow-flash-data}.
17582
17583 @item -mfix-cortex-m3-ldrd
17584 @opindex mfix-cortex-m3-ldrd
17585 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17586 with overlapping destination and base registers are used. This option avoids
17587 generating these instructions. This option is enabled by default when
17588 @option{-mcpu=cortex-m3} is specified.
17589
17590 @item -munaligned-access
17591 @itemx -mno-unaligned-access
17592 @opindex munaligned-access
17593 @opindex mno-unaligned-access
17594 Enables (or disables) reading and writing of 16- and 32- bit values
17595 from addresses that are not 16- or 32- bit aligned. By default
17596 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17597 ARMv8-M Baseline architectures, and enabled for all other
17598 architectures. If unaligned access is not enabled then words in packed
17599 data structures are accessed a byte at a time.
17600
17601 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17602 generated object file to either true or false, depending upon the
17603 setting of this option. If unaligned access is enabled then the
17604 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17605 defined.
17606
17607 @item -mneon-for-64bits
17608 @opindex mneon-for-64bits
17609 Enables using Neon to handle scalar 64-bits operations. This is
17610 disabled by default since the cost of moving data from core registers
17611 to Neon is high.
17612
17613 @item -mslow-flash-data
17614 @opindex mslow-flash-data
17615 Assume loading data from flash is slower than fetching instruction.
17616 Therefore literal load is minimized for better performance.
17617 This option is only supported when compiling for ARMv7 M-profile and
17618 off by default. It conflicts with @option{-mword-relocations}.
17619
17620 @item -masm-syntax-unified
17621 @opindex masm-syntax-unified
17622 Assume inline assembler is using unified asm syntax. The default is
17623 currently off which implies divided syntax. This option has no impact
17624 on Thumb2. However, this may change in future releases of GCC.
17625 Divided syntax should be considered deprecated.
17626
17627 @item -mrestrict-it
17628 @opindex mrestrict-it
17629 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17630 IT blocks can only contain a single 16-bit instruction from a select
17631 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17632
17633 @item -mprint-tune-info
17634 @opindex mprint-tune-info
17635 Print CPU tuning information as comment in assembler file. This is
17636 an option used only for regression testing of the compiler and not
17637 intended for ordinary use in compiling code. This option is disabled
17638 by default.
17639
17640 @item -mverbose-cost-dump
17641 @opindex mverbose-cost-dump
17642 Enable verbose cost model dumping in the debug dump files. This option is
17643 provided for use in debugging the compiler.
17644
17645 @item -mpure-code
17646 @opindex mpure-code
17647 Do not allow constant data to be placed in code sections.
17648 Additionally, when compiling for ELF object format give all text sections the
17649 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17650 is only available when generating non-pic code for M-profile targets with the
17651 MOVT instruction.
17652
17653 @item -mcmse
17654 @opindex mcmse
17655 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17656 Development Tools Engineering Specification", which can be found on
17657 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17658 @end table
17659
17660 @node AVR Options
17661 @subsection AVR Options
17662 @cindex AVR Options
17663
17664 These options are defined for AVR implementations:
17665
17666 @table @gcctabopt
17667 @item -mmcu=@var{mcu}
17668 @opindex mmcu
17669 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17670
17671 The default for this option is@tie{}@samp{avr2}.
17672
17673 GCC supports the following AVR devices and ISAs:
17674
17675 @include avr-mmcu.texi
17676
17677 @item -mabsdata
17678 @opindex mabsdata
17679
17680 Assume that all data in static storage can be accessed by LDS / STS
17681 instructions. This option has only an effect on reduced Tiny devices like
17682 ATtiny40. See also the @code{absdata}
17683 @ref{AVR Variable Attributes,variable attribute}.
17684
17685 @item -maccumulate-args
17686 @opindex maccumulate-args
17687 Accumulate outgoing function arguments and acquire/release the needed
17688 stack space for outgoing function arguments once in function
17689 prologue/epilogue. Without this option, outgoing arguments are pushed
17690 before calling a function and popped afterwards.
17691
17692 Popping the arguments after the function call can be expensive on
17693 AVR so that accumulating the stack space might lead to smaller
17694 executables because arguments need not be removed from the
17695 stack after such a function call.
17696
17697 This option can lead to reduced code size for functions that perform
17698 several calls to functions that get their arguments on the stack like
17699 calls to printf-like functions.
17700
17701 @item -mbranch-cost=@var{cost}
17702 @opindex mbranch-cost
17703 Set the branch costs for conditional branch instructions to
17704 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17705 integers. The default branch cost is 0.
17706
17707 @item -mcall-prologues
17708 @opindex mcall-prologues
17709 Functions prologues/epilogues are expanded as calls to appropriate
17710 subroutines. Code size is smaller.
17711
17712 @item -mgas-isr-prologues
17713 @opindex mgas-isr-prologues
17714 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17715 instruction supported by GNU Binutils.
17716 If this option is on, the feature can still be disabled for individual
17717 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17718 function attribute. This feature is activated per default
17719 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17720 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17721
17722 @item -mint8
17723 @opindex mint8
17724 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17725 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17726 and @code{long long} is 4 bytes. Please note that this option does not
17727 conform to the C standards, but it results in smaller code
17728 size.
17729
17730 @item -mmain-is-OS_task
17731 @opindex mmain-is-OS_task
17732 Do not save registers in @code{main}. The effect is the same like
17733 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17734 to @code{main}. It is activated per default if optimization is on.
17735
17736 @item -mn-flash=@var{num}
17737 @opindex mn-flash
17738 Assume that the flash memory has a size of
17739 @var{num} times 64@tie{}KiB.
17740
17741 @item -mno-interrupts
17742 @opindex mno-interrupts
17743 Generated code is not compatible with hardware interrupts.
17744 Code size is smaller.
17745
17746 @item -mrelax
17747 @opindex mrelax
17748 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17749 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17750 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17751 the assembler's command line and the @option{--relax} option to the
17752 linker's command line.
17753
17754 Jump relaxing is performed by the linker because jump offsets are not
17755 known before code is located. Therefore, the assembler code generated by the
17756 compiler is the same, but the instructions in the executable may
17757 differ from instructions in the assembler code.
17758
17759 Relaxing must be turned on if linker stubs are needed, see the
17760 section on @code{EIND} and linker stubs below.
17761
17762 @item -mrmw
17763 @opindex mrmw
17764 Assume that the device supports the Read-Modify-Write
17765 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17766
17767 @item -mshort-calls
17768 @opindex mshort-calls
17769
17770 Assume that @code{RJMP} and @code{RCALL} can target the whole
17771 program memory.
17772
17773 This option is used internally for multilib selection. It is
17774 not an optimization option, and you don't need to set it by hand.
17775
17776 @item -msp8
17777 @opindex msp8
17778 Treat the stack pointer register as an 8-bit register,
17779 i.e.@: assume the high byte of the stack pointer is zero.
17780 In general, you don't need to set this option by hand.
17781
17782 This option is used internally by the compiler to select and
17783 build multilibs for architectures @code{avr2} and @code{avr25}.
17784 These architectures mix devices with and without @code{SPH}.
17785 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17786 the compiler driver adds or removes this option from the compiler
17787 proper's command line, because the compiler then knows if the device
17788 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17789 register or not.
17790
17791 @item -mstrict-X
17792 @opindex mstrict-X
17793 Use address register @code{X} in a way proposed by the hardware. This means
17794 that @code{X} is only used in indirect, post-increment or
17795 pre-decrement addressing.
17796
17797 Without this option, the @code{X} register may be used in the same way
17798 as @code{Y} or @code{Z} which then is emulated by additional
17799 instructions.
17800 For example, loading a value with @code{X+const} addressing with a
17801 small non-negative @code{const < 64} to a register @var{Rn} is
17802 performed as
17803
17804 @example
17805 adiw r26, const ; X += const
17806 ld @var{Rn}, X ; @var{Rn} = *X
17807 sbiw r26, const ; X -= const
17808 @end example
17809
17810 @item -mtiny-stack
17811 @opindex mtiny-stack
17812 Only change the lower 8@tie{}bits of the stack pointer.
17813
17814 @item -mfract-convert-truncate
17815 @opindex mfract-convert-truncate
17816 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17817
17818 @item -nodevicelib
17819 @opindex nodevicelib
17820 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17821
17822 @item -Waddr-space-convert
17823 @opindex Waddr-space-convert
17824 @opindex Wno-addr-space-convert
17825 Warn about conversions between address spaces in the case where the
17826 resulting address space is not contained in the incoming address space.
17827
17828 @item -Wmisspelled-isr
17829 @opindex Wmisspelled-isr
17830 @opindex Wno-misspelled-isr
17831 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17832 Enabled by default.
17833 @end table
17834
17835 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17836 @cindex @code{EIND}
17837 Pointers in the implementation are 16@tie{}bits wide.
17838 The address of a function or label is represented as word address so
17839 that indirect jumps and calls can target any code address in the
17840 range of 64@tie{}Ki words.
17841
17842 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17843 bytes of program memory space, there is a special function register called
17844 @code{EIND} that serves as most significant part of the target address
17845 when @code{EICALL} or @code{EIJMP} instructions are used.
17846
17847 Indirect jumps and calls on these devices are handled as follows by
17848 the compiler and are subject to some limitations:
17849
17850 @itemize @bullet
17851
17852 @item
17853 The compiler never sets @code{EIND}.
17854
17855 @item
17856 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17857 instructions or might read @code{EIND} directly in order to emulate an
17858 indirect call/jump by means of a @code{RET} instruction.
17859
17860 @item
17861 The compiler assumes that @code{EIND} never changes during the startup
17862 code or during the application. In particular, @code{EIND} is not
17863 saved/restored in function or interrupt service routine
17864 prologue/epilogue.
17865
17866 @item
17867 For indirect calls to functions and computed goto, the linker
17868 generates @emph{stubs}. Stubs are jump pads sometimes also called
17869 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17870 The stub contains a direct jump to the desired address.
17871
17872 @item
17873 Linker relaxation must be turned on so that the linker generates
17874 the stubs correctly in all situations. See the compiler option
17875 @option{-mrelax} and the linker option @option{--relax}.
17876 There are corner cases where the linker is supposed to generate stubs
17877 but aborts without relaxation and without a helpful error message.
17878
17879 @item
17880 The default linker script is arranged for code with @code{EIND = 0}.
17881 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17882 linker script has to be used in order to place the sections whose
17883 name start with @code{.trampolines} into the segment where @code{EIND}
17884 points to.
17885
17886 @item
17887 The startup code from libgcc never sets @code{EIND}.
17888 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17889 For the impact of AVR-LibC on @code{EIND}, see the
17890 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17891
17892 @item
17893 It is legitimate for user-specific startup code to set up @code{EIND}
17894 early, for example by means of initialization code located in
17895 section @code{.init3}. Such code runs prior to general startup code
17896 that initializes RAM and calls constructors, but after the bit
17897 of startup code from AVR-LibC that sets @code{EIND} to the segment
17898 where the vector table is located.
17899 @example
17900 #include <avr/io.h>
17901
17902 static void
17903 __attribute__((section(".init3"),naked,used,no_instrument_function))
17904 init3_set_eind (void)
17905 @{
17906 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17907 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17908 @}
17909 @end example
17910
17911 @noindent
17912 The @code{__trampolines_start} symbol is defined in the linker script.
17913
17914 @item
17915 Stubs are generated automatically by the linker if
17916 the following two conditions are met:
17917 @itemize @minus
17918
17919 @item The address of a label is taken by means of the @code{gs} modifier
17920 (short for @emph{generate stubs}) like so:
17921 @example
17922 LDI r24, lo8(gs(@var{func}))
17923 LDI r25, hi8(gs(@var{func}))
17924 @end example
17925 @item The final location of that label is in a code segment
17926 @emph{outside} the segment where the stubs are located.
17927 @end itemize
17928
17929 @item
17930 The compiler emits such @code{gs} modifiers for code labels in the
17931 following situations:
17932 @itemize @minus
17933 @item Taking address of a function or code label.
17934 @item Computed goto.
17935 @item If prologue-save function is used, see @option{-mcall-prologues}
17936 command-line option.
17937 @item Switch/case dispatch tables. If you do not want such dispatch
17938 tables you can specify the @option{-fno-jump-tables} command-line option.
17939 @item C and C++ constructors/destructors called during startup/shutdown.
17940 @item If the tools hit a @code{gs()} modifier explained above.
17941 @end itemize
17942
17943 @item
17944 Jumping to non-symbolic addresses like so is @emph{not} supported:
17945
17946 @example
17947 int main (void)
17948 @{
17949 /* Call function at word address 0x2 */
17950 return ((int(*)(void)) 0x2)();
17951 @}
17952 @end example
17953
17954 Instead, a stub has to be set up, i.e.@: the function has to be called
17955 through a symbol (@code{func_4} in the example):
17956
17957 @example
17958 int main (void)
17959 @{
17960 extern int func_4 (void);
17961
17962 /* Call function at byte address 0x4 */
17963 return func_4();
17964 @}
17965 @end example
17966
17967 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17968 Alternatively, @code{func_4} can be defined in the linker script.
17969 @end itemize
17970
17971 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17972 @cindex @code{RAMPD}
17973 @cindex @code{RAMPX}
17974 @cindex @code{RAMPY}
17975 @cindex @code{RAMPZ}
17976 Some AVR devices support memories larger than the 64@tie{}KiB range
17977 that can be accessed with 16-bit pointers. To access memory locations
17978 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17979 register is used as high part of the address:
17980 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17981 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17982 register, respectively, to get a wide address. Similarly,
17983 @code{RAMPD} is used together with direct addressing.
17984
17985 @itemize
17986 @item
17987 The startup code initializes the @code{RAMP} special function
17988 registers with zero.
17989
17990 @item
17991 If a @ref{AVR Named Address Spaces,named address space} other than
17992 generic or @code{__flash} is used, then @code{RAMPZ} is set
17993 as needed before the operation.
17994
17995 @item
17996 If the device supports RAM larger than 64@tie{}KiB and the compiler
17997 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17998 is reset to zero after the operation.
17999
18000 @item
18001 If the device comes with a specific @code{RAMP} register, the ISR
18002 prologue/epilogue saves/restores that SFR and initializes it with
18003 zero in case the ISR code might (implicitly) use it.
18004
18005 @item
18006 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18007 If you use inline assembler to read from locations outside the
18008 16-bit address range and change one of the @code{RAMP} registers,
18009 you must reset it to zero after the access.
18010
18011 @end itemize
18012
18013 @subsubsection AVR Built-in Macros
18014
18015 GCC defines several built-in macros so that the user code can test
18016 for the presence or absence of features. Almost any of the following
18017 built-in macros are deduced from device capabilities and thus
18018 triggered by the @option{-mmcu=} command-line option.
18019
18020 For even more AVR-specific built-in macros see
18021 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18022
18023 @table @code
18024
18025 @item __AVR_ARCH__
18026 Build-in macro that resolves to a decimal number that identifies the
18027 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18028 Possible values are:
18029
18030 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18031 @code{4}, @code{5}, @code{51}, @code{6}
18032
18033 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18034 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18035
18036 respectively and
18037
18038 @code{100},
18039 @code{102}, @code{103}, @code{104},
18040 @code{105}, @code{106}, @code{107}
18041
18042 for @var{mcu}=@code{avrtiny},
18043 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18044 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18045 If @var{mcu} specifies a device, this built-in macro is set
18046 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18047 defined to @code{4}.
18048
18049 @item __AVR_@var{Device}__
18050 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18051 the device's name. For example, @option{-mmcu=atmega8} defines the
18052 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18053 @code{__AVR_ATtiny261A__}, etc.
18054
18055 The built-in macros' names follow
18056 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18057 the device name as from the AVR user manual. The difference between
18058 @var{Device} in the built-in macro and @var{device} in
18059 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18060
18061 If @var{device} is not a device but only a core architecture like
18062 @samp{avr51}, this macro is not defined.
18063
18064 @item __AVR_DEVICE_NAME__
18065 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18066 the device's name. For example, with @option{-mmcu=atmega8} the macro
18067 is defined to @code{atmega8}.
18068
18069 If @var{device} is not a device but only a core architecture like
18070 @samp{avr51}, this macro is not defined.
18071
18072 @item __AVR_XMEGA__
18073 The device / architecture belongs to the XMEGA family of devices.
18074
18075 @item __AVR_HAVE_ELPM__
18076 The device has the @code{ELPM} instruction.
18077
18078 @item __AVR_HAVE_ELPMX__
18079 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18080 R@var{n},Z+} instructions.
18081
18082 @item __AVR_HAVE_MOVW__
18083 The device has the @code{MOVW} instruction to perform 16-bit
18084 register-register moves.
18085
18086 @item __AVR_HAVE_LPMX__
18087 The device has the @code{LPM R@var{n},Z} and
18088 @code{LPM R@var{n},Z+} instructions.
18089
18090 @item __AVR_HAVE_MUL__
18091 The device has a hardware multiplier.
18092
18093 @item __AVR_HAVE_JMP_CALL__
18094 The device has the @code{JMP} and @code{CALL} instructions.
18095 This is the case for devices with more than 8@tie{}KiB of program
18096 memory.
18097
18098 @item __AVR_HAVE_EIJMP_EICALL__
18099 @itemx __AVR_3_BYTE_PC__
18100 The device has the @code{EIJMP} and @code{EICALL} instructions.
18101 This is the case for devices with more than 128@tie{}KiB of program memory.
18102 This also means that the program counter
18103 (PC) is 3@tie{}bytes wide.
18104
18105 @item __AVR_2_BYTE_PC__
18106 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18107 with up to 128@tie{}KiB of program memory.
18108
18109 @item __AVR_HAVE_8BIT_SP__
18110 @itemx __AVR_HAVE_16BIT_SP__
18111 The stack pointer (SP) register is treated as 8-bit respectively
18112 16-bit register by the compiler.
18113 The definition of these macros is affected by @option{-mtiny-stack}.
18114
18115 @item __AVR_HAVE_SPH__
18116 @itemx __AVR_SP8__
18117 The device has the SPH (high part of stack pointer) special function
18118 register or has an 8-bit stack pointer, respectively.
18119 The definition of these macros is affected by @option{-mmcu=} and
18120 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18121 by @option{-msp8}.
18122
18123 @item __AVR_HAVE_RAMPD__
18124 @itemx __AVR_HAVE_RAMPX__
18125 @itemx __AVR_HAVE_RAMPY__
18126 @itemx __AVR_HAVE_RAMPZ__
18127 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18128 @code{RAMPZ} special function register, respectively.
18129
18130 @item __NO_INTERRUPTS__
18131 This macro reflects the @option{-mno-interrupts} command-line option.
18132
18133 @item __AVR_ERRATA_SKIP__
18134 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18135 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18136 instructions because of a hardware erratum. Skip instructions are
18137 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18138 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18139 set.
18140
18141 @item __AVR_ISA_RMW__
18142 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18143
18144 @item __AVR_SFR_OFFSET__=@var{offset}
18145 Instructions that can address I/O special function registers directly
18146 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18147 address as if addressed by an instruction to access RAM like @code{LD}
18148 or @code{STS}. This offset depends on the device architecture and has
18149 to be subtracted from the RAM address in order to get the
18150 respective I/O@tie{}address.
18151
18152 @item __AVR_SHORT_CALLS__
18153 The @option{-mshort-calls} command line option is set.
18154
18155 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18156 Some devices support reading from flash memory by means of @code{LD*}
18157 instructions. The flash memory is seen in the data address space
18158 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18159 is not defined, this feature is not available. If defined,
18160 the address space is linear and there is no need to put
18161 @code{.rodata} into RAM. This is handled by the default linker
18162 description file, and is currently available for
18163 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18164 there is no need to use address spaces like @code{__flash} or
18165 features like attribute @code{progmem} and @code{pgm_read_*}.
18166
18167 @item __WITH_AVRLIBC__
18168 The compiler is configured to be used together with AVR-Libc.
18169 See the @option{--with-avrlibc} configure option.
18170
18171 @end table
18172
18173 @node Blackfin Options
18174 @subsection Blackfin Options
18175 @cindex Blackfin Options
18176
18177 @table @gcctabopt
18178 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18179 @opindex mcpu=
18180 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18181 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18182 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18183 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18184 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18185 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18186 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18187 @samp{bf561}, @samp{bf592}.
18188
18189 The optional @var{sirevision} specifies the silicon revision of the target
18190 Blackfin processor. Any workarounds available for the targeted silicon revision
18191 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18192 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18193 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18194 hexadecimal digits representing the major and minor numbers in the silicon
18195 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18196 is not defined. If @var{sirevision} is @samp{any}, the
18197 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18198 If this optional @var{sirevision} is not used, GCC assumes the latest known
18199 silicon revision of the targeted Blackfin processor.
18200
18201 GCC defines a preprocessor macro for the specified @var{cpu}.
18202 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18203 provided by libgloss to be linked in if @option{-msim} is not given.
18204
18205 Without this option, @samp{bf532} is used as the processor by default.
18206
18207 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18208 only the preprocessor macro is defined.
18209
18210 @item -msim
18211 @opindex msim
18212 Specifies that the program will be run on the simulator. This causes
18213 the simulator BSP provided by libgloss to be linked in. This option
18214 has effect only for @samp{bfin-elf} toolchain.
18215 Certain other options, such as @option{-mid-shared-library} and
18216 @option{-mfdpic}, imply @option{-msim}.
18217
18218 @item -momit-leaf-frame-pointer
18219 @opindex momit-leaf-frame-pointer
18220 Don't keep the frame pointer in a register for leaf functions. This
18221 avoids the instructions to save, set up and restore frame pointers and
18222 makes an extra register available in leaf functions.
18223
18224 @item -mspecld-anomaly
18225 @opindex mspecld-anomaly
18226 When enabled, the compiler ensures that the generated code does not
18227 contain speculative loads after jump instructions. If this option is used,
18228 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18229
18230 @item -mno-specld-anomaly
18231 @opindex mno-specld-anomaly
18232 @opindex mspecld-anomaly
18233 Don't generate extra code to prevent speculative loads from occurring.
18234
18235 @item -mcsync-anomaly
18236 @opindex mcsync-anomaly
18237 When enabled, the compiler ensures that the generated code does not
18238 contain CSYNC or SSYNC instructions too soon after conditional branches.
18239 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18240
18241 @item -mno-csync-anomaly
18242 @opindex mno-csync-anomaly
18243 @opindex mcsync-anomaly
18244 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18245 occurring too soon after a conditional branch.
18246
18247 @item -mlow64k
18248 @opindex mlow64k
18249 When enabled, the compiler is free to take advantage of the knowledge that
18250 the entire program fits into the low 64k of memory.
18251
18252 @item -mno-low64k
18253 @opindex mno-low64k
18254 Assume that the program is arbitrarily large. This is the default.
18255
18256 @item -mstack-check-l1
18257 @opindex mstack-check-l1
18258 Do stack checking using information placed into L1 scratchpad memory by the
18259 uClinux kernel.
18260
18261 @item -mid-shared-library
18262 @opindex mid-shared-library
18263 Generate code that supports shared libraries via the library ID method.
18264 This allows for execute in place and shared libraries in an environment
18265 without virtual memory management. This option implies @option{-fPIC}.
18266 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18267
18268 @item -mno-id-shared-library
18269 @opindex mno-id-shared-library
18270 @opindex mid-shared-library
18271 Generate code that doesn't assume ID-based shared libraries are being used.
18272 This is the default.
18273
18274 @item -mleaf-id-shared-library
18275 @opindex mleaf-id-shared-library
18276 Generate code that supports shared libraries via the library ID method,
18277 but assumes that this library or executable won't link against any other
18278 ID shared libraries. That allows the compiler to use faster code for jumps
18279 and calls.
18280
18281 @item -mno-leaf-id-shared-library
18282 @opindex mno-leaf-id-shared-library
18283 @opindex mleaf-id-shared-library
18284 Do not assume that the code being compiled won't link against any ID shared
18285 libraries. Slower code is generated for jump and call insns.
18286
18287 @item -mshared-library-id=n
18288 @opindex mshared-library-id
18289 Specifies the identification number of the ID-based shared library being
18290 compiled. Specifying a value of 0 generates more compact code; specifying
18291 other values forces the allocation of that number to the current
18292 library but is no more space- or time-efficient than omitting this option.
18293
18294 @item -msep-data
18295 @opindex msep-data
18296 Generate code that allows the data segment to be located in a different
18297 area of memory from the text segment. This allows for execute in place in
18298 an environment without virtual memory management by eliminating relocations
18299 against the text section.
18300
18301 @item -mno-sep-data
18302 @opindex mno-sep-data
18303 @opindex msep-data
18304 Generate code that assumes that the data segment follows the text segment.
18305 This is the default.
18306
18307 @item -mlong-calls
18308 @itemx -mno-long-calls
18309 @opindex mlong-calls
18310 @opindex mno-long-calls
18311 Tells the compiler to perform function calls by first loading the
18312 address of the function into a register and then performing a subroutine
18313 call on this register. This switch is needed if the target function
18314 lies outside of the 24-bit addressing range of the offset-based
18315 version of subroutine call instruction.
18316
18317 This feature is not enabled by default. Specifying
18318 @option{-mno-long-calls} restores the default behavior. Note these
18319 switches have no effect on how the compiler generates code to handle
18320 function calls via function pointers.
18321
18322 @item -mfast-fp
18323 @opindex mfast-fp
18324 Link with the fast floating-point library. This library relaxes some of
18325 the IEEE floating-point standard's rules for checking inputs against
18326 Not-a-Number (NAN), in the interest of performance.
18327
18328 @item -minline-plt
18329 @opindex minline-plt
18330 Enable inlining of PLT entries in function calls to functions that are
18331 not known to bind locally. It has no effect without @option{-mfdpic}.
18332
18333 @item -mmulticore
18334 @opindex mmulticore
18335 Build a standalone application for multicore Blackfin processors.
18336 This option causes proper start files and link scripts supporting
18337 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18338 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18339
18340 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18341 selects the one-application-per-core programming model. Without
18342 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18343 programming model is used. In this model, the main function of Core B
18344 should be named as @code{coreb_main}.
18345
18346 If this option is not used, the single-core application programming
18347 model is used.
18348
18349 @item -mcorea
18350 @opindex mcorea
18351 Build a standalone application for Core A of BF561 when using
18352 the one-application-per-core programming model. Proper start files
18353 and link scripts are used to support Core A, and the macro
18354 @code{__BFIN_COREA} is defined.
18355 This option can only be used in conjunction with @option{-mmulticore}.
18356
18357 @item -mcoreb
18358 @opindex mcoreb
18359 Build a standalone application for Core B of BF561 when using
18360 the one-application-per-core programming model. Proper start files
18361 and link scripts are used to support Core B, and the macro
18362 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18363 should be used instead of @code{main}.
18364 This option can only be used in conjunction with @option{-mmulticore}.
18365
18366 @item -msdram
18367 @opindex msdram
18368 Build a standalone application for SDRAM. Proper start files and
18369 link scripts are used to put the application into SDRAM, and the macro
18370 @code{__BFIN_SDRAM} is defined.
18371 The loader should initialize SDRAM before loading the application.
18372
18373 @item -micplb
18374 @opindex micplb
18375 Assume that ICPLBs are enabled at run time. This has an effect on certain
18376 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18377 are enabled; for standalone applications the default is off.
18378 @end table
18379
18380 @node C6X Options
18381 @subsection C6X Options
18382 @cindex C6X Options
18383
18384 @table @gcctabopt
18385 @item -march=@var{name}
18386 @opindex march
18387 This specifies the name of the target architecture. GCC uses this
18388 name to determine what kind of instructions it can emit when generating
18389 assembly code. Permissible names are: @samp{c62x},
18390 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18391
18392 @item -mbig-endian
18393 @opindex mbig-endian
18394 Generate code for a big-endian target.
18395
18396 @item -mlittle-endian
18397 @opindex mlittle-endian
18398 Generate code for a little-endian target. This is the default.
18399
18400 @item -msim
18401 @opindex msim
18402 Choose startup files and linker script suitable for the simulator.
18403
18404 @item -msdata=default
18405 @opindex msdata=default
18406 Put small global and static data in the @code{.neardata} section,
18407 which is pointed to by register @code{B14}. Put small uninitialized
18408 global and static data in the @code{.bss} section, which is adjacent
18409 to the @code{.neardata} section. Put small read-only data into the
18410 @code{.rodata} section. The corresponding sections used for large
18411 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18412
18413 @item -msdata=all
18414 @opindex msdata=all
18415 Put all data, not just small objects, into the sections reserved for
18416 small data, and use addressing relative to the @code{B14} register to
18417 access them.
18418
18419 @item -msdata=none
18420 @opindex msdata=none
18421 Make no use of the sections reserved for small data, and use absolute
18422 addresses to access all data. Put all initialized global and static
18423 data in the @code{.fardata} section, and all uninitialized data in the
18424 @code{.far} section. Put all constant data into the @code{.const}
18425 section.
18426 @end table
18427
18428 @node CRIS Options
18429 @subsection CRIS Options
18430 @cindex CRIS Options
18431
18432 These options are defined specifically for the CRIS ports.
18433
18434 @table @gcctabopt
18435 @item -march=@var{architecture-type}
18436 @itemx -mcpu=@var{architecture-type}
18437 @opindex march
18438 @opindex mcpu
18439 Generate code for the specified architecture. The choices for
18440 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18441 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18442 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18443 @samp{v10}.
18444
18445 @item -mtune=@var{architecture-type}
18446 @opindex mtune
18447 Tune to @var{architecture-type} everything applicable about the generated
18448 code, except for the ABI and the set of available instructions. The
18449 choices for @var{architecture-type} are the same as for
18450 @option{-march=@var{architecture-type}}.
18451
18452 @item -mmax-stack-frame=@var{n}
18453 @opindex mmax-stack-frame
18454 Warn when the stack frame of a function exceeds @var{n} bytes.
18455
18456 @item -metrax4
18457 @itemx -metrax100
18458 @opindex metrax4
18459 @opindex metrax100
18460 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18461 @option{-march=v3} and @option{-march=v8} respectively.
18462
18463 @item -mmul-bug-workaround
18464 @itemx -mno-mul-bug-workaround
18465 @opindex mmul-bug-workaround
18466 @opindex mno-mul-bug-workaround
18467 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18468 models where it applies. This option is active by default.
18469
18470 @item -mpdebug
18471 @opindex mpdebug
18472 Enable CRIS-specific verbose debug-related information in the assembly
18473 code. This option also has the effect of turning off the @samp{#NO_APP}
18474 formatted-code indicator to the assembler at the beginning of the
18475 assembly file.
18476
18477 @item -mcc-init
18478 @opindex mcc-init
18479 Do not use condition-code results from previous instruction; always emit
18480 compare and test instructions before use of condition codes.
18481
18482 @item -mno-side-effects
18483 @opindex mno-side-effects
18484 @opindex mside-effects
18485 Do not emit instructions with side effects in addressing modes other than
18486 post-increment.
18487
18488 @item -mstack-align
18489 @itemx -mno-stack-align
18490 @itemx -mdata-align
18491 @itemx -mno-data-align
18492 @itemx -mconst-align
18493 @itemx -mno-const-align
18494 @opindex mstack-align
18495 @opindex mno-stack-align
18496 @opindex mdata-align
18497 @opindex mno-data-align
18498 @opindex mconst-align
18499 @opindex mno-const-align
18500 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18501 stack frame, individual data and constants to be aligned for the maximum
18502 single data access size for the chosen CPU model. The default is to
18503 arrange for 32-bit alignment. ABI details such as structure layout are
18504 not affected by these options.
18505
18506 @item -m32-bit
18507 @itemx -m16-bit
18508 @itemx -m8-bit
18509 @opindex m32-bit
18510 @opindex m16-bit
18511 @opindex m8-bit
18512 Similar to the stack- data- and const-align options above, these options
18513 arrange for stack frame, writable data and constants to all be 32-bit,
18514 16-bit or 8-bit aligned. The default is 32-bit alignment.
18515
18516 @item -mno-prologue-epilogue
18517 @itemx -mprologue-epilogue
18518 @opindex mno-prologue-epilogue
18519 @opindex mprologue-epilogue
18520 With @option{-mno-prologue-epilogue}, the normal function prologue and
18521 epilogue which set up the stack frame are omitted and no return
18522 instructions or return sequences are generated in the code. Use this
18523 option only together with visual inspection of the compiled code: no
18524 warnings or errors are generated when call-saved registers must be saved,
18525 or storage for local variables needs to be allocated.
18526
18527 @item -mno-gotplt
18528 @itemx -mgotplt
18529 @opindex mno-gotplt
18530 @opindex mgotplt
18531 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18532 instruction sequences that load addresses for functions from the PLT part
18533 of the GOT rather than (traditional on other architectures) calls to the
18534 PLT@. The default is @option{-mgotplt}.
18535
18536 @item -melf
18537 @opindex melf
18538 Legacy no-op option only recognized with the cris-axis-elf and
18539 cris-axis-linux-gnu targets.
18540
18541 @item -mlinux
18542 @opindex mlinux
18543 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18544
18545 @item -sim
18546 @opindex sim
18547 This option, recognized for the cris-axis-elf, arranges
18548 to link with input-output functions from a simulator library. Code,
18549 initialized data and zero-initialized data are allocated consecutively.
18550
18551 @item -sim2
18552 @opindex sim2
18553 Like @option{-sim}, but pass linker options to locate initialized data at
18554 0x40000000 and zero-initialized data at 0x80000000.
18555 @end table
18556
18557 @node CR16 Options
18558 @subsection CR16 Options
18559 @cindex CR16 Options
18560
18561 These options are defined specifically for the CR16 ports.
18562
18563 @table @gcctabopt
18564
18565 @item -mmac
18566 @opindex mmac
18567 Enable the use of multiply-accumulate instructions. Disabled by default.
18568
18569 @item -mcr16cplus
18570 @itemx -mcr16c
18571 @opindex mcr16cplus
18572 @opindex mcr16c
18573 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18574 is default.
18575
18576 @item -msim
18577 @opindex msim
18578 Links the library libsim.a which is in compatible with simulator. Applicable
18579 to ELF compiler only.
18580
18581 @item -mint32
18582 @opindex mint32
18583 Choose integer type as 32-bit wide.
18584
18585 @item -mbit-ops
18586 @opindex mbit-ops
18587 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18588
18589 @item -mdata-model=@var{model}
18590 @opindex mdata-model
18591 Choose a data model. The choices for @var{model} are @samp{near},
18592 @samp{far} or @samp{medium}. @samp{medium} is default.
18593 However, @samp{far} is not valid with @option{-mcr16c}, as the
18594 CR16C architecture does not support the far data model.
18595 @end table
18596
18597 @node C-SKY Options
18598 @subsection C-SKY Options
18599 @cindex C-SKY Options
18600
18601 GCC supports these options when compiling for C-SKY V2 processors.
18602
18603 @table @gcctabopt
18604
18605 @item -march=@var{arch}
18606 @opindex march=
18607 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18608 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18609 The default is @samp{ck810}.
18610
18611 @item -mcpu=@var{cpu}
18612 @opindex mcpu=
18613 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18614 @samp{ck801}, @samp{ck801t},
18615 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18616 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18617 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18618 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18619 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18620 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18621 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18622 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18623 @samp{ck803eftr1}, @samp{ck803efhtr1},
18624 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18625 @samp{ck803sef}, @samp{ck803seft},
18626 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18627 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18628 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18629 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18630
18631 @item -mbig-endian
18632 @opindex mbig-endian
18633 @itemx -EB
18634 @opindex EB
18635 @itemx -mlittle-endian
18636 @opindex mlittle-endian
18637 @itemx -EL
18638 @opindex EL
18639
18640 Select big- or little-endian code. The default is little-endian.
18641
18642 @item -mhard-float
18643 @opindex mhard-float
18644 @itemx -msoft-float
18645 @opindex msoft-float
18646
18647 Select hardware or software floating-point implementations.
18648 The default is soft float.
18649
18650 @item -mdouble-float
18651 @itemx -mno-double-float
18652 @opindex mdouble-float
18653 When @option{-mhard-float} is in effect, enable generation of
18654 double-precision float instructions. This is the default except
18655 when compiling for CK803.
18656
18657 @item -mfdivdu
18658 @itemx -mno-fdivdu
18659 @opindex mfdivdu
18660 When @option{-mhard-float} is in effect, enable generation of
18661 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18662 This is the default except when compiling for CK803.
18663
18664 @item -mfpu=@var{fpu}
18665 @opindex mfpu=
18666 Select the floating-point processor. This option can only be used with
18667 @option{-mhard-float}.
18668 Values for @var{fpu} are
18669 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18670 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18671 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18672
18673 @item -melrw
18674 @itemx -mno-elrw
18675 @opindex melrw
18676 Enable the extended @code{lrw} instruction. This option defaults to on
18677 for CK801 and off otherwise.
18678
18679 @item -mistack
18680 @itemx -mno-istack
18681 @opindex mistack
18682 Enable interrupt stack instructions; the default is off.
18683
18684 The @option{-mistack} option is required to handle the
18685 @code{interrupt} and @code{isr} function attributes
18686 (@pxref{C-SKY Function Attributes}).
18687
18688 @item -mmp
18689 @opindex mmp
18690 Enable multiprocessor instructions; the default is off.
18691
18692 @item -mcp
18693 @opindex mcp
18694 Enable coprocessor instructions; the default is off.
18695
18696 @item -mcache
18697 @opindex mcache
18698 Enable coprocessor instructions; the default is off.
18699
18700 @item -msecurity
18701 @opindex msecurity
18702 Enable C-SKY security instructions; the default is off.
18703
18704 @item -mtrust
18705 @opindex mtrust
18706 Enable C-SKY trust instructions; the default is off.
18707
18708 @item -mdsp
18709 @opindex mdsp
18710 @itemx -medsp
18711 @opindex medsp
18712 @itemx -mvdsp
18713 @opindex mvdsp
18714 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18715 All of these options default to off.
18716
18717 @item -mdiv
18718 @itemx -mno-div
18719 @opindex mdiv
18720 Generate divide instructions. Default is off.
18721
18722 @item -msmart
18723 @itemx -mno-smart
18724 @opindex msmart
18725 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18726 use of 16-bit instructions. This option is ignored for CK801 where this
18727 is the required behavior, and it defaults to on for CK802.
18728 For other targets, the default is off.
18729
18730 @item -mhigh-registers
18731 @itemx -mno-high-registers
18732 @opindex mhigh-registers
18733 Generate code using the high registers numbered 16-31. This option
18734 is not supported on CK801, CK802, or CK803, and is enabled by default
18735 for other processors.
18736
18737 @item -manchor
18738 @itemx -mno-anchor
18739 @opindex manchor
18740 Generate code using global anchor symbol addresses.
18741
18742 @item -mpushpop
18743 @itemx -mno-pushpop
18744 @opindex mpushpop
18745 Generate code using @code{push} and @code{pop} instructions. This option
18746 defaults to on.
18747
18748 @item -mmultiple-stld
18749 @itemx -mstm
18750 @itemx -mno-multiple-stld
18751 @itemx -mno-stm
18752 @opindex mmultiple-stld
18753 Generate code using @code{stm} and @code{ldm} instructions. This option
18754 isn't supported on CK801 but is enabled by default on other processors.
18755
18756 @item -mconstpool
18757 @itemx -mno-constpool
18758 @opindex mconstpool
18759 Create constant pools in the compiler instead of deferring it to the
18760 assembler. This option is the default and required for correct code
18761 generation on CK801 and CK802, and is optional on other processors.
18762
18763 @item -mstack-size
18764 @item -mno-stack-size
18765 @opindex mstack-size
18766 Emit @code{.stack_size} directives for each function in the assembly
18767 output. This option defaults to off.
18768
18769 @item -mccrt
18770 @itemx -mno-ccrt
18771 @opindex mccrt
18772 Generate code for the C-SKY compiler runtime instead of libgcc. This
18773 option defaults to off.
18774
18775 @item -mbranch-cost=@var{n}
18776 @opindex mbranch-cost=
18777 Set the branch costs to roughly @code{n} instructions. The default is 1.
18778
18779 @item -msched-prolog
18780 @itemx -mno-sched-prolog
18781 @opindex msched-prolog
18782 Permit scheduling of function prologue and epilogue sequences. Using
18783 this option can result in code that is not compliant with the C-SKY V2 ABI
18784 prologue requirements and that cannot be debugged or backtraced.
18785 It is disabled by default.
18786
18787 @end table
18788
18789 @node Darwin Options
18790 @subsection Darwin Options
18791 @cindex Darwin options
18792
18793 These options are defined for all architectures running the Darwin operating
18794 system.
18795
18796 FSF GCC on Darwin does not create ``fat'' object files; it creates
18797 an object file for the single architecture that GCC was built to
18798 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18799 @option{-arch} options are used; it does so by running the compiler or
18800 linker multiple times and joining the results together with
18801 @file{lipo}.
18802
18803 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18804 @samp{i686}) is determined by the flags that specify the ISA
18805 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18806 @option{-force_cpusubtype_ALL} option can be used to override this.
18807
18808 The Darwin tools vary in their behavior when presented with an ISA
18809 mismatch. The assembler, @file{as}, only permits instructions to
18810 be used that are valid for the subtype of the file it is generating,
18811 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18812 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18813 and prints an error if asked to create a shared library with a less
18814 restrictive subtype than its input files (for instance, trying to put
18815 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18816 for executables, @command{ld}, quietly gives the executable the most
18817 restrictive subtype of any of its input files.
18818
18819 @table @gcctabopt
18820 @item -F@var{dir}
18821 @opindex F
18822 Add the framework directory @var{dir} to the head of the list of
18823 directories to be searched for header files. These directories are
18824 interleaved with those specified by @option{-I} options and are
18825 scanned in a left-to-right order.
18826
18827 A framework directory is a directory with frameworks in it. A
18828 framework is a directory with a @file{Headers} and/or
18829 @file{PrivateHeaders} directory contained directly in it that ends
18830 in @file{.framework}. The name of a framework is the name of this
18831 directory excluding the @file{.framework}. Headers associated with
18832 the framework are found in one of those two directories, with
18833 @file{Headers} being searched first. A subframework is a framework
18834 directory that is in a framework's @file{Frameworks} directory.
18835 Includes of subframework headers can only appear in a header of a
18836 framework that contains the subframework, or in a sibling subframework
18837 header. Two subframeworks are siblings if they occur in the same
18838 framework. A subframework should not have the same name as a
18839 framework; a warning is issued if this is violated. Currently a
18840 subframework cannot have subframeworks; in the future, the mechanism
18841 may be extended to support this. The standard frameworks can be found
18842 in @file{/System/Library/Frameworks} and
18843 @file{/Library/Frameworks}. An example include looks like
18844 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18845 the name of the framework and @file{header.h} is found in the
18846 @file{PrivateHeaders} or @file{Headers} directory.
18847
18848 @item -iframework@var{dir}
18849 @opindex iframework
18850 Like @option{-F} except the directory is a treated as a system
18851 directory. The main difference between this @option{-iframework} and
18852 @option{-F} is that with @option{-iframework} the compiler does not
18853 warn about constructs contained within header files found via
18854 @var{dir}. This option is valid only for the C family of languages.
18855
18856 @item -gused
18857 @opindex gused
18858 Emit debugging information for symbols that are used. For stabs
18859 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18860 This is by default ON@.
18861
18862 @item -gfull
18863 @opindex gfull
18864 Emit debugging information for all symbols and types.
18865
18866 @item -mmacosx-version-min=@var{version}
18867 The earliest version of MacOS X that this executable will run on
18868 is @var{version}. Typical values of @var{version} include @code{10.1},
18869 @code{10.2}, and @code{10.3.9}.
18870
18871 If the compiler was built to use the system's headers by default,
18872 then the default for this option is the system version on which the
18873 compiler is running, otherwise the default is to make choices that
18874 are compatible with as many systems and code bases as possible.
18875
18876 @item -mkernel
18877 @opindex mkernel
18878 Enable kernel development mode. The @option{-mkernel} option sets
18879 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18880 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18881 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18882 applicable. This mode also sets @option{-mno-altivec},
18883 @option{-msoft-float}, @option{-fno-builtin} and
18884 @option{-mlong-branch} for PowerPC targets.
18885
18886 @item -mone-byte-bool
18887 @opindex mone-byte-bool
18888 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18889 By default @code{sizeof(bool)} is @code{4} when compiling for
18890 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18891 option has no effect on x86.
18892
18893 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18894 to generate code that is not binary compatible with code generated
18895 without that switch. Using this switch may require recompiling all
18896 other modules in a program, including system libraries. Use this
18897 switch to conform to a non-default data model.
18898
18899 @item -mfix-and-continue
18900 @itemx -ffix-and-continue
18901 @itemx -findirect-data
18902 @opindex mfix-and-continue
18903 @opindex ffix-and-continue
18904 @opindex findirect-data
18905 Generate code suitable for fast turnaround development, such as to
18906 allow GDB to dynamically load @file{.o} files into already-running
18907 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18908 are provided for backwards compatibility.
18909
18910 @item -all_load
18911 @opindex all_load
18912 Loads all members of static archive libraries.
18913 See man ld(1) for more information.
18914
18915 @item -arch_errors_fatal
18916 @opindex arch_errors_fatal
18917 Cause the errors having to do with files that have the wrong architecture
18918 to be fatal.
18919
18920 @item -bind_at_load
18921 @opindex bind_at_load
18922 Causes the output file to be marked such that the dynamic linker will
18923 bind all undefined references when the file is loaded or launched.
18924
18925 @item -bundle
18926 @opindex bundle
18927 Produce a Mach-o bundle format file.
18928 See man ld(1) for more information.
18929
18930 @item -bundle_loader @var{executable}
18931 @opindex bundle_loader
18932 This option specifies the @var{executable} that will load the build
18933 output file being linked. See man ld(1) for more information.
18934
18935 @item -dynamiclib
18936 @opindex dynamiclib
18937 When passed this option, GCC produces a dynamic library instead of
18938 an executable when linking, using the Darwin @file{libtool} command.
18939
18940 @item -force_cpusubtype_ALL
18941 @opindex force_cpusubtype_ALL
18942 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18943 one controlled by the @option{-mcpu} or @option{-march} option.
18944
18945 @item -allowable_client @var{client_name}
18946 @itemx -client_name
18947 @itemx -compatibility_version
18948 @itemx -current_version
18949 @itemx -dead_strip
18950 @itemx -dependency-file
18951 @itemx -dylib_file
18952 @itemx -dylinker_install_name
18953 @itemx -dynamic
18954 @itemx -exported_symbols_list
18955 @itemx -filelist
18956 @need 800
18957 @itemx -flat_namespace
18958 @itemx -force_flat_namespace
18959 @itemx -headerpad_max_install_names
18960 @itemx -image_base
18961 @itemx -init
18962 @itemx -install_name
18963 @itemx -keep_private_externs
18964 @itemx -multi_module
18965 @itemx -multiply_defined
18966 @itemx -multiply_defined_unused
18967 @need 800
18968 @itemx -noall_load
18969 @itemx -no_dead_strip_inits_and_terms
18970 @itemx -nofixprebinding
18971 @itemx -nomultidefs
18972 @itemx -noprebind
18973 @itemx -noseglinkedit
18974 @itemx -pagezero_size
18975 @itemx -prebind
18976 @itemx -prebind_all_twolevel_modules
18977 @itemx -private_bundle
18978 @need 800
18979 @itemx -read_only_relocs
18980 @itemx -sectalign
18981 @itemx -sectobjectsymbols
18982 @itemx -whyload
18983 @itemx -seg1addr
18984 @itemx -sectcreate
18985 @itemx -sectobjectsymbols
18986 @itemx -sectorder
18987 @itemx -segaddr
18988 @itemx -segs_read_only_addr
18989 @need 800
18990 @itemx -segs_read_write_addr
18991 @itemx -seg_addr_table
18992 @itemx -seg_addr_table_filename
18993 @itemx -seglinkedit
18994 @itemx -segprot
18995 @itemx -segs_read_only_addr
18996 @itemx -segs_read_write_addr
18997 @itemx -single_module
18998 @itemx -static
18999 @itemx -sub_library
19000 @need 800
19001 @itemx -sub_umbrella
19002 @itemx -twolevel_namespace
19003 @itemx -umbrella
19004 @itemx -undefined
19005 @itemx -unexported_symbols_list
19006 @itemx -weak_reference_mismatches
19007 @itemx -whatsloaded
19008 @opindex allowable_client
19009 @opindex client_name
19010 @opindex compatibility_version
19011 @opindex current_version
19012 @opindex dead_strip
19013 @opindex dependency-file
19014 @opindex dylib_file
19015 @opindex dylinker_install_name
19016 @opindex dynamic
19017 @opindex exported_symbols_list
19018 @opindex filelist
19019 @opindex flat_namespace
19020 @opindex force_flat_namespace
19021 @opindex headerpad_max_install_names
19022 @opindex image_base
19023 @opindex init
19024 @opindex install_name
19025 @opindex keep_private_externs
19026 @opindex multi_module
19027 @opindex multiply_defined
19028 @opindex multiply_defined_unused
19029 @opindex noall_load
19030 @opindex no_dead_strip_inits_and_terms
19031 @opindex nofixprebinding
19032 @opindex nomultidefs
19033 @opindex noprebind
19034 @opindex noseglinkedit
19035 @opindex pagezero_size
19036 @opindex prebind
19037 @opindex prebind_all_twolevel_modules
19038 @opindex private_bundle
19039 @opindex read_only_relocs
19040 @opindex sectalign
19041 @opindex sectobjectsymbols
19042 @opindex whyload
19043 @opindex seg1addr
19044 @opindex sectcreate
19045 @opindex sectobjectsymbols
19046 @opindex sectorder
19047 @opindex segaddr
19048 @opindex segs_read_only_addr
19049 @opindex segs_read_write_addr
19050 @opindex seg_addr_table
19051 @opindex seg_addr_table_filename
19052 @opindex seglinkedit
19053 @opindex segprot
19054 @opindex segs_read_only_addr
19055 @opindex segs_read_write_addr
19056 @opindex single_module
19057 @opindex static
19058 @opindex sub_library
19059 @opindex sub_umbrella
19060 @opindex twolevel_namespace
19061 @opindex umbrella
19062 @opindex undefined
19063 @opindex unexported_symbols_list
19064 @opindex weak_reference_mismatches
19065 @opindex whatsloaded
19066 These options are passed to the Darwin linker. The Darwin linker man page
19067 describes them in detail.
19068 @end table
19069
19070 @node DEC Alpha Options
19071 @subsection DEC Alpha Options
19072
19073 These @samp{-m} options are defined for the DEC Alpha implementations:
19074
19075 @table @gcctabopt
19076 @item -mno-soft-float
19077 @itemx -msoft-float
19078 @opindex mno-soft-float
19079 @opindex msoft-float
19080 Use (do not use) the hardware floating-point instructions for
19081 floating-point operations. When @option{-msoft-float} is specified,
19082 functions in @file{libgcc.a} are used to perform floating-point
19083 operations. Unless they are replaced by routines that emulate the
19084 floating-point operations, or compiled in such a way as to call such
19085 emulations routines, these routines issue floating-point
19086 operations. If you are compiling for an Alpha without floating-point
19087 operations, you must ensure that the library is built so as not to call
19088 them.
19089
19090 Note that Alpha implementations without floating-point operations are
19091 required to have floating-point registers.
19092
19093 @item -mfp-reg
19094 @itemx -mno-fp-regs
19095 @opindex mfp-reg
19096 @opindex mno-fp-regs
19097 Generate code that uses (does not use) the floating-point register set.
19098 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19099 register set is not used, floating-point operands are passed in integer
19100 registers as if they were integers and floating-point results are passed
19101 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19102 so any function with a floating-point argument or return value called by code
19103 compiled with @option{-mno-fp-regs} must also be compiled with that
19104 option.
19105
19106 A typical use of this option is building a kernel that does not use,
19107 and hence need not save and restore, any floating-point registers.
19108
19109 @item -mieee
19110 @opindex mieee
19111 The Alpha architecture implements floating-point hardware optimized for
19112 maximum performance. It is mostly compliant with the IEEE floating-point
19113 standard. However, for full compliance, software assistance is
19114 required. This option generates code fully IEEE-compliant code
19115 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19116 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19117 defined during compilation. The resulting code is less efficient but is
19118 able to correctly support denormalized numbers and exceptional IEEE
19119 values such as not-a-number and plus/minus infinity. Other Alpha
19120 compilers call this option @option{-ieee_with_no_inexact}.
19121
19122 @item -mieee-with-inexact
19123 @opindex mieee-with-inexact
19124 This is like @option{-mieee} except the generated code also maintains
19125 the IEEE @var{inexact-flag}. Turning on this option causes the
19126 generated code to implement fully-compliant IEEE math. In addition to
19127 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19128 macro. On some Alpha implementations the resulting code may execute
19129 significantly slower than the code generated by default. Since there is
19130 very little code that depends on the @var{inexact-flag}, you should
19131 normally not specify this option. Other Alpha compilers call this
19132 option @option{-ieee_with_inexact}.
19133
19134 @item -mfp-trap-mode=@var{trap-mode}
19135 @opindex mfp-trap-mode
19136 This option controls what floating-point related traps are enabled.
19137 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19138 The trap mode can be set to one of four values:
19139
19140 @table @samp
19141 @item n
19142 This is the default (normal) setting. The only traps that are enabled
19143 are the ones that cannot be disabled in software (e.g., division by zero
19144 trap).
19145
19146 @item u
19147 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19148 as well.
19149
19150 @item su
19151 Like @samp{u}, but the instructions are marked to be safe for software
19152 completion (see Alpha architecture manual for details).
19153
19154 @item sui
19155 Like @samp{su}, but inexact traps are enabled as well.
19156 @end table
19157
19158 @item -mfp-rounding-mode=@var{rounding-mode}
19159 @opindex mfp-rounding-mode
19160 Selects the IEEE rounding mode. Other Alpha compilers call this option
19161 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19162 of:
19163
19164 @table @samp
19165 @item n
19166 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19167 the nearest machine number or towards the even machine number in case
19168 of a tie.
19169
19170 @item m
19171 Round towards minus infinity.
19172
19173 @item c
19174 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19175
19176 @item d
19177 Dynamic rounding mode. A field in the floating-point control register
19178 (@var{fpcr}, see Alpha architecture reference manual) controls the
19179 rounding mode in effect. The C library initializes this register for
19180 rounding towards plus infinity. Thus, unless your program modifies the
19181 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19182 @end table
19183
19184 @item -mtrap-precision=@var{trap-precision}
19185 @opindex mtrap-precision
19186 In the Alpha architecture, floating-point traps are imprecise. This
19187 means without software assistance it is impossible to recover from a
19188 floating trap and program execution normally needs to be terminated.
19189 GCC can generate code that can assist operating system trap handlers
19190 in determining the exact location that caused a floating-point trap.
19191 Depending on the requirements of an application, different levels of
19192 precisions can be selected:
19193
19194 @table @samp
19195 @item p
19196 Program precision. This option is the default and means a trap handler
19197 can only identify which program caused a floating-point exception.
19198
19199 @item f
19200 Function precision. The trap handler can determine the function that
19201 caused a floating-point exception.
19202
19203 @item i
19204 Instruction precision. The trap handler can determine the exact
19205 instruction that caused a floating-point exception.
19206 @end table
19207
19208 Other Alpha compilers provide the equivalent options called
19209 @option{-scope_safe} and @option{-resumption_safe}.
19210
19211 @item -mieee-conformant
19212 @opindex mieee-conformant
19213 This option marks the generated code as IEEE conformant. You must not
19214 use this option unless you also specify @option{-mtrap-precision=i} and either
19215 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19216 is to emit the line @samp{.eflag 48} in the function prologue of the
19217 generated assembly file.
19218
19219 @item -mbuild-constants
19220 @opindex mbuild-constants
19221 Normally GCC examines a 32- or 64-bit integer constant to
19222 see if it can construct it from smaller constants in two or three
19223 instructions. If it cannot, it outputs the constant as a literal and
19224 generates code to load it from the data segment at run time.
19225
19226 Use this option to require GCC to construct @emph{all} integer constants
19227 using code, even if it takes more instructions (the maximum is six).
19228
19229 You typically use this option to build a shared library dynamic
19230 loader. Itself a shared library, it must relocate itself in memory
19231 before it can find the variables and constants in its own data segment.
19232
19233 @item -mbwx
19234 @itemx -mno-bwx
19235 @itemx -mcix
19236 @itemx -mno-cix
19237 @itemx -mfix
19238 @itemx -mno-fix
19239 @itemx -mmax
19240 @itemx -mno-max
19241 @opindex mbwx
19242 @opindex mno-bwx
19243 @opindex mcix
19244 @opindex mno-cix
19245 @opindex mfix
19246 @opindex mno-fix
19247 @opindex mmax
19248 @opindex mno-max
19249 Indicate whether GCC should generate code to use the optional BWX,
19250 CIX, FIX and MAX instruction sets. The default is to use the instruction
19251 sets supported by the CPU type specified via @option{-mcpu=} option or that
19252 of the CPU on which GCC was built if none is specified.
19253
19254 @item -mfloat-vax
19255 @itemx -mfloat-ieee
19256 @opindex mfloat-vax
19257 @opindex mfloat-ieee
19258 Generate code that uses (does not use) VAX F and G floating-point
19259 arithmetic instead of IEEE single and double precision.
19260
19261 @item -mexplicit-relocs
19262 @itemx -mno-explicit-relocs
19263 @opindex mexplicit-relocs
19264 @opindex mno-explicit-relocs
19265 Older Alpha assemblers provided no way to generate symbol relocations
19266 except via assembler macros. Use of these macros does not allow
19267 optimal instruction scheduling. GNU binutils as of version 2.12
19268 supports a new syntax that allows the compiler to explicitly mark
19269 which relocations should apply to which instructions. This option
19270 is mostly useful for debugging, as GCC detects the capabilities of
19271 the assembler when it is built and sets the default accordingly.
19272
19273 @item -msmall-data
19274 @itemx -mlarge-data
19275 @opindex msmall-data
19276 @opindex mlarge-data
19277 When @option{-mexplicit-relocs} is in effect, static data is
19278 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19279 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19280 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19281 16-bit relocations off of the @code{$gp} register. This limits the
19282 size of the small data area to 64KB, but allows the variables to be
19283 directly accessed via a single instruction.
19284
19285 The default is @option{-mlarge-data}. With this option the data area
19286 is limited to just below 2GB@. Programs that require more than 2GB of
19287 data must use @code{malloc} or @code{mmap} to allocate the data in the
19288 heap instead of in the program's data segment.
19289
19290 When generating code for shared libraries, @option{-fpic} implies
19291 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19292
19293 @item -msmall-text
19294 @itemx -mlarge-text
19295 @opindex msmall-text
19296 @opindex mlarge-text
19297 When @option{-msmall-text} is used, the compiler assumes that the
19298 code of the entire program (or shared library) fits in 4MB, and is
19299 thus reachable with a branch instruction. When @option{-msmall-data}
19300 is used, the compiler can assume that all local symbols share the
19301 same @code{$gp} value, and thus reduce the number of instructions
19302 required for a function call from 4 to 1.
19303
19304 The default is @option{-mlarge-text}.
19305
19306 @item -mcpu=@var{cpu_type}
19307 @opindex mcpu
19308 Set the instruction set and instruction scheduling parameters for
19309 machine type @var{cpu_type}. You can specify either the @samp{EV}
19310 style name or the corresponding chip number. GCC supports scheduling
19311 parameters for the EV4, EV5 and EV6 family of processors and
19312 chooses the default values for the instruction set from the processor
19313 you specify. If you do not specify a processor type, GCC defaults
19314 to the processor on which the compiler was built.
19315
19316 Supported values for @var{cpu_type} are
19317
19318 @table @samp
19319 @item ev4
19320 @itemx ev45
19321 @itemx 21064
19322 Schedules as an EV4 and has no instruction set extensions.
19323
19324 @item ev5
19325 @itemx 21164
19326 Schedules as an EV5 and has no instruction set extensions.
19327
19328 @item ev56
19329 @itemx 21164a
19330 Schedules as an EV5 and supports the BWX extension.
19331
19332 @item pca56
19333 @itemx 21164pc
19334 @itemx 21164PC
19335 Schedules as an EV5 and supports the BWX and MAX extensions.
19336
19337 @item ev6
19338 @itemx 21264
19339 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19340
19341 @item ev67
19342 @itemx 21264a
19343 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19344 @end table
19345
19346 Native toolchains also support the value @samp{native},
19347 which selects the best architecture option for the host processor.
19348 @option{-mcpu=native} has no effect if GCC does not recognize
19349 the processor.
19350
19351 @item -mtune=@var{cpu_type}
19352 @opindex mtune
19353 Set only the instruction scheduling parameters for machine type
19354 @var{cpu_type}. The instruction set is not changed.
19355
19356 Native toolchains also support the value @samp{native},
19357 which selects the best architecture option for the host processor.
19358 @option{-mtune=native} has no effect if GCC does not recognize
19359 the processor.
19360
19361 @item -mmemory-latency=@var{time}
19362 @opindex mmemory-latency
19363 Sets the latency the scheduler should assume for typical memory
19364 references as seen by the application. This number is highly
19365 dependent on the memory access patterns used by the application
19366 and the size of the external cache on the machine.
19367
19368 Valid options for @var{time} are
19369
19370 @table @samp
19371 @item @var{number}
19372 A decimal number representing clock cycles.
19373
19374 @item L1
19375 @itemx L2
19376 @itemx L3
19377 @itemx main
19378 The compiler contains estimates of the number of clock cycles for
19379 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19380 (also called Dcache, Scache, and Bcache), as well as to main memory.
19381 Note that L3 is only valid for EV5.
19382
19383 @end table
19384 @end table
19385
19386 @node FR30 Options
19387 @subsection FR30 Options
19388 @cindex FR30 Options
19389
19390 These options are defined specifically for the FR30 port.
19391
19392 @table @gcctabopt
19393
19394 @item -msmall-model
19395 @opindex msmall-model
19396 Use the small address space model. This can produce smaller code, but
19397 it does assume that all symbolic values and addresses fit into a
19398 20-bit range.
19399
19400 @item -mno-lsim
19401 @opindex mno-lsim
19402 Assume that runtime support has been provided and so there is no need
19403 to include the simulator library (@file{libsim.a}) on the linker
19404 command line.
19405
19406 @end table
19407
19408 @node FT32 Options
19409 @subsection FT32 Options
19410 @cindex FT32 Options
19411
19412 These options are defined specifically for the FT32 port.
19413
19414 @table @gcctabopt
19415
19416 @item -msim
19417 @opindex msim
19418 Specifies that the program will be run on the simulator. This causes
19419 an alternate runtime startup and library to be linked.
19420 You must not use this option when generating programs that will run on
19421 real hardware; you must provide your own runtime library for whatever
19422 I/O functions are needed.
19423
19424 @item -mlra
19425 @opindex mlra
19426 Enable Local Register Allocation. This is still experimental for FT32,
19427 so by default the compiler uses standard reload.
19428
19429 @item -mnodiv
19430 @opindex mnodiv
19431 Do not use div and mod instructions.
19432
19433 @item -mft32b
19434 @opindex mft32b
19435 Enable use of the extended instructions of the FT32B processor.
19436
19437 @item -mcompress
19438 @opindex mcompress
19439 Compress all code using the Ft32B code compression scheme.
19440
19441 @item -mnopm
19442 @opindex mnopm
19443 Do not generate code that reads program memory.
19444
19445 @end table
19446
19447 @node FRV Options
19448 @subsection FRV Options
19449 @cindex FRV Options
19450
19451 @table @gcctabopt
19452 @item -mgpr-32
19453 @opindex mgpr-32
19454
19455 Only use the first 32 general-purpose registers.
19456
19457 @item -mgpr-64
19458 @opindex mgpr-64
19459
19460 Use all 64 general-purpose registers.
19461
19462 @item -mfpr-32
19463 @opindex mfpr-32
19464
19465 Use only the first 32 floating-point registers.
19466
19467 @item -mfpr-64
19468 @opindex mfpr-64
19469
19470 Use all 64 floating-point registers.
19471
19472 @item -mhard-float
19473 @opindex mhard-float
19474
19475 Use hardware instructions for floating-point operations.
19476
19477 @item -msoft-float
19478 @opindex msoft-float
19479
19480 Use library routines for floating-point operations.
19481
19482 @item -malloc-cc
19483 @opindex malloc-cc
19484
19485 Dynamically allocate condition code registers.
19486
19487 @item -mfixed-cc
19488 @opindex mfixed-cc
19489
19490 Do not try to dynamically allocate condition code registers, only
19491 use @code{icc0} and @code{fcc0}.
19492
19493 @item -mdword
19494 @opindex mdword
19495
19496 Change ABI to use double word insns.
19497
19498 @item -mno-dword
19499 @opindex mno-dword
19500 @opindex mdword
19501
19502 Do not use double word instructions.
19503
19504 @item -mdouble
19505 @opindex mdouble
19506
19507 Use floating-point double instructions.
19508
19509 @item -mno-double
19510 @opindex mno-double
19511
19512 Do not use floating-point double instructions.
19513
19514 @item -mmedia
19515 @opindex mmedia
19516
19517 Use media instructions.
19518
19519 @item -mno-media
19520 @opindex mno-media
19521
19522 Do not use media instructions.
19523
19524 @item -mmuladd
19525 @opindex mmuladd
19526
19527 Use multiply and add/subtract instructions.
19528
19529 @item -mno-muladd
19530 @opindex mno-muladd
19531
19532 Do not use multiply and add/subtract instructions.
19533
19534 @item -mfdpic
19535 @opindex mfdpic
19536
19537 Select the FDPIC ABI, which uses function descriptors to represent
19538 pointers to functions. Without any PIC/PIE-related options, it
19539 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19540 assumes GOT entries and small data are within a 12-bit range from the
19541 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19542 are computed with 32 bits.
19543 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19544
19545 @item -minline-plt
19546 @opindex minline-plt
19547
19548 Enable inlining of PLT entries in function calls to functions that are
19549 not known to bind locally. It has no effect without @option{-mfdpic}.
19550 It's enabled by default if optimizing for speed and compiling for
19551 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19552 optimization option such as @option{-O3} or above is present in the
19553 command line.
19554
19555 @item -mTLS
19556 @opindex mTLS
19557
19558 Assume a large TLS segment when generating thread-local code.
19559
19560 @item -mtls
19561 @opindex mtls
19562
19563 Do not assume a large TLS segment when generating thread-local code.
19564
19565 @item -mgprel-ro
19566 @opindex mgprel-ro
19567
19568 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19569 that is known to be in read-only sections. It's enabled by default,
19570 except for @option{-fpic} or @option{-fpie}: even though it may help
19571 make the global offset table smaller, it trades 1 instruction for 4.
19572 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19573 one of which may be shared by multiple symbols, and it avoids the need
19574 for a GOT entry for the referenced symbol, so it's more likely to be a
19575 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19576
19577 @item -multilib-library-pic
19578 @opindex multilib-library-pic
19579
19580 Link with the (library, not FD) pic libraries. It's implied by
19581 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19582 @option{-fpic} without @option{-mfdpic}. You should never have to use
19583 it explicitly.
19584
19585 @item -mlinked-fp
19586 @opindex mlinked-fp
19587
19588 Follow the EABI requirement of always creating a frame pointer whenever
19589 a stack frame is allocated. This option is enabled by default and can
19590 be disabled with @option{-mno-linked-fp}.
19591
19592 @item -mlong-calls
19593 @opindex mlong-calls
19594
19595 Use indirect addressing to call functions outside the current
19596 compilation unit. This allows the functions to be placed anywhere
19597 within the 32-bit address space.
19598
19599 @item -malign-labels
19600 @opindex malign-labels
19601
19602 Try to align labels to an 8-byte boundary by inserting NOPs into the
19603 previous packet. This option only has an effect when VLIW packing
19604 is enabled. It doesn't create new packets; it merely adds NOPs to
19605 existing ones.
19606
19607 @item -mlibrary-pic
19608 @opindex mlibrary-pic
19609
19610 Generate position-independent EABI code.
19611
19612 @item -macc-4
19613 @opindex macc-4
19614
19615 Use only the first four media accumulator registers.
19616
19617 @item -macc-8
19618 @opindex macc-8
19619
19620 Use all eight media accumulator registers.
19621
19622 @item -mpack
19623 @opindex mpack
19624
19625 Pack VLIW instructions.
19626
19627 @item -mno-pack
19628 @opindex mno-pack
19629
19630 Do not pack VLIW instructions.
19631
19632 @item -mno-eflags
19633 @opindex mno-eflags
19634
19635 Do not mark ABI switches in e_flags.
19636
19637 @item -mcond-move
19638 @opindex mcond-move
19639
19640 Enable the use of conditional-move instructions (default).
19641
19642 This switch is mainly for debugging the compiler and will likely be removed
19643 in a future version.
19644
19645 @item -mno-cond-move
19646 @opindex mno-cond-move
19647
19648 Disable the use of conditional-move instructions.
19649
19650 This switch is mainly for debugging the compiler and will likely be removed
19651 in a future version.
19652
19653 @item -mscc
19654 @opindex mscc
19655
19656 Enable the use of conditional set instructions (default).
19657
19658 This switch is mainly for debugging the compiler and will likely be removed
19659 in a future version.
19660
19661 @item -mno-scc
19662 @opindex mno-scc
19663
19664 Disable the use of conditional set instructions.
19665
19666 This switch is mainly for debugging the compiler and will likely be removed
19667 in a future version.
19668
19669 @item -mcond-exec
19670 @opindex mcond-exec
19671
19672 Enable the use of conditional execution (default).
19673
19674 This switch is mainly for debugging the compiler and will likely be removed
19675 in a future version.
19676
19677 @item -mno-cond-exec
19678 @opindex mno-cond-exec
19679
19680 Disable the use of conditional execution.
19681
19682 This switch is mainly for debugging the compiler and will likely be removed
19683 in a future version.
19684
19685 @item -mvliw-branch
19686 @opindex mvliw-branch
19687
19688 Run a pass to pack branches into VLIW instructions (default).
19689
19690 This switch is mainly for debugging the compiler and will likely be removed
19691 in a future version.
19692
19693 @item -mno-vliw-branch
19694 @opindex mno-vliw-branch
19695
19696 Do not run a pass to pack branches into VLIW instructions.
19697
19698 This switch is mainly for debugging the compiler and will likely be removed
19699 in a future version.
19700
19701 @item -mmulti-cond-exec
19702 @opindex mmulti-cond-exec
19703
19704 Enable optimization of @code{&&} and @code{||} in conditional execution
19705 (default).
19706
19707 This switch is mainly for debugging the compiler and will likely be removed
19708 in a future version.
19709
19710 @item -mno-multi-cond-exec
19711 @opindex mno-multi-cond-exec
19712
19713 Disable optimization of @code{&&} and @code{||} in conditional execution.
19714
19715 This switch is mainly for debugging the compiler and will likely be removed
19716 in a future version.
19717
19718 @item -mnested-cond-exec
19719 @opindex mnested-cond-exec
19720
19721 Enable nested conditional execution optimizations (default).
19722
19723 This switch is mainly for debugging the compiler and will likely be removed
19724 in a future version.
19725
19726 @item -mno-nested-cond-exec
19727 @opindex mno-nested-cond-exec
19728
19729 Disable nested conditional execution optimizations.
19730
19731 This switch is mainly for debugging the compiler and will likely be removed
19732 in a future version.
19733
19734 @item -moptimize-membar
19735 @opindex moptimize-membar
19736
19737 This switch removes redundant @code{membar} instructions from the
19738 compiler-generated code. It is enabled by default.
19739
19740 @item -mno-optimize-membar
19741 @opindex mno-optimize-membar
19742 @opindex moptimize-membar
19743
19744 This switch disables the automatic removal of redundant @code{membar}
19745 instructions from the generated code.
19746
19747 @item -mtomcat-stats
19748 @opindex mtomcat-stats
19749
19750 Cause gas to print out tomcat statistics.
19751
19752 @item -mcpu=@var{cpu}
19753 @opindex mcpu
19754
19755 Select the processor type for which to generate code. Possible values are
19756 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19757 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19758
19759 @end table
19760
19761 @node GNU/Linux Options
19762 @subsection GNU/Linux Options
19763
19764 These @samp{-m} options are defined for GNU/Linux targets:
19765
19766 @table @gcctabopt
19767 @item -mglibc
19768 @opindex mglibc
19769 Use the GNU C library. This is the default except
19770 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19771 @samp{*-*-linux-*android*} targets.
19772
19773 @item -muclibc
19774 @opindex muclibc
19775 Use uClibc C library. This is the default on
19776 @samp{*-*-linux-*uclibc*} targets.
19777
19778 @item -mmusl
19779 @opindex mmusl
19780 Use the musl C library. This is the default on
19781 @samp{*-*-linux-*musl*} targets.
19782
19783 @item -mbionic
19784 @opindex mbionic
19785 Use Bionic C library. This is the default on
19786 @samp{*-*-linux-*android*} targets.
19787
19788 @item -mandroid
19789 @opindex mandroid
19790 Compile code compatible with Android platform. This is the default on
19791 @samp{*-*-linux-*android*} targets.
19792
19793 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19794 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19795 this option makes the GCC driver pass Android-specific options to the linker.
19796 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19797 to be defined.
19798
19799 @item -tno-android-cc
19800 @opindex tno-android-cc
19801 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19802 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19803 @option{-fno-rtti} by default.
19804
19805 @item -tno-android-ld
19806 @opindex tno-android-ld
19807 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19808 linking options to the linker.
19809
19810 @end table
19811
19812 @node H8/300 Options
19813 @subsection H8/300 Options
19814
19815 These @samp{-m} options are defined for the H8/300 implementations:
19816
19817 @table @gcctabopt
19818 @item -mrelax
19819 @opindex mrelax
19820 Shorten some address references at link time, when possible; uses the
19821 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19822 ld, Using ld}, for a fuller description.
19823
19824 @item -mh
19825 @opindex mh
19826 Generate code for the H8/300H@.
19827
19828 @item -ms
19829 @opindex ms
19830 Generate code for the H8S@.
19831
19832 @item -mn
19833 @opindex mn
19834 Generate code for the H8S and H8/300H in the normal mode. This switch
19835 must be used either with @option{-mh} or @option{-ms}.
19836
19837 @item -ms2600
19838 @opindex ms2600
19839 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19840
19841 @item -mexr
19842 @opindex mexr
19843 Extended registers are stored on stack before execution of function
19844 with monitor attribute. Default option is @option{-mexr}.
19845 This option is valid only for H8S targets.
19846
19847 @item -mno-exr
19848 @opindex mno-exr
19849 @opindex mexr
19850 Extended registers are not stored on stack before execution of function
19851 with monitor attribute. Default option is @option{-mno-exr}.
19852 This option is valid only for H8S targets.
19853
19854 @item -mint32
19855 @opindex mint32
19856 Make @code{int} data 32 bits by default.
19857
19858 @item -malign-300
19859 @opindex malign-300
19860 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19861 The default for the H8/300H and H8S is to align longs and floats on
19862 4-byte boundaries.
19863 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19864 This option has no effect on the H8/300.
19865 @end table
19866
19867 @node HPPA Options
19868 @subsection HPPA Options
19869 @cindex HPPA Options
19870
19871 These @samp{-m} options are defined for the HPPA family of computers:
19872
19873 @table @gcctabopt
19874 @item -march=@var{architecture-type}
19875 @opindex march
19876 Generate code for the specified architecture. The choices for
19877 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19878 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19879 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19880 architecture option for your machine. Code compiled for lower numbered
19881 architectures runs on higher numbered architectures, but not the
19882 other way around.
19883
19884 @item -mpa-risc-1-0
19885 @itemx -mpa-risc-1-1
19886 @itemx -mpa-risc-2-0
19887 @opindex mpa-risc-1-0
19888 @opindex mpa-risc-1-1
19889 @opindex mpa-risc-2-0
19890 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19891
19892 @item -mcaller-copies
19893 @opindex mcaller-copies
19894 The caller copies function arguments passed by hidden reference. This
19895 option should be used with care as it is not compatible with the default
19896 32-bit runtime. However, only aggregates larger than eight bytes are
19897 passed by hidden reference and the option provides better compatibility
19898 with OpenMP.
19899
19900 @item -mjump-in-delay
19901 @opindex mjump-in-delay
19902 This option is ignored and provided for compatibility purposes only.
19903
19904 @item -mdisable-fpregs
19905 @opindex mdisable-fpregs
19906 Prevent floating-point registers from being used in any manner. This is
19907 necessary for compiling kernels that perform lazy context switching of
19908 floating-point registers. If you use this option and attempt to perform
19909 floating-point operations, the compiler aborts.
19910
19911 @item -mdisable-indexing
19912 @opindex mdisable-indexing
19913 Prevent the compiler from using indexing address modes. This avoids some
19914 rather obscure problems when compiling MIG generated code under MACH@.
19915
19916 @item -mno-space-regs
19917 @opindex mno-space-regs
19918 @opindex mspace-regs
19919 Generate code that assumes the target has no space registers. This allows
19920 GCC to generate faster indirect calls and use unscaled index address modes.
19921
19922 Such code is suitable for level 0 PA systems and kernels.
19923
19924 @item -mfast-indirect-calls
19925 @opindex mfast-indirect-calls
19926 Generate code that assumes calls never cross space boundaries. This
19927 allows GCC to emit code that performs faster indirect calls.
19928
19929 This option does not work in the presence of shared libraries or nested
19930 functions.
19931
19932 @item -mfixed-range=@var{register-range}
19933 @opindex mfixed-range
19934 Generate code treating the given register range as fixed registers.
19935 A fixed register is one that the register allocator cannot use. This is
19936 useful when compiling kernel code. A register range is specified as
19937 two registers separated by a dash. Multiple register ranges can be
19938 specified separated by a comma.
19939
19940 @item -mlong-load-store
19941 @opindex mlong-load-store
19942 Generate 3-instruction load and store sequences as sometimes required by
19943 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19944 the HP compilers.
19945
19946 @item -mportable-runtime
19947 @opindex mportable-runtime
19948 Use the portable calling conventions proposed by HP for ELF systems.
19949
19950 @item -mgas
19951 @opindex mgas
19952 Enable the use of assembler directives only GAS understands.
19953
19954 @item -mschedule=@var{cpu-type}
19955 @opindex mschedule
19956 Schedule code according to the constraints for the machine type
19957 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19958 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19959 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19960 proper scheduling option for your machine. The default scheduling is
19961 @samp{8000}.
19962
19963 @item -mlinker-opt
19964 @opindex mlinker-opt
19965 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19966 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19967 linkers in which they give bogus error messages when linking some programs.
19968
19969 @item -msoft-float
19970 @opindex msoft-float
19971 Generate output containing library calls for floating point.
19972 @strong{Warning:} the requisite libraries are not available for all HPPA
19973 targets. Normally the facilities of the machine's usual C compiler are
19974 used, but this cannot be done directly in cross-compilation. You must make
19975 your own arrangements to provide suitable library functions for
19976 cross-compilation.
19977
19978 @option{-msoft-float} changes the calling convention in the output file;
19979 therefore, it is only useful if you compile @emph{all} of a program with
19980 this option. In particular, you need to compile @file{libgcc.a}, the
19981 library that comes with GCC, with @option{-msoft-float} in order for
19982 this to work.
19983
19984 @item -msio
19985 @opindex msio
19986 Generate the predefine, @code{_SIO}, for server IO@. The default is
19987 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19988 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19989 options are available under HP-UX and HI-UX@.
19990
19991 @item -mgnu-ld
19992 @opindex mgnu-ld
19993 Use options specific to GNU @command{ld}.
19994 This passes @option{-shared} to @command{ld} when
19995 building a shared library. It is the default when GCC is configured,
19996 explicitly or implicitly, with the GNU linker. This option does not
19997 affect which @command{ld} is called; it only changes what parameters
19998 are passed to that @command{ld}.
19999 The @command{ld} that is called is determined by the
20000 @option{--with-ld} configure option, GCC's program search path, and
20001 finally by the user's @env{PATH}. The linker used by GCC can be printed
20002 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20003 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20004
20005 @item -mhp-ld
20006 @opindex mhp-ld
20007 Use options specific to HP @command{ld}.
20008 This passes @option{-b} to @command{ld} when building
20009 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20010 links. It is the default when GCC is configured, explicitly or
20011 implicitly, with the HP linker. This option does not affect
20012 which @command{ld} is called; it only changes what parameters are passed to that
20013 @command{ld}.
20014 The @command{ld} that is called is determined by the @option{--with-ld}
20015 configure option, GCC's program search path, and finally by the user's
20016 @env{PATH}. The linker used by GCC can be printed using @samp{which
20017 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20018 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20019
20020 @item -mlong-calls
20021 @opindex mno-long-calls
20022 @opindex mlong-calls
20023 Generate code that uses long call sequences. This ensures that a call
20024 is always able to reach linker generated stubs. The default is to generate
20025 long calls only when the distance from the call site to the beginning
20026 of the function or translation unit, as the case may be, exceeds a
20027 predefined limit set by the branch type being used. The limits for
20028 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20029 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20030 240,000 bytes.
20031
20032 Distances are measured from the beginning of functions when using the
20033 @option{-ffunction-sections} option, or when using the @option{-mgas}
20034 and @option{-mno-portable-runtime} options together under HP-UX with
20035 the SOM linker.
20036
20037 It is normally not desirable to use this option as it degrades
20038 performance. However, it may be useful in large applications,
20039 particularly when partial linking is used to build the application.
20040
20041 The types of long calls used depends on the capabilities of the
20042 assembler and linker, and the type of code being generated. The
20043 impact on systems that support long absolute calls, and long pic
20044 symbol-difference or pc-relative calls should be relatively small.
20045 However, an indirect call is used on 32-bit ELF systems in pic code
20046 and it is quite long.
20047
20048 @item -munix=@var{unix-std}
20049 @opindex march
20050 Generate compiler predefines and select a startfile for the specified
20051 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20052 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20053 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20054 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20055 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20056 and later.
20057
20058 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20059 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20060 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20061 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20062 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20063 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20064
20065 It is @emph{important} to note that this option changes the interfaces
20066 for various library routines. It also affects the operational behavior
20067 of the C library. Thus, @emph{extreme} care is needed in using this
20068 option.
20069
20070 Library code that is intended to operate with more than one UNIX
20071 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20072 as appropriate. Most GNU software doesn't provide this capability.
20073
20074 @item -nolibdld
20075 @opindex nolibdld
20076 Suppress the generation of link options to search libdld.sl when the
20077 @option{-static} option is specified on HP-UX 10 and later.
20078
20079 @item -static
20080 @opindex static
20081 The HP-UX implementation of setlocale in libc has a dependency on
20082 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20083 when the @option{-static} option is specified, special link options
20084 are needed to resolve this dependency.
20085
20086 On HP-UX 10 and later, the GCC driver adds the necessary options to
20087 link with libdld.sl when the @option{-static} option is specified.
20088 This causes the resulting binary to be dynamic. On the 64-bit port,
20089 the linkers generate dynamic binaries by default in any case. The
20090 @option{-nolibdld} option can be used to prevent the GCC driver from
20091 adding these link options.
20092
20093 @item -threads
20094 @opindex threads
20095 Add support for multithreading with the @dfn{dce thread} library
20096 under HP-UX@. This option sets flags for both the preprocessor and
20097 linker.
20098 @end table
20099
20100 @node IA-64 Options
20101 @subsection IA-64 Options
20102 @cindex IA-64 Options
20103
20104 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20105
20106 @table @gcctabopt
20107 @item -mbig-endian
20108 @opindex mbig-endian
20109 Generate code for a big-endian target. This is the default for HP-UX@.
20110
20111 @item -mlittle-endian
20112 @opindex mlittle-endian
20113 Generate code for a little-endian target. This is the default for AIX5
20114 and GNU/Linux.
20115
20116 @item -mgnu-as
20117 @itemx -mno-gnu-as
20118 @opindex mgnu-as
20119 @opindex mno-gnu-as
20120 Generate (or don't) code for the GNU assembler. This is the default.
20121 @c Also, this is the default if the configure option @option{--with-gnu-as}
20122 @c is used.
20123
20124 @item -mgnu-ld
20125 @itemx -mno-gnu-ld
20126 @opindex mgnu-ld
20127 @opindex mno-gnu-ld
20128 Generate (or don't) code for the GNU linker. This is the default.
20129 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20130 @c is used.
20131
20132 @item -mno-pic
20133 @opindex mno-pic
20134 Generate code that does not use a global pointer register. The result
20135 is not position independent code, and violates the IA-64 ABI@.
20136
20137 @item -mvolatile-asm-stop
20138 @itemx -mno-volatile-asm-stop
20139 @opindex mvolatile-asm-stop
20140 @opindex mno-volatile-asm-stop
20141 Generate (or don't) a stop bit immediately before and after volatile asm
20142 statements.
20143
20144 @item -mregister-names
20145 @itemx -mno-register-names
20146 @opindex mregister-names
20147 @opindex mno-register-names
20148 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20149 the stacked registers. This may make assembler output more readable.
20150
20151 @item -mno-sdata
20152 @itemx -msdata
20153 @opindex mno-sdata
20154 @opindex msdata
20155 Disable (or enable) optimizations that use the small data section. This may
20156 be useful for working around optimizer bugs.
20157
20158 @item -mconstant-gp
20159 @opindex mconstant-gp
20160 Generate code that uses a single constant global pointer value. This is
20161 useful when compiling kernel code.
20162
20163 @item -mauto-pic
20164 @opindex mauto-pic
20165 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20166 This is useful when compiling firmware code.
20167
20168 @item -minline-float-divide-min-latency
20169 @opindex minline-float-divide-min-latency
20170 Generate code for inline divides of floating-point values
20171 using the minimum latency algorithm.
20172
20173 @item -minline-float-divide-max-throughput
20174 @opindex minline-float-divide-max-throughput
20175 Generate code for inline divides of floating-point values
20176 using the maximum throughput algorithm.
20177
20178 @item -mno-inline-float-divide
20179 @opindex mno-inline-float-divide
20180 Do not generate inline code for divides of floating-point values.
20181
20182 @item -minline-int-divide-min-latency
20183 @opindex minline-int-divide-min-latency
20184 Generate code for inline divides of integer values
20185 using the minimum latency algorithm.
20186
20187 @item -minline-int-divide-max-throughput
20188 @opindex minline-int-divide-max-throughput
20189 Generate code for inline divides of integer values
20190 using the maximum throughput algorithm.
20191
20192 @item -mno-inline-int-divide
20193 @opindex mno-inline-int-divide
20194 @opindex minline-int-divide
20195 Do not generate inline code for divides of integer values.
20196
20197 @item -minline-sqrt-min-latency
20198 @opindex minline-sqrt-min-latency
20199 Generate code for inline square roots
20200 using the minimum latency algorithm.
20201
20202 @item -minline-sqrt-max-throughput
20203 @opindex minline-sqrt-max-throughput
20204 Generate code for inline square roots
20205 using the maximum throughput algorithm.
20206
20207 @item -mno-inline-sqrt
20208 @opindex mno-inline-sqrt
20209 Do not generate inline code for @code{sqrt}.
20210
20211 @item -mfused-madd
20212 @itemx -mno-fused-madd
20213 @opindex mfused-madd
20214 @opindex mno-fused-madd
20215 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20216 instructions. The default is to use these instructions.
20217
20218 @item -mno-dwarf2-asm
20219 @itemx -mdwarf2-asm
20220 @opindex mno-dwarf2-asm
20221 @opindex mdwarf2-asm
20222 Don't (or do) generate assembler code for the DWARF line number debugging
20223 info. This may be useful when not using the GNU assembler.
20224
20225 @item -mearly-stop-bits
20226 @itemx -mno-early-stop-bits
20227 @opindex mearly-stop-bits
20228 @opindex mno-early-stop-bits
20229 Allow stop bits to be placed earlier than immediately preceding the
20230 instruction that triggered the stop bit. This can improve instruction
20231 scheduling, but does not always do so.
20232
20233 @item -mfixed-range=@var{register-range}
20234 @opindex mfixed-range
20235 Generate code treating the given register range as fixed registers.
20236 A fixed register is one that the register allocator cannot use. This is
20237 useful when compiling kernel code. A register range is specified as
20238 two registers separated by a dash. Multiple register ranges can be
20239 specified separated by a comma.
20240
20241 @item -mtls-size=@var{tls-size}
20242 @opindex mtls-size
20243 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20244 64.
20245
20246 @item -mtune=@var{cpu-type}
20247 @opindex mtune
20248 Tune the instruction scheduling for a particular CPU, Valid values are
20249 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20250 and @samp{mckinley}.
20251
20252 @item -milp32
20253 @itemx -mlp64
20254 @opindex milp32
20255 @opindex mlp64
20256 Generate code for a 32-bit or 64-bit environment.
20257 The 32-bit environment sets int, long and pointer to 32 bits.
20258 The 64-bit environment sets int to 32 bits and long and pointer
20259 to 64 bits. These are HP-UX specific flags.
20260
20261 @item -mno-sched-br-data-spec
20262 @itemx -msched-br-data-spec
20263 @opindex mno-sched-br-data-spec
20264 @opindex msched-br-data-spec
20265 (Dis/En)able data speculative scheduling before reload.
20266 This results in generation of @code{ld.a} instructions and
20267 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20268 The default setting is disabled.
20269
20270 @item -msched-ar-data-spec
20271 @itemx -mno-sched-ar-data-spec
20272 @opindex msched-ar-data-spec
20273 @opindex mno-sched-ar-data-spec
20274 (En/Dis)able data speculative scheduling after reload.
20275 This results in generation of @code{ld.a} instructions and
20276 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20277 The default setting is enabled.
20278
20279 @item -mno-sched-control-spec
20280 @itemx -msched-control-spec
20281 @opindex mno-sched-control-spec
20282 @opindex msched-control-spec
20283 (Dis/En)able control speculative scheduling. This feature is
20284 available only during region scheduling (i.e.@: before reload).
20285 This results in generation of the @code{ld.s} instructions and
20286 the corresponding check instructions @code{chk.s}.
20287 The default setting is disabled.
20288
20289 @item -msched-br-in-data-spec
20290 @itemx -mno-sched-br-in-data-spec
20291 @opindex msched-br-in-data-spec
20292 @opindex mno-sched-br-in-data-spec
20293 (En/Dis)able speculative scheduling of the instructions that
20294 are dependent on the data speculative loads before reload.
20295 This is effective only with @option{-msched-br-data-spec} enabled.
20296 The default setting is enabled.
20297
20298 @item -msched-ar-in-data-spec
20299 @itemx -mno-sched-ar-in-data-spec
20300 @opindex msched-ar-in-data-spec
20301 @opindex mno-sched-ar-in-data-spec
20302 (En/Dis)able speculative scheduling of the instructions that
20303 are dependent on the data speculative loads after reload.
20304 This is effective only with @option{-msched-ar-data-spec} enabled.
20305 The default setting is enabled.
20306
20307 @item -msched-in-control-spec
20308 @itemx -mno-sched-in-control-spec
20309 @opindex msched-in-control-spec
20310 @opindex mno-sched-in-control-spec
20311 (En/Dis)able speculative scheduling of the instructions that
20312 are dependent on the control speculative loads.
20313 This is effective only with @option{-msched-control-spec} enabled.
20314 The default setting is enabled.
20315
20316 @item -mno-sched-prefer-non-data-spec-insns
20317 @itemx -msched-prefer-non-data-spec-insns
20318 @opindex mno-sched-prefer-non-data-spec-insns
20319 @opindex msched-prefer-non-data-spec-insns
20320 If enabled, data-speculative instructions are chosen for schedule
20321 only if there are no other choices at the moment. This makes
20322 the use of the data speculation much more conservative.
20323 The default setting is disabled.
20324
20325 @item -mno-sched-prefer-non-control-spec-insns
20326 @itemx -msched-prefer-non-control-spec-insns
20327 @opindex mno-sched-prefer-non-control-spec-insns
20328 @opindex msched-prefer-non-control-spec-insns
20329 If enabled, control-speculative instructions are chosen for schedule
20330 only if there are no other choices at the moment. This makes
20331 the use of the control speculation much more conservative.
20332 The default setting is disabled.
20333
20334 @item -mno-sched-count-spec-in-critical-path
20335 @itemx -msched-count-spec-in-critical-path
20336 @opindex mno-sched-count-spec-in-critical-path
20337 @opindex msched-count-spec-in-critical-path
20338 If enabled, speculative dependencies are considered during
20339 computation of the instructions priorities. This makes the use of the
20340 speculation a bit more conservative.
20341 The default setting is disabled.
20342
20343 @item -msched-spec-ldc
20344 @opindex msched-spec-ldc
20345 Use a simple data speculation check. This option is on by default.
20346
20347 @item -msched-control-spec-ldc
20348 @opindex msched-spec-ldc
20349 Use a simple check for control speculation. This option is on by default.
20350
20351 @item -msched-stop-bits-after-every-cycle
20352 @opindex msched-stop-bits-after-every-cycle
20353 Place a stop bit after every cycle when scheduling. This option is on
20354 by default.
20355
20356 @item -msched-fp-mem-deps-zero-cost
20357 @opindex msched-fp-mem-deps-zero-cost
20358 Assume that floating-point stores and loads are not likely to cause a conflict
20359 when placed into the same instruction group. This option is disabled by
20360 default.
20361
20362 @item -msel-sched-dont-check-control-spec
20363 @opindex msel-sched-dont-check-control-spec
20364 Generate checks for control speculation in selective scheduling.
20365 This flag is disabled by default.
20366
20367 @item -msched-max-memory-insns=@var{max-insns}
20368 @opindex msched-max-memory-insns
20369 Limit on the number of memory insns per instruction group, giving lower
20370 priority to subsequent memory insns attempting to schedule in the same
20371 instruction group. Frequently useful to prevent cache bank conflicts.
20372 The default value is 1.
20373
20374 @item -msched-max-memory-insns-hard-limit
20375 @opindex msched-max-memory-insns-hard-limit
20376 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20377 disallowing more than that number in an instruction group.
20378 Otherwise, the limit is ``soft'', meaning that non-memory operations
20379 are preferred when the limit is reached, but memory operations may still
20380 be scheduled.
20381
20382 @end table
20383
20384 @node LM32 Options
20385 @subsection LM32 Options
20386 @cindex LM32 options
20387
20388 These @option{-m} options are defined for the LatticeMico32 architecture:
20389
20390 @table @gcctabopt
20391 @item -mbarrel-shift-enabled
20392 @opindex mbarrel-shift-enabled
20393 Enable barrel-shift instructions.
20394
20395 @item -mdivide-enabled
20396 @opindex mdivide-enabled
20397 Enable divide and modulus instructions.
20398
20399 @item -mmultiply-enabled
20400 @opindex multiply-enabled
20401 Enable multiply instructions.
20402
20403 @item -msign-extend-enabled
20404 @opindex msign-extend-enabled
20405 Enable sign extend instructions.
20406
20407 @item -muser-enabled
20408 @opindex muser-enabled
20409 Enable user-defined instructions.
20410
20411 @end table
20412
20413 @node M32C Options
20414 @subsection M32C Options
20415 @cindex M32C options
20416
20417 @table @gcctabopt
20418 @item -mcpu=@var{name}
20419 @opindex mcpu=
20420 Select the CPU for which code is generated. @var{name} may be one of
20421 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20422 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20423 the M32C/80 series.
20424
20425 @item -msim
20426 @opindex msim
20427 Specifies that the program will be run on the simulator. This causes
20428 an alternate runtime library to be linked in which supports, for
20429 example, file I/O@. You must not use this option when generating
20430 programs that will run on real hardware; you must provide your own
20431 runtime library for whatever I/O functions are needed.
20432
20433 @item -memregs=@var{number}
20434 @opindex memregs=
20435 Specifies the number of memory-based pseudo-registers GCC uses
20436 during code generation. These pseudo-registers are used like real
20437 registers, so there is a tradeoff between GCC's ability to fit the
20438 code into available registers, and the performance penalty of using
20439 memory instead of registers. Note that all modules in a program must
20440 be compiled with the same value for this option. Because of that, you
20441 must not use this option with GCC's default runtime libraries.
20442
20443 @end table
20444
20445 @node M32R/D Options
20446 @subsection M32R/D Options
20447 @cindex M32R/D options
20448
20449 These @option{-m} options are defined for Renesas M32R/D architectures:
20450
20451 @table @gcctabopt
20452 @item -m32r2
20453 @opindex m32r2
20454 Generate code for the M32R/2@.
20455
20456 @item -m32rx
20457 @opindex m32rx
20458 Generate code for the M32R/X@.
20459
20460 @item -m32r
20461 @opindex m32r
20462 Generate code for the M32R@. This is the default.
20463
20464 @item -mmodel=small
20465 @opindex mmodel=small
20466 Assume all objects live in the lower 16MB of memory (so that their addresses
20467 can be loaded with the @code{ld24} instruction), and assume all subroutines
20468 are reachable with the @code{bl} instruction.
20469 This is the default.
20470
20471 The addressability of a particular object can be set with the
20472 @code{model} attribute.
20473
20474 @item -mmodel=medium
20475 @opindex mmodel=medium
20476 Assume objects may be anywhere in the 32-bit address space (the compiler
20477 generates @code{seth/add3} instructions to load their addresses), and
20478 assume all subroutines are reachable with the @code{bl} instruction.
20479
20480 @item -mmodel=large
20481 @opindex mmodel=large
20482 Assume objects may be anywhere in the 32-bit address space (the compiler
20483 generates @code{seth/add3} instructions to load their addresses), and
20484 assume subroutines may not be reachable with the @code{bl} instruction
20485 (the compiler generates the much slower @code{seth/add3/jl}
20486 instruction sequence).
20487
20488 @item -msdata=none
20489 @opindex msdata=none
20490 Disable use of the small data area. Variables are put into
20491 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20492 @code{section} attribute has been specified).
20493 This is the default.
20494
20495 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20496 Objects may be explicitly put in the small data area with the
20497 @code{section} attribute using one of these sections.
20498
20499 @item -msdata=sdata
20500 @opindex msdata=sdata
20501 Put small global and static data in the small data area, but do not
20502 generate special code to reference them.
20503
20504 @item -msdata=use
20505 @opindex msdata=use
20506 Put small global and static data in the small data area, and generate
20507 special instructions to reference them.
20508
20509 @item -G @var{num}
20510 @opindex G
20511 @cindex smaller data references
20512 Put global and static objects less than or equal to @var{num} bytes
20513 into the small data or BSS sections instead of the normal data or BSS
20514 sections. The default value of @var{num} is 8.
20515 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20516 for this option to have any effect.
20517
20518 All modules should be compiled with the same @option{-G @var{num}} value.
20519 Compiling with different values of @var{num} may or may not work; if it
20520 doesn't the linker gives an error message---incorrect code is not
20521 generated.
20522
20523 @item -mdebug
20524 @opindex mdebug
20525 Makes the M32R-specific code in the compiler display some statistics
20526 that might help in debugging programs.
20527
20528 @item -malign-loops
20529 @opindex malign-loops
20530 Align all loops to a 32-byte boundary.
20531
20532 @item -mno-align-loops
20533 @opindex mno-align-loops
20534 Do not enforce a 32-byte alignment for loops. This is the default.
20535
20536 @item -missue-rate=@var{number}
20537 @opindex missue-rate=@var{number}
20538 Issue @var{number} instructions per cycle. @var{number} can only be 1
20539 or 2.
20540
20541 @item -mbranch-cost=@var{number}
20542 @opindex mbranch-cost=@var{number}
20543 @var{number} can only be 1 or 2. If it is 1 then branches are
20544 preferred over conditional code, if it is 2, then the opposite applies.
20545
20546 @item -mflush-trap=@var{number}
20547 @opindex mflush-trap=@var{number}
20548 Specifies the trap number to use to flush the cache. The default is
20549 12. Valid numbers are between 0 and 15 inclusive.
20550
20551 @item -mno-flush-trap
20552 @opindex mno-flush-trap
20553 Specifies that the cache cannot be flushed by using a trap.
20554
20555 @item -mflush-func=@var{name}
20556 @opindex mflush-func=@var{name}
20557 Specifies the name of the operating system function to call to flush
20558 the cache. The default is @samp{_flush_cache}, but a function call
20559 is only used if a trap is not available.
20560
20561 @item -mno-flush-func
20562 @opindex mno-flush-func
20563 Indicates that there is no OS function for flushing the cache.
20564
20565 @end table
20566
20567 @node M680x0 Options
20568 @subsection M680x0 Options
20569 @cindex M680x0 options
20570
20571 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20572 The default settings depend on which architecture was selected when
20573 the compiler was configured; the defaults for the most common choices
20574 are given below.
20575
20576 @table @gcctabopt
20577 @item -march=@var{arch}
20578 @opindex march
20579 Generate code for a specific M680x0 or ColdFire instruction set
20580 architecture. Permissible values of @var{arch} for M680x0
20581 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20582 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20583 architectures are selected according to Freescale's ISA classification
20584 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20585 @samp{isab} and @samp{isac}.
20586
20587 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20588 code for a ColdFire target. The @var{arch} in this macro is one of the
20589 @option{-march} arguments given above.
20590
20591 When used together, @option{-march} and @option{-mtune} select code
20592 that runs on a family of similar processors but that is optimized
20593 for a particular microarchitecture.
20594
20595 @item -mcpu=@var{cpu}
20596 @opindex mcpu
20597 Generate code for a specific M680x0 or ColdFire processor.
20598 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20599 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20600 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20601 below, which also classifies the CPUs into families:
20602
20603 @multitable @columnfractions 0.20 0.80
20604 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20605 @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}
20606 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20607 @item @samp{5206e} @tab @samp{5206e}
20608 @item @samp{5208} @tab @samp{5207} @samp{5208}
20609 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20610 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20611 @item @samp{5216} @tab @samp{5214} @samp{5216}
20612 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20613 @item @samp{5225} @tab @samp{5224} @samp{5225}
20614 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20615 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20616 @item @samp{5249} @tab @samp{5249}
20617 @item @samp{5250} @tab @samp{5250}
20618 @item @samp{5271} @tab @samp{5270} @samp{5271}
20619 @item @samp{5272} @tab @samp{5272}
20620 @item @samp{5275} @tab @samp{5274} @samp{5275}
20621 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20622 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20623 @item @samp{5307} @tab @samp{5307}
20624 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20625 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20626 @item @samp{5407} @tab @samp{5407}
20627 @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}
20628 @end multitable
20629
20630 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20631 @var{arch} is compatible with @var{cpu}. Other combinations of
20632 @option{-mcpu} and @option{-march} are rejected.
20633
20634 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20635 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20636 where the value of @var{family} is given by the table above.
20637
20638 @item -mtune=@var{tune}
20639 @opindex mtune
20640 Tune the code for a particular microarchitecture within the
20641 constraints set by @option{-march} and @option{-mcpu}.
20642 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20643 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20644 and @samp{cpu32}. The ColdFire microarchitectures
20645 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20646
20647 You can also use @option{-mtune=68020-40} for code that needs
20648 to run relatively well on 68020, 68030 and 68040 targets.
20649 @option{-mtune=68020-60} is similar but includes 68060 targets
20650 as well. These two options select the same tuning decisions as
20651 @option{-m68020-40} and @option{-m68020-60} respectively.
20652
20653 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20654 when tuning for 680x0 architecture @var{arch}. It also defines
20655 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20656 option is used. If GCC is tuning for a range of architectures,
20657 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20658 it defines the macros for every architecture in the range.
20659
20660 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20661 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20662 of the arguments given above.
20663
20664 @item -m68000
20665 @itemx -mc68000
20666 @opindex m68000
20667 @opindex mc68000
20668 Generate output for a 68000. This is the default
20669 when the compiler is configured for 68000-based systems.
20670 It is equivalent to @option{-march=68000}.
20671
20672 Use this option for microcontrollers with a 68000 or EC000 core,
20673 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20674
20675 @item -m68010
20676 @opindex m68010
20677 Generate output for a 68010. This is the default
20678 when the compiler is configured for 68010-based systems.
20679 It is equivalent to @option{-march=68010}.
20680
20681 @item -m68020
20682 @itemx -mc68020
20683 @opindex m68020
20684 @opindex mc68020
20685 Generate output for a 68020. This is the default
20686 when the compiler is configured for 68020-based systems.
20687 It is equivalent to @option{-march=68020}.
20688
20689 @item -m68030
20690 @opindex m68030
20691 Generate output for a 68030. This is the default when the compiler is
20692 configured for 68030-based systems. It is equivalent to
20693 @option{-march=68030}.
20694
20695 @item -m68040
20696 @opindex m68040
20697 Generate output for a 68040. This is the default when the compiler is
20698 configured for 68040-based systems. It is equivalent to
20699 @option{-march=68040}.
20700
20701 This option inhibits the use of 68881/68882 instructions that have to be
20702 emulated by software on the 68040. Use this option if your 68040 does not
20703 have code to emulate those instructions.
20704
20705 @item -m68060
20706 @opindex m68060
20707 Generate output for a 68060. This is the default when the compiler is
20708 configured for 68060-based systems. It is equivalent to
20709 @option{-march=68060}.
20710
20711 This option inhibits the use of 68020 and 68881/68882 instructions that
20712 have to be emulated by software on the 68060. Use this option if your 68060
20713 does not have code to emulate those instructions.
20714
20715 @item -mcpu32
20716 @opindex mcpu32
20717 Generate output for a CPU32. This is the default
20718 when the compiler is configured for CPU32-based systems.
20719 It is equivalent to @option{-march=cpu32}.
20720
20721 Use this option for microcontrollers with a
20722 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20723 68336, 68340, 68341, 68349 and 68360.
20724
20725 @item -m5200
20726 @opindex m5200
20727 Generate output for a 520X ColdFire CPU@. This is the default
20728 when the compiler is configured for 520X-based systems.
20729 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20730 in favor of that option.
20731
20732 Use this option for microcontroller with a 5200 core, including
20733 the MCF5202, MCF5203, MCF5204 and MCF5206.
20734
20735 @item -m5206e
20736 @opindex m5206e
20737 Generate output for a 5206e ColdFire CPU@. The option is now
20738 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20739
20740 @item -m528x
20741 @opindex m528x
20742 Generate output for a member of the ColdFire 528X family.
20743 The option is now deprecated in favor of the equivalent
20744 @option{-mcpu=528x}.
20745
20746 @item -m5307
20747 @opindex m5307
20748 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20749 in favor of the equivalent @option{-mcpu=5307}.
20750
20751 @item -m5407
20752 @opindex m5407
20753 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20754 in favor of the equivalent @option{-mcpu=5407}.
20755
20756 @item -mcfv4e
20757 @opindex mcfv4e
20758 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20759 This includes use of hardware floating-point instructions.
20760 The option is equivalent to @option{-mcpu=547x}, and is now
20761 deprecated in favor of that option.
20762
20763 @item -m68020-40
20764 @opindex m68020-40
20765 Generate output for a 68040, without using any of the new instructions.
20766 This results in code that can run relatively efficiently on either a
20767 68020/68881 or a 68030 or a 68040. The generated code does use the
20768 68881 instructions that are emulated on the 68040.
20769
20770 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20771
20772 @item -m68020-60
20773 @opindex m68020-60
20774 Generate output for a 68060, without using any of the new instructions.
20775 This results in code that can run relatively efficiently on either a
20776 68020/68881 or a 68030 or a 68040. The generated code does use the
20777 68881 instructions that are emulated on the 68060.
20778
20779 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20780
20781 @item -mhard-float
20782 @itemx -m68881
20783 @opindex mhard-float
20784 @opindex m68881
20785 Generate floating-point instructions. This is the default for 68020
20786 and above, and for ColdFire devices that have an FPU@. It defines the
20787 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20788 on ColdFire targets.
20789
20790 @item -msoft-float
20791 @opindex msoft-float
20792 Do not generate floating-point instructions; use library calls instead.
20793 This is the default for 68000, 68010, and 68832 targets. It is also
20794 the default for ColdFire devices that have no FPU.
20795
20796 @item -mdiv
20797 @itemx -mno-div
20798 @opindex mdiv
20799 @opindex mno-div
20800 Generate (do not generate) ColdFire hardware divide and remainder
20801 instructions. If @option{-march} is used without @option{-mcpu},
20802 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20803 architectures. Otherwise, the default is taken from the target CPU
20804 (either the default CPU, or the one specified by @option{-mcpu}). For
20805 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20806 @option{-mcpu=5206e}.
20807
20808 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20809
20810 @item -mshort
20811 @opindex mshort
20812 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20813 Additionally, parameters passed on the stack are also aligned to a
20814 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20815
20816 @item -mno-short
20817 @opindex mno-short
20818 Do not consider type @code{int} to be 16 bits wide. This is the default.
20819
20820 @item -mnobitfield
20821 @itemx -mno-bitfield
20822 @opindex mnobitfield
20823 @opindex mno-bitfield
20824 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20825 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20826
20827 @item -mbitfield
20828 @opindex mbitfield
20829 Do use the bit-field instructions. The @option{-m68020} option implies
20830 @option{-mbitfield}. This is the default if you use a configuration
20831 designed for a 68020.
20832
20833 @item -mrtd
20834 @opindex mrtd
20835 Use a different function-calling convention, in which functions
20836 that take a fixed number of arguments return with the @code{rtd}
20837 instruction, which pops their arguments while returning. This
20838 saves one instruction in the caller since there is no need to pop
20839 the arguments there.
20840
20841 This calling convention is incompatible with the one normally
20842 used on Unix, so you cannot use it if you need to call libraries
20843 compiled with the Unix compiler.
20844
20845 Also, you must provide function prototypes for all functions that
20846 take variable numbers of arguments (including @code{printf});
20847 otherwise incorrect code is generated for calls to those
20848 functions.
20849
20850 In addition, seriously incorrect code results if you call a
20851 function with too many arguments. (Normally, extra arguments are
20852 harmlessly ignored.)
20853
20854 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20855 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20856
20857 The default is @option{-mno-rtd}.
20858
20859 @item -malign-int
20860 @itemx -mno-align-int
20861 @opindex malign-int
20862 @opindex mno-align-int
20863 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20864 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20865 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20866 Aligning variables on 32-bit boundaries produces code that runs somewhat
20867 faster on processors with 32-bit busses at the expense of more memory.
20868
20869 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20870 aligns structures containing the above types differently than
20871 most published application binary interface specifications for the m68k.
20872
20873 @item -mpcrel
20874 @opindex mpcrel
20875 Use the pc-relative addressing mode of the 68000 directly, instead of
20876 using a global offset table. At present, this option implies @option{-fpic},
20877 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20878 not presently supported with @option{-mpcrel}, though this could be supported for
20879 68020 and higher processors.
20880
20881 @item -mno-strict-align
20882 @itemx -mstrict-align
20883 @opindex mno-strict-align
20884 @opindex mstrict-align
20885 Do not (do) assume that unaligned memory references are handled by
20886 the system.
20887
20888 @item -msep-data
20889 Generate code that allows the data segment to be located in a different
20890 area of memory from the text segment. This allows for execute-in-place in
20891 an environment without virtual memory management. This option implies
20892 @option{-fPIC}.
20893
20894 @item -mno-sep-data
20895 Generate code that assumes that the data segment follows the text segment.
20896 This is the default.
20897
20898 @item -mid-shared-library
20899 Generate code that supports shared libraries via the library ID method.
20900 This allows for execute-in-place and shared libraries in an environment
20901 without virtual memory management. This option implies @option{-fPIC}.
20902
20903 @item -mno-id-shared-library
20904 Generate code that doesn't assume ID-based shared libraries are being used.
20905 This is the default.
20906
20907 @item -mshared-library-id=n
20908 Specifies the identification number of the ID-based shared library being
20909 compiled. Specifying a value of 0 generates more compact code; specifying
20910 other values forces the allocation of that number to the current
20911 library, but is no more space- or time-efficient than omitting this option.
20912
20913 @item -mxgot
20914 @itemx -mno-xgot
20915 @opindex mxgot
20916 @opindex mno-xgot
20917 When generating position-independent code for ColdFire, generate code
20918 that works if the GOT has more than 8192 entries. This code is
20919 larger and slower than code generated without this option. On M680x0
20920 processors, this option is not needed; @option{-fPIC} suffices.
20921
20922 GCC normally uses a single instruction to load values from the GOT@.
20923 While this is relatively efficient, it only works if the GOT
20924 is smaller than about 64k. Anything larger causes the linker
20925 to report an error such as:
20926
20927 @cindex relocation truncated to fit (ColdFire)
20928 @smallexample
20929 relocation truncated to fit: R_68K_GOT16O foobar
20930 @end smallexample
20931
20932 If this happens, you should recompile your code with @option{-mxgot}.
20933 It should then work with very large GOTs. However, code generated with
20934 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20935 the value of a global symbol.
20936
20937 Note that some linkers, including newer versions of the GNU linker,
20938 can create multiple GOTs and sort GOT entries. If you have such a linker,
20939 you should only need to use @option{-mxgot} when compiling a single
20940 object file that accesses more than 8192 GOT entries. Very few do.
20941
20942 These options have no effect unless GCC is generating
20943 position-independent code.
20944
20945 @item -mlong-jump-table-offsets
20946 @opindex mlong-jump-table-offsets
20947 Use 32-bit offsets in @code{switch} tables. The default is to use
20948 16-bit offsets.
20949
20950 @end table
20951
20952 @node MCore Options
20953 @subsection MCore Options
20954 @cindex MCore options
20955
20956 These are the @samp{-m} options defined for the Motorola M*Core
20957 processors.
20958
20959 @table @gcctabopt
20960
20961 @item -mhardlit
20962 @itemx -mno-hardlit
20963 @opindex mhardlit
20964 @opindex mno-hardlit
20965 Inline constants into the code stream if it can be done in two
20966 instructions or less.
20967
20968 @item -mdiv
20969 @itemx -mno-div
20970 @opindex mdiv
20971 @opindex mno-div
20972 Use the divide instruction. (Enabled by default).
20973
20974 @item -mrelax-immediate
20975 @itemx -mno-relax-immediate
20976 @opindex mrelax-immediate
20977 @opindex mno-relax-immediate
20978 Allow arbitrary-sized immediates in bit operations.
20979
20980 @item -mwide-bitfields
20981 @itemx -mno-wide-bitfields
20982 @opindex mwide-bitfields
20983 @opindex mno-wide-bitfields
20984 Always treat bit-fields as @code{int}-sized.
20985
20986 @item -m4byte-functions
20987 @itemx -mno-4byte-functions
20988 @opindex m4byte-functions
20989 @opindex mno-4byte-functions
20990 Force all functions to be aligned to a 4-byte boundary.
20991
20992 @item -mcallgraph-data
20993 @itemx -mno-callgraph-data
20994 @opindex mcallgraph-data
20995 @opindex mno-callgraph-data
20996 Emit callgraph information.
20997
20998 @item -mslow-bytes
20999 @itemx -mno-slow-bytes
21000 @opindex mslow-bytes
21001 @opindex mno-slow-bytes
21002 Prefer word access when reading byte quantities.
21003
21004 @item -mlittle-endian
21005 @itemx -mbig-endian
21006 @opindex mlittle-endian
21007 @opindex mbig-endian
21008 Generate code for a little-endian target.
21009
21010 @item -m210
21011 @itemx -m340
21012 @opindex m210
21013 @opindex m340
21014 Generate code for the 210 processor.
21015
21016 @item -mno-lsim
21017 @opindex mno-lsim
21018 Assume that runtime support has been provided and so omit the
21019 simulator library (@file{libsim.a)} from the linker command line.
21020
21021 @item -mstack-increment=@var{size}
21022 @opindex mstack-increment
21023 Set the maximum amount for a single stack increment operation. Large
21024 values can increase the speed of programs that contain functions
21025 that need a large amount of stack space, but they can also trigger a
21026 segmentation fault if the stack is extended too much. The default
21027 value is 0x1000.
21028
21029 @end table
21030
21031 @node MeP Options
21032 @subsection MeP Options
21033 @cindex MeP options
21034
21035 @table @gcctabopt
21036
21037 @item -mabsdiff
21038 @opindex mabsdiff
21039 Enables the @code{abs} instruction, which is the absolute difference
21040 between two registers.
21041
21042 @item -mall-opts
21043 @opindex mall-opts
21044 Enables all the optional instructions---average, multiply, divide, bit
21045 operations, leading zero, absolute difference, min/max, clip, and
21046 saturation.
21047
21048
21049 @item -maverage
21050 @opindex maverage
21051 Enables the @code{ave} instruction, which computes the average of two
21052 registers.
21053
21054 @item -mbased=@var{n}
21055 @opindex mbased=
21056 Variables of size @var{n} bytes or smaller are placed in the
21057 @code{.based} section by default. Based variables use the @code{$tp}
21058 register as a base register, and there is a 128-byte limit to the
21059 @code{.based} section.
21060
21061 @item -mbitops
21062 @opindex mbitops
21063 Enables the bit operation instructions---bit test (@code{btstm}), set
21064 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21065 test-and-set (@code{tas}).
21066
21067 @item -mc=@var{name}
21068 @opindex mc=
21069 Selects which section constant data is placed in. @var{name} may
21070 be @samp{tiny}, @samp{near}, or @samp{far}.
21071
21072 @item -mclip
21073 @opindex mclip
21074 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21075 useful unless you also provide @option{-mminmax}.
21076
21077 @item -mconfig=@var{name}
21078 @opindex mconfig=
21079 Selects one of the built-in core configurations. Each MeP chip has
21080 one or more modules in it; each module has a core CPU and a variety of
21081 coprocessors, optional instructions, and peripherals. The
21082 @code{MeP-Integrator} tool, not part of GCC, provides these
21083 configurations through this option; using this option is the same as
21084 using all the corresponding command-line options. The default
21085 configuration is @samp{default}.
21086
21087 @item -mcop
21088 @opindex mcop
21089 Enables the coprocessor instructions. By default, this is a 32-bit
21090 coprocessor. Note that the coprocessor is normally enabled via the
21091 @option{-mconfig=} option.
21092
21093 @item -mcop32
21094 @opindex mcop32
21095 Enables the 32-bit coprocessor's instructions.
21096
21097 @item -mcop64
21098 @opindex mcop64
21099 Enables the 64-bit coprocessor's instructions.
21100
21101 @item -mivc2
21102 @opindex mivc2
21103 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21104
21105 @item -mdc
21106 @opindex mdc
21107 Causes constant variables to be placed in the @code{.near} section.
21108
21109 @item -mdiv
21110 @opindex mdiv
21111 Enables the @code{div} and @code{divu} instructions.
21112
21113 @item -meb
21114 @opindex meb
21115 Generate big-endian code.
21116
21117 @item -mel
21118 @opindex mel
21119 Generate little-endian code.
21120
21121 @item -mio-volatile
21122 @opindex mio-volatile
21123 Tells the compiler that any variable marked with the @code{io}
21124 attribute is to be considered volatile.
21125
21126 @item -ml
21127 @opindex ml
21128 Causes variables to be assigned to the @code{.far} section by default.
21129
21130 @item -mleadz
21131 @opindex mleadz
21132 Enables the @code{leadz} (leading zero) instruction.
21133
21134 @item -mm
21135 @opindex mm
21136 Causes variables to be assigned to the @code{.near} section by default.
21137
21138 @item -mminmax
21139 @opindex mminmax
21140 Enables the @code{min} and @code{max} instructions.
21141
21142 @item -mmult
21143 @opindex mmult
21144 Enables the multiplication and multiply-accumulate instructions.
21145
21146 @item -mno-opts
21147 @opindex mno-opts
21148 Disables all the optional instructions enabled by @option{-mall-opts}.
21149
21150 @item -mrepeat
21151 @opindex mrepeat
21152 Enables the @code{repeat} and @code{erepeat} instructions, used for
21153 low-overhead looping.
21154
21155 @item -ms
21156 @opindex ms
21157 Causes all variables to default to the @code{.tiny} section. Note
21158 that there is a 65536-byte limit to this section. Accesses to these
21159 variables use the @code{%gp} base register.
21160
21161 @item -msatur
21162 @opindex msatur
21163 Enables the saturation instructions. Note that the compiler does not
21164 currently generate these itself, but this option is included for
21165 compatibility with other tools, like @code{as}.
21166
21167 @item -msdram
21168 @opindex msdram
21169 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21170
21171 @item -msim
21172 @opindex msim
21173 Link the simulator run-time libraries.
21174
21175 @item -msimnovec
21176 @opindex msimnovec
21177 Link the simulator runtime libraries, excluding built-in support
21178 for reset and exception vectors and tables.
21179
21180 @item -mtf
21181 @opindex mtf
21182 Causes all functions to default to the @code{.far} section. Without
21183 this option, functions default to the @code{.near} section.
21184
21185 @item -mtiny=@var{n}
21186 @opindex mtiny=
21187 Variables that are @var{n} bytes or smaller are allocated to the
21188 @code{.tiny} section. These variables use the @code{$gp} base
21189 register. The default for this option is 4, but note that there's a
21190 65536-byte limit to the @code{.tiny} section.
21191
21192 @end table
21193
21194 @node MicroBlaze Options
21195 @subsection MicroBlaze Options
21196 @cindex MicroBlaze Options
21197
21198 @table @gcctabopt
21199
21200 @item -msoft-float
21201 @opindex msoft-float
21202 Use software emulation for floating point (default).
21203
21204 @item -mhard-float
21205 @opindex mhard-float
21206 Use hardware floating-point instructions.
21207
21208 @item -mmemcpy
21209 @opindex mmemcpy
21210 Do not optimize block moves, use @code{memcpy}.
21211
21212 @item -mno-clearbss
21213 @opindex mno-clearbss
21214 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21215
21216 @item -mcpu=@var{cpu-type}
21217 @opindex mcpu=
21218 Use features of, and schedule code for, the given CPU.
21219 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21220 where @var{X} is a major version, @var{YY} is the minor version, and
21221 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21222 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21223
21224 @item -mxl-soft-mul
21225 @opindex mxl-soft-mul
21226 Use software multiply emulation (default).
21227
21228 @item -mxl-soft-div
21229 @opindex mxl-soft-div
21230 Use software emulation for divides (default).
21231
21232 @item -mxl-barrel-shift
21233 @opindex mxl-barrel-shift
21234 Use the hardware barrel shifter.
21235
21236 @item -mxl-pattern-compare
21237 @opindex mxl-pattern-compare
21238 Use pattern compare instructions.
21239
21240 @item -msmall-divides
21241 @opindex msmall-divides
21242 Use table lookup optimization for small signed integer divisions.
21243
21244 @item -mxl-stack-check
21245 @opindex mxl-stack-check
21246 This option is deprecated. Use @option{-fstack-check} instead.
21247
21248 @item -mxl-gp-opt
21249 @opindex mxl-gp-opt
21250 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21251
21252 @item -mxl-multiply-high
21253 @opindex mxl-multiply-high
21254 Use multiply high instructions for high part of 32x32 multiply.
21255
21256 @item -mxl-float-convert
21257 @opindex mxl-float-convert
21258 Use hardware floating-point conversion instructions.
21259
21260 @item -mxl-float-sqrt
21261 @opindex mxl-float-sqrt
21262 Use hardware floating-point square root instruction.
21263
21264 @item -mbig-endian
21265 @opindex mbig-endian
21266 Generate code for a big-endian target.
21267
21268 @item -mlittle-endian
21269 @opindex mlittle-endian
21270 Generate code for a little-endian target.
21271
21272 @item -mxl-reorder
21273 @opindex mxl-reorder
21274 Use reorder instructions (swap and byte reversed load/store).
21275
21276 @item -mxl-mode-@var{app-model}
21277 Select application model @var{app-model}. Valid models are
21278 @table @samp
21279 @item executable
21280 normal executable (default), uses startup code @file{crt0.o}.
21281
21282 @item -mpic-data-is-text-relative
21283 @opindex mpic-data-is-text-relative
21284 Assume that the displacement between the text and data segments is fixed
21285 at static link time. This allows data to be referenced by offset from start of
21286 text address instead of GOT since PC-relative addressing is not supported.
21287
21288 @item xmdstub
21289 for use with Xilinx Microprocessor Debugger (XMD) based
21290 software intrusive debug agent called xmdstub. This uses startup file
21291 @file{crt1.o} and sets the start address of the program to 0x800.
21292
21293 @item bootstrap
21294 for applications that are loaded using a bootloader.
21295 This model uses startup file @file{crt2.o} which does not contain a processor
21296 reset vector handler. This is suitable for transferring control on a
21297 processor reset to the bootloader rather than the application.
21298
21299 @item novectors
21300 for applications that do not require any of the
21301 MicroBlaze vectors. This option may be useful for applications running
21302 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21303 @end table
21304
21305 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21306 @option{-mxl-mode-@var{app-model}}.
21307
21308 @end table
21309
21310 @node MIPS Options
21311 @subsection MIPS Options
21312 @cindex MIPS options
21313
21314 @table @gcctabopt
21315
21316 @item -EB
21317 @opindex EB
21318 Generate big-endian code.
21319
21320 @item -EL
21321 @opindex EL
21322 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21323 configurations.
21324
21325 @item -march=@var{arch}
21326 @opindex march
21327 Generate code that runs on @var{arch}, which can be the name of a
21328 generic MIPS ISA, or the name of a particular processor.
21329 The ISA names are:
21330 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21331 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21332 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21333 @samp{mips64r5} and @samp{mips64r6}.
21334 The processor names are:
21335 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21336 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21337 @samp{5kc}, @samp{5kf},
21338 @samp{20kc},
21339 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21340 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21341 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21342 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21343 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21344 @samp{i6400}, @samp{i6500},
21345 @samp{interaptiv},
21346 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21347 @samp{gs464e}, @samp{gs264e},
21348 @samp{m4k},
21349 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21350 @samp{m5100}, @samp{m5101},
21351 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21352 @samp{orion},
21353 @samp{p5600}, @samp{p6600},
21354 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21355 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21356 @samp{r6000}, @samp{r8000},
21357 @samp{rm7000}, @samp{rm9000},
21358 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21359 @samp{sb1},
21360 @samp{sr71000},
21361 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21362 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21363 @samp{xlr} and @samp{xlp}.
21364 The special value @samp{from-abi} selects the
21365 most compatible architecture for the selected ABI (that is,
21366 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21367
21368 The native Linux/GNU toolchain also supports the value @samp{native},
21369 which selects the best architecture option for the host processor.
21370 @option{-march=native} has no effect if GCC does not recognize
21371 the processor.
21372
21373 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21374 (for example, @option{-march=r2k}). Prefixes are optional, and
21375 @samp{vr} may be written @samp{r}.
21376
21377 Names of the form @samp{@var{n}f2_1} refer to processors with
21378 FPUs clocked at half the rate of the core, names of the form
21379 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21380 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21381 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21382 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21383 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21384 accepted as synonyms for @samp{@var{n}f1_1}.
21385
21386 GCC defines two macros based on the value of this option. The first
21387 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21388 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21389 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21390 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21391 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21392
21393 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21394 above. In other words, it has the full prefix and does not
21395 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21396 the macro names the resolved architecture (either @code{"mips1"} or
21397 @code{"mips3"}). It names the default architecture when no
21398 @option{-march} option is given.
21399
21400 @item -mtune=@var{arch}
21401 @opindex mtune
21402 Optimize for @var{arch}. Among other things, this option controls
21403 the way instructions are scheduled, and the perceived cost of arithmetic
21404 operations. The list of @var{arch} values is the same as for
21405 @option{-march}.
21406
21407 When this option is not used, GCC optimizes for the processor
21408 specified by @option{-march}. By using @option{-march} and
21409 @option{-mtune} together, it is possible to generate code that
21410 runs on a family of processors, but optimize the code for one
21411 particular member of that family.
21412
21413 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21414 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21415 @option{-march} ones described above.
21416
21417 @item -mips1
21418 @opindex mips1
21419 Equivalent to @option{-march=mips1}.
21420
21421 @item -mips2
21422 @opindex mips2
21423 Equivalent to @option{-march=mips2}.
21424
21425 @item -mips3
21426 @opindex mips3
21427 Equivalent to @option{-march=mips3}.
21428
21429 @item -mips4
21430 @opindex mips4
21431 Equivalent to @option{-march=mips4}.
21432
21433 @item -mips32
21434 @opindex mips32
21435 Equivalent to @option{-march=mips32}.
21436
21437 @item -mips32r3
21438 @opindex mips32r3
21439 Equivalent to @option{-march=mips32r3}.
21440
21441 @item -mips32r5
21442 @opindex mips32r5
21443 Equivalent to @option{-march=mips32r5}.
21444
21445 @item -mips32r6
21446 @opindex mips32r6
21447 Equivalent to @option{-march=mips32r6}.
21448
21449 @item -mips64
21450 @opindex mips64
21451 Equivalent to @option{-march=mips64}.
21452
21453 @item -mips64r2
21454 @opindex mips64r2
21455 Equivalent to @option{-march=mips64r2}.
21456
21457 @item -mips64r3
21458 @opindex mips64r3
21459 Equivalent to @option{-march=mips64r3}.
21460
21461 @item -mips64r5
21462 @opindex mips64r5
21463 Equivalent to @option{-march=mips64r5}.
21464
21465 @item -mips64r6
21466 @opindex mips64r6
21467 Equivalent to @option{-march=mips64r6}.
21468
21469 @item -mips16
21470 @itemx -mno-mips16
21471 @opindex mips16
21472 @opindex mno-mips16
21473 Generate (do not generate) MIPS16 code. If GCC is targeting a
21474 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21475
21476 MIPS16 code generation can also be controlled on a per-function basis
21477 by means of @code{mips16} and @code{nomips16} attributes.
21478 @xref{Function Attributes}, for more information.
21479
21480 @item -mflip-mips16
21481 @opindex mflip-mips16
21482 Generate MIPS16 code on alternating functions. This option is provided
21483 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21484 not intended for ordinary use in compiling user code.
21485
21486 @item -minterlink-compressed
21487 @itemx -mno-interlink-compressed
21488 @opindex minterlink-compressed
21489 @opindex mno-interlink-compressed
21490 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21491 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21492
21493 For example, code using the standard ISA encoding cannot jump directly
21494 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21495 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21496 knows that the target of the jump is not compressed.
21497
21498 @item -minterlink-mips16
21499 @itemx -mno-interlink-mips16
21500 @opindex minterlink-mips16
21501 @opindex mno-interlink-mips16
21502 Aliases of @option{-minterlink-compressed} and
21503 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21504 and are retained for backwards compatibility.
21505
21506 @item -mabi=32
21507 @itemx -mabi=o64
21508 @itemx -mabi=n32
21509 @itemx -mabi=64
21510 @itemx -mabi=eabi
21511 @opindex mabi=32
21512 @opindex mabi=o64
21513 @opindex mabi=n32
21514 @opindex mabi=64
21515 @opindex mabi=eabi
21516 Generate code for the given ABI@.
21517
21518 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21519 generates 64-bit code when you select a 64-bit architecture, but you
21520 can use @option{-mgp32} to get 32-bit code instead.
21521
21522 For information about the O64 ABI, see
21523 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21524
21525 GCC supports a variant of the o32 ABI in which floating-point registers
21526 are 64 rather than 32 bits wide. You can select this combination with
21527 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21528 and @code{mfhc1} instructions and is therefore only supported for
21529 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21530
21531 The register assignments for arguments and return values remain the
21532 same, but each scalar value is passed in a single 64-bit register
21533 rather than a pair of 32-bit registers. For example, scalar
21534 floating-point values are returned in @samp{$f0} only, not a
21535 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21536 remains the same in that the even-numbered double-precision registers
21537 are saved.
21538
21539 Two additional variants of the o32 ABI are supported to enable
21540 a transition from 32-bit to 64-bit registers. These are FPXX
21541 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21542 The FPXX extension mandates that all code must execute correctly
21543 when run using 32-bit or 64-bit registers. The code can be interlinked
21544 with either FP32 or FP64, but not both.
21545 The FP64A extension is similar to the FP64 extension but forbids the
21546 use of odd-numbered single-precision registers. This can be used
21547 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21548 processors and allows both FP32 and FP64A code to interlink and
21549 run in the same process without changing FPU modes.
21550
21551 @item -mabicalls
21552 @itemx -mno-abicalls
21553 @opindex mabicalls
21554 @opindex mno-abicalls
21555 Generate (do not generate) code that is suitable for SVR4-style
21556 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21557 systems.
21558
21559 @item -mshared
21560 @itemx -mno-shared
21561 Generate (do not generate) code that is fully position-independent,
21562 and that can therefore be linked into shared libraries. This option
21563 only affects @option{-mabicalls}.
21564
21565 All @option{-mabicalls} code has traditionally been position-independent,
21566 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21567 as an extension, the GNU toolchain allows executables to use absolute
21568 accesses for locally-binding symbols. It can also use shorter GP
21569 initialization sequences and generate direct calls to locally-defined
21570 functions. This mode is selected by @option{-mno-shared}.
21571
21572 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21573 objects that can only be linked by the GNU linker. However, the option
21574 does not affect the ABI of the final executable; it only affects the ABI
21575 of relocatable objects. Using @option{-mno-shared} generally makes
21576 executables both smaller and quicker.
21577
21578 @option{-mshared} is the default.
21579
21580 @item -mplt
21581 @itemx -mno-plt
21582 @opindex mplt
21583 @opindex mno-plt
21584 Assume (do not assume) that the static and dynamic linkers
21585 support PLTs and copy relocations. This option only affects
21586 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21587 has no effect without @option{-msym32}.
21588
21589 You can make @option{-mplt} the default by configuring
21590 GCC with @option{--with-mips-plt}. The default is
21591 @option{-mno-plt} otherwise.
21592
21593 @item -mxgot
21594 @itemx -mno-xgot
21595 @opindex mxgot
21596 @opindex mno-xgot
21597 Lift (do not lift) the usual restrictions on the size of the global
21598 offset table.
21599
21600 GCC normally uses a single instruction to load values from the GOT@.
21601 While this is relatively efficient, it only works if the GOT
21602 is smaller than about 64k. Anything larger causes the linker
21603 to report an error such as:
21604
21605 @cindex relocation truncated to fit (MIPS)
21606 @smallexample
21607 relocation truncated to fit: R_MIPS_GOT16 foobar
21608 @end smallexample
21609
21610 If this happens, you should recompile your code with @option{-mxgot}.
21611 This works with very large GOTs, although the code is also
21612 less efficient, since it takes three instructions to fetch the
21613 value of a global symbol.
21614
21615 Note that some linkers can create multiple GOTs. If you have such a
21616 linker, you should only need to use @option{-mxgot} when a single object
21617 file accesses more than 64k's worth of GOT entries. Very few do.
21618
21619 These options have no effect unless GCC is generating position
21620 independent code.
21621
21622 @item -mgp32
21623 @opindex mgp32
21624 Assume that general-purpose registers are 32 bits wide.
21625
21626 @item -mgp64
21627 @opindex mgp64
21628 Assume that general-purpose registers are 64 bits wide.
21629
21630 @item -mfp32
21631 @opindex mfp32
21632 Assume that floating-point registers are 32 bits wide.
21633
21634 @item -mfp64
21635 @opindex mfp64
21636 Assume that floating-point registers are 64 bits wide.
21637
21638 @item -mfpxx
21639 @opindex mfpxx
21640 Do not assume the width of floating-point registers.
21641
21642 @item -mhard-float
21643 @opindex mhard-float
21644 Use floating-point coprocessor instructions.
21645
21646 @item -msoft-float
21647 @opindex msoft-float
21648 Do not use floating-point coprocessor instructions. Implement
21649 floating-point calculations using library calls instead.
21650
21651 @item -mno-float
21652 @opindex mno-float
21653 Equivalent to @option{-msoft-float}, but additionally asserts that the
21654 program being compiled does not perform any floating-point operations.
21655 This option is presently supported only by some bare-metal MIPS
21656 configurations, where it may select a special set of libraries
21657 that lack all floating-point support (including, for example, the
21658 floating-point @code{printf} formats).
21659 If code compiled with @option{-mno-float} accidentally contains
21660 floating-point operations, it is likely to suffer a link-time
21661 or run-time failure.
21662
21663 @item -msingle-float
21664 @opindex msingle-float
21665 Assume that the floating-point coprocessor only supports single-precision
21666 operations.
21667
21668 @item -mdouble-float
21669 @opindex mdouble-float
21670 Assume that the floating-point coprocessor supports double-precision
21671 operations. This is the default.
21672
21673 @item -modd-spreg
21674 @itemx -mno-odd-spreg
21675 @opindex modd-spreg
21676 @opindex mno-odd-spreg
21677 Enable the use of odd-numbered single-precision floating-point registers
21678 for the o32 ABI. This is the default for processors that are known to
21679 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21680 is set by default.
21681
21682 @item -mabs=2008
21683 @itemx -mabs=legacy
21684 @opindex mabs=2008
21685 @opindex mabs=legacy
21686 These options control the treatment of the special not-a-number (NaN)
21687 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21688 @code{neg.@i{fmt}} machine instructions.
21689
21690 By default or when @option{-mabs=legacy} is used the legacy
21691 treatment is selected. In this case these instructions are considered
21692 arithmetic and avoided where correct operation is required and the
21693 input operand might be a NaN. A longer sequence of instructions that
21694 manipulate the sign bit of floating-point datum manually is used
21695 instead unless the @option{-ffinite-math-only} option has also been
21696 specified.
21697
21698 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21699 this case these instructions are considered non-arithmetic and therefore
21700 operating correctly in all cases, including in particular where the
21701 input operand is a NaN. These instructions are therefore always used
21702 for the respective operations.
21703
21704 @item -mnan=2008
21705 @itemx -mnan=legacy
21706 @opindex mnan=2008
21707 @opindex mnan=legacy
21708 These options control the encoding of the special not-a-number (NaN)
21709 IEEE 754 floating-point data.
21710
21711 The @option{-mnan=legacy} option selects the legacy encoding. In this
21712 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21713 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21714 by the first bit of their trailing significand field being 1.
21715
21716 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21717 this case qNaNs are denoted by the first bit of their trailing
21718 significand field being 1, whereas sNaNs are denoted by the first bit of
21719 their trailing significand field being 0.
21720
21721 The default is @option{-mnan=legacy} unless GCC has been configured with
21722 @option{--with-nan=2008}.
21723
21724 @item -mllsc
21725 @itemx -mno-llsc
21726 @opindex mllsc
21727 @opindex mno-llsc
21728 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21729 implement atomic memory built-in functions. When neither option is
21730 specified, GCC uses the instructions if the target architecture
21731 supports them.
21732
21733 @option{-mllsc} is useful if the runtime environment can emulate the
21734 instructions and @option{-mno-llsc} can be useful when compiling for
21735 nonstandard ISAs. You can make either option the default by
21736 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21737 respectively. @option{--with-llsc} is the default for some
21738 configurations; see the installation documentation for details.
21739
21740 @item -mdsp
21741 @itemx -mno-dsp
21742 @opindex mdsp
21743 @opindex mno-dsp
21744 Use (do not use) revision 1 of the MIPS DSP ASE@.
21745 @xref{MIPS DSP Built-in Functions}. This option defines the
21746 preprocessor macro @code{__mips_dsp}. It also defines
21747 @code{__mips_dsp_rev} to 1.
21748
21749 @item -mdspr2
21750 @itemx -mno-dspr2
21751 @opindex mdspr2
21752 @opindex mno-dspr2
21753 Use (do not use) revision 2 of the MIPS DSP ASE@.
21754 @xref{MIPS DSP Built-in Functions}. This option defines the
21755 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21756 It also defines @code{__mips_dsp_rev} to 2.
21757
21758 @item -msmartmips
21759 @itemx -mno-smartmips
21760 @opindex msmartmips
21761 @opindex mno-smartmips
21762 Use (do not use) the MIPS SmartMIPS ASE.
21763
21764 @item -mpaired-single
21765 @itemx -mno-paired-single
21766 @opindex mpaired-single
21767 @opindex mno-paired-single
21768 Use (do not use) paired-single floating-point instructions.
21769 @xref{MIPS Paired-Single Support}. This option requires
21770 hardware floating-point support to be enabled.
21771
21772 @item -mdmx
21773 @itemx -mno-mdmx
21774 @opindex mdmx
21775 @opindex mno-mdmx
21776 Use (do not use) MIPS Digital Media Extension instructions.
21777 This option can only be used when generating 64-bit code and requires
21778 hardware floating-point support to be enabled.
21779
21780 @item -mips3d
21781 @itemx -mno-mips3d
21782 @opindex mips3d
21783 @opindex mno-mips3d
21784 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21785 The option @option{-mips3d} implies @option{-mpaired-single}.
21786
21787 @item -mmicromips
21788 @itemx -mno-micromips
21789 @opindex mmicromips
21790 @opindex mno-mmicromips
21791 Generate (do not generate) microMIPS code.
21792
21793 MicroMIPS code generation can also be controlled on a per-function basis
21794 by means of @code{micromips} and @code{nomicromips} attributes.
21795 @xref{Function Attributes}, for more information.
21796
21797 @item -mmt
21798 @itemx -mno-mt
21799 @opindex mmt
21800 @opindex mno-mt
21801 Use (do not use) MT Multithreading instructions.
21802
21803 @item -mmcu
21804 @itemx -mno-mcu
21805 @opindex mmcu
21806 @opindex mno-mcu
21807 Use (do not use) the MIPS MCU ASE instructions.
21808
21809 @item -meva
21810 @itemx -mno-eva
21811 @opindex meva
21812 @opindex mno-eva
21813 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21814
21815 @item -mvirt
21816 @itemx -mno-virt
21817 @opindex mvirt
21818 @opindex mno-virt
21819 Use (do not use) the MIPS Virtualization (VZ) instructions.
21820
21821 @item -mxpa
21822 @itemx -mno-xpa
21823 @opindex mxpa
21824 @opindex mno-xpa
21825 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21826
21827 @item -mcrc
21828 @itemx -mno-crc
21829 @opindex mcrc
21830 @opindex mno-crc
21831 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21832
21833 @item -mginv
21834 @itemx -mno-ginv
21835 @opindex mginv
21836 @opindex mno-ginv
21837 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21838
21839 @item -mloongson-mmi
21840 @itemx -mno-loongson-mmi
21841 @opindex mloongson-mmi
21842 @opindex mno-loongson-mmi
21843 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21844
21845 @item -mloongson-ext
21846 @itemx -mno-loongson-ext
21847 @opindex mloongson-ext
21848 @opindex mno-loongson-ext
21849 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21850
21851 @item -mloongson-ext2
21852 @itemx -mno-loongson-ext2
21853 @opindex mloongson-ext2
21854 @opindex mno-loongson-ext2
21855 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21856
21857 @item -mlong64
21858 @opindex mlong64
21859 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21860 an explanation of the default and the way that the pointer size is
21861 determined.
21862
21863 @item -mlong32
21864 @opindex mlong32
21865 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21866
21867 The default size of @code{int}s, @code{long}s and pointers depends on
21868 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21869 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21870 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21871 or the same size as integer registers, whichever is smaller.
21872
21873 @item -msym32
21874 @itemx -mno-sym32
21875 @opindex msym32
21876 @opindex mno-sym32
21877 Assume (do not assume) that all symbols have 32-bit values, regardless
21878 of the selected ABI@. This option is useful in combination with
21879 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21880 to generate shorter and faster references to symbolic addresses.
21881
21882 @item -G @var{num}
21883 @opindex G
21884 Put definitions of externally-visible data in a small data section
21885 if that data is no bigger than @var{num} bytes. GCC can then generate
21886 more efficient accesses to the data; see @option{-mgpopt} for details.
21887
21888 The default @option{-G} option depends on the configuration.
21889
21890 @item -mlocal-sdata
21891 @itemx -mno-local-sdata
21892 @opindex mlocal-sdata
21893 @opindex mno-local-sdata
21894 Extend (do not extend) the @option{-G} behavior to local data too,
21895 such as to static variables in C@. @option{-mlocal-sdata} is the
21896 default for all configurations.
21897
21898 If the linker complains that an application is using too much small data,
21899 you might want to try rebuilding the less performance-critical parts with
21900 @option{-mno-local-sdata}. You might also want to build large
21901 libraries with @option{-mno-local-sdata}, so that the libraries leave
21902 more room for the main program.
21903
21904 @item -mextern-sdata
21905 @itemx -mno-extern-sdata
21906 @opindex mextern-sdata
21907 @opindex mno-extern-sdata
21908 Assume (do not assume) that externally-defined data is in
21909 a small data section if the size of that data is within the @option{-G} limit.
21910 @option{-mextern-sdata} is the default for all configurations.
21911
21912 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21913 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21914 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21915 is placed in a small data section. If @var{Var} is defined by another
21916 module, you must either compile that module with a high-enough
21917 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21918 definition. If @var{Var} is common, you must link the application
21919 with a high-enough @option{-G} setting.
21920
21921 The easiest way of satisfying these restrictions is to compile
21922 and link every module with the same @option{-G} option. However,
21923 you may wish to build a library that supports several different
21924 small data limits. You can do this by compiling the library with
21925 the highest supported @option{-G} setting and additionally using
21926 @option{-mno-extern-sdata} to stop the library from making assumptions
21927 about externally-defined data.
21928
21929 @item -mgpopt
21930 @itemx -mno-gpopt
21931 @opindex mgpopt
21932 @opindex mno-gpopt
21933 Use (do not use) GP-relative accesses for symbols that are known to be
21934 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21935 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21936 configurations.
21937
21938 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21939 might not hold the value of @code{_gp}. For example, if the code is
21940 part of a library that might be used in a boot monitor, programs that
21941 call boot monitor routines pass an unknown value in @code{$gp}.
21942 (In such situations, the boot monitor itself is usually compiled
21943 with @option{-G0}.)
21944
21945 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21946 @option{-mno-extern-sdata}.
21947
21948 @item -membedded-data
21949 @itemx -mno-embedded-data
21950 @opindex membedded-data
21951 @opindex mno-embedded-data
21952 Allocate variables to the read-only data section first if possible, then
21953 next in the small data section if possible, otherwise in data. This gives
21954 slightly slower code than the default, but reduces the amount of RAM required
21955 when executing, and thus may be preferred for some embedded systems.
21956
21957 @item -muninit-const-in-rodata
21958 @itemx -mno-uninit-const-in-rodata
21959 @opindex muninit-const-in-rodata
21960 @opindex mno-uninit-const-in-rodata
21961 Put uninitialized @code{const} variables in the read-only data section.
21962 This option is only meaningful in conjunction with @option{-membedded-data}.
21963
21964 @item -mcode-readable=@var{setting}
21965 @opindex mcode-readable
21966 Specify whether GCC may generate code that reads from executable sections.
21967 There are three possible settings:
21968
21969 @table @gcctabopt
21970 @item -mcode-readable=yes
21971 Instructions may freely access executable sections. This is the
21972 default setting.
21973
21974 @item -mcode-readable=pcrel
21975 MIPS16 PC-relative load instructions can access executable sections,
21976 but other instructions must not do so. This option is useful on 4KSc
21977 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21978 It is also useful on processors that can be configured to have a dual
21979 instruction/data SRAM interface and that, like the M4K, automatically
21980 redirect PC-relative loads to the instruction RAM.
21981
21982 @item -mcode-readable=no
21983 Instructions must not access executable sections. This option can be
21984 useful on targets that are configured to have a dual instruction/data
21985 SRAM interface but that (unlike the M4K) do not automatically redirect
21986 PC-relative loads to the instruction RAM.
21987 @end table
21988
21989 @item -msplit-addresses
21990 @itemx -mno-split-addresses
21991 @opindex msplit-addresses
21992 @opindex mno-split-addresses
21993 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21994 relocation operators. This option has been superseded by
21995 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21996
21997 @item -mexplicit-relocs
21998 @itemx -mno-explicit-relocs
21999 @opindex mexplicit-relocs
22000 @opindex mno-explicit-relocs
22001 Use (do not use) assembler relocation operators when dealing with symbolic
22002 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22003 is to use assembler macros instead.
22004
22005 @option{-mexplicit-relocs} is the default if GCC was configured
22006 to use an assembler that supports relocation operators.
22007
22008 @item -mcheck-zero-division
22009 @itemx -mno-check-zero-division
22010 @opindex mcheck-zero-division
22011 @opindex mno-check-zero-division
22012 Trap (do not trap) on integer division by zero.
22013
22014 The default is @option{-mcheck-zero-division}.
22015
22016 @item -mdivide-traps
22017 @itemx -mdivide-breaks
22018 @opindex mdivide-traps
22019 @opindex mdivide-breaks
22020 MIPS systems check for division by zero by generating either a
22021 conditional trap or a break instruction. Using traps results in
22022 smaller code, but is only supported on MIPS II and later. Also, some
22023 versions of the Linux kernel have a bug that prevents trap from
22024 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22025 allow conditional traps on architectures that support them and
22026 @option{-mdivide-breaks} to force the use of breaks.
22027
22028 The default is usually @option{-mdivide-traps}, but this can be
22029 overridden at configure time using @option{--with-divide=breaks}.
22030 Divide-by-zero checks can be completely disabled using
22031 @option{-mno-check-zero-division}.
22032
22033 @item -mload-store-pairs
22034 @itemx -mno-load-store-pairs
22035 @opindex mload-store-pairs
22036 @opindex mno-load-store-pairs
22037 Enable (disable) an optimization that pairs consecutive load or store
22038 instructions to enable load/store bonding. This option is enabled by
22039 default but only takes effect when the selected architecture is known
22040 to support bonding.
22041
22042 @item -mmemcpy
22043 @itemx -mno-memcpy
22044 @opindex mmemcpy
22045 @opindex mno-memcpy
22046 Force (do not force) the use of @code{memcpy} for non-trivial block
22047 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22048 most constant-sized copies.
22049
22050 @item -mlong-calls
22051 @itemx -mno-long-calls
22052 @opindex mlong-calls
22053 @opindex mno-long-calls
22054 Disable (do not disable) use of the @code{jal} instruction. Calling
22055 functions using @code{jal} is more efficient but requires the caller
22056 and callee to be in the same 256 megabyte segment.
22057
22058 This option has no effect on abicalls code. The default is
22059 @option{-mno-long-calls}.
22060
22061 @item -mmad
22062 @itemx -mno-mad
22063 @opindex mmad
22064 @opindex mno-mad
22065 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22066 instructions, as provided by the R4650 ISA@.
22067
22068 @item -mimadd
22069 @itemx -mno-imadd
22070 @opindex mimadd
22071 @opindex mno-imadd
22072 Enable (disable) use of the @code{madd} and @code{msub} integer
22073 instructions. The default is @option{-mimadd} on architectures
22074 that support @code{madd} and @code{msub} except for the 74k
22075 architecture where it was found to generate slower code.
22076
22077 @item -mfused-madd
22078 @itemx -mno-fused-madd
22079 @opindex mfused-madd
22080 @opindex mno-fused-madd
22081 Enable (disable) use of the floating-point multiply-accumulate
22082 instructions, when they are available. The default is
22083 @option{-mfused-madd}.
22084
22085 On the R8000 CPU when multiply-accumulate instructions are used,
22086 the intermediate product is calculated to infinite precision
22087 and is not subject to the FCSR Flush to Zero bit. This may be
22088 undesirable in some circumstances. On other processors the result
22089 is numerically identical to the equivalent computation using
22090 separate multiply, add, subtract and negate instructions.
22091
22092 @item -nocpp
22093 @opindex nocpp
22094 Tell the MIPS assembler to not run its preprocessor over user
22095 assembler files (with a @samp{.s} suffix) when assembling them.
22096
22097 @item -mfix-24k
22098 @itemx -mno-fix-24k
22099 @opindex mfix-24k
22100 @opindex mno-fix-24k
22101 Work around the 24K E48 (lost data on stores during refill) errata.
22102 The workarounds are implemented by the assembler rather than by GCC@.
22103
22104 @item -mfix-r4000
22105 @itemx -mno-fix-r4000
22106 @opindex mfix-r4000
22107 @opindex mno-fix-r4000
22108 Work around certain R4000 CPU errata:
22109 @itemize @minus
22110 @item
22111 A double-word or a variable shift may give an incorrect result if executed
22112 immediately after starting an integer division.
22113 @item
22114 A double-word or a variable shift may give an incorrect result if executed
22115 while an integer multiplication is in progress.
22116 @item
22117 An integer division may give an incorrect result if started in a delay slot
22118 of a taken branch or a jump.
22119 @end itemize
22120
22121 @item -mfix-r4400
22122 @itemx -mno-fix-r4400
22123 @opindex mfix-r4400
22124 @opindex mno-fix-r4400
22125 Work around certain R4400 CPU errata:
22126 @itemize @minus
22127 @item
22128 A double-word or a variable shift may give an incorrect result if executed
22129 immediately after starting an integer division.
22130 @end itemize
22131
22132 @item -mfix-r10000
22133 @itemx -mno-fix-r10000
22134 @opindex mfix-r10000
22135 @opindex mno-fix-r10000
22136 Work around certain R10000 errata:
22137 @itemize @minus
22138 @item
22139 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22140 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22141 @end itemize
22142
22143 This option can only be used if the target architecture supports
22144 branch-likely instructions. @option{-mfix-r10000} is the default when
22145 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22146 otherwise.
22147
22148 @item -mfix-r5900
22149 @itemx -mno-fix-r5900
22150 @opindex mfix-r5900
22151 Do not attempt to schedule the preceding instruction into the delay slot
22152 of a branch instruction placed at the end of a short loop of six
22153 instructions or fewer and always schedule a @code{nop} instruction there
22154 instead. The short loop bug under certain conditions causes loops to
22155 execute only once or twice, due to a hardware bug in the R5900 chip. The
22156 workaround is implemented by the assembler rather than by GCC@.
22157
22158 @item -mfix-rm7000
22159 @itemx -mno-fix-rm7000
22160 @opindex mfix-rm7000
22161 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22162 workarounds are implemented by the assembler rather than by GCC@.
22163
22164 @item -mfix-vr4120
22165 @itemx -mno-fix-vr4120
22166 @opindex mfix-vr4120
22167 Work around certain VR4120 errata:
22168 @itemize @minus
22169 @item
22170 @code{dmultu} does not always produce the correct result.
22171 @item
22172 @code{div} and @code{ddiv} do not always produce the correct result if one
22173 of the operands is negative.
22174 @end itemize
22175 The workarounds for the division errata rely on special functions in
22176 @file{libgcc.a}. At present, these functions are only provided by
22177 the @code{mips64vr*-elf} configurations.
22178
22179 Other VR4120 errata require a NOP to be inserted between certain pairs of
22180 instructions. These errata are handled by the assembler, not by GCC itself.
22181
22182 @item -mfix-vr4130
22183 @opindex mfix-vr4130
22184 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22185 workarounds are implemented by the assembler rather than by GCC,
22186 although GCC avoids using @code{mflo} and @code{mfhi} if the
22187 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22188 instructions are available instead.
22189
22190 @item -mfix-sb1
22191 @itemx -mno-fix-sb1
22192 @opindex mfix-sb1
22193 Work around certain SB-1 CPU core errata.
22194 (This flag currently works around the SB-1 revision 2
22195 ``F1'' and ``F2'' floating-point errata.)
22196
22197 @item -mr10k-cache-barrier=@var{setting}
22198 @opindex mr10k-cache-barrier
22199 Specify whether GCC should insert cache barriers to avoid the
22200 side effects of speculation on R10K processors.
22201
22202 In common with many processors, the R10K tries to predict the outcome
22203 of a conditional branch and speculatively executes instructions from
22204 the ``taken'' branch. It later aborts these instructions if the
22205 predicted outcome is wrong. However, on the R10K, even aborted
22206 instructions can have side effects.
22207
22208 This problem only affects kernel stores and, depending on the system,
22209 kernel loads. As an example, a speculatively-executed store may load
22210 the target memory into cache and mark the cache line as dirty, even if
22211 the store itself is later aborted. If a DMA operation writes to the
22212 same area of memory before the ``dirty'' line is flushed, the cached
22213 data overwrites the DMA-ed data. See the R10K processor manual
22214 for a full description, including other potential problems.
22215
22216 One workaround is to insert cache barrier instructions before every memory
22217 access that might be speculatively executed and that might have side
22218 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22219 controls GCC's implementation of this workaround. It assumes that
22220 aborted accesses to any byte in the following regions does not have
22221 side effects:
22222
22223 @enumerate
22224 @item
22225 the memory occupied by the current function's stack frame;
22226
22227 @item
22228 the memory occupied by an incoming stack argument;
22229
22230 @item
22231 the memory occupied by an object with a link-time-constant address.
22232 @end enumerate
22233
22234 It is the kernel's responsibility to ensure that speculative
22235 accesses to these regions are indeed safe.
22236
22237 If the input program contains a function declaration such as:
22238
22239 @smallexample
22240 void foo (void);
22241 @end smallexample
22242
22243 then the implementation of @code{foo} must allow @code{j foo} and
22244 @code{jal foo} to be executed speculatively. GCC honors this
22245 restriction for functions it compiles itself. It expects non-GCC
22246 functions (such as hand-written assembly code) to do the same.
22247
22248 The option has three forms:
22249
22250 @table @gcctabopt
22251 @item -mr10k-cache-barrier=load-store
22252 Insert a cache barrier before a load or store that might be
22253 speculatively executed and that might have side effects even
22254 if aborted.
22255
22256 @item -mr10k-cache-barrier=store
22257 Insert a cache barrier before a store that might be speculatively
22258 executed and that might have side effects even if aborted.
22259
22260 @item -mr10k-cache-barrier=none
22261 Disable the insertion of cache barriers. This is the default setting.
22262 @end table
22263
22264 @item -mflush-func=@var{func}
22265 @itemx -mno-flush-func
22266 @opindex mflush-func
22267 Specifies the function to call to flush the I and D caches, or to not
22268 call any such function. If called, the function must take the same
22269 arguments as the common @code{_flush_func}, that is, the address of the
22270 memory range for which the cache is being flushed, the size of the
22271 memory range, and the number 3 (to flush both caches). The default
22272 depends on the target GCC was configured for, but commonly is either
22273 @code{_flush_func} or @code{__cpu_flush}.
22274
22275 @item mbranch-cost=@var{num}
22276 @opindex mbranch-cost
22277 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22278 This cost is only a heuristic and is not guaranteed to produce
22279 consistent results across releases. A zero cost redundantly selects
22280 the default, which is based on the @option{-mtune} setting.
22281
22282 @item -mbranch-likely
22283 @itemx -mno-branch-likely
22284 @opindex mbranch-likely
22285 @opindex mno-branch-likely
22286 Enable or disable use of Branch Likely instructions, regardless of the
22287 default for the selected architecture. By default, Branch Likely
22288 instructions may be generated if they are supported by the selected
22289 architecture. An exception is for the MIPS32 and MIPS64 architectures
22290 and processors that implement those architectures; for those, Branch
22291 Likely instructions are not be generated by default because the MIPS32
22292 and MIPS64 architectures specifically deprecate their use.
22293
22294 @item -mcompact-branches=never
22295 @itemx -mcompact-branches=optimal
22296 @itemx -mcompact-branches=always
22297 @opindex mcompact-branches=never
22298 @opindex mcompact-branches=optimal
22299 @opindex mcompact-branches=always
22300 These options control which form of branches will be generated. The
22301 default is @option{-mcompact-branches=optimal}.
22302
22303 The @option{-mcompact-branches=never} option ensures that compact branch
22304 instructions will never be generated.
22305
22306 The @option{-mcompact-branches=always} option ensures that a compact
22307 branch instruction will be generated if available. If a compact branch
22308 instruction is not available, a delay slot form of the branch will be
22309 used instead.
22310
22311 This option is supported from MIPS Release 6 onwards.
22312
22313 The @option{-mcompact-branches=optimal} option will cause a delay slot
22314 branch to be used if one is available in the current ISA and the delay
22315 slot is successfully filled. If the delay slot is not filled, a compact
22316 branch will be chosen if one is available.
22317
22318 @item -mfp-exceptions
22319 @itemx -mno-fp-exceptions
22320 @opindex mfp-exceptions
22321 Specifies whether FP exceptions are enabled. This affects how
22322 FP instructions are scheduled for some processors.
22323 The default is that FP exceptions are
22324 enabled.
22325
22326 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22327 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22328 FP pipe.
22329
22330 @item -mvr4130-align
22331 @itemx -mno-vr4130-align
22332 @opindex mvr4130-align
22333 The VR4130 pipeline is two-way superscalar, but can only issue two
22334 instructions together if the first one is 8-byte aligned. When this
22335 option is enabled, GCC aligns pairs of instructions that it
22336 thinks should execute in parallel.
22337
22338 This option only has an effect when optimizing for the VR4130.
22339 It normally makes code faster, but at the expense of making it bigger.
22340 It is enabled by default at optimization level @option{-O3}.
22341
22342 @item -msynci
22343 @itemx -mno-synci
22344 @opindex msynci
22345 Enable (disable) generation of @code{synci} instructions on
22346 architectures that support it. The @code{synci} instructions (if
22347 enabled) are generated when @code{__builtin___clear_cache} is
22348 compiled.
22349
22350 This option defaults to @option{-mno-synci}, but the default can be
22351 overridden by configuring GCC with @option{--with-synci}.
22352
22353 When compiling code for single processor systems, it is generally safe
22354 to use @code{synci}. However, on many multi-core (SMP) systems, it
22355 does not invalidate the instruction caches on all cores and may lead
22356 to undefined behavior.
22357
22358 @item -mrelax-pic-calls
22359 @itemx -mno-relax-pic-calls
22360 @opindex mrelax-pic-calls
22361 Try to turn PIC calls that are normally dispatched via register
22362 @code{$25} into direct calls. This is only possible if the linker can
22363 resolve the destination at link time and if the destination is within
22364 range for a direct call.
22365
22366 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22367 an assembler and a linker that support the @code{.reloc} assembly
22368 directive and @option{-mexplicit-relocs} is in effect. With
22369 @option{-mno-explicit-relocs}, this optimization can be performed by the
22370 assembler and the linker alone without help from the compiler.
22371
22372 @item -mmcount-ra-address
22373 @itemx -mno-mcount-ra-address
22374 @opindex mmcount-ra-address
22375 @opindex mno-mcount-ra-address
22376 Emit (do not emit) code that allows @code{_mcount} to modify the
22377 calling function's return address. When enabled, this option extends
22378 the usual @code{_mcount} interface with a new @var{ra-address}
22379 parameter, which has type @code{intptr_t *} and is passed in register
22380 @code{$12}. @code{_mcount} can then modify the return address by
22381 doing both of the following:
22382 @itemize
22383 @item
22384 Returning the new address in register @code{$31}.
22385 @item
22386 Storing the new address in @code{*@var{ra-address}},
22387 if @var{ra-address} is nonnull.
22388 @end itemize
22389
22390 The default is @option{-mno-mcount-ra-address}.
22391
22392 @item -mframe-header-opt
22393 @itemx -mno-frame-header-opt
22394 @opindex mframe-header-opt
22395 Enable (disable) frame header optimization in the o32 ABI. When using the
22396 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22397 function to write out register arguments. When enabled, this optimization
22398 will suppress the allocation of the frame header if it can be determined that
22399 it is unused.
22400
22401 This optimization is off by default at all optimization levels.
22402
22403 @item -mlxc1-sxc1
22404 @itemx -mno-lxc1-sxc1
22405 @opindex mlxc1-sxc1
22406 When applicable, enable (disable) the generation of @code{lwxc1},
22407 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22408
22409 @item -mmadd4
22410 @itemx -mno-madd4
22411 @opindex mmadd4
22412 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22413 @code{madd.d} and related instructions. Enabled by default.
22414
22415 @end table
22416
22417 @node MMIX Options
22418 @subsection MMIX Options
22419 @cindex MMIX Options
22420
22421 These options are defined for the MMIX:
22422
22423 @table @gcctabopt
22424 @item -mlibfuncs
22425 @itemx -mno-libfuncs
22426 @opindex mlibfuncs
22427 @opindex mno-libfuncs
22428 Specify that intrinsic library functions are being compiled, passing all
22429 values in registers, no matter the size.
22430
22431 @item -mepsilon
22432 @itemx -mno-epsilon
22433 @opindex mepsilon
22434 @opindex mno-epsilon
22435 Generate floating-point comparison instructions that compare with respect
22436 to the @code{rE} epsilon register.
22437
22438 @item -mabi=mmixware
22439 @itemx -mabi=gnu
22440 @opindex mabi=mmixware
22441 @opindex mabi=gnu
22442 Generate code that passes function parameters and return values that (in
22443 the called function) are seen as registers @code{$0} and up, as opposed to
22444 the GNU ABI which uses global registers @code{$231} and up.
22445
22446 @item -mzero-extend
22447 @itemx -mno-zero-extend
22448 @opindex mzero-extend
22449 @opindex mno-zero-extend
22450 When reading data from memory in sizes shorter than 64 bits, use (do not
22451 use) zero-extending load instructions by default, rather than
22452 sign-extending ones.
22453
22454 @item -mknuthdiv
22455 @itemx -mno-knuthdiv
22456 @opindex mknuthdiv
22457 @opindex mno-knuthdiv
22458 Make the result of a division yielding a remainder have the same sign as
22459 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22460 remainder follows the sign of the dividend. Both methods are
22461 arithmetically valid, the latter being almost exclusively used.
22462
22463 @item -mtoplevel-symbols
22464 @itemx -mno-toplevel-symbols
22465 @opindex mtoplevel-symbols
22466 @opindex mno-toplevel-symbols
22467 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22468 code can be used with the @code{PREFIX} assembly directive.
22469
22470 @item -melf
22471 @opindex melf
22472 Generate an executable in the ELF format, rather than the default
22473 @samp{mmo} format used by the @command{mmix} simulator.
22474
22475 @item -mbranch-predict
22476 @itemx -mno-branch-predict
22477 @opindex mbranch-predict
22478 @opindex mno-branch-predict
22479 Use (do not use) the probable-branch instructions, when static branch
22480 prediction indicates a probable branch.
22481
22482 @item -mbase-addresses
22483 @itemx -mno-base-addresses
22484 @opindex mbase-addresses
22485 @opindex mno-base-addresses
22486 Generate (do not generate) code that uses @emph{base addresses}. Using a
22487 base address automatically generates a request (handled by the assembler
22488 and the linker) for a constant to be set up in a global register. The
22489 register is used for one or more base address requests within the range 0
22490 to 255 from the value held in the register. The generally leads to short
22491 and fast code, but the number of different data items that can be
22492 addressed is limited. This means that a program that uses lots of static
22493 data may require @option{-mno-base-addresses}.
22494
22495 @item -msingle-exit
22496 @itemx -mno-single-exit
22497 @opindex msingle-exit
22498 @opindex mno-single-exit
22499 Force (do not force) generated code to have a single exit point in each
22500 function.
22501 @end table
22502
22503 @node MN10300 Options
22504 @subsection MN10300 Options
22505 @cindex MN10300 options
22506
22507 These @option{-m} options are defined for Matsushita MN10300 architectures:
22508
22509 @table @gcctabopt
22510 @item -mmult-bug
22511 @opindex mmult-bug
22512 Generate code to avoid bugs in the multiply instructions for the MN10300
22513 processors. This is the default.
22514
22515 @item -mno-mult-bug
22516 @opindex mno-mult-bug
22517 Do not generate code to avoid bugs in the multiply instructions for the
22518 MN10300 processors.
22519
22520 @item -mam33
22521 @opindex mam33
22522 Generate code using features specific to the AM33 processor.
22523
22524 @item -mno-am33
22525 @opindex mno-am33
22526 Do not generate code using features specific to the AM33 processor. This
22527 is the default.
22528
22529 @item -mam33-2
22530 @opindex mam33-2
22531 Generate code using features specific to the AM33/2.0 processor.
22532
22533 @item -mam34
22534 @opindex mam34
22535 Generate code using features specific to the AM34 processor.
22536
22537 @item -mtune=@var{cpu-type}
22538 @opindex mtune
22539 Use the timing characteristics of the indicated CPU type when
22540 scheduling instructions. This does not change the targeted processor
22541 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22542 @samp{am33-2} or @samp{am34}.
22543
22544 @item -mreturn-pointer-on-d0
22545 @opindex mreturn-pointer-on-d0
22546 When generating a function that returns a pointer, return the pointer
22547 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22548 only in @code{a0}, and attempts to call such functions without a prototype
22549 result in errors. Note that this option is on by default; use
22550 @option{-mno-return-pointer-on-d0} to disable it.
22551
22552 @item -mno-crt0
22553 @opindex mno-crt0
22554 Do not link in the C run-time initialization object file.
22555
22556 @item -mrelax
22557 @opindex mrelax
22558 Indicate to the linker that it should perform a relaxation optimization pass
22559 to shorten branches, calls and absolute memory addresses. This option only
22560 has an effect when used on the command line for the final link step.
22561
22562 This option makes symbolic debugging impossible.
22563
22564 @item -mliw
22565 @opindex mliw
22566 Allow the compiler to generate @emph{Long Instruction Word}
22567 instructions if the target is the @samp{AM33} or later. This is the
22568 default. This option defines the preprocessor macro @code{__LIW__}.
22569
22570 @item -mno-liw
22571 @opindex mno-liw
22572 Do not allow the compiler to generate @emph{Long Instruction Word}
22573 instructions. This option defines the preprocessor macro
22574 @code{__NO_LIW__}.
22575
22576 @item -msetlb
22577 @opindex msetlb
22578 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22579 instructions if the target is the @samp{AM33} or later. This is the
22580 default. This option defines the preprocessor macro @code{__SETLB__}.
22581
22582 @item -mno-setlb
22583 @opindex mno-setlb
22584 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22585 instructions. This option defines the preprocessor macro
22586 @code{__NO_SETLB__}.
22587
22588 @end table
22589
22590 @node Moxie Options
22591 @subsection Moxie Options
22592 @cindex Moxie Options
22593
22594 @table @gcctabopt
22595
22596 @item -meb
22597 @opindex meb
22598 Generate big-endian code. This is the default for @samp{moxie-*-*}
22599 configurations.
22600
22601 @item -mel
22602 @opindex mel
22603 Generate little-endian code.
22604
22605 @item -mmul.x
22606 @opindex mmul.x
22607 Generate mul.x and umul.x instructions. This is the default for
22608 @samp{moxiebox-*-*} configurations.
22609
22610 @item -mno-crt0
22611 @opindex mno-crt0
22612 Do not link in the C run-time initialization object file.
22613
22614 @end table
22615
22616 @node MSP430 Options
22617 @subsection MSP430 Options
22618 @cindex MSP430 Options
22619
22620 These options are defined for the MSP430:
22621
22622 @table @gcctabopt
22623
22624 @item -masm-hex
22625 @opindex masm-hex
22626 Force assembly output to always use hex constants. Normally such
22627 constants are signed decimals, but this option is available for
22628 testsuite and/or aesthetic purposes.
22629
22630 @item -mmcu=
22631 @opindex mmcu=
22632 Select the MCU to target. This is used to create a C preprocessor
22633 symbol based upon the MCU name, converted to upper case and pre- and
22634 post-fixed with @samp{__}. This in turn is used by the
22635 @file{msp430.h} header file to select an MCU-specific supplementary
22636 header file.
22637
22638 The option also sets the ISA to use. If the MCU name is one that is
22639 known to only support the 430 ISA then that is selected, otherwise the
22640 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22641 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22642 name selects the 430X ISA.
22643
22644 In addition an MCU-specific linker script is added to the linker
22645 command line. The script's name is the name of the MCU with
22646 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22647 command line defines the C preprocessor symbol @code{__XXX__} and
22648 cause the linker to search for a script called @file{xxx.ld}.
22649
22650 This option is also passed on to the assembler.
22651
22652 @item -mwarn-mcu
22653 @itemx -mno-warn-mcu
22654 @opindex mwarn-mcu
22655 @opindex mno-warn-mcu
22656 This option enables or disables warnings about conflicts between the
22657 MCU name specified by the @option{-mmcu} option and the ISA set by the
22658 @option{-mcpu} option and/or the hardware multiply support set by the
22659 @option{-mhwmult} option. It also toggles warnings about unrecognized
22660 MCU names. This option is on by default.
22661
22662 @item -mcpu=
22663 @opindex mcpu=
22664 Specifies the ISA to use. Accepted values are @samp{msp430},
22665 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22666 @option{-mmcu=} option should be used to select the ISA.
22667
22668 @item -msim
22669 @opindex msim
22670 Link to the simulator runtime libraries and linker script. Overrides
22671 any scripts that would be selected by the @option{-mmcu=} option.
22672
22673 @item -mlarge
22674 @opindex mlarge
22675 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22676
22677 @item -msmall
22678 @opindex msmall
22679 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22680
22681 @item -mrelax
22682 @opindex mrelax
22683 This option is passed to the assembler and linker, and allows the
22684 linker to perform certain optimizations that cannot be done until
22685 the final link.
22686
22687 @item mhwmult=
22688 @opindex mhwmult=
22689 Describes the type of hardware multiply supported by the target.
22690 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22691 for the original 16-bit-only multiply supported by early MCUs.
22692 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22693 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22694 A value of @samp{auto} can also be given. This tells GCC to deduce
22695 the hardware multiply support based upon the MCU name provided by the
22696 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22697 the MCU name is not recognized then no hardware multiply support is
22698 assumed. @code{auto} is the default setting.
22699
22700 Hardware multiplies are normally performed by calling a library
22701 routine. This saves space in the generated code. When compiling at
22702 @option{-O3} or higher however the hardware multiplier is invoked
22703 inline. This makes for bigger, but faster code.
22704
22705 The hardware multiply routines disable interrupts whilst running and
22706 restore the previous interrupt state when they finish. This makes
22707 them safe to use inside interrupt handlers as well as in normal code.
22708
22709 @item -minrt
22710 @opindex minrt
22711 Enable the use of a minimum runtime environment - no static
22712 initializers or constructors. This is intended for memory-constrained
22713 devices. The compiler includes special symbols in some objects
22714 that tell the linker and runtime which code fragments are required.
22715
22716 @item -mcode-region=
22717 @itemx -mdata-region=
22718 @opindex mcode-region
22719 @opindex mdata-region
22720 These options tell the compiler where to place functions and data that
22721 do not have one of the @code{lower}, @code{upper}, @code{either} or
22722 @code{section} attributes. Possible values are @code{lower},
22723 @code{upper}, @code{either} or @code{any}. The first three behave
22724 like the corresponding attribute. The fourth possible value -
22725 @code{any} - is the default. It leaves placement entirely up to the
22726 linker script and how it assigns the standard sections
22727 (@code{.text}, @code{.data}, etc) to the memory regions.
22728
22729 @item -msilicon-errata=
22730 @opindex msilicon-errata
22731 This option passes on a request to assembler to enable the fixes for
22732 the named silicon errata.
22733
22734 @item -msilicon-errata-warn=
22735 @opindex msilicon-errata-warn
22736 This option passes on a request to the assembler to enable warning
22737 messages when a silicon errata might need to be applied.
22738
22739 @end table
22740
22741 @node NDS32 Options
22742 @subsection NDS32 Options
22743 @cindex NDS32 Options
22744
22745 These options are defined for NDS32 implementations:
22746
22747 @table @gcctabopt
22748
22749 @item -mbig-endian
22750 @opindex mbig-endian
22751 Generate code in big-endian mode.
22752
22753 @item -mlittle-endian
22754 @opindex mlittle-endian
22755 Generate code in little-endian mode.
22756
22757 @item -mreduced-regs
22758 @opindex mreduced-regs
22759 Use reduced-set registers for register allocation.
22760
22761 @item -mfull-regs
22762 @opindex mfull-regs
22763 Use full-set registers for register allocation.
22764
22765 @item -mcmov
22766 @opindex mcmov
22767 Generate conditional move instructions.
22768
22769 @item -mno-cmov
22770 @opindex mno-cmov
22771 Do not generate conditional move instructions.
22772
22773 @item -mext-perf
22774 @opindex mext-perf
22775 Generate performance extension instructions.
22776
22777 @item -mno-ext-perf
22778 @opindex mno-ext-perf
22779 Do not generate performance extension instructions.
22780
22781 @item -mext-perf2
22782 @opindex mext-perf2
22783 Generate performance extension 2 instructions.
22784
22785 @item -mno-ext-perf2
22786 @opindex mno-ext-perf2
22787 Do not generate performance extension 2 instructions.
22788
22789 @item -mext-string
22790 @opindex mext-string
22791 Generate string extension instructions.
22792
22793 @item -mno-ext-string
22794 @opindex mno-ext-string
22795 Do not generate string extension instructions.
22796
22797 @item -mv3push
22798 @opindex mv3push
22799 Generate v3 push25/pop25 instructions.
22800
22801 @item -mno-v3push
22802 @opindex mno-v3push
22803 Do not generate v3 push25/pop25 instructions.
22804
22805 @item -m16-bit
22806 @opindex m16-bit
22807 Generate 16-bit instructions.
22808
22809 @item -mno-16-bit
22810 @opindex mno-16-bit
22811 Do not generate 16-bit instructions.
22812
22813 @item -misr-vector-size=@var{num}
22814 @opindex misr-vector-size
22815 Specify the size of each interrupt vector, which must be 4 or 16.
22816
22817 @item -mcache-block-size=@var{num}
22818 @opindex mcache-block-size
22819 Specify the size of each cache block,
22820 which must be a power of 2 between 4 and 512.
22821
22822 @item -march=@var{arch}
22823 @opindex march
22824 Specify the name of the target architecture.
22825
22826 @item -mcmodel=@var{code-model}
22827 @opindex mcmodel
22828 Set the code model to one of
22829 @table @asis
22830 @item @samp{small}
22831 All the data and read-only data segments must be within 512KB addressing space.
22832 The text segment must be within 16MB addressing space.
22833 @item @samp{medium}
22834 The data segment must be within 512KB while the read-only data segment can be
22835 within 4GB addressing space. The text segment should be still within 16MB
22836 addressing space.
22837 @item @samp{large}
22838 All the text and data segments can be within 4GB addressing space.
22839 @end table
22840
22841 @item -mctor-dtor
22842 @opindex mctor-dtor
22843 Enable constructor/destructor feature.
22844
22845 @item -mrelax
22846 @opindex mrelax
22847 Guide linker to relax instructions.
22848
22849 @end table
22850
22851 @node Nios II Options
22852 @subsection Nios II Options
22853 @cindex Nios II options
22854 @cindex Altera Nios II options
22855
22856 These are the options defined for the Altera Nios II processor.
22857
22858 @table @gcctabopt
22859
22860 @item -G @var{num}
22861 @opindex G
22862 @cindex smaller data references
22863 Put global and static objects less than or equal to @var{num} bytes
22864 into the small data or BSS sections instead of the normal data or BSS
22865 sections. The default value of @var{num} is 8.
22866
22867 @item -mgpopt=@var{option}
22868 @itemx -mgpopt
22869 @itemx -mno-gpopt
22870 @opindex mgpopt
22871 @opindex mno-gpopt
22872 Generate (do not generate) GP-relative accesses. The following
22873 @var{option} names are recognized:
22874
22875 @table @samp
22876
22877 @item none
22878 Do not generate GP-relative accesses.
22879
22880 @item local
22881 Generate GP-relative accesses for small data objects that are not
22882 external, weak, or uninitialized common symbols.
22883 Also use GP-relative addressing for objects that
22884 have been explicitly placed in a small data section via a @code{section}
22885 attribute.
22886
22887 @item global
22888 As for @samp{local}, but also generate GP-relative accesses for
22889 small data objects that are external, weak, or common. If you use this option,
22890 you must ensure that all parts of your program (including libraries) are
22891 compiled with the same @option{-G} setting.
22892
22893 @item data
22894 Generate GP-relative accesses for all data objects in the program. If you
22895 use this option, the entire data and BSS segments
22896 of your program must fit in 64K of memory and you must use an appropriate
22897 linker script to allocate them within the addressable range of the
22898 global pointer.
22899
22900 @item all
22901 Generate GP-relative addresses for function pointers as well as data
22902 pointers. If you use this option, the entire text, data, and BSS segments
22903 of your program must fit in 64K of memory and you must use an appropriate
22904 linker script to allocate them within the addressable range of the
22905 global pointer.
22906
22907 @end table
22908
22909 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22910 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22911
22912 The default is @option{-mgpopt} except when @option{-fpic} or
22913 @option{-fPIC} is specified to generate position-independent code.
22914 Note that the Nios II ABI does not permit GP-relative accesses from
22915 shared libraries.
22916
22917 You may need to specify @option{-mno-gpopt} explicitly when building
22918 programs that include large amounts of small data, including large
22919 GOT data sections. In this case, the 16-bit offset for GP-relative
22920 addressing may not be large enough to allow access to the entire
22921 small data section.
22922
22923 @item -mgprel-sec=@var{regexp}
22924 @opindex mgprel-sec
22925 This option specifies additional section names that can be accessed via
22926 GP-relative addressing. It is most useful in conjunction with
22927 @code{section} attributes on variable declarations
22928 (@pxref{Common Variable Attributes}) and a custom linker script.
22929 The @var{regexp} is a POSIX Extended Regular Expression.
22930
22931 This option does not affect the behavior of the @option{-G} option, and
22932 the specified sections are in addition to the standard @code{.sdata}
22933 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22934
22935 @item -mr0rel-sec=@var{regexp}
22936 @opindex mr0rel-sec
22937 This option specifies names of sections that can be accessed via a
22938 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22939 of the 32-bit address space. It is most useful in conjunction with
22940 @code{section} attributes on variable declarations
22941 (@pxref{Common Variable Attributes}) and a custom linker script.
22942 The @var{regexp} is a POSIX Extended Regular Expression.
22943
22944 In contrast to the use of GP-relative addressing for small data,
22945 zero-based addressing is never generated by default and there are no
22946 conventional section names used in standard linker scripts for sections
22947 in the low or high areas of memory.
22948
22949 @item -mel
22950 @itemx -meb
22951 @opindex mel
22952 @opindex meb
22953 Generate little-endian (default) or big-endian (experimental) code,
22954 respectively.
22955
22956 @item -march=@var{arch}
22957 @opindex march
22958 This specifies the name of the target Nios II architecture. GCC uses this
22959 name to determine what kind of instructions it can emit when generating
22960 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22961
22962 The preprocessor macro @code{__nios2_arch__} is available to programs,
22963 with value 1 or 2, indicating the targeted ISA level.
22964
22965 @item -mbypass-cache
22966 @itemx -mno-bypass-cache
22967 @opindex mno-bypass-cache
22968 @opindex mbypass-cache
22969 Force all load and store instructions to always bypass cache by
22970 using I/O variants of the instructions. The default is not to
22971 bypass the cache.
22972
22973 @item -mno-cache-volatile
22974 @itemx -mcache-volatile
22975 @opindex mcache-volatile
22976 @opindex mno-cache-volatile
22977 Volatile memory access bypass the cache using the I/O variants of
22978 the load and store instructions. The default is not to bypass the cache.
22979
22980 @item -mno-fast-sw-div
22981 @itemx -mfast-sw-div
22982 @opindex mno-fast-sw-div
22983 @opindex mfast-sw-div
22984 Do not use table-based fast divide for small numbers. The default
22985 is to use the fast divide at @option{-O3} and above.
22986
22987 @item -mno-hw-mul
22988 @itemx -mhw-mul
22989 @itemx -mno-hw-mulx
22990 @itemx -mhw-mulx
22991 @itemx -mno-hw-div
22992 @itemx -mhw-div
22993 @opindex mno-hw-mul
22994 @opindex mhw-mul
22995 @opindex mno-hw-mulx
22996 @opindex mhw-mulx
22997 @opindex mno-hw-div
22998 @opindex mhw-div
22999 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23000 instructions by the compiler. The default is to emit @code{mul}
23001 and not emit @code{div} and @code{mulx}.
23002
23003 @item -mbmx
23004 @itemx -mno-bmx
23005 @itemx -mcdx
23006 @itemx -mno-cdx
23007 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23008 CDX (code density) instructions. Enabling these instructions also
23009 requires @option{-march=r2}. Since these instructions are optional
23010 extensions to the R2 architecture, the default is not to emit them.
23011
23012 @item -mcustom-@var{insn}=@var{N}
23013 @itemx -mno-custom-@var{insn}
23014 @opindex mcustom-@var{insn}
23015 @opindex mno-custom-@var{insn}
23016 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23017 custom instruction with encoding @var{N} when generating code that uses
23018 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23019 instruction 253 for single-precision floating-point add operations instead
23020 of the default behavior of using a library call.
23021
23022 The following values of @var{insn} are supported. Except as otherwise
23023 noted, floating-point operations are expected to be implemented with
23024 normal IEEE 754 semantics and correspond directly to the C operators or the
23025 equivalent GCC built-in functions (@pxref{Other Builtins}).
23026
23027 Single-precision floating point:
23028 @table @asis
23029
23030 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23031 Binary arithmetic operations.
23032
23033 @item @samp{fnegs}
23034 Unary negation.
23035
23036 @item @samp{fabss}
23037 Unary absolute value.
23038
23039 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23040 Comparison operations.
23041
23042 @item @samp{fmins}, @samp{fmaxs}
23043 Floating-point minimum and maximum. These instructions are only
23044 generated if @option{-ffinite-math-only} is specified.
23045
23046 @item @samp{fsqrts}
23047 Unary square root operation.
23048
23049 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23050 Floating-point trigonometric and exponential functions. These instructions
23051 are only generated if @option{-funsafe-math-optimizations} is also specified.
23052
23053 @end table
23054
23055 Double-precision floating point:
23056 @table @asis
23057
23058 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23059 Binary arithmetic operations.
23060
23061 @item @samp{fnegd}
23062 Unary negation.
23063
23064 @item @samp{fabsd}
23065 Unary absolute value.
23066
23067 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23068 Comparison operations.
23069
23070 @item @samp{fmind}, @samp{fmaxd}
23071 Double-precision minimum and maximum. These instructions are only
23072 generated if @option{-ffinite-math-only} is specified.
23073
23074 @item @samp{fsqrtd}
23075 Unary square root operation.
23076
23077 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23078 Double-precision trigonometric and exponential functions. These instructions
23079 are only generated if @option{-funsafe-math-optimizations} is also specified.
23080
23081 @end table
23082
23083 Conversions:
23084 @table @asis
23085 @item @samp{fextsd}
23086 Conversion from single precision to double precision.
23087
23088 @item @samp{ftruncds}
23089 Conversion from double precision to single precision.
23090
23091 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23092 Conversion from floating point to signed or unsigned integer types, with
23093 truncation towards zero.
23094
23095 @item @samp{round}
23096 Conversion from single-precision floating point to signed integer,
23097 rounding to the nearest integer and ties away from zero.
23098 This corresponds to the @code{__builtin_lroundf} function when
23099 @option{-fno-math-errno} is used.
23100
23101 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23102 Conversion from signed or unsigned integer types to floating-point types.
23103
23104 @end table
23105
23106 In addition, all of the following transfer instructions for internal
23107 registers X and Y must be provided to use any of the double-precision
23108 floating-point instructions. Custom instructions taking two
23109 double-precision source operands expect the first operand in the
23110 64-bit register X. The other operand (or only operand of a unary
23111 operation) is given to the custom arithmetic instruction with the
23112 least significant half in source register @var{src1} and the most
23113 significant half in @var{src2}. A custom instruction that returns a
23114 double-precision result returns the most significant 32 bits in the
23115 destination register and the other half in 32-bit register Y.
23116 GCC automatically generates the necessary code sequences to write
23117 register X and/or read register Y when double-precision floating-point
23118 instructions are used.
23119
23120 @table @asis
23121
23122 @item @samp{fwrx}
23123 Write @var{src1} into the least significant half of X and @var{src2} into
23124 the most significant half of X.
23125
23126 @item @samp{fwry}
23127 Write @var{src1} into Y.
23128
23129 @item @samp{frdxhi}, @samp{frdxlo}
23130 Read the most or least (respectively) significant half of X and store it in
23131 @var{dest}.
23132
23133 @item @samp{frdy}
23134 Read the value of Y and store it into @var{dest}.
23135 @end table
23136
23137 Note that you can gain more local control over generation of Nios II custom
23138 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23139 and @code{target("no-custom-@var{insn}")} function attributes
23140 (@pxref{Function Attributes})
23141 or pragmas (@pxref{Function Specific Option Pragmas}).
23142
23143 @item -mcustom-fpu-cfg=@var{name}
23144 @opindex mcustom-fpu-cfg
23145
23146 This option enables a predefined, named set of custom instruction encodings
23147 (see @option{-mcustom-@var{insn}} above).
23148 Currently, the following sets are defined:
23149
23150 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23151 @gccoptlist{-mcustom-fmuls=252 @gol
23152 -mcustom-fadds=253 @gol
23153 -mcustom-fsubs=254 @gol
23154 -fsingle-precision-constant}
23155
23156 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23157 @gccoptlist{-mcustom-fmuls=252 @gol
23158 -mcustom-fadds=253 @gol
23159 -mcustom-fsubs=254 @gol
23160 -mcustom-fdivs=255 @gol
23161 -fsingle-precision-constant}
23162
23163 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23164 @gccoptlist{-mcustom-floatus=243 @gol
23165 -mcustom-fixsi=244 @gol
23166 -mcustom-floatis=245 @gol
23167 -mcustom-fcmpgts=246 @gol
23168 -mcustom-fcmples=249 @gol
23169 -mcustom-fcmpeqs=250 @gol
23170 -mcustom-fcmpnes=251 @gol
23171 -mcustom-fmuls=252 @gol
23172 -mcustom-fadds=253 @gol
23173 -mcustom-fsubs=254 @gol
23174 -mcustom-fdivs=255 @gol
23175 -fsingle-precision-constant}
23176
23177 Custom instruction assignments given by individual
23178 @option{-mcustom-@var{insn}=} options override those given by
23179 @option{-mcustom-fpu-cfg=}, regardless of the
23180 order of the options on the command line.
23181
23182 Note that you can gain more local control over selection of a FPU
23183 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23184 function attribute (@pxref{Function Attributes})
23185 or pragma (@pxref{Function Specific Option Pragmas}).
23186
23187 @end table
23188
23189 These additional @samp{-m} options are available for the Altera Nios II
23190 ELF (bare-metal) target:
23191
23192 @table @gcctabopt
23193
23194 @item -mhal
23195 @opindex mhal
23196 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23197 startup and termination code, and is typically used in conjunction with
23198 @option{-msys-crt0=} to specify the location of the alternate startup code
23199 provided by the HAL BSP.
23200
23201 @item -msmallc
23202 @opindex msmallc
23203 Link with a limited version of the C library, @option{-lsmallc}, rather than
23204 Newlib.
23205
23206 @item -msys-crt0=@var{startfile}
23207 @opindex msys-crt0
23208 @var{startfile} is the file name of the startfile (crt0) to use
23209 when linking. This option is only useful in conjunction with @option{-mhal}.
23210
23211 @item -msys-lib=@var{systemlib}
23212 @opindex msys-lib
23213 @var{systemlib} is the library name of the library that provides
23214 low-level system calls required by the C library,
23215 e.g.@: @code{read} and @code{write}.
23216 This option is typically used to link with a library provided by a HAL BSP.
23217
23218 @end table
23219
23220 @node Nvidia PTX Options
23221 @subsection Nvidia PTX Options
23222 @cindex Nvidia PTX options
23223 @cindex nvptx options
23224
23225 These options are defined for Nvidia PTX:
23226
23227 @table @gcctabopt
23228
23229 @item -m32
23230 @itemx -m64
23231 @opindex m32
23232 @opindex m64
23233 Generate code for 32-bit or 64-bit ABI.
23234
23235 @item -misa=@var{ISA-string}
23236 @opindex march
23237 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23238 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23239 @samp{sm_35}. The default ISA is sm_30.
23240
23241 @item -mmainkernel
23242 @opindex mmainkernel
23243 Link in code for a __main kernel. This is for stand-alone instead of
23244 offloading execution.
23245
23246 @item -moptimize
23247 @opindex moptimize
23248 Apply partitioned execution optimizations. This is the default when any
23249 level of optimization is selected.
23250
23251 @item -msoft-stack
23252 @opindex msoft-stack
23253 Generate code that does not use @code{.local} memory
23254 directly for stack storage. Instead, a per-warp stack pointer is
23255 maintained explicitly. This enables variable-length stack allocation (with
23256 variable-length arrays or @code{alloca}), and when global memory is used for
23257 underlying storage, makes it possible to access automatic variables from other
23258 threads, or with atomic instructions. This code generation variant is used
23259 for OpenMP offloading, but the option is exposed on its own for the purpose
23260 of testing the compiler; to generate code suitable for linking into programs
23261 using OpenMP offloading, use option @option{-mgomp}.
23262
23263 @item -muniform-simt
23264 @opindex muniform-simt
23265 Switch to code generation variant that allows to execute all threads in each
23266 warp, while maintaining memory state and side effects as if only one thread
23267 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23268 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23269 current lane index equals the master lane index), and the register being
23270 assigned is copied via a shuffle instruction from the master lane. Outside of
23271 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23272 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23273 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23274 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23275 with current lane index to compute the master lane index.
23276
23277 @item -mgomp
23278 @opindex mgomp
23279 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23280 @option{-muniform-simt} options, and selects corresponding multilib variant.
23281
23282 @end table
23283
23284 @node OpenRISC Options
23285 @subsection OpenRISC Options
23286 @cindex OpenRISC Options
23287
23288 These options are defined for OpenRISC:
23289
23290 @table @gcctabopt
23291
23292 @item -mboard=@var{name}
23293 @opindex mboard
23294 Configure a board specific runtime. This will be passed to the linker for
23295 newlib board library linking. The default is @code{or1ksim}.
23296
23297 @item -mnewlib
23298 @opindex mnewlib
23299 For compatibility, it's always newlib for elf now.
23300
23301 @item -mhard-div
23302 @opindex mhard-div
23303 Generate code for hardware which supports divide instructions. This is the
23304 default.
23305
23306 @item -mhard-mul
23307 @opindex mhard-mul
23308 Generate code for hardware which supports multiply instructions. This is the
23309 default.
23310
23311 @item -mcmov
23312 @opindex mcmov
23313 Generate code for hardware which supports the conditional move (@code{l.cmov})
23314 instruction.
23315
23316 @item -mror
23317 @opindex mror
23318 Generate code for hardware which supports rotate right instructions.
23319
23320 @item -msext
23321 @opindex msext
23322 Generate code for hardware which supports sign-extension instructions.
23323
23324 @item -msfimm
23325 @opindex msfimm
23326 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23327 instructions.
23328
23329 @item -mshftimm
23330 @opindex mshftimm
23331 Generate code for hardware which supports shift immediate related instructions
23332 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23333 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23334 also be specified.
23335
23336 @item -msoft-div
23337 @opindex msoft-div
23338 Generate code for hardware which requires divide instruction emulation.
23339
23340 @item -msoft-mul
23341 @opindex msoft-mul
23342 Generate code for hardware which requires multiply instruction emulation.
23343
23344 @end table
23345
23346 @node PDP-11 Options
23347 @subsection PDP-11 Options
23348 @cindex PDP-11 Options
23349
23350 These options are defined for the PDP-11:
23351
23352 @table @gcctabopt
23353 @item -mfpu
23354 @opindex mfpu
23355 Use hardware FPP floating point. This is the default. (FIS floating
23356 point on the PDP-11/40 is not supported.) Implies -m45.
23357
23358 @item -msoft-float
23359 @opindex msoft-float
23360 Do not use hardware floating point.
23361
23362 @item -mac0
23363 @opindex mac0
23364 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23365
23366 @item -mno-ac0
23367 @opindex mno-ac0
23368 Return floating-point results in memory. This is the default.
23369
23370 @item -m40
23371 @opindex m40
23372 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23373
23374 @item -m45
23375 @opindex m45
23376 Generate code for a PDP-11/45. This is the default.
23377
23378 @item -m10
23379 @opindex m10
23380 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23381
23382 @item -mint16
23383 @itemx -mno-int32
23384 @opindex mint16
23385 @opindex mno-int32
23386 Use 16-bit @code{int}. This is the default.
23387
23388 @item -mint32
23389 @itemx -mno-int16
23390 @opindex mint32
23391 @opindex mno-int16
23392 Use 32-bit @code{int}.
23393
23394 @item -msplit
23395 @opindex msplit
23396 Target has split instruction and data space. Implies -m45.
23397
23398 @item -munix-asm
23399 @opindex munix-asm
23400 Use Unix assembler syntax.
23401
23402 @item -mdec-asm
23403 @opindex mdec-asm
23404 Use DEC assembler syntax.
23405
23406 @item -mgnu-asm
23407 @opindex mgnu-asm
23408 Use GNU assembler syntax. This is the default.
23409
23410 @item -mlra
23411 @opindex mlra
23412 Use the new LRA register allocator. By default, the old ``reload''
23413 allocator is used.
23414 @end table
23415
23416 @node picoChip Options
23417 @subsection picoChip Options
23418 @cindex picoChip options
23419
23420 These @samp{-m} options are defined for picoChip implementations:
23421
23422 @table @gcctabopt
23423
23424 @item -mae=@var{ae_type}
23425 @opindex mcpu
23426 Set the instruction set, register set, and instruction scheduling
23427 parameters for array element type @var{ae_type}. Supported values
23428 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23429
23430 @option{-mae=ANY} selects a completely generic AE type. Code
23431 generated with this option runs on any of the other AE types. The
23432 code is not as efficient as it would be if compiled for a specific
23433 AE type, and some types of operation (e.g., multiplication) do not
23434 work properly on all types of AE.
23435
23436 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23437 for compiled code, and is the default.
23438
23439 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23440 option may suffer from poor performance of byte (char) manipulation,
23441 since the DSP AE does not provide hardware support for byte load/stores.
23442
23443 @item -msymbol-as-address
23444 Enable the compiler to directly use a symbol name as an address in a
23445 load/store instruction, without first loading it into a
23446 register. Typically, the use of this option generates larger
23447 programs, which run faster than when the option isn't used. However, the
23448 results vary from program to program, so it is left as a user option,
23449 rather than being permanently enabled.
23450
23451 @item -mno-inefficient-warnings
23452 Disables warnings about the generation of inefficient code. These
23453 warnings can be generated, for example, when compiling code that
23454 performs byte-level memory operations on the MAC AE type. The MAC AE has
23455 no hardware support for byte-level memory operations, so all byte
23456 load/stores must be synthesized from word load/store operations. This is
23457 inefficient and a warning is generated to indicate
23458 that you should rewrite the code to avoid byte operations, or to target
23459 an AE type that has the necessary hardware support. This option disables
23460 these warnings.
23461
23462 @end table
23463
23464 @node PowerPC Options
23465 @subsection PowerPC Options
23466 @cindex PowerPC options
23467
23468 These are listed under @xref{RS/6000 and PowerPC Options}.
23469
23470 @node RISC-V Options
23471 @subsection RISC-V Options
23472 @cindex RISC-V Options
23473
23474 These command-line options are defined for RISC-V targets:
23475
23476 @table @gcctabopt
23477 @item -mbranch-cost=@var{n}
23478 @opindex mbranch-cost
23479 Set the cost of branches to roughly @var{n} instructions.
23480
23481 @item -mplt
23482 @itemx -mno-plt
23483 @opindex plt
23484 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23485 non-PIC. The default is @option{-mplt}.
23486
23487 @item -mabi=@var{ABI-string}
23488 @opindex mabi
23489 Specify integer and floating-point calling convention. @var{ABI-string}
23490 contains two parts: the size of integer types and the registers used for
23491 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23492 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23493 32-bit), and that floating-point values up to 64 bits wide are passed in F
23494 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23495 allows the compiler to generate code that uses the F and D extensions but only
23496 allows floating-point values up to 32 bits long to be passed in registers; or
23497 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23498 passed in registers.
23499
23500 The default for this argument is system dependent, users who want a specific
23501 calling convention should specify one explicitly. The valid calling
23502 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23503 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23504 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23505 invalid because the ABI requires 64-bit values be passed in F registers, but F
23506 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23507 only be used with the @samp{rv32e} architecture. This ABI is not well
23508 specified at present, and is subject to change.
23509
23510 @item -mfdiv
23511 @itemx -mno-fdiv
23512 @opindex mfdiv
23513 Do or don't use hardware floating-point divide and square root instructions.
23514 This requires the F or D extensions for floating-point registers. The default
23515 is to use them if the specified architecture has these instructions.
23516
23517 @item -mdiv
23518 @itemx -mno-div
23519 @opindex mdiv
23520 Do or don't use hardware instructions for integer division. This requires the
23521 M extension. The default is to use them if the specified architecture has
23522 these instructions.
23523
23524 @item -march=@var{ISA-string}
23525 @opindex march
23526 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23527 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23528 @samp{rv32imaf}.
23529
23530 @item -mtune=@var{processor-string}
23531 @opindex mtune
23532 Optimize the output for the given processor, specified by microarchitecture
23533 name.
23534
23535 @item -mpreferred-stack-boundary=@var{num}
23536 @opindex mpreferred-stack-boundary
23537 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23538 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23539 the default is 4 (16 bytes or 128-bits).
23540
23541 @strong{Warning:} If you use this switch, then you must build all modules with
23542 the same value, including any libraries. This includes the system libraries
23543 and startup modules.
23544
23545 @item -msmall-data-limit=@var{n}
23546 @opindex msmall-data-limit
23547 Put global and static data smaller than @var{n} bytes into a special section
23548 (on some targets).
23549
23550 @item -msave-restore
23551 @itemx -mno-save-restore
23552 @opindex msave-restore
23553 Do or don't use smaller but slower prologue and epilogue code that uses
23554 library function calls. The default is to use fast inline prologues and
23555 epilogues.
23556
23557 @item -mstrict-align
23558 @itemx -mno-strict-align
23559 @opindex mstrict-align
23560 Do not or do generate unaligned memory accesses. The default is set depending
23561 on whether the processor we are optimizing for supports fast unaligned access
23562 or not.
23563
23564 @item -mcmodel=medlow
23565 @opindex mcmodel=medlow
23566 Generate code for the medium-low code model. The program and its statically
23567 defined symbols must lie within a single 2 GiB address range and must lie
23568 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23569 statically or dynamically linked. This is the default code model.
23570
23571 @item -mcmodel=medany
23572 @opindex mcmodel=medany
23573 Generate code for the medium-any code model. The program and its statically
23574 defined symbols must be within any single 2 GiB address range. Programs can be
23575 statically or dynamically linked.
23576
23577 @item -mexplicit-relocs
23578 @itemx -mno-exlicit-relocs
23579 Use or do not use assembler relocation operators when dealing with symbolic
23580 addresses. The alternative is to use assembler macros instead, which may
23581 limit optimization.
23582
23583 @item -mrelax
23584 @itemx -mno-relax
23585 Take advantage of linker relaxations to reduce the number of instructions
23586 required to materialize symbol addresses. The default is to take advantage of
23587 linker relaxations.
23588
23589 @end table
23590
23591 @node RL78 Options
23592 @subsection RL78 Options
23593 @cindex RL78 Options
23594
23595 @table @gcctabopt
23596
23597 @item -msim
23598 @opindex msim
23599 Links in additional target libraries to support operation within a
23600 simulator.
23601
23602 @item -mmul=none
23603 @itemx -mmul=g10
23604 @itemx -mmul=g13
23605 @itemx -mmul=g14
23606 @itemx -mmul=rl78
23607 @opindex mmul
23608 Specifies the type of hardware multiplication and division support to
23609 be used. The simplest is @code{none}, which uses software for both
23610 multiplication and division. This is the default. The @code{g13}
23611 value is for the hardware multiply/divide peripheral found on the
23612 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23613 the multiplication and division instructions supported by the RL78/G14
23614 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23615 the value @code{mg10} is an alias for @code{none}.
23616
23617 In addition a C preprocessor macro is defined, based upon the setting
23618 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23619 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23620
23621 @item -mcpu=g10
23622 @itemx -mcpu=g13
23623 @itemx -mcpu=g14
23624 @itemx -mcpu=rl78
23625 @opindex mcpu
23626 Specifies the RL78 core to target. The default is the G14 core, also
23627 known as an S3 core or just RL78. The G13 or S2 core does not have
23628 multiply or divide instructions, instead it uses a hardware peripheral
23629 for these operations. The G10 or S1 core does not have register
23630 banks, so it uses a different calling convention.
23631
23632 If this option is set it also selects the type of hardware multiply
23633 support to use, unless this is overridden by an explicit
23634 @option{-mmul=none} option on the command line. Thus specifying
23635 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23636 peripheral and specifying @option{-mcpu=g10} disables the use of
23637 hardware multiplications altogether.
23638
23639 Note, although the RL78/G14 core is the default target, specifying
23640 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23641 change the behavior of the toolchain since it also enables G14
23642 hardware multiply support. If these options are not specified on the
23643 command line then software multiplication routines will be used even
23644 though the code targets the RL78 core. This is for backwards
23645 compatibility with older toolchains which did not have hardware
23646 multiply and divide support.
23647
23648 In addition a C preprocessor macro is defined, based upon the setting
23649 of this option. Possible values are: @code{__RL78_G10__},
23650 @code{__RL78_G13__} or @code{__RL78_G14__}.
23651
23652 @item -mg10
23653 @itemx -mg13
23654 @itemx -mg14
23655 @itemx -mrl78
23656 @opindex mg10
23657 @opindex mg13
23658 @opindex mg14
23659 @opindex mrl78
23660 These are aliases for the corresponding @option{-mcpu=} option. They
23661 are provided for backwards compatibility.
23662
23663 @item -mallregs
23664 @opindex mallregs
23665 Allow the compiler to use all of the available registers. By default
23666 registers @code{r24..r31} are reserved for use in interrupt handlers.
23667 With this option enabled these registers can be used in ordinary
23668 functions as well.
23669
23670 @item -m64bit-doubles
23671 @itemx -m32bit-doubles
23672 @opindex m64bit-doubles
23673 @opindex m32bit-doubles
23674 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23675 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23676 @option{-m32bit-doubles}.
23677
23678 @item -msave-mduc-in-interrupts
23679 @itemx -mno-save-mduc-in-interrupts
23680 @opindex msave-mduc-in-interrupts
23681 @opindex mno-save-mduc-in-interrupts
23682 Specifies that interrupt handler functions should preserve the
23683 MDUC registers. This is only necessary if normal code might use
23684 the MDUC registers, for example because it performs multiplication
23685 and division operations. The default is to ignore the MDUC registers
23686 as this makes the interrupt handlers faster. The target option -mg13
23687 needs to be passed for this to work as this feature is only available
23688 on the G13 target (S2 core). The MDUC registers will only be saved
23689 if the interrupt handler performs a multiplication or division
23690 operation or it calls another function.
23691
23692 @end table
23693
23694 @node RS/6000 and PowerPC Options
23695 @subsection IBM RS/6000 and PowerPC Options
23696 @cindex RS/6000 and PowerPC Options
23697 @cindex IBM RS/6000 and PowerPC Options
23698
23699 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23700 @table @gcctabopt
23701 @item -mpowerpc-gpopt
23702 @itemx -mno-powerpc-gpopt
23703 @itemx -mpowerpc-gfxopt
23704 @itemx -mno-powerpc-gfxopt
23705 @need 800
23706 @itemx -mpowerpc64
23707 @itemx -mno-powerpc64
23708 @itemx -mmfcrf
23709 @itemx -mno-mfcrf
23710 @itemx -mpopcntb
23711 @itemx -mno-popcntb
23712 @itemx -mpopcntd
23713 @itemx -mno-popcntd
23714 @itemx -mfprnd
23715 @itemx -mno-fprnd
23716 @need 800
23717 @itemx -mcmpb
23718 @itemx -mno-cmpb
23719 @itemx -mmfpgpr
23720 @itemx -mno-mfpgpr
23721 @itemx -mhard-dfp
23722 @itemx -mno-hard-dfp
23723 @opindex mpowerpc-gpopt
23724 @opindex mno-powerpc-gpopt
23725 @opindex mpowerpc-gfxopt
23726 @opindex mno-powerpc-gfxopt
23727 @opindex mpowerpc64
23728 @opindex mno-powerpc64
23729 @opindex mmfcrf
23730 @opindex mno-mfcrf
23731 @opindex mpopcntb
23732 @opindex mno-popcntb
23733 @opindex mpopcntd
23734 @opindex mno-popcntd
23735 @opindex mfprnd
23736 @opindex mno-fprnd
23737 @opindex mcmpb
23738 @opindex mno-cmpb
23739 @opindex mmfpgpr
23740 @opindex mno-mfpgpr
23741 @opindex mhard-dfp
23742 @opindex mno-hard-dfp
23743 You use these options to specify which instructions are available on the
23744 processor you are using. The default value of these options is
23745 determined when configuring GCC@. Specifying the
23746 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23747 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23748 rather than the options listed above.
23749
23750 Specifying @option{-mpowerpc-gpopt} allows
23751 GCC to use the optional PowerPC architecture instructions in the
23752 General Purpose group, including floating-point square root. Specifying
23753 @option{-mpowerpc-gfxopt} allows GCC to
23754 use the optional PowerPC architecture instructions in the Graphics
23755 group, including floating-point select.
23756
23757 The @option{-mmfcrf} option allows GCC to generate the move from
23758 condition register field instruction implemented on the POWER4
23759 processor and other processors that support the PowerPC V2.01
23760 architecture.
23761 The @option{-mpopcntb} option allows GCC to generate the popcount and
23762 double-precision FP reciprocal estimate instruction implemented on the
23763 POWER5 processor and other processors that support the PowerPC V2.02
23764 architecture.
23765 The @option{-mpopcntd} option allows GCC to generate the popcount
23766 instruction implemented on the POWER7 processor and other processors
23767 that support the PowerPC V2.06 architecture.
23768 The @option{-mfprnd} option allows GCC to generate the FP round to
23769 integer instructions implemented on the POWER5+ processor and other
23770 processors that support the PowerPC V2.03 architecture.
23771 The @option{-mcmpb} option allows GCC to generate the compare bytes
23772 instruction implemented on the POWER6 processor and other processors
23773 that support the PowerPC V2.05 architecture.
23774 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23775 general-purpose register instructions implemented on the POWER6X
23776 processor and other processors that support the extended PowerPC V2.05
23777 architecture.
23778 The @option{-mhard-dfp} option allows GCC to generate the decimal
23779 floating-point instructions implemented on some POWER processors.
23780
23781 The @option{-mpowerpc64} option allows GCC to generate the additional
23782 64-bit instructions that are found in the full PowerPC64 architecture
23783 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23784 @option{-mno-powerpc64}.
23785
23786 @item -mcpu=@var{cpu_type}
23787 @opindex mcpu
23788 Set architecture type, register usage, and
23789 instruction scheduling parameters for machine type @var{cpu_type}.
23790 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23791 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23792 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23793 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23794 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23795 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23796 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23797 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23798 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23799 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23800 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23801 @samp{rs64}, and @samp{native}.
23802
23803 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23804 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23805 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23806 architecture machine types, with an appropriate, generic processor
23807 model assumed for scheduling purposes.
23808
23809 Specifying @samp{native} as cpu type detects and selects the
23810 architecture option that corresponds to the host processor of the
23811 system performing the compilation.
23812 @option{-mcpu=native} has no effect if GCC does not recognize the
23813 processor.
23814
23815 The other options specify a specific processor. Code generated under
23816 those options runs best on that processor, and may not run at all on
23817 others.
23818
23819 The @option{-mcpu} options automatically enable or disable the
23820 following options:
23821
23822 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23823 -mpopcntb -mpopcntd -mpowerpc64 @gol
23824 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23825 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23826 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23827 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23828
23829 The particular options set for any particular CPU varies between
23830 compiler versions, depending on what setting seems to produce optimal
23831 code for that CPU; it doesn't necessarily reflect the actual hardware's
23832 capabilities. If you wish to set an individual option to a particular
23833 value, you may specify it after the @option{-mcpu} option, like
23834 @option{-mcpu=970 -mno-altivec}.
23835
23836 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23837 not enabled or disabled by the @option{-mcpu} option at present because
23838 AIX does not have full support for these options. You may still
23839 enable or disable them individually if you're sure it'll work in your
23840 environment.
23841
23842 @item -mtune=@var{cpu_type}
23843 @opindex mtune
23844 Set the instruction scheduling parameters for machine type
23845 @var{cpu_type}, but do not set the architecture type or register usage,
23846 as @option{-mcpu=@var{cpu_type}} does. The same
23847 values for @var{cpu_type} are used for @option{-mtune} as for
23848 @option{-mcpu}. If both are specified, the code generated uses the
23849 architecture and registers set by @option{-mcpu}, but the
23850 scheduling parameters set by @option{-mtune}.
23851
23852 @item -mcmodel=small
23853 @opindex mcmodel=small
23854 Generate PowerPC64 code for the small model: The TOC is limited to
23855 64k.
23856
23857 @item -mcmodel=medium
23858 @opindex mcmodel=medium
23859 Generate PowerPC64 code for the medium model: The TOC and other static
23860 data may be up to a total of 4G in size. This is the default for 64-bit
23861 Linux.
23862
23863 @item -mcmodel=large
23864 @opindex mcmodel=large
23865 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23866 in size. Other data and code is only limited by the 64-bit address
23867 space.
23868
23869 @item -maltivec
23870 @itemx -mno-altivec
23871 @opindex maltivec
23872 @opindex mno-altivec
23873 Generate code that uses (does not use) AltiVec instructions, and also
23874 enable the use of built-in functions that allow more direct access to
23875 the AltiVec instruction set. You may also need to set
23876 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23877 enhancements.
23878
23879 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23880 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23881 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23882 match array element order corresponding to the endianness of the
23883 target. That is, element zero identifies the leftmost element in a
23884 vector register when targeting a big-endian platform, and identifies
23885 the rightmost element in a vector register when targeting a
23886 little-endian platform.
23887
23888 @item -maltivec=be
23889 @opindex maltivec=be
23890 Generate AltiVec instructions using big-endian element order,
23891 regardless of whether the target is big- or little-endian. This is
23892 the default when targeting a big-endian platform. Using this option
23893 is currently deprecated. Support for this feature will be removed in
23894 GCC 9.
23895
23896 The element order is used to interpret element numbers in AltiVec
23897 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23898 @code{vec_insert}. By default, these match array element order
23899 corresponding to the endianness for the target.
23900
23901 @item -maltivec=le
23902 @opindex maltivec=le
23903 Generate AltiVec instructions using little-endian element order,
23904 regardless of whether the target is big- or little-endian. This is
23905 the default when targeting a little-endian platform. This option is
23906 currently ignored when targeting a big-endian platform.
23907
23908 The element order is used to interpret element numbers in AltiVec
23909 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23910 @code{vec_insert}. By default, these match array element order
23911 corresponding to the endianness for the target.
23912
23913 @item -mvrsave
23914 @itemx -mno-vrsave
23915 @opindex mvrsave
23916 @opindex mno-vrsave
23917 Generate VRSAVE instructions when generating AltiVec code.
23918
23919 @item -msecure-plt
23920 @opindex msecure-plt
23921 Generate code that allows @command{ld} and @command{ld.so}
23922 to build executables and shared
23923 libraries with non-executable @code{.plt} and @code{.got} sections.
23924 This is a PowerPC
23925 32-bit SYSV ABI option.
23926
23927 @item -mbss-plt
23928 @opindex mbss-plt
23929 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23930 fills in, and
23931 requires @code{.plt} and @code{.got}
23932 sections that are both writable and executable.
23933 This is a PowerPC 32-bit SYSV ABI option.
23934
23935 @item -misel
23936 @itemx -mno-isel
23937 @opindex misel
23938 @opindex mno-isel
23939 This switch enables or disables the generation of ISEL instructions.
23940
23941 @item -mvsx
23942 @itemx -mno-vsx
23943 @opindex mvsx
23944 @opindex mno-vsx
23945 Generate code that uses (does not use) vector/scalar (VSX)
23946 instructions, and also enable the use of built-in functions that allow
23947 more direct access to the VSX instruction set.
23948
23949 @item -mcrypto
23950 @itemx -mno-crypto
23951 @opindex mcrypto
23952 @opindex mno-crypto
23953 Enable the use (disable) of the built-in functions that allow direct
23954 access to the cryptographic instructions that were added in version
23955 2.07 of the PowerPC ISA.
23956
23957 @item -mhtm
23958 @itemx -mno-htm
23959 @opindex mhtm
23960 @opindex mno-htm
23961 Enable (disable) the use of the built-in functions that allow direct
23962 access to the Hardware Transactional Memory (HTM) instructions that
23963 were added in version 2.07 of the PowerPC ISA.
23964
23965 @item -mpower8-fusion
23966 @itemx -mno-power8-fusion
23967 @opindex mpower8-fusion
23968 @opindex mno-power8-fusion
23969 Generate code that keeps (does not keeps) some integer operations
23970 adjacent so that the instructions can be fused together on power8 and
23971 later processors.
23972
23973 @item -mpower8-vector
23974 @itemx -mno-power8-vector
23975 @opindex mpower8-vector
23976 @opindex mno-power8-vector
23977 Generate code that uses (does not use) the vector and scalar
23978 instructions that were added in version 2.07 of the PowerPC ISA. Also
23979 enable the use of built-in functions that allow more direct access to
23980 the vector instructions.
23981
23982 @item -mquad-memory
23983 @itemx -mno-quad-memory
23984 @opindex mquad-memory
23985 @opindex mno-quad-memory
23986 Generate code that uses (does not use) the non-atomic quad word memory
23987 instructions. The @option{-mquad-memory} option requires use of
23988 64-bit mode.
23989
23990 @item -mquad-memory-atomic
23991 @itemx -mno-quad-memory-atomic
23992 @opindex mquad-memory-atomic
23993 @opindex mno-quad-memory-atomic
23994 Generate code that uses (does not use) the atomic quad word memory
23995 instructions. The @option{-mquad-memory-atomic} option requires use of
23996 64-bit mode.
23997
23998 @item -mfloat128
23999 @itemx -mno-float128
24000 @opindex mfloat128
24001 @opindex mno-float128
24002 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24003 and use either software emulation for IEEE 128-bit floating point or
24004 hardware instructions.
24005
24006 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24007 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24008 use the IEEE 128-bit floating point support. The IEEE 128-bit
24009 floating point support only works on PowerPC Linux systems.
24010
24011 The default for @option{-mfloat128} is enabled on PowerPC Linux
24012 systems using the VSX instruction set, and disabled on other systems.
24013
24014 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24015 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24016 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24017 floating point instructions. Otherwise, if you do not specify to
24018 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24019 system, IEEE 128-bit floating point will be done with software
24020 emulation.
24021
24022 @item -mfloat128-hardware
24023 @itemx -mno-float128-hardware
24024 @opindex mfloat128-hardware
24025 @opindex mno-float128-hardware
24026 Enable/disable using ISA 3.0 hardware instructions to support the
24027 @var{__float128} data type.
24028
24029 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24030 Linux systems using the ISA 3.0 instruction set, and disabled on other
24031 systems.
24032
24033 @item -m32
24034 @itemx -m64
24035 @opindex m32
24036 @opindex m64
24037 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24038 targets (including GNU/Linux). The 32-bit environment sets int, long
24039 and pointer to 32 bits and generates code that runs on any PowerPC
24040 variant. The 64-bit environment sets int to 32 bits and long and
24041 pointer to 64 bits, and generates code for PowerPC64, as for
24042 @option{-mpowerpc64}.
24043
24044 @item -mfull-toc
24045 @itemx -mno-fp-in-toc
24046 @itemx -mno-sum-in-toc
24047 @itemx -mminimal-toc
24048 @opindex mfull-toc
24049 @opindex mno-fp-in-toc
24050 @opindex mno-sum-in-toc
24051 @opindex mminimal-toc
24052 Modify generation of the TOC (Table Of Contents), which is created for
24053 every executable file. The @option{-mfull-toc} option is selected by
24054 default. In that case, GCC allocates at least one TOC entry for
24055 each unique non-automatic variable reference in your program. GCC
24056 also places floating-point constants in the TOC@. However, only
24057 16,384 entries are available in the TOC@.
24058
24059 If you receive a linker error message that saying you have overflowed
24060 the available TOC space, you can reduce the amount of TOC space used
24061 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24062 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24063 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24064 generate code to calculate the sum of an address and a constant at
24065 run time instead of putting that sum into the TOC@. You may specify one
24066 or both of these options. Each causes GCC to produce very slightly
24067 slower and larger code at the expense of conserving TOC space.
24068
24069 If you still run out of space in the TOC even when you specify both of
24070 these options, specify @option{-mminimal-toc} instead. This option causes
24071 GCC to make only one TOC entry for every file. When you specify this
24072 option, GCC produces code that is slower and larger but which
24073 uses extremely little TOC space. You may wish to use this option
24074 only on files that contain less frequently-executed code.
24075
24076 @item -maix64
24077 @itemx -maix32
24078 @opindex maix64
24079 @opindex maix32
24080 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24081 @code{long} type, and the infrastructure needed to support them.
24082 Specifying @option{-maix64} implies @option{-mpowerpc64},
24083 while @option{-maix32} disables the 64-bit ABI and
24084 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24085
24086 @item -mxl-compat
24087 @itemx -mno-xl-compat
24088 @opindex mxl-compat
24089 @opindex mno-xl-compat
24090 Produce code that conforms more closely to IBM XL compiler semantics
24091 when using AIX-compatible ABI@. Pass floating-point arguments to
24092 prototyped functions beyond the register save area (RSA) on the stack
24093 in addition to argument FPRs. Do not assume that most significant
24094 double in 128-bit long double value is properly rounded when comparing
24095 values and converting to double. Use XL symbol names for long double
24096 support routines.
24097
24098 The AIX calling convention was extended but not initially documented to
24099 handle an obscure K&R C case of calling a function that takes the
24100 address of its arguments with fewer arguments than declared. IBM XL
24101 compilers access floating-point arguments that do not fit in the
24102 RSA from the stack when a subroutine is compiled without
24103 optimization. Because always storing floating-point arguments on the
24104 stack is inefficient and rarely needed, this option is not enabled by
24105 default and only is necessary when calling subroutines compiled by IBM
24106 XL compilers without optimization.
24107
24108 @item -mpe
24109 @opindex mpe
24110 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24111 application written to use message passing with special startup code to
24112 enable the application to run. The system must have PE installed in the
24113 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24114 must be overridden with the @option{-specs=} option to specify the
24115 appropriate directory location. The Parallel Environment does not
24116 support threads, so the @option{-mpe} option and the @option{-pthread}
24117 option are incompatible.
24118
24119 @item -malign-natural
24120 @itemx -malign-power
24121 @opindex malign-natural
24122 @opindex malign-power
24123 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24124 @option{-malign-natural} overrides the ABI-defined alignment of larger
24125 types, such as floating-point doubles, on their natural size-based boundary.
24126 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24127 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24128
24129 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24130 is not supported.
24131
24132 @item -msoft-float
24133 @itemx -mhard-float
24134 @opindex msoft-float
24135 @opindex mhard-float
24136 Generate code that does not use (uses) the floating-point register set.
24137 Software floating-point emulation is provided if you use the
24138 @option{-msoft-float} option, and pass the option to GCC when linking.
24139
24140 @item -mmultiple
24141 @itemx -mno-multiple
24142 @opindex mmultiple
24143 @opindex mno-multiple
24144 Generate code that uses (does not use) the load multiple word
24145 instructions and the store multiple word instructions. These
24146 instructions are generated by default on POWER systems, and not
24147 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24148 PowerPC systems, since those instructions do not work when the
24149 processor is in little-endian mode. The exceptions are PPC740 and
24150 PPC750 which permit these instructions in little-endian mode.
24151
24152 @item -mupdate
24153 @itemx -mno-update
24154 @opindex mupdate
24155 @opindex mno-update
24156 Generate code that uses (does not use) the load or store instructions
24157 that update the base register to the address of the calculated memory
24158 location. These instructions are generated by default. If you use
24159 @option{-mno-update}, there is a small window between the time that the
24160 stack pointer is updated and the address of the previous frame is
24161 stored, which means code that walks the stack frame across interrupts or
24162 signals may get corrupted data.
24163
24164 @item -mavoid-indexed-addresses
24165 @itemx -mno-avoid-indexed-addresses
24166 @opindex mavoid-indexed-addresses
24167 @opindex mno-avoid-indexed-addresses
24168 Generate code that tries to avoid (not avoid) the use of indexed load
24169 or store instructions. These instructions can incur a performance
24170 penalty on Power6 processors in certain situations, such as when
24171 stepping through large arrays that cross a 16M boundary. This option
24172 is enabled by default when targeting Power6 and disabled otherwise.
24173
24174 @item -mfused-madd
24175 @itemx -mno-fused-madd
24176 @opindex mfused-madd
24177 @opindex mno-fused-madd
24178 Generate code that uses (does not use) the floating-point multiply and
24179 accumulate instructions. These instructions are generated by default
24180 if hardware floating point is used. The machine-dependent
24181 @option{-mfused-madd} option is now mapped to the machine-independent
24182 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24183 mapped to @option{-ffp-contract=off}.
24184
24185 @item -mmulhw
24186 @itemx -mno-mulhw
24187 @opindex mmulhw
24188 @opindex mno-mulhw
24189 Generate code that uses (does not use) the half-word multiply and
24190 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24191 These instructions are generated by default when targeting those
24192 processors.
24193
24194 @item -mdlmzb
24195 @itemx -mno-dlmzb
24196 @opindex mdlmzb
24197 @opindex mno-dlmzb
24198 Generate code that uses (does not use) the string-search @samp{dlmzb}
24199 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24200 generated by default when targeting those processors.
24201
24202 @item -mno-bit-align
24203 @itemx -mbit-align
24204 @opindex mno-bit-align
24205 @opindex mbit-align
24206 On System V.4 and embedded PowerPC systems do not (do) force structures
24207 and unions that contain bit-fields to be aligned to the base type of the
24208 bit-field.
24209
24210 For example, by default a structure containing nothing but 8
24211 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24212 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24213 the structure is aligned to a 1-byte boundary and is 1 byte in
24214 size.
24215
24216 @item -mno-strict-align
24217 @itemx -mstrict-align
24218 @opindex mno-strict-align
24219 @opindex mstrict-align
24220 On System V.4 and embedded PowerPC systems do not (do) assume that
24221 unaligned memory references are handled by the system.
24222
24223 @item -mrelocatable
24224 @itemx -mno-relocatable
24225 @opindex mrelocatable
24226 @opindex mno-relocatable
24227 Generate code that allows (does not allow) a static executable to be
24228 relocated to a different address at run time. A simple embedded
24229 PowerPC system loader should relocate the entire contents of
24230 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24231 a table of 32-bit addresses generated by this option. For this to
24232 work, all objects linked together must be compiled with
24233 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24234 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24235
24236 @item -mrelocatable-lib
24237 @itemx -mno-relocatable-lib
24238 @opindex mrelocatable-lib
24239 @opindex mno-relocatable-lib
24240 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24241 @code{.fixup} section to allow static executables to be relocated at
24242 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24243 alignment of @option{-mrelocatable}. Objects compiled with
24244 @option{-mrelocatable-lib} may be linked with objects compiled with
24245 any combination of the @option{-mrelocatable} options.
24246
24247 @item -mno-toc
24248 @itemx -mtoc
24249 @opindex mno-toc
24250 @opindex mtoc
24251 On System V.4 and embedded PowerPC systems do not (do) assume that
24252 register 2 contains a pointer to a global area pointing to the addresses
24253 used in the program.
24254
24255 @item -mlittle
24256 @itemx -mlittle-endian
24257 @opindex mlittle
24258 @opindex mlittle-endian
24259 On System V.4 and embedded PowerPC systems compile code for the
24260 processor in little-endian mode. The @option{-mlittle-endian} option is
24261 the same as @option{-mlittle}.
24262
24263 @item -mbig
24264 @itemx -mbig-endian
24265 @opindex mbig
24266 @opindex mbig-endian
24267 On System V.4 and embedded PowerPC systems compile code for the
24268 processor in big-endian mode. The @option{-mbig-endian} option is
24269 the same as @option{-mbig}.
24270
24271 @item -mdynamic-no-pic
24272 @opindex mdynamic-no-pic
24273 On Darwin and Mac OS X systems, compile code so that it is not
24274 relocatable, but that its external references are relocatable. The
24275 resulting code is suitable for applications, but not shared
24276 libraries.
24277
24278 @item -msingle-pic-base
24279 @opindex msingle-pic-base
24280 Treat the register used for PIC addressing as read-only, rather than
24281 loading it in the prologue for each function. The runtime system is
24282 responsible for initializing this register with an appropriate value
24283 before execution begins.
24284
24285 @item -mprioritize-restricted-insns=@var{priority}
24286 @opindex mprioritize-restricted-insns
24287 This option controls the priority that is assigned to
24288 dispatch-slot restricted instructions during the second scheduling
24289 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24290 or @samp{2} to assign no, highest, or second-highest (respectively)
24291 priority to dispatch-slot restricted
24292 instructions.
24293
24294 @item -msched-costly-dep=@var{dependence_type}
24295 @opindex msched-costly-dep
24296 This option controls which dependences are considered costly
24297 by the target during instruction scheduling. The argument
24298 @var{dependence_type} takes one of the following values:
24299
24300 @table @asis
24301 @item @samp{no}
24302 No dependence is costly.
24303
24304 @item @samp{all}
24305 All dependences are costly.
24306
24307 @item @samp{true_store_to_load}
24308 A true dependence from store to load is costly.
24309
24310 @item @samp{store_to_load}
24311 Any dependence from store to load is costly.
24312
24313 @item @var{number}
24314 Any dependence for which the latency is greater than or equal to
24315 @var{number} is costly.
24316 @end table
24317
24318 @item -minsert-sched-nops=@var{scheme}
24319 @opindex minsert-sched-nops
24320 This option controls which NOP insertion scheme is used during
24321 the second scheduling pass. The argument @var{scheme} takes one of the
24322 following values:
24323
24324 @table @asis
24325 @item @samp{no}
24326 Don't insert NOPs.
24327
24328 @item @samp{pad}
24329 Pad with NOPs any dispatch group that has vacant issue slots,
24330 according to the scheduler's grouping.
24331
24332 @item @samp{regroup_exact}
24333 Insert NOPs to force costly dependent insns into
24334 separate groups. Insert exactly as many NOPs as needed to force an insn
24335 to a new group, according to the estimated processor grouping.
24336
24337 @item @var{number}
24338 Insert NOPs to force costly dependent insns into
24339 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24340 @end table
24341
24342 @item -mcall-sysv
24343 @opindex mcall-sysv
24344 On System V.4 and embedded PowerPC systems compile code using calling
24345 conventions that adhere to the March 1995 draft of the System V
24346 Application Binary Interface, PowerPC processor supplement. This is the
24347 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24348
24349 @item -mcall-sysv-eabi
24350 @itemx -mcall-eabi
24351 @opindex mcall-sysv-eabi
24352 @opindex mcall-eabi
24353 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24354
24355 @item -mcall-sysv-noeabi
24356 @opindex mcall-sysv-noeabi
24357 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24358
24359 @item -mcall-aixdesc
24360 @opindex m
24361 On System V.4 and embedded PowerPC systems compile code for the AIX
24362 operating system.
24363
24364 @item -mcall-linux
24365 @opindex mcall-linux
24366 On System V.4 and embedded PowerPC systems compile code for the
24367 Linux-based GNU system.
24368
24369 @item -mcall-freebsd
24370 @opindex mcall-freebsd
24371 On System V.4 and embedded PowerPC systems compile code for the
24372 FreeBSD operating system.
24373
24374 @item -mcall-netbsd
24375 @opindex mcall-netbsd
24376 On System V.4 and embedded PowerPC systems compile code for the
24377 NetBSD operating system.
24378
24379 @item -mcall-openbsd
24380 @opindex mcall-netbsd
24381 On System V.4 and embedded PowerPC systems compile code for the
24382 OpenBSD operating system.
24383
24384 @item -mtraceback=@var{traceback_type}
24385 @opindex mtraceback
24386 Select the type of traceback table. Valid values for @var{traceback_type}
24387 are @samp{full}, @samp{part}, and @samp{no}.
24388
24389 @item -maix-struct-return
24390 @opindex maix-struct-return
24391 Return all structures in memory (as specified by the AIX ABI)@.
24392
24393 @item -msvr4-struct-return
24394 @opindex msvr4-struct-return
24395 Return structures smaller than 8 bytes in registers (as specified by the
24396 SVR4 ABI)@.
24397
24398 @item -mabi=@var{abi-type}
24399 @opindex mabi
24400 Extend the current ABI with a particular extension, or remove such extension.
24401 Valid values are @samp{altivec}, @samp{no-altivec},
24402 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24403 @samp{elfv1}, @samp{elfv2}@.
24404
24405 @item -mabi=ibmlongdouble
24406 @opindex mabi=ibmlongdouble
24407 Change the current ABI to use IBM extended-precision long double.
24408 This is not likely to work if your system defaults to using IEEE
24409 extended-precision long double. If you change the long double type
24410 from IEEE extended-precision, the compiler will issue a warning unless
24411 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24412 to be enabled.
24413
24414 @item -mabi=ieeelongdouble
24415 @opindex mabi=ieeelongdouble
24416 Change the current ABI to use IEEE extended-precision long double.
24417 This is not likely to work if your system defaults to using IBM
24418 extended-precision long double. If you change the long double type
24419 from IBM extended-precision, the compiler will issue a warning unless
24420 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24421 to be enabled.
24422
24423 @item -mabi=elfv1
24424 @opindex mabi=elfv1
24425 Change the current ABI to use the ELFv1 ABI.
24426 This is the default ABI for big-endian PowerPC 64-bit Linux.
24427 Overriding the default ABI requires special system support and is
24428 likely to fail in spectacular ways.
24429
24430 @item -mabi=elfv2
24431 @opindex mabi=elfv2
24432 Change the current ABI to use the ELFv2 ABI.
24433 This is the default ABI for little-endian PowerPC 64-bit Linux.
24434 Overriding the default ABI requires special system support and is
24435 likely to fail in spectacular ways.
24436
24437 @item -mgnu-attribute
24438 @itemx -mno-gnu-attribute
24439 @opindex mgnu-attribute
24440 @opindex mno-gnu-attribute
24441 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24442 .gnu.attributes section that specify ABI variations in function
24443 parameters or return values.
24444
24445 @item -mprototype
24446 @itemx -mno-prototype
24447 @opindex mprototype
24448 @opindex mno-prototype
24449 On System V.4 and embedded PowerPC systems assume that all calls to
24450 variable argument functions are properly prototyped. Otherwise, the
24451 compiler must insert an instruction before every non-prototyped call to
24452 set or clear bit 6 of the condition code register (@code{CR}) to
24453 indicate whether floating-point values are passed in the floating-point
24454 registers in case the function takes variable arguments. With
24455 @option{-mprototype}, only calls to prototyped variable argument functions
24456 set or clear the bit.
24457
24458 @item -msim
24459 @opindex msim
24460 On embedded PowerPC systems, assume that the startup module is called
24461 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24462 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24463 configurations.
24464
24465 @item -mmvme
24466 @opindex mmvme
24467 On embedded PowerPC systems, assume that the startup module is called
24468 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24469 @file{libc.a}.
24470
24471 @item -mads
24472 @opindex mads
24473 On embedded PowerPC systems, assume that the startup module is called
24474 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24475 @file{libc.a}.
24476
24477 @item -myellowknife
24478 @opindex myellowknife
24479 On embedded PowerPC systems, assume that the startup module is called
24480 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24481 @file{libc.a}.
24482
24483 @item -mvxworks
24484 @opindex mvxworks
24485 On System V.4 and embedded PowerPC systems, specify that you are
24486 compiling for a VxWorks system.
24487
24488 @item -memb
24489 @opindex memb
24490 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24491 header to indicate that @samp{eabi} extended relocations are used.
24492
24493 @item -meabi
24494 @itemx -mno-eabi
24495 @opindex meabi
24496 @opindex mno-eabi
24497 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24498 Embedded Applications Binary Interface (EABI), which is a set of
24499 modifications to the System V.4 specifications. Selecting @option{-meabi}
24500 means that the stack is aligned to an 8-byte boundary, a function
24501 @code{__eabi} is called from @code{main} to set up the EABI
24502 environment, and the @option{-msdata} option can use both @code{r2} and
24503 @code{r13} to point to two separate small data areas. Selecting
24504 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24505 no EABI initialization function is called from @code{main}, and the
24506 @option{-msdata} option only uses @code{r13} to point to a single
24507 small data area. The @option{-meabi} option is on by default if you
24508 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24509
24510 @item -msdata=eabi
24511 @opindex msdata=eabi
24512 On System V.4 and embedded PowerPC systems, put small initialized
24513 @code{const} global and static data in the @code{.sdata2} section, which
24514 is pointed to by register @code{r2}. Put small initialized
24515 non-@code{const} global and static data in the @code{.sdata} section,
24516 which is pointed to by register @code{r13}. Put small uninitialized
24517 global and static data in the @code{.sbss} section, which is adjacent to
24518 the @code{.sdata} section. The @option{-msdata=eabi} option is
24519 incompatible with the @option{-mrelocatable} option. The
24520 @option{-msdata=eabi} option also sets the @option{-memb} option.
24521
24522 @item -msdata=sysv
24523 @opindex msdata=sysv
24524 On System V.4 and embedded PowerPC systems, put small global and static
24525 data in the @code{.sdata} section, which is pointed to by register
24526 @code{r13}. Put small uninitialized global and static data in the
24527 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24528 The @option{-msdata=sysv} option is incompatible with the
24529 @option{-mrelocatable} option.
24530
24531 @item -msdata=default
24532 @itemx -msdata
24533 @opindex msdata=default
24534 @opindex msdata
24535 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24536 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24537 same as @option{-msdata=sysv}.
24538
24539 @item -msdata=data
24540 @opindex msdata=data
24541 On System V.4 and embedded PowerPC systems, put small global
24542 data in the @code{.sdata} section. Put small uninitialized global
24543 data in the @code{.sbss} section. Do not use register @code{r13}
24544 to address small data however. This is the default behavior unless
24545 other @option{-msdata} options are used.
24546
24547 @item -msdata=none
24548 @itemx -mno-sdata
24549 @opindex msdata=none
24550 @opindex mno-sdata
24551 On embedded PowerPC systems, put all initialized global and static data
24552 in the @code{.data} section, and all uninitialized data in the
24553 @code{.bss} section.
24554
24555 @item -mreadonly-in-sdata
24556 @opindex mreadonly-in-sdata
24557 @opindex mno-readonly-in-sdata
24558 Put read-only objects in the @code{.sdata} section as well. This is the
24559 default.
24560
24561 @item -mblock-move-inline-limit=@var{num}
24562 @opindex mblock-move-inline-limit
24563 Inline all block moves (such as calls to @code{memcpy} or structure
24564 copies) less than or equal to @var{num} bytes. The minimum value for
24565 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24566 targets. The default value is target-specific.
24567
24568 @item -mblock-compare-inline-limit=@var{num}
24569 @opindex mblock-compare-inline-limit
24570 Generate non-looping inline code for all block compares (such as calls
24571 to @code{memcmp} or structure compares) less than or equal to @var{num}
24572 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24573 block compare is disabled. The default value is target-specific.
24574
24575 @item -mblock-compare-inline-loop-limit=@var{num}
24576 @opindex mblock-compare-inline-loop-limit
24577 Generate an inline expansion using loop code for all block compares that
24578 are less than or equal to @var{num} bytes, but greater than the limit
24579 for non-loop inline block compare expansion. If the block length is not
24580 constant, at most @var{num} bytes will be compared before @code{memcmp}
24581 is called to compare the remainder of the block. The default value is
24582 target-specific.
24583
24584 @item -mstring-compare-inline-limit=@var{num}
24585 @opindex mstring-compare-inline-limit
24586 Compare at most @var{num} string bytes with inline code.
24587 If the difference or end of string is not found at the
24588 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24589 take care of the rest of the comparison. The default is 64 bytes.
24590
24591 @item -G @var{num}
24592 @opindex G
24593 @cindex smaller data references (PowerPC)
24594 @cindex .sdata/.sdata2 references (PowerPC)
24595 On embedded PowerPC systems, put global and static items less than or
24596 equal to @var{num} bytes into the small data or BSS sections instead of
24597 the normal data or BSS section. By default, @var{num} is 8. The
24598 @option{-G @var{num}} switch is also passed to the linker.
24599 All modules should be compiled with the same @option{-G @var{num}} value.
24600
24601 @item -mregnames
24602 @itemx -mno-regnames
24603 @opindex mregnames
24604 @opindex mno-regnames
24605 On System V.4 and embedded PowerPC systems do (do not) emit register
24606 names in the assembly language output using symbolic forms.
24607
24608 @item -mlongcall
24609 @itemx -mno-longcall
24610 @opindex mlongcall
24611 @opindex mno-longcall
24612 By default assume that all calls are far away so that a longer and more
24613 expensive calling sequence is required. This is required for calls
24614 farther than 32 megabytes (33,554,432 bytes) from the current location.
24615 A short call is generated if the compiler knows
24616 the call cannot be that far away. This setting can be overridden by
24617 the @code{shortcall} function attribute, or by @code{#pragma
24618 longcall(0)}.
24619
24620 Some linkers are capable of detecting out-of-range calls and generating
24621 glue code on the fly. On these systems, long calls are unnecessary and
24622 generate slower code. As of this writing, the AIX linker can do this,
24623 as can the GNU linker for PowerPC/64. It is planned to add this feature
24624 to the GNU linker for 32-bit PowerPC systems as well.
24625
24626 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24627 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24628 addresses represent the callee and the branch island. The
24629 Darwin/PPC linker prefers the first address and generates a @code{bl
24630 callee} if the PPC @code{bl} instruction reaches the callee directly;
24631 otherwise, the linker generates @code{bl L42} to call the branch
24632 island. The branch island is appended to the body of the
24633 calling function; it computes the full 32-bit address of the callee
24634 and jumps to it.
24635
24636 On Mach-O (Darwin) systems, this option directs the compiler emit to
24637 the glue for every direct call, and the Darwin linker decides whether
24638 to use or discard it.
24639
24640 In the future, GCC may ignore all longcall specifications
24641 when the linker is known to generate glue.
24642
24643 @item -mtls-markers
24644 @itemx -mno-tls-markers
24645 @opindex mtls-markers
24646 @opindex mno-tls-markers
24647 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24648 specifying the function argument. The relocation allows the linker to
24649 reliably associate function call with argument setup instructions for
24650 TLS optimization, which in turn allows GCC to better schedule the
24651 sequence.
24652
24653 @item -mrecip
24654 @itemx -mno-recip
24655 @opindex mrecip
24656 This option enables use of the reciprocal estimate and
24657 reciprocal square root estimate instructions with additional
24658 Newton-Raphson steps to increase precision instead of doing a divide or
24659 square root and divide for floating-point arguments. You should use
24660 the @option{-ffast-math} option when using @option{-mrecip} (or at
24661 least @option{-funsafe-math-optimizations},
24662 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24663 @option{-fno-trapping-math}). Note that while the throughput of the
24664 sequence is generally higher than the throughput of the non-reciprocal
24665 instruction, the precision of the sequence can be decreased by up to 2
24666 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24667 roots.
24668
24669 @item -mrecip=@var{opt}
24670 @opindex mrecip=opt
24671 This option controls which reciprocal estimate instructions
24672 may be used. @var{opt} is a comma-separated list of options, which may
24673 be preceded by a @code{!} to invert the option:
24674
24675 @table @samp
24676
24677 @item all
24678 Enable all estimate instructions.
24679
24680 @item default
24681 Enable the default instructions, equivalent to @option{-mrecip}.
24682
24683 @item none
24684 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24685
24686 @item div
24687 Enable the reciprocal approximation instructions for both
24688 single and double precision.
24689
24690 @item divf
24691 Enable the single-precision reciprocal approximation instructions.
24692
24693 @item divd
24694 Enable the double-precision reciprocal approximation instructions.
24695
24696 @item rsqrt
24697 Enable the reciprocal square root approximation instructions for both
24698 single and double precision.
24699
24700 @item rsqrtf
24701 Enable the single-precision reciprocal square root approximation instructions.
24702
24703 @item rsqrtd
24704 Enable the double-precision reciprocal square root approximation instructions.
24705
24706 @end table
24707
24708 So, for example, @option{-mrecip=all,!rsqrtd} enables
24709 all of the reciprocal estimate instructions, except for the
24710 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24711 which handle the double-precision reciprocal square root calculations.
24712
24713 @item -mrecip-precision
24714 @itemx -mno-recip-precision
24715 @opindex mrecip-precision
24716 Assume (do not assume) that the reciprocal estimate instructions
24717 provide higher-precision estimates than is mandated by the PowerPC
24718 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24719 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24720 The double-precision square root estimate instructions are not generated by
24721 default on low-precision machines, since they do not provide an
24722 estimate that converges after three steps.
24723
24724 @item -mveclibabi=@var{type}
24725 @opindex mveclibabi
24726 Specifies the ABI type to use for vectorizing intrinsics using an
24727 external library. The only type supported at present is @samp{mass},
24728 which specifies to use IBM's Mathematical Acceleration Subsystem
24729 (MASS) libraries for vectorizing intrinsics using external libraries.
24730 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24731 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24732 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24733 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24734 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24735 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24736 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24737 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24738 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24739 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24740 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24741 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24742 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24743 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24744 for power7. Both @option{-ftree-vectorize} and
24745 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24746 libraries must be specified at link time.
24747
24748 @item -mfriz
24749 @itemx -mno-friz
24750 @opindex mfriz
24751 Generate (do not generate) the @code{friz} instruction when the
24752 @option{-funsafe-math-optimizations} option is used to optimize
24753 rounding of floating-point values to 64-bit integer and back to floating
24754 point. The @code{friz} instruction does not return the same value if
24755 the floating-point number is too large to fit in an integer.
24756
24757 @item -mpointers-to-nested-functions
24758 @itemx -mno-pointers-to-nested-functions
24759 @opindex mpointers-to-nested-functions
24760 Generate (do not generate) code to load up the static chain register
24761 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24762 systems where a function pointer points to a 3-word descriptor giving
24763 the function address, TOC value to be loaded in register @code{r2}, and
24764 static chain value to be loaded in register @code{r11}. The
24765 @option{-mpointers-to-nested-functions} is on by default. You cannot
24766 call through pointers to nested functions or pointers
24767 to functions compiled in other languages that use the static chain if
24768 you use @option{-mno-pointers-to-nested-functions}.
24769
24770 @item -msave-toc-indirect
24771 @itemx -mno-save-toc-indirect
24772 @opindex msave-toc-indirect
24773 Generate (do not generate) code to save the TOC value in the reserved
24774 stack location in the function prologue if the function calls through
24775 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24776 saved in the prologue, it is saved just before the call through the
24777 pointer. The @option{-mno-save-toc-indirect} option is the default.
24778
24779 @item -mcompat-align-parm
24780 @itemx -mno-compat-align-parm
24781 @opindex mcompat-align-parm
24782 Generate (do not generate) code to pass structure parameters with a
24783 maximum alignment of 64 bits, for compatibility with older versions
24784 of GCC.
24785
24786 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24787 structure parameter on a 128-bit boundary when that structure contained
24788 a member requiring 128-bit alignment. This is corrected in more
24789 recent versions of GCC. This option may be used to generate code
24790 that is compatible with functions compiled with older versions of
24791 GCC.
24792
24793 The @option{-mno-compat-align-parm} option is the default.
24794
24795 @item -mstack-protector-guard=@var{guard}
24796 @itemx -mstack-protector-guard-reg=@var{reg}
24797 @itemx -mstack-protector-guard-offset=@var{offset}
24798 @itemx -mstack-protector-guard-symbol=@var{symbol}
24799 @opindex mstack-protector-guard
24800 @opindex mstack-protector-guard-reg
24801 @opindex mstack-protector-guard-offset
24802 @opindex mstack-protector-guard-symbol
24803 Generate stack protection code using canary at @var{guard}. Supported
24804 locations are @samp{global} for global canary or @samp{tls} for per-thread
24805 canary in the TLS block (the default with GNU libc version 2.4 or later).
24806
24807 With the latter choice the options
24808 @option{-mstack-protector-guard-reg=@var{reg}} and
24809 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24810 which register to use as base register for reading the canary, and from what
24811 offset from that base register. The default for those is as specified in the
24812 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24813 the offset with a symbol reference to a canary in the TLS block.
24814 @end table
24815
24816 @node RX Options
24817 @subsection RX Options
24818 @cindex RX Options
24819
24820 These command-line options are defined for RX targets:
24821
24822 @table @gcctabopt
24823 @item -m64bit-doubles
24824 @itemx -m32bit-doubles
24825 @opindex m64bit-doubles
24826 @opindex m32bit-doubles
24827 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24828 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24829 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24830 works on 32-bit values, which is why the default is
24831 @option{-m32bit-doubles}.
24832
24833 @item -fpu
24834 @itemx -nofpu
24835 @opindex fpu
24836 @opindex nofpu
24837 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24838 floating-point hardware. The default is enabled for the RX600
24839 series and disabled for the RX200 series.
24840
24841 Floating-point instructions are only generated for 32-bit floating-point
24842 values, however, so the FPU hardware is not used for doubles if the
24843 @option{-m64bit-doubles} option is used.
24844
24845 @emph{Note} If the @option{-fpu} option is enabled then
24846 @option{-funsafe-math-optimizations} is also enabled automatically.
24847 This is because the RX FPU instructions are themselves unsafe.
24848
24849 @item -mcpu=@var{name}
24850 @opindex mcpu
24851 Selects the type of RX CPU to be targeted. Currently three types are
24852 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24853 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24854
24855 The only difference between @samp{RX600} and @samp{RX610} is that the
24856 @samp{RX610} does not support the @code{MVTIPL} instruction.
24857
24858 The @samp{RX200} series does not have a hardware floating-point unit
24859 and so @option{-nofpu} is enabled by default when this type is
24860 selected.
24861
24862 @item -mbig-endian-data
24863 @itemx -mlittle-endian-data
24864 @opindex mbig-endian-data
24865 @opindex mlittle-endian-data
24866 Store data (but not code) in the big-endian format. The default is
24867 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24868 format.
24869
24870 @item -msmall-data-limit=@var{N}
24871 @opindex msmall-data-limit
24872 Specifies the maximum size in bytes of global and static variables
24873 which can be placed into the small data area. Using the small data
24874 area can lead to smaller and faster code, but the size of area is
24875 limited and it is up to the programmer to ensure that the area does
24876 not overflow. Also when the small data area is used one of the RX's
24877 registers (usually @code{r13}) is reserved for use pointing to this
24878 area, so it is no longer available for use by the compiler. This
24879 could result in slower and/or larger code if variables are pushed onto
24880 the stack instead of being held in this register.
24881
24882 Note, common variables (variables that have not been initialized) and
24883 constants are not placed into the small data area as they are assigned
24884 to other sections in the output executable.
24885
24886 The default value is zero, which disables this feature. Note, this
24887 feature is not enabled by default with higher optimization levels
24888 (@option{-O2} etc) because of the potentially detrimental effects of
24889 reserving a register. It is up to the programmer to experiment and
24890 discover whether this feature is of benefit to their program. See the
24891 description of the @option{-mpid} option for a description of how the
24892 actual register to hold the small data area pointer is chosen.
24893
24894 @item -msim
24895 @itemx -mno-sim
24896 @opindex msim
24897 @opindex mno-sim
24898 Use the simulator runtime. The default is to use the libgloss
24899 board-specific runtime.
24900
24901 @item -mas100-syntax
24902 @itemx -mno-as100-syntax
24903 @opindex mas100-syntax
24904 @opindex mno-as100-syntax
24905 When generating assembler output use a syntax that is compatible with
24906 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24907 assembler, but it has some restrictions so it is not generated by default.
24908
24909 @item -mmax-constant-size=@var{N}
24910 @opindex mmax-constant-size
24911 Specifies the maximum size, in bytes, of a constant that can be used as
24912 an operand in a RX instruction. Although the RX instruction set does
24913 allow constants of up to 4 bytes in length to be used in instructions,
24914 a longer value equates to a longer instruction. Thus in some
24915 circumstances it can be beneficial to restrict the size of constants
24916 that are used in instructions. Constants that are too big are instead
24917 placed into a constant pool and referenced via register indirection.
24918
24919 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24920 or 4 means that constants of any size are allowed.
24921
24922 @item -mrelax
24923 @opindex mrelax
24924 Enable linker relaxation. Linker relaxation is a process whereby the
24925 linker attempts to reduce the size of a program by finding shorter
24926 versions of various instructions. Disabled by default.
24927
24928 @item -mint-register=@var{N}
24929 @opindex mint-register
24930 Specify the number of registers to reserve for fast interrupt handler
24931 functions. The value @var{N} can be between 0 and 4. A value of 1
24932 means that register @code{r13} is reserved for the exclusive use
24933 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24934 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24935 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24936 A value of 0, the default, does not reserve any registers.
24937
24938 @item -msave-acc-in-interrupts
24939 @opindex msave-acc-in-interrupts
24940 Specifies that interrupt handler functions should preserve the
24941 accumulator register. This is only necessary if normal code might use
24942 the accumulator register, for example because it performs 64-bit
24943 multiplications. The default is to ignore the accumulator as this
24944 makes the interrupt handlers faster.
24945
24946 @item -mpid
24947 @itemx -mno-pid
24948 @opindex mpid
24949 @opindex mno-pid
24950 Enables the generation of position independent data. When enabled any
24951 access to constant data is done via an offset from a base address
24952 held in a register. This allows the location of constant data to be
24953 determined at run time without requiring the executable to be
24954 relocated, which is a benefit to embedded applications with tight
24955 memory constraints. Data that can be modified is not affected by this
24956 option.
24957
24958 Note, using this feature reserves a register, usually @code{r13}, for
24959 the constant data base address. This can result in slower and/or
24960 larger code, especially in complicated functions.
24961
24962 The actual register chosen to hold the constant data base address
24963 depends upon whether the @option{-msmall-data-limit} and/or the
24964 @option{-mint-register} command-line options are enabled. Starting
24965 with register @code{r13} and proceeding downwards, registers are
24966 allocated first to satisfy the requirements of @option{-mint-register},
24967 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24968 is possible for the small data area register to be @code{r8} if both
24969 @option{-mint-register=4} and @option{-mpid} are specified on the
24970 command line.
24971
24972 By default this feature is not enabled. The default can be restored
24973 via the @option{-mno-pid} command-line option.
24974
24975 @item -mno-warn-multiple-fast-interrupts
24976 @itemx -mwarn-multiple-fast-interrupts
24977 @opindex mno-warn-multiple-fast-interrupts
24978 @opindex mwarn-multiple-fast-interrupts
24979 Prevents GCC from issuing a warning message if it finds more than one
24980 fast interrupt handler when it is compiling a file. The default is to
24981 issue a warning for each extra fast interrupt handler found, as the RX
24982 only supports one such interrupt.
24983
24984 @item -mallow-string-insns
24985 @itemx -mno-allow-string-insns
24986 @opindex mallow-string-insns
24987 @opindex mno-allow-string-insns
24988 Enables or disables the use of the string manipulation instructions
24989 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24990 @code{SWHILE} and also the @code{RMPA} instruction. These
24991 instructions may prefetch data, which is not safe to do if accessing
24992 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24993 for more information).
24994
24995 The default is to allow these instructions, but it is not possible for
24996 GCC to reliably detect all circumstances where a string instruction
24997 might be used to access an I/O register, so their use cannot be
24998 disabled automatically. Instead it is reliant upon the programmer to
24999 use the @option{-mno-allow-string-insns} option if their program
25000 accesses I/O space.
25001
25002 When the instructions are enabled GCC defines the C preprocessor
25003 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25004 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25005
25006 @item -mjsr
25007 @itemx -mno-jsr
25008 @opindex mjsr
25009 @opindex mno-jsr
25010 Use only (or not only) @code{JSR} instructions to access functions.
25011 This option can be used when code size exceeds the range of @code{BSR}
25012 instructions. Note that @option{-mno-jsr} does not mean to not use
25013 @code{JSR} but instead means that any type of branch may be used.
25014 @end table
25015
25016 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25017 has special significance to the RX port when used with the
25018 @code{interrupt} function attribute. This attribute indicates a
25019 function intended to process fast interrupts. GCC ensures
25020 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25021 and/or @code{r13} and only provided that the normal use of the
25022 corresponding registers have been restricted via the
25023 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25024 options.
25025
25026 @node S/390 and zSeries Options
25027 @subsection S/390 and zSeries Options
25028 @cindex S/390 and zSeries Options
25029
25030 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25031
25032 @table @gcctabopt
25033 @item -mhard-float
25034 @itemx -msoft-float
25035 @opindex mhard-float
25036 @opindex msoft-float
25037 Use (do not use) the hardware floating-point instructions and registers
25038 for floating-point operations. When @option{-msoft-float} is specified,
25039 functions in @file{libgcc.a} are used to perform floating-point
25040 operations. When @option{-mhard-float} is specified, the compiler
25041 generates IEEE floating-point instructions. This is the default.
25042
25043 @item -mhard-dfp
25044 @itemx -mno-hard-dfp
25045 @opindex mhard-dfp
25046 @opindex mno-hard-dfp
25047 Use (do not use) the hardware decimal-floating-point instructions for
25048 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25049 specified, functions in @file{libgcc.a} are used to perform
25050 decimal-floating-point operations. When @option{-mhard-dfp} is
25051 specified, the compiler generates decimal-floating-point hardware
25052 instructions. This is the default for @option{-march=z9-ec} or higher.
25053
25054 @item -mlong-double-64
25055 @itemx -mlong-double-128
25056 @opindex mlong-double-64
25057 @opindex mlong-double-128
25058 These switches control the size of @code{long double} type. A size
25059 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25060 type. This is the default.
25061
25062 @item -mbackchain
25063 @itemx -mno-backchain
25064 @opindex mbackchain
25065 @opindex mno-backchain
25066 Store (do not store) the address of the caller's frame as backchain pointer
25067 into the callee's stack frame.
25068 A backchain may be needed to allow debugging using tools that do not understand
25069 DWARF call frame information.
25070 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25071 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25072 the backchain is placed into the topmost word of the 96/160 byte register
25073 save area.
25074
25075 In general, code compiled with @option{-mbackchain} is call-compatible with
25076 code compiled with @option{-mmo-backchain}; however, use of the backchain
25077 for debugging purposes usually requires that the whole binary is built with
25078 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25079 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25080 to build a linux kernel use @option{-msoft-float}.
25081
25082 The default is to not maintain the backchain.
25083
25084 @item -mpacked-stack
25085 @itemx -mno-packed-stack
25086 @opindex mpacked-stack
25087 @opindex mno-packed-stack
25088 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25089 specified, the compiler uses the all fields of the 96/160 byte register save
25090 area only for their default purpose; unused fields still take up stack space.
25091 When @option{-mpacked-stack} is specified, register save slots are densely
25092 packed at the top of the register save area; unused space is reused for other
25093 purposes, allowing for more efficient use of the available stack space.
25094 However, when @option{-mbackchain} is also in effect, the topmost word of
25095 the save area is always used to store the backchain, and the return address
25096 register is always saved two words below the backchain.
25097
25098 As long as the stack frame backchain is not used, code generated with
25099 @option{-mpacked-stack} is call-compatible with code generated with
25100 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25101 S/390 or zSeries generated code that uses the stack frame backchain at run
25102 time, not just for debugging purposes. Such code is not call-compatible
25103 with code compiled with @option{-mpacked-stack}. Also, note that the
25104 combination of @option{-mbackchain},
25105 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25106 to build a linux kernel use @option{-msoft-float}.
25107
25108 The default is to not use the packed stack layout.
25109
25110 @item -msmall-exec
25111 @itemx -mno-small-exec
25112 @opindex msmall-exec
25113 @opindex mno-small-exec
25114 Generate (or do not generate) code using the @code{bras} instruction
25115 to do subroutine calls.
25116 This only works reliably if the total executable size does not
25117 exceed 64k. The default is to use the @code{basr} instruction instead,
25118 which does not have this limitation.
25119
25120 @item -m64
25121 @itemx -m31
25122 @opindex m64
25123 @opindex m31
25124 When @option{-m31} is specified, generate code compliant to the
25125 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25126 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25127 particular to generate 64-bit instructions. For the @samp{s390}
25128 targets, the default is @option{-m31}, while the @samp{s390x}
25129 targets default to @option{-m64}.
25130
25131 @item -mzarch
25132 @itemx -mesa
25133 @opindex mzarch
25134 @opindex mesa
25135 When @option{-mzarch} is specified, generate code using the
25136 instructions available on z/Architecture.
25137 When @option{-mesa} is specified, generate code using the
25138 instructions available on ESA/390. Note that @option{-mesa} is
25139 not possible with @option{-m64}.
25140 When generating code compliant to the GNU/Linux for S/390 ABI,
25141 the default is @option{-mesa}. When generating code compliant
25142 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25143
25144 @item -mhtm
25145 @itemx -mno-htm
25146 @opindex mhtm
25147 @opindex mno-htm
25148 The @option{-mhtm} option enables a set of builtins making use of
25149 instructions available with the transactional execution facility
25150 introduced with the IBM zEnterprise EC12 machine generation
25151 @ref{S/390 System z Built-in Functions}.
25152 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25153
25154 @item -mvx
25155 @itemx -mno-vx
25156 @opindex mvx
25157 @opindex mno-vx
25158 When @option{-mvx} is specified, generate code using the instructions
25159 available with the vector extension facility introduced with the IBM
25160 z13 machine generation.
25161 This option changes the ABI for some vector type values with regard to
25162 alignment and calling conventions. In case vector type values are
25163 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25164 command will be added to mark the resulting binary with the ABI used.
25165 @option{-mvx} is enabled by default when using @option{-march=z13}.
25166
25167 @item -mzvector
25168 @itemx -mno-zvector
25169 @opindex mzvector
25170 @opindex mno-zvector
25171 The @option{-mzvector} option enables vector language extensions and
25172 builtins using instructions available with the vector extension
25173 facility introduced with the IBM z13 machine generation.
25174 This option adds support for @samp{vector} to be used as a keyword to
25175 define vector type variables and arguments. @samp{vector} is only
25176 available when GNU extensions are enabled. It will not be expanded
25177 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25178 In addition to the GCC low-level builtins @option{-mzvector} enables
25179 a set of builtins added for compatibility with AltiVec-style
25180 implementations like Power and Cell. In order to make use of these
25181 builtins the header file @file{vecintrin.h} needs to be included.
25182 @option{-mzvector} is disabled by default.
25183
25184 @item -mmvcle
25185 @itemx -mno-mvcle
25186 @opindex mmvcle
25187 @opindex mno-mvcle
25188 Generate (or do not generate) code using the @code{mvcle} instruction
25189 to perform block moves. When @option{-mno-mvcle} is specified,
25190 use a @code{mvc} loop instead. This is the default unless optimizing for
25191 size.
25192
25193 @item -mdebug
25194 @itemx -mno-debug
25195 @opindex mdebug
25196 @opindex mno-debug
25197 Print (or do not print) additional debug information when compiling.
25198 The default is to not print debug information.
25199
25200 @item -march=@var{cpu-type}
25201 @opindex march
25202 Generate code that runs on @var{cpu-type}, which is the name of a
25203 system representing a certain processor type. Possible values for
25204 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25205 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25206 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25207 @samp{z14}/@samp{arch12}, and @samp{native}.
25208
25209 The default is @option{-march=z900}.
25210
25211 Specifying @samp{native} as cpu type can be used to select the best
25212 architecture option for the host processor.
25213 @option{-march=native} has no effect if GCC does not recognize the
25214 processor.
25215
25216 @item -mtune=@var{cpu-type}
25217 @opindex mtune
25218 Tune to @var{cpu-type} everything applicable about the generated code,
25219 except for the ABI and the set of available instructions.
25220 The list of @var{cpu-type} values is the same as for @option{-march}.
25221 The default is the value used for @option{-march}.
25222
25223 @item -mtpf-trace
25224 @itemx -mno-tpf-trace
25225 @opindex mtpf-trace
25226 @opindex mno-tpf-trace
25227 Generate code that adds (does not add) in TPF OS specific branches to trace
25228 routines in the operating system. This option is off by default, even
25229 when compiling for the TPF OS@.
25230
25231 @item -mfused-madd
25232 @itemx -mno-fused-madd
25233 @opindex mfused-madd
25234 @opindex mno-fused-madd
25235 Generate code that uses (does not use) the floating-point multiply and
25236 accumulate instructions. These instructions are generated by default if
25237 hardware floating point is used.
25238
25239 @item -mwarn-framesize=@var{framesize}
25240 @opindex mwarn-framesize
25241 Emit a warning if the current function exceeds the given frame size. Because
25242 this is a compile-time check it doesn't need to be a real problem when the program
25243 runs. It is intended to identify functions that most probably cause
25244 a stack overflow. It is useful to be used in an environment with limited stack
25245 size e.g.@: the linux kernel.
25246
25247 @item -mwarn-dynamicstack
25248 @opindex mwarn-dynamicstack
25249 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25250 arrays. This is generally a bad idea with a limited stack size.
25251
25252 @item -mstack-guard=@var{stack-guard}
25253 @itemx -mstack-size=@var{stack-size}
25254 @opindex mstack-guard
25255 @opindex mstack-size
25256 If these options are provided the S/390 back end emits additional instructions in
25257 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25258 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25259 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25260 the frame size of the compiled function is chosen.
25261 These options are intended to be used to help debugging stack overflow problems.
25262 The additionally emitted code causes only little overhead and hence can also be
25263 used in production-like systems without greater performance degradation. The given
25264 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25265 @var{stack-guard} without exceeding 64k.
25266 In order to be efficient the extra code makes the assumption that the stack starts
25267 at an address aligned to the value given by @var{stack-size}.
25268 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25269
25270 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25271 @opindex mhotpatch
25272 If the hotpatch option is enabled, a ``hot-patching'' function
25273 prologue is generated for all functions in the compilation unit.
25274 The funtion label is prepended with the given number of two-byte
25275 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25276 the label, 2 * @var{post-halfwords} bytes are appended, using the
25277 largest NOP like instructions the architecture allows (maximum
25278 1000000).
25279
25280 If both arguments are zero, hotpatching is disabled.
25281
25282 This option can be overridden for individual functions with the
25283 @code{hotpatch} attribute.
25284 @end table
25285
25286 @node Score Options
25287 @subsection Score Options
25288 @cindex Score Options
25289
25290 These options are defined for Score implementations:
25291
25292 @table @gcctabopt
25293 @item -meb
25294 @opindex meb
25295 Compile code for big-endian mode. This is the default.
25296
25297 @item -mel
25298 @opindex mel
25299 Compile code for little-endian mode.
25300
25301 @item -mnhwloop
25302 @opindex mnhwloop
25303 Disable generation of @code{bcnz} instructions.
25304
25305 @item -muls
25306 @opindex muls
25307 Enable generation of unaligned load and store instructions.
25308
25309 @item -mmac
25310 @opindex mmac
25311 Enable the use of multiply-accumulate instructions. Disabled by default.
25312
25313 @item -mscore5
25314 @opindex mscore5
25315 Specify the SCORE5 as the target architecture.
25316
25317 @item -mscore5u
25318 @opindex mscore5u
25319 Specify the SCORE5U of the target architecture.
25320
25321 @item -mscore7
25322 @opindex mscore7
25323 Specify the SCORE7 as the target architecture. This is the default.
25324
25325 @item -mscore7d
25326 @opindex mscore7d
25327 Specify the SCORE7D as the target architecture.
25328 @end table
25329
25330 @node SH Options
25331 @subsection SH Options
25332
25333 These @samp{-m} options are defined for the SH implementations:
25334
25335 @table @gcctabopt
25336 @item -m1
25337 @opindex m1
25338 Generate code for the SH1.
25339
25340 @item -m2
25341 @opindex m2
25342 Generate code for the SH2.
25343
25344 @item -m2e
25345 Generate code for the SH2e.
25346
25347 @item -m2a-nofpu
25348 @opindex m2a-nofpu
25349 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25350 that the floating-point unit is not used.
25351
25352 @item -m2a-single-only
25353 @opindex m2a-single-only
25354 Generate code for the SH2a-FPU, in such a way that no double-precision
25355 floating-point operations are used.
25356
25357 @item -m2a-single
25358 @opindex m2a-single
25359 Generate code for the SH2a-FPU assuming the floating-point unit is in
25360 single-precision mode by default.
25361
25362 @item -m2a
25363 @opindex m2a
25364 Generate code for the SH2a-FPU assuming the floating-point unit is in
25365 double-precision mode by default.
25366
25367 @item -m3
25368 @opindex m3
25369 Generate code for the SH3.
25370
25371 @item -m3e
25372 @opindex m3e
25373 Generate code for the SH3e.
25374
25375 @item -m4-nofpu
25376 @opindex m4-nofpu
25377 Generate code for the SH4 without a floating-point unit.
25378
25379 @item -m4-single-only
25380 @opindex m4-single-only
25381 Generate code for the SH4 with a floating-point unit that only
25382 supports single-precision arithmetic.
25383
25384 @item -m4-single
25385 @opindex m4-single
25386 Generate code for the SH4 assuming the floating-point unit is in
25387 single-precision mode by default.
25388
25389 @item -m4
25390 @opindex m4
25391 Generate code for the SH4.
25392
25393 @item -m4-100
25394 @opindex m4-100
25395 Generate code for SH4-100.
25396
25397 @item -m4-100-nofpu
25398 @opindex m4-100-nofpu
25399 Generate code for SH4-100 in such a way that the
25400 floating-point unit is not used.
25401
25402 @item -m4-100-single
25403 @opindex m4-100-single
25404 Generate code for SH4-100 assuming the floating-point unit is in
25405 single-precision mode by default.
25406
25407 @item -m4-100-single-only
25408 @opindex m4-100-single-only
25409 Generate code for SH4-100 in such a way that no double-precision
25410 floating-point operations are used.
25411
25412 @item -m4-200
25413 @opindex m4-200
25414 Generate code for SH4-200.
25415
25416 @item -m4-200-nofpu
25417 @opindex m4-200-nofpu
25418 Generate code for SH4-200 without in such a way that the
25419 floating-point unit is not used.
25420
25421 @item -m4-200-single
25422 @opindex m4-200-single
25423 Generate code for SH4-200 assuming the floating-point unit is in
25424 single-precision mode by default.
25425
25426 @item -m4-200-single-only
25427 @opindex m4-200-single-only
25428 Generate code for SH4-200 in such a way that no double-precision
25429 floating-point operations are used.
25430
25431 @item -m4-300
25432 @opindex m4-300
25433 Generate code for SH4-300.
25434
25435 @item -m4-300-nofpu
25436 @opindex m4-300-nofpu
25437 Generate code for SH4-300 without in such a way that the
25438 floating-point unit is not used.
25439
25440 @item -m4-300-single
25441 @opindex m4-300-single
25442 Generate code for SH4-300 in such a way that no double-precision
25443 floating-point operations are used.
25444
25445 @item -m4-300-single-only
25446 @opindex m4-300-single-only
25447 Generate code for SH4-300 in such a way that no double-precision
25448 floating-point operations are used.
25449
25450 @item -m4-340
25451 @opindex m4-340
25452 Generate code for SH4-340 (no MMU, no FPU).
25453
25454 @item -m4-500
25455 @opindex m4-500
25456 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25457 assembler.
25458
25459 @item -m4a-nofpu
25460 @opindex m4a-nofpu
25461 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25462 floating-point unit is not used.
25463
25464 @item -m4a-single-only
25465 @opindex m4a-single-only
25466 Generate code for the SH4a, in such a way that no double-precision
25467 floating-point operations are used.
25468
25469 @item -m4a-single
25470 @opindex m4a-single
25471 Generate code for the SH4a assuming the floating-point unit is in
25472 single-precision mode by default.
25473
25474 @item -m4a
25475 @opindex m4a
25476 Generate code for the SH4a.
25477
25478 @item -m4al
25479 @opindex m4al
25480 Same as @option{-m4a-nofpu}, except that it implicitly passes
25481 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25482 instructions at the moment.
25483
25484 @item -mb
25485 @opindex mb
25486 Compile code for the processor in big-endian mode.
25487
25488 @item -ml
25489 @opindex ml
25490 Compile code for the processor in little-endian mode.
25491
25492 @item -mdalign
25493 @opindex mdalign
25494 Align doubles at 64-bit boundaries. Note that this changes the calling
25495 conventions, and thus some functions from the standard C library do
25496 not work unless you recompile it first with @option{-mdalign}.
25497
25498 @item -mrelax
25499 @opindex mrelax
25500 Shorten some address references at link time, when possible; uses the
25501 linker option @option{-relax}.
25502
25503 @item -mbigtable
25504 @opindex mbigtable
25505 Use 32-bit offsets in @code{switch} tables. The default is to use
25506 16-bit offsets.
25507
25508 @item -mbitops
25509 @opindex mbitops
25510 Enable the use of bit manipulation instructions on SH2A.
25511
25512 @item -mfmovd
25513 @opindex mfmovd
25514 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25515 alignment constraints.
25516
25517 @item -mrenesas
25518 @opindex mrenesas
25519 Comply with the calling conventions defined by Renesas.
25520
25521 @item -mno-renesas
25522 @opindex mno-renesas
25523 Comply with the calling conventions defined for GCC before the Renesas
25524 conventions were available. This option is the default for all
25525 targets of the SH toolchain.
25526
25527 @item -mnomacsave
25528 @opindex mnomacsave
25529 Mark the @code{MAC} register as call-clobbered, even if
25530 @option{-mrenesas} is given.
25531
25532 @item -mieee
25533 @itemx -mno-ieee
25534 @opindex mieee
25535 @opindex mno-ieee
25536 Control the IEEE compliance of floating-point comparisons, which affects the
25537 handling of cases where the result of a comparison is unordered. By default
25538 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25539 enabled @option{-mno-ieee} is implicitly set, which results in faster
25540 floating-point greater-equal and less-equal comparisons. The implicit settings
25541 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25542
25543 @item -minline-ic_invalidate
25544 @opindex minline-ic_invalidate
25545 Inline code to invalidate instruction cache entries after setting up
25546 nested function trampolines.
25547 This option has no effect if @option{-musermode} is in effect and the selected
25548 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25549 instruction.
25550 If the selected code generation option does not allow the use of the @code{icbi}
25551 instruction, and @option{-musermode} is not in effect, the inlined code
25552 manipulates the instruction cache address array directly with an associative
25553 write. This not only requires privileged mode at run time, but it also
25554 fails if the cache line had been mapped via the TLB and has become unmapped.
25555
25556 @item -misize
25557 @opindex misize
25558 Dump instruction size and location in the assembly code.
25559
25560 @item -mpadstruct
25561 @opindex mpadstruct
25562 This option is deprecated. It pads structures to multiple of 4 bytes,
25563 which is incompatible with the SH ABI@.
25564
25565 @item -matomic-model=@var{model}
25566 @opindex matomic-model=@var{model}
25567 Sets the model of atomic operations and additional parameters as a comma
25568 separated list. For details on the atomic built-in functions see
25569 @ref{__atomic Builtins}. The following models and parameters are supported:
25570
25571 @table @samp
25572
25573 @item none
25574 Disable compiler generated atomic sequences and emit library calls for atomic
25575 operations. This is the default if the target is not @code{sh*-*-linux*}.
25576
25577 @item soft-gusa
25578 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25579 built-in functions. The generated atomic sequences require additional support
25580 from the interrupt/exception handling code of the system and are only suitable
25581 for SH3* and SH4* single-core systems. This option is enabled by default when
25582 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25583 this option also partially utilizes the hardware atomic instructions
25584 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25585 @samp{strict} is specified.
25586
25587 @item soft-tcb
25588 Generate software atomic sequences that use a variable in the thread control
25589 block. This is a variation of the gUSA sequences which can also be used on
25590 SH1* and SH2* targets. The generated atomic sequences require additional
25591 support from the interrupt/exception handling code of the system and are only
25592 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25593 parameter has to be specified as well.
25594
25595 @item soft-imask
25596 Generate software atomic sequences that temporarily disable interrupts by
25597 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25598 in privileged mode and is only suitable for single-core systems. Additional
25599 support from the interrupt/exception handling code of the system is not
25600 required. This model is enabled by default when the target is
25601 @code{sh*-*-linux*} and SH1* or SH2*.
25602
25603 @item hard-llcs
25604 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25605 instructions only. This is only available on SH4A and is suitable for
25606 multi-core systems. Since the hardware instructions support only 32 bit atomic
25607 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25608 Code compiled with this option is also compatible with other software
25609 atomic model interrupt/exception handling systems if executed on an SH4A
25610 system. Additional support from the interrupt/exception handling code of the
25611 system is not required for this model.
25612
25613 @item gbr-offset=
25614 This parameter specifies the offset in bytes of the variable in the thread
25615 control block structure that should be used by the generated atomic sequences
25616 when the @samp{soft-tcb} model has been selected. For other models this
25617 parameter is ignored. The specified value must be an integer multiple of four
25618 and in the range 0-1020.
25619
25620 @item strict
25621 This parameter prevents mixed usage of multiple atomic models, even if they
25622 are compatible, and makes the compiler generate atomic sequences of the
25623 specified model only.
25624
25625 @end table
25626
25627 @item -mtas
25628 @opindex mtas
25629 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25630 Notice that depending on the particular hardware and software configuration
25631 this can degrade overall performance due to the operand cache line flushes
25632 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25633 processors the @code{tas.b} instruction must be used with caution since it
25634 can result in data corruption for certain cache configurations.
25635
25636 @item -mprefergot
25637 @opindex mprefergot
25638 When generating position-independent code, emit function calls using
25639 the Global Offset Table instead of the Procedure Linkage Table.
25640
25641 @item -musermode
25642 @itemx -mno-usermode
25643 @opindex musermode
25644 @opindex mno-usermode
25645 Don't allow (allow) the compiler generating privileged mode code. Specifying
25646 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25647 inlined code would not work in user mode. @option{-musermode} is the default
25648 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25649 @option{-musermode} has no effect, since there is no user mode.
25650
25651 @item -multcost=@var{number}
25652 @opindex multcost=@var{number}
25653 Set the cost to assume for a multiply insn.
25654
25655 @item -mdiv=@var{strategy}
25656 @opindex mdiv=@var{strategy}
25657 Set the division strategy to be used for integer division operations.
25658 @var{strategy} can be one of:
25659
25660 @table @samp
25661
25662 @item call-div1
25663 Calls a library function that uses the single-step division instruction
25664 @code{div1} to perform the operation. Division by zero calculates an
25665 unspecified result and does not trap. This is the default except for SH4,
25666 SH2A and SHcompact.
25667
25668 @item call-fp
25669 Calls a library function that performs the operation in double precision
25670 floating point. Division by zero causes a floating-point exception. This is
25671 the default for SHcompact with FPU. Specifying this for targets that do not
25672 have a double precision FPU defaults to @code{call-div1}.
25673
25674 @item call-table
25675 Calls a library function that uses a lookup table for small divisors and
25676 the @code{div1} instruction with case distinction for larger divisors. Division
25677 by zero calculates an unspecified result and does not trap. This is the default
25678 for SH4. Specifying this for targets that do not have dynamic shift
25679 instructions defaults to @code{call-div1}.
25680
25681 @end table
25682
25683 When a division strategy has not been specified the default strategy is
25684 selected based on the current target. For SH2A the default strategy is to
25685 use the @code{divs} and @code{divu} instructions instead of library function
25686 calls.
25687
25688 @item -maccumulate-outgoing-args
25689 @opindex maccumulate-outgoing-args
25690 Reserve space once for outgoing arguments in the function prologue rather
25691 than around each call. Generally beneficial for performance and size. Also
25692 needed for unwinding to avoid changing the stack frame around conditional code.
25693
25694 @item -mdivsi3_libfunc=@var{name}
25695 @opindex mdivsi3_libfunc=@var{name}
25696 Set the name of the library function used for 32-bit signed division to
25697 @var{name}.
25698 This only affects the name used in the @samp{call} division strategies, and
25699 the compiler still expects the same sets of input/output/clobbered registers as
25700 if this option were not present.
25701
25702 @item -mfixed-range=@var{register-range}
25703 @opindex mfixed-range
25704 Generate code treating the given register range as fixed registers.
25705 A fixed register is one that the register allocator can not use. This is
25706 useful when compiling kernel code. A register range is specified as
25707 two registers separated by a dash. Multiple register ranges can be
25708 specified separated by a comma.
25709
25710 @item -mbranch-cost=@var{num}
25711 @opindex mbranch-cost=@var{num}
25712 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25713 make the compiler try to generate more branch-free code if possible.
25714 If not specified the value is selected depending on the processor type that
25715 is being compiled for.
25716
25717 @item -mzdcbranch
25718 @itemx -mno-zdcbranch
25719 @opindex mzdcbranch
25720 @opindex mno-zdcbranch
25721 Assume (do not assume) that zero displacement conditional branch instructions
25722 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25723 compiler prefers zero displacement branch code sequences. This is
25724 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25725 disabled by specifying @option{-mno-zdcbranch}.
25726
25727 @item -mcbranch-force-delay-slot
25728 @opindex mcbranch-force-delay-slot
25729 Force the usage of delay slots for conditional branches, which stuffs the delay
25730 slot with a @code{nop} if a suitable instruction cannot be found. By default
25731 this option is disabled. It can be enabled to work around hardware bugs as
25732 found in the original SH7055.
25733
25734 @item -mfused-madd
25735 @itemx -mno-fused-madd
25736 @opindex mfused-madd
25737 @opindex mno-fused-madd
25738 Generate code that uses (does not use) the floating-point multiply and
25739 accumulate instructions. These instructions are generated by default
25740 if hardware floating point is used. The machine-dependent
25741 @option{-mfused-madd} option is now mapped to the machine-independent
25742 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25743 mapped to @option{-ffp-contract=off}.
25744
25745 @item -mfsca
25746 @itemx -mno-fsca
25747 @opindex mfsca
25748 @opindex mno-fsca
25749 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25750 and cosine approximations. The option @option{-mfsca} must be used in
25751 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25752 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25753 approximations even if @option{-funsafe-math-optimizations} is in effect.
25754
25755 @item -mfsrra
25756 @itemx -mno-fsrra
25757 @opindex mfsrra
25758 @opindex mno-fsrra
25759 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25760 reciprocal square root approximations. The option @option{-mfsrra} must be used
25761 in combination with @option{-funsafe-math-optimizations} and
25762 @option{-ffinite-math-only}. It is enabled by default when generating code for
25763 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25764 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25765 in effect.
25766
25767 @item -mpretend-cmove
25768 @opindex mpretend-cmove
25769 Prefer zero-displacement conditional branches for conditional move instruction
25770 patterns. This can result in faster code on the SH4 processor.
25771
25772 @item -mfdpic
25773 @opindex fdpic
25774 Generate code using the FDPIC ABI.
25775
25776 @end table
25777
25778 @node Solaris 2 Options
25779 @subsection Solaris 2 Options
25780 @cindex Solaris 2 options
25781
25782 These @samp{-m} options are supported on Solaris 2:
25783
25784 @table @gcctabopt
25785 @item -mclear-hwcap
25786 @opindex mclear-hwcap
25787 @option{-mclear-hwcap} tells the compiler to remove the hardware
25788 capabilities generated by the Solaris assembler. This is only necessary
25789 when object files use ISA extensions not supported by the current
25790 machine, but check at runtime whether or not to use them.
25791
25792 @item -mimpure-text
25793 @opindex mimpure-text
25794 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25795 the compiler to not pass @option{-z text} to the linker when linking a
25796 shared object. Using this option, you can link position-dependent
25797 code into a shared object.
25798
25799 @option{-mimpure-text} suppresses the ``relocations remain against
25800 allocatable but non-writable sections'' linker error message.
25801 However, the necessary relocations trigger copy-on-write, and the
25802 shared object is not actually shared across processes. Instead of
25803 using @option{-mimpure-text}, you should compile all source code with
25804 @option{-fpic} or @option{-fPIC}.
25805
25806 @end table
25807
25808 These switches are supported in addition to the above on Solaris 2:
25809
25810 @table @gcctabopt
25811 @item -pthreads
25812 @opindex pthreads
25813 This is a synonym for @option{-pthread}.
25814 @end table
25815
25816 @node SPARC Options
25817 @subsection SPARC Options
25818 @cindex SPARC options
25819
25820 These @samp{-m} options are supported on the SPARC:
25821
25822 @table @gcctabopt
25823 @item -mno-app-regs
25824 @itemx -mapp-regs
25825 @opindex mno-app-regs
25826 @opindex mapp-regs
25827 Specify @option{-mapp-regs} to generate output using the global registers
25828 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25829 global register 1, each global register 2 through 4 is then treated as an
25830 allocable register that is clobbered by function calls. This is the default.
25831
25832 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25833 specify @option{-mno-app-regs}. You should compile libraries and system
25834 software with this option.
25835
25836 @item -mflat
25837 @itemx -mno-flat
25838 @opindex mflat
25839 @opindex mno-flat
25840 With @option{-mflat}, the compiler does not generate save/restore instructions
25841 and uses a ``flat'' or single register window model. This model is compatible
25842 with the regular register window model. The local registers and the input
25843 registers (0--5) are still treated as ``call-saved'' registers and are
25844 saved on the stack as needed.
25845
25846 With @option{-mno-flat} (the default), the compiler generates save/restore
25847 instructions (except for leaf functions). This is the normal operating mode.
25848
25849 @item -mfpu
25850 @itemx -mhard-float
25851 @opindex mfpu
25852 @opindex mhard-float
25853 Generate output containing floating-point instructions. This is the
25854 default.
25855
25856 @item -mno-fpu
25857 @itemx -msoft-float
25858 @opindex mno-fpu
25859 @opindex msoft-float
25860 Generate output containing library calls for floating point.
25861 @strong{Warning:} the requisite libraries are not available for all SPARC
25862 targets. Normally the facilities of the machine's usual C compiler are
25863 used, but this cannot be done directly in cross-compilation. You must make
25864 your own arrangements to provide suitable library functions for
25865 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25866 @samp{sparclite-*-*} do provide software floating-point support.
25867
25868 @option{-msoft-float} changes the calling convention in the output file;
25869 therefore, it is only useful if you compile @emph{all} of a program with
25870 this option. In particular, you need to compile @file{libgcc.a}, the
25871 library that comes with GCC, with @option{-msoft-float} in order for
25872 this to work.
25873
25874 @item -mhard-quad-float
25875 @opindex mhard-quad-float
25876 Generate output containing quad-word (long double) floating-point
25877 instructions.
25878
25879 @item -msoft-quad-float
25880 @opindex msoft-quad-float
25881 Generate output containing library calls for quad-word (long double)
25882 floating-point instructions. The functions called are those specified
25883 in the SPARC ABI@. This is the default.
25884
25885 As of this writing, there are no SPARC implementations that have hardware
25886 support for the quad-word floating-point instructions. They all invoke
25887 a trap handler for one of these instructions, and then the trap handler
25888 emulates the effect of the instruction. Because of the trap handler overhead,
25889 this is much slower than calling the ABI library routines. Thus the
25890 @option{-msoft-quad-float} option is the default.
25891
25892 @item -mno-unaligned-doubles
25893 @itemx -munaligned-doubles
25894 @opindex mno-unaligned-doubles
25895 @opindex munaligned-doubles
25896 Assume that doubles have 8-byte alignment. This is the default.
25897
25898 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25899 alignment only if they are contained in another type, or if they have an
25900 absolute address. Otherwise, it assumes they have 4-byte alignment.
25901 Specifying this option avoids some rare compatibility problems with code
25902 generated by other compilers. It is not the default because it results
25903 in a performance loss, especially for floating-point code.
25904
25905 @item -muser-mode
25906 @itemx -mno-user-mode
25907 @opindex muser-mode
25908 @opindex mno-user-mode
25909 Do not generate code that can only run in supervisor mode. This is relevant
25910 only for the @code{casa} instruction emitted for the LEON3 processor. This
25911 is the default.
25912
25913 @item -mfaster-structs
25914 @itemx -mno-faster-structs
25915 @opindex mfaster-structs
25916 @opindex mno-faster-structs
25917 With @option{-mfaster-structs}, the compiler assumes that structures
25918 should have 8-byte alignment. This enables the use of pairs of
25919 @code{ldd} and @code{std} instructions for copies in structure
25920 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25921 However, the use of this changed alignment directly violates the SPARC
25922 ABI@. Thus, it's intended only for use on targets where the developer
25923 acknowledges that their resulting code is not directly in line with
25924 the rules of the ABI@.
25925
25926 @item -mstd-struct-return
25927 @itemx -mno-std-struct-return
25928 @opindex mstd-struct-return
25929 @opindex mno-std-struct-return
25930 With @option{-mstd-struct-return}, the compiler generates checking code
25931 in functions returning structures or unions to detect size mismatches
25932 between the two sides of function calls, as per the 32-bit ABI@.
25933
25934 The default is @option{-mno-std-struct-return}. This option has no effect
25935 in 64-bit mode.
25936
25937 @item -mlra
25938 @itemx -mno-lra
25939 @opindex mlra
25940 @opindex mno-lra
25941 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25942 so @option{-mno-lra} needs to be passed to get old Reload.
25943
25944 @item -mcpu=@var{cpu_type}
25945 @opindex mcpu
25946 Set the instruction set, register set, and instruction scheduling parameters
25947 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25948 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25949 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25950 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25951 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25952 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25953
25954 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25955 which selects the best architecture option for the host processor.
25956 @option{-mcpu=native} has no effect if GCC does not recognize
25957 the processor.
25958
25959 Default instruction scheduling parameters are used for values that select
25960 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25961 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25962
25963 Here is a list of each supported architecture and their supported
25964 implementations.
25965
25966 @table @asis
25967 @item v7
25968 cypress, leon3v7
25969
25970 @item v8
25971 supersparc, hypersparc, leon, leon3
25972
25973 @item sparclite
25974 f930, f934, sparclite86x
25975
25976 @item sparclet
25977 tsc701
25978
25979 @item v9
25980 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25981 niagara7, m8
25982 @end table
25983
25984 By default (unless configured otherwise), GCC generates code for the V7
25985 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25986 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25987 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25988 SPARCStation 1, 2, IPX etc.
25989
25990 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25991 architecture. The only difference from V7 code is that the compiler emits
25992 the integer multiply and integer divide instructions which exist in SPARC-V8
25993 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25994 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25995 2000 series.
25996
25997 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25998 the SPARC architecture. This adds the integer multiply, integer divide step
25999 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26000 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26001 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26002 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26003 MB86934 chip, which is the more recent SPARClite with FPU@.
26004
26005 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26006 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26007 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26008 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26009 optimizes it for the TEMIC SPARClet chip.
26010
26011 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26012 architecture. This adds 64-bit integer and floating-point move instructions,
26013 3 additional floating-point condition code registers and conditional move
26014 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26015 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26016 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26017 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26018 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26019 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26020 additionally optimizes it for Sun UltraSPARC T2 chips. With
26021 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26022 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26023 additionally optimizes it for Sun UltraSPARC T4 chips. With
26024 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26025 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26026 additionally optimizes it for Oracle M8 chips.
26027
26028 @item -mtune=@var{cpu_type}
26029 @opindex mtune
26030 Set the instruction scheduling parameters for machine type
26031 @var{cpu_type}, but do not set the instruction set or register set that the
26032 option @option{-mcpu=@var{cpu_type}} does.
26033
26034 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26035 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26036 that select a particular CPU implementation. Those are
26037 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26038 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26039 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26040 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26041 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26042 and GNU/Linux toolchains, @samp{native} can also be used.
26043
26044 @item -mv8plus
26045 @itemx -mno-v8plus
26046 @opindex mv8plus
26047 @opindex mno-v8plus
26048 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26049 difference from the V8 ABI is that the global and out registers are
26050 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26051 mode for all SPARC-V9 processors.
26052
26053 @item -mvis
26054 @itemx -mno-vis
26055 @opindex mvis
26056 @opindex mno-vis
26057 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26058 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26059
26060 @item -mvis2
26061 @itemx -mno-vis2
26062 @opindex mvis2
26063 @opindex mno-vis2
26064 With @option{-mvis2}, GCC generates code that takes advantage of
26065 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26066 default is @option{-mvis2} when targeting a cpu that supports such
26067 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26068 also sets @option{-mvis}.
26069
26070 @item -mvis3
26071 @itemx -mno-vis3
26072 @opindex mvis3
26073 @opindex mno-vis3
26074 With @option{-mvis3}, GCC generates code that takes advantage of
26075 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26076 default is @option{-mvis3} when targeting a cpu that supports such
26077 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26078 also sets @option{-mvis2} and @option{-mvis}.
26079
26080 @item -mvis4
26081 @itemx -mno-vis4
26082 @opindex mvis4
26083 @opindex mno-vis4
26084 With @option{-mvis4}, GCC generates code that takes advantage of
26085 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26086 default is @option{-mvis4} when targeting a cpu that supports such
26087 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26088 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26089
26090 @item -mvis4b
26091 @itemx -mno-vis4b
26092 @opindex mvis4b
26093 @opindex mno-vis4b
26094 With @option{-mvis4b}, GCC generates code that takes advantage of
26095 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26096 the additional VIS instructions introduced in the Oracle SPARC
26097 Architecture 2017. The default is @option{-mvis4b} when targeting a
26098 cpu that supports such instructions, such as m8 and later. Setting
26099 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26100 @option{-mvis2} and @option{-mvis}.
26101
26102 @item -mcbcond
26103 @itemx -mno-cbcond
26104 @opindex mcbcond
26105 @opindex mno-cbcond
26106 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26107 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26108 when targeting a CPU that supports such instructions, such as Niagara-4 and
26109 later.
26110
26111 @item -mfmaf
26112 @itemx -mno-fmaf
26113 @opindex mfmaf
26114 @opindex mno-fmaf
26115 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26116 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26117 when targeting a CPU that supports such instructions, such as Niagara-3 and
26118 later.
26119
26120 @item -mfsmuld
26121 @itemx -mno-fsmuld
26122 @opindex mfsmuld
26123 @opindex mno-fsmuld
26124 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26125 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26126 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26127 or V9 with FPU except @option{-mcpu=leon}.
26128
26129 @item -mpopc
26130 @itemx -mno-popc
26131 @opindex mpopc
26132 @opindex mno-popc
26133 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26134 Population Count instruction. The default is @option{-mpopc}
26135 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26136 later.
26137
26138 @item -msubxc
26139 @itemx -mno-subxc
26140 @opindex msubxc
26141 @opindex mno-subxc
26142 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26143 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26144 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26145 later.
26146
26147 @item -mfix-at697f
26148 @opindex mfix-at697f
26149 Enable the documented workaround for the single erratum of the Atmel AT697F
26150 processor (which corresponds to erratum #13 of the AT697E processor).
26151
26152 @item -mfix-ut699
26153 @opindex mfix-ut699
26154 Enable the documented workarounds for the floating-point errata and the data
26155 cache nullify errata of the UT699 processor.
26156
26157 @item -mfix-ut700
26158 @opindex mfix-ut700
26159 Enable the documented workaround for the back-to-back store errata of
26160 the UT699E/UT700 processor.
26161
26162 @item -mfix-gr712rc
26163 @opindex mfix-gr712rc
26164 Enable the documented workaround for the back-to-back store errata of
26165 the GR712RC processor.
26166 @end table
26167
26168 These @samp{-m} options are supported in addition to the above
26169 on SPARC-V9 processors in 64-bit environments:
26170
26171 @table @gcctabopt
26172 @item -m32
26173 @itemx -m64
26174 @opindex m32
26175 @opindex m64
26176 Generate code for a 32-bit or 64-bit environment.
26177 The 32-bit environment sets int, long and pointer to 32 bits.
26178 The 64-bit environment sets int to 32 bits and long and pointer
26179 to 64 bits.
26180
26181 @item -mcmodel=@var{which}
26182 @opindex mcmodel
26183 Set the code model to one of
26184
26185 @table @samp
26186 @item medlow
26187 The Medium/Low code model: 64-bit addresses, programs
26188 must be linked in the low 32 bits of memory. Programs can be statically
26189 or dynamically linked.
26190
26191 @item medmid
26192 The Medium/Middle code model: 64-bit addresses, programs
26193 must be linked in the low 44 bits of memory, the text and data segments must
26194 be less than 2GB in size and the data segment must be located within 2GB of
26195 the text segment.
26196
26197 @item medany
26198 The Medium/Anywhere code model: 64-bit addresses, programs
26199 may be linked anywhere in memory, the text and data segments must be less
26200 than 2GB in size and the data segment must be located within 2GB of the
26201 text segment.
26202
26203 @item embmedany
26204 The Medium/Anywhere code model for embedded systems:
26205 64-bit addresses, the text and data segments must be less than 2GB in
26206 size, both starting anywhere in memory (determined at link time). The
26207 global register %g4 points to the base of the data segment. Programs
26208 are statically linked and PIC is not supported.
26209 @end table
26210
26211 @item -mmemory-model=@var{mem-model}
26212 @opindex mmemory-model
26213 Set the memory model in force on the processor to one of
26214
26215 @table @samp
26216 @item default
26217 The default memory model for the processor and operating system.
26218
26219 @item rmo
26220 Relaxed Memory Order
26221
26222 @item pso
26223 Partial Store Order
26224
26225 @item tso
26226 Total Store Order
26227
26228 @item sc
26229 Sequential Consistency
26230 @end table
26231
26232 These memory models are formally defined in Appendix D of the SPARC-V9
26233 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26234
26235 @item -mstack-bias
26236 @itemx -mno-stack-bias
26237 @opindex mstack-bias
26238 @opindex mno-stack-bias
26239 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26240 frame pointer if present, are offset by @minus{}2047 which must be added back
26241 when making stack frame references. This is the default in 64-bit mode.
26242 Otherwise, assume no such offset is present.
26243 @end table
26244
26245 @node SPU Options
26246 @subsection SPU Options
26247 @cindex SPU options
26248
26249 These @samp{-m} options are supported on the SPU:
26250
26251 @table @gcctabopt
26252 @item -mwarn-reloc
26253 @itemx -merror-reloc
26254 @opindex mwarn-reloc
26255 @opindex merror-reloc
26256
26257 The loader for SPU does not handle dynamic relocations. By default, GCC
26258 gives an error when it generates code that requires a dynamic
26259 relocation. @option{-mno-error-reloc} disables the error,
26260 @option{-mwarn-reloc} generates a warning instead.
26261
26262 @item -msafe-dma
26263 @itemx -munsafe-dma
26264 @opindex msafe-dma
26265 @opindex munsafe-dma
26266
26267 Instructions that initiate or test completion of DMA must not be
26268 reordered with respect to loads and stores of the memory that is being
26269 accessed.
26270 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26271 memory accesses, but that can lead to inefficient code in places where the
26272 memory is known to not change. Rather than mark the memory as volatile,
26273 you can use @option{-msafe-dma} to tell the compiler to treat
26274 the DMA instructions as potentially affecting all memory.
26275
26276 @item -mbranch-hints
26277 @opindex mbranch-hints
26278
26279 By default, GCC generates a branch hint instruction to avoid
26280 pipeline stalls for always-taken or probably-taken branches. A hint
26281 is not generated closer than 8 instructions away from its branch.
26282 There is little reason to disable them, except for debugging purposes,
26283 or to make an object a little bit smaller.
26284
26285 @item -msmall-mem
26286 @itemx -mlarge-mem
26287 @opindex msmall-mem
26288 @opindex mlarge-mem
26289
26290 By default, GCC generates code assuming that addresses are never larger
26291 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26292 a full 32-bit address.
26293
26294 @item -mstdmain
26295 @opindex mstdmain
26296
26297 By default, GCC links against startup code that assumes the SPU-style
26298 main function interface (which has an unconventional parameter list).
26299 With @option{-mstdmain}, GCC links your program against startup
26300 code that assumes a C99-style interface to @code{main}, including a
26301 local copy of @code{argv} strings.
26302
26303 @item -mfixed-range=@var{register-range}
26304 @opindex mfixed-range
26305 Generate code treating the given register range as fixed registers.
26306 A fixed register is one that the register allocator cannot use. This is
26307 useful when compiling kernel code. A register range is specified as
26308 two registers separated by a dash. Multiple register ranges can be
26309 specified separated by a comma.
26310
26311 @item -mea32
26312 @itemx -mea64
26313 @opindex mea32
26314 @opindex mea64
26315 Compile code assuming that pointers to the PPU address space accessed
26316 via the @code{__ea} named address space qualifier are either 32 or 64
26317 bits wide. The default is 32 bits. As this is an ABI-changing option,
26318 all object code in an executable must be compiled with the same setting.
26319
26320 @item -maddress-space-conversion
26321 @itemx -mno-address-space-conversion
26322 @opindex maddress-space-conversion
26323 @opindex mno-address-space-conversion
26324 Allow/disallow treating the @code{__ea} address space as superset
26325 of the generic address space. This enables explicit type casts
26326 between @code{__ea} and generic pointer as well as implicit
26327 conversions of generic pointers to @code{__ea} pointers. The
26328 default is to allow address space pointer conversions.
26329
26330 @item -mcache-size=@var{cache-size}
26331 @opindex mcache-size
26332 This option controls the version of libgcc that the compiler links to an
26333 executable and selects a software-managed cache for accessing variables
26334 in the @code{__ea} address space with a particular cache size. Possible
26335 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26336 and @samp{128}. The default cache size is 64KB.
26337
26338 @item -matomic-updates
26339 @itemx -mno-atomic-updates
26340 @opindex matomic-updates
26341 @opindex mno-atomic-updates
26342 This option controls the version of libgcc that the compiler links to an
26343 executable and selects whether atomic updates to the software-managed
26344 cache of PPU-side variables are used. If you use atomic updates, changes
26345 to a PPU variable from SPU code using the @code{__ea} named address space
26346 qualifier do not interfere with changes to other PPU variables residing
26347 in the same cache line from PPU code. If you do not use atomic updates,
26348 such interference may occur; however, writing back cache lines is
26349 more efficient. The default behavior is to use atomic updates.
26350
26351 @item -mdual-nops
26352 @itemx -mdual-nops=@var{n}
26353 @opindex mdual-nops
26354 By default, GCC inserts NOPs to increase dual issue when it expects
26355 it to increase performance. @var{n} can be a value from 0 to 10. A
26356 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26357 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26358
26359 @item -mhint-max-nops=@var{n}
26360 @opindex mhint-max-nops
26361 Maximum number of NOPs to insert for a branch hint. A branch hint must
26362 be at least 8 instructions away from the branch it is affecting. GCC
26363 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26364 generate the branch hint.
26365
26366 @item -mhint-max-distance=@var{n}
26367 @opindex mhint-max-distance
26368 The encoding of the branch hint instruction limits the hint to be within
26369 256 instructions of the branch it is affecting. By default, GCC makes
26370 sure it is within 125.
26371
26372 @item -msafe-hints
26373 @opindex msafe-hints
26374 Work around a hardware bug that causes the SPU to stall indefinitely.
26375 By default, GCC inserts the @code{hbrp} instruction to make sure
26376 this stall won't happen.
26377
26378 @end table
26379
26380 @node System V Options
26381 @subsection Options for System V
26382
26383 These additional options are available on System V Release 4 for
26384 compatibility with other compilers on those systems:
26385
26386 @table @gcctabopt
26387 @item -G
26388 @opindex G
26389 Create a shared object.
26390 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26391
26392 @item -Qy
26393 @opindex Qy
26394 Identify the versions of each tool used by the compiler, in a
26395 @code{.ident} assembler directive in the output.
26396
26397 @item -Qn
26398 @opindex Qn
26399 Refrain from adding @code{.ident} directives to the output file (this is
26400 the default).
26401
26402 @item -YP,@var{dirs}
26403 @opindex YP
26404 Search the directories @var{dirs}, and no others, for libraries
26405 specified with @option{-l}.
26406
26407 @item -Ym,@var{dir}
26408 @opindex Ym
26409 Look in the directory @var{dir} to find the M4 preprocessor.
26410 The assembler uses this option.
26411 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26412 @c the generic assembler that comes with Solaris takes just -Ym.
26413 @end table
26414
26415 @node TILE-Gx Options
26416 @subsection TILE-Gx Options
26417 @cindex TILE-Gx options
26418
26419 These @samp{-m} options are supported on the TILE-Gx:
26420
26421 @table @gcctabopt
26422 @item -mcmodel=small
26423 @opindex mcmodel=small
26424 Generate code for the small model. The distance for direct calls is
26425 limited to 500M in either direction. PC-relative addresses are 32
26426 bits. Absolute addresses support the full address range.
26427
26428 @item -mcmodel=large
26429 @opindex mcmodel=large
26430 Generate code for the large model. There is no limitation on call
26431 distance, pc-relative addresses, or absolute addresses.
26432
26433 @item -mcpu=@var{name}
26434 @opindex mcpu
26435 Selects the type of CPU to be targeted. Currently the only supported
26436 type is @samp{tilegx}.
26437
26438 @item -m32
26439 @itemx -m64
26440 @opindex m32
26441 @opindex m64
26442 Generate code for a 32-bit or 64-bit environment. The 32-bit
26443 environment sets int, long, and pointer to 32 bits. The 64-bit
26444 environment sets int to 32 bits and long and pointer to 64 bits.
26445
26446 @item -mbig-endian
26447 @itemx -mlittle-endian
26448 @opindex mbig-endian
26449 @opindex mlittle-endian
26450 Generate code in big/little endian mode, respectively.
26451 @end table
26452
26453 @node TILEPro Options
26454 @subsection TILEPro Options
26455 @cindex TILEPro options
26456
26457 These @samp{-m} options are supported on the TILEPro:
26458
26459 @table @gcctabopt
26460 @item -mcpu=@var{name}
26461 @opindex mcpu
26462 Selects the type of CPU to be targeted. Currently the only supported
26463 type is @samp{tilepro}.
26464
26465 @item -m32
26466 @opindex m32
26467 Generate code for a 32-bit environment, which sets int, long, and
26468 pointer to 32 bits. This is the only supported behavior so the flag
26469 is essentially ignored.
26470 @end table
26471
26472 @node V850 Options
26473 @subsection V850 Options
26474 @cindex V850 Options
26475
26476 These @samp{-m} options are defined for V850 implementations:
26477
26478 @table @gcctabopt
26479 @item -mlong-calls
26480 @itemx -mno-long-calls
26481 @opindex mlong-calls
26482 @opindex mno-long-calls
26483 Treat all calls as being far away (near). If calls are assumed to be
26484 far away, the compiler always loads the function's address into a
26485 register, and calls indirect through the pointer.
26486
26487 @item -mno-ep
26488 @itemx -mep
26489 @opindex mno-ep
26490 @opindex mep
26491 Do not optimize (do optimize) basic blocks that use the same index
26492 pointer 4 or more times to copy pointer into the @code{ep} register, and
26493 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26494 option is on by default if you optimize.
26495
26496 @item -mno-prolog-function
26497 @itemx -mprolog-function
26498 @opindex mno-prolog-function
26499 @opindex mprolog-function
26500 Do not use (do use) external functions to save and restore registers
26501 at the prologue and epilogue of a function. The external functions
26502 are slower, but use less code space if more than one function saves
26503 the same number of registers. The @option{-mprolog-function} option
26504 is on by default if you optimize.
26505
26506 @item -mspace
26507 @opindex mspace
26508 Try to make the code as small as possible. At present, this just turns
26509 on the @option{-mep} and @option{-mprolog-function} options.
26510
26511 @item -mtda=@var{n}
26512 @opindex mtda
26513 Put static or global variables whose size is @var{n} bytes or less into
26514 the tiny data area that register @code{ep} points to. The tiny data
26515 area can hold up to 256 bytes in total (128 bytes for byte references).
26516
26517 @item -msda=@var{n}
26518 @opindex msda
26519 Put static or global variables whose size is @var{n} bytes or less into
26520 the small data area that register @code{gp} points to. The small data
26521 area can hold up to 64 kilobytes.
26522
26523 @item -mzda=@var{n}
26524 @opindex mzda
26525 Put static or global variables whose size is @var{n} bytes or less into
26526 the first 32 kilobytes of memory.
26527
26528 @item -mv850
26529 @opindex mv850
26530 Specify that the target processor is the V850.
26531
26532 @item -mv850e3v5
26533 @opindex mv850e3v5
26534 Specify that the target processor is the V850E3V5. The preprocessor
26535 constant @code{__v850e3v5__} is defined if this option is used.
26536
26537 @item -mv850e2v4
26538 @opindex mv850e2v4
26539 Specify that the target processor is the V850E3V5. This is an alias for
26540 the @option{-mv850e3v5} option.
26541
26542 @item -mv850e2v3
26543 @opindex mv850e2v3
26544 Specify that the target processor is the V850E2V3. The preprocessor
26545 constant @code{__v850e2v3__} is defined if this option is used.
26546
26547 @item -mv850e2
26548 @opindex mv850e2
26549 Specify that the target processor is the V850E2. The preprocessor
26550 constant @code{__v850e2__} is defined if this option is used.
26551
26552 @item -mv850e1
26553 @opindex mv850e1
26554 Specify that the target processor is the V850E1. The preprocessor
26555 constants @code{__v850e1__} and @code{__v850e__} are defined if
26556 this option is used.
26557
26558 @item -mv850es
26559 @opindex mv850es
26560 Specify that the target processor is the V850ES. This is an alias for
26561 the @option{-mv850e1} option.
26562
26563 @item -mv850e
26564 @opindex mv850e
26565 Specify that the target processor is the V850E@. The preprocessor
26566 constant @code{__v850e__} is defined if this option is used.
26567
26568 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26569 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26570 are defined then a default target processor is chosen and the
26571 relevant @samp{__v850*__} preprocessor constant is defined.
26572
26573 The preprocessor constants @code{__v850} and @code{__v851__} are always
26574 defined, regardless of which processor variant is the target.
26575
26576 @item -mdisable-callt
26577 @itemx -mno-disable-callt
26578 @opindex mdisable-callt
26579 @opindex mno-disable-callt
26580 This option suppresses generation of the @code{CALLT} instruction for the
26581 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26582 architecture.
26583
26584 This option is enabled by default when the RH850 ABI is
26585 in use (see @option{-mrh850-abi}), and disabled by default when the
26586 GCC ABI is in use. If @code{CALLT} instructions are being generated
26587 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26588
26589 @item -mrelax
26590 @itemx -mno-relax
26591 @opindex mrelax
26592 @opindex mno-relax
26593 Pass on (or do not pass on) the @option{-mrelax} command-line option
26594 to the assembler.
26595
26596 @item -mlong-jumps
26597 @itemx -mno-long-jumps
26598 @opindex mlong-jumps
26599 @opindex mno-long-jumps
26600 Disable (or re-enable) the generation of PC-relative jump instructions.
26601
26602 @item -msoft-float
26603 @itemx -mhard-float
26604 @opindex msoft-float
26605 @opindex mhard-float
26606 Disable (or re-enable) the generation of hardware floating point
26607 instructions. This option is only significant when the target
26608 architecture is @samp{V850E2V3} or higher. If hardware floating point
26609 instructions are being generated then the C preprocessor symbol
26610 @code{__FPU_OK__} is defined, otherwise the symbol
26611 @code{__NO_FPU__} is defined.
26612
26613 @item -mloop
26614 @opindex mloop
26615 Enables the use of the e3v5 LOOP instruction. The use of this
26616 instruction is not enabled by default when the e3v5 architecture is
26617 selected because its use is still experimental.
26618
26619 @item -mrh850-abi
26620 @itemx -mghs
26621 @opindex mrh850-abi
26622 @opindex mghs
26623 Enables support for the RH850 version of the V850 ABI. This is the
26624 default. With this version of the ABI the following rules apply:
26625
26626 @itemize
26627 @item
26628 Integer sized structures and unions are returned via a memory pointer
26629 rather than a register.
26630
26631 @item
26632 Large structures and unions (more than 8 bytes in size) are passed by
26633 value.
26634
26635 @item
26636 Functions are aligned to 16-bit boundaries.
26637
26638 @item
26639 The @option{-m8byte-align} command-line option is supported.
26640
26641 @item
26642 The @option{-mdisable-callt} command-line option is enabled by
26643 default. The @option{-mno-disable-callt} command-line option is not
26644 supported.
26645 @end itemize
26646
26647 When this version of the ABI is enabled the C preprocessor symbol
26648 @code{__V850_RH850_ABI__} is defined.
26649
26650 @item -mgcc-abi
26651 @opindex mgcc-abi
26652 Enables support for the old GCC version of the V850 ABI. With this
26653 version of the ABI the following rules apply:
26654
26655 @itemize
26656 @item
26657 Integer sized structures and unions are returned in register @code{r10}.
26658
26659 @item
26660 Large structures and unions (more than 8 bytes in size) are passed by
26661 reference.
26662
26663 @item
26664 Functions are aligned to 32-bit boundaries, unless optimizing for
26665 size.
26666
26667 @item
26668 The @option{-m8byte-align} command-line option is not supported.
26669
26670 @item
26671 The @option{-mdisable-callt} command-line option is supported but not
26672 enabled by default.
26673 @end itemize
26674
26675 When this version of the ABI is enabled the C preprocessor symbol
26676 @code{__V850_GCC_ABI__} is defined.
26677
26678 @item -m8byte-align
26679 @itemx -mno-8byte-align
26680 @opindex m8byte-align
26681 @opindex mno-8byte-align
26682 Enables support for @code{double} and @code{long long} types to be
26683 aligned on 8-byte boundaries. The default is to restrict the
26684 alignment of all objects to at most 4-bytes. When
26685 @option{-m8byte-align} is in effect the C preprocessor symbol
26686 @code{__V850_8BYTE_ALIGN__} is defined.
26687
26688 @item -mbig-switch
26689 @opindex mbig-switch
26690 Generate code suitable for big switch tables. Use this option only if
26691 the assembler/linker complain about out of range branches within a switch
26692 table.
26693
26694 @item -mapp-regs
26695 @opindex mapp-regs
26696 This option causes r2 and r5 to be used in the code generated by
26697 the compiler. This setting is the default.
26698
26699 @item -mno-app-regs
26700 @opindex mno-app-regs
26701 This option causes r2 and r5 to be treated as fixed registers.
26702
26703 @end table
26704
26705 @node VAX Options
26706 @subsection VAX Options
26707 @cindex VAX options
26708
26709 These @samp{-m} options are defined for the VAX:
26710
26711 @table @gcctabopt
26712 @item -munix
26713 @opindex munix
26714 Do not output certain jump instructions (@code{aobleq} and so on)
26715 that the Unix assembler for the VAX cannot handle across long
26716 ranges.
26717
26718 @item -mgnu
26719 @opindex mgnu
26720 Do output those jump instructions, on the assumption that the
26721 GNU assembler is being used.
26722
26723 @item -mg
26724 @opindex mg
26725 Output code for G-format floating-point numbers instead of D-format.
26726 @end table
26727
26728 @node Visium Options
26729 @subsection Visium Options
26730 @cindex Visium options
26731
26732 @table @gcctabopt
26733
26734 @item -mdebug
26735 @opindex mdebug
26736 A program which performs file I/O and is destined to run on an MCM target
26737 should be linked with this option. It causes the libraries libc.a and
26738 libdebug.a to be linked. The program should be run on the target under
26739 the control of the GDB remote debugging stub.
26740
26741 @item -msim
26742 @opindex msim
26743 A program which performs file I/O and is destined to run on the simulator
26744 should be linked with option. This causes libraries libc.a and libsim.a to
26745 be linked.
26746
26747 @item -mfpu
26748 @itemx -mhard-float
26749 @opindex mfpu
26750 @opindex mhard-float
26751 Generate code containing floating-point instructions. This is the
26752 default.
26753
26754 @item -mno-fpu
26755 @itemx -msoft-float
26756 @opindex mno-fpu
26757 @opindex msoft-float
26758 Generate code containing library calls for floating-point.
26759
26760 @option{-msoft-float} changes the calling convention in the output file;
26761 therefore, it is only useful if you compile @emph{all} of a program with
26762 this option. In particular, you need to compile @file{libgcc.a}, the
26763 library that comes with GCC, with @option{-msoft-float} in order for
26764 this to work.
26765
26766 @item -mcpu=@var{cpu_type}
26767 @opindex mcpu
26768 Set the instruction set, register set, and instruction scheduling parameters
26769 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26770 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26771
26772 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26773
26774 By default (unless configured otherwise), GCC generates code for the GR5
26775 variant of the Visium architecture.
26776
26777 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26778 architecture. The only difference from GR5 code is that the compiler will
26779 generate block move instructions.
26780
26781 @item -mtune=@var{cpu_type}
26782 @opindex mtune
26783 Set the instruction scheduling parameters for machine type @var{cpu_type},
26784 but do not set the instruction set or register set that the option
26785 @option{-mcpu=@var{cpu_type}} would.
26786
26787 @item -msv-mode
26788 @opindex msv-mode
26789 Generate code for the supervisor mode, where there are no restrictions on
26790 the access to general registers. This is the default.
26791
26792 @item -muser-mode
26793 @opindex muser-mode
26794 Generate code for the user mode, where the access to some general registers
26795 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26796 mode; on the GR6, only registers r29 to r31 are affected.
26797 @end table
26798
26799 @node VMS Options
26800 @subsection VMS Options
26801
26802 These @samp{-m} options are defined for the VMS implementations:
26803
26804 @table @gcctabopt
26805 @item -mvms-return-codes
26806 @opindex mvms-return-codes
26807 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26808 condition (e.g.@: error) codes.
26809
26810 @item -mdebug-main=@var{prefix}
26811 @opindex mdebug-main=@var{prefix}
26812 Flag the first routine whose name starts with @var{prefix} as the main
26813 routine for the debugger.
26814
26815 @item -mmalloc64
26816 @opindex mmalloc64
26817 Default to 64-bit memory allocation routines.
26818
26819 @item -mpointer-size=@var{size}
26820 @opindex mpointer-size=@var{size}
26821 Set the default size of pointers. Possible options for @var{size} are
26822 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26823 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26824 The later option disables @code{pragma pointer_size}.
26825 @end table
26826
26827 @node VxWorks Options
26828 @subsection VxWorks Options
26829 @cindex VxWorks Options
26830
26831 The options in this section are defined for all VxWorks targets.
26832 Options specific to the target hardware are listed with the other
26833 options for that target.
26834
26835 @table @gcctabopt
26836 @item -mrtp
26837 @opindex mrtp
26838 GCC can generate code for both VxWorks kernels and real time processes
26839 (RTPs). This option switches from the former to the latter. It also
26840 defines the preprocessor macro @code{__RTP__}.
26841
26842 @item -non-static
26843 @opindex non-static
26844 Link an RTP executable against shared libraries rather than static
26845 libraries. The options @option{-static} and @option{-shared} can
26846 also be used for RTPs (@pxref{Link Options}); @option{-static}
26847 is the default.
26848
26849 @item -Bstatic
26850 @itemx -Bdynamic
26851 @opindex Bstatic
26852 @opindex Bdynamic
26853 These options are passed down to the linker. They are defined for
26854 compatibility with Diab.
26855
26856 @item -Xbind-lazy
26857 @opindex Xbind-lazy
26858 Enable lazy binding of function calls. This option is equivalent to
26859 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26860
26861 @item -Xbind-now
26862 @opindex Xbind-now
26863 Disable lazy binding of function calls. This option is the default and
26864 is defined for compatibility with Diab.
26865 @end table
26866
26867 @node x86 Options
26868 @subsection x86 Options
26869 @cindex x86 Options
26870
26871 These @samp{-m} options are defined for the x86 family of computers.
26872
26873 @table @gcctabopt
26874
26875 @item -march=@var{cpu-type}
26876 @opindex march
26877 Generate instructions for the machine type @var{cpu-type}. In contrast to
26878 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26879 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26880 to generate code that may not run at all on processors other than the one
26881 indicated. Specifying @option{-march=@var{cpu-type}} implies
26882 @option{-mtune=@var{cpu-type}}.
26883
26884 The choices for @var{cpu-type} are:
26885
26886 @table @samp
26887 @item native
26888 This selects the CPU to generate code for at compilation time by determining
26889 the processor type of the compiling machine. Using @option{-march=native}
26890 enables all instruction subsets supported by the local machine (hence
26891 the result might not run on different machines). Using @option{-mtune=native}
26892 produces code optimized for the local machine under the constraints
26893 of the selected instruction set.
26894
26895 @item x86-64
26896 A generic CPU with 64-bit extensions.
26897
26898 @item i386
26899 Original Intel i386 CPU@.
26900
26901 @item i486
26902 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26903
26904 @item i586
26905 @itemx pentium
26906 Intel Pentium CPU with no MMX support.
26907
26908 @item lakemont
26909 Intel Lakemont MCU, based on Intel Pentium CPU.
26910
26911 @item pentium-mmx
26912 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26913
26914 @item pentiumpro
26915 Intel Pentium Pro CPU@.
26916
26917 @item i686
26918 When used with @option{-march}, the Pentium Pro
26919 instruction set is used, so the code runs on all i686 family chips.
26920 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26921
26922 @item pentium2
26923 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26924 support.
26925
26926 @item pentium3
26927 @itemx pentium3m
26928 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26929 set support.
26930
26931 @item pentium-m
26932 Intel Pentium M; low-power version of Intel Pentium III CPU
26933 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26934
26935 @item pentium4
26936 @itemx pentium4m
26937 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26938
26939 @item prescott
26940 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26941 set support.
26942
26943 @item nocona
26944 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26945 SSE2 and SSE3 instruction set support.
26946
26947 @item core2
26948 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26949 instruction set support.
26950
26951 @item nehalem
26952 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26953 SSE4.1, SSE4.2 and POPCNT instruction set support.
26954
26955 @item westmere
26956 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26957 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26958
26959 @item sandybridge
26960 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26961 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26962
26963 @item ivybridge
26964 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26965 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26966 instruction set support.
26967
26968 @item haswell
26969 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26970 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26971 BMI, BMI2 and F16C instruction set support.
26972
26973 @item broadwell
26974 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26975 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26976 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26977
26978 @item skylake
26979 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26980 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26981 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26982 XSAVES instruction set support.
26983
26984 @item bonnell
26985 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26986 instruction set support.
26987
26988 @item silvermont
26989 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26990 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26991
26992 @item goldmont
26993 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26994 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26995 instruction set support.
26996
26997 @item goldmont-plus
26998 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26999 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27000 PTWRITE, RDPID, SGX and UMIP instruction set support.
27001
27002 @item tremont
27003 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27004 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27005 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27006
27007 @item knl
27008 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27009 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27010 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27011 AVX512CD instruction set support.
27012
27013 @item knm
27014 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27015 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27016 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27017 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27018
27019 @item skylake-avx512
27020 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27021 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27022 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27023 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27024
27025 @item cannonlake
27026 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27027 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27028 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27029 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27030 AVX512IFMA, SHA and UMIP instruction set support.
27031
27032 @item icelake-client
27033 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27034 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27035 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27036 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27037 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27038 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27039
27040 @item icelake-server
27041 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27042 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27043 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27044 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27045 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27046 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27047 set support.
27048
27049 @item cascadelake
27050 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27051 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27052 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27053 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27054
27055 @item k6
27056 AMD K6 CPU with MMX instruction set support.
27057
27058 @item k6-2
27059 @itemx k6-3
27060 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27061
27062 @item athlon
27063 @itemx athlon-tbird
27064 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27065 support.
27066
27067 @item athlon-4
27068 @itemx athlon-xp
27069 @itemx athlon-mp
27070 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27071 instruction set support.
27072
27073 @item k8
27074 @itemx opteron
27075 @itemx athlon64
27076 @itemx athlon-fx
27077 Processors based on the AMD K8 core with x86-64 instruction set support,
27078 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27079 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27080 instruction set extensions.)
27081
27082 @item k8-sse3
27083 @itemx opteron-sse3
27084 @itemx athlon64-sse3
27085 Improved versions of AMD K8 cores with SSE3 instruction set support.
27086
27087 @item amdfam10
27088 @itemx barcelona
27089 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27090 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27091 instruction set extensions.)
27092
27093 @item bdver1
27094 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27095 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27096 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27097 @item bdver2
27098 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27099 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27100 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27101 extensions.)
27102 @item bdver3
27103 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27104 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27105 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27106 64-bit instruction set extensions.
27107 @item bdver4
27108 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27109 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27110 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27111 SSE4.2, ABM and 64-bit instruction set extensions.
27112
27113 @item znver1
27114 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27115 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27116 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27117 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27118 instruction set extensions.
27119 @item znver2
27120 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27121 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27122 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27123 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27124 instruction set extensions.)
27125
27126
27127 @item btver1
27128 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27129 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27130 instruction set extensions.)
27131
27132 @item btver2
27133 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27134 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27135 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27136
27137 @item winchip-c6
27138 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27139 set support.
27140
27141 @item winchip2
27142 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27143 instruction set support.
27144
27145 @item c3
27146 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27147 (No scheduling is implemented for this chip.)
27148
27149 @item c3-2
27150 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27151 (No scheduling is implemented for this chip.)
27152
27153 @item c7
27154 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27155 (No scheduling is implemented for this chip.)
27156
27157 @item samuel-2
27158 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27159 (No scheduling is implemented for this chip.)
27160
27161 @item nehemiah
27162 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27163 (No scheduling is implemented for this chip.)
27164
27165 @item esther
27166 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27167 (No scheduling is implemented for this chip.)
27168
27169 @item eden-x2
27170 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27171 (No scheduling is implemented for this chip.)
27172
27173 @item eden-x4
27174 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27175 AVX and AVX2 instruction set support.
27176 (No scheduling is implemented for this chip.)
27177
27178 @item nano
27179 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27180 instruction set support.
27181 (No scheduling is implemented for this chip.)
27182
27183 @item nano-1000
27184 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27185 instruction set support.
27186 (No scheduling is implemented for this chip.)
27187
27188 @item nano-2000
27189 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27190 instruction set support.
27191 (No scheduling is implemented for this chip.)
27192
27193 @item nano-3000
27194 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27195 instruction set support.
27196 (No scheduling is implemented for this chip.)
27197
27198 @item nano-x2
27199 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27200 instruction set support.
27201 (No scheduling is implemented for this chip.)
27202
27203 @item nano-x4
27204 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27205 instruction set support.
27206 (No scheduling is implemented for this chip.)
27207
27208 @item geode
27209 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27210 @end table
27211
27212 @item -mtune=@var{cpu-type}
27213 @opindex mtune
27214 Tune to @var{cpu-type} everything applicable about the generated code, except
27215 for the ABI and the set of available instructions.
27216 While picking a specific @var{cpu-type} schedules things appropriately
27217 for that particular chip, the compiler does not generate any code that
27218 cannot run on the default machine type unless you use a
27219 @option{-march=@var{cpu-type}} option.
27220 For example, if GCC is configured for i686-pc-linux-gnu
27221 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27222 but still runs on i686 machines.
27223
27224 The choices for @var{cpu-type} are the same as for @option{-march}.
27225 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27226
27227 @table @samp
27228 @item generic
27229 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27230 If you know the CPU on which your code will run, then you should use
27231 the corresponding @option{-mtune} or @option{-march} option instead of
27232 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27233 of your application will have, then you should use this option.
27234
27235 As new processors are deployed in the marketplace, the behavior of this
27236 option will change. Therefore, if you upgrade to a newer version of
27237 GCC, code generation controlled by this option will change to reflect
27238 the processors
27239 that are most common at the time that version of GCC is released.
27240
27241 There is no @option{-march=generic} option because @option{-march}
27242 indicates the instruction set the compiler can use, and there is no
27243 generic instruction set applicable to all processors. In contrast,
27244 @option{-mtune} indicates the processor (or, in this case, collection of
27245 processors) for which the code is optimized.
27246
27247 @item intel
27248 Produce code optimized for the most current Intel processors, which are
27249 Haswell and Silvermont for this version of GCC. If you know the CPU
27250 on which your code will run, then you should use the corresponding
27251 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27252 But, if you want your application performs better on both Haswell and
27253 Silvermont, then you should use this option.
27254
27255 As new Intel processors are deployed in the marketplace, the behavior of
27256 this option will change. Therefore, if you upgrade to a newer version of
27257 GCC, code generation controlled by this option will change to reflect
27258 the most current Intel processors at the time that version of GCC is
27259 released.
27260
27261 There is no @option{-march=intel} option because @option{-march} indicates
27262 the instruction set the compiler can use, and there is no common
27263 instruction set applicable to all processors. In contrast,
27264 @option{-mtune} indicates the processor (or, in this case, collection of
27265 processors) for which the code is optimized.
27266 @end table
27267
27268 @item -mcpu=@var{cpu-type}
27269 @opindex mcpu
27270 A deprecated synonym for @option{-mtune}.
27271
27272 @item -mfpmath=@var{unit}
27273 @opindex mfpmath
27274 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27275 for @var{unit} are:
27276
27277 @table @samp
27278 @item 387
27279 Use the standard 387 floating-point coprocessor present on the majority of chips and
27280 emulated otherwise. Code compiled with this option runs almost everywhere.
27281 The temporary results are computed in 80-bit precision instead of the precision
27282 specified by the type, resulting in slightly different results compared to most
27283 of other chips. See @option{-ffloat-store} for more detailed description.
27284
27285 This is the default choice for non-Darwin x86-32 targets.
27286
27287 @item sse
27288 Use scalar floating-point instructions present in the SSE instruction set.
27289 This instruction set is supported by Pentium III and newer chips,
27290 and in the AMD line
27291 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27292 instruction set supports only single-precision arithmetic, thus the double and
27293 extended-precision arithmetic are still done using 387. A later version, present
27294 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27295 arithmetic too.
27296
27297 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27298 or @option{-msse2} switches to enable SSE extensions and make this option
27299 effective. For the x86-64 compiler, these extensions are enabled by default.
27300
27301 The resulting code should be considerably faster in the majority of cases and avoid
27302 the numerical instability problems of 387 code, but may break some existing
27303 code that expects temporaries to be 80 bits.
27304
27305 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27306 and the default choice for x86-32 targets with the SSE2 instruction set
27307 when @option{-ffast-math} is enabled.
27308
27309 @item sse,387
27310 @itemx sse+387
27311 @itemx both
27312 Attempt to utilize both instruction sets at once. This effectively doubles the
27313 amount of available registers, and on chips with separate execution units for
27314 387 and SSE the execution resources too. Use this option with care, as it is
27315 still experimental, because the GCC register allocator does not model separate
27316 functional units well, resulting in unstable performance.
27317 @end table
27318
27319 @item -masm=@var{dialect}
27320 @opindex masm=@var{dialect}
27321 Output assembly instructions using selected @var{dialect}. Also affects
27322 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27323 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27324 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27325 not support @samp{intel}.
27326
27327 @item -mieee-fp
27328 @itemx -mno-ieee-fp
27329 @opindex mieee-fp
27330 @opindex mno-ieee-fp
27331 Control whether or not the compiler uses IEEE floating-point
27332 comparisons. These correctly handle the case where the result of a
27333 comparison is unordered.
27334
27335 @item -m80387
27336 @itemx -mhard-float
27337 @opindex 80387
27338 @opindex mhard-float
27339 Generate output containing 80387 instructions for floating point.
27340
27341 @item -mno-80387
27342 @itemx -msoft-float
27343 @opindex no-80387
27344 @opindex msoft-float
27345 Generate output containing library calls for floating point.
27346
27347 @strong{Warning:} the requisite libraries are not part of GCC@.
27348 Normally the facilities of the machine's usual C compiler are used, but
27349 this cannot be done directly in cross-compilation. You must make your
27350 own arrangements to provide suitable library functions for
27351 cross-compilation.
27352
27353 On machines where a function returns floating-point results in the 80387
27354 register stack, some floating-point opcodes may be emitted even if
27355 @option{-msoft-float} is used.
27356
27357 @item -mno-fp-ret-in-387
27358 @opindex mno-fp-ret-in-387
27359 @opindex mfp-ret-in-387
27360 Do not use the FPU registers for return values of functions.
27361
27362 The usual calling convention has functions return values of types
27363 @code{float} and @code{double} in an FPU register, even if there
27364 is no FPU@. The idea is that the operating system should emulate
27365 an FPU@.
27366
27367 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27368 in ordinary CPU registers instead.
27369
27370 @item -mno-fancy-math-387
27371 @opindex mno-fancy-math-387
27372 @opindex mfancy-math-387
27373 Some 387 emulators do not support the @code{sin}, @code{cos} and
27374 @code{sqrt} instructions for the 387. Specify this option to avoid
27375 generating those instructions.
27376 This option is overridden when @option{-march}
27377 indicates that the target CPU always has an FPU and so the
27378 instruction does not need emulation. These
27379 instructions are not generated unless you also use the
27380 @option{-funsafe-math-optimizations} switch.
27381
27382 @item -malign-double
27383 @itemx -mno-align-double
27384 @opindex malign-double
27385 @opindex mno-align-double
27386 Control whether GCC aligns @code{double}, @code{long double}, and
27387 @code{long long} variables on a two-word boundary or a one-word
27388 boundary. Aligning @code{double} variables on a two-word boundary
27389 produces code that runs somewhat faster on a Pentium at the
27390 expense of more memory.
27391
27392 On x86-64, @option{-malign-double} is enabled by default.
27393
27394 @strong{Warning:} if you use the @option{-malign-double} switch,
27395 structures containing the above types are aligned differently than
27396 the published application binary interface specifications for the x86-32
27397 and are not binary compatible with structures in code compiled
27398 without that switch.
27399
27400 @item -m96bit-long-double
27401 @itemx -m128bit-long-double
27402 @opindex m96bit-long-double
27403 @opindex m128bit-long-double
27404 These switches control the size of @code{long double} type. The x86-32
27405 application binary interface specifies the size to be 96 bits,
27406 so @option{-m96bit-long-double} is the default in 32-bit mode.
27407
27408 Modern architectures (Pentium and newer) prefer @code{long double}
27409 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27410 conforming to the ABI, this is not possible. So specifying
27411 @option{-m128bit-long-double} aligns @code{long double}
27412 to a 16-byte boundary by padding the @code{long double} with an additional
27413 32-bit zero.
27414
27415 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27416 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27417
27418 Notice that neither of these options enable any extra precision over the x87
27419 standard of 80 bits for a @code{long double}.
27420
27421 @strong{Warning:} if you override the default value for your target ABI, this
27422 changes the size of
27423 structures and arrays containing @code{long double} variables,
27424 as well as modifying the function calling convention for functions taking
27425 @code{long double}. Hence they are not binary-compatible
27426 with code compiled without that switch.
27427
27428 @item -mlong-double-64
27429 @itemx -mlong-double-80
27430 @itemx -mlong-double-128
27431 @opindex mlong-double-64
27432 @opindex mlong-double-80
27433 @opindex mlong-double-128
27434 These switches control the size of @code{long double} type. A size
27435 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27436 type. This is the default for 32-bit Bionic C library. A size
27437 of 128 bits makes the @code{long double} type equivalent to the
27438 @code{__float128} type. This is the default for 64-bit Bionic C library.
27439
27440 @strong{Warning:} if you override the default value for your target ABI, this
27441 changes the size of
27442 structures and arrays containing @code{long double} variables,
27443 as well as modifying the function calling convention for functions taking
27444 @code{long double}. Hence they are not binary-compatible
27445 with code compiled without that switch.
27446
27447 @item -malign-data=@var{type}
27448 @opindex malign-data
27449 Control how GCC aligns variables. Supported values for @var{type} are
27450 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27451 and earlier, @samp{abi} uses alignment value as specified by the
27452 psABI, and @samp{cacheline} uses increased alignment value to match
27453 the cache line size. @samp{compat} is the default.
27454
27455 @item -mlarge-data-threshold=@var{threshold}
27456 @opindex mlarge-data-threshold
27457 When @option{-mcmodel=medium} is specified, data objects larger than
27458 @var{threshold} are placed in the large data section. This value must be the
27459 same across all objects linked into the binary, and defaults to 65535.
27460
27461 @item -mrtd
27462 @opindex mrtd
27463 Use a different function-calling convention, in which functions that
27464 take a fixed number of arguments return with the @code{ret @var{num}}
27465 instruction, which pops their arguments while returning. This saves one
27466 instruction in the caller since there is no need to pop the arguments
27467 there.
27468
27469 You can specify that an individual function is called with this calling
27470 sequence with the function attribute @code{stdcall}. You can also
27471 override the @option{-mrtd} option by using the function attribute
27472 @code{cdecl}. @xref{Function Attributes}.
27473
27474 @strong{Warning:} this calling convention is incompatible with the one
27475 normally used on Unix, so you cannot use it if you need to call
27476 libraries compiled with the Unix compiler.
27477
27478 Also, you must provide function prototypes for all functions that
27479 take variable numbers of arguments (including @code{printf});
27480 otherwise incorrect code is generated for calls to those
27481 functions.
27482
27483 In addition, seriously incorrect code results if you call a
27484 function with too many arguments. (Normally, extra arguments are
27485 harmlessly ignored.)
27486
27487 @item -mregparm=@var{num}
27488 @opindex mregparm
27489 Control how many registers are used to pass integer arguments. By
27490 default, no registers are used to pass arguments, and at most 3
27491 registers can be used. You can control this behavior for a specific
27492 function by using the function attribute @code{regparm}.
27493 @xref{Function Attributes}.
27494
27495 @strong{Warning:} if you use this switch, and
27496 @var{num} is nonzero, then you must build all modules with the same
27497 value, including any libraries. This includes the system libraries and
27498 startup modules.
27499
27500 @item -msseregparm
27501 @opindex msseregparm
27502 Use SSE register passing conventions for float and double arguments
27503 and return values. You can control this behavior for a specific
27504 function by using the function attribute @code{sseregparm}.
27505 @xref{Function Attributes}.
27506
27507 @strong{Warning:} if you use this switch then you must build all
27508 modules with the same value, including any libraries. This includes
27509 the system libraries and startup modules.
27510
27511 @item -mvect8-ret-in-mem
27512 @opindex mvect8-ret-in-mem
27513 Return 8-byte vectors in memory instead of MMX registers. This is the
27514 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27515 Studio compilers until version 12. Later compiler versions (starting
27516 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27517 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27518 you need to remain compatible with existing code produced by those
27519 previous compiler versions or older versions of GCC@.
27520
27521 @item -mpc32
27522 @itemx -mpc64
27523 @itemx -mpc80
27524 @opindex mpc32
27525 @opindex mpc64
27526 @opindex mpc80
27527
27528 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27529 is specified, the significands of results of floating-point operations are
27530 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27531 significands of results of floating-point operations to 53 bits (double
27532 precision) and @option{-mpc80} rounds the significands of results of
27533 floating-point operations to 64 bits (extended double precision), which is
27534 the default. When this option is used, floating-point operations in higher
27535 precisions are not available to the programmer without setting the FPU
27536 control word explicitly.
27537
27538 Setting the rounding of floating-point operations to less than the default
27539 80 bits can speed some programs by 2% or more. Note that some mathematical
27540 libraries assume that extended-precision (80-bit) floating-point operations
27541 are enabled by default; routines in such libraries could suffer significant
27542 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27543 when this option is used to set the precision to less than extended precision.
27544
27545 @item -mstackrealign
27546 @opindex mstackrealign
27547 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27548 option generates an alternate prologue and epilogue that realigns the
27549 run-time stack if necessary. This supports mixing legacy codes that keep
27550 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27551 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27552 applicable to individual functions.
27553
27554 @item -mpreferred-stack-boundary=@var{num}
27555 @opindex mpreferred-stack-boundary
27556 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27557 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27558 the default is 4 (16 bytes or 128 bits).
27559
27560 @strong{Warning:} When generating code for the x86-64 architecture with
27561 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27562 used to keep the stack boundary aligned to 8 byte boundary. Since
27563 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27564 intended to be used in controlled environment where stack space is
27565 important limitation. This option leads to wrong code when functions
27566 compiled with 16 byte stack alignment (such as functions from a standard
27567 library) are called with misaligned stack. In this case, SSE
27568 instructions may lead to misaligned memory access traps. In addition,
27569 variable arguments are handled incorrectly for 16 byte aligned
27570 objects (including x87 long double and __int128), leading to wrong
27571 results. You must build all modules with
27572 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27573 includes the system libraries and startup modules.
27574
27575 @item -mincoming-stack-boundary=@var{num}
27576 @opindex mincoming-stack-boundary
27577 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27578 boundary. If @option{-mincoming-stack-boundary} is not specified,
27579 the one specified by @option{-mpreferred-stack-boundary} is used.
27580
27581 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27582 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27583 suffer significant run time performance penalties. On Pentium III, the
27584 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27585 properly if it is not 16-byte aligned.
27586
27587 To ensure proper alignment of this values on the stack, the stack boundary
27588 must be as aligned as that required by any value stored on the stack.
27589 Further, every function must be generated such that it keeps the stack
27590 aligned. Thus calling a function compiled with a higher preferred
27591 stack boundary from a function compiled with a lower preferred stack
27592 boundary most likely misaligns the stack. It is recommended that
27593 libraries that use callbacks always use the default setting.
27594
27595 This extra alignment does consume extra stack space, and generally
27596 increases code size. Code that is sensitive to stack space usage, such
27597 as embedded systems and operating system kernels, may want to reduce the
27598 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27599
27600 @need 200
27601 @item -mmmx
27602 @opindex mmmx
27603 @need 200
27604 @itemx -msse
27605 @opindex msse
27606 @need 200
27607 @itemx -msse2
27608 @opindex msse2
27609 @need 200
27610 @itemx -msse3
27611 @opindex msse3
27612 @need 200
27613 @itemx -mssse3
27614 @opindex mssse3
27615 @need 200
27616 @itemx -msse4
27617 @opindex msse4
27618 @need 200
27619 @itemx -msse4a
27620 @opindex msse4a
27621 @need 200
27622 @itemx -msse4.1
27623 @opindex msse4.1
27624 @need 200
27625 @itemx -msse4.2
27626 @opindex msse4.2
27627 @need 200
27628 @itemx -mavx
27629 @opindex mavx
27630 @need 200
27631 @itemx -mavx2
27632 @opindex mavx2
27633 @need 200
27634 @itemx -mavx512f
27635 @opindex mavx512f
27636 @need 200
27637 @itemx -mavx512pf
27638 @opindex mavx512pf
27639 @need 200
27640 @itemx -mavx512er
27641 @opindex mavx512er
27642 @need 200
27643 @itemx -mavx512cd
27644 @opindex mavx512cd
27645 @need 200
27646 @itemx -mavx512vl
27647 @opindex mavx512vl
27648 @need 200
27649 @itemx -mavx512bw
27650 @opindex mavx512bw
27651 @need 200
27652 @itemx -mavx512dq
27653 @opindex mavx512dq
27654 @need 200
27655 @itemx -mavx512ifma
27656 @opindex mavx512ifma
27657 @need 200
27658 @itemx -mavx512vbmi
27659 @opindex mavx512vbmi
27660 @need 200
27661 @itemx -msha
27662 @opindex msha
27663 @need 200
27664 @itemx -maes
27665 @opindex maes
27666 @need 200
27667 @itemx -mpclmul
27668 @opindex mpclmul
27669 @need 200
27670 @itemx -mclflushopt
27671 @opindex mclflushopt
27672 @need 200
27673 @itemx -mfsgsbase
27674 @opindex mfsgsbase
27675 @need 200
27676 @itemx -mptwrite
27677 @opindex mptwrite
27678 @need 200
27679 @itemx -mrdrnd
27680 @opindex mrdrnd
27681 @need 200
27682 @itemx -mf16c
27683 @opindex mf16c
27684 @need 200
27685 @itemx -mfma
27686 @opindex mfma
27687 @need 200
27688 @itemx -mpconfig
27689 @opindex mpconfig
27690 @need 200
27691 @itemx -mwbnoinvd
27692 @opindex mwbnoinvd
27693 @need 200
27694 @itemx -mfma4
27695 @opindex mfma4
27696 @need 200
27697 @itemx -mprefetchwt1
27698 @opindex mprefetchwt1
27699 @need 200
27700 @itemx -mxop
27701 @opindex mxop
27702 @need 200
27703 @itemx -mlwp
27704 @opindex mlwp
27705 @need 200
27706 @itemx -m3dnow
27707 @opindex m3dnow
27708 @need 200
27709 @itemx -m3dnowa
27710 @opindex m3dnowa
27711 @need 200
27712 @itemx -mpopcnt
27713 @opindex mpopcnt
27714 @need 200
27715 @itemx -mabm
27716 @opindex mabm
27717 @need 200
27718 @itemx -mbmi
27719 @opindex mbmi
27720 @need 200
27721 @itemx -mbmi2
27722 @need 200
27723 @itemx -mlzcnt
27724 @opindex mlzcnt
27725 @need 200
27726 @itemx -mfxsr
27727 @opindex mfxsr
27728 @need 200
27729 @itemx -mxsave
27730 @opindex mxsave
27731 @need 200
27732 @itemx -mxsaveopt
27733 @opindex mxsaveopt
27734 @need 200
27735 @itemx -mxsavec
27736 @opindex mxsavec
27737 @need 200
27738 @itemx -mxsaves
27739 @opindex mxsaves
27740 @need 200
27741 @itemx -mrtm
27742 @opindex mrtm
27743 @need 200
27744 @itemx -mtbm
27745 @opindex mtbm
27746 @need 200
27747 @itemx -mmwaitx
27748 @opindex mmwaitx
27749 @need 200
27750 @itemx -mclzero
27751 @opindex mclzero
27752 @need 200
27753 @itemx -mpku
27754 @opindex mpku
27755 @need 200
27756 @itemx -mavx512vbmi2
27757 @opindex mavx512vbmi2
27758 @need 200
27759 @itemx -mgfni
27760 @opindex mgfni
27761 @need 200
27762 @itemx -mvaes
27763 @opindex mvaes
27764 @need 200
27765 @itemx -mwaitpkg
27766 @opindex mwaitpkg
27767 @need 200
27768 @itemx -mvpclmulqdq
27769 @opindex mvpclmulqdq
27770 @need 200
27771 @itemx -mavx512bitalg
27772 @opindex mavx512bitalg
27773 @need 200
27774 @itemx -mmovdiri
27775 @opindex mmovdiri
27776 @need 200
27777 @itemx -mmovdir64b
27778 @opindex mmovdir64b
27779 @need 200
27780 @itemx -mavx512vpopcntdq
27781 @opindex mavx512vpopcntdq
27782 @need 200
27783 @itemx -mcldemote
27784 @opindex mcldemote
27785 These switches enable the use of instructions in the MMX, SSE,
27786 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27787 SHA, AES, PCLMUL, FSGSBASE, PTWRITE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27788 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27789 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27790 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27791 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27792 sets. Each has a corresponding @option{-mno-} option to disable use of these
27793 instructions.
27794
27795 These extensions are also available as built-in functions: see
27796 @ref{x86 Built-in Functions}, for details of the functions enabled and
27797 disabled by these switches.
27798
27799 To generate SSE/SSE2 instructions automatically from floating-point
27800 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27801
27802 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27803 generates new AVX instructions or AVX equivalence for all SSEx instructions
27804 when needed.
27805
27806 These options enable GCC to use these extended instructions in
27807 generated code, even without @option{-mfpmath=sse}. Applications that
27808 perform run-time CPU detection must compile separate files for each
27809 supported architecture, using the appropriate flags. In particular,
27810 the file containing the CPU detection code should be compiled without
27811 these options.
27812
27813 @item -mdump-tune-features
27814 @opindex mdump-tune-features
27815 This option instructs GCC to dump the names of the x86 performance
27816 tuning features and default settings. The names can be used in
27817 @option{-mtune-ctrl=@var{feature-list}}.
27818
27819 @item -mtune-ctrl=@var{feature-list}
27820 @opindex mtune-ctrl=@var{feature-list}
27821 This option is used to do fine grain control of x86 code generation features.
27822 @var{feature-list} is a comma separated list of @var{feature} names. See also
27823 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27824 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27825 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27826 developers. Using it may lead to code paths not covered by testing and can
27827 potentially result in compiler ICEs or runtime errors.
27828
27829 @item -mno-default
27830 @opindex mno-default
27831 This option instructs GCC to turn off all tunable features. See also
27832 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27833
27834 @item -mcld
27835 @opindex mcld
27836 This option instructs GCC to emit a @code{cld} instruction in the prologue
27837 of functions that use string instructions. String instructions depend on
27838 the DF flag to select between autoincrement or autodecrement mode. While the
27839 ABI specifies the DF flag to be cleared on function entry, some operating
27840 systems violate this specification by not clearing the DF flag in their
27841 exception dispatchers. The exception handler can be invoked with the DF flag
27842 set, which leads to wrong direction mode when string instructions are used.
27843 This option can be enabled by default on 32-bit x86 targets by configuring
27844 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27845 instructions can be suppressed with the @option{-mno-cld} compiler option
27846 in this case.
27847
27848 @item -mvzeroupper
27849 @opindex mvzeroupper
27850 This option instructs GCC to emit a @code{vzeroupper} instruction
27851 before a transfer of control flow out of the function to minimize
27852 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27853 intrinsics.
27854
27855 @item -mprefer-avx128
27856 @opindex mprefer-avx128
27857 This option instructs GCC to use 128-bit AVX instructions instead of
27858 256-bit AVX instructions in the auto-vectorizer.
27859
27860 @item -mprefer-vector-width=@var{opt}
27861 @opindex mprefer-vector-width
27862 This option instructs GCC to use @var{opt}-bit vector width in instructions
27863 instead of default on the selected platform.
27864
27865 @table @samp
27866 @item none
27867 No extra limitations applied to GCC other than defined by the selected platform.
27868
27869 @item 128
27870 Prefer 128-bit vector width for instructions.
27871
27872 @item 256
27873 Prefer 256-bit vector width for instructions.
27874
27875 @item 512
27876 Prefer 512-bit vector width for instructions.
27877 @end table
27878
27879 @item -mcx16
27880 @opindex mcx16
27881 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27882 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27883 objects. This is useful for atomic updates of data structures exceeding one
27884 machine word in size. The compiler uses this instruction to implement
27885 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27886 128-bit integers, a library call is always used.
27887
27888 @item -msahf
27889 @opindex msahf
27890 This option enables generation of @code{SAHF} instructions in 64-bit code.
27891 Early Intel Pentium 4 CPUs with Intel 64 support,
27892 prior to the introduction of Pentium 4 G1 step in December 2005,
27893 lacked the @code{LAHF} and @code{SAHF} instructions
27894 which are supported by AMD64.
27895 These are load and store instructions, respectively, for certain status flags.
27896 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27897 @code{drem}, and @code{remainder} built-in functions;
27898 see @ref{Other Builtins} for details.
27899
27900 @item -mmovbe
27901 @opindex mmovbe
27902 This option enables use of the @code{movbe} instruction to implement
27903 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27904
27905 @item -mshstk
27906 @opindex mshstk
27907 The @option{-mshstk} option enables shadow stack built-in functions
27908 from x86 Control-flow Enforcement Technology (CET).
27909
27910 @item -mcrc32
27911 @opindex mcrc32
27912 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27913 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27914 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27915
27916 @item -mrecip
27917 @opindex mrecip
27918 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27919 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27920 with an additional Newton-Raphson step
27921 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27922 (and their vectorized
27923 variants) for single-precision floating-point arguments. These instructions
27924 are generated only when @option{-funsafe-math-optimizations} is enabled
27925 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27926 Note that while the throughput of the sequence is higher than the throughput
27927 of the non-reciprocal instruction, the precision of the sequence can be
27928 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
27929
27930 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27931 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27932 combination), and doesn't need @option{-mrecip}.
27933
27934 Also note that GCC emits the above sequence with additional Newton-Raphson step
27935 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27936 already with @option{-ffast-math} (or the above option combination), and
27937 doesn't need @option{-mrecip}.
27938
27939 @item -mrecip=@var{opt}
27940 @opindex mrecip=opt
27941 This option controls which reciprocal estimate instructions
27942 may be used. @var{opt} is a comma-separated list of options, which may
27943 be preceded by a @samp{!} to invert the option:
27944
27945 @table @samp
27946 @item all
27947 Enable all estimate instructions.
27948
27949 @item default
27950 Enable the default instructions, equivalent to @option{-mrecip}.
27951
27952 @item none
27953 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27954
27955 @item div
27956 Enable the approximation for scalar division.
27957
27958 @item vec-div
27959 Enable the approximation for vectorized division.
27960
27961 @item sqrt
27962 Enable the approximation for scalar square root.
27963
27964 @item vec-sqrt
27965 Enable the approximation for vectorized square root.
27966 @end table
27967
27968 So, for example, @option{-mrecip=all,!sqrt} enables
27969 all of the reciprocal approximations, except for square root.
27970
27971 @item -mveclibabi=@var{type}
27972 @opindex mveclibabi
27973 Specifies the ABI type to use for vectorizing intrinsics using an
27974 external library. Supported values for @var{type} are @samp{svml}
27975 for the Intel short
27976 vector math library and @samp{acml} for the AMD math core library.
27977 To use this option, both @option{-ftree-vectorize} and
27978 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27979 ABI-compatible library must be specified at link time.
27980
27981 GCC currently emits calls to @code{vmldExp2},
27982 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
27983 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27984 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27985 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27986 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
27987 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27988 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27989 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27990 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27991 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27992 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27993 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27994 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27995 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27996 when @option{-mveclibabi=acml} is used.
27997
27998 @item -mabi=@var{name}
27999 @opindex mabi
28000 Generate code for the specified calling convention. Permissible values
28001 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28002 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28003 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28004 You can control this behavior for specific functions by
28005 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28006 @xref{Function Attributes}.
28007
28008 @item -mforce-indirect-call
28009 @opindex mforce-indirect-call
28010 Force all calls to functions to be indirect. This is useful
28011 when using Intel Processor Trace where it generates more precise timing
28012 information for function calls.
28013
28014 @item -mmanual-endbr
28015 @opindex mmanual-endbr
28016 Insert ENDBR instruction at function entry only via the @code{cf_check}
28017 function attribute. This is useful when used with the option
28018 @option{-fcf-protection=branch} to control ENDBR insertion at the
28019 function entry.
28020
28021 @item -mcall-ms2sysv-xlogues
28022 @opindex mcall-ms2sysv-xlogues
28023 @opindex mno-call-ms2sysv-xlogues
28024 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28025 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28026 default, the code for saving and restoring these registers is emitted inline,
28027 resulting in fairly lengthy prologues and epilogues. Using
28028 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28029 use stubs in the static portion of libgcc to perform these saves and restores,
28030 thus reducing function size at the cost of a few extra instructions.
28031
28032 @item -mtls-dialect=@var{type}
28033 @opindex mtls-dialect
28034 Generate code to access thread-local storage using the @samp{gnu} or
28035 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28036 @samp{gnu2} is more efficient, but it may add compile- and run-time
28037 requirements that cannot be satisfied on all systems.
28038
28039 @item -mpush-args
28040 @itemx -mno-push-args
28041 @opindex mpush-args
28042 @opindex mno-push-args
28043 Use PUSH operations to store outgoing parameters. This method is shorter
28044 and usually equally fast as method using SUB/MOV operations and is enabled
28045 by default. In some cases disabling it may improve performance because of
28046 improved scheduling and reduced dependencies.
28047
28048 @item -maccumulate-outgoing-args
28049 @opindex maccumulate-outgoing-args
28050 If enabled, the maximum amount of space required for outgoing arguments is
28051 computed in the function prologue. This is faster on most modern CPUs
28052 because of reduced dependencies, improved scheduling and reduced stack usage
28053 when the preferred stack boundary is not equal to 2. The drawback is a notable
28054 increase in code size. This switch implies @option{-mno-push-args}.
28055
28056 @item -mthreads
28057 @opindex mthreads
28058 Support thread-safe exception handling on MinGW. Programs that rely
28059 on thread-safe exception handling must compile and link all code with the
28060 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28061 @option{-D_MT}; when linking, it links in a special thread helper library
28062 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28063
28064 @item -mms-bitfields
28065 @itemx -mno-ms-bitfields
28066 @opindex mms-bitfields
28067 @opindex mno-ms-bitfields
28068
28069 Enable/disable bit-field layout compatible with the native Microsoft
28070 Windows compiler.
28071
28072 If @code{packed} is used on a structure, or if bit-fields are used,
28073 it may be that the Microsoft ABI lays out the structure differently
28074 than the way GCC normally does. Particularly when moving packed
28075 data between functions compiled with GCC and the native Microsoft compiler
28076 (either via function call or as data in a file), it may be necessary to access
28077 either format.
28078
28079 This option is enabled by default for Microsoft Windows
28080 targets. This behavior can also be controlled locally by use of variable
28081 or type attributes. For more information, see @ref{x86 Variable Attributes}
28082 and @ref{x86 Type Attributes}.
28083
28084 The Microsoft structure layout algorithm is fairly simple with the exception
28085 of the bit-field packing.
28086 The padding and alignment of members of structures and whether a bit-field
28087 can straddle a storage-unit boundary are determine by these rules:
28088
28089 @enumerate
28090 @item Structure members are stored sequentially in the order in which they are
28091 declared: the first member has the lowest memory address and the last member
28092 the highest.
28093
28094 @item Every data object has an alignment requirement. The alignment requirement
28095 for all data except structures, unions, and arrays is either the size of the
28096 object or the current packing size (specified with either the
28097 @code{aligned} attribute or the @code{pack} pragma),
28098 whichever is less. For structures, unions, and arrays,
28099 the alignment requirement is the largest alignment requirement of its members.
28100 Every object is allocated an offset so that:
28101
28102 @smallexample
28103 offset % alignment_requirement == 0
28104 @end smallexample
28105
28106 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28107 unit if the integral types are the same size and if the next bit-field fits
28108 into the current allocation unit without crossing the boundary imposed by the
28109 common alignment requirements of the bit-fields.
28110 @end enumerate
28111
28112 MSVC interprets zero-length bit-fields in the following ways:
28113
28114 @enumerate
28115 @item If a zero-length bit-field is inserted between two bit-fields that
28116 are normally coalesced, the bit-fields are not coalesced.
28117
28118 For example:
28119
28120 @smallexample
28121 struct
28122 @{
28123 unsigned long bf_1 : 12;
28124 unsigned long : 0;
28125 unsigned long bf_2 : 12;
28126 @} t1;
28127 @end smallexample
28128
28129 @noindent
28130 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28131 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28132
28133 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28134 alignment of the zero-length bit-field is greater than the member that follows it,
28135 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28136
28137 For example:
28138
28139 @smallexample
28140 struct
28141 @{
28142 char foo : 4;
28143 short : 0;
28144 char bar;
28145 @} t2;
28146
28147 struct
28148 @{
28149 char foo : 4;
28150 short : 0;
28151 double bar;
28152 @} t3;
28153 @end smallexample
28154
28155 @noindent
28156 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28157 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28158 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28159 of the structure.
28160
28161 Taking this into account, it is important to note the following:
28162
28163 @enumerate
28164 @item If a zero-length bit-field follows a normal bit-field, the type of the
28165 zero-length bit-field may affect the alignment of the structure as whole. For
28166 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28167 normal bit-field, and is of type short.
28168
28169 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28170 still affect the alignment of the structure:
28171
28172 @smallexample
28173 struct
28174 @{
28175 char foo : 6;
28176 long : 0;
28177 @} t4;
28178 @end smallexample
28179
28180 @noindent
28181 Here, @code{t4} takes up 4 bytes.
28182 @end enumerate
28183
28184 @item Zero-length bit-fields following non-bit-field members are ignored:
28185
28186 @smallexample
28187 struct
28188 @{
28189 char foo;
28190 long : 0;
28191 char bar;
28192 @} t5;
28193 @end smallexample
28194
28195 @noindent
28196 Here, @code{t5} takes up 2 bytes.
28197 @end enumerate
28198
28199
28200 @item -mno-align-stringops
28201 @opindex mno-align-stringops
28202 @opindex malign-stringops
28203 Do not align the destination of inlined string operations. This switch reduces
28204 code size and improves performance in case the destination is already aligned,
28205 but GCC doesn't know about it.
28206
28207 @item -minline-all-stringops
28208 @opindex minline-all-stringops
28209 By default GCC inlines string operations only when the destination is
28210 known to be aligned to least a 4-byte boundary.
28211 This enables more inlining and increases code
28212 size, but may improve performance of code that depends on fast
28213 @code{memcpy}, @code{strlen},
28214 and @code{memset} for short lengths.
28215
28216 @item -minline-stringops-dynamically
28217 @opindex minline-stringops-dynamically
28218 For string operations of unknown size, use run-time checks with
28219 inline code for small blocks and a library call for large blocks.
28220
28221 @item -mstringop-strategy=@var{alg}
28222 @opindex mstringop-strategy=@var{alg}
28223 Override the internal decision heuristic for the particular algorithm to use
28224 for inlining string operations. The allowed values for @var{alg} are:
28225
28226 @table @samp
28227 @item rep_byte
28228 @itemx rep_4byte
28229 @itemx rep_8byte
28230 Expand using i386 @code{rep} prefix of the specified size.
28231
28232 @item byte_loop
28233 @itemx loop
28234 @itemx unrolled_loop
28235 Expand into an inline loop.
28236
28237 @item libcall
28238 Always use a library call.
28239 @end table
28240
28241 @item -mmemcpy-strategy=@var{strategy}
28242 @opindex mmemcpy-strategy=@var{strategy}
28243 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28244 should be inlined and what inline algorithm to use when the expected size
28245 of the copy operation is known. @var{strategy}
28246 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28247 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28248 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28249 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28250 in the list must be specified in increasing order. The minimal byte size for
28251 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28252 preceding range.
28253
28254 @item -mmemset-strategy=@var{strategy}
28255 @opindex mmemset-strategy=@var{strategy}
28256 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28257 @code{__builtin_memset} expansion.
28258
28259 @item -momit-leaf-frame-pointer
28260 @opindex momit-leaf-frame-pointer
28261 Don't keep the frame pointer in a register for leaf functions. This
28262 avoids the instructions to save, set up, and restore frame pointers and
28263 makes an extra register available in leaf functions. The option
28264 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28265 which might make debugging harder.
28266
28267 @item -mtls-direct-seg-refs
28268 @itemx -mno-tls-direct-seg-refs
28269 @opindex mtls-direct-seg-refs
28270 Controls whether TLS variables may be accessed with offsets from the
28271 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28272 or whether the thread base pointer must be added. Whether or not this
28273 is valid depends on the operating system, and whether it maps the
28274 segment to cover the entire TLS area.
28275
28276 For systems that use the GNU C Library, the default is on.
28277
28278 @item -msse2avx
28279 @itemx -mno-sse2avx
28280 @opindex msse2avx
28281 Specify that the assembler should encode SSE instructions with VEX
28282 prefix. The option @option{-mavx} turns this on by default.
28283
28284 @item -mfentry
28285 @itemx -mno-fentry
28286 @opindex mfentry
28287 If profiling is active (@option{-pg}), put the profiling
28288 counter call before the prologue.
28289 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28290 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28291
28292 @item -mrecord-mcount
28293 @itemx -mno-record-mcount
28294 @opindex mrecord-mcount
28295 If profiling is active (@option{-pg}), generate a __mcount_loc section
28296 that contains pointers to each profiling call. This is useful for
28297 automatically patching and out calls.
28298
28299 @item -mnop-mcount
28300 @itemx -mno-nop-mcount
28301 @opindex mnop-mcount
28302 If profiling is active (@option{-pg}), generate the calls to
28303 the profiling functions as NOPs. This is useful when they
28304 should be patched in later dynamically. This is likely only
28305 useful together with @option{-mrecord-mcount}.
28306
28307 @item -minstrument-return=@var{type}
28308 @opindex minstrument-return
28309 Instrument function exit in -pg -mfentry instrumented functions with
28310 call to specified function. This only instruments true returns ending
28311 with ret, but not sibling calls ending with jump. Valid types
28312 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28313 or @var{nop5} to generate a 5 byte nop.
28314
28315 @item -mrecord-return
28316 @itemx -mno-record-return
28317 @opindex mrecord-return
28318 Generate a __return_loc section pointing to all return instrumentation code.
28319
28320 @item -mfentry-name=@var{name}
28321 @opindex mfentry-name
28322 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28323
28324 @item -mfentry-section=@var{name}
28325 @opindex mfentry-section
28326 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28327
28328 @item -mskip-rax-setup
28329 @itemx -mno-skip-rax-setup
28330 @opindex mskip-rax-setup
28331 When generating code for the x86-64 architecture with SSE extensions
28332 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28333 register when there are no variable arguments passed in vector registers.
28334
28335 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28336 saving vector registers on stack when passing variable arguments, the
28337 impacts of this option are callees may waste some stack space,
28338 misbehave or jump to a random location. GCC 4.4 or newer don't have
28339 those issues, regardless the RAX register value.
28340
28341 @item -m8bit-idiv
28342 @itemx -mno-8bit-idiv
28343 @opindex m8bit-idiv
28344 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28345 much faster than 32-bit/64-bit integer divide. This option generates a
28346 run-time check. If both dividend and divisor are within range of 0
28347 to 255, 8-bit unsigned integer divide is used instead of
28348 32-bit/64-bit integer divide.
28349
28350 @item -mavx256-split-unaligned-load
28351 @itemx -mavx256-split-unaligned-store
28352 @opindex mavx256-split-unaligned-load
28353 @opindex mavx256-split-unaligned-store
28354 Split 32-byte AVX unaligned load and store.
28355
28356 @item -mstack-protector-guard=@var{guard}
28357 @itemx -mstack-protector-guard-reg=@var{reg}
28358 @itemx -mstack-protector-guard-offset=@var{offset}
28359 @opindex mstack-protector-guard
28360 @opindex mstack-protector-guard-reg
28361 @opindex mstack-protector-guard-offset
28362 Generate stack protection code using canary at @var{guard}. Supported
28363 locations are @samp{global} for global canary or @samp{tls} for per-thread
28364 canary in the TLS block (the default). This option has effect only when
28365 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28366
28367 With the latter choice the options
28368 @option{-mstack-protector-guard-reg=@var{reg}} and
28369 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28370 which segment register (@code{%fs} or @code{%gs}) to use as base register
28371 for reading the canary, and from what offset from that base register.
28372 The default for those is as specified in the relevant ABI.
28373
28374 @item -mgeneral-regs-only
28375 @opindex mgeneral-regs-only
28376 Generate code that uses only the general-purpose registers. This
28377 prevents the compiler from using floating-point, vector, mask and bound
28378 registers.
28379
28380 @item -mindirect-branch=@var{choice}
28381 @opindex mindirect-branch
28382 Convert indirect call and jump with @var{choice}. The default is
28383 @samp{keep}, which keeps indirect call and jump unmodified.
28384 @samp{thunk} converts indirect call and jump to call and return thunk.
28385 @samp{thunk-inline} converts indirect call and jump to inlined call
28386 and return thunk. @samp{thunk-extern} converts indirect call and jump
28387 to external call and return thunk provided in a separate object file.
28388 You can control this behavior for a specific function by using the
28389 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28390
28391 Note that @option{-mcmodel=large} is incompatible with
28392 @option{-mindirect-branch=thunk} and
28393 @option{-mindirect-branch=thunk-extern} since the thunk function may
28394 not be reachable in the large code model.
28395
28396 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28397 @option{-fcf-protection=branch} since the external thunk can not be modified
28398 to disable control-flow check.
28399
28400 @item -mfunction-return=@var{choice}
28401 @opindex mfunction-return
28402 Convert function return with @var{choice}. The default is @samp{keep},
28403 which keeps function return unmodified. @samp{thunk} converts function
28404 return to call and return thunk. @samp{thunk-inline} converts function
28405 return to inlined call and return thunk. @samp{thunk-extern} converts
28406 function return to external call and return thunk provided in a separate
28407 object file. You can control this behavior for a specific function by
28408 using the function attribute @code{function_return}.
28409 @xref{Function Attributes}.
28410
28411 Note that @option{-mcmodel=large} is incompatible with
28412 @option{-mfunction-return=thunk} and
28413 @option{-mfunction-return=thunk-extern} since the thunk function may
28414 not be reachable in the large code model.
28415
28416
28417 @item -mindirect-branch-register
28418 @opindex mindirect-branch-register
28419 Force indirect call and jump via register.
28420
28421 @end table
28422
28423 These @samp{-m} switches are supported in addition to the above
28424 on x86-64 processors in 64-bit environments.
28425
28426 @table @gcctabopt
28427 @item -m32
28428 @itemx -m64
28429 @itemx -mx32
28430 @itemx -m16
28431 @itemx -miamcu
28432 @opindex m32
28433 @opindex m64
28434 @opindex mx32
28435 @opindex m16
28436 @opindex miamcu
28437 Generate code for a 16-bit, 32-bit or 64-bit environment.
28438 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28439 to 32 bits, and
28440 generates code that runs on any i386 system.
28441
28442 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28443 types to 64 bits, and generates code for the x86-64 architecture.
28444 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28445 and @option{-mdynamic-no-pic} options.
28446
28447 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28448 to 32 bits, and
28449 generates code for the x86-64 architecture.
28450
28451 The @option{-m16} option is the same as @option{-m32}, except for that
28452 it outputs the @code{.code16gcc} assembly directive at the beginning of
28453 the assembly output so that the binary can run in 16-bit mode.
28454
28455 The @option{-miamcu} option generates code which conforms to Intel MCU
28456 psABI. It requires the @option{-m32} option to be turned on.
28457
28458 @item -mno-red-zone
28459 @opindex mno-red-zone
28460 @opindex mred-zone
28461 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28462 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28463 stack pointer that is not modified by signal or interrupt handlers
28464 and therefore can be used for temporary data without adjusting the stack
28465 pointer. The flag @option{-mno-red-zone} disables this red zone.
28466
28467 @item -mcmodel=small
28468 @opindex mcmodel=small
28469 Generate code for the small code model: the program and its symbols must
28470 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28471 Programs can be statically or dynamically linked. This is the default
28472 code model.
28473
28474 @item -mcmodel=kernel
28475 @opindex mcmodel=kernel
28476 Generate code for the kernel code model. The kernel runs in the
28477 negative 2 GB of the address space.
28478 This model has to be used for Linux kernel code.
28479
28480 @item -mcmodel=medium
28481 @opindex mcmodel=medium
28482 Generate code for the medium model: the program is linked in the lower 2
28483 GB of the address space. Small symbols are also placed there. Symbols
28484 with sizes larger than @option{-mlarge-data-threshold} are put into
28485 large data or BSS sections and can be located above 2GB. Programs can
28486 be statically or dynamically linked.
28487
28488 @item -mcmodel=large
28489 @opindex mcmodel=large
28490 Generate code for the large model. This model makes no assumptions
28491 about addresses and sizes of sections.
28492
28493 @item -maddress-mode=long
28494 @opindex maddress-mode=long
28495 Generate code for long address mode. This is only supported for 64-bit
28496 and x32 environments. It is the default address mode for 64-bit
28497 environments.
28498
28499 @item -maddress-mode=short
28500 @opindex maddress-mode=short
28501 Generate code for short address mode. This is only supported for 32-bit
28502 and x32 environments. It is the default address mode for 32-bit and
28503 x32 environments.
28504 @end table
28505
28506 @node x86 Windows Options
28507 @subsection x86 Windows Options
28508 @cindex x86 Windows Options
28509 @cindex Windows Options for x86
28510
28511 These additional options are available for Microsoft Windows targets:
28512
28513 @table @gcctabopt
28514 @item -mconsole
28515 @opindex mconsole
28516 This option
28517 specifies that a console application is to be generated, by
28518 instructing the linker to set the PE header subsystem type
28519 required for console applications.
28520 This option is available for Cygwin and MinGW targets and is
28521 enabled by default on those targets.
28522
28523 @item -mdll
28524 @opindex mdll
28525 This option is available for Cygwin and MinGW targets. It
28526 specifies that a DLL---a dynamic link library---is to be
28527 generated, enabling the selection of the required runtime
28528 startup object and entry point.
28529
28530 @item -mnop-fun-dllimport
28531 @opindex mnop-fun-dllimport
28532 This option is available for Cygwin and MinGW targets. It
28533 specifies that the @code{dllimport} attribute should be ignored.
28534
28535 @item -mthread
28536 @opindex mthread
28537 This option is available for MinGW targets. It specifies
28538 that MinGW-specific thread support is to be used.
28539
28540 @item -municode
28541 @opindex municode
28542 This option is available for MinGW-w64 targets. It causes
28543 the @code{UNICODE} preprocessor macro to be predefined, and
28544 chooses Unicode-capable runtime startup code.
28545
28546 @item -mwin32
28547 @opindex mwin32
28548 This option is available for Cygwin and MinGW targets. It
28549 specifies that the typical Microsoft Windows predefined macros are to
28550 be set in the pre-processor, but does not influence the choice
28551 of runtime library/startup code.
28552
28553 @item -mwindows
28554 @opindex mwindows
28555 This option is available for Cygwin and MinGW targets. It
28556 specifies that a GUI application is to be generated by
28557 instructing the linker to set the PE header subsystem type
28558 appropriately.
28559
28560 @item -fno-set-stack-executable
28561 @opindex fno-set-stack-executable
28562 @opindex fset-stack-executable
28563 This option is available for MinGW targets. It specifies that
28564 the executable flag for the stack used by nested functions isn't
28565 set. This is necessary for binaries running in kernel mode of
28566 Microsoft Windows, as there the User32 API, which is used to set executable
28567 privileges, isn't available.
28568
28569 @item -fwritable-relocated-rdata
28570 @opindex fno-writable-relocated-rdata
28571 @opindex fwritable-relocated-rdata
28572 This option is available for MinGW and Cygwin targets. It specifies
28573 that relocated-data in read-only section is put into the @code{.data}
28574 section. This is a necessary for older runtimes not supporting
28575 modification of @code{.rdata} sections for pseudo-relocation.
28576
28577 @item -mpe-aligned-commons
28578 @opindex mpe-aligned-commons
28579 This option is available for Cygwin and MinGW targets. It
28580 specifies that the GNU extension to the PE file format that
28581 permits the correct alignment of COMMON variables should be
28582 used when generating code. It is enabled by default if
28583 GCC detects that the target assembler found during configuration
28584 supports the feature.
28585 @end table
28586
28587 See also under @ref{x86 Options} for standard options.
28588
28589 @node Xstormy16 Options
28590 @subsection Xstormy16 Options
28591 @cindex Xstormy16 Options
28592
28593 These options are defined for Xstormy16:
28594
28595 @table @gcctabopt
28596 @item -msim
28597 @opindex msim
28598 Choose startup files and linker script suitable for the simulator.
28599 @end table
28600
28601 @node Xtensa Options
28602 @subsection Xtensa Options
28603 @cindex Xtensa Options
28604
28605 These options are supported for Xtensa targets:
28606
28607 @table @gcctabopt
28608 @item -mconst16
28609 @itemx -mno-const16
28610 @opindex mconst16
28611 @opindex mno-const16
28612 Enable or disable use of @code{CONST16} instructions for loading
28613 constant values. The @code{CONST16} instruction is currently not a
28614 standard option from Tensilica. When enabled, @code{CONST16}
28615 instructions are always used in place of the standard @code{L32R}
28616 instructions. The use of @code{CONST16} is enabled by default only if
28617 the @code{L32R} instruction is not available.
28618
28619 @item -mfused-madd
28620 @itemx -mno-fused-madd
28621 @opindex mfused-madd
28622 @opindex mno-fused-madd
28623 Enable or disable use of fused multiply/add and multiply/subtract
28624 instructions in the floating-point option. This has no effect if the
28625 floating-point option is not also enabled. Disabling fused multiply/add
28626 and multiply/subtract instructions forces the compiler to use separate
28627 instructions for the multiply and add/subtract operations. This may be
28628 desirable in some cases where strict IEEE 754-compliant results are
28629 required: the fused multiply add/subtract instructions do not round the
28630 intermediate result, thereby producing results with @emph{more} bits of
28631 precision than specified by the IEEE standard. Disabling fused multiply
28632 add/subtract instructions also ensures that the program output is not
28633 sensitive to the compiler's ability to combine multiply and add/subtract
28634 operations.
28635
28636 @item -mserialize-volatile
28637 @itemx -mno-serialize-volatile
28638 @opindex mserialize-volatile
28639 @opindex mno-serialize-volatile
28640 When this option is enabled, GCC inserts @code{MEMW} instructions before
28641 @code{volatile} memory references to guarantee sequential consistency.
28642 The default is @option{-mserialize-volatile}. Use
28643 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28644
28645 @item -mforce-no-pic
28646 @opindex mforce-no-pic
28647 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28648 position-independent code (PIC), this option disables PIC for compiling
28649 kernel code.
28650
28651 @item -mtext-section-literals
28652 @itemx -mno-text-section-literals
28653 @opindex mtext-section-literals
28654 @opindex mno-text-section-literals
28655 These options control the treatment of literal pools. The default is
28656 @option{-mno-text-section-literals}, which places literals in a separate
28657 section in the output file. This allows the literal pool to be placed
28658 in a data RAM/ROM, and it also allows the linker to combine literal
28659 pools from separate object files to remove redundant literals and
28660 improve code size. With @option{-mtext-section-literals}, the literals
28661 are interspersed in the text section in order to keep them as close as
28662 possible to their references. This may be necessary for large assembly
28663 files. Literals for each function are placed right before that function.
28664
28665 @item -mauto-litpools
28666 @itemx -mno-auto-litpools
28667 @opindex mauto-litpools
28668 @opindex mno-auto-litpools
28669 These options control the treatment of literal pools. The default is
28670 @option{-mno-auto-litpools}, which places literals in a separate
28671 section in the output file unless @option{-mtext-section-literals} is
28672 used. With @option{-mauto-litpools} the literals are interspersed in
28673 the text section by the assembler. Compiler does not produce explicit
28674 @code{.literal} directives and loads literals into registers with
28675 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28676 do relaxation and place literals as necessary. This option allows
28677 assembler to create several literal pools per function and assemble
28678 very big functions, which may not be possible with
28679 @option{-mtext-section-literals}.
28680
28681 @item -mtarget-align
28682 @itemx -mno-target-align
28683 @opindex mtarget-align
28684 @opindex mno-target-align
28685 When this option is enabled, GCC instructs the assembler to
28686 automatically align instructions to reduce branch penalties at the
28687 expense of some code density. The assembler attempts to widen density
28688 instructions to align branch targets and the instructions following call
28689 instructions. If there are not enough preceding safe density
28690 instructions to align a target, no widening is performed. The
28691 default is @option{-mtarget-align}. These options do not affect the
28692 treatment of auto-aligned instructions like @code{LOOP}, which the
28693 assembler always aligns, either by widening density instructions or
28694 by inserting NOP instructions.
28695
28696 @item -mlongcalls
28697 @itemx -mno-longcalls
28698 @opindex mlongcalls
28699 @opindex mno-longcalls
28700 When this option is enabled, GCC instructs the assembler to translate
28701 direct calls to indirect calls unless it can determine that the target
28702 of a direct call is in the range allowed by the call instruction. This
28703 translation typically occurs for calls to functions in other source
28704 files. Specifically, the assembler translates a direct @code{CALL}
28705 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28706 The default is @option{-mno-longcalls}. This option should be used in
28707 programs where the call target can potentially be out of range. This
28708 option is implemented in the assembler, not the compiler, so the
28709 assembly code generated by GCC still shows direct call
28710 instructions---look at the disassembled object code to see the actual
28711 instructions. Note that the assembler uses an indirect call for
28712 every cross-file call, not just those that really are out of range.
28713 @end table
28714
28715 @node zSeries Options
28716 @subsection zSeries Options
28717 @cindex zSeries options
28718
28719 These are listed under @xref{S/390 and zSeries Options}.
28720
28721
28722 @c man end
28723
28724 @node Spec Files
28725 @section Specifying Subprocesses and the Switches to Pass to Them
28726 @cindex Spec Files
28727
28728 @command{gcc} is a driver program. It performs its job by invoking a
28729 sequence of other programs to do the work of compiling, assembling and
28730 linking. GCC interprets its command-line parameters and uses these to
28731 deduce which programs it should invoke, and which command-line options
28732 it ought to place on their command lines. This behavior is controlled
28733 by @dfn{spec strings}. In most cases there is one spec string for each
28734 program that GCC can invoke, but a few programs have multiple spec
28735 strings to control their behavior. The spec strings built into GCC can
28736 be overridden by using the @option{-specs=} command-line switch to specify
28737 a spec file.
28738
28739 @dfn{Spec files} are plain-text files that are used to construct spec
28740 strings. They consist of a sequence of directives separated by blank
28741 lines. The type of directive is determined by the first non-whitespace
28742 character on the line, which can be one of the following:
28743
28744 @table @code
28745 @item %@var{command}
28746 Issues a @var{command} to the spec file processor. The commands that can
28747 appear here are:
28748
28749 @table @code
28750 @item %include <@var{file}>
28751 @cindex @code{%include}
28752 Search for @var{file} and insert its text at the current point in the
28753 specs file.
28754
28755 @item %include_noerr <@var{file}>
28756 @cindex @code{%include_noerr}
28757 Just like @samp{%include}, but do not generate an error message if the include
28758 file cannot be found.
28759
28760 @item %rename @var{old_name} @var{new_name}
28761 @cindex @code{%rename}
28762 Rename the spec string @var{old_name} to @var{new_name}.
28763
28764 @end table
28765
28766 @item *[@var{spec_name}]:
28767 This tells the compiler to create, override or delete the named spec
28768 string. All lines after this directive up to the next directive or
28769 blank line are considered to be the text for the spec string. If this
28770 results in an empty string then the spec is deleted. (Or, if the
28771 spec did not exist, then nothing happens.) Otherwise, if the spec
28772 does not currently exist a new spec is created. If the spec does
28773 exist then its contents are overridden by the text of this
28774 directive, unless the first character of that text is the @samp{+}
28775 character, in which case the text is appended to the spec.
28776
28777 @item [@var{suffix}]:
28778 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28779 and up to the next directive or blank line are considered to make up the
28780 spec string for the indicated suffix. When the compiler encounters an
28781 input file with the named suffix, it processes the spec string in
28782 order to work out how to compile that file. For example:
28783
28784 @smallexample
28785 .ZZ:
28786 z-compile -input %i
28787 @end smallexample
28788
28789 This says that any input file whose name ends in @samp{.ZZ} should be
28790 passed to the program @samp{z-compile}, which should be invoked with the
28791 command-line switch @option{-input} and with the result of performing the
28792 @samp{%i} substitution. (See below.)
28793
28794 As an alternative to providing a spec string, the text following a
28795 suffix directive can be one of the following:
28796
28797 @table @code
28798 @item @@@var{language}
28799 This says that the suffix is an alias for a known @var{language}. This is
28800 similar to using the @option{-x} command-line switch to GCC to specify a
28801 language explicitly. For example:
28802
28803 @smallexample
28804 .ZZ:
28805 @@c++
28806 @end smallexample
28807
28808 Says that .ZZ files are, in fact, C++ source files.
28809
28810 @item #@var{name}
28811 This causes an error messages saying:
28812
28813 @smallexample
28814 @var{name} compiler not installed on this system.
28815 @end smallexample
28816 @end table
28817
28818 GCC already has an extensive list of suffixes built into it.
28819 This directive adds an entry to the end of the list of suffixes, but
28820 since the list is searched from the end backwards, it is effectively
28821 possible to override earlier entries using this technique.
28822
28823 @end table
28824
28825 GCC has the following spec strings built into it. Spec files can
28826 override these strings or create their own. Note that individual
28827 targets can also add their own spec strings to this list.
28828
28829 @smallexample
28830 asm Options to pass to the assembler
28831 asm_final Options to pass to the assembler post-processor
28832 cpp Options to pass to the C preprocessor
28833 cc1 Options to pass to the C compiler
28834 cc1plus Options to pass to the C++ compiler
28835 endfile Object files to include at the end of the link
28836 link Options to pass to the linker
28837 lib Libraries to include on the command line to the linker
28838 libgcc Decides which GCC support library to pass to the linker
28839 linker Sets the name of the linker
28840 predefines Defines to be passed to the C preprocessor
28841 signed_char Defines to pass to CPP to say whether @code{char} is signed
28842 by default
28843 startfile Object files to include at the start of the link
28844 @end smallexample
28845
28846 Here is a small example of a spec file:
28847
28848 @smallexample
28849 %rename lib old_lib
28850
28851 *lib:
28852 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28853 @end smallexample
28854
28855 This example renames the spec called @samp{lib} to @samp{old_lib} and
28856 then overrides the previous definition of @samp{lib} with a new one.
28857 The new definition adds in some extra command-line options before
28858 including the text of the old definition.
28859
28860 @dfn{Spec strings} are a list of command-line options to be passed to their
28861 corresponding program. In addition, the spec strings can contain
28862 @samp{%}-prefixed sequences to substitute variable text or to
28863 conditionally insert text into the command line. Using these constructs
28864 it is possible to generate quite complex command lines.
28865
28866 Here is a table of all defined @samp{%}-sequences for spec
28867 strings. Note that spaces are not generated automatically around the
28868 results of expanding these sequences. Therefore you can concatenate them
28869 together or combine them with constant text in a single argument.
28870
28871 @table @code
28872 @item %%
28873 Substitute one @samp{%} into the program name or argument.
28874
28875 @item %i
28876 Substitute the name of the input file being processed.
28877
28878 @item %b
28879 Substitute the basename of the input file being processed.
28880 This is the substring up to (and not including) the last period
28881 and not including the directory.
28882
28883 @item %B
28884 This is the same as @samp{%b}, but include the file suffix (text after
28885 the last period).
28886
28887 @item %d
28888 Marks the argument containing or following the @samp{%d} as a
28889 temporary file name, so that that file is deleted if GCC exits
28890 successfully. Unlike @samp{%g}, this contributes no text to the
28891 argument.
28892
28893 @item %g@var{suffix}
28894 Substitute a file name that has suffix @var{suffix} and is chosen
28895 once per compilation, and mark the argument in the same way as
28896 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28897 name is now chosen in a way that is hard to predict even when previously
28898 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28899 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28900 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28901 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28902 was simply substituted with a file name chosen once per compilation,
28903 without regard to any appended suffix (which was therefore treated
28904 just like ordinary text), making such attacks more likely to succeed.
28905
28906 @item %u@var{suffix}
28907 Like @samp{%g}, but generates a new temporary file name
28908 each time it appears instead of once per compilation.
28909
28910 @item %U@var{suffix}
28911 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28912 new one if there is no such last file name. In the absence of any
28913 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28914 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28915 involves the generation of two distinct file names, one
28916 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28917 simply substituted with a file name chosen for the previous @samp{%u},
28918 without regard to any appended suffix.
28919
28920 @item %j@var{suffix}
28921 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28922 writable, and if @option{-save-temps} is not used;
28923 otherwise, substitute the name
28924 of a temporary file, just like @samp{%u}. This temporary file is not
28925 meant for communication between processes, but rather as a junk
28926 disposal mechanism.
28927
28928 @item %|@var{suffix}
28929 @itemx %m@var{suffix}
28930 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28931 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28932 all. These are the two most common ways to instruct a program that it
28933 should read from standard input or write to standard output. If you
28934 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28935 construct: see for example @file{f/lang-specs.h}.
28936
28937 @item %.@var{SUFFIX}
28938 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28939 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28940 terminated by the next space or %.
28941
28942 @item %w
28943 Marks the argument containing or following the @samp{%w} as the
28944 designated output file of this compilation. This puts the argument
28945 into the sequence of arguments that @samp{%o} substitutes.
28946
28947 @item %o
28948 Substitutes the names of all the output files, with spaces
28949 automatically placed around them. You should write spaces
28950 around the @samp{%o} as well or the results are undefined.
28951 @samp{%o} is for use in the specs for running the linker.
28952 Input files whose names have no recognized suffix are not compiled
28953 at all, but they are included among the output files, so they are
28954 linked.
28955
28956 @item %O
28957 Substitutes the suffix for object files. Note that this is
28958 handled specially when it immediately follows @samp{%g, %u, or %U},
28959 because of the need for those to form complete file names. The
28960 handling is such that @samp{%O} is treated exactly as if it had already
28961 been substituted, except that @samp{%g, %u, and %U} do not currently
28962 support additional @var{suffix} characters following @samp{%O} as they do
28963 following, for example, @samp{.o}.
28964
28965 @item %p
28966 Substitutes the standard macro predefinitions for the
28967 current target machine. Use this when running @command{cpp}.
28968
28969 @item %P
28970 Like @samp{%p}, but puts @samp{__} before and after the name of each
28971 predefined macro, except for macros that start with @samp{__} or with
28972 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28973 C@.
28974
28975 @item %I
28976 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28977 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28978 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28979 and @option{-imultilib} as necessary.
28980
28981 @item %s
28982 Current argument is the name of a library or startup file of some sort.
28983 Search for that file in a standard list of directories and substitute
28984 the full name found. The current working directory is included in the
28985 list of directories scanned.
28986
28987 @item %T
28988 Current argument is the name of a linker script. Search for that file
28989 in the current list of directories to scan for libraries. If the file
28990 is located insert a @option{--script} option into the command line
28991 followed by the full path name found. If the file is not found then
28992 generate an error message. Note: the current working directory is not
28993 searched.
28994
28995 @item %e@var{str}
28996 Print @var{str} as an error message. @var{str} is terminated by a newline.
28997 Use this when inconsistent options are detected.
28998
28999 @item %(@var{name})
29000 Substitute the contents of spec string @var{name} at this point.
29001
29002 @item %x@{@var{option}@}
29003 Accumulate an option for @samp{%X}.
29004
29005 @item %X
29006 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29007 spec string.
29008
29009 @item %Y
29010 Output the accumulated assembler options specified by @option{-Wa}.
29011
29012 @item %Z
29013 Output the accumulated preprocessor options specified by @option{-Wp}.
29014
29015 @item %a
29016 Process the @code{asm} spec. This is used to compute the
29017 switches to be passed to the assembler.
29018
29019 @item %A
29020 Process the @code{asm_final} spec. This is a spec string for
29021 passing switches to an assembler post-processor, if such a program is
29022 needed.
29023
29024 @item %l
29025 Process the @code{link} spec. This is the spec for computing the
29026 command line passed to the linker. Typically it makes use of the
29027 @samp{%L %G %S %D and %E} sequences.
29028
29029 @item %D
29030 Dump out a @option{-L} option for each directory that GCC believes might
29031 contain startup files. If the target supports multilibs then the
29032 current multilib directory is prepended to each of these paths.
29033
29034 @item %L
29035 Process the @code{lib} spec. This is a spec string for deciding which
29036 libraries are included on the command line to the linker.
29037
29038 @item %G
29039 Process the @code{libgcc} spec. This is a spec string for deciding
29040 which GCC support library is included on the command line to the linker.
29041
29042 @item %S
29043 Process the @code{startfile} spec. This is a spec for deciding which
29044 object files are the first ones passed to the linker. Typically
29045 this might be a file named @file{crt0.o}.
29046
29047 @item %E
29048 Process the @code{endfile} spec. This is a spec string that specifies
29049 the last object files that are passed to the linker.
29050
29051 @item %C
29052 Process the @code{cpp} spec. This is used to construct the arguments
29053 to be passed to the C preprocessor.
29054
29055 @item %1
29056 Process the @code{cc1} spec. This is used to construct the options to be
29057 passed to the actual C compiler (@command{cc1}).
29058
29059 @item %2
29060 Process the @code{cc1plus} spec. This is used to construct the options to be
29061 passed to the actual C++ compiler (@command{cc1plus}).
29062
29063 @item %*
29064 Substitute the variable part of a matched option. See below.
29065 Note that each comma in the substituted string is replaced by
29066 a single space.
29067
29068 @item %<S
29069 Remove all occurrences of @code{-S} from the command line. Note---this
29070 command is position dependent. @samp{%} commands in the spec string
29071 before this one see @code{-S}, @samp{%} commands in the spec string
29072 after this one do not.
29073
29074 @item %:@var{function}(@var{args})
29075 Call the named function @var{function}, passing it @var{args}.
29076 @var{args} is first processed as a nested spec string, then split
29077 into an argument vector in the usual fashion. The function returns
29078 a string which is processed as if it had appeared literally as part
29079 of the current spec.
29080
29081 The following built-in spec functions are provided:
29082
29083 @table @code
29084 @item @code{getenv}
29085 The @code{getenv} spec function takes two arguments: an environment
29086 variable name and a string. If the environment variable is not
29087 defined, a fatal error is issued. Otherwise, the return value is the
29088 value of the environment variable concatenated with the string. For
29089 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29090
29091 @smallexample
29092 %:getenv(TOPDIR /include)
29093 @end smallexample
29094
29095 expands to @file{/path/to/top/include}.
29096
29097 @item @code{if-exists}
29098 The @code{if-exists} spec function takes one argument, an absolute
29099 pathname to a file. If the file exists, @code{if-exists} returns the
29100 pathname. Here is a small example of its usage:
29101
29102 @smallexample
29103 *startfile:
29104 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29105 @end smallexample
29106
29107 @item @code{if-exists-else}
29108 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29109 spec function, except that it takes two arguments. The first argument is
29110 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29111 returns the pathname. If it does not exist, it returns the second argument.
29112 This way, @code{if-exists-else} can be used to select one file or another,
29113 based on the existence of the first. Here is a small example of its usage:
29114
29115 @smallexample
29116 *startfile:
29117 crt0%O%s %:if-exists(crti%O%s) \
29118 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29119 @end smallexample
29120
29121 @item @code{replace-outfile}
29122 The @code{replace-outfile} spec function takes two arguments. It looks for the
29123 first argument in the outfiles array and replaces it with the second argument. Here
29124 is a small example of its usage:
29125
29126 @smallexample
29127 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29128 @end smallexample
29129
29130 @item @code{remove-outfile}
29131 The @code{remove-outfile} spec function takes one argument. It looks for the
29132 first argument in the outfiles array and removes it. Here is a small example
29133 its usage:
29134
29135 @smallexample
29136 %:remove-outfile(-lm)
29137 @end smallexample
29138
29139 @item @code{pass-through-libs}
29140 The @code{pass-through-libs} spec function takes any number of arguments. It
29141 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29142 assumes are the names of linker input library archive files) and returns a
29143 result containing all the found arguments each prepended by
29144 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29145 intended to be passed to the LTO linker plugin.
29146
29147 @smallexample
29148 %:pass-through-libs(%G %L %G)
29149 @end smallexample
29150
29151 @item @code{print-asm-header}
29152 The @code{print-asm-header} function takes no arguments and simply
29153 prints a banner like:
29154
29155 @smallexample
29156 Assembler options
29157 =================
29158
29159 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29160 @end smallexample
29161
29162 It is used to separate compiler options from assembler options
29163 in the @option{--target-help} output.
29164 @end table
29165
29166 @item %@{S@}
29167 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29168 If that switch is not specified, this substitutes nothing. Note that
29169 the leading dash is omitted when specifying this option, and it is
29170 automatically inserted if the substitution is performed. Thus the spec
29171 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29172 and outputs the command-line option @option{-foo}.
29173
29174 @item %W@{S@}
29175 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29176 deleted on failure.
29177
29178 @item %@{S*@}
29179 Substitutes all the switches specified to GCC whose names start
29180 with @code{-S}, but which also take an argument. This is used for
29181 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29182 GCC considers @option{-o foo} as being
29183 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29184 text, including the space. Thus two arguments are generated.
29185
29186 @item %@{S*&T*@}
29187 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29188 (the order of @code{S} and @code{T} in the spec is not significant).
29189 There can be any number of ampersand-separated variables; for each the
29190 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29191
29192 @item %@{S:X@}
29193 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29194
29195 @item %@{!S:X@}
29196 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29197
29198 @item %@{S*:X@}
29199 Substitutes @code{X} if one or more switches whose names start with
29200 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29201 once, no matter how many such switches appeared. However, if @code{%*}
29202 appears somewhere in @code{X}, then @code{X} is substituted once
29203 for each matching switch, with the @code{%*} replaced by the part of
29204 that switch matching the @code{*}.
29205
29206 If @code{%*} appears as the last part of a spec sequence then a space
29207 is added after the end of the last substitution. If there is more
29208 text in the sequence, however, then a space is not generated. This
29209 allows the @code{%*} substitution to be used as part of a larger
29210 string. For example, a spec string like this:
29211
29212 @smallexample
29213 %@{mcu=*:--script=%*/memory.ld@}
29214 @end smallexample
29215
29216 @noindent
29217 when matching an option like @option{-mcu=newchip} produces:
29218
29219 @smallexample
29220 --script=newchip/memory.ld
29221 @end smallexample
29222
29223 @item %@{.S:X@}
29224 Substitutes @code{X}, if processing a file with suffix @code{S}.
29225
29226 @item %@{!.S:X@}
29227 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29228
29229 @item %@{,S:X@}
29230 Substitutes @code{X}, if processing a file for language @code{S}.
29231
29232 @item %@{!,S:X@}
29233 Substitutes @code{X}, if not processing a file for language @code{S}.
29234
29235 @item %@{S|P:X@}
29236 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29237 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29238 @code{*} sequences as well, although they have a stronger binding than
29239 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29240 alternatives must be starred, and only the first matching alternative
29241 is substituted.
29242
29243 For example, a spec string like this:
29244
29245 @smallexample
29246 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29247 @end smallexample
29248
29249 @noindent
29250 outputs the following command-line options from the following input
29251 command-line options:
29252
29253 @smallexample
29254 fred.c -foo -baz
29255 jim.d -bar -boggle
29256 -d fred.c -foo -baz -boggle
29257 -d jim.d -bar -baz -boggle
29258 @end smallexample
29259
29260 @item %@{S:X; T:Y; :D@}
29261
29262 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29263 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29264 be as many clauses as you need. This may be combined with @code{.},
29265 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29266
29267
29268 @end table
29269
29270 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29271 or similar construct can use a backslash to ignore the special meaning
29272 of the character following it, thus allowing literal matching of a
29273 character that is otherwise specially treated. For example,
29274 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29275 @option{-std=iso9899:1999} option is given.
29276
29277 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29278 construct may contain other nested @samp{%} constructs or spaces, or
29279 even newlines. They are processed as usual, as described above.
29280 Trailing white space in @code{X} is ignored. White space may also
29281 appear anywhere on the left side of the colon in these constructs,
29282 except between @code{.} or @code{*} and the corresponding word.
29283
29284 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29285 handled specifically in these constructs. If another value of
29286 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29287 @option{-W} switch is found later in the command line, the earlier
29288 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29289 just one letter, which passes all matching options.
29290
29291 The character @samp{|} at the beginning of the predicate text is used to
29292 indicate that a command should be piped to the following command, but
29293 only if @option{-pipe} is specified.
29294
29295 It is built into GCC which switches take arguments and which do not.
29296 (You might think it would be useful to generalize this to allow each
29297 compiler's spec to say which switches take arguments. But this cannot
29298 be done in a consistent fashion. GCC cannot even decide which input
29299 files have been specified without knowing which switches take arguments,
29300 and it must know which input files to compile in order to tell which
29301 compilers to run).
29302
29303 GCC also knows implicitly that arguments starting in @option{-l} are to be
29304 treated as compiler output files, and passed to the linker in their
29305 proper position among the other output files.
29306
29307 @node Environment Variables
29308 @section Environment Variables Affecting GCC
29309 @cindex environment variables
29310
29311 @c man begin ENVIRONMENT
29312 This section describes several environment variables that affect how GCC
29313 operates. Some of them work by specifying directories or prefixes to use
29314 when searching for various kinds of files. Some are used to specify other
29315 aspects of the compilation environment.
29316
29317 Note that you can also specify places to search using options such as
29318 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29319 take precedence over places specified using environment variables, which
29320 in turn take precedence over those specified by the configuration of GCC@.
29321 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29322 GNU Compiler Collection (GCC) Internals}.
29323
29324 @table @env
29325 @item LANG
29326 @itemx LC_CTYPE
29327 @c @itemx LC_COLLATE
29328 @itemx LC_MESSAGES
29329 @c @itemx LC_MONETARY
29330 @c @itemx LC_NUMERIC
29331 @c @itemx LC_TIME
29332 @itemx LC_ALL
29333 @findex LANG
29334 @findex LC_CTYPE
29335 @c @findex LC_COLLATE
29336 @findex LC_MESSAGES
29337 @c @findex LC_MONETARY
29338 @c @findex LC_NUMERIC
29339 @c @findex LC_TIME
29340 @findex LC_ALL
29341 @cindex locale
29342 These environment variables control the way that GCC uses
29343 localization information which allows GCC to work with different
29344 national conventions. GCC inspects the locale categories
29345 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29346 so. These locale categories can be set to any value supported by your
29347 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29348 Kingdom encoded in UTF-8.
29349
29350 The @env{LC_CTYPE} environment variable specifies character
29351 classification. GCC uses it to determine the character boundaries in
29352 a string; this is needed for some multibyte encodings that contain quote
29353 and escape characters that are otherwise interpreted as a string
29354 end or escape.
29355
29356 The @env{LC_MESSAGES} environment variable specifies the language to
29357 use in diagnostic messages.
29358
29359 If the @env{LC_ALL} environment variable is set, it overrides the value
29360 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29361 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29362 environment variable. If none of these variables are set, GCC
29363 defaults to traditional C English behavior.
29364
29365 @item TMPDIR
29366 @findex TMPDIR
29367 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29368 files. GCC uses temporary files to hold the output of one stage of
29369 compilation which is to be used as input to the next stage: for example,
29370 the output of the preprocessor, which is the input to the compiler
29371 proper.
29372
29373 @item GCC_COMPARE_DEBUG
29374 @findex GCC_COMPARE_DEBUG
29375 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29376 @option{-fcompare-debug} to the compiler driver. See the documentation
29377 of this option for more details.
29378
29379 @item GCC_EXEC_PREFIX
29380 @findex GCC_EXEC_PREFIX
29381 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29382 names of the subprograms executed by the compiler. No slash is added
29383 when this prefix is combined with the name of a subprogram, but you can
29384 specify a prefix that ends with a slash if you wish.
29385
29386 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29387 an appropriate prefix to use based on the pathname it is invoked with.
29388
29389 If GCC cannot find the subprogram using the specified prefix, it
29390 tries looking in the usual places for the subprogram.
29391
29392 The default value of @env{GCC_EXEC_PREFIX} is
29393 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29394 the installed compiler. In many cases @var{prefix} is the value
29395 of @code{prefix} when you ran the @file{configure} script.
29396
29397 Other prefixes specified with @option{-B} take precedence over this prefix.
29398
29399 This prefix is also used for finding files such as @file{crt0.o} that are
29400 used for linking.
29401
29402 In addition, the prefix is used in an unusual way in finding the
29403 directories to search for header files. For each of the standard
29404 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29405 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29406 replacing that beginning with the specified prefix to produce an
29407 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29408 @file{foo/bar} just before it searches the standard directory
29409 @file{/usr/local/lib/bar}.
29410 If a standard directory begins with the configured
29411 @var{prefix} then the value of @var{prefix} is replaced by
29412 @env{GCC_EXEC_PREFIX} when looking for header files.
29413
29414 @item COMPILER_PATH
29415 @findex COMPILER_PATH
29416 The value of @env{COMPILER_PATH} is a colon-separated list of
29417 directories, much like @env{PATH}. GCC tries the directories thus
29418 specified when searching for subprograms, if it cannot find the
29419 subprograms using @env{GCC_EXEC_PREFIX}.
29420
29421 @item LIBRARY_PATH
29422 @findex LIBRARY_PATH
29423 The value of @env{LIBRARY_PATH} is a colon-separated list of
29424 directories, much like @env{PATH}. When configured as a native compiler,
29425 GCC tries the directories thus specified when searching for special
29426 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29427 using GCC also uses these directories when searching for ordinary
29428 libraries for the @option{-l} option (but directories specified with
29429 @option{-L} come first).
29430
29431 @item LANG
29432 @findex LANG
29433 @cindex locale definition
29434 This variable is used to pass locale information to the compiler. One way in
29435 which this information is used is to determine the character set to be used
29436 when character literals, string literals and comments are parsed in C and C++.
29437 When the compiler is configured to allow multibyte characters,
29438 the following values for @env{LANG} are recognized:
29439
29440 @table @samp
29441 @item C-JIS
29442 Recognize JIS characters.
29443 @item C-SJIS
29444 Recognize SJIS characters.
29445 @item C-EUCJP
29446 Recognize EUCJP characters.
29447 @end table
29448
29449 If @env{LANG} is not defined, or if it has some other value, then the
29450 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29451 recognize and translate multibyte characters.
29452 @end table
29453
29454 @noindent
29455 Some additional environment variables affect the behavior of the
29456 preprocessor.
29457
29458 @include cppenv.texi
29459
29460 @c man end
29461
29462 @node Precompiled Headers
29463 @section Using Precompiled Headers
29464 @cindex precompiled headers
29465 @cindex speed of compilation
29466
29467 Often large projects have many header files that are included in every
29468 source file. The time the compiler takes to process these header files
29469 over and over again can account for nearly all of the time required to
29470 build the project. To make builds faster, GCC allows you to
29471 @dfn{precompile} a header file.
29472
29473 To create a precompiled header file, simply compile it as you would any
29474 other file, if necessary using the @option{-x} option to make the driver
29475 treat it as a C or C++ header file. You may want to use a
29476 tool like @command{make} to keep the precompiled header up-to-date when
29477 the headers it contains change.
29478
29479 A precompiled header file is searched for when @code{#include} is
29480 seen in the compilation. As it searches for the included file
29481 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29482 compiler looks for a precompiled header in each directory just before it
29483 looks for the include file in that directory. The name searched for is
29484 the name specified in the @code{#include} with @samp{.gch} appended. If
29485 the precompiled header file cannot be used, it is ignored.
29486
29487 For instance, if you have @code{#include "all.h"}, and you have
29488 @file{all.h.gch} in the same directory as @file{all.h}, then the
29489 precompiled header file is used if possible, and the original
29490 header is used otherwise.
29491
29492 Alternatively, you might decide to put the precompiled header file in a
29493 directory and use @option{-I} to ensure that directory is searched
29494 before (or instead of) the directory containing the original header.
29495 Then, if you want to check that the precompiled header file is always
29496 used, you can put a file of the same name as the original header in this
29497 directory containing an @code{#error} command.
29498
29499 This also works with @option{-include}. So yet another way to use
29500 precompiled headers, good for projects not designed with precompiled
29501 header files in mind, is to simply take most of the header files used by
29502 a project, include them from another header file, precompile that header
29503 file, and @option{-include} the precompiled header. If the header files
29504 have guards against multiple inclusion, they are skipped because
29505 they've already been included (in the precompiled header).
29506
29507 If you need to precompile the same header file for different
29508 languages, targets, or compiler options, you can instead make a
29509 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29510 header in the directory, perhaps using @option{-o}. It doesn't matter
29511 what you call the files in the directory; every precompiled header in
29512 the directory is considered. The first precompiled header
29513 encountered in the directory that is valid for this compilation is
29514 used; they're searched in no particular order.
29515
29516 There are many other possibilities, limited only by your imagination,
29517 good sense, and the constraints of your build system.
29518
29519 A precompiled header file can be used only when these conditions apply:
29520
29521 @itemize
29522 @item
29523 Only one precompiled header can be used in a particular compilation.
29524
29525 @item
29526 A precompiled header cannot be used once the first C token is seen. You
29527 can have preprocessor directives before a precompiled header; you cannot
29528 include a precompiled header from inside another header.
29529
29530 @item
29531 The precompiled header file must be produced for the same language as
29532 the current compilation. You cannot use a C precompiled header for a C++
29533 compilation.
29534
29535 @item
29536 The precompiled header file must have been produced by the same compiler
29537 binary as the current compilation is using.
29538
29539 @item
29540 Any macros defined before the precompiled header is included must
29541 either be defined in the same way as when the precompiled header was
29542 generated, or must not affect the precompiled header, which usually
29543 means that they don't appear in the precompiled header at all.
29544
29545 The @option{-D} option is one way to define a macro before a
29546 precompiled header is included; using a @code{#define} can also do it.
29547 There are also some options that define macros implicitly, like
29548 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29549 defined this way.
29550
29551 @item If debugging information is output when using the precompiled
29552 header, using @option{-g} or similar, the same kind of debugging information
29553 must have been output when building the precompiled header. However,
29554 a precompiled header built using @option{-g} can be used in a compilation
29555 when no debugging information is being output.
29556
29557 @item The same @option{-m} options must generally be used when building
29558 and using the precompiled header. @xref{Submodel Options},
29559 for any cases where this rule is relaxed.
29560
29561 @item Each of the following options must be the same when building and using
29562 the precompiled header:
29563
29564 @gccoptlist{-fexceptions}
29565
29566 @item
29567 Some other command-line options starting with @option{-f},
29568 @option{-p}, or @option{-O} must be defined in the same way as when
29569 the precompiled header was generated. At present, it's not clear
29570 which options are safe to change and which are not; the safest choice
29571 is to use exactly the same options when generating and using the
29572 precompiled header. The following are known to be safe:
29573
29574 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29575 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29576 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29577 -pedantic-errors}
29578
29579 @end itemize
29580
29581 For all of these except the last, the compiler automatically
29582 ignores the precompiled header if the conditions aren't met. If you
29583 find an option combination that doesn't work and doesn't cause the
29584 precompiled header to be ignored, please consider filing a bug report,
29585 see @ref{Bugs}.
29586
29587 If you do use differing options when generating and using the
29588 precompiled header, the actual behavior is a mixture of the
29589 behavior for the options. For instance, if you use @option{-g} to
29590 generate the precompiled header but not when using it, you may or may
29591 not get debugging information for routines in the precompiled header.