[ARC] Update mea option documentation
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
207
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
223 -fno-optional-diags -fpermissive @gol
224 -fno-pretty-templates @gol
225 -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -Wcomma-subscript -Wconversion-null @gol
234 -Wctor-dtor-privacy @gol
235 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
236 -Wliteral-suffix @gol
237 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
238 -Wnamespaces -Wnarrowing @gol
239 -Wpessimizing-move -Wredundant-move @gol
240 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
241 -Wnon-virtual-dtor -Wreorder -Wregister @gol
242 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
243 -Wno-non-template-friend -Wold-style-cast @gol
244 -Woverloaded-virtual -Wno-pmf-conversions @gol
245 -Wno-class-conversion -Wno-terminate @gol
246 -Wsign-promo -Wvirtual-inheritance -Wvolatile}
247
248 @item Objective-C and Objective-C++ Language Options
249 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
250 Objective-C and Objective-C++ Dialects}.
251 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
252 -fgnu-runtime -fnext-runtime @gol
253 -fno-nil-receivers @gol
254 -fobjc-abi-version=@var{n} @gol
255 -fobjc-call-cxx-cdtors @gol
256 -fobjc-direct-dispatch @gol
257 -fobjc-exceptions @gol
258 -fobjc-gc @gol
259 -fobjc-nilcheck @gol
260 -fobjc-std=objc1 @gol
261 -fno-local-ivars @gol
262 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
263 -freplace-objc-classes @gol
264 -fzero-link @gol
265 -gen-decls @gol
266 -Wassign-intercept @gol
267 -Wno-protocol -Wselector @gol
268 -Wstrict-selector-match @gol
269 -Wundeclared-selector}
270
271 @item Diagnostic Message Formatting Options
272 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
273 @gccoptlist{-fmessage-length=@var{n} @gol
274 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
275 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
276 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
277 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
278 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
279 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
280 -fdiagnostics-minimum-margin-width=@var{width} @gol
281 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
282 -fdiagnostics-show-template-tree -fno-elide-type @gol
283 -fno-show-column}
284
285 @item Warning Options
286 @xref{Warning Options,,Options to Request or Suppress Warnings}.
287 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
288 -pedantic-errors @gol
289 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
290 -Waggregate-return -Waligned-new @gol
291 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
292 -Walloca -Walloca-larger-than=@var{byte-size} @gol
293 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
294 -Wno-attributes -Wattribute-alias=@var{n} @gol
295 -Wbool-compare -Wbool-operation @gol
296 -Wno-builtin-declaration-mismatch @gol
297 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
298 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
299 -Wc++20-compat @gol
300 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
301 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
302 -Wclobbered -Wcomment -Wconditionally-supported @gol
303 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
304 -Wdelete-incomplete @gol
305 -Wno-attribute-warning @gol
306 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
307 -Wdisabled-optimization @gol
308 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
309 -Wno-div-by-zero -Wdouble-promotion @gol
310 -Wduplicated-branches -Wduplicated-cond @gol
311 -Wempty-body -Wenum-compare -Wenum-conversion @gol
312 -Wno-endif-labels -Wexpansion-to-defined @gol
313 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
314 -Wfloat-equal -Wformat -Wformat=2 @gol
315 -Wno-format-contains-nul -Wno-format-extra-args @gol
316 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
317 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
318 -Wformat-y2k -Wframe-address @gol
319 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
320 -Wjump-misses-init @gol
321 -Whsa -Wif-not-aligned @gol
322 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
323 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
324 -Wimplicit-function-declaration -Wimplicit-int @gol
325 -Winaccessible-base @gol
326 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
327 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
328 -Wzero-length-bounds @gol
329 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
330 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
331 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
332 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
333 -Wmissing-field-initializers -Wmissing-format-attribute @gol
334 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
335 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
336 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
337 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
338 -Woverride-init-side-effects -Woverlength-strings @gol
339 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
340 -Wparentheses -Wno-pedantic-ms-format @gol
341 -Wplacement-new -Wplacement-new=@var{n} @gol
342 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
343 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
344 -Wrestrict -Wno-return-local-addr @gol
345 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
346 -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
347 -Wshift-overflow -Wshift-overflow=@var{n} @gol
348 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
349 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
350 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
351 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
352 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
353 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
354 -Wstring-compare @gol
355 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
356 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
357 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
358 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
359 -Wswitch-unreachable -Wsync-nand @gol
360 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
361 -Wtype-limits -Wundef @gol
362 -Wuninitialized -Wunknown-pragmas @gol
363 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
364 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
365 -Wunused-parameter -Wno-unused-result @gol
366 -Wunused-value -Wunused-variable @gol
367 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
368 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
369 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
370 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
371 -Wwrite-strings @gol
372 -Wzero-as-null-pointer-constant}
373
374 @item C and Objective-C-only Warning Options
375 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
376 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
377 -Wold-style-declaration -Wold-style-definition @gol
378 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
379 -Wdeclaration-after-statement -Wpointer-sign}
380
381 @item Debugging Options
382 @xref{Debugging Options,,Options for Debugging Your Program}.
383 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
384 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
385 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
386 -gas-loc-support -gno-as-loc-support @gol
387 -gas-locview-support -gno-as-locview-support @gol
388 -gcolumn-info -gno-column-info @gol
389 -gstatement-frontiers -gno-statement-frontiers @gol
390 -gvariable-location-views -gno-variable-location-views @gol
391 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
392 -ginline-points -gno-inline-points @gol
393 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
394 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
395 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
396 -fno-eliminate-unused-debug-types @gol
397 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
398 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
399 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
400 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
401 -fvar-tracking -fvar-tracking-assignments}
402
403 @item Optimization Options
404 @xref{Optimize Options,,Options that Control Optimization}.
405 @gccoptlist{-faggressive-loop-optimizations @gol
406 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
407 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
408 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
409 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
410 -fallow-store-data-races @gol
411 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
412 -fauto-inc-dec -fbranch-probabilities @gol
413 -fcaller-saves @gol
414 -fcombine-stack-adjustments -fconserve-stack @gol
415 -fcompare-elim -fcprop-registers -fcrossjumping @gol
416 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
417 -fcx-limited-range @gol
418 -fdata-sections -fdce -fdelayed-branch @gol
419 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
420 -fdevirtualize-at-ltrans -fdse @gol
421 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
422 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
423 -ffinite-loops @gol
424 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
425 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
426 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
427 -fif-conversion2 -findirect-inlining @gol
428 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
429 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
430 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
431 -fipa-reference -fipa-reference-addressable @gol
432 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
433 -flive-patching=@var{level} @gol
434 -fira-region=@var{region} -fira-hoist-pressure @gol
435 -fira-loop-pressure -fno-ira-share-save-slots @gol
436 -fno-ira-share-spill-slots @gol
437 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
438 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
439 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
440 -floop-block -floop-interchange -floop-strip-mine @gol
441 -floop-unroll-and-jam -floop-nest-optimize @gol
442 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
443 -flto-partition=@var{alg} -fmerge-all-constants @gol
444 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
445 -fmove-loop-invariants -fno-branch-count-reg @gol
446 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
447 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
448 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
449 -fno-sched-spec -fno-signed-zeros @gol
450 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
451 -fomit-frame-pointer -foptimize-sibling-calls @gol
452 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
453 -fprefetch-loop-arrays @gol
454 -fprofile-correction @gol
455 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
456 -fprofile-reorder-functions @gol
457 -freciprocal-math -free -frename-registers -freorder-blocks @gol
458 -freorder-blocks-algorithm=@var{algorithm} @gol
459 -freorder-blocks-and-partition -freorder-functions @gol
460 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
461 -frounding-math -fsave-optimization-record @gol
462 -fsched2-use-superblocks -fsched-pressure @gol
463 -fsched-spec-load -fsched-spec-load-dangerous @gol
464 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
465 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
466 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
467 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
468 -fschedule-fusion @gol
469 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
470 -fselective-scheduling -fselective-scheduling2 @gol
471 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
472 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
473 -fsignaling-nans @gol
474 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
475 -fsplit-paths @gol
476 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
477 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
478 -fthread-jumps -ftracer -ftree-bit-ccp @gol
479 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
480 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
481 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
482 -ftree-loop-if-convert -ftree-loop-im @gol
483 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
484 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
485 -ftree-loop-vectorize @gol
486 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
487 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
488 -ftree-switch-conversion -ftree-tail-merge @gol
489 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
490 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
491 -funsafe-math-optimizations -funswitch-loops @gol
492 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
493 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
494 --param @var{name}=@var{value}
495 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
496
497 @item Program Instrumentation Options
498 @xref{Instrumentation Options,,Program Instrumentation Options}.
499 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
500 -fprofile-abs-path @gol
501 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
502 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
503 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
504 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
505 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
506 -fsanitize-undefined-trap-on-error -fbounds-check @gol
507 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
508 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
509 -fstack-protector-explicit -fstack-check @gol
510 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
511 -fno-stack-limit -fsplit-stack @gol
512 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
513 -fvtv-counts -fvtv-debug @gol
514 -finstrument-functions @gol
515 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
516 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
517
518 @item Preprocessor Options
519 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
520 @gccoptlist{-A@var{question}=@var{answer} @gol
521 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
522 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
523 -dD -dI -dM -dN -dU @gol
524 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
525 -fexec-charset=@var{charset} -fextended-identifiers @gol
526 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
527 -fmax-include-depth=@var{depth} @gol
528 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
529 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
530 -fwide-exec-charset=@var{charset} -fworking-directory @gol
531 -H -imacros @var{file} -include @var{file} @gol
532 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
533 -no-integrated-cpp -P -pthread -remap @gol
534 -traditional -traditional-cpp -trigraphs @gol
535 -U@var{macro} -undef @gol
536 -Wp,@var{option} -Xpreprocessor @var{option}}
537
538 @item Assembler Options
539 @xref{Assembler Options,,Passing Options to the Assembler}.
540 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
541
542 @item Linker Options
543 @xref{Link Options,,Options for Linking}.
544 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
545 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
546 -e @var{entry} --entry=@var{entry} @gol
547 -pie -pthread -r -rdynamic @gol
548 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
549 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
550 -shared -shared-libgcc -symbolic @gol
551 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
552 -u @var{symbol} -z @var{keyword}}
553
554 @item Directory Options
555 @xref{Directory Options,,Options for Directory Search}.
556 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
557 -idirafter @var{dir} @gol
558 -imacros @var{file} -imultilib @var{dir} @gol
559 -iplugindir=@var{dir} -iprefix @var{file} @gol
560 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
561 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
562 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
563 -nostdinc -nostdinc++ --sysroot=@var{dir}}
564
565 @item Code Generation Options
566 @xref{Code Gen Options,,Options for Code Generation Conventions}.
567 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
568 -ffixed-@var{reg} -fexceptions @gol
569 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
570 -fasynchronous-unwind-tables @gol
571 -fno-gnu-unique @gol
572 -finhibit-size-directive -fno-common -fno-ident @gol
573 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
574 -fno-jump-tables @gol
575 -frecord-gcc-switches @gol
576 -freg-struct-return -fshort-enums -fshort-wchar @gol
577 -fverbose-asm -fpack-struct[=@var{n}] @gol
578 -fleading-underscore -ftls-model=@var{model} @gol
579 -fstack-reuse=@var{reuse_level} @gol
580 -ftrampolines -ftrapv -fwrapv @gol
581 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
582 -fstrict-volatile-bitfields -fsync-libcalls}
583
584 @item Developer Options
585 @xref{Developer Options,,GCC Developer Options}.
586 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
587 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
588 -fchecking -fchecking=@var{n}
589 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
590 -fdisable-ipa-@var{pass_name} @gol
591 -fdisable-rtl-@var{pass_name} @gol
592 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
593 -fdisable-tree-@var{pass_name} @gol
594 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
595 -fdump-debug -fdump-earlydebug @gol
596 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
597 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
598 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
599 -fdump-lang-all @gol
600 -fdump-lang-@var{switch} @gol
601 -fdump-lang-@var{switch}-@var{options} @gol
602 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
603 -fdump-passes @gol
604 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
605 -fdump-statistics @gol
606 -fdump-tree-all @gol
607 -fdump-tree-@var{switch} @gol
608 -fdump-tree-@var{switch}-@var{options} @gol
609 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
610 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
611 -fenable-@var{kind}-@var{pass} @gol
612 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
613 -fira-verbose=@var{n} @gol
614 -flto-report -flto-report-wpa -fmem-report-wpa @gol
615 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
616 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
617 -fprofile-report @gol
618 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
619 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
620 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
621 -fvar-tracking-assignments-toggle -gtoggle @gol
622 -print-file-name=@var{library} -print-libgcc-file-name @gol
623 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
624 -print-prog-name=@var{program} -print-search-dirs -Q @gol
625 -print-sysroot -print-sysroot-headers-suffix @gol
626 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
627
628 @item Machine-Dependent Options
629 @xref{Submodel Options,,Machine-Dependent Options}.
630 @c This list is ordered alphanumerically by subsection name.
631 @c Try and put the significant identifier (CPU or system) first,
632 @c so users have a clue at guessing where the ones they want will be.
633
634 @emph{AArch64 Options}
635 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
636 -mgeneral-regs-only @gol
637 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
638 -mstrict-align -mno-strict-align @gol
639 -momit-leaf-frame-pointer @gol
640 -mtls-dialect=desc -mtls-dialect=traditional @gol
641 -mtls-size=@var{size} @gol
642 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
643 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
644 -mpc-relative-literal-loads @gol
645 -msign-return-address=@var{scope} @gol
646 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
647 +@var{b-key}]|@var{bti} @gol
648 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
649 -moverride=@var{string} -mverbose-cost-dump @gol
650 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
651 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
652 -moutline-atomics }
653
654 @emph{Adapteva Epiphany Options}
655 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
656 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
657 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
658 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
659 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
660 -msplit-vecmove-early -m1reg-@var{reg}}
661
662 @emph{AMD GCN Options}
663 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
664
665 @emph{ARC Options}
666 @gccoptlist{-mbarrel-shifter -mjli-always @gol
667 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
668 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
669 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
670 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
671 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
672 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
673 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
674 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
675 -mvolatile-cache -mtp-regno=@var{regno} @gol
676 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
677 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
678 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
679 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
680 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
681 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
682 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
683 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
684
685 @emph{ARM Options}
686 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
687 -mabi=@var{name} @gol
688 -mapcs-stack-check -mno-apcs-stack-check @gol
689 -mapcs-reentrant -mno-apcs-reentrant @gol
690 -mgeneral-regs-only @gol
691 -msched-prolog -mno-sched-prolog @gol
692 -mlittle-endian -mbig-endian @gol
693 -mbe8 -mbe32 @gol
694 -mfloat-abi=@var{name} @gol
695 -mfp16-format=@var{name}
696 -mthumb-interwork -mno-thumb-interwork @gol
697 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
698 -mtune=@var{name} -mprint-tune-info @gol
699 -mstructure-size-boundary=@var{n} @gol
700 -mabort-on-noreturn @gol
701 -mlong-calls -mno-long-calls @gol
702 -msingle-pic-base -mno-single-pic-base @gol
703 -mpic-register=@var{reg} @gol
704 -mnop-fun-dllimport @gol
705 -mpoke-function-name @gol
706 -mthumb -marm -mflip-thumb @gol
707 -mtpcs-frame -mtpcs-leaf-frame @gol
708 -mcaller-super-interworking -mcallee-super-interworking @gol
709 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
710 -mword-relocations @gol
711 -mfix-cortex-m3-ldrd @gol
712 -munaligned-access @gol
713 -mneon-for-64bits @gol
714 -mslow-flash-data @gol
715 -masm-syntax-unified @gol
716 -mrestrict-it @gol
717 -mverbose-cost-dump @gol
718 -mpure-code @gol
719 -mcmse @gol
720 -mfdpic}
721
722 @emph{AVR Options}
723 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
724 -mbranch-cost=@var{cost} @gol
725 -mcall-prologues -mgas-isr-prologues -mint8 @gol
726 -mn_flash=@var{size} -mno-interrupts @gol
727 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
728 -mfract-convert-truncate @gol
729 -mshort-calls -nodevicelib @gol
730 -Waddr-space-convert -Wmisspelled-isr}
731
732 @emph{Blackfin Options}
733 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
734 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
735 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
736 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
737 -mno-id-shared-library -mshared-library-id=@var{n} @gol
738 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
739 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
740 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
741 -micplb}
742
743 @emph{C6X Options}
744 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
745 -msim -msdata=@var{sdata-type}}
746
747 @emph{CRIS Options}
748 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
749 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
750 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
751 -mstack-align -mdata-align -mconst-align @gol
752 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
753 -melf -maout -melinux -mlinux -sim -sim2 @gol
754 -mmul-bug-workaround -mno-mul-bug-workaround}
755
756 @emph{CR16 Options}
757 @gccoptlist{-mmac @gol
758 -mcr16cplus -mcr16c @gol
759 -msim -mint32 -mbit-ops
760 -mdata-model=@var{model}}
761
762 @emph{C-SKY Options}
763 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
764 -mbig-endian -EB -mlittle-endian -EL @gol
765 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
766 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
767 -mdsp -medsp -mvdsp @gol
768 -mdiv -msmart -mhigh-registers -manchor @gol
769 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
770 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
771
772 @emph{Darwin Options}
773 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
774 -arch_only -bind_at_load -bundle -bundle_loader @gol
775 -client_name -compatibility_version -current_version @gol
776 -dead_strip @gol
777 -dependency-file -dylib_file -dylinker_install_name @gol
778 -dynamic -dynamiclib -exported_symbols_list @gol
779 -filelist -flat_namespace -force_cpusubtype_ALL @gol
780 -force_flat_namespace -headerpad_max_install_names @gol
781 -iframework @gol
782 -image_base -init -install_name -keep_private_externs @gol
783 -multi_module -multiply_defined -multiply_defined_unused @gol
784 -noall_load -no_dead_strip_inits_and_terms @gol
785 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
786 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
787 -private_bundle -read_only_relocs -sectalign @gol
788 -sectobjectsymbols -whyload -seg1addr @gol
789 -sectcreate -sectobjectsymbols -sectorder @gol
790 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
791 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
792 -segprot -segs_read_only_addr -segs_read_write_addr @gol
793 -single_module -static -sub_library -sub_umbrella @gol
794 -twolevel_namespace -umbrella -undefined @gol
795 -unexported_symbols_list -weak_reference_mismatches @gol
796 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
797 -mkernel -mone-byte-bool}
798
799 @emph{DEC Alpha Options}
800 @gccoptlist{-mno-fp-regs -msoft-float @gol
801 -mieee -mieee-with-inexact -mieee-conformant @gol
802 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
803 -mtrap-precision=@var{mode} -mbuild-constants @gol
804 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
805 -mbwx -mmax -mfix -mcix @gol
806 -mfloat-vax -mfloat-ieee @gol
807 -mexplicit-relocs -msmall-data -mlarge-data @gol
808 -msmall-text -mlarge-text @gol
809 -mmemory-latency=@var{time}}
810
811 @emph{eBPF Options}
812 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
813 -mframe-limit=@var{bytes}}
814
815 @emph{FR30 Options}
816 @gccoptlist{-msmall-model -mno-lsim}
817
818 @emph{FT32 Options}
819 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
820
821 @emph{FRV Options}
822 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
823 -mhard-float -msoft-float @gol
824 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
825 -mdouble -mno-double @gol
826 -mmedia -mno-media -mmuladd -mno-muladd @gol
827 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
828 -mlinked-fp -mlong-calls -malign-labels @gol
829 -mlibrary-pic -macc-4 -macc-8 @gol
830 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
831 -moptimize-membar -mno-optimize-membar @gol
832 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
833 -mvliw-branch -mno-vliw-branch @gol
834 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
835 -mno-nested-cond-exec -mtomcat-stats @gol
836 -mTLS -mtls @gol
837 -mcpu=@var{cpu}}
838
839 @emph{GNU/Linux Options}
840 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
841 -tno-android-cc -tno-android-ld}
842
843 @emph{H8/300 Options}
844 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
845
846 @emph{HPPA Options}
847 @gccoptlist{-march=@var{architecture-type} @gol
848 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
849 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
850 -mfixed-range=@var{register-range} @gol
851 -mjump-in-delay -mlinker-opt -mlong-calls @gol
852 -mlong-load-store -mno-disable-fpregs @gol
853 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
854 -mno-jump-in-delay -mno-long-load-store @gol
855 -mno-portable-runtime -mno-soft-float @gol
856 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
857 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
858 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
859 -munix=@var{unix-std} -nolibdld -static -threads}
860
861 @emph{IA-64 Options}
862 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
863 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
864 -mconstant-gp -mauto-pic -mfused-madd @gol
865 -minline-float-divide-min-latency @gol
866 -minline-float-divide-max-throughput @gol
867 -mno-inline-float-divide @gol
868 -minline-int-divide-min-latency @gol
869 -minline-int-divide-max-throughput @gol
870 -mno-inline-int-divide @gol
871 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
872 -mno-inline-sqrt @gol
873 -mdwarf2-asm -mearly-stop-bits @gol
874 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
875 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
876 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
877 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
878 -msched-spec-ldc -msched-spec-control-ldc @gol
879 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
880 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
881 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
882 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
883
884 @emph{LM32 Options}
885 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
886 -msign-extend-enabled -muser-enabled}
887
888 @emph{M32R/D Options}
889 @gccoptlist{-m32r2 -m32rx -m32r @gol
890 -mdebug @gol
891 -malign-loops -mno-align-loops @gol
892 -missue-rate=@var{number} @gol
893 -mbranch-cost=@var{number} @gol
894 -mmodel=@var{code-size-model-type} @gol
895 -msdata=@var{sdata-type} @gol
896 -mno-flush-func -mflush-func=@var{name} @gol
897 -mno-flush-trap -mflush-trap=@var{number} @gol
898 -G @var{num}}
899
900 @emph{M32C Options}
901 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
902
903 @emph{M680x0 Options}
904 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
905 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
906 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
907 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
908 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
909 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
910 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
911 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
912 -mxgot -mno-xgot -mlong-jump-table-offsets}
913
914 @emph{MCore Options}
915 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
916 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
917 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
918 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
919 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
920
921 @emph{MeP Options}
922 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
923 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
924 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
925 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
926 -mtiny=@var{n}}
927
928 @emph{MicroBlaze Options}
929 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
930 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
931 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
932 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
933 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
934 -mpic-data-is-text-relative}
935
936 @emph{MIPS Options}
937 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
938 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
939 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
940 -mips16 -mno-mips16 -mflip-mips16 @gol
941 -minterlink-compressed -mno-interlink-compressed @gol
942 -minterlink-mips16 -mno-interlink-mips16 @gol
943 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
944 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
945 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
946 -mno-float -msingle-float -mdouble-float @gol
947 -modd-spreg -mno-odd-spreg @gol
948 -mabs=@var{mode} -mnan=@var{encoding} @gol
949 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
950 -mmcu -mmno-mcu @gol
951 -meva -mno-eva @gol
952 -mvirt -mno-virt @gol
953 -mxpa -mno-xpa @gol
954 -mcrc -mno-crc @gol
955 -mginv -mno-ginv @gol
956 -mmicromips -mno-micromips @gol
957 -mmsa -mno-msa @gol
958 -mloongson-mmi -mno-loongson-mmi @gol
959 -mloongson-ext -mno-loongson-ext @gol
960 -mloongson-ext2 -mno-loongson-ext2 @gol
961 -mfpu=@var{fpu-type} @gol
962 -msmartmips -mno-smartmips @gol
963 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
964 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
965 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
966 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
967 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
968 -membedded-data -mno-embedded-data @gol
969 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
970 -mcode-readable=@var{setting} @gol
971 -msplit-addresses -mno-split-addresses @gol
972 -mexplicit-relocs -mno-explicit-relocs @gol
973 -mcheck-zero-division -mno-check-zero-division @gol
974 -mdivide-traps -mdivide-breaks @gol
975 -mload-store-pairs -mno-load-store-pairs @gol
976 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
977 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
978 -mfix-24k -mno-fix-24k @gol
979 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
980 -mfix-r5900 -mno-fix-r5900 @gol
981 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
982 -mfix-vr4120 -mno-fix-vr4120 @gol
983 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
984 -mflush-func=@var{func} -mno-flush-func @gol
985 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
986 -mcompact-branches=@var{policy} @gol
987 -mfp-exceptions -mno-fp-exceptions @gol
988 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
989 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
990 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
991 -mframe-header-opt -mno-frame-header-opt}
992
993 @emph{MMIX Options}
994 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
995 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
996 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
997 -mno-base-addresses -msingle-exit -mno-single-exit}
998
999 @emph{MN10300 Options}
1000 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1001 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1002 -mtune=@var{cpu-type} @gol
1003 -mreturn-pointer-on-d0 @gol
1004 -mno-crt0 -mrelax -mliw -msetlb}
1005
1006 @emph{Moxie Options}
1007 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1008
1009 @emph{MSP430 Options}
1010 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1011 -mwarn-mcu @gol
1012 -mcode-region= -mdata-region= @gol
1013 -msilicon-errata= -msilicon-errata-warn= @gol
1014 -mhwmult= -minrt -mtiny-printf}
1015
1016 @emph{NDS32 Options}
1017 @gccoptlist{-mbig-endian -mlittle-endian @gol
1018 -mreduced-regs -mfull-regs @gol
1019 -mcmov -mno-cmov @gol
1020 -mext-perf -mno-ext-perf @gol
1021 -mext-perf2 -mno-ext-perf2 @gol
1022 -mext-string -mno-ext-string @gol
1023 -mv3push -mno-v3push @gol
1024 -m16bit -mno-16bit @gol
1025 -misr-vector-size=@var{num} @gol
1026 -mcache-block-size=@var{num} @gol
1027 -march=@var{arch} @gol
1028 -mcmodel=@var{code-model} @gol
1029 -mctor-dtor -mrelax}
1030
1031 @emph{Nios II Options}
1032 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1033 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1034 -mel -meb @gol
1035 -mno-bypass-cache -mbypass-cache @gol
1036 -mno-cache-volatile -mcache-volatile @gol
1037 -mno-fast-sw-div -mfast-sw-div @gol
1038 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1039 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1040 -mcustom-fpu-cfg=@var{name} @gol
1041 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1042 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1043
1044 @emph{Nvidia PTX Options}
1045 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1046
1047 @emph{OpenRISC Options}
1048 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1049 -msoft-mul -msoft-div @gol
1050 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1051 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1052
1053 @emph{PDP-11 Options}
1054 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1055 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1056 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1057
1058 @emph{picoChip Options}
1059 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1060 -msymbol-as-address -mno-inefficient-warnings}
1061
1062 @emph{PowerPC Options}
1063 See RS/6000 and PowerPC Options.
1064
1065 @emph{PRU Options}
1066 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1067 -mabi=@var{variant} @gol}
1068
1069 @emph{RISC-V Options}
1070 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1071 -mplt -mno-plt @gol
1072 -mabi=@var{ABI-string} @gol
1073 -mfdiv -mno-fdiv @gol
1074 -mdiv -mno-div @gol
1075 -march=@var{ISA-string} @gol
1076 -mtune=@var{processor-string} @gol
1077 -mpreferred-stack-boundary=@var{num} @gol
1078 -msmall-data-limit=@var{N-bytes} @gol
1079 -msave-restore -mno-save-restore @gol
1080 -mstrict-align -mno-strict-align @gol
1081 -mcmodel=medlow -mcmodel=medany @gol
1082 -mexplicit-relocs -mno-explicit-relocs @gol
1083 -mrelax -mno-relax @gol
1084 -mriscv-attribute -mmo-riscv-attribute @gol
1085 -malign-data=@var{type}}
1086
1087 @emph{RL78 Options}
1088 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1089 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1090 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1091
1092 @emph{RS/6000 and PowerPC Options}
1093 @gccoptlist{-mcpu=@var{cpu-type} @gol
1094 -mtune=@var{cpu-type} @gol
1095 -mcmodel=@var{code-model} @gol
1096 -mpowerpc64 @gol
1097 -maltivec -mno-altivec @gol
1098 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1099 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1100 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1101 -mfprnd -mno-fprnd @gol
1102 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1103 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1104 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1105 -malign-power -malign-natural @gol
1106 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1107 -mupdate -mno-update @gol
1108 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1109 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1110 -mstrict-align -mno-strict-align -mrelocatable @gol
1111 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1112 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1113 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1114 -mprioritize-restricted-insns=@var{priority} @gol
1115 -msched-costly-dep=@var{dependence_type} @gol
1116 -minsert-sched-nops=@var{scheme} @gol
1117 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1118 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1119 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1120 -mtraceback=@var{traceback_type} @gol
1121 -maix-struct-return -msvr4-struct-return @gol
1122 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1123 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1124 -mblock-move-inline-limit=@var{num} @gol
1125 -mblock-compare-inline-limit=@var{num} @gol
1126 -mblock-compare-inline-loop-limit=@var{num} @gol
1127 -mstring-compare-inline-limit=@var{num} @gol
1128 -misel -mno-isel @gol
1129 -mvrsave -mno-vrsave @gol
1130 -mmulhw -mno-mulhw @gol
1131 -mdlmzb -mno-dlmzb @gol
1132 -mprototype -mno-prototype @gol
1133 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1134 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1135 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1136 -mno-recip-precision @gol
1137 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1138 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1139 -msave-toc-indirect -mno-save-toc-indirect @gol
1140 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1141 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1142 -mquad-memory -mno-quad-memory @gol
1143 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1144 -mcompat-align-parm -mno-compat-align-parm @gol
1145 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1146 -mgnu-attribute -mno-gnu-attribute @gol
1147 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1148 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1149
1150 @emph{RX Options}
1151 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1152 -mcpu=@gol
1153 -mbig-endian-data -mlittle-endian-data @gol
1154 -msmall-data @gol
1155 -msim -mno-sim@gol
1156 -mas100-syntax -mno-as100-syntax@gol
1157 -mrelax@gol
1158 -mmax-constant-size=@gol
1159 -mint-register=@gol
1160 -mpid@gol
1161 -mallow-string-insns -mno-allow-string-insns@gol
1162 -mjsr@gol
1163 -mno-warn-multiple-fast-interrupts@gol
1164 -msave-acc-in-interrupts}
1165
1166 @emph{S/390 and zSeries Options}
1167 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1168 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1169 -mlong-double-64 -mlong-double-128 @gol
1170 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1171 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1172 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1173 -mhtm -mvx -mzvector @gol
1174 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1175 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1176 -mhotpatch=@var{halfwords},@var{halfwords}}
1177
1178 @emph{Score Options}
1179 @gccoptlist{-meb -mel @gol
1180 -mnhwloop @gol
1181 -muls @gol
1182 -mmac @gol
1183 -mscore5 -mscore5u -mscore7 -mscore7d}
1184
1185 @emph{SH Options}
1186 @gccoptlist{-m1 -m2 -m2e @gol
1187 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1188 -m3 -m3e @gol
1189 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1190 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1191 -mb -ml -mdalign -mrelax @gol
1192 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1193 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1194 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1195 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1196 -maccumulate-outgoing-args @gol
1197 -matomic-model=@var{atomic-model} @gol
1198 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1199 -mcbranch-force-delay-slot @gol
1200 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1201 -mpretend-cmove -mtas}
1202
1203 @emph{Solaris 2 Options}
1204 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1205 -pthreads}
1206
1207 @emph{SPARC Options}
1208 @gccoptlist{-mcpu=@var{cpu-type} @gol
1209 -mtune=@var{cpu-type} @gol
1210 -mcmodel=@var{code-model} @gol
1211 -mmemory-model=@var{mem-model} @gol
1212 -m32 -m64 -mapp-regs -mno-app-regs @gol
1213 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1214 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1215 -mhard-quad-float -msoft-quad-float @gol
1216 -mstack-bias -mno-stack-bias @gol
1217 -mstd-struct-return -mno-std-struct-return @gol
1218 -munaligned-doubles -mno-unaligned-doubles @gol
1219 -muser-mode -mno-user-mode @gol
1220 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1221 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1222 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1223 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1224 -mpopc -mno-popc -msubxc -mno-subxc @gol
1225 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1226 -mlra -mno-lra}
1227
1228 @emph{System V Options}
1229 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1230
1231 @emph{TILE-Gx Options}
1232 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1233 -mcmodel=@var{code-model}}
1234
1235 @emph{TILEPro Options}
1236 @gccoptlist{-mcpu=@var{cpu} -m32}
1237
1238 @emph{V850 Options}
1239 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1240 -mprolog-function -mno-prolog-function -mspace @gol
1241 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1242 -mapp-regs -mno-app-regs @gol
1243 -mdisable-callt -mno-disable-callt @gol
1244 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1245 -mv850e -mv850 -mv850e3v5 @gol
1246 -mloop @gol
1247 -mrelax @gol
1248 -mlong-jumps @gol
1249 -msoft-float @gol
1250 -mhard-float @gol
1251 -mgcc-abi @gol
1252 -mrh850-abi @gol
1253 -mbig-switch}
1254
1255 @emph{VAX Options}
1256 @gccoptlist{-mg -mgnu -munix}
1257
1258 @emph{Visium Options}
1259 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1260 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1261
1262 @emph{VMS Options}
1263 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1264 -mpointer-size=@var{size}}
1265
1266 @emph{VxWorks Options}
1267 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1268 -Xbind-lazy -Xbind-now}
1269
1270 @emph{x86 Options}
1271 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1272 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1273 -mfpmath=@var{unit} @gol
1274 -masm=@var{dialect} -mno-fancy-math-387 @gol
1275 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1276 -mno-wide-multiply -mrtd -malign-double @gol
1277 -mpreferred-stack-boundary=@var{num} @gol
1278 -mincoming-stack-boundary=@var{num} @gol
1279 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1280 -mrecip -mrecip=@var{opt} @gol
1281 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1282 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1283 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1284 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1285 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1286 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1287 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1288 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1289 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1290 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1291 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1292 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1293 -mrdseed -msgx -mavx512vp2intersect@gol
1294 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1295 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1296 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1297 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1298 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1299 -mregparm=@var{num} -msseregparm @gol
1300 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1301 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1302 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1303 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1304 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1305 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1306 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1307 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1308 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1309 -mstack-protector-guard-reg=@var{reg} @gol
1310 -mstack-protector-guard-offset=@var{offset} @gol
1311 -mstack-protector-guard-symbol=@var{symbol} @gol
1312 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1313 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1314 -mindirect-branch-register}
1315
1316 @emph{x86 Windows Options}
1317 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1318 -mnop-fun-dllimport -mthread @gol
1319 -municode -mwin32 -mwindows -fno-set-stack-executable}
1320
1321 @emph{Xstormy16 Options}
1322 @gccoptlist{-msim}
1323
1324 @emph{Xtensa Options}
1325 @gccoptlist{-mconst16 -mno-const16 @gol
1326 -mfused-madd -mno-fused-madd @gol
1327 -mforce-no-pic @gol
1328 -mserialize-volatile -mno-serialize-volatile @gol
1329 -mtext-section-literals -mno-text-section-literals @gol
1330 -mauto-litpools -mno-auto-litpools @gol
1331 -mtarget-align -mno-target-align @gol
1332 -mlongcalls -mno-longcalls}
1333
1334 @emph{zSeries Options}
1335 See S/390 and zSeries Options.
1336 @end table
1337
1338
1339 @node Overall Options
1340 @section Options Controlling the Kind of Output
1341
1342 Compilation can involve up to four stages: preprocessing, compilation
1343 proper, assembly and linking, always in that order. GCC is capable of
1344 preprocessing and compiling several files either into several
1345 assembler input files, or into one assembler input file; then each
1346 assembler input file produces an object file, and linking combines all
1347 the object files (those newly compiled, and those specified as input)
1348 into an executable file.
1349
1350 @cindex file name suffix
1351 For any given input file, the file name suffix determines what kind of
1352 compilation is done:
1353
1354 @table @gcctabopt
1355 @item @var{file}.c
1356 C source code that must be preprocessed.
1357
1358 @item @var{file}.i
1359 C source code that should not be preprocessed.
1360
1361 @item @var{file}.ii
1362 C++ source code that should not be preprocessed.
1363
1364 @item @var{file}.m
1365 Objective-C source code. Note that you must link with the @file{libobjc}
1366 library to make an Objective-C program work.
1367
1368 @item @var{file}.mi
1369 Objective-C source code that should not be preprocessed.
1370
1371 @item @var{file}.mm
1372 @itemx @var{file}.M
1373 Objective-C++ source code. Note that you must link with the @file{libobjc}
1374 library to make an Objective-C++ program work. Note that @samp{.M} refers
1375 to a literal capital M@.
1376
1377 @item @var{file}.mii
1378 Objective-C++ source code that should not be preprocessed.
1379
1380 @item @var{file}.h
1381 C, C++, Objective-C or Objective-C++ header file to be turned into a
1382 precompiled header (default), or C, C++ header file to be turned into an
1383 Ada spec (via the @option{-fdump-ada-spec} switch).
1384
1385 @item @var{file}.cc
1386 @itemx @var{file}.cp
1387 @itemx @var{file}.cxx
1388 @itemx @var{file}.cpp
1389 @itemx @var{file}.CPP
1390 @itemx @var{file}.c++
1391 @itemx @var{file}.C
1392 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1393 the last two letters must both be literally @samp{x}. Likewise,
1394 @samp{.C} refers to a literal capital C@.
1395
1396 @item @var{file}.mm
1397 @itemx @var{file}.M
1398 Objective-C++ source code that must be preprocessed.
1399
1400 @item @var{file}.mii
1401 Objective-C++ source code that should not be preprocessed.
1402
1403 @item @var{file}.hh
1404 @itemx @var{file}.H
1405 @itemx @var{file}.hp
1406 @itemx @var{file}.hxx
1407 @itemx @var{file}.hpp
1408 @itemx @var{file}.HPP
1409 @itemx @var{file}.h++
1410 @itemx @var{file}.tcc
1411 C++ header file to be turned into a precompiled header or Ada spec.
1412
1413 @item @var{file}.f
1414 @itemx @var{file}.for
1415 @itemx @var{file}.ftn
1416 Fixed form Fortran source code that should not be preprocessed.
1417
1418 @item @var{file}.F
1419 @itemx @var{file}.FOR
1420 @itemx @var{file}.fpp
1421 @itemx @var{file}.FPP
1422 @itemx @var{file}.FTN
1423 Fixed form Fortran source code that must be preprocessed (with the traditional
1424 preprocessor).
1425
1426 @item @var{file}.f90
1427 @itemx @var{file}.f95
1428 @itemx @var{file}.f03
1429 @itemx @var{file}.f08
1430 Free form Fortran source code that should not be preprocessed.
1431
1432 @item @var{file}.F90
1433 @itemx @var{file}.F95
1434 @itemx @var{file}.F03
1435 @itemx @var{file}.F08
1436 Free form Fortran source code that must be preprocessed (with the
1437 traditional preprocessor).
1438
1439 @item @var{file}.go
1440 Go source code.
1441
1442 @item @var{file}.brig
1443 BRIG files (binary representation of HSAIL).
1444
1445 @item @var{file}.d
1446 D source code.
1447
1448 @item @var{file}.di
1449 D interface file.
1450
1451 @item @var{file}.dd
1452 D documentation code (Ddoc).
1453
1454 @item @var{file}.ads
1455 Ada source code file that contains a library unit declaration (a
1456 declaration of a package, subprogram, or generic, or a generic
1457 instantiation), or a library unit renaming declaration (a package,
1458 generic, or subprogram renaming declaration). Such files are also
1459 called @dfn{specs}.
1460
1461 @item @var{file}.adb
1462 Ada source code file containing a library unit body (a subprogram or
1463 package body). Such files are also called @dfn{bodies}.
1464
1465 @c GCC also knows about some suffixes for languages not yet included:
1466 @c Ratfor:
1467 @c @var{file}.r
1468
1469 @item @var{file}.s
1470 Assembler code.
1471
1472 @item @var{file}.S
1473 @itemx @var{file}.sx
1474 Assembler code that must be preprocessed.
1475
1476 @item @var{other}
1477 An object file to be fed straight into linking.
1478 Any file name with no recognized suffix is treated this way.
1479 @end table
1480
1481 @opindex x
1482 You can specify the input language explicitly with the @option{-x} option:
1483
1484 @table @gcctabopt
1485 @item -x @var{language}
1486 Specify explicitly the @var{language} for the following input files
1487 (rather than letting the compiler choose a default based on the file
1488 name suffix). This option applies to all following input files until
1489 the next @option{-x} option. Possible values for @var{language} are:
1490 @smallexample
1491 c c-header cpp-output
1492 c++ c++-header c++-cpp-output
1493 objective-c objective-c-header objective-c-cpp-output
1494 objective-c++ objective-c++-header objective-c++-cpp-output
1495 assembler assembler-with-cpp
1496 ada
1497 d
1498 f77 f77-cpp-input f95 f95-cpp-input
1499 go
1500 brig
1501 @end smallexample
1502
1503 @item -x none
1504 Turn off any specification of a language, so that subsequent files are
1505 handled according to their file name suffixes (as they are if @option{-x}
1506 has not been used at all).
1507 @end table
1508
1509 If you only want some of the stages of compilation, you can use
1510 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1511 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1512 @command{gcc} is to stop. Note that some combinations (for example,
1513 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1514
1515 @table @gcctabopt
1516 @item -c
1517 @opindex c
1518 Compile or assemble the source files, but do not link. The linking
1519 stage simply is not done. The ultimate output is in the form of an
1520 object file for each source file.
1521
1522 By default, the object file name for a source file is made by replacing
1523 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1524
1525 Unrecognized input files, not requiring compilation or assembly, are
1526 ignored.
1527
1528 @item -S
1529 @opindex S
1530 Stop after the stage of compilation proper; do not assemble. The output
1531 is in the form of an assembler code file for each non-assembler input
1532 file specified.
1533
1534 By default, the assembler file name for a source file is made by
1535 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1536
1537 Input files that don't require compilation are ignored.
1538
1539 @item -E
1540 @opindex E
1541 Stop after the preprocessing stage; do not run the compiler proper. The
1542 output is in the form of preprocessed source code, which is sent to the
1543 standard output.
1544
1545 Input files that don't require preprocessing are ignored.
1546
1547 @cindex output file option
1548 @item -o @var{file}
1549 @opindex o
1550 Place output in file @var{file}. This applies to whatever
1551 sort of output is being produced, whether it be an executable file,
1552 an object file, an assembler file or preprocessed C code.
1553
1554 If @option{-o} is not specified, the default is to put an executable
1555 file in @file{a.out}, the object file for
1556 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1557 assembler file in @file{@var{source}.s}, a precompiled header file in
1558 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1559 standard output.
1560
1561 @item -v
1562 @opindex v
1563 Print (on standard error output) the commands executed to run the stages
1564 of compilation. Also print the version number of the compiler driver
1565 program and of the preprocessor and the compiler proper.
1566
1567 @item -###
1568 @opindex ###
1569 Like @option{-v} except the commands are not executed and arguments
1570 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1571 This is useful for shell scripts to capture the driver-generated command lines.
1572
1573 @item --help
1574 @opindex help
1575 Print (on the standard output) a description of the command-line options
1576 understood by @command{gcc}. If the @option{-v} option is also specified
1577 then @option{--help} is also passed on to the various processes
1578 invoked by @command{gcc}, so that they can display the command-line options
1579 they accept. If the @option{-Wextra} option has also been specified
1580 (prior to the @option{--help} option), then command-line options that
1581 have no documentation associated with them are also displayed.
1582
1583 @item --target-help
1584 @opindex target-help
1585 Print (on the standard output) a description of target-specific command-line
1586 options for each tool. For some targets extra target-specific
1587 information may also be printed.
1588
1589 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1590 Print (on the standard output) a description of the command-line
1591 options understood by the compiler that fit into all specified classes
1592 and qualifiers. These are the supported classes:
1593
1594 @table @asis
1595 @item @samp{optimizers}
1596 Display all of the optimization options supported by the
1597 compiler.
1598
1599 @item @samp{warnings}
1600 Display all of the options controlling warning messages
1601 produced by the compiler.
1602
1603 @item @samp{target}
1604 Display target-specific options. Unlike the
1605 @option{--target-help} option however, target-specific options of the
1606 linker and assembler are not displayed. This is because those
1607 tools do not currently support the extended @option{--help=} syntax.
1608
1609 @item @samp{params}
1610 Display the values recognized by the @option{--param}
1611 option.
1612
1613 @item @var{language}
1614 Display the options supported for @var{language}, where
1615 @var{language} is the name of one of the languages supported in this
1616 version of GCC@.
1617
1618 @item @samp{common}
1619 Display the options that are common to all languages.
1620 @end table
1621
1622 These are the supported qualifiers:
1623
1624 @table @asis
1625 @item @samp{undocumented}
1626 Display only those options that are undocumented.
1627
1628 @item @samp{joined}
1629 Display options taking an argument that appears after an equal
1630 sign in the same continuous piece of text, such as:
1631 @samp{--help=target}.
1632
1633 @item @samp{separate}
1634 Display options taking an argument that appears as a separate word
1635 following the original option, such as: @samp{-o output-file}.
1636 @end table
1637
1638 Thus for example to display all the undocumented target-specific
1639 switches supported by the compiler, use:
1640
1641 @smallexample
1642 --help=target,undocumented
1643 @end smallexample
1644
1645 The sense of a qualifier can be inverted by prefixing it with the
1646 @samp{^} character, so for example to display all binary warning
1647 options (i.e., ones that are either on or off and that do not take an
1648 argument) that have a description, use:
1649
1650 @smallexample
1651 --help=warnings,^joined,^undocumented
1652 @end smallexample
1653
1654 The argument to @option{--help=} should not consist solely of inverted
1655 qualifiers.
1656
1657 Combining several classes is possible, although this usually
1658 restricts the output so much that there is nothing to display. One
1659 case where it does work, however, is when one of the classes is
1660 @var{target}. For example, to display all the target-specific
1661 optimization options, use:
1662
1663 @smallexample
1664 --help=target,optimizers
1665 @end smallexample
1666
1667 The @option{--help=} option can be repeated on the command line. Each
1668 successive use displays its requested class of options, skipping
1669 those that have already been displayed. If @option{--help} is also
1670 specified anywhere on the command line then this takes precedence
1671 over any @option{--help=} option.
1672
1673 If the @option{-Q} option appears on the command line before the
1674 @option{--help=} option, then the descriptive text displayed by
1675 @option{--help=} is changed. Instead of describing the displayed
1676 options, an indication is given as to whether the option is enabled,
1677 disabled or set to a specific value (assuming that the compiler
1678 knows this at the point where the @option{--help=} option is used).
1679
1680 Here is a truncated example from the ARM port of @command{gcc}:
1681
1682 @smallexample
1683 % gcc -Q -mabi=2 --help=target -c
1684 The following options are target specific:
1685 -mabi= 2
1686 -mabort-on-noreturn [disabled]
1687 -mapcs [disabled]
1688 @end smallexample
1689
1690 The output is sensitive to the effects of previous command-line
1691 options, so for example it is possible to find out which optimizations
1692 are enabled at @option{-O2} by using:
1693
1694 @smallexample
1695 -Q -O2 --help=optimizers
1696 @end smallexample
1697
1698 Alternatively you can discover which binary optimizations are enabled
1699 by @option{-O3} by using:
1700
1701 @smallexample
1702 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1703 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1704 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1705 @end smallexample
1706
1707 @item --version
1708 @opindex version
1709 Display the version number and copyrights of the invoked GCC@.
1710
1711 @item -pass-exit-codes
1712 @opindex pass-exit-codes
1713 Normally the @command{gcc} program exits with the code of 1 if any
1714 phase of the compiler returns a non-success return code. If you specify
1715 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1716 the numerically highest error produced by any phase returning an error
1717 indication. The C, C++, and Fortran front ends return 4 if an internal
1718 compiler error is encountered.
1719
1720 @item -pipe
1721 @opindex pipe
1722 Use pipes rather than temporary files for communication between the
1723 various stages of compilation. This fails to work on some systems where
1724 the assembler is unable to read from a pipe; but the GNU assembler has
1725 no trouble.
1726
1727 @item -specs=@var{file}
1728 @opindex specs
1729 Process @var{file} after the compiler reads in the standard @file{specs}
1730 file, in order to override the defaults which the @command{gcc} driver
1731 program uses when determining what switches to pass to @command{cc1},
1732 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1733 @option{-specs=@var{file}} can be specified on the command line, and they
1734 are processed in order, from left to right. @xref{Spec Files}, for
1735 information about the format of the @var{file}.
1736
1737 @item -wrapper
1738 @opindex wrapper
1739 Invoke all subcommands under a wrapper program. The name of the
1740 wrapper program and its parameters are passed as a comma separated
1741 list.
1742
1743 @smallexample
1744 gcc -c t.c -wrapper gdb,--args
1745 @end smallexample
1746
1747 @noindent
1748 This invokes all subprograms of @command{gcc} under
1749 @samp{gdb --args}, thus the invocation of @command{cc1} is
1750 @samp{gdb --args cc1 @dots{}}.
1751
1752 @item -ffile-prefix-map=@var{old}=@var{new}
1753 @opindex ffile-prefix-map
1754 When compiling files residing in directory @file{@var{old}}, record
1755 any references to them in the result of the compilation as if the
1756 files resided in directory @file{@var{new}} instead. Specifying this
1757 option is equivalent to specifying all the individual
1758 @option{-f*-prefix-map} options. This can be used to make reproducible
1759 builds that are location independent. See also
1760 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1761
1762 @item -fplugin=@var{name}.so
1763 @opindex fplugin
1764 Load the plugin code in file @var{name}.so, assumed to be a
1765 shared object to be dlopen'd by the compiler. The base name of
1766 the shared object file is used to identify the plugin for the
1767 purposes of argument parsing (See
1768 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1769 Each plugin should define the callback functions specified in the
1770 Plugins API.
1771
1772 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1773 @opindex fplugin-arg
1774 Define an argument called @var{key} with a value of @var{value}
1775 for the plugin called @var{name}.
1776
1777 @item -fdump-ada-spec@r{[}-slim@r{]}
1778 @opindex fdump-ada-spec
1779 For C and C++ source and include files, generate corresponding Ada specs.
1780 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1781 GNAT User's Guide}, which provides detailed documentation on this feature.
1782
1783 @item -fada-spec-parent=@var{unit}
1784 @opindex fada-spec-parent
1785 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1786 Ada specs as child units of parent @var{unit}.
1787
1788 @item -fdump-go-spec=@var{file}
1789 @opindex fdump-go-spec
1790 For input files in any language, generate corresponding Go
1791 declarations in @var{file}. This generates Go @code{const},
1792 @code{type}, @code{var}, and @code{func} declarations which may be a
1793 useful way to start writing a Go interface to code written in some
1794 other language.
1795
1796 @include @value{srcdir}/../libiberty/at-file.texi
1797 @end table
1798
1799 @node Invoking G++
1800 @section Compiling C++ Programs
1801
1802 @cindex suffixes for C++ source
1803 @cindex C++ source file suffixes
1804 C++ source files conventionally use one of the suffixes @samp{.C},
1805 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1806 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1807 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1808 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1809 files with these names and compiles them as C++ programs even if you
1810 call the compiler the same way as for compiling C programs (usually
1811 with the name @command{gcc}).
1812
1813 @findex g++
1814 @findex c++
1815 However, the use of @command{gcc} does not add the C++ library.
1816 @command{g++} is a program that calls GCC and automatically specifies linking
1817 against the C++ library. It treats @samp{.c},
1818 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1819 files unless @option{-x} is used. This program is also useful when
1820 precompiling a C header file with a @samp{.h} extension for use in C++
1821 compilations. On many systems, @command{g++} is also installed with
1822 the name @command{c++}.
1823
1824 @cindex invoking @command{g++}
1825 When you compile C++ programs, you may specify many of the same
1826 command-line options that you use for compiling programs in any
1827 language; or command-line options meaningful for C and related
1828 languages; or options that are meaningful only for C++ programs.
1829 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1830 explanations of options for languages related to C@.
1831 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1832 explanations of options that are meaningful only for C++ programs.
1833
1834 @node C Dialect Options
1835 @section Options Controlling C Dialect
1836 @cindex dialect options
1837 @cindex language dialect options
1838 @cindex options, dialect
1839
1840 The following options control the dialect of C (or languages derived
1841 from C, such as C++, Objective-C and Objective-C++) that the compiler
1842 accepts:
1843
1844 @table @gcctabopt
1845 @cindex ANSI support
1846 @cindex ISO support
1847 @item -ansi
1848 @opindex ansi
1849 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1850 equivalent to @option{-std=c++98}.
1851
1852 This turns off certain features of GCC that are incompatible with ISO
1853 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1854 such as the @code{asm} and @code{typeof} keywords, and
1855 predefined macros such as @code{unix} and @code{vax} that identify the
1856 type of system you are using. It also enables the undesirable and
1857 rarely used ISO trigraph feature. For the C compiler,
1858 it disables recognition of C++ style @samp{//} comments as well as
1859 the @code{inline} keyword.
1860
1861 The alternate keywords @code{__asm__}, @code{__extension__},
1862 @code{__inline__} and @code{__typeof__} continue to work despite
1863 @option{-ansi}. You would not want to use them in an ISO C program, of
1864 course, but it is useful to put them in header files that might be included
1865 in compilations done with @option{-ansi}. Alternate predefined macros
1866 such as @code{__unix__} and @code{__vax__} are also available, with or
1867 without @option{-ansi}.
1868
1869 The @option{-ansi} option does not cause non-ISO programs to be
1870 rejected gratuitously. For that, @option{-Wpedantic} is required in
1871 addition to @option{-ansi}. @xref{Warning Options}.
1872
1873 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1874 option is used. Some header files may notice this macro and refrain
1875 from declaring certain functions or defining certain macros that the
1876 ISO standard doesn't call for; this is to avoid interfering with any
1877 programs that might use these names for other things.
1878
1879 Functions that are normally built in but do not have semantics
1880 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1881 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1882 built-in functions provided by GCC}, for details of the functions
1883 affected.
1884
1885 @item -std=
1886 @opindex std
1887 Determine the language standard. @xref{Standards,,Language Standards
1888 Supported by GCC}, for details of these standard versions. This option
1889 is currently only supported when compiling C or C++.
1890
1891 The compiler can accept several base standards, such as @samp{c90} or
1892 @samp{c++98}, and GNU dialects of those standards, such as
1893 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1894 compiler accepts all programs following that standard plus those
1895 using GNU extensions that do not contradict it. For example,
1896 @option{-std=c90} turns off certain features of GCC that are
1897 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1898 keywords, but not other GNU extensions that do not have a meaning in
1899 ISO C90, such as omitting the middle term of a @code{?:}
1900 expression. On the other hand, when a GNU dialect of a standard is
1901 specified, all features supported by the compiler are enabled, even when
1902 those features change the meaning of the base standard. As a result, some
1903 strict-conforming programs may be rejected. The particular standard
1904 is used by @option{-Wpedantic} to identify which features are GNU
1905 extensions given that version of the standard. For example
1906 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1907 comments, while @option{-std=gnu99 -Wpedantic} does not.
1908
1909 A value for this option must be provided; possible values are
1910
1911 @table @samp
1912 @item c90
1913 @itemx c89
1914 @itemx iso9899:1990
1915 Support all ISO C90 programs (certain GNU extensions that conflict
1916 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1917
1918 @item iso9899:199409
1919 ISO C90 as modified in amendment 1.
1920
1921 @item c99
1922 @itemx c9x
1923 @itemx iso9899:1999
1924 @itemx iso9899:199x
1925 ISO C99. This standard is substantially completely supported, modulo
1926 bugs and floating-point issues
1927 (mainly but not entirely relating to optional C99 features from
1928 Annexes F and G). See
1929 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1930 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1931
1932 @item c11
1933 @itemx c1x
1934 @itemx iso9899:2011
1935 ISO C11, the 2011 revision of the ISO C standard. This standard is
1936 substantially completely supported, modulo bugs, floating-point issues
1937 (mainly but not entirely relating to optional C11 features from
1938 Annexes F and G) and the optional Annexes K (Bounds-checking
1939 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1940
1941 @item c17
1942 @itemx c18
1943 @itemx iso9899:2017
1944 @itemx iso9899:2018
1945 ISO C17, the 2017 revision of the ISO C standard
1946 (published in 2018). This standard is
1947 same as C11 except for corrections of defects (all of which are also
1948 applied with @option{-std=c11}) and a new value of
1949 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1950
1951 @item c2x
1952 The next version of the ISO C standard, still under development. The
1953 support for this version is experimental and incomplete.
1954
1955 @item gnu90
1956 @itemx gnu89
1957 GNU dialect of ISO C90 (including some C99 features).
1958
1959 @item gnu99
1960 @itemx gnu9x
1961 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1962
1963 @item gnu11
1964 @itemx gnu1x
1965 GNU dialect of ISO C11.
1966 The name @samp{gnu1x} is deprecated.
1967
1968 @item gnu17
1969 @itemx gnu18
1970 GNU dialect of ISO C17. This is the default for C code.
1971
1972 @item gnu2x
1973 The next version of the ISO C standard, still under development, plus
1974 GNU extensions. The support for this version is experimental and
1975 incomplete.
1976
1977 @item c++98
1978 @itemx c++03
1979 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1980 additional defect reports. Same as @option{-ansi} for C++ code.
1981
1982 @item gnu++98
1983 @itemx gnu++03
1984 GNU dialect of @option{-std=c++98}.
1985
1986 @item c++11
1987 @itemx c++0x
1988 The 2011 ISO C++ standard plus amendments.
1989 The name @samp{c++0x} is deprecated.
1990
1991 @item gnu++11
1992 @itemx gnu++0x
1993 GNU dialect of @option{-std=c++11}.
1994 The name @samp{gnu++0x} is deprecated.
1995
1996 @item c++14
1997 @itemx c++1y
1998 The 2014 ISO C++ standard plus amendments.
1999 The name @samp{c++1y} is deprecated.
2000
2001 @item gnu++14
2002 @itemx gnu++1y
2003 GNU dialect of @option{-std=c++14}.
2004 This is the default for C++ code.
2005 The name @samp{gnu++1y} is deprecated.
2006
2007 @item c++17
2008 @itemx c++1z
2009 The 2017 ISO C++ standard plus amendments.
2010 The name @samp{c++1z} is deprecated.
2011
2012 @item gnu++17
2013 @itemx gnu++1z
2014 GNU dialect of @option{-std=c++17}.
2015 The name @samp{gnu++1z} is deprecated.
2016
2017 @item c++2a
2018 The next revision of the ISO C++ standard, tentatively planned for
2019 2020. Support is highly experimental, and will almost certainly
2020 change in incompatible ways in future releases.
2021
2022 @item gnu++2a
2023 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2024 and will almost certainly change in incompatible ways in future
2025 releases.
2026 @end table
2027
2028 @item -fgnu89-inline
2029 @opindex fgnu89-inline
2030 The option @option{-fgnu89-inline} tells GCC to use the traditional
2031 GNU semantics for @code{inline} functions when in C99 mode.
2032 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2033 Using this option is roughly equivalent to adding the
2034 @code{gnu_inline} function attribute to all inline functions
2035 (@pxref{Function Attributes}).
2036
2037 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2038 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2039 specifies the default behavior).
2040 This option is not supported in @option{-std=c90} or
2041 @option{-std=gnu90} mode.
2042
2043 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2044 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2045 in effect for @code{inline} functions. @xref{Common Predefined
2046 Macros,,,cpp,The C Preprocessor}.
2047
2048 @item -fpermitted-flt-eval-methods=@var{style}
2049 @opindex fpermitted-flt-eval-methods
2050 @opindex fpermitted-flt-eval-methods=c11
2051 @opindex fpermitted-flt-eval-methods=ts-18661-3
2052 ISO/IEC TS 18661-3 defines new permissible values for
2053 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2054 a semantic type that is an interchange or extended format should be
2055 evaluated to the precision and range of that type. These new values are
2056 a superset of those permitted under C99/C11, which does not specify the
2057 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2058 conforming to C11 may not have been written expecting the possibility of
2059 the new values.
2060
2061 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2062 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2063 or the extended set of values specified in ISO/IEC TS 18661-3.
2064
2065 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2066
2067 The default when in a standards compliant mode (@option{-std=c11} or similar)
2068 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2069 dialect (@option{-std=gnu11} or similar) is
2070 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2071
2072 @item -aux-info @var{filename}
2073 @opindex aux-info
2074 Output to the given filename prototyped declarations for all functions
2075 declared and/or defined in a translation unit, including those in header
2076 files. This option is silently ignored in any language other than C@.
2077
2078 Besides declarations, the file indicates, in comments, the origin of
2079 each declaration (source file and line), whether the declaration was
2080 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2081 @samp{O} for old, respectively, in the first character after the line
2082 number and the colon), and whether it came from a declaration or a
2083 definition (@samp{C} or @samp{F}, respectively, in the following
2084 character). In the case of function definitions, a K&R-style list of
2085 arguments followed by their declarations is also provided, inside
2086 comments, after the declaration.
2087
2088 @item -fallow-parameterless-variadic-functions
2089 @opindex fallow-parameterless-variadic-functions
2090 Accept variadic functions without named parameters.
2091
2092 Although it is possible to define such a function, this is not very
2093 useful as it is not possible to read the arguments. This is only
2094 supported for C as this construct is allowed by C++.
2095
2096 @item -fno-asm
2097 @opindex fno-asm
2098 @opindex fasm
2099 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2100 keyword, so that code can use these words as identifiers. You can use
2101 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2102 instead. @option{-ansi} implies @option{-fno-asm}.
2103
2104 In C++, this switch only affects the @code{typeof} keyword, since
2105 @code{asm} and @code{inline} are standard keywords. You may want to
2106 use the @option{-fno-gnu-keywords} flag instead, which has the same
2107 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2108 switch only affects the @code{asm} and @code{typeof} keywords, since
2109 @code{inline} is a standard keyword in ISO C99.
2110
2111 @item -fno-builtin
2112 @itemx -fno-builtin-@var{function}
2113 @opindex fno-builtin
2114 @opindex fbuiltin
2115 @cindex built-in functions
2116 Don't recognize built-in functions that do not begin with
2117 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2118 functions provided by GCC}, for details of the functions affected,
2119 including those which are not built-in functions when @option{-ansi} or
2120 @option{-std} options for strict ISO C conformance are used because they
2121 do not have an ISO standard meaning.
2122
2123 GCC normally generates special code to handle certain built-in functions
2124 more efficiently; for instance, calls to @code{alloca} may become single
2125 instructions which adjust the stack directly, and calls to @code{memcpy}
2126 may become inline copy loops. The resulting code is often both smaller
2127 and faster, but since the function calls no longer appear as such, you
2128 cannot set a breakpoint on those calls, nor can you change the behavior
2129 of the functions by linking with a different library. In addition,
2130 when a function is recognized as a built-in function, GCC may use
2131 information about that function to warn about problems with calls to
2132 that function, or to generate more efficient code, even if the
2133 resulting code still contains calls to that function. For example,
2134 warnings are given with @option{-Wformat} for bad calls to
2135 @code{printf} when @code{printf} is built in and @code{strlen} is
2136 known not to modify global memory.
2137
2138 With the @option{-fno-builtin-@var{function}} option
2139 only the built-in function @var{function} is
2140 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2141 function is named that is not built-in in this version of GCC, this
2142 option is ignored. There is no corresponding
2143 @option{-fbuiltin-@var{function}} option; if you wish to enable
2144 built-in functions selectively when using @option{-fno-builtin} or
2145 @option{-ffreestanding}, you may define macros such as:
2146
2147 @smallexample
2148 #define abs(n) __builtin_abs ((n))
2149 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2150 @end smallexample
2151
2152 @item -fgimple
2153 @opindex fgimple
2154
2155 Enable parsing of function definitions marked with @code{__GIMPLE}.
2156 This is an experimental feature that allows unit testing of GIMPLE
2157 passes.
2158
2159 @item -fhosted
2160 @opindex fhosted
2161 @cindex hosted environment
2162
2163 Assert that compilation targets a hosted environment. This implies
2164 @option{-fbuiltin}. A hosted environment is one in which the
2165 entire standard library is available, and in which @code{main} has a return
2166 type of @code{int}. Examples are nearly everything except a kernel.
2167 This is equivalent to @option{-fno-freestanding}.
2168
2169 @item -ffreestanding
2170 @opindex ffreestanding
2171 @cindex hosted environment
2172
2173 Assert that compilation targets a freestanding environment. This
2174 implies @option{-fno-builtin}. A freestanding environment
2175 is one in which the standard library may not exist, and program startup may
2176 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2177 This is equivalent to @option{-fno-hosted}.
2178
2179 @xref{Standards,,Language Standards Supported by GCC}, for details of
2180 freestanding and hosted environments.
2181
2182 @item -fopenacc
2183 @opindex fopenacc
2184 @cindex OpenACC accelerator programming
2185 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2186 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2187 compiler generates accelerated code according to the OpenACC Application
2188 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2189 implies @option{-pthread}, and thus is only supported on targets that
2190 have support for @option{-pthread}.
2191
2192 @item -fopenacc-dim=@var{geom}
2193 @opindex fopenacc-dim
2194 @cindex OpenACC accelerator programming
2195 Specify default compute dimensions for parallel offload regions that do
2196 not explicitly specify. The @var{geom} value is a triple of
2197 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2198 can be omitted, to use a target-specific default value.
2199
2200 @item -fopenmp
2201 @opindex fopenmp
2202 @cindex OpenMP parallel
2203 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2204 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2205 compiler generates parallel code according to the OpenMP Application
2206 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2207 implies @option{-pthread}, and thus is only supported on targets that
2208 have support for @option{-pthread}. @option{-fopenmp} implies
2209 @option{-fopenmp-simd}.
2210
2211 @item -fopenmp-simd
2212 @opindex fopenmp-simd
2213 @cindex OpenMP SIMD
2214 @cindex SIMD
2215 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2216 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2217 are ignored.
2218
2219 @item -fgnu-tm
2220 @opindex fgnu-tm
2221 When the option @option{-fgnu-tm} is specified, the compiler
2222 generates code for the Linux variant of Intel's current Transactional
2223 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2224 an experimental feature whose interface may change in future versions
2225 of GCC, as the official specification changes. Please note that not
2226 all architectures are supported for this feature.
2227
2228 For more information on GCC's support for transactional memory,
2229 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2230 Transactional Memory Library}.
2231
2232 Note that the transactional memory feature is not supported with
2233 non-call exceptions (@option{-fnon-call-exceptions}).
2234
2235 @item -fms-extensions
2236 @opindex fms-extensions
2237 Accept some non-standard constructs used in Microsoft header files.
2238
2239 In C++ code, this allows member names in structures to be similar
2240 to previous types declarations.
2241
2242 @smallexample
2243 typedef int UOW;
2244 struct ABC @{
2245 UOW UOW;
2246 @};
2247 @end smallexample
2248
2249 Some cases of unnamed fields in structures and unions are only
2250 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2251 fields within structs/unions}, for details.
2252
2253 Note that this option is off for all targets except for x86
2254 targets using ms-abi.
2255
2256 @item -fplan9-extensions
2257 @opindex fplan9-extensions
2258 Accept some non-standard constructs used in Plan 9 code.
2259
2260 This enables @option{-fms-extensions}, permits passing pointers to
2261 structures with anonymous fields to functions that expect pointers to
2262 elements of the type of the field, and permits referring to anonymous
2263 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2264 struct/union fields within structs/unions}, for details. This is only
2265 supported for C, not C++.
2266
2267 @item -fcond-mismatch
2268 @opindex fcond-mismatch
2269 Allow conditional expressions with mismatched types in the second and
2270 third arguments. The value of such an expression is void. This option
2271 is not supported for C++.
2272
2273 @item -flax-vector-conversions
2274 @opindex flax-vector-conversions
2275 Allow implicit conversions between vectors with differing numbers of
2276 elements and/or incompatible element types. This option should not be
2277 used for new code.
2278
2279 @item -funsigned-char
2280 @opindex funsigned-char
2281 Let the type @code{char} be unsigned, like @code{unsigned char}.
2282
2283 Each kind of machine has a default for what @code{char} should
2284 be. It is either like @code{unsigned char} by default or like
2285 @code{signed char} by default.
2286
2287 Ideally, a portable program should always use @code{signed char} or
2288 @code{unsigned char} when it depends on the signedness of an object.
2289 But many programs have been written to use plain @code{char} and
2290 expect it to be signed, or expect it to be unsigned, depending on the
2291 machines they were written for. This option, and its inverse, let you
2292 make such a program work with the opposite default.
2293
2294 The type @code{char} is always a distinct type from each of
2295 @code{signed char} or @code{unsigned char}, even though its behavior
2296 is always just like one of those two.
2297
2298 @item -fsigned-char
2299 @opindex fsigned-char
2300 Let the type @code{char} be signed, like @code{signed char}.
2301
2302 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2303 the negative form of @option{-funsigned-char}. Likewise, the option
2304 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2305
2306 @item -fsigned-bitfields
2307 @itemx -funsigned-bitfields
2308 @itemx -fno-signed-bitfields
2309 @itemx -fno-unsigned-bitfields
2310 @opindex fsigned-bitfields
2311 @opindex funsigned-bitfields
2312 @opindex fno-signed-bitfields
2313 @opindex fno-unsigned-bitfields
2314 These options control whether a bit-field is signed or unsigned, when the
2315 declaration does not use either @code{signed} or @code{unsigned}. By
2316 default, such a bit-field is signed, because this is consistent: the
2317 basic integer types such as @code{int} are signed types.
2318
2319 @item -fsso-struct=@var{endianness}
2320 @opindex fsso-struct
2321 Set the default scalar storage order of structures and unions to the
2322 specified endianness. The accepted values are @samp{big-endian},
2323 @samp{little-endian} and @samp{native} for the native endianness of
2324 the target (the default). This option is not supported for C++.
2325
2326 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2327 code that is not binary compatible with code generated without it if the
2328 specified endianness is not the native endianness of the target.
2329 @end table
2330
2331 @node C++ Dialect Options
2332 @section Options Controlling C++ Dialect
2333
2334 @cindex compiler options, C++
2335 @cindex C++ options, command-line
2336 @cindex options, C++
2337 This section describes the command-line options that are only meaningful
2338 for C++ programs. You can also use most of the GNU compiler options
2339 regardless of what language your program is in. For example, you
2340 might compile a file @file{firstClass.C} like this:
2341
2342 @smallexample
2343 g++ -g -fstrict-enums -O -c firstClass.C
2344 @end smallexample
2345
2346 @noindent
2347 In this example, only @option{-fstrict-enums} is an option meant
2348 only for C++ programs; you can use the other options with any
2349 language supported by GCC@.
2350
2351 Some options for compiling C programs, such as @option{-std}, are also
2352 relevant for C++ programs.
2353 @xref{C Dialect Options,,Options Controlling C Dialect}.
2354
2355 Here is a list of options that are @emph{only} for compiling C++ programs:
2356
2357 @table @gcctabopt
2358
2359 @item -fabi-version=@var{n}
2360 @opindex fabi-version
2361 Use version @var{n} of the C++ ABI@. The default is version 0.
2362
2363 Version 0 refers to the version conforming most closely to
2364 the C++ ABI specification. Therefore, the ABI obtained using version 0
2365 will change in different versions of G++ as ABI bugs are fixed.
2366
2367 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2368
2369 Version 2 is the version of the C++ ABI that first appeared in G++
2370 3.4, and was the default through G++ 4.9.
2371
2372 Version 3 corrects an error in mangling a constant address as a
2373 template argument.
2374
2375 Version 4, which first appeared in G++ 4.5, implements a standard
2376 mangling for vector types.
2377
2378 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2379 attribute const/volatile on function pointer types, decltype of a
2380 plain decl, and use of a function parameter in the declaration of
2381 another parameter.
2382
2383 Version 6, which first appeared in G++ 4.7, corrects the promotion
2384 behavior of C++11 scoped enums and the mangling of template argument
2385 packs, const/static_cast, prefix ++ and --, and a class scope function
2386 used as a template argument.
2387
2388 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2389 builtin type and corrects the mangling of lambdas in default argument
2390 scope.
2391
2392 Version 8, which first appeared in G++ 4.9, corrects the substitution
2393 behavior of function types with function-cv-qualifiers.
2394
2395 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2396 @code{nullptr_t}.
2397
2398 Version 10, which first appeared in G++ 6.1, adds mangling of
2399 attributes that affect type identity, such as ia32 calling convention
2400 attributes (e.g.@: @samp{stdcall}).
2401
2402 Version 11, which first appeared in G++ 7, corrects the mangling of
2403 sizeof... expressions and operator names. For multiple entities with
2404 the same name within a function, that are declared in different scopes,
2405 the mangling now changes starting with the twelfth occurrence. It also
2406 implies @option{-fnew-inheriting-ctors}.
2407
2408 Version 12, which first appeared in G++ 8, corrects the calling
2409 conventions for empty classes on the x86_64 target and for classes
2410 with only deleted copy/move constructors. It accidentally changes the
2411 calling convention for classes with a deleted copy constructor and a
2412 trivial move constructor.
2413
2414 Version 13, which first appeared in G++ 8.2, fixes the accidental
2415 change in version 12.
2416
2417 Version 14, which first appeared in G++ 10, corrects the mangling of
2418 the nullptr expression.
2419
2420 See also @option{-Wabi}.
2421
2422 @item -fabi-compat-version=@var{n}
2423 @opindex fabi-compat-version
2424 On targets that support strong aliases, G++
2425 works around mangling changes by creating an alias with the correct
2426 mangled name when defining a symbol with an incorrect mangled name.
2427 This switch specifies which ABI version to use for the alias.
2428
2429 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2430 compatibility). If another ABI version is explicitly selected, this
2431 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2432 use @option{-fabi-compat-version=2}.
2433
2434 If this option is not provided but @option{-Wabi=@var{n}} is, that
2435 version is used for compatibility aliases. If this option is provided
2436 along with @option{-Wabi} (without the version), the version from this
2437 option is used for the warning.
2438
2439 @item -fno-access-control
2440 @opindex fno-access-control
2441 @opindex faccess-control
2442 Turn off all access checking. This switch is mainly useful for working
2443 around bugs in the access control code.
2444
2445 @item -faligned-new
2446 @opindex faligned-new
2447 Enable support for C++17 @code{new} of types that require more
2448 alignment than @code{void* ::operator new(std::size_t)} provides. A
2449 numeric argument such as @code{-faligned-new=32} can be used to
2450 specify how much alignment (in bytes) is provided by that function,
2451 but few users will need to override the default of
2452 @code{alignof(std::max_align_t)}.
2453
2454 This flag is enabled by default for @option{-std=c++17}.
2455
2456 @item -fchar8_t
2457 @itemx -fno-char8_t
2458 @opindex fchar8_t
2459 @opindex fno-char8_t
2460 Enable support for @code{char8_t} as adopted for C++2a. This includes
2461 the addition of a new @code{char8_t} fundamental type, changes to the
2462 types of UTF-8 string and character literals, new signatures for
2463 user-defined literals, associated standard library updates, and new
2464 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2465
2466 This option enables functions to be overloaded for ordinary and UTF-8
2467 strings:
2468
2469 @smallexample
2470 int f(const char *); // #1
2471 int f(const char8_t *); // #2
2472 int v1 = f("text"); // Calls #1
2473 int v2 = f(u8"text"); // Calls #2
2474 @end smallexample
2475
2476 @noindent
2477 and introduces new signatures for user-defined literals:
2478
2479 @smallexample
2480 int operator""_udl1(char8_t);
2481 int v3 = u8'x'_udl1;
2482 int operator""_udl2(const char8_t*, std::size_t);
2483 int v4 = u8"text"_udl2;
2484 template<typename T, T...> int operator""_udl3();
2485 int v5 = u8"text"_udl3;
2486 @end smallexample
2487
2488 @noindent
2489 The change to the types of UTF-8 string and character literals introduces
2490 incompatibilities with ISO C++11 and later standards. For example, the
2491 following code is well-formed under ISO C++11, but is ill-formed when
2492 @option{-fchar8_t} is specified.
2493
2494 @smallexample
2495 char ca[] = u8"xx"; // error: char-array initialized from wide
2496 // string
2497 const char *cp = u8"xx";// error: invalid conversion from
2498 // `const char8_t*' to `const char*'
2499 int f(const char*);
2500 auto v = f(u8"xx"); // error: invalid conversion from
2501 // `const char8_t*' to `const char*'
2502 std::string s@{u8"xx"@}; // error: no matching function for call to
2503 // `std::basic_string<char>::basic_string()'
2504 using namespace std::literals;
2505 s = u8"xx"s; // error: conversion from
2506 // `basic_string<char8_t>' to non-scalar
2507 // type `basic_string<char>' requested
2508 @end smallexample
2509
2510 @item -fcheck-new
2511 @opindex fcheck-new
2512 Check that the pointer returned by @code{operator new} is non-null
2513 before attempting to modify the storage allocated. This check is
2514 normally unnecessary because the C++ standard specifies that
2515 @code{operator new} only returns @code{0} if it is declared
2516 @code{throw()}, in which case the compiler always checks the
2517 return value even without this option. In all other cases, when
2518 @code{operator new} has a non-empty exception specification, memory
2519 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2520 @samp{new (nothrow)}.
2521
2522 @item -fconcepts
2523 @itemx -fconcepts-ts
2524 @opindex fconcepts
2525 @opindex fconcepts-ts
2526 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2527 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2528
2529 With @option{-std=c++2a} and above, Concepts are part of the language
2530 standard, so @option{-fconcepts} defaults to on. But the standard
2531 specification of Concepts differs significantly from the TS, so some
2532 constructs that were allowed in the TS but didn't make it into the
2533 standard can still be enabled by @option{-fconcepts-ts}.
2534
2535 @item -fconstexpr-depth=@var{n}
2536 @opindex fconstexpr-depth
2537 Set the maximum nested evaluation depth for C++11 constexpr functions
2538 to @var{n}. A limit is needed to detect endless recursion during
2539 constant expression evaluation. The minimum specified by the standard
2540 is 512.
2541
2542 @item -fconstexpr-cache-depth=@var{n}
2543 @opindex fconstexpr-cache-depth
2544 Set the maximum level of nested evaluation depth for C++11 constexpr
2545 functions that will be cached to @var{n}. This is a heuristic that
2546 trades off compilation speed (when the cache avoids repeated
2547 calculations) against memory consumption (when the cache grows very
2548 large from highly recursive evaluations). The default is 8. Very few
2549 users are likely to want to adjust it, but if your code does heavy
2550 constexpr calculations you might want to experiment to find which
2551 value works best for you.
2552
2553 @item -fconstexpr-loop-limit=@var{n}
2554 @opindex fconstexpr-loop-limit
2555 Set the maximum number of iterations for a loop in C++14 constexpr functions
2556 to @var{n}. A limit is needed to detect infinite loops during
2557 constant expression evaluation. The default is 262144 (1<<18).
2558
2559 @item -fconstexpr-ops-limit=@var{n}
2560 @opindex fconstexpr-ops-limit
2561 Set the maximum number of operations during a single constexpr evaluation.
2562 Even when number of iterations of a single loop is limited with the above limit,
2563 if there are several nested loops and each of them has many iterations but still
2564 smaller than the above limit, or if in a body of some loop or even outside
2565 of a loop too many expressions need to be evaluated, the resulting constexpr
2566 evaluation might take too long.
2567 The default is 33554432 (1<<25).
2568
2569 @item -fno-elide-constructors
2570 @opindex fno-elide-constructors
2571 @opindex felide-constructors
2572 The C++ standard allows an implementation to omit creating a temporary
2573 that is only used to initialize another object of the same type.
2574 Specifying this option disables that optimization, and forces G++ to
2575 call the copy constructor in all cases. This option also causes G++
2576 to call trivial member functions which otherwise would be expanded inline.
2577
2578 In C++17, the compiler is required to omit these temporaries, but this
2579 option still affects trivial member functions.
2580
2581 @item -fno-enforce-eh-specs
2582 @opindex fno-enforce-eh-specs
2583 @opindex fenforce-eh-specs
2584 Don't generate code to check for violation of exception specifications
2585 at run time. This option violates the C++ standard, but may be useful
2586 for reducing code size in production builds, much like defining
2587 @code{NDEBUG}. This does not give user code permission to throw
2588 exceptions in violation of the exception specifications; the compiler
2589 still optimizes based on the specifications, so throwing an
2590 unexpected exception results in undefined behavior at run time.
2591
2592 @item -fextern-tls-init
2593 @itemx -fno-extern-tls-init
2594 @opindex fextern-tls-init
2595 @opindex fno-extern-tls-init
2596 The C++11 and OpenMP standards allow @code{thread_local} and
2597 @code{threadprivate} variables to have dynamic (runtime)
2598 initialization. To support this, any use of such a variable goes
2599 through a wrapper function that performs any necessary initialization.
2600 When the use and definition of the variable are in the same
2601 translation unit, this overhead can be optimized away, but when the
2602 use is in a different translation unit there is significant overhead
2603 even if the variable doesn't actually need dynamic initialization. If
2604 the programmer can be sure that no use of the variable in a
2605 non-defining TU needs to trigger dynamic initialization (either
2606 because the variable is statically initialized, or a use of the
2607 variable in the defining TU will be executed before any uses in
2608 another TU), they can avoid this overhead with the
2609 @option{-fno-extern-tls-init} option.
2610
2611 On targets that support symbol aliases, the default is
2612 @option{-fextern-tls-init}. On targets that do not support symbol
2613 aliases, the default is @option{-fno-extern-tls-init}.
2614
2615 @item -fno-gnu-keywords
2616 @opindex fno-gnu-keywords
2617 @opindex fgnu-keywords
2618 Do not recognize @code{typeof} as a keyword, so that code can use this
2619 word as an identifier. You can use the keyword @code{__typeof__} instead.
2620 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2621 @option{-std=c++98}, @option{-std=c++11}, etc.
2622
2623 @item -fno-implicit-templates
2624 @opindex fno-implicit-templates
2625 @opindex fimplicit-templates
2626 Never emit code for non-inline templates that are instantiated
2627 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2628 If you use this option, you must take care to structure your code to
2629 include all the necessary explicit instantiations to avoid getting
2630 undefined symbols at link time.
2631 @xref{Template Instantiation}, for more information.
2632
2633 @item -fno-implicit-inline-templates
2634 @opindex fno-implicit-inline-templates
2635 @opindex fimplicit-inline-templates
2636 Don't emit code for implicit instantiations of inline templates, either.
2637 The default is to handle inlines differently so that compiles with and
2638 without optimization need the same set of explicit instantiations.
2639
2640 @item -fno-implement-inlines
2641 @opindex fno-implement-inlines
2642 @opindex fimplement-inlines
2643 To save space, do not emit out-of-line copies of inline functions
2644 controlled by @code{#pragma implementation}. This causes linker
2645 errors if these functions are not inlined everywhere they are called.
2646
2647 @item -fms-extensions
2648 @opindex fms-extensions
2649 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2650 int and getting a pointer to member function via non-standard syntax.
2651
2652 @item -fnew-inheriting-ctors
2653 @opindex fnew-inheriting-ctors
2654 Enable the P0136 adjustment to the semantics of C++11 constructor
2655 inheritance. This is part of C++17 but also considered to be a Defect
2656 Report against C++11 and C++14. This flag is enabled by default
2657 unless @option{-fabi-version=10} or lower is specified.
2658
2659 @item -fnew-ttp-matching
2660 @opindex fnew-ttp-matching
2661 Enable the P0522 resolution to Core issue 150, template template
2662 parameters and default arguments: this allows a template with default
2663 template arguments as an argument for a template template parameter
2664 with fewer template parameters. This flag is enabled by default for
2665 @option{-std=c++17}.
2666
2667 @item -fno-nonansi-builtins
2668 @opindex fno-nonansi-builtins
2669 @opindex fnonansi-builtins
2670 Disable built-in declarations of functions that are not mandated by
2671 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2672 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2673
2674 @item -fnothrow-opt
2675 @opindex fnothrow-opt
2676 Treat a @code{throw()} exception specification as if it were a
2677 @code{noexcept} specification to reduce or eliminate the text size
2678 overhead relative to a function with no exception specification. If
2679 the function has local variables of types with non-trivial
2680 destructors, the exception specification actually makes the
2681 function smaller because the EH cleanups for those variables can be
2682 optimized away. The semantic effect is that an exception thrown out of
2683 a function with such an exception specification results in a call
2684 to @code{terminate} rather than @code{unexpected}.
2685
2686 @item -fno-operator-names
2687 @opindex fno-operator-names
2688 @opindex foperator-names
2689 Do not treat the operator name keywords @code{and}, @code{bitand},
2690 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2691 synonyms as keywords.
2692
2693 @item -fno-optional-diags
2694 @opindex fno-optional-diags
2695 @opindex foptional-diags
2696 Disable diagnostics that the standard says a compiler does not need to
2697 issue. Currently, the only such diagnostic issued by G++ is the one for
2698 a name having multiple meanings within a class.
2699
2700 @item -fpermissive
2701 @opindex fpermissive
2702 Downgrade some diagnostics about nonconformant code from errors to
2703 warnings. Thus, using @option{-fpermissive} allows some
2704 nonconforming code to compile.
2705
2706 @item -fno-pretty-templates
2707 @opindex fno-pretty-templates
2708 @opindex fpretty-templates
2709 When an error message refers to a specialization of a function
2710 template, the compiler normally prints the signature of the
2711 template followed by the template arguments and any typedefs or
2712 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2713 rather than @code{void f(int)}) so that it's clear which template is
2714 involved. When an error message refers to a specialization of a class
2715 template, the compiler omits any template arguments that match
2716 the default template arguments for that template. If either of these
2717 behaviors make it harder to understand the error message rather than
2718 easier, you can use @option{-fno-pretty-templates} to disable them.
2719
2720 @item -fno-rtti
2721 @opindex fno-rtti
2722 @opindex frtti
2723 Disable generation of information about every class with virtual
2724 functions for use by the C++ run-time type identification features
2725 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2726 of the language, you can save some space by using this flag. Note that
2727 exception handling uses the same information, but G++ generates it as
2728 needed. The @code{dynamic_cast} operator can still be used for casts that
2729 do not require run-time type information, i.e.@: casts to @code{void *} or to
2730 unambiguous base classes.
2731
2732 Mixing code compiled with @option{-frtti} with that compiled with
2733 @option{-fno-rtti} may not work. For example, programs may
2734 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2735 for a class compiled with @option{-frtti}.
2736
2737 @item -fsized-deallocation
2738 @opindex fsized-deallocation
2739 Enable the built-in global declarations
2740 @smallexample
2741 void operator delete (void *, std::size_t) noexcept;
2742 void operator delete[] (void *, std::size_t) noexcept;
2743 @end smallexample
2744 as introduced in C++14. This is useful for user-defined replacement
2745 deallocation functions that, for example, use the size of the object
2746 to make deallocation faster. Enabled by default under
2747 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2748 warns about places that might want to add a definition.
2749
2750 @item -fstrict-enums
2751 @opindex fstrict-enums
2752 Allow the compiler to optimize using the assumption that a value of
2753 enumerated type can only be one of the values of the enumeration (as
2754 defined in the C++ standard; basically, a value that can be
2755 represented in the minimum number of bits needed to represent all the
2756 enumerators). This assumption may not be valid if the program uses a
2757 cast to convert an arbitrary integer value to the enumerated type.
2758
2759 @item -fstrong-eval-order
2760 @opindex fstrong-eval-order
2761 Evaluate member access, array subscripting, and shift expressions in
2762 left-to-right order, and evaluate assignment in right-to-left order,
2763 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2764 @option{-fstrong-eval-order=some} enables just the ordering of member
2765 access and shift expressions, and is the default without
2766 @option{-std=c++17}.
2767
2768 @item -ftemplate-backtrace-limit=@var{n}
2769 @opindex ftemplate-backtrace-limit
2770 Set the maximum number of template instantiation notes for a single
2771 warning or error to @var{n}. The default value is 10.
2772
2773 @item -ftemplate-depth=@var{n}
2774 @opindex ftemplate-depth
2775 Set the maximum instantiation depth for template classes to @var{n}.
2776 A limit on the template instantiation depth is needed to detect
2777 endless recursions during template class instantiation. ANSI/ISO C++
2778 conforming programs must not rely on a maximum depth greater than 17
2779 (changed to 1024 in C++11). The default value is 900, as the compiler
2780 can run out of stack space before hitting 1024 in some situations.
2781
2782 @item -fno-threadsafe-statics
2783 @opindex fno-threadsafe-statics
2784 @opindex fthreadsafe-statics
2785 Do not emit the extra code to use the routines specified in the C++
2786 ABI for thread-safe initialization of local statics. You can use this
2787 option to reduce code size slightly in code that doesn't need to be
2788 thread-safe.
2789
2790 @item -fuse-cxa-atexit
2791 @opindex fuse-cxa-atexit
2792 Register destructors for objects with static storage duration with the
2793 @code{__cxa_atexit} function rather than the @code{atexit} function.
2794 This option is required for fully standards-compliant handling of static
2795 destructors, but only works if your C library supports
2796 @code{__cxa_atexit}.
2797
2798 @item -fno-use-cxa-get-exception-ptr
2799 @opindex fno-use-cxa-get-exception-ptr
2800 @opindex fuse-cxa-get-exception-ptr
2801 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2802 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2803 if the runtime routine is not available.
2804
2805 @item -fvisibility-inlines-hidden
2806 @opindex fvisibility-inlines-hidden
2807 This switch declares that the user does not attempt to compare
2808 pointers to inline functions or methods where the addresses of the two functions
2809 are taken in different shared objects.
2810
2811 The effect of this is that GCC may, effectively, mark inline methods with
2812 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2813 appear in the export table of a DSO and do not require a PLT indirection
2814 when used within the DSO@. Enabling this option can have a dramatic effect
2815 on load and link times of a DSO as it massively reduces the size of the
2816 dynamic export table when the library makes heavy use of templates.
2817
2818 The behavior of this switch is not quite the same as marking the
2819 methods as hidden directly, because it does not affect static variables
2820 local to the function or cause the compiler to deduce that
2821 the function is defined in only one shared object.
2822
2823 You may mark a method as having a visibility explicitly to negate the
2824 effect of the switch for that method. For example, if you do want to
2825 compare pointers to a particular inline method, you might mark it as
2826 having default visibility. Marking the enclosing class with explicit
2827 visibility has no effect.
2828
2829 Explicitly instantiated inline methods are unaffected by this option
2830 as their linkage might otherwise cross a shared library boundary.
2831 @xref{Template Instantiation}.
2832
2833 @item -fvisibility-ms-compat
2834 @opindex fvisibility-ms-compat
2835 This flag attempts to use visibility settings to make GCC's C++
2836 linkage model compatible with that of Microsoft Visual Studio.
2837
2838 The flag makes these changes to GCC's linkage model:
2839
2840 @enumerate
2841 @item
2842 It sets the default visibility to @code{hidden}, like
2843 @option{-fvisibility=hidden}.
2844
2845 @item
2846 Types, but not their members, are not hidden by default.
2847
2848 @item
2849 The One Definition Rule is relaxed for types without explicit
2850 visibility specifications that are defined in more than one
2851 shared object: those declarations are permitted if they are
2852 permitted when this option is not used.
2853 @end enumerate
2854
2855 In new code it is better to use @option{-fvisibility=hidden} and
2856 export those classes that are intended to be externally visible.
2857 Unfortunately it is possible for code to rely, perhaps accidentally,
2858 on the Visual Studio behavior.
2859
2860 Among the consequences of these changes are that static data members
2861 of the same type with the same name but defined in different shared
2862 objects are different, so changing one does not change the other;
2863 and that pointers to function members defined in different shared
2864 objects may not compare equal. When this flag is given, it is a
2865 violation of the ODR to define types with the same name differently.
2866
2867 @item -fno-weak
2868 @opindex fno-weak
2869 @opindex fweak
2870 Do not use weak symbol support, even if it is provided by the linker.
2871 By default, G++ uses weak symbols if they are available. This
2872 option exists only for testing, and should not be used by end-users;
2873 it results in inferior code and has no benefits. This option may
2874 be removed in a future release of G++.
2875
2876 @item -nostdinc++
2877 @opindex nostdinc++
2878 Do not search for header files in the standard directories specific to
2879 C++, but do still search the other standard directories. (This option
2880 is used when building the C++ library.)
2881 @end table
2882
2883 In addition, these optimization, warning, and code generation options
2884 have meanings only for C++ programs:
2885
2886 @table @gcctabopt
2887 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2888 @opindex Wabi
2889 @opindex Wno-abi
2890 Warn when G++ it generates code that is probably not compatible with
2891 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2892 ABI with each major release, normally @option{-Wabi} will warn only if
2893 there is a check added later in a release series for an ABI issue
2894 discovered since the initial release. @option{-Wabi} will warn about
2895 more things if an older ABI version is selected (with
2896 @option{-fabi-version=@var{n}}).
2897
2898 @option{-Wabi} can also be used with an explicit version number to
2899 warn about compatibility with a particular @option{-fabi-version}
2900 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2901 @option{-fabi-version=2}.
2902
2903 If an explicit version number is provided and
2904 @option{-fabi-compat-version} is not specified, the version number
2905 from this option is used for compatibility aliases. If no explicit
2906 version number is provided with this option, but
2907 @option{-fabi-compat-version} is specified, that version number is
2908 used for ABI warnings.
2909
2910 Although an effort has been made to warn about
2911 all such cases, there are probably some cases that are not warned about,
2912 even though G++ is generating incompatible code. There may also be
2913 cases where warnings are emitted even though the code that is generated
2914 is compatible.
2915
2916 You should rewrite your code to avoid these warnings if you are
2917 concerned about the fact that code generated by G++ may not be binary
2918 compatible with code generated by other compilers.
2919
2920 Known incompatibilities in @option{-fabi-version=2} (which was the
2921 default from GCC 3.4 to 4.9) include:
2922
2923 @itemize @bullet
2924
2925 @item
2926 A template with a non-type template parameter of reference type was
2927 mangled incorrectly:
2928 @smallexample
2929 extern int N;
2930 template <int &> struct S @{@};
2931 void n (S<N>) @{2@}
2932 @end smallexample
2933
2934 This was fixed in @option{-fabi-version=3}.
2935
2936 @item
2937 SIMD vector types declared using @code{__attribute ((vector_size))} were
2938 mangled in a non-standard way that does not allow for overloading of
2939 functions taking vectors of different sizes.
2940
2941 The mangling was changed in @option{-fabi-version=4}.
2942
2943 @item
2944 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2945 qualifiers, and @code{decltype} of a plain declaration was folded away.
2946
2947 These mangling issues were fixed in @option{-fabi-version=5}.
2948
2949 @item
2950 Scoped enumerators passed as arguments to a variadic function are
2951 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2952 On most targets this does not actually affect the parameter passing
2953 ABI, as there is no way to pass an argument smaller than @code{int}.
2954
2955 Also, the ABI changed the mangling of template argument packs,
2956 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2957 a class scope function used as a template argument.
2958
2959 These issues were corrected in @option{-fabi-version=6}.
2960
2961 @item
2962 Lambdas in default argument scope were mangled incorrectly, and the
2963 ABI changed the mangling of @code{nullptr_t}.
2964
2965 These issues were corrected in @option{-fabi-version=7}.
2966
2967 @item
2968 When mangling a function type with function-cv-qualifiers, the
2969 un-qualified function type was incorrectly treated as a substitution
2970 candidate.
2971
2972 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2973
2974 @item
2975 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2976 unaligned accesses. Note that this did not affect the ABI of a
2977 function with a @code{nullptr_t} parameter, as parameters have a
2978 minimum alignment.
2979
2980 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2981
2982 @item
2983 Target-specific attributes that affect the identity of a type, such as
2984 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2985 did not affect the mangled name, leading to name collisions when
2986 function pointers were used as template arguments.
2987
2988 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2989
2990 @end itemize
2991
2992 It also warns about psABI-related changes. The known psABI changes at this
2993 point include:
2994
2995 @itemize @bullet
2996
2997 @item
2998 For SysV/x86-64, unions with @code{long double} members are
2999 passed in memory as specified in psABI. For example:
3000
3001 @smallexample
3002 union U @{
3003 long double ld;
3004 int i;
3005 @};
3006 @end smallexample
3007
3008 @noindent
3009 @code{union U} is always passed in memory.
3010
3011 @end itemize
3012
3013 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3014 @opindex Wabi-tag
3015 @opindex Wabi-tag
3016 Warn when a type with an ABI tag is used in a context that does not
3017 have that ABI tag. See @ref{C++ Attributes} for more information
3018 about ABI tags.
3019
3020 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3021 @opindex Wcomma-subscript
3022 @opindex Wno-comma-subscript
3023 Warn about uses of a comma expression within a subscripting expression.
3024 This usage was deprecated in C++2a. However, a comma expression wrapped
3025 in @code{( )} is not deprecated. Example:
3026
3027 @smallexample
3028 @group
3029 void f(int *a, int b, int c) @{
3030 a[b,c]; // deprecated
3031 a[(b,c)]; // OK
3032 @}
3033 @end group
3034 @end smallexample
3035
3036 Enabled by default with @option{-std=c++2a}.
3037
3038 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3039 @opindex Wctor-dtor-privacy
3040 @opindex Wno-ctor-dtor-privacy
3041 Warn when a class seems unusable because all the constructors or
3042 destructors in that class are private, and it has neither friends nor
3043 public static member functions. Also warn if there are no non-private
3044 methods, and there's at least one private member function that isn't
3045 a constructor or destructor.
3046
3047 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3048 @opindex Wdelete-non-virtual-dtor
3049 @opindex Wno-delete-non-virtual-dtor
3050 Warn when @code{delete} is used to destroy an instance of a class that
3051 has virtual functions and non-virtual destructor. It is unsafe to delete
3052 an instance of a derived class through a pointer to a base class if the
3053 base class does not have a virtual destructor. This warning is enabled
3054 by @option{-Wall}.
3055
3056 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3057 @opindex Wdeprecated-copy
3058 @opindex Wno-deprecated-copy
3059 Warn that the implicit declaration of a copy constructor or copy
3060 assignment operator is deprecated if the class has a user-provided
3061 copy constructor or copy assignment operator, in C++11 and up. This
3062 warning is enabled by @option{-Wextra}. With
3063 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3064 user-provided destructor.
3065
3066 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3067 @opindex Winit-list-lifetime
3068 @opindex Wno-init-list-lifetime
3069 Do not warn about uses of @code{std::initializer_list} that are likely
3070 to result in dangling pointers. Since the underlying array for an
3071 @code{initializer_list} is handled like a normal C++ temporary object,
3072 it is easy to inadvertently keep a pointer to the array past the end
3073 of the array's lifetime. For example:
3074
3075 @itemize @bullet
3076 @item
3077 If a function returns a temporary @code{initializer_list}, or a local
3078 @code{initializer_list} variable, the array's lifetime ends at the end
3079 of the return statement, so the value returned has a dangling pointer.
3080
3081 @item
3082 If a new-expression creates an @code{initializer_list}, the array only
3083 lives until the end of the enclosing full-expression, so the
3084 @code{initializer_list} in the heap has a dangling pointer.
3085
3086 @item
3087 When an @code{initializer_list} variable is assigned from a
3088 brace-enclosed initializer list, the temporary array created for the
3089 right side of the assignment only lives until the end of the
3090 full-expression, so at the next statement the @code{initializer_list}
3091 variable has a dangling pointer.
3092
3093 @smallexample
3094 // li's initial underlying array lives as long as li
3095 std::initializer_list<int> li = @{ 1,2,3 @};
3096 // assignment changes li to point to a temporary array
3097 li = @{ 4, 5 @};
3098 // now the temporary is gone and li has a dangling pointer
3099 int i = li.begin()[0] // undefined behavior
3100 @end smallexample
3101
3102 @item
3103 When a list constructor stores the @code{begin} pointer from the
3104 @code{initializer_list} argument, this doesn't extend the lifetime of
3105 the array, so if a class variable is constructed from a temporary
3106 @code{initializer_list}, the pointer is left dangling by the end of
3107 the variable declaration statement.
3108
3109 @end itemize
3110
3111 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3112 @opindex Wliteral-suffix
3113 @opindex Wno-literal-suffix
3114 Warn when a string or character literal is followed by a ud-suffix which does
3115 not begin with an underscore. As a conforming extension, GCC treats such
3116 suffixes as separate preprocessing tokens in order to maintain backwards
3117 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3118 For example:
3119
3120 @smallexample
3121 #define __STDC_FORMAT_MACROS
3122 #include <inttypes.h>
3123 #include <stdio.h>
3124
3125 int main() @{
3126 int64_t i64 = 123;
3127 printf("My int64: %" PRId64"\n", i64);
3128 @}
3129 @end smallexample
3130
3131 In this case, @code{PRId64} is treated as a separate preprocessing token.
3132
3133 Additionally, warn when a user-defined literal operator is declared with
3134 a literal suffix identifier that doesn't begin with an underscore. Literal
3135 suffix identifiers that don't begin with an underscore are reserved for
3136 future standardization.
3137
3138 This warning is enabled by default.
3139
3140 @item -Wlto-type-mismatch
3141 @opindex Wlto-type-mismatch
3142 @opindex Wno-lto-type-mismatch
3143
3144 During the link-time optimization warn about type mismatches in
3145 global declarations from different compilation units.
3146 Requires @option{-flto} to be enabled. Enabled by default.
3147
3148 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3149 @opindex Wnarrowing
3150 @opindex Wno-narrowing
3151 For C++11 and later standards, narrowing conversions are diagnosed by default,
3152 as required by the standard. A narrowing conversion from a constant produces
3153 an error, and a narrowing conversion from a non-constant produces a warning,
3154 but @option{-Wno-narrowing} suppresses the diagnostic.
3155 Note that this does not affect the meaning of well-formed code;
3156 narrowing conversions are still considered ill-formed in SFINAE contexts.
3157
3158 With @option{-Wnarrowing} in C++98, warn when a narrowing
3159 conversion prohibited by C++11 occurs within
3160 @samp{@{ @}}, e.g.
3161
3162 @smallexample
3163 int i = @{ 2.2 @}; // error: narrowing from double to int
3164 @end smallexample
3165
3166 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3167
3168 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3169 @opindex Wnoexcept
3170 @opindex Wno-noexcept
3171 Warn when a noexcept-expression evaluates to false because of a call
3172 to a function that does not have a non-throwing exception
3173 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3174 the compiler to never throw an exception.
3175
3176 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3177 @opindex Wnoexcept-type
3178 @opindex Wno-noexcept-type
3179 Warn if the C++17 feature making @code{noexcept} part of a function
3180 type changes the mangled name of a symbol relative to C++14. Enabled
3181 by @option{-Wabi} and @option{-Wc++17-compat}.
3182
3183 As an example:
3184
3185 @smallexample
3186 template <class T> void f(T t) @{ t(); @};
3187 void g() noexcept;
3188 void h() @{ f(g); @}
3189 @end smallexample
3190
3191 @noindent
3192 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3193 C++17 it calls @code{f<void(*)()noexcept>}.
3194
3195 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3196 @opindex Wclass-memaccess
3197 @opindex Wno-class-memaccess
3198 Warn when the destination of a call to a raw memory function such as
3199 @code{memset} or @code{memcpy} is an object of class type, and when writing
3200 into such an object might bypass the class non-trivial or deleted constructor
3201 or copy assignment, violate const-correctness or encapsulation, or corrupt
3202 virtual table pointers. Modifying the representation of such objects may
3203 violate invariants maintained by member functions of the class. For example,
3204 the call to @code{memset} below is undefined because it modifies a non-trivial
3205 class object and is, therefore, diagnosed. The safe way to either initialize
3206 or clear the storage of objects of such types is by using the appropriate
3207 constructor or assignment operator, if one is available.
3208 @smallexample
3209 std::string str = "abc";
3210 memset (&str, 0, sizeof str);
3211 @end smallexample
3212 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3213 Explicitly casting the pointer to the class object to @code{void *} or
3214 to a type that can be safely accessed by the raw memory function suppresses
3215 the warning.
3216
3217 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3218 @opindex Wnon-virtual-dtor
3219 @opindex Wno-non-virtual-dtor
3220 Warn when a class has virtual functions and an accessible non-virtual
3221 destructor itself or in an accessible polymorphic base class, in which
3222 case it is possible but unsafe to delete an instance of a derived
3223 class through a pointer to the class itself or base class. This
3224 warning is automatically enabled if @option{-Weffc++} is specified.
3225
3226 @item -Wregister @r{(C++ and Objective-C++ only)}
3227 @opindex Wregister
3228 @opindex Wno-register
3229 Warn on uses of the @code{register} storage class specifier, except
3230 when it is part of the GNU @ref{Explicit Register Variables} extension.
3231 The use of the @code{register} keyword as storage class specifier has
3232 been deprecated in C++11 and removed in C++17.
3233 Enabled by default with @option{-std=c++17}.
3234
3235 @item -Wreorder @r{(C++ and Objective-C++ only)}
3236 @opindex Wreorder
3237 @opindex Wno-reorder
3238 @cindex reordering, warning
3239 @cindex warning for reordering of member initializers
3240 Warn when the order of member initializers given in the code does not
3241 match the order in which they must be executed. For instance:
3242
3243 @smallexample
3244 struct A @{
3245 int i;
3246 int j;
3247 A(): j (0), i (1) @{ @}
3248 @};
3249 @end smallexample
3250
3251 @noindent
3252 The compiler rearranges the member initializers for @code{i}
3253 and @code{j} to match the declaration order of the members, emitting
3254 a warning to that effect. This warning is enabled by @option{-Wall}.
3255
3256 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3257 @opindex Wpessimizing-move
3258 @opindex Wno-pessimizing-move
3259 This warning warns when a call to @code{std::move} prevents copy
3260 elision. A typical scenario when copy elision can occur is when returning in
3261 a function with a class return type, when the expression being returned is the
3262 name of a non-volatile automatic object, and is not a function parameter, and
3263 has the same type as the function return type.
3264
3265 @smallexample
3266 struct T @{
3267 @dots{}
3268 @};
3269 T fn()
3270 @{
3271 T t;
3272 @dots{}
3273 return std::move (t);
3274 @}
3275 @end smallexample
3276
3277 But in this example, the @code{std::move} call prevents copy elision.
3278
3279 This warning is enabled by @option{-Wall}.
3280
3281 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3282 @opindex Wredundant-move
3283 @opindex Wno-redundant-move
3284 This warning warns about redundant calls to @code{std::move}; that is, when
3285 a move operation would have been performed even without the @code{std::move}
3286 call. This happens because the compiler is forced to treat the object as if
3287 it were an rvalue in certain situations such as returning a local variable,
3288 where copy elision isn't applicable. Consider:
3289
3290 @smallexample
3291 struct T @{
3292 @dots{}
3293 @};
3294 T fn(T t)
3295 @{
3296 @dots{}
3297 return std::move (t);
3298 @}
3299 @end smallexample
3300
3301 Here, the @code{std::move} call is redundant. Because G++ implements Core
3302 Issue 1579, another example is:
3303
3304 @smallexample
3305 struct T @{ // convertible to U
3306 @dots{}
3307 @};
3308 struct U @{
3309 @dots{}
3310 @};
3311 U fn()
3312 @{
3313 T t;
3314 @dots{}
3315 return std::move (t);
3316 @}
3317 @end smallexample
3318 In this example, copy elision isn't applicable because the type of the
3319 expression being returned and the function return type differ, yet G++
3320 treats the return value as if it were designated by an rvalue.
3321
3322 This warning is enabled by @option{-Wextra}.
3323
3324 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3325 @opindex fext-numeric-literals
3326 @opindex fno-ext-numeric-literals
3327 Accept imaginary, fixed-point, or machine-defined
3328 literal number suffixes as GNU extensions.
3329 When this option is turned off these suffixes are treated
3330 as C++11 user-defined literal numeric suffixes.
3331 This is on by default for all pre-C++11 dialects and all GNU dialects:
3332 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3333 @option{-std=gnu++14}.
3334 This option is off by default
3335 for ISO C++11 onwards (@option{-std=c++11}, ...).
3336 @end table
3337
3338 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3339
3340 @table @gcctabopt
3341 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3342 @opindex Weffc++
3343 @opindex Wno-effc++
3344 Warn about violations of the following style guidelines from Scott Meyers'
3345 @cite{Effective C++} series of books:
3346
3347 @itemize @bullet
3348 @item
3349 Define a copy constructor and an assignment operator for classes
3350 with dynamically-allocated memory.
3351
3352 @item
3353 Prefer initialization to assignment in constructors.
3354
3355 @item
3356 Have @code{operator=} return a reference to @code{*this}.
3357
3358 @item
3359 Don't try to return a reference when you must return an object.
3360
3361 @item
3362 Distinguish between prefix and postfix forms of increment and
3363 decrement operators.
3364
3365 @item
3366 Never overload @code{&&}, @code{||}, or @code{,}.
3367
3368 @end itemize
3369
3370 This option also enables @option{-Wnon-virtual-dtor}, which is also
3371 one of the effective C++ recommendations. However, the check is
3372 extended to warn about the lack of virtual destructor in accessible
3373 non-polymorphic bases classes too.
3374
3375 When selecting this option, be aware that the standard library
3376 headers do not obey all of these guidelines; use @samp{grep -v}
3377 to filter out those warnings.
3378
3379 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3380 @opindex Wstrict-null-sentinel
3381 @opindex Wno-strict-null-sentinel
3382 Warn about the use of an uncasted @code{NULL} as sentinel. When
3383 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3384 to @code{__null}. Although it is a null pointer constant rather than a
3385 null pointer, it is guaranteed to be of the same size as a pointer.
3386 But this use is not portable across different compilers.
3387
3388 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3389 @opindex Wno-non-template-friend
3390 @opindex Wnon-template-friend
3391 Disable warnings when non-template friend functions are declared
3392 within a template. In very old versions of GCC that predate implementation
3393 of the ISO standard, declarations such as
3394 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3395 could be interpreted as a particular specialization of a template
3396 function; the warning exists to diagnose compatibility problems,
3397 and is enabled by default.
3398
3399 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3400 @opindex Wold-style-cast
3401 @opindex Wno-old-style-cast
3402 Warn if an old-style (C-style) cast to a non-void type is used within
3403 a C++ program. The new-style casts (@code{dynamic_cast},
3404 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3405 less vulnerable to unintended effects and much easier to search for.
3406
3407 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3408 @opindex Woverloaded-virtual
3409 @opindex Wno-overloaded-virtual
3410 @cindex overloaded virtual function, warning
3411 @cindex warning for overloaded virtual function
3412 Warn when a function declaration hides virtual functions from a
3413 base class. For example, in:
3414
3415 @smallexample
3416 struct A @{
3417 virtual void f();
3418 @};
3419
3420 struct B: public A @{
3421 void f(int);
3422 @};
3423 @end smallexample
3424
3425 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3426 like:
3427
3428 @smallexample
3429 B* b;
3430 b->f();
3431 @end smallexample
3432
3433 @noindent
3434 fails to compile.
3435
3436 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3437 @opindex Wno-pmf-conversions
3438 @opindex Wpmf-conversions
3439 Disable the diagnostic for converting a bound pointer to member function
3440 to a plain pointer.
3441
3442 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3443 @opindex Wsign-promo
3444 @opindex Wno-sign-promo
3445 Warn when overload resolution chooses a promotion from unsigned or
3446 enumerated type to a signed type, over a conversion to an unsigned type of
3447 the same size. Previous versions of G++ tried to preserve
3448 unsignedness, but the standard mandates the current behavior.
3449
3450 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3451 @opindex Wtemplates
3452 @opindex Wno-templates
3453 Warn when a primary template declaration is encountered. Some coding
3454 rules disallow templates, and this may be used to enforce that rule.
3455 The warning is inactive inside a system header file, such as the STL, so
3456 one can still use the STL. One may also instantiate or specialize
3457 templates.
3458
3459 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3460 @opindex Wmultiple-inheritance
3461 @opindex Wno-multiple-inheritance
3462 Warn when a class is defined with multiple direct base classes. Some
3463 coding rules disallow multiple inheritance, and this may be used to
3464 enforce that rule. The warning is inactive inside a system header file,
3465 such as the STL, so one can still use the STL. One may also define
3466 classes that indirectly use multiple inheritance.
3467
3468 @item -Wvirtual-inheritance
3469 @opindex Wvirtual-inheritance
3470 @opindex Wno-virtual-inheritance
3471 Warn when a class is defined with a virtual direct base class. Some
3472 coding rules disallow multiple inheritance, and this may be used to
3473 enforce that rule. The warning is inactive inside a system header file,
3474 such as the STL, so one can still use the STL. One may also define
3475 classes that indirectly use virtual inheritance.
3476
3477 @item -Wnamespaces
3478 @opindex Wnamespaces
3479 @opindex Wno-namespaces
3480 Warn when a namespace definition is opened. Some coding rules disallow
3481 namespaces, and this may be used to enforce that rule. The warning is
3482 inactive inside a system header file, such as the STL, so one can still
3483 use the STL. One may also use using directives and qualified names.
3484
3485 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3486 @opindex Wterminate
3487 @opindex Wno-terminate
3488 Disable the warning about a throw-expression that will immediately
3489 result in a call to @code{terminate}.
3490
3491 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3492 @opindex Wno-class-conversion
3493 @opindex Wclass-conversion
3494 Disable the warning about the case when a conversion function converts an
3495 object to the same type, to a base class of that type, or to void; such
3496 a conversion function will never be called.
3497
3498 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3499 @opindex Wvolatile
3500 @opindex Wno-volatile
3501 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3502 postfix and prefix @code{++} and @code{--} expressions of
3503 @code{volatile}-qualified types, using simple assignments where the left
3504 operand is a @code{volatile}-qualified non-class type for their value,
3505 compound assignments where the left operand is a @code{volatile}-qualified
3506 non-class type, @code{volatile}-qualified function return type,
3507 @code{volatile}-qualified parameter type, and structured bindings of a
3508 @code{volatile}-qualified type. This usage was deprecated in C++20.
3509
3510 Enabled by default with @option{-std=c++2a}.
3511 @end table
3512
3513 @node Objective-C and Objective-C++ Dialect Options
3514 @section Options Controlling Objective-C and Objective-C++ Dialects
3515
3516 @cindex compiler options, Objective-C and Objective-C++
3517 @cindex Objective-C and Objective-C++ options, command-line
3518 @cindex options, Objective-C and Objective-C++
3519 (NOTE: This manual does not describe the Objective-C and Objective-C++
3520 languages themselves. @xref{Standards,,Language Standards
3521 Supported by GCC}, for references.)
3522
3523 This section describes the command-line options that are only meaningful
3524 for Objective-C and Objective-C++ programs. You can also use most of
3525 the language-independent GNU compiler options.
3526 For example, you might compile a file @file{some_class.m} like this:
3527
3528 @smallexample
3529 gcc -g -fgnu-runtime -O -c some_class.m
3530 @end smallexample
3531
3532 @noindent
3533 In this example, @option{-fgnu-runtime} is an option meant only for
3534 Objective-C and Objective-C++ programs; you can use the other options with
3535 any language supported by GCC@.
3536
3537 Note that since Objective-C is an extension of the C language, Objective-C
3538 compilations may also use options specific to the C front-end (e.g.,
3539 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3540 C++-specific options (e.g., @option{-Wabi}).
3541
3542 Here is a list of options that are @emph{only} for compiling Objective-C
3543 and Objective-C++ programs:
3544
3545 @table @gcctabopt
3546 @item -fconstant-string-class=@var{class-name}
3547 @opindex fconstant-string-class
3548 Use @var{class-name} as the name of the class to instantiate for each
3549 literal string specified with the syntax @code{@@"@dots{}"}. The default
3550 class name is @code{NXConstantString} if the GNU runtime is being used, and
3551 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3552 @option{-fconstant-cfstrings} option, if also present, overrides the
3553 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3554 to be laid out as constant CoreFoundation strings.
3555
3556 @item -fgnu-runtime
3557 @opindex fgnu-runtime
3558 Generate object code compatible with the standard GNU Objective-C
3559 runtime. This is the default for most types of systems.
3560
3561 @item -fnext-runtime
3562 @opindex fnext-runtime
3563 Generate output compatible with the NeXT runtime. This is the default
3564 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3565 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3566 used.
3567
3568 @item -fno-nil-receivers
3569 @opindex fno-nil-receivers
3570 @opindex fnil-receivers
3571 Assume that all Objective-C message dispatches (@code{[receiver
3572 message:arg]}) in this translation unit ensure that the receiver is
3573 not @code{nil}. This allows for more efficient entry points in the
3574 runtime to be used. This option is only available in conjunction with
3575 the NeXT runtime and ABI version 0 or 1.
3576
3577 @item -fobjc-abi-version=@var{n}
3578 @opindex fobjc-abi-version
3579 Use version @var{n} of the Objective-C ABI for the selected runtime.
3580 This option is currently supported only for the NeXT runtime. In that
3581 case, Version 0 is the traditional (32-bit) ABI without support for
3582 properties and other Objective-C 2.0 additions. Version 1 is the
3583 traditional (32-bit) ABI with support for properties and other
3584 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3585 nothing is specified, the default is Version 0 on 32-bit target
3586 machines, and Version 2 on 64-bit target machines.
3587
3588 @item -fobjc-call-cxx-cdtors
3589 @opindex fobjc-call-cxx-cdtors
3590 For each Objective-C class, check if any of its instance variables is a
3591 C++ object with a non-trivial default constructor. If so, synthesize a
3592 special @code{- (id) .cxx_construct} instance method which runs
3593 non-trivial default constructors on any such instance variables, in order,
3594 and then return @code{self}. Similarly, check if any instance variable
3595 is a C++ object with a non-trivial destructor, and if so, synthesize a
3596 special @code{- (void) .cxx_destruct} method which runs
3597 all such default destructors, in reverse order.
3598
3599 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3600 methods thusly generated only operate on instance variables
3601 declared in the current Objective-C class, and not those inherited
3602 from superclasses. It is the responsibility of the Objective-C
3603 runtime to invoke all such methods in an object's inheritance
3604 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3605 by the runtime immediately after a new object instance is allocated;
3606 the @code{- (void) .cxx_destruct} methods are invoked immediately
3607 before the runtime deallocates an object instance.
3608
3609 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3610 support for invoking the @code{- (id) .cxx_construct} and
3611 @code{- (void) .cxx_destruct} methods.
3612
3613 @item -fobjc-direct-dispatch
3614 @opindex fobjc-direct-dispatch
3615 Allow fast jumps to the message dispatcher. On Darwin this is
3616 accomplished via the comm page.
3617
3618 @item -fobjc-exceptions
3619 @opindex fobjc-exceptions
3620 Enable syntactic support for structured exception handling in
3621 Objective-C, similar to what is offered by C++. This option
3622 is required to use the Objective-C keywords @code{@@try},
3623 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3624 @code{@@synchronized}. This option is available with both the GNU
3625 runtime and the NeXT runtime (but not available in conjunction with
3626 the NeXT runtime on Mac OS X 10.2 and earlier).
3627
3628 @item -fobjc-gc
3629 @opindex fobjc-gc
3630 Enable garbage collection (GC) in Objective-C and Objective-C++
3631 programs. This option is only available with the NeXT runtime; the
3632 GNU runtime has a different garbage collection implementation that
3633 does not require special compiler flags.
3634
3635 @item -fobjc-nilcheck
3636 @opindex fobjc-nilcheck
3637 For the NeXT runtime with version 2 of the ABI, check for a nil
3638 receiver in method invocations before doing the actual method call.
3639 This is the default and can be disabled using
3640 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3641 checked for nil in this way no matter what this flag is set to.
3642 Currently this flag does nothing when the GNU runtime, or an older
3643 version of the NeXT runtime ABI, is used.
3644
3645 @item -fobjc-std=objc1
3646 @opindex fobjc-std
3647 Conform to the language syntax of Objective-C 1.0, the language
3648 recognized by GCC 4.0. This only affects the Objective-C additions to
3649 the C/C++ language; it does not affect conformance to C/C++ standards,
3650 which is controlled by the separate C/C++ dialect option flags. When
3651 this option is used with the Objective-C or Objective-C++ compiler,
3652 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3653 This is useful if you need to make sure that your Objective-C code can
3654 be compiled with older versions of GCC@.
3655
3656 @item -freplace-objc-classes
3657 @opindex freplace-objc-classes
3658 Emit a special marker instructing @command{ld(1)} not to statically link in
3659 the resulting object file, and allow @command{dyld(1)} to load it in at
3660 run time instead. This is used in conjunction with the Fix-and-Continue
3661 debugging mode, where the object file in question may be recompiled and
3662 dynamically reloaded in the course of program execution, without the need
3663 to restart the program itself. Currently, Fix-and-Continue functionality
3664 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3665 and later.
3666
3667 @item -fzero-link
3668 @opindex fzero-link
3669 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3670 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3671 compile time) with static class references that get initialized at load time,
3672 which improves run-time performance. Specifying the @option{-fzero-link} flag
3673 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3674 to be retained. This is useful in Zero-Link debugging mode, since it allows
3675 for individual class implementations to be modified during program execution.
3676 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3677 regardless of command-line options.
3678
3679 @item -fno-local-ivars
3680 @opindex fno-local-ivars
3681 @opindex flocal-ivars
3682 By default instance variables in Objective-C can be accessed as if
3683 they were local variables from within the methods of the class they're
3684 declared in. This can lead to shadowing between instance variables
3685 and other variables declared either locally inside a class method or
3686 globally with the same name. Specifying the @option{-fno-local-ivars}
3687 flag disables this behavior thus avoiding variable shadowing issues.
3688
3689 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3690 @opindex fivar-visibility
3691 Set the default instance variable visibility to the specified option
3692 so that instance variables declared outside the scope of any access
3693 modifier directives default to the specified visibility.
3694
3695 @item -gen-decls
3696 @opindex gen-decls
3697 Dump interface declarations for all classes seen in the source file to a
3698 file named @file{@var{sourcename}.decl}.
3699
3700 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3701 @opindex Wassign-intercept
3702 @opindex Wno-assign-intercept
3703 Warn whenever an Objective-C assignment is being intercepted by the
3704 garbage collector.
3705
3706 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3707 @opindex Wno-protocol
3708 @opindex Wprotocol
3709 If a class is declared to implement a protocol, a warning is issued for
3710 every method in the protocol that is not implemented by the class. The
3711 default behavior is to issue a warning for every method not explicitly
3712 implemented in the class, even if a method implementation is inherited
3713 from the superclass. If you use the @option{-Wno-protocol} option, then
3714 methods inherited from the superclass are considered to be implemented,
3715 and no warning is issued for them.
3716
3717 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3718 @opindex Wselector
3719 @opindex Wno-selector
3720 Warn if multiple methods of different types for the same selector are
3721 found during compilation. The check is performed on the list of methods
3722 in the final stage of compilation. Additionally, a check is performed
3723 for each selector appearing in a @code{@@selector(@dots{})}
3724 expression, and a corresponding method for that selector has been found
3725 during compilation. Because these checks scan the method table only at
3726 the end of compilation, these warnings are not produced if the final
3727 stage of compilation is not reached, for example because an error is
3728 found during compilation, or because the @option{-fsyntax-only} option is
3729 being used.
3730
3731 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3732 @opindex Wstrict-selector-match
3733 @opindex Wno-strict-selector-match
3734 Warn if multiple methods with differing argument and/or return types are
3735 found for a given selector when attempting to send a message using this
3736 selector to a receiver of type @code{id} or @code{Class}. When this flag
3737 is off (which is the default behavior), the compiler omits such warnings
3738 if any differences found are confined to types that share the same size
3739 and alignment.
3740
3741 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3742 @opindex Wundeclared-selector
3743 @opindex Wno-undeclared-selector
3744 Warn if a @code{@@selector(@dots{})} expression referring to an
3745 undeclared selector is found. A selector is considered undeclared if no
3746 method with that name has been declared before the
3747 @code{@@selector(@dots{})} expression, either explicitly in an
3748 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3749 an @code{@@implementation} section. This option always performs its
3750 checks as soon as a @code{@@selector(@dots{})} expression is found,
3751 while @option{-Wselector} only performs its checks in the final stage of
3752 compilation. This also enforces the coding style convention
3753 that methods and selectors must be declared before being used.
3754
3755 @item -print-objc-runtime-info
3756 @opindex print-objc-runtime-info
3757 Generate C header describing the largest structure that is passed by
3758 value, if any.
3759
3760 @end table
3761
3762 @node Diagnostic Message Formatting Options
3763 @section Options to Control Diagnostic Messages Formatting
3764 @cindex options to control diagnostics formatting
3765 @cindex diagnostic messages
3766 @cindex message formatting
3767
3768 Traditionally, diagnostic messages have been formatted irrespective of
3769 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3770 options described below
3771 to control the formatting algorithm for diagnostic messages,
3772 e.g.@: how many characters per line, how often source location
3773 information should be reported. Note that some language front ends may not
3774 honor these options.
3775
3776 @table @gcctabopt
3777 @item -fmessage-length=@var{n}
3778 @opindex fmessage-length
3779 Try to format error messages so that they fit on lines of about
3780 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3781 done; each error message appears on a single line. This is the
3782 default for all front ends.
3783
3784 Note - this option also affects the display of the @samp{#error} and
3785 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3786 function/type/variable attribute. It does not however affect the
3787 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3788
3789 @item -fdiagnostics-show-location=once
3790 @opindex fdiagnostics-show-location
3791 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3792 reporter to emit source location information @emph{once}; that is, in
3793 case the message is too long to fit on a single physical line and has to
3794 be wrapped, the source location won't be emitted (as prefix) again,
3795 over and over, in subsequent continuation lines. This is the default
3796 behavior.
3797
3798 @item -fdiagnostics-show-location=every-line
3799 Only meaningful in line-wrapping mode. Instructs the diagnostic
3800 messages reporter to emit the same source location information (as
3801 prefix) for physical lines that result from the process of breaking
3802 a message which is too long to fit on a single line.
3803
3804 @item -fdiagnostics-color[=@var{WHEN}]
3805 @itemx -fno-diagnostics-color
3806 @opindex fdiagnostics-color
3807 @cindex highlight, color
3808 @vindex GCC_COLORS @r{environment variable}
3809 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3810 or @samp{auto}. The default depends on how the compiler has been configured,
3811 it can be any of the above @var{WHEN} options or also @samp{never}
3812 if @env{GCC_COLORS} environment variable isn't present in the environment,
3813 and @samp{auto} otherwise.
3814 @samp{auto} means to use color only when the standard error is a terminal.
3815 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3816 aliases for @option{-fdiagnostics-color=always} and
3817 @option{-fdiagnostics-color=never}, respectively.
3818
3819 The colors are defined by the environment variable @env{GCC_COLORS}.
3820 Its value is a colon-separated list of capabilities and Select Graphic
3821 Rendition (SGR) substrings. SGR commands are interpreted by the
3822 terminal or terminal emulator. (See the section in the documentation
3823 of your text terminal for permitted values and their meanings as
3824 character attributes.) These substring values are integers in decimal
3825 representation and can be concatenated with semicolons.
3826 Common values to concatenate include
3827 @samp{1} for bold,
3828 @samp{4} for underline,
3829 @samp{5} for blink,
3830 @samp{7} for inverse,
3831 @samp{39} for default foreground color,
3832 @samp{30} to @samp{37} for foreground colors,
3833 @samp{90} to @samp{97} for 16-color mode foreground colors,
3834 @samp{38;5;0} to @samp{38;5;255}
3835 for 88-color and 256-color modes foreground colors,
3836 @samp{49} for default background color,
3837 @samp{40} to @samp{47} for background colors,
3838 @samp{100} to @samp{107} for 16-color mode background colors,
3839 and @samp{48;5;0} to @samp{48;5;255}
3840 for 88-color and 256-color modes background colors.
3841
3842 The default @env{GCC_COLORS} is
3843 @smallexample
3844 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3845 quote=01:fixit-insert=32:fixit-delete=31:\
3846 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3847 type-diff=01;32
3848 @end smallexample
3849 @noindent
3850 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3851 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3852 @samp{01} is bold, and @samp{31} is red.
3853 Setting @env{GCC_COLORS} to the empty string disables colors.
3854 Supported capabilities are as follows.
3855
3856 @table @code
3857 @item error=
3858 @vindex error GCC_COLORS @r{capability}
3859 SGR substring for error: markers.
3860
3861 @item warning=
3862 @vindex warning GCC_COLORS @r{capability}
3863 SGR substring for warning: markers.
3864
3865 @item note=
3866 @vindex note GCC_COLORS @r{capability}
3867 SGR substring for note: markers.
3868
3869 @item range1=
3870 @vindex range1 GCC_COLORS @r{capability}
3871 SGR substring for first additional range.
3872
3873 @item range2=
3874 @vindex range2 GCC_COLORS @r{capability}
3875 SGR substring for second additional range.
3876
3877 @item locus=
3878 @vindex locus GCC_COLORS @r{capability}
3879 SGR substring for location information, @samp{file:line} or
3880 @samp{file:line:column} etc.
3881
3882 @item quote=
3883 @vindex quote GCC_COLORS @r{capability}
3884 SGR substring for information printed within quotes.
3885
3886 @item fixit-insert=
3887 @vindex fixit-insert GCC_COLORS @r{capability}
3888 SGR substring for fix-it hints suggesting text to
3889 be inserted or replaced.
3890
3891 @item fixit-delete=
3892 @vindex fixit-delete GCC_COLORS @r{capability}
3893 SGR substring for fix-it hints suggesting text to
3894 be deleted.
3895
3896 @item diff-filename=
3897 @vindex diff-filename GCC_COLORS @r{capability}
3898 SGR substring for filename headers within generated patches.
3899
3900 @item diff-hunk=
3901 @vindex diff-hunk GCC_COLORS @r{capability}
3902 SGR substring for the starts of hunks within generated patches.
3903
3904 @item diff-delete=
3905 @vindex diff-delete GCC_COLORS @r{capability}
3906 SGR substring for deleted lines within generated patches.
3907
3908 @item diff-insert=
3909 @vindex diff-insert GCC_COLORS @r{capability}
3910 SGR substring for inserted lines within generated patches.
3911
3912 @item type-diff=
3913 @vindex type-diff GCC_COLORS @r{capability}
3914 SGR substring for highlighting mismatching types within template
3915 arguments in the C++ frontend.
3916 @end table
3917
3918 @item -fdiagnostics-urls[=@var{WHEN}]
3919 @opindex fdiagnostics-urls
3920 @cindex urls
3921 Use escape sequences to embed URLs in diagnostics. For example, when
3922 @option{-fdiagnostics-show-option} emits text showing the command-line
3923 option controlling a diagnostic, embed a URL for documentation of that
3924 option.
3925
3926 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
3927 The default is @samp{auto}, which means to use URL escape sequences only
3928 when the standard error is a terminal.
3929
3930 @item -fno-diagnostics-show-option
3931 @opindex fno-diagnostics-show-option
3932 @opindex fdiagnostics-show-option
3933 By default, each diagnostic emitted includes text indicating the
3934 command-line option that directly controls the diagnostic (if such an
3935 option is known to the diagnostic machinery). Specifying the
3936 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3937
3938 @item -fno-diagnostics-show-caret
3939 @opindex fno-diagnostics-show-caret
3940 @opindex fdiagnostics-show-caret
3941 By default, each diagnostic emitted includes the original source line
3942 and a caret @samp{^} indicating the column. This option suppresses this
3943 information. The source line is truncated to @var{n} characters, if
3944 the @option{-fmessage-length=n} option is given. When the output is done
3945 to the terminal, the width is limited to the width given by the
3946 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3947
3948 @item -fno-diagnostics-show-labels
3949 @opindex fno-diagnostics-show-labels
3950 @opindex fdiagnostics-show-labels
3951 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3952 diagnostics can label ranges of source code with pertinent information, such
3953 as the types of expressions:
3954
3955 @smallexample
3956 printf ("foo %s bar", long_i + long_j);
3957 ~^ ~~~~~~~~~~~~~~~
3958 | |
3959 char * long int
3960 @end smallexample
3961
3962 This option suppresses the printing of these labels (in the example above,
3963 the vertical bars and the ``char *'' and ``long int'' text).
3964
3965 @item -fno-diagnostics-show-line-numbers
3966 @opindex fno-diagnostics-show-line-numbers
3967 @opindex fdiagnostics-show-line-numbers
3968 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3969 a left margin is printed, showing line numbers. This option suppresses this
3970 left margin.
3971
3972 @item -fdiagnostics-minimum-margin-width=@var{width}
3973 @opindex fdiagnostics-minimum-margin-width
3974 This option controls the minimum width of the left margin printed by
3975 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3976
3977 @item -fdiagnostics-parseable-fixits
3978 @opindex fdiagnostics-parseable-fixits
3979 Emit fix-it hints in a machine-parseable format, suitable for consumption
3980 by IDEs. For each fix-it, a line will be printed after the relevant
3981 diagnostic, starting with the string ``fix-it:''. For example:
3982
3983 @smallexample
3984 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3985 @end smallexample
3986
3987 The location is expressed as a half-open range, expressed as a count of
3988 bytes, starting at byte 1 for the initial column. In the above example,
3989 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3990 given string:
3991
3992 @smallexample
3993 00000000011111111112222222222
3994 12345678901234567890123456789
3995 gtk_widget_showall (dlg);
3996 ^^^^^^^^^^^^^^^^^^
3997 gtk_widget_show_all
3998 @end smallexample
3999
4000 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4001 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4002 (e.g. vertical tab as ``\013'').
4003
4004 An empty replacement string indicates that the given range is to be removed.
4005 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4006 be inserted at the given position.
4007
4008 @item -fdiagnostics-generate-patch
4009 @opindex fdiagnostics-generate-patch
4010 Print fix-it hints to stderr in unified diff format, after any diagnostics
4011 are printed. For example:
4012
4013 @smallexample
4014 --- test.c
4015 +++ test.c
4016 @@ -42,5 +42,5 @@
4017
4018 void show_cb(GtkDialog *dlg)
4019 @{
4020 - gtk_widget_showall(dlg);
4021 + gtk_widget_show_all(dlg);
4022 @}
4023
4024 @end smallexample
4025
4026 The diff may or may not be colorized, following the same rules
4027 as for diagnostics (see @option{-fdiagnostics-color}).
4028
4029 @item -fdiagnostics-show-template-tree
4030 @opindex fdiagnostics-show-template-tree
4031
4032 In the C++ frontend, when printing diagnostics showing mismatching
4033 template types, such as:
4034
4035 @smallexample
4036 could not convert 'std::map<int, std::vector<double> >()'
4037 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4038 @end smallexample
4039
4040 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4041 tree-like structure showing the common and differing parts of the types,
4042 such as:
4043
4044 @smallexample
4045 map<
4046 [...],
4047 vector<
4048 [double != float]>>
4049 @end smallexample
4050
4051 The parts that differ are highlighted with color (``double'' and
4052 ``float'' in this case).
4053
4054 @item -fno-elide-type
4055 @opindex fno-elide-type
4056 @opindex felide-type
4057 By default when the C++ frontend prints diagnostics showing mismatching
4058 template types, common parts of the types are printed as ``[...]'' to
4059 simplify the error message. For example:
4060
4061 @smallexample
4062 could not convert 'std::map<int, std::vector<double> >()'
4063 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4064 @end smallexample
4065
4066 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4067 This flag also affects the output of the
4068 @option{-fdiagnostics-show-template-tree} flag.
4069
4070 @item -fno-show-column
4071 @opindex fno-show-column
4072 @opindex fshow-column
4073 Do not print column numbers in diagnostics. This may be necessary if
4074 diagnostics are being scanned by a program that does not understand the
4075 column numbers, such as @command{dejagnu}.
4076
4077 @item -fdiagnostics-format=@var{FORMAT}
4078 @opindex fdiagnostics-format
4079 Select a different format for printing diagnostics.
4080 @var{FORMAT} is @samp{text} or @samp{json}.
4081 The default is @samp{text}.
4082
4083 The @samp{json} format consists of a top-level JSON array containing JSON
4084 objects representing the diagnostics.
4085
4086 The JSON is emitted as one line, without formatting; the examples below
4087 have been formatted for clarity.
4088
4089 Diagnostics can have child diagnostics. For example, this error and note:
4090
4091 @smallexample
4092 misleading-indentation.c:15:3: warning: this 'if' clause does not
4093 guard... [-Wmisleading-indentation]
4094 15 | if (flag)
4095 | ^~
4096 misleading-indentation.c:17:5: note: ...this statement, but the latter
4097 is misleadingly indented as if it were guarded by the 'if'
4098 17 | y = 2;
4099 | ^
4100 @end smallexample
4101
4102 @noindent
4103 might be printed in JSON form (after formatting) like this:
4104
4105 @smallexample
4106 [
4107 @{
4108 "kind": "warning",
4109 "locations": [
4110 @{
4111 "caret": @{
4112 "column": 3,
4113 "file": "misleading-indentation.c",
4114 "line": 15
4115 @},
4116 "finish": @{
4117 "column": 4,
4118 "file": "misleading-indentation.c",
4119 "line": 15
4120 @}
4121 @}
4122 ],
4123 "message": "this \u2018if\u2019 clause does not guard...",
4124 "option": "-Wmisleading-indentation",
4125 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4126 "children": [
4127 @{
4128 "kind": "note",
4129 "locations": [
4130 @{
4131 "caret": @{
4132 "column": 5,
4133 "file": "misleading-indentation.c",
4134 "line": 17
4135 @}
4136 @}
4137 ],
4138 "message": "...this statement, but the latter is @dots{}"
4139 @}
4140 ]
4141 @},
4142 @dots{}
4143 ]
4144 @end smallexample
4145
4146 @noindent
4147 where the @code{note} is a child of the @code{warning}.
4148
4149 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4150 an @code{option} key describing the command-line option controlling the
4151 warning.
4152
4153 A diagnostic can contain zero or more locations. Each location has up
4154 to three positions within it: a @code{caret} position and optional
4155 @code{start} and @code{finish} positions. A location can also have
4156 an optional @code{label} string. For example, this error:
4157
4158 @smallexample
4159 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4160 'struct s'@} and 'T' @{aka 'struct t'@})
4161 64 | return callee_4a () + callee_4b ();
4162 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4163 | | |
4164 | | T @{aka struct t@}
4165 | S @{aka struct s@}
4166 @end smallexample
4167
4168 @noindent
4169 has three locations. Its primary location is at the ``+'' token at column
4170 23. It has two secondary locations, describing the left and right-hand sides
4171 of the expression, which have labels. It might be printed in JSON form as:
4172
4173 @smallexample
4174 @{
4175 "children": [],
4176 "kind": "error",
4177 "locations": [
4178 @{
4179 "caret": @{
4180 "column": 23, "file": "bad-binary-ops.c", "line": 64
4181 @}
4182 @},
4183 @{
4184 "caret": @{
4185 "column": 10, "file": "bad-binary-ops.c", "line": 64
4186 @},
4187 "finish": @{
4188 "column": 21, "file": "bad-binary-ops.c", "line": 64
4189 @},
4190 "label": "S @{aka struct s@}"
4191 @},
4192 @{
4193 "caret": @{
4194 "column": 25, "file": "bad-binary-ops.c", "line": 64
4195 @},
4196 "finish": @{
4197 "column": 36, "file": "bad-binary-ops.c", "line": 64
4198 @},
4199 "label": "T @{aka struct t@}"
4200 @}
4201 ],
4202 "message": "invalid operands to binary + @dots{}"
4203 @}
4204 @end smallexample
4205
4206 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4207 consisting of half-open intervals, similar to the output of
4208 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4209 with a replacement fix-it hint:
4210
4211 @smallexample
4212 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4213 mean 'color'?
4214 8 | return ptr->colour;
4215 | ^~~~~~
4216 | color
4217 @end smallexample
4218
4219 @noindent
4220 might be printed in JSON form as:
4221
4222 @smallexample
4223 @{
4224 "children": [],
4225 "fixits": [
4226 @{
4227 "next": @{
4228 "column": 21,
4229 "file": "demo.c",
4230 "line": 8
4231 @},
4232 "start": @{
4233 "column": 15,
4234 "file": "demo.c",
4235 "line": 8
4236 @},
4237 "string": "color"
4238 @}
4239 ],
4240 "kind": "error",
4241 "locations": [
4242 @{
4243 "caret": @{
4244 "column": 15,
4245 "file": "demo.c",
4246 "line": 8
4247 @},
4248 "finish": @{
4249 "column": 20,
4250 "file": "demo.c",
4251 "line": 8
4252 @}
4253 @}
4254 ],
4255 "message": "\u2018struct s\u2019 has no member named @dots{}"
4256 @}
4257 @end smallexample
4258
4259 @noindent
4260 where the fix-it hint suggests replacing the text from @code{start} up
4261 to but not including @code{next} with @code{string}'s value. Deletions
4262 are expressed via an empty value for @code{string}, insertions by
4263 having @code{start} equal @code{next}.
4264
4265 @end table
4266
4267 @node Warning Options
4268 @section Options to Request or Suppress Warnings
4269 @cindex options to control warnings
4270 @cindex warning messages
4271 @cindex messages, warning
4272 @cindex suppressing warnings
4273
4274 Warnings are diagnostic messages that report constructions that
4275 are not inherently erroneous but that are risky or suggest there
4276 may have been an error.
4277
4278 The following language-independent options do not enable specific
4279 warnings but control the kinds of diagnostics produced by GCC@.
4280
4281 @table @gcctabopt
4282 @cindex syntax checking
4283 @item -fsyntax-only
4284 @opindex fsyntax-only
4285 Check the code for syntax errors, but don't do anything beyond that.
4286
4287 @item -fmax-errors=@var{n}
4288 @opindex fmax-errors
4289 Limits the maximum number of error messages to @var{n}, at which point
4290 GCC bails out rather than attempting to continue processing the source
4291 code. If @var{n} is 0 (the default), there is no limit on the number
4292 of error messages produced. If @option{-Wfatal-errors} is also
4293 specified, then @option{-Wfatal-errors} takes precedence over this
4294 option.
4295
4296 @item -w
4297 @opindex w
4298 Inhibit all warning messages.
4299
4300 @item -Werror
4301 @opindex Werror
4302 @opindex Wno-error
4303 Make all warnings into errors.
4304
4305 @item -Werror=
4306 @opindex Werror=
4307 @opindex Wno-error=
4308 Make the specified warning into an error. The specifier for a warning
4309 is appended; for example @option{-Werror=switch} turns the warnings
4310 controlled by @option{-Wswitch} into errors. This switch takes a
4311 negative form, to be used to negate @option{-Werror} for specific
4312 warnings; for example @option{-Wno-error=switch} makes
4313 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4314 is in effect.
4315
4316 The warning message for each controllable warning includes the
4317 option that controls the warning. That option can then be used with
4318 @option{-Werror=} and @option{-Wno-error=} as described above.
4319 (Printing of the option in the warning message can be disabled using the
4320 @option{-fno-diagnostics-show-option} flag.)
4321
4322 Note that specifying @option{-Werror=}@var{foo} automatically implies
4323 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4324 imply anything.
4325
4326 @item -Wfatal-errors
4327 @opindex Wfatal-errors
4328 @opindex Wno-fatal-errors
4329 This option causes the compiler to abort compilation on the first error
4330 occurred rather than trying to keep going and printing further error
4331 messages.
4332
4333 @end table
4334
4335 You can request many specific warnings with options beginning with
4336 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4337 implicit declarations. Each of these specific warning options also
4338 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4339 example, @option{-Wno-implicit}. This manual lists only one of the
4340 two forms, whichever is not the default. For further
4341 language-specific options also refer to @ref{C++ Dialect Options} and
4342 @ref{Objective-C and Objective-C++ Dialect Options}.
4343
4344 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4345 options, such as @option{-Wunused}, which may turn on further options,
4346 such as @option{-Wunused-value}. The combined effect of positive and
4347 negative forms is that more specific options have priority over less
4348 specific ones, independently of their position in the command-line. For
4349 options of the same specificity, the last one takes effect. Options
4350 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4351 as if they appeared at the end of the command-line.
4352
4353 When an unrecognized warning option is requested (e.g.,
4354 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4355 that the option is not recognized. However, if the @option{-Wno-} form
4356 is used, the behavior is slightly different: no diagnostic is
4357 produced for @option{-Wno-unknown-warning} unless other diagnostics
4358 are being produced. This allows the use of new @option{-Wno-} options
4359 with old compilers, but if something goes wrong, the compiler
4360 warns that an unrecognized option is present.
4361
4362 @table @gcctabopt
4363 @item -Wpedantic
4364 @itemx -pedantic
4365 @opindex pedantic
4366 @opindex Wpedantic
4367 @opindex Wno-pedantic
4368 Issue all the warnings demanded by strict ISO C and ISO C++;
4369 reject all programs that use forbidden extensions, and some other
4370 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4371 version of the ISO C standard specified by any @option{-std} option used.
4372
4373 Valid ISO C and ISO C++ programs should compile properly with or without
4374 this option (though a rare few require @option{-ansi} or a
4375 @option{-std} option specifying the required version of ISO C)@. However,
4376 without this option, certain GNU extensions and traditional C and C++
4377 features are supported as well. With this option, they are rejected.
4378
4379 @option{-Wpedantic} does not cause warning messages for use of the
4380 alternate keywords whose names begin and end with @samp{__}. This alternate
4381 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4382 i.e. @samp{__intN__}.
4383 Pedantic warnings are also disabled in the expression that follows
4384 @code{__extension__}. However, only system header files should use
4385 these escape routes; application programs should avoid them.
4386 @xref{Alternate Keywords}.
4387
4388 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4389 C conformance. They soon find that it does not do quite what they want:
4390 it finds some non-ISO practices, but not all---only those for which
4391 ISO C @emph{requires} a diagnostic, and some others for which
4392 diagnostics have been added.
4393
4394 A feature to report any failure to conform to ISO C might be useful in
4395 some instances, but would require considerable additional work and would
4396 be quite different from @option{-Wpedantic}. We don't have plans to
4397 support such a feature in the near future.
4398
4399 Where the standard specified with @option{-std} represents a GNU
4400 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4401 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4402 extended dialect is based. Warnings from @option{-Wpedantic} are given
4403 where they are required by the base standard. (It does not make sense
4404 for such warnings to be given only for features not in the specified GNU
4405 C dialect, since by definition the GNU dialects of C include all
4406 features the compiler supports with the given option, and there would be
4407 nothing to warn about.)
4408
4409 @item -pedantic-errors
4410 @opindex pedantic-errors
4411 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4412 requires a diagnostic, in some cases where there is undefined behavior
4413 at compile-time and in some other cases that do not prevent compilation
4414 of programs that are valid according to the standard. This is not
4415 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4416 by this option and not enabled by the latter and vice versa.
4417
4418 @item -Wall
4419 @opindex Wall
4420 @opindex Wno-all
4421 This enables all the warnings about constructions that some users
4422 consider questionable, and that are easy to avoid (or modify to
4423 prevent the warning), even in conjunction with macros. This also
4424 enables some language-specific warnings described in @ref{C++ Dialect
4425 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4426
4427 @option{-Wall} turns on the following warning flags:
4428
4429 @gccoptlist{-Waddress @gol
4430 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4431 -Wbool-compare @gol
4432 -Wbool-operation @gol
4433 -Wc++11-compat -Wc++14-compat @gol
4434 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4435 -Wchar-subscripts @gol
4436 -Wcomment @gol
4437 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4438 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4439 -Wenum-conversion @r{in C/ObjC;} @gol
4440 -Wformat @gol
4441 -Wint-in-bool-context @gol
4442 -Wimplicit @r{(C and Objective-C only)} @gol
4443 -Wimplicit-int @r{(C and Objective-C only)} @gol
4444 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4445 -Winit-self @r{(only for C++)} @gol
4446 -Wzero-length-bounds @gol
4447 -Wlogical-not-parentheses @gol
4448 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4449 -Wmaybe-uninitialized @gol
4450 -Wmemset-elt-size @gol
4451 -Wmemset-transposed-args @gol
4452 -Wmisleading-indentation @r{(only for C/C++)} @gol
4453 -Wmissing-attributes @gol
4454 -Wmissing-braces @r{(only for C/ObjC)} @gol
4455 -Wmultistatement-macros @gol
4456 -Wnarrowing @r{(only for C++)} @gol
4457 -Wnonnull @gol
4458 -Wnonnull-compare @gol
4459 -Wopenmp-simd @gol
4460 -Wparentheses @gol
4461 -Wpessimizing-move @r{(only for C++)} @gol
4462 -Wpointer-sign @gol
4463 -Wreorder @gol
4464 -Wrestrict @gol
4465 -Wreturn-type @gol
4466 -Wsequence-point @gol
4467 -Wsign-compare @r{(only in C++)} @gol
4468 -Wsizeof-pointer-div @gol
4469 -Wsizeof-pointer-memaccess @gol
4470 -Wstrict-aliasing @gol
4471 -Wstrict-overflow=1 @gol
4472 -Wswitch @gol
4473 -Wtautological-compare @gol
4474 -Wtrigraphs @gol
4475 -Wuninitialized @gol
4476 -Wunknown-pragmas @gol
4477 -Wunused-function @gol
4478 -Wunused-label @gol
4479 -Wunused-value @gol
4480 -Wunused-variable @gol
4481 -Wvolatile-register-var}
4482
4483 Note that some warning flags are not implied by @option{-Wall}. Some of
4484 them warn about constructions that users generally do not consider
4485 questionable, but which occasionally you might wish to check for;
4486 others warn about constructions that are necessary or hard to avoid in
4487 some cases, and there is no simple way to modify the code to suppress
4488 the warning. Some of them are enabled by @option{-Wextra} but many of
4489 them must be enabled individually.
4490
4491 @item -Wextra
4492 @opindex W
4493 @opindex Wextra
4494 @opindex Wno-extra
4495 This enables some extra warning flags that are not enabled by
4496 @option{-Wall}. (This option used to be called @option{-W}. The older
4497 name is still supported, but the newer name is more descriptive.)
4498
4499 @gccoptlist{-Wclobbered @gol
4500 -Wcast-function-type @gol
4501 -Wdeprecated-copy @r{(C++ only)} @gol
4502 -Wempty-body @gol
4503 -Wignored-qualifiers @gol
4504 -Wimplicit-fallthrough=3 @gol
4505 -Wmissing-field-initializers @gol
4506 -Wmissing-parameter-type @r{(C only)} @gol
4507 -Wold-style-declaration @r{(C only)} @gol
4508 -Woverride-init @gol
4509 -Wsign-compare @r{(C only)} @gol
4510 -Wstring-compare @gol
4511 -Wredundant-move @r{(only for C++)} @gol
4512 -Wtype-limits @gol
4513 -Wuninitialized @gol
4514 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4515 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4516 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4517
4518
4519 The option @option{-Wextra} also prints warning messages for the
4520 following cases:
4521
4522 @itemize @bullet
4523
4524 @item
4525 A pointer is compared against integer zero with @code{<}, @code{<=},
4526 @code{>}, or @code{>=}.
4527
4528 @item
4529 (C++ only) An enumerator and a non-enumerator both appear in a
4530 conditional expression.
4531
4532 @item
4533 (C++ only) Ambiguous virtual bases.
4534
4535 @item
4536 (C++ only) Subscripting an array that has been declared @code{register}.
4537
4538 @item
4539 (C++ only) Taking the address of a variable that has been declared
4540 @code{register}.
4541
4542 @item
4543 (C++ only) A base class is not initialized in the copy constructor
4544 of a derived class.
4545
4546 @end itemize
4547
4548 @item -Wchar-subscripts
4549 @opindex Wchar-subscripts
4550 @opindex Wno-char-subscripts
4551 Warn if an array subscript has type @code{char}. This is a common cause
4552 of error, as programmers often forget that this type is signed on some
4553 machines.
4554 This warning is enabled by @option{-Wall}.
4555
4556 @item -Wno-coverage-mismatch
4557 @opindex Wno-coverage-mismatch
4558 @opindex Wcoverage-mismatch
4559 Warn if feedback profiles do not match when using the
4560 @option{-fprofile-use} option.
4561 If a source file is changed between compiling with @option{-fprofile-generate}
4562 and with @option{-fprofile-use}, the files with the profile feedback can fail
4563 to match the source file and GCC cannot use the profile feedback
4564 information. By default, this warning is enabled and is treated as an
4565 error. @option{-Wno-coverage-mismatch} can be used to disable the
4566 warning or @option{-Wno-error=coverage-mismatch} can be used to
4567 disable the error. Disabling the error for this warning can result in
4568 poorly optimized code and is useful only in the
4569 case of very minor changes such as bug fixes to an existing code-base.
4570 Completely disabling the warning is not recommended.
4571
4572 @item -Wno-cpp
4573 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4574
4575 Suppress warning messages emitted by @code{#warning} directives.
4576
4577 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4578 @opindex Wdouble-promotion
4579 @opindex Wno-double-promotion
4580 Give a warning when a value of type @code{float} is implicitly
4581 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4582 floating-point unit implement @code{float} in hardware, but emulate
4583 @code{double} in software. On such a machine, doing computations
4584 using @code{double} values is much more expensive because of the
4585 overhead required for software emulation.
4586
4587 It is easy to accidentally do computations with @code{double} because
4588 floating-point literals are implicitly of type @code{double}. For
4589 example, in:
4590 @smallexample
4591 @group
4592 float area(float radius)
4593 @{
4594 return 3.14159 * radius * radius;
4595 @}
4596 @end group
4597 @end smallexample
4598 the compiler performs the entire computation with @code{double}
4599 because the floating-point literal is a @code{double}.
4600
4601 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4602 @opindex Wduplicate-decl-specifier
4603 @opindex Wno-duplicate-decl-specifier
4604 Warn if a declaration has duplicate @code{const}, @code{volatile},
4605 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4606 @option{-Wall}.
4607
4608 @item -Wformat
4609 @itemx -Wformat=@var{n}
4610 @opindex Wformat
4611 @opindex Wno-format
4612 @opindex ffreestanding
4613 @opindex fno-builtin
4614 @opindex Wformat=
4615 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4616 the arguments supplied have types appropriate to the format string
4617 specified, and that the conversions specified in the format string make
4618 sense. This includes standard functions, and others specified by format
4619 attributes (@pxref{Function Attributes}), in the @code{printf},
4620 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4621 not in the C standard) families (or other target-specific families).
4622 Which functions are checked without format attributes having been
4623 specified depends on the standard version selected, and such checks of
4624 functions without the attribute specified are disabled by
4625 @option{-ffreestanding} or @option{-fno-builtin}.
4626
4627 The formats are checked against the format features supported by GNU
4628 libc version 2.2. These include all ISO C90 and C99 features, as well
4629 as features from the Single Unix Specification and some BSD and GNU
4630 extensions. Other library implementations may not support all these
4631 features; GCC does not support warning about features that go beyond a
4632 particular library's limitations. However, if @option{-Wpedantic} is used
4633 with @option{-Wformat}, warnings are given about format features not
4634 in the selected standard version (but not for @code{strfmon} formats,
4635 since those are not in any version of the C standard). @xref{C Dialect
4636 Options,,Options Controlling C Dialect}.
4637
4638 @table @gcctabopt
4639 @item -Wformat=1
4640 @itemx -Wformat
4641 @opindex Wformat
4642 @opindex Wformat=1
4643 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4644 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4645 @option{-Wformat} also checks for null format arguments for several
4646 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4647 aspects of this level of format checking can be disabled by the
4648 options: @option{-Wno-format-contains-nul},
4649 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4650 @option{-Wformat} is enabled by @option{-Wall}.
4651
4652 @item -Wno-format-contains-nul
4653 @opindex Wno-format-contains-nul
4654 @opindex Wformat-contains-nul
4655 If @option{-Wformat} is specified, do not warn about format strings that
4656 contain NUL bytes.
4657
4658 @item -Wno-format-extra-args
4659 @opindex Wno-format-extra-args
4660 @opindex Wformat-extra-args
4661 If @option{-Wformat} is specified, do not warn about excess arguments to a
4662 @code{printf} or @code{scanf} format function. The C standard specifies
4663 that such arguments are ignored.
4664
4665 Where the unused arguments lie between used arguments that are
4666 specified with @samp{$} operand number specifications, normally
4667 warnings are still given, since the implementation could not know what
4668 type to pass to @code{va_arg} to skip the unused arguments. However,
4669 in the case of @code{scanf} formats, this option suppresses the
4670 warning if the unused arguments are all pointers, since the Single
4671 Unix Specification says that such unused arguments are allowed.
4672
4673 @item -Wformat-overflow
4674 @itemx -Wformat-overflow=@var{level}
4675 @opindex Wformat-overflow
4676 @opindex Wno-format-overflow
4677 Warn about calls to formatted input/output functions such as @code{sprintf}
4678 and @code{vsprintf} that might overflow the destination buffer. When the
4679 exact number of bytes written by a format directive cannot be determined
4680 at compile-time it is estimated based on heuristics that depend on the
4681 @var{level} argument and on optimization. While enabling optimization
4682 will in most cases improve the accuracy of the warning, it may also
4683 result in false positives.
4684
4685 @table @gcctabopt
4686 @item -Wformat-overflow
4687 @itemx -Wformat-overflow=1
4688 @opindex Wformat-overflow
4689 @opindex Wno-format-overflow
4690 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4691 employs a conservative approach that warns only about calls that most
4692 likely overflow the buffer. At this level, numeric arguments to format
4693 directives with unknown values are assumed to have the value of one, and
4694 strings of unknown length to be empty. Numeric arguments that are known
4695 to be bounded to a subrange of their type, or string arguments whose output
4696 is bounded either by their directive's precision or by a finite set of
4697 string literals, are assumed to take on the value within the range that
4698 results in the most bytes on output. For example, the call to @code{sprintf}
4699 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4700 the terminating NUL character (@code{'\0'}) appended by the function
4701 to the destination buffer will be written past its end. Increasing
4702 the size of the buffer by a single byte is sufficient to avoid the
4703 warning, though it may not be sufficient to avoid the overflow.
4704
4705 @smallexample
4706 void f (int a, int b)
4707 @{
4708 char buf [13];
4709 sprintf (buf, "a = %i, b = %i\n", a, b);
4710 @}
4711 @end smallexample
4712
4713 @item -Wformat-overflow=2
4714 Level @var{2} warns also about calls that might overflow the destination
4715 buffer given an argument of sufficient length or magnitude. At level
4716 @var{2}, unknown numeric arguments are assumed to have the minimum
4717 representable value for signed types with a precision greater than 1, and
4718 the maximum representable value otherwise. Unknown string arguments whose
4719 length cannot be assumed to be bounded either by the directive's precision,
4720 or by a finite set of string literals they may evaluate to, or the character
4721 array they may point to, are assumed to be 1 character long.
4722
4723 At level @var{2}, the call in the example above is again diagnosed, but
4724 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4725 @code{%i} directive will write some of its digits beyond the end of
4726 the destination buffer. To make the call safe regardless of the values
4727 of the two variables, the size of the destination buffer must be increased
4728 to at least 34 bytes. GCC includes the minimum size of the buffer in
4729 an informational note following the warning.
4730
4731 An alternative to increasing the size of the destination buffer is to
4732 constrain the range of formatted values. The maximum length of string
4733 arguments can be bounded by specifying the precision in the format
4734 directive. When numeric arguments of format directives can be assumed
4735 to be bounded by less than the precision of their type, choosing
4736 an appropriate length modifier to the format specifier will reduce
4737 the required buffer size. For example, if @var{a} and @var{b} in the
4738 example above can be assumed to be within the precision of
4739 the @code{short int} type then using either the @code{%hi} format
4740 directive or casting the argument to @code{short} reduces the maximum
4741 required size of the buffer to 24 bytes.
4742
4743 @smallexample
4744 void f (int a, int b)
4745 @{
4746 char buf [23];
4747 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4748 @}
4749 @end smallexample
4750 @end table
4751
4752 @item -Wno-format-zero-length
4753 @opindex Wno-format-zero-length
4754 @opindex Wformat-zero-length
4755 If @option{-Wformat} is specified, do not warn about zero-length formats.
4756 The C standard specifies that zero-length formats are allowed.
4757
4758
4759 @item -Wformat=2
4760 @opindex Wformat=2
4761 Enable @option{-Wformat} plus additional format checks. Currently
4762 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4763 -Wformat-y2k}.
4764
4765 @item -Wformat-nonliteral
4766 @opindex Wformat-nonliteral
4767 @opindex Wno-format-nonliteral
4768 If @option{-Wformat} is specified, also warn if the format string is not a
4769 string literal and so cannot be checked, unless the format function
4770 takes its format arguments as a @code{va_list}.
4771
4772 @item -Wformat-security
4773 @opindex Wformat-security
4774 @opindex Wno-format-security
4775 If @option{-Wformat} is specified, also warn about uses of format
4776 functions that represent possible security problems. At present, this
4777 warns about calls to @code{printf} and @code{scanf} functions where the
4778 format string is not a string literal and there are no format arguments,
4779 as in @code{printf (foo);}. This may be a security hole if the format
4780 string came from untrusted input and contains @samp{%n}. (This is
4781 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4782 in future warnings may be added to @option{-Wformat-security} that are not
4783 included in @option{-Wformat-nonliteral}.)
4784
4785 @item -Wformat-signedness
4786 @opindex Wformat-signedness
4787 @opindex Wno-format-signedness
4788 If @option{-Wformat} is specified, also warn if the format string
4789 requires an unsigned argument and the argument is signed and vice versa.
4790
4791 @item -Wformat-truncation
4792 @itemx -Wformat-truncation=@var{level}
4793 @opindex Wformat-truncation
4794 @opindex Wno-format-truncation
4795 Warn about calls to formatted input/output functions such as @code{snprintf}
4796 and @code{vsnprintf} that might result in output truncation. When the exact
4797 number of bytes written by a format directive cannot be determined at
4798 compile-time it is estimated based on heuristics that depend on
4799 the @var{level} argument and on optimization. While enabling optimization
4800 will in most cases improve the accuracy of the warning, it may also result
4801 in false positives. Except as noted otherwise, the option uses the same
4802 logic @option{-Wformat-overflow}.
4803
4804 @table @gcctabopt
4805 @item -Wformat-truncation
4806 @itemx -Wformat-truncation=1
4807 @opindex Wformat-truncation
4808 @opindex Wno-format-truncation
4809 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4810 employs a conservative approach that warns only about calls to bounded
4811 functions whose return value is unused and that will most likely result
4812 in output truncation.
4813
4814 @item -Wformat-truncation=2
4815 Level @var{2} warns also about calls to bounded functions whose return
4816 value is used and that might result in truncation given an argument of
4817 sufficient length or magnitude.
4818 @end table
4819
4820 @item -Wformat-y2k
4821 @opindex Wformat-y2k
4822 @opindex Wno-format-y2k
4823 If @option{-Wformat} is specified, also warn about @code{strftime}
4824 formats that may yield only a two-digit year.
4825 @end table
4826
4827 @item -Wnonnull
4828 @opindex Wnonnull
4829 @opindex Wno-nonnull
4830 Warn about passing a null pointer for arguments marked as
4831 requiring a non-null value by the @code{nonnull} function attribute.
4832
4833 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4834 can be disabled with the @option{-Wno-nonnull} option.
4835
4836 @item -Wnonnull-compare
4837 @opindex Wnonnull-compare
4838 @opindex Wno-nonnull-compare
4839 Warn when comparing an argument marked with the @code{nonnull}
4840 function attribute against null inside the function.
4841
4842 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4843 can be disabled with the @option{-Wno-nonnull-compare} option.
4844
4845 @item -Wnull-dereference
4846 @opindex Wnull-dereference
4847 @opindex Wno-null-dereference
4848 Warn if the compiler detects paths that trigger erroneous or
4849 undefined behavior due to dereferencing a null pointer. This option
4850 is only active when @option{-fdelete-null-pointer-checks} is active,
4851 which is enabled by optimizations in most targets. The precision of
4852 the warnings depends on the optimization options used.
4853
4854 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4855 @opindex Winaccessible-base
4856 @opindex Wno-inaccessible-base
4857 Warn when a base class is inaccessible in a class derived from it due to
4858 ambiguity. The warning is enabled by default. Note the warning for virtual
4859 bases is enabled by the @option{-Wextra} option.
4860 @smallexample
4861 @group
4862 struct A @{ int a; @};
4863
4864 struct B : A @{ @};
4865
4866 struct C : B, A @{ @};
4867 @end group
4868 @end smallexample
4869
4870 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4871 @opindex Winit-self
4872 @opindex Wno-init-self
4873 Warn about uninitialized variables that are initialized with themselves.
4874 Note this option can only be used with the @option{-Wuninitialized} option.
4875
4876 For example, GCC warns about @code{i} being uninitialized in the
4877 following snippet only when @option{-Winit-self} has been specified:
4878 @smallexample
4879 @group
4880 int f()
4881 @{
4882 int i = i;
4883 return i;
4884 @}
4885 @end group
4886 @end smallexample
4887
4888 This warning is enabled by @option{-Wall} in C++.
4889
4890 @item -Wimplicit-int @r{(C and Objective-C only)}
4891 @opindex Wimplicit-int
4892 @opindex Wno-implicit-int
4893 Warn when a declaration does not specify a type.
4894 This warning is enabled by @option{-Wall}.
4895
4896 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4897 @opindex Wimplicit-function-declaration
4898 @opindex Wno-implicit-function-declaration
4899 Give a warning whenever a function is used before being declared. In
4900 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4901 enabled by default and it is made into an error by
4902 @option{-pedantic-errors}. This warning is also enabled by
4903 @option{-Wall}.
4904
4905 @item -Wimplicit @r{(C and Objective-C only)}
4906 @opindex Wimplicit
4907 @opindex Wno-implicit
4908 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4909 This warning is enabled by @option{-Wall}.
4910
4911 @item -Wimplicit-fallthrough
4912 @opindex Wimplicit-fallthrough
4913 @opindex Wno-implicit-fallthrough
4914 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4915 and @option{-Wno-implicit-fallthrough} is the same as
4916 @option{-Wimplicit-fallthrough=0}.
4917
4918 @item -Wimplicit-fallthrough=@var{n}
4919 @opindex Wimplicit-fallthrough=
4920 Warn when a switch case falls through. For example:
4921
4922 @smallexample
4923 @group
4924 switch (cond)
4925 @{
4926 case 1:
4927 a = 1;
4928 break;
4929 case 2:
4930 a = 2;
4931 case 3:
4932 a = 3;
4933 break;
4934 @}
4935 @end group
4936 @end smallexample
4937
4938 This warning does not warn when the last statement of a case cannot
4939 fall through, e.g. when there is a return statement or a call to function
4940 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4941 also takes into account control flow statements, such as ifs, and only
4942 warns when appropriate. E.g.@:
4943
4944 @smallexample
4945 @group
4946 switch (cond)
4947 @{
4948 case 1:
4949 if (i > 3) @{
4950 bar (5);
4951 break;
4952 @} else if (i < 1) @{
4953 bar (0);
4954 @} else
4955 return;
4956 default:
4957 @dots{}
4958 @}
4959 @end group
4960 @end smallexample
4961
4962 Since there are occasions where a switch case fall through is desirable,
4963 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4964 to be used along with a null statement to suppress this warning that
4965 would normally occur:
4966
4967 @smallexample
4968 @group
4969 switch (cond)
4970 @{
4971 case 1:
4972 bar (0);
4973 __attribute__ ((fallthrough));
4974 default:
4975 @dots{}
4976 @}
4977 @end group
4978 @end smallexample
4979
4980 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4981 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4982 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4983 Instead of these attributes, it is also possible to add a fallthrough comment
4984 to silence the warning. The whole body of the C or C++ style comment should
4985 match the given regular expressions listed below. The option argument @var{n}
4986 specifies what kind of comments are accepted:
4987
4988 @itemize @bullet
4989
4990 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4991
4992 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4993 expression, any comment is used as fallthrough comment.
4994
4995 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4996 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4997
4998 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4999 following regular expressions:
5000
5001 @itemize @bullet
5002
5003 @item @code{-fallthrough}
5004
5005 @item @code{@@fallthrough@@}
5006
5007 @item @code{lint -fallthrough[ \t]*}
5008
5009 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5010
5011 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5012
5013 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5014
5015 @end itemize
5016
5017 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5018 following regular expressions:
5019
5020 @itemize @bullet
5021
5022 @item @code{-fallthrough}
5023
5024 @item @code{@@fallthrough@@}
5025
5026 @item @code{lint -fallthrough[ \t]*}
5027
5028 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5029
5030 @end itemize
5031
5032 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5033 fallthrough comments, only attributes disable the warning.
5034
5035 @end itemize
5036
5037 The comment needs to be followed after optional whitespace and other comments
5038 by @code{case} or @code{default} keywords or by a user label that precedes some
5039 @code{case} or @code{default} label.
5040
5041 @smallexample
5042 @group
5043 switch (cond)
5044 @{
5045 case 1:
5046 bar (0);
5047 /* FALLTHRU */
5048 default:
5049 @dots{}
5050 @}
5051 @end group
5052 @end smallexample
5053
5054 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5055
5056 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5057 @opindex Wif-not-aligned
5058 @opindex Wno-if-not-aligned
5059 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5060 should be issued. This is enabled by default.
5061 Use @option{-Wno-if-not-aligned} to disable it.
5062
5063 @item -Wignored-qualifiers @r{(C and C++ only)}
5064 @opindex Wignored-qualifiers
5065 @opindex Wno-ignored-qualifiers
5066 Warn if the return type of a function has a type qualifier
5067 such as @code{const}. For ISO C such a type qualifier has no effect,
5068 since the value returned by a function is not an lvalue.
5069 For C++, the warning is only emitted for scalar types or @code{void}.
5070 ISO C prohibits qualified @code{void} return types on function
5071 definitions, so such return types always receive a warning
5072 even without this option.
5073
5074 This warning is also enabled by @option{-Wextra}.
5075
5076 @item -Wignored-attributes @r{(C and C++ only)}
5077 @opindex Wignored-attributes
5078 @opindex Wno-ignored-attributes
5079 Warn when an attribute is ignored. This is different from the
5080 @option{-Wattributes} option in that it warns whenever the compiler decides
5081 to drop an attribute, not that the attribute is either unknown, used in a
5082 wrong place, etc. This warning is enabled by default.
5083
5084 @item -Wmain
5085 @opindex Wmain
5086 @opindex Wno-main
5087 Warn if the type of @code{main} is suspicious. @code{main} should be
5088 a function with external linkage, returning int, taking either zero
5089 arguments, two, or three arguments of appropriate types. This warning
5090 is enabled by default in C++ and is enabled by either @option{-Wall}
5091 or @option{-Wpedantic}.
5092
5093 @item -Wmisleading-indentation @r{(C and C++ only)}
5094 @opindex Wmisleading-indentation
5095 @opindex Wno-misleading-indentation
5096 Warn when the indentation of the code does not reflect the block structure.
5097 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5098 @code{for} clauses with a guarded statement that does not use braces,
5099 followed by an unguarded statement with the same indentation.
5100
5101 In the following example, the call to ``bar'' is misleadingly indented as
5102 if it were guarded by the ``if'' conditional.
5103
5104 @smallexample
5105 if (some_condition ())
5106 foo ();
5107 bar (); /* Gotcha: this is not guarded by the "if". */
5108 @end smallexample
5109
5110 In the case of mixed tabs and spaces, the warning uses the
5111 @option{-ftabstop=} option to determine if the statements line up
5112 (defaulting to 8).
5113
5114 The warning is not issued for code involving multiline preprocessor logic
5115 such as the following example.
5116
5117 @smallexample
5118 if (flagA)
5119 foo (0);
5120 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5121 if (flagB)
5122 #endif
5123 foo (1);
5124 @end smallexample
5125
5126 The warning is not issued after a @code{#line} directive, since this
5127 typically indicates autogenerated code, and no assumptions can be made
5128 about the layout of the file that the directive references.
5129
5130 This warning is enabled by @option{-Wall} in C and C++.
5131
5132 @item -Wmissing-attributes
5133 @opindex Wmissing-attributes
5134 @opindex Wno-missing-attributes
5135 Warn when a declaration of a function is missing one or more attributes
5136 that a related function is declared with and whose absence may adversely
5137 affect the correctness or efficiency of generated code. For example,
5138 the warning is issued for declarations of aliases that use attributes
5139 to specify less restrictive requirements than those of their targets.
5140 This typically represents a potential optimization opportunity.
5141 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5142 issued when the alias is more restrictive than the target, which could
5143 lead to incorrect code generation.
5144 Attributes considered include @code{alloc_align}, @code{alloc_size},
5145 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5146 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5147 @code{returns_nonnull}, and @code{returns_twice}.
5148
5149 In C++, the warning is issued when an explicit specialization of a primary
5150 template declared with attribute @code{alloc_align}, @code{alloc_size},
5151 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5152 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5153 @code{error}, and @code{warning} suppress the warning.
5154 (@pxref{Function Attributes}).
5155
5156 You can use the @code{copy} attribute to apply the same
5157 set of attributes to a declaration as that on another declaration without
5158 explicitly enumerating the attributes. This attribute can be applied
5159 to declarations of functions (@pxref{Common Function Attributes}),
5160 variables (@pxref{Common Variable Attributes}), or types
5161 (@pxref{Common Type Attributes}).
5162
5163 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5164
5165 For example, since the declaration of the primary function template
5166 below makes use of both attribute @code{malloc} and @code{alloc_size}
5167 the declaration of the explicit specialization of the template is
5168 diagnosed because it is missing one of the attributes.
5169
5170 @smallexample
5171 template <class T>
5172 T* __attribute__ ((malloc, alloc_size (1)))
5173 allocate (size_t);
5174
5175 template <>
5176 void* __attribute__ ((malloc)) // missing alloc_size
5177 allocate<void> (size_t);
5178 @end smallexample
5179
5180 @item -Wmissing-braces
5181 @opindex Wmissing-braces
5182 @opindex Wno-missing-braces
5183 Warn if an aggregate or union initializer is not fully bracketed. In
5184 the following example, the initializer for @code{a} is not fully
5185 bracketed, but that for @code{b} is fully bracketed. This warning is
5186 enabled by @option{-Wall} in C.
5187
5188 @smallexample
5189 int a[2][2] = @{ 0, 1, 2, 3 @};
5190 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5191 @end smallexample
5192
5193 This warning is enabled by @option{-Wall}.
5194
5195 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5196 @opindex Wmissing-include-dirs
5197 @opindex Wno-missing-include-dirs
5198 Warn if a user-supplied include directory does not exist.
5199
5200 @item -Wmissing-profile
5201 @opindex Wmissing-profile
5202 @opindex Wno-missing-profile
5203 Warn if feedback profiles are missing when using the
5204 @option{-fprofile-use} option.
5205 This option diagnoses those cases where a new function or a new file is added
5206 to the user code between compiling with @option{-fprofile-generate} and with
5207 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5208 profile feedback data files do not contain any profile feedback information for
5209 the newly added function or file respectively. Also, in the case when profile
5210 count data (.gcda) files are removed, GCC cannot use any profile feedback
5211 information. In all these cases, warnings are issued to inform the user that a
5212 profile generation step is due. @option{-Wno-missing-profile} can be used to
5213 disable the warning. Ignoring the warning can result in poorly optimized code.
5214 Completely disabling the warning is not recommended and should be done only
5215 when non-existent profile data is justified.
5216
5217 @item -Wmultistatement-macros
5218 @opindex Wmultistatement-macros
5219 @opindex Wno-multistatement-macros
5220 Warn about unsafe multiple statement macros that appear to be guarded
5221 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5222 @code{while}, in which only the first statement is actually guarded after
5223 the macro is expanded.
5224
5225 For example:
5226
5227 @smallexample
5228 #define DOIT x++; y++
5229 if (c)
5230 DOIT;
5231 @end smallexample
5232
5233 will increment @code{y} unconditionally, not just when @code{c} holds.
5234 The can usually be fixed by wrapping the macro in a do-while loop:
5235 @smallexample
5236 #define DOIT do @{ x++; y++; @} while (0)
5237 if (c)
5238 DOIT;
5239 @end smallexample
5240
5241 This warning is enabled by @option{-Wall} in C and C++.
5242
5243 @item -Wparentheses
5244 @opindex Wparentheses
5245 @opindex Wno-parentheses
5246 Warn if parentheses are omitted in certain contexts, such
5247 as when there is an assignment in a context where a truth value
5248 is expected, or when operators are nested whose precedence people
5249 often get confused about.
5250
5251 Also warn if a comparison like @code{x<=y<=z} appears; this is
5252 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5253 interpretation from that of ordinary mathematical notation.
5254
5255 Also warn for dangerous uses of the GNU extension to
5256 @code{?:} with omitted middle operand. When the condition
5257 in the @code{?}: operator is a boolean expression, the omitted value is
5258 always 1. Often programmers expect it to be a value computed
5259 inside the conditional expression instead.
5260
5261 For C++ this also warns for some cases of unnecessary parentheses in
5262 declarations, which can indicate an attempt at a function call instead
5263 of a declaration:
5264 @smallexample
5265 @{
5266 // Declares a local variable called mymutex.
5267 std::unique_lock<std::mutex> (mymutex);
5268 // User meant std::unique_lock<std::mutex> lock (mymutex);
5269 @}
5270 @end smallexample
5271
5272 This warning is enabled by @option{-Wall}.
5273
5274 @item -Wsequence-point
5275 @opindex Wsequence-point
5276 @opindex Wno-sequence-point
5277 Warn about code that may have undefined semantics because of violations
5278 of sequence point rules in the C and C++ standards.
5279
5280 The C and C++ standards define the order in which expressions in a C/C++
5281 program are evaluated in terms of @dfn{sequence points}, which represent
5282 a partial ordering between the execution of parts of the program: those
5283 executed before the sequence point, and those executed after it. These
5284 occur after the evaluation of a full expression (one which is not part
5285 of a larger expression), after the evaluation of the first operand of a
5286 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5287 function is called (but after the evaluation of its arguments and the
5288 expression denoting the called function), and in certain other places.
5289 Other than as expressed by the sequence point rules, the order of
5290 evaluation of subexpressions of an expression is not specified. All
5291 these rules describe only a partial order rather than a total order,
5292 since, for example, if two functions are called within one expression
5293 with no sequence point between them, the order in which the functions
5294 are called is not specified. However, the standards committee have
5295 ruled that function calls do not overlap.
5296
5297 It is not specified when between sequence points modifications to the
5298 values of objects take effect. Programs whose behavior depends on this
5299 have undefined behavior; the C and C++ standards specify that ``Between
5300 the previous and next sequence point an object shall have its stored
5301 value modified at most once by the evaluation of an expression.
5302 Furthermore, the prior value shall be read only to determine the value
5303 to be stored.''. If a program breaks these rules, the results on any
5304 particular implementation are entirely unpredictable.
5305
5306 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5307 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5308 diagnosed by this option, and it may give an occasional false positive
5309 result, but in general it has been found fairly effective at detecting
5310 this sort of problem in programs.
5311
5312 The C++17 standard will define the order of evaluation of operands in
5313 more cases: in particular it requires that the right-hand side of an
5314 assignment be evaluated before the left-hand side, so the above
5315 examples are no longer undefined. But this warning will still warn
5316 about them, to help people avoid writing code that is undefined in C
5317 and earlier revisions of C++.
5318
5319 The standard is worded confusingly, therefore there is some debate
5320 over the precise meaning of the sequence point rules in subtle cases.
5321 Links to discussions of the problem, including proposed formal
5322 definitions, may be found on the GCC readings page, at
5323 @uref{http://gcc.gnu.org/@/readings.html}.
5324
5325 This warning is enabled by @option{-Wall} for C and C++.
5326
5327 @item -Wno-return-local-addr
5328 @opindex Wno-return-local-addr
5329 @opindex Wreturn-local-addr
5330 Do not warn about returning a pointer (or in C++, a reference) to a
5331 variable that goes out of scope after the function returns.
5332
5333 @item -Wreturn-type
5334 @opindex Wreturn-type
5335 @opindex Wno-return-type
5336 Warn whenever a function is defined with a return type that defaults
5337 to @code{int}. Also warn about any @code{return} statement with no
5338 return value in a function whose return type is not @code{void}
5339 (falling off the end of the function body is considered returning
5340 without a value).
5341
5342 For C only, warn about a @code{return} statement with an expression in a
5343 function whose return type is @code{void}, unless the expression type is
5344 also @code{void}. As a GNU extension, the latter case is accepted
5345 without a warning unless @option{-Wpedantic} is used. Attempting
5346 to use the return value of a non-@code{void} function other than @code{main}
5347 that flows off the end by reaching the closing curly brace that terminates
5348 the function is undefined.
5349
5350 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5351 than @code{main} results in undefined behavior even when the value of
5352 the function is not used.
5353
5354 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5355
5356 @item -Wshift-count-negative
5357 @opindex Wshift-count-negative
5358 @opindex Wno-shift-count-negative
5359 Warn if shift count is negative. This warning is enabled by default.
5360
5361 @item -Wshift-count-overflow
5362 @opindex Wshift-count-overflow
5363 @opindex Wno-shift-count-overflow
5364 Warn if shift count >= width of type. This warning is enabled by default.
5365
5366 @item -Wshift-negative-value
5367 @opindex Wshift-negative-value
5368 @opindex Wno-shift-negative-value
5369 Warn if left shifting a negative value. This warning is enabled by
5370 @option{-Wextra} in C99 and C++11 modes (and newer).
5371
5372 @item -Wshift-overflow
5373 @itemx -Wshift-overflow=@var{n}
5374 @opindex Wshift-overflow
5375 @opindex Wno-shift-overflow
5376 Warn about left shift overflows. This warning is enabled by
5377 default in C99 and C++11 modes (and newer).
5378
5379 @table @gcctabopt
5380 @item -Wshift-overflow=1
5381 This is the warning level of @option{-Wshift-overflow} and is enabled
5382 by default in C99 and C++11 modes (and newer). This warning level does
5383 not warn about left-shifting 1 into the sign bit. (However, in C, such
5384 an overflow is still rejected in contexts where an integer constant expression
5385 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5386 shifts always wrap.
5387
5388 @item -Wshift-overflow=2
5389 This warning level also warns about left-shifting 1 into the sign bit,
5390 unless C++14 mode (or newer) is active.
5391 @end table
5392
5393 @item -Wswitch
5394 @opindex Wswitch
5395 @opindex Wno-switch
5396 Warn whenever a @code{switch} statement has an index of enumerated type
5397 and lacks a @code{case} for one or more of the named codes of that
5398 enumeration. (The presence of a @code{default} label prevents this
5399 warning.) @code{case} labels outside the enumeration range also
5400 provoke warnings when this option is used (even if there is a
5401 @code{default} label).
5402 This warning is enabled by @option{-Wall}.
5403
5404 @item -Wswitch-default
5405 @opindex Wswitch-default
5406 @opindex Wno-switch-default
5407 Warn whenever a @code{switch} statement does not have a @code{default}
5408 case.
5409
5410 @item -Wswitch-enum
5411 @opindex Wswitch-enum
5412 @opindex Wno-switch-enum
5413 Warn whenever a @code{switch} statement has an index of enumerated type
5414 and lacks a @code{case} for one or more of the named codes of that
5415 enumeration. @code{case} labels outside the enumeration range also
5416 provoke warnings when this option is used. The only difference
5417 between @option{-Wswitch} and this option is that this option gives a
5418 warning about an omitted enumeration code even if there is a
5419 @code{default} label.
5420
5421 @item -Wswitch-bool
5422 @opindex Wswitch-bool
5423 @opindex Wno-switch-bool
5424 Warn whenever a @code{switch} statement has an index of boolean type
5425 and the case values are outside the range of a boolean type.
5426 It is possible to suppress this warning by casting the controlling
5427 expression to a type other than @code{bool}. For example:
5428 @smallexample
5429 @group
5430 switch ((int) (a == 4))
5431 @{
5432 @dots{}
5433 @}
5434 @end group
5435 @end smallexample
5436 This warning is enabled by default for C and C++ programs.
5437
5438 @item -Wswitch-outside-range
5439 @opindex Wswitch-outside-range
5440 @opindex Wno-switch-outside-range
5441 Warn whenever a @code{switch} case has a value that is outside of its
5442 respective type range. This warning is enabled by default for
5443 C and C++ programs.
5444
5445 @item -Wswitch-unreachable
5446 @opindex Wswitch-unreachable
5447 @opindex Wno-switch-unreachable
5448 Warn whenever a @code{switch} statement contains statements between the
5449 controlling expression and the first case label, which will never be
5450 executed. For example:
5451 @smallexample
5452 @group
5453 switch (cond)
5454 @{
5455 i = 15;
5456 @dots{}
5457 case 5:
5458 @dots{}
5459 @}
5460 @end group
5461 @end smallexample
5462 @option{-Wswitch-unreachable} does not warn if the statement between the
5463 controlling expression and the first case label is just a declaration:
5464 @smallexample
5465 @group
5466 switch (cond)
5467 @{
5468 int i;
5469 @dots{}
5470 case 5:
5471 i = 5;
5472 @dots{}
5473 @}
5474 @end group
5475 @end smallexample
5476 This warning is enabled by default for C and C++ programs.
5477
5478 @item -Wsync-nand @r{(C and C++ only)}
5479 @opindex Wsync-nand
5480 @opindex Wno-sync-nand
5481 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5482 built-in functions are used. These functions changed semantics in GCC 4.4.
5483
5484 @item -Wunused-but-set-parameter
5485 @opindex Wunused-but-set-parameter
5486 @opindex Wno-unused-but-set-parameter
5487 Warn whenever a function parameter is assigned to, but otherwise unused
5488 (aside from its declaration).
5489
5490 To suppress this warning use the @code{unused} attribute
5491 (@pxref{Variable Attributes}).
5492
5493 This warning is also enabled by @option{-Wunused} together with
5494 @option{-Wextra}.
5495
5496 @item -Wunused-but-set-variable
5497 @opindex Wunused-but-set-variable
5498 @opindex Wno-unused-but-set-variable
5499 Warn whenever a local variable is assigned to, but otherwise unused
5500 (aside from its declaration).
5501 This warning is enabled by @option{-Wall}.
5502
5503 To suppress this warning use the @code{unused} attribute
5504 (@pxref{Variable Attributes}).
5505
5506 This warning is also enabled by @option{-Wunused}, which is enabled
5507 by @option{-Wall}.
5508
5509 @item -Wunused-function
5510 @opindex Wunused-function
5511 @opindex Wno-unused-function
5512 Warn whenever a static function is declared but not defined or a
5513 non-inline static function is unused.
5514 This warning is enabled by @option{-Wall}.
5515
5516 @item -Wunused-label
5517 @opindex Wunused-label
5518 @opindex Wno-unused-label
5519 Warn whenever a label is declared but not used.
5520 This warning is enabled by @option{-Wall}.
5521
5522 To suppress this warning use the @code{unused} attribute
5523 (@pxref{Variable Attributes}).
5524
5525 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5526 @opindex Wunused-local-typedefs
5527 @opindex Wno-unused-local-typedefs
5528 Warn when a typedef locally defined in a function is not used.
5529 This warning is enabled by @option{-Wall}.
5530
5531 @item -Wunused-parameter
5532 @opindex Wunused-parameter
5533 @opindex Wno-unused-parameter
5534 Warn whenever a function parameter is unused aside from its declaration.
5535
5536 To suppress this warning use the @code{unused} attribute
5537 (@pxref{Variable Attributes}).
5538
5539 @item -Wno-unused-result
5540 @opindex Wunused-result
5541 @opindex Wno-unused-result
5542 Do not warn if a caller of a function marked with attribute
5543 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5544 its return value. The default is @option{-Wunused-result}.
5545
5546 @item -Wunused-variable
5547 @opindex Wunused-variable
5548 @opindex Wno-unused-variable
5549 Warn whenever a local or static variable is unused aside from its
5550 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5551 but not for C++. This warning is enabled by @option{-Wall}.
5552
5553 To suppress this warning use the @code{unused} attribute
5554 (@pxref{Variable Attributes}).
5555
5556 @item -Wunused-const-variable
5557 @itemx -Wunused-const-variable=@var{n}
5558 @opindex Wunused-const-variable
5559 @opindex Wno-unused-const-variable
5560 Warn whenever a constant static variable is unused aside from its declaration.
5561 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5562 for C, but not for C++. In C this declares variable storage, but in C++ this
5563 is not an error since const variables take the place of @code{#define}s.
5564
5565 To suppress this warning use the @code{unused} attribute
5566 (@pxref{Variable Attributes}).
5567
5568 @table @gcctabopt
5569 @item -Wunused-const-variable=1
5570 This is the warning level that is enabled by @option{-Wunused-variable} for
5571 C. It warns only about unused static const variables defined in the main
5572 compilation unit, but not about static const variables declared in any
5573 header included.
5574
5575 @item -Wunused-const-variable=2
5576 This warning level also warns for unused constant static variables in
5577 headers (excluding system headers). This is the warning level of
5578 @option{-Wunused-const-variable} and must be explicitly requested since
5579 in C++ this isn't an error and in C it might be harder to clean up all
5580 headers included.
5581 @end table
5582
5583 @item -Wunused-value
5584 @opindex Wunused-value
5585 @opindex Wno-unused-value
5586 Warn whenever a statement computes a result that is explicitly not
5587 used. To suppress this warning cast the unused expression to
5588 @code{void}. This includes an expression-statement or the left-hand
5589 side of a comma expression that contains no side effects. For example,
5590 an expression such as @code{x[i,j]} causes a warning, while
5591 @code{x[(void)i,j]} does not.
5592
5593 This warning is enabled by @option{-Wall}.
5594
5595 @item -Wunused
5596 @opindex Wunused
5597 @opindex Wno-unused
5598 All the above @option{-Wunused} options combined.
5599
5600 In order to get a warning about an unused function parameter, you must
5601 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5602 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5603
5604 @item -Wuninitialized
5605 @opindex Wuninitialized
5606 @opindex Wno-uninitialized
5607 Warn if an automatic variable is used without first being initialized.
5608 In C++, warn if a non-static reference or non-static @code{const}
5609 member appears in a class without constructors.
5610
5611 If you want to warn about code that uses the uninitialized value of the
5612 variable in its own initializer, use the @option{-Winit-self} option.
5613
5614 These warnings occur for individual uninitialized elements of
5615 structure, union or array variables as well as for variables that are
5616 uninitialized as a whole. They do not occur for variables or elements
5617 declared @code{volatile}. Because these warnings depend on
5618 optimization, the exact variables or elements for which there are
5619 warnings depend on the precise optimization options and version of GCC
5620 used.
5621
5622 Note that there may be no warning about a variable that is used only
5623 to compute a value that itself is never used, because such
5624 computations may be deleted by data flow analysis before the warnings
5625 are printed.
5626
5627 @item -Winvalid-memory-model
5628 @opindex Winvalid-memory-model
5629 @opindex Wno-invalid-memory-model
5630 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5631 and the C11 atomic generic functions with a memory consistency argument
5632 that is either invalid for the operation or outside the range of values
5633 of the @code{memory_order} enumeration. For example, since the
5634 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5635 defined for the relaxed, release, and sequentially consistent memory
5636 orders the following code is diagnosed:
5637
5638 @smallexample
5639 void store (int *i)
5640 @{
5641 __atomic_store_n (i, 0, memory_order_consume);
5642 @}
5643 @end smallexample
5644
5645 @option{-Winvalid-memory-model} is enabled by default.
5646
5647 @item -Wmaybe-uninitialized
5648 @opindex Wmaybe-uninitialized
5649 @opindex Wno-maybe-uninitialized
5650 For an automatic (i.e.@: local) variable, if there exists a path from the
5651 function entry to a use of the variable that is initialized, but there exist
5652 some other paths for which the variable is not initialized, the compiler
5653 emits a warning if it cannot prove the uninitialized paths are not
5654 executed at run time.
5655
5656 These warnings are only possible in optimizing compilation, because otherwise
5657 GCC does not keep track of the state of variables.
5658
5659 These warnings are made optional because GCC may not be able to determine when
5660 the code is correct in spite of appearing to have an error. Here is one
5661 example of how this can happen:
5662
5663 @smallexample
5664 @group
5665 @{
5666 int x;
5667 switch (y)
5668 @{
5669 case 1: x = 1;
5670 break;
5671 case 2: x = 4;
5672 break;
5673 case 3: x = 5;
5674 @}
5675 foo (x);
5676 @}
5677 @end group
5678 @end smallexample
5679
5680 @noindent
5681 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5682 always initialized, but GCC doesn't know this. To suppress the
5683 warning, you need to provide a default case with assert(0) or
5684 similar code.
5685
5686 @cindex @code{longjmp} warnings
5687 This option also warns when a non-volatile automatic variable might be
5688 changed by a call to @code{longjmp}.
5689 The compiler sees only the calls to @code{setjmp}. It cannot know
5690 where @code{longjmp} will be called; in fact, a signal handler could
5691 call it at any point in the code. As a result, you may get a warning
5692 even when there is in fact no problem because @code{longjmp} cannot
5693 in fact be called at the place that would cause a problem.
5694
5695 Some spurious warnings can be avoided if you declare all the functions
5696 you use that never return as @code{noreturn}. @xref{Function
5697 Attributes}.
5698
5699 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5700
5701 @item -Wunknown-pragmas
5702 @opindex Wunknown-pragmas
5703 @opindex Wno-unknown-pragmas
5704 @cindex warning for unknown pragmas
5705 @cindex unknown pragmas, warning
5706 @cindex pragmas, warning of unknown
5707 Warn when a @code{#pragma} directive is encountered that is not understood by
5708 GCC@. If this command-line option is used, warnings are even issued
5709 for unknown pragmas in system header files. This is not the case if
5710 the warnings are only enabled by the @option{-Wall} command-line option.
5711
5712 @item -Wno-pragmas
5713 @opindex Wno-pragmas
5714 @opindex Wpragmas
5715 Do not warn about misuses of pragmas, such as incorrect parameters,
5716 invalid syntax, or conflicts between pragmas. See also
5717 @option{-Wunknown-pragmas}.
5718
5719 @item -Wno-prio-ctor-dtor
5720 @opindex Wno-prio-ctor-dtor
5721 @opindex Wprio-ctor-dtor
5722 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5723 The use of constructor and destructor attributes allow you to assign a
5724 priority to the constructor/destructor to control its order of execution
5725 before @code{main} is called or after it returns. The priority values must be
5726 greater than 100 as the compiler reserves priority values between 0--100 for
5727 the implementation.
5728
5729 @item -Wstrict-aliasing
5730 @opindex Wstrict-aliasing
5731 @opindex Wno-strict-aliasing
5732 This option is only active when @option{-fstrict-aliasing} is active.
5733 It warns about code that might break the strict aliasing rules that the
5734 compiler is using for optimization. The warning does not catch all
5735 cases, but does attempt to catch the more common pitfalls. It is
5736 included in @option{-Wall}.
5737 It is equivalent to @option{-Wstrict-aliasing=3}
5738
5739 @item -Wstrict-aliasing=n
5740 @opindex Wstrict-aliasing=n
5741 This option is only active when @option{-fstrict-aliasing} is active.
5742 It warns about code that might break the strict aliasing rules that the
5743 compiler is using for optimization.
5744 Higher levels correspond to higher accuracy (fewer false positives).
5745 Higher levels also correspond to more effort, similar to the way @option{-O}
5746 works.
5747 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5748
5749 Level 1: Most aggressive, quick, least accurate.
5750 Possibly useful when higher levels
5751 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5752 false negatives. However, it has many false positives.
5753 Warns for all pointer conversions between possibly incompatible types,
5754 even if never dereferenced. Runs in the front end only.
5755
5756 Level 2: Aggressive, quick, not too precise.
5757 May still have many false positives (not as many as level 1 though),
5758 and few false negatives (but possibly more than level 1).
5759 Unlike level 1, it only warns when an address is taken. Warns about
5760 incomplete types. Runs in the front end only.
5761
5762 Level 3 (default for @option{-Wstrict-aliasing}):
5763 Should have very few false positives and few false
5764 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5765 Takes care of the common pun+dereference pattern in the front end:
5766 @code{*(int*)&some_float}.
5767 If optimization is enabled, it also runs in the back end, where it deals
5768 with multiple statement cases using flow-sensitive points-to information.
5769 Only warns when the converted pointer is dereferenced.
5770 Does not warn about incomplete types.
5771
5772 @item -Wstrict-overflow
5773 @itemx -Wstrict-overflow=@var{n}
5774 @opindex Wstrict-overflow
5775 @opindex Wno-strict-overflow
5776 This option is only active when signed overflow is undefined.
5777 It warns about cases where the compiler optimizes based on the
5778 assumption that signed overflow does not occur. Note that it does not
5779 warn about all cases where the code might overflow: it only warns
5780 about cases where the compiler implements some optimization. Thus
5781 this warning depends on the optimization level.
5782
5783 An optimization that assumes that signed overflow does not occur is
5784 perfectly safe if the values of the variables involved are such that
5785 overflow never does, in fact, occur. Therefore this warning can
5786 easily give a false positive: a warning about code that is not
5787 actually a problem. To help focus on important issues, several
5788 warning levels are defined. No warnings are issued for the use of
5789 undefined signed overflow when estimating how many iterations a loop
5790 requires, in particular when determining whether a loop will be
5791 executed at all.
5792
5793 @table @gcctabopt
5794 @item -Wstrict-overflow=1
5795 Warn about cases that are both questionable and easy to avoid. For
5796 example the compiler simplifies
5797 @code{x + 1 > x} to @code{1}. This level of
5798 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5799 are not, and must be explicitly requested.
5800
5801 @item -Wstrict-overflow=2
5802 Also warn about other cases where a comparison is simplified to a
5803 constant. For example: @code{abs (x) >= 0}. This can only be
5804 simplified when signed integer overflow is undefined, because
5805 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5806 zero. @option{-Wstrict-overflow} (with no level) is the same as
5807 @option{-Wstrict-overflow=2}.
5808
5809 @item -Wstrict-overflow=3
5810 Also warn about other cases where a comparison is simplified. For
5811 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5812
5813 @item -Wstrict-overflow=4
5814 Also warn about other simplifications not covered by the above cases.
5815 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5816
5817 @item -Wstrict-overflow=5
5818 Also warn about cases where the compiler reduces the magnitude of a
5819 constant involved in a comparison. For example: @code{x + 2 > y} is
5820 simplified to @code{x + 1 >= y}. This is reported only at the
5821 highest warning level because this simplification applies to many
5822 comparisons, so this warning level gives a very large number of
5823 false positives.
5824 @end table
5825
5826 @item -Wstring-compare
5827 @opindex Wstring-compare
5828 @opindex Wno-string-compare
5829 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
5830 determined to be either zero or non-zero in tests for such equality
5831 owing to the length of one argument being greater than the size of
5832 the array the other argument is stored in (or the bound in the case
5833 of @code{strncmp}). Such calls could be mistakes. For example,
5834 the call to @code{strcmp} below is diagnosed because its result is
5835 necessarily non-zero irrespective of the contents of the array @code{a}.
5836
5837 @smallexample
5838 extern char a[4];
5839 void f (char *d)
5840 @{
5841 strcpy (d, "string");
5842 @dots{}
5843 if (0 == strcmp (a, d)) // cannot be true
5844 puts ("a and d are the same");
5845 @}
5846 @end smallexample
5847
5848 @option{-Wstring-compare} is enabled by @option{-Wextra}.
5849
5850 @item -Wstringop-overflow
5851 @itemx -Wstringop-overflow=@var{type}
5852 @opindex Wstringop-overflow
5853 @opindex Wno-stringop-overflow
5854 Warn for calls to string manipulation functions such as @code{memcpy} and
5855 @code{strcpy} that are determined to overflow the destination buffer. The
5856 optional argument is one greater than the type of Object Size Checking to
5857 perform to determine the size of the destination. @xref{Object Size Checking}.
5858 The argument is meaningful only for functions that operate on character arrays
5859 but not for raw memory functions like @code{memcpy} which always make use
5860 of Object Size type-0. The option also warns for calls that specify a size
5861 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5862 The option produces the best results with optimization enabled but can detect
5863 a small subset of simple buffer overflows even without optimization in
5864 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5865 correspond to the standard functions. In any case, the option warns about
5866 just a subset of buffer overflows detected by the corresponding overflow
5867 checking built-ins. For example, the option will issue a warning for
5868 the @code{strcpy} call below because it copies at least 5 characters
5869 (the string @code{"blue"} including the terminating NUL) into the buffer
5870 of size 4.
5871
5872 @smallexample
5873 enum Color @{ blue, purple, yellow @};
5874 const char* f (enum Color clr)
5875 @{
5876 static char buf [4];
5877 const char *str;
5878 switch (clr)
5879 @{
5880 case blue: str = "blue"; break;
5881 case purple: str = "purple"; break;
5882 case yellow: str = "yellow"; break;
5883 @}
5884
5885 return strcpy (buf, str); // warning here
5886 @}
5887 @end smallexample
5888
5889 Option @option{-Wstringop-overflow=2} is enabled by default.
5890
5891 @table @gcctabopt
5892 @item -Wstringop-overflow
5893 @itemx -Wstringop-overflow=1
5894 @opindex Wstringop-overflow
5895 @opindex Wno-stringop-overflow
5896 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5897 to determine the sizes of destination objects. This is the default setting
5898 of the option. At this setting the option will not warn for writes past
5899 the end of subobjects of larger objects accessed by pointers unless the
5900 size of the largest surrounding object is known. When the destination may
5901 be one of several objects it is assumed to be the largest one of them. On
5902 Linux systems, when optimization is enabled at this setting the option warns
5903 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5904 a non-zero value.
5905
5906 @item -Wstringop-overflow=2
5907 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5908 to determine the sizes of destination objects. At this setting the option
5909 will warn about overflows when writing to members of the largest complete
5910 objects whose exact size is known. It will, however, not warn for excessive
5911 writes to the same members of unknown objects referenced by pointers since
5912 they may point to arrays containing unknown numbers of elements.
5913
5914 @item -Wstringop-overflow=3
5915 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5916 to determine the sizes of destination objects. At this setting the option
5917 warns about overflowing the smallest object or data member. This is the
5918 most restrictive setting of the option that may result in warnings for safe
5919 code.
5920
5921 @item -Wstringop-overflow=4
5922 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5923 to determine the sizes of destination objects. At this setting the option
5924 will warn about overflowing any data members, and when the destination is
5925 one of several objects it uses the size of the largest of them to decide
5926 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5927 setting of the option may result in warnings for benign code.
5928 @end table
5929
5930 @item -Wstringop-truncation
5931 @opindex Wstringop-truncation
5932 @opindex Wno-stringop-truncation
5933 Warn for calls to bounded string manipulation functions such as @code{strncat},
5934 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5935 or leave the destination unchanged.
5936
5937 In the following example, the call to @code{strncat} specifies a bound that
5938 is less than the length of the source string. As a result, the copy of
5939 the source will be truncated and so the call is diagnosed. To avoid the
5940 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5941
5942 @smallexample
5943 void append (char *buf, size_t bufsize)
5944 @{
5945 strncat (buf, ".txt", 3);
5946 @}
5947 @end smallexample
5948
5949 As another example, the following call to @code{strncpy} results in copying
5950 to @code{d} just the characters preceding the terminating NUL, without
5951 appending the NUL to the end. Assuming the result of @code{strncpy} is
5952 necessarily a NUL-terminated string is a common mistake, and so the call
5953 is diagnosed. To avoid the warning when the result is not expected to be
5954 NUL-terminated, call @code{memcpy} instead.
5955
5956 @smallexample
5957 void copy (char *d, const char *s)
5958 @{
5959 strncpy (d, s, strlen (s));
5960 @}
5961 @end smallexample
5962
5963 In the following example, the call to @code{strncpy} specifies the size
5964 of the destination buffer as the bound. If the length of the source
5965 string is equal to or greater than this size the result of the copy will
5966 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5967 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5968 element of the buffer to @code{NUL}.
5969
5970 @smallexample
5971 void copy (const char *s)
5972 @{
5973 char buf[80];
5974 strncpy (buf, s, sizeof buf);
5975 @dots{}
5976 @}
5977 @end smallexample
5978
5979 In situations where a character array is intended to store a sequence
5980 of bytes with no terminating @code{NUL} such an array may be annotated
5981 with attribute @code{nonstring} to avoid this warning. Such arrays,
5982 however, are not suitable arguments to functions that expect
5983 @code{NUL}-terminated strings. To help detect accidental misuses of
5984 such arrays GCC issues warnings unless it can prove that the use is
5985 safe. @xref{Common Variable Attributes}.
5986
5987 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5988 @opindex Wsuggest-attribute=
5989 @opindex Wno-suggest-attribute=
5990 Warn for cases where adding an attribute may be beneficial. The
5991 attributes currently supported are listed below.
5992
5993 @table @gcctabopt
5994 @item -Wsuggest-attribute=pure
5995 @itemx -Wsuggest-attribute=const
5996 @itemx -Wsuggest-attribute=noreturn
5997 @itemx -Wmissing-noreturn
5998 @itemx -Wsuggest-attribute=malloc
5999 @opindex Wsuggest-attribute=pure
6000 @opindex Wno-suggest-attribute=pure
6001 @opindex Wsuggest-attribute=const
6002 @opindex Wno-suggest-attribute=const
6003 @opindex Wsuggest-attribute=noreturn
6004 @opindex Wno-suggest-attribute=noreturn
6005 @opindex Wmissing-noreturn
6006 @opindex Wno-missing-noreturn
6007 @opindex Wsuggest-attribute=malloc
6008 @opindex Wno-suggest-attribute=malloc
6009
6010 Warn about functions that might be candidates for attributes
6011 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6012 only warns for functions visible in other compilation units or (in the case of
6013 @code{pure} and @code{const}) if it cannot prove that the function returns
6014 normally. A function returns normally if it doesn't contain an infinite loop or
6015 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6016 requires option @option{-fipa-pure-const}, which is enabled by default at
6017 @option{-O} and higher. Higher optimization levels improve the accuracy
6018 of the analysis.
6019
6020 @item -Wsuggest-attribute=format
6021 @itemx -Wmissing-format-attribute
6022 @opindex Wsuggest-attribute=format
6023 @opindex Wmissing-format-attribute
6024 @opindex Wno-suggest-attribute=format
6025 @opindex Wno-missing-format-attribute
6026 @opindex Wformat
6027 @opindex Wno-format
6028
6029 Warn about function pointers that might be candidates for @code{format}
6030 attributes. Note these are only possible candidates, not absolute ones.
6031 GCC guesses that function pointers with @code{format} attributes that
6032 are used in assignment, initialization, parameter passing or return
6033 statements should have a corresponding @code{format} attribute in the
6034 resulting type. I.e.@: the left-hand side of the assignment or
6035 initialization, the type of the parameter variable, or the return type
6036 of the containing function respectively should also have a @code{format}
6037 attribute to avoid the warning.
6038
6039 GCC also warns about function definitions that might be
6040 candidates for @code{format} attributes. Again, these are only
6041 possible candidates. GCC guesses that @code{format} attributes
6042 might be appropriate for any function that calls a function like
6043 @code{vprintf} or @code{vscanf}, but this might not always be the
6044 case, and some functions for which @code{format} attributes are
6045 appropriate may not be detected.
6046
6047 @item -Wsuggest-attribute=cold
6048 @opindex Wsuggest-attribute=cold
6049 @opindex Wno-suggest-attribute=cold
6050
6051 Warn about functions that might be candidates for @code{cold} attribute. This
6052 is based on static detection and generally will only warn about functions which
6053 always leads to a call to another @code{cold} function such as wrappers of
6054 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6055 @end table
6056
6057 @item -Wsuggest-final-types
6058 @opindex Wno-suggest-final-types
6059 @opindex Wsuggest-final-types
6060 Warn about types with virtual methods where code quality would be improved
6061 if the type were declared with the C++11 @code{final} specifier,
6062 or, if possible,
6063 declared in an anonymous namespace. This allows GCC to more aggressively
6064 devirtualize the polymorphic calls. This warning is more effective with
6065 link-time optimization,
6066 where the information about the class hierarchy graph is
6067 more complete.
6068
6069 @item -Wsuggest-final-methods
6070 @opindex Wno-suggest-final-methods
6071 @opindex Wsuggest-final-methods
6072 Warn about virtual methods where code quality would be improved if the method
6073 were declared with the C++11 @code{final} specifier,
6074 or, if possible, its type were
6075 declared in an anonymous namespace or with the @code{final} specifier.
6076 This warning is
6077 more effective with link-time optimization, where the information about the
6078 class hierarchy graph is more complete. It is recommended to first consider
6079 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6080 annotations.
6081
6082 @item -Wsuggest-override
6083 Warn about overriding virtual functions that are not marked with the override
6084 keyword.
6085
6086 @item -Walloc-zero
6087 @opindex Wno-alloc-zero
6088 @opindex Walloc-zero
6089 Warn about calls to allocation functions decorated with attribute
6090 @code{alloc_size} that specify zero bytes, including those to the built-in
6091 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6092 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6093 when called with a zero size differs among implementations (and in the case
6094 of @code{realloc} has been deprecated) relying on it may result in subtle
6095 portability bugs and should be avoided.
6096
6097 @item -Walloc-size-larger-than=@var{byte-size}
6098 @opindex Walloc-size-larger-than=
6099 @opindex Wno-alloc-size-larger-than
6100 Warn about calls to functions decorated with attribute @code{alloc_size}
6101 that attempt to allocate objects larger than the specified number of bytes,
6102 or where the result of the size computation in an integer type with infinite
6103 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6104 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6105 Warnings controlled by the option can be disabled either by specifying
6106 @var{byte-size} of @samp{SIZE_MAX} or more or by
6107 @option{-Wno-alloc-size-larger-than}.
6108 @xref{Function Attributes}.
6109
6110 @item -Wno-alloc-size-larger-than
6111 @opindex Wno-alloc-size-larger-than
6112 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6113 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6114 larger.
6115
6116 @item -Walloca
6117 @opindex Wno-alloca
6118 @opindex Walloca
6119 This option warns on all uses of @code{alloca} in the source.
6120
6121 @item -Walloca-larger-than=@var{byte-size}
6122 @opindex Walloca-larger-than=
6123 @opindex Wno-alloca-larger-than
6124 This option warns on calls to @code{alloca} with an integer argument whose
6125 value is either zero, or that is not bounded by a controlling predicate
6126 that limits its value to at most @var{byte-size}. It also warns for calls
6127 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6128 types are considered unbounded even if they appear to be constrained to
6129 the expected range.
6130
6131 For example, a bounded case of @code{alloca} could be:
6132
6133 @smallexample
6134 void func (size_t n)
6135 @{
6136 void *p;
6137 if (n <= 1000)
6138 p = alloca (n);
6139 else
6140 p = malloc (n);
6141 f (p);
6142 @}
6143 @end smallexample
6144
6145 In the above example, passing @code{-Walloca-larger-than=1000} would not
6146 issue a warning because the call to @code{alloca} is known to be at most
6147 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6148 the compiler would emit a warning.
6149
6150 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6151 controlling predicate constraining its integer argument. For example:
6152
6153 @smallexample
6154 void func ()
6155 @{
6156 void *p = alloca (n);
6157 f (p);
6158 @}
6159 @end smallexample
6160
6161 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6162 a warning, but this time because of the lack of bounds checking.
6163
6164 Note, that even seemingly correct code involving signed integers could
6165 cause a warning:
6166
6167 @smallexample
6168 void func (signed int n)
6169 @{
6170 if (n < 500)
6171 @{
6172 p = alloca (n);
6173 f (p);
6174 @}
6175 @}
6176 @end smallexample
6177
6178 In the above example, @var{n} could be negative, causing a larger than
6179 expected argument to be implicitly cast into the @code{alloca} call.
6180
6181 This option also warns when @code{alloca} is used in a loop.
6182
6183 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6184 but is usually only effective when @option{-ftree-vrp} is active (default
6185 for @option{-O2} and above).
6186
6187 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6188
6189 @item -Wno-alloca-larger-than
6190 @opindex Wno-alloca-larger-than
6191 Disable @option{-Walloca-larger-than=} warnings. The option is
6192 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6193
6194 @item -Warray-bounds
6195 @itemx -Warray-bounds=@var{n}
6196 @opindex Wno-array-bounds
6197 @opindex Warray-bounds
6198 This option is only active when @option{-ftree-vrp} is active
6199 (default for @option{-O2} and above). It warns about subscripts to arrays
6200 that are always out of bounds. This warning is enabled by @option{-Wall}.
6201
6202 @table @gcctabopt
6203 @item -Warray-bounds=1
6204 This is the warning level of @option{-Warray-bounds} and is enabled
6205 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6206
6207 @item -Warray-bounds=2
6208 This warning level also warns about out of bounds access for
6209 arrays at the end of a struct and for arrays accessed through
6210 pointers. This warning level may give a larger number of
6211 false positives and is deactivated by default.
6212 @end table
6213
6214 @item -Wattribute-alias=@var{n}
6215 @itemx -Wno-attribute-alias
6216 @opindex Wattribute-alias
6217 @opindex Wno-attribute-alias
6218 Warn about declarations using the @code{alias} and similar attributes whose
6219 target is incompatible with the type of the alias.
6220 @xref{Function Attributes,,Declaring Attributes of Functions}.
6221
6222 @table @gcctabopt
6223 @item -Wattribute-alias=1
6224 The default warning level of the @option{-Wattribute-alias} option diagnoses
6225 incompatibilities between the type of the alias declaration and that of its
6226 target. Such incompatibilities are typically indicative of bugs.
6227
6228 @item -Wattribute-alias=2
6229
6230 At this level @option{-Wattribute-alias} also diagnoses cases where
6231 the attributes of the alias declaration are more restrictive than the
6232 attributes applied to its target. These mismatches can potentially
6233 result in incorrect code generation. In other cases they may be
6234 benign and could be resolved simply by adding the missing attribute to
6235 the target. For comparison, see the @option{-Wmissing-attributes}
6236 option, which controls diagnostics when the alias declaration is less
6237 restrictive than the target, rather than more restrictive.
6238
6239 Attributes considered include @code{alloc_align}, @code{alloc_size},
6240 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6241 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6242 @code{returns_nonnull}, and @code{returns_twice}.
6243 @end table
6244
6245 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6246 This is the default. You can disable these warnings with either
6247 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6248
6249 @item -Wbool-compare
6250 @opindex Wno-bool-compare
6251 @opindex Wbool-compare
6252 Warn about boolean expression compared with an integer value different from
6253 @code{true}/@code{false}. For instance, the following comparison is
6254 always false:
6255 @smallexample
6256 int n = 5;
6257 @dots{}
6258 if ((n > 1) == 2) @{ @dots{} @}
6259 @end smallexample
6260 This warning is enabled by @option{-Wall}.
6261
6262 @item -Wbool-operation
6263 @opindex Wno-bool-operation
6264 @opindex Wbool-operation
6265 Warn about suspicious operations on expressions of a boolean type. For
6266 instance, bitwise negation of a boolean is very likely a bug in the program.
6267 For C, this warning also warns about incrementing or decrementing a boolean,
6268 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6269 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6270
6271 This warning is enabled by @option{-Wall}.
6272
6273 @item -Wduplicated-branches
6274 @opindex Wno-duplicated-branches
6275 @opindex Wduplicated-branches
6276 Warn when an if-else has identical branches. This warning detects cases like
6277 @smallexample
6278 if (p != NULL)
6279 return 0;
6280 else
6281 return 0;
6282 @end smallexample
6283 It doesn't warn when both branches contain just a null statement. This warning
6284 also warn for conditional operators:
6285 @smallexample
6286 int i = x ? *p : *p;
6287 @end smallexample
6288
6289 @item -Wduplicated-cond
6290 @opindex Wno-duplicated-cond
6291 @opindex Wduplicated-cond
6292 Warn about duplicated conditions in an if-else-if chain. For instance,
6293 warn for the following code:
6294 @smallexample
6295 if (p->q != NULL) @{ @dots{} @}
6296 else if (p->q != NULL) @{ @dots{} @}
6297 @end smallexample
6298
6299 @item -Wframe-address
6300 @opindex Wno-frame-address
6301 @opindex Wframe-address
6302 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6303 is called with an argument greater than 0. Such calls may return indeterminate
6304 values or crash the program. The warning is included in @option{-Wall}.
6305
6306 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6307 @opindex Wno-discarded-qualifiers
6308 @opindex Wdiscarded-qualifiers
6309 Do not warn if type qualifiers on pointers are being discarded.
6310 Typically, the compiler warns if a @code{const char *} variable is
6311 passed to a function that takes a @code{char *} parameter. This option
6312 can be used to suppress such a warning.
6313
6314 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6315 @opindex Wno-discarded-array-qualifiers
6316 @opindex Wdiscarded-array-qualifiers
6317 Do not warn if type qualifiers on arrays which are pointer targets
6318 are being discarded. Typically, the compiler warns if a
6319 @code{const int (*)[]} variable is passed to a function that
6320 takes a @code{int (*)[]} parameter. This option can be used to
6321 suppress such a warning.
6322
6323 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6324 @opindex Wno-incompatible-pointer-types
6325 @opindex Wincompatible-pointer-types
6326 Do not warn when there is a conversion between pointers that have incompatible
6327 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6328 which warns for pointer argument passing or assignment with different
6329 signedness.
6330
6331 @item -Wno-int-conversion @r{(C and Objective-C only)}
6332 @opindex Wno-int-conversion
6333 @opindex Wint-conversion
6334 Do not warn about incompatible integer to pointer and pointer to integer
6335 conversions. This warning is about implicit conversions; for explicit
6336 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6337 @option{-Wno-pointer-to-int-cast} may be used.
6338
6339 @item -Wzero-length-bounds
6340 @opindex Wzero-length-bounds
6341 @opindex Wzero-length-bounds
6342 Warn about accesses to elements of zero-length array members that might
6343 overlap other members of the same object. Declaring interior zero-length
6344 arrays is discouraged because accesses to them are undefined. See
6345 @xref{Zero Length}.
6346
6347 For example, the first two stores in function @code{bad} are diagnosed
6348 because the array elements overlap the subsequent members @code{b} and
6349 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
6350 because it is beyond the bounds of the enclosing object.
6351
6352 @smallexample
6353 struct X @{ int a[0]; int b, c; @};
6354 struct X x;
6355
6356 void bad (void)
6357 @{
6358 x.a[0] = 0; // -Wzero-length-bounds
6359 x.a[1] = 1; // -Wzero-length-bounds
6360 x.a[2] = 2; // -Warray-bounds
6361 @}
6362 @end smallexample
6363
6364 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6365
6366 @item -Wno-div-by-zero
6367 @opindex Wno-div-by-zero
6368 @opindex Wdiv-by-zero
6369 Do not warn about compile-time integer division by zero. Floating-point
6370 division by zero is not warned about, as it can be a legitimate way of
6371 obtaining infinities and NaNs.
6372
6373 @item -Wsystem-headers
6374 @opindex Wsystem-headers
6375 @opindex Wno-system-headers
6376 @cindex warnings from system headers
6377 @cindex system headers, warnings from
6378 Print warning messages for constructs found in system header files.
6379 Warnings from system headers are normally suppressed, on the assumption
6380 that they usually do not indicate real problems and would only make the
6381 compiler output harder to read. Using this command-line option tells
6382 GCC to emit warnings from system headers as if they occurred in user
6383 code. However, note that using @option{-Wall} in conjunction with this
6384 option does @emph{not} warn about unknown pragmas in system
6385 headers---for that, @option{-Wunknown-pragmas} must also be used.
6386
6387 @item -Wtautological-compare
6388 @opindex Wtautological-compare
6389 @opindex Wno-tautological-compare
6390 Warn if a self-comparison always evaluates to true or false. This
6391 warning detects various mistakes such as:
6392 @smallexample
6393 int i = 1;
6394 @dots{}
6395 if (i > i) @{ @dots{} @}
6396 @end smallexample
6397
6398 This warning also warns about bitwise comparisons that always evaluate
6399 to true or false, for instance:
6400 @smallexample
6401 if ((a & 16) == 10) @{ @dots{} @}
6402 @end smallexample
6403 will always be false.
6404
6405 This warning is enabled by @option{-Wall}.
6406
6407 @item -Wtrampolines
6408 @opindex Wtrampolines
6409 @opindex Wno-trampolines
6410 Warn about trampolines generated for pointers to nested functions.
6411 A trampoline is a small piece of data or code that is created at run
6412 time on the stack when the address of a nested function is taken, and is
6413 used to call the nested function indirectly. For some targets, it is
6414 made up of data only and thus requires no special treatment. But, for
6415 most targets, it is made up of code and thus requires the stack to be
6416 made executable in order for the program to work properly.
6417
6418 @item -Wfloat-equal
6419 @opindex Wfloat-equal
6420 @opindex Wno-float-equal
6421 Warn if floating-point values are used in equality comparisons.
6422
6423 The idea behind this is that sometimes it is convenient (for the
6424 programmer) to consider floating-point values as approximations to
6425 infinitely precise real numbers. If you are doing this, then you need
6426 to compute (by analyzing the code, or in some other way) the maximum or
6427 likely maximum error that the computation introduces, and allow for it
6428 when performing comparisons (and when producing output, but that's a
6429 different problem). In particular, instead of testing for equality, you
6430 should check to see whether the two values have ranges that overlap; and
6431 this is done with the relational operators, so equality comparisons are
6432 probably mistaken.
6433
6434 @item -Wtraditional @r{(C and Objective-C only)}
6435 @opindex Wtraditional
6436 @opindex Wno-traditional
6437 Warn about certain constructs that behave differently in traditional and
6438 ISO C@. Also warn about ISO C constructs that have no traditional C
6439 equivalent, and/or problematic constructs that should be avoided.
6440
6441 @itemize @bullet
6442 @item
6443 Macro parameters that appear within string literals in the macro body.
6444 In traditional C macro replacement takes place within string literals,
6445 but in ISO C it does not.
6446
6447 @item
6448 In traditional C, some preprocessor directives did not exist.
6449 Traditional preprocessors only considered a line to be a directive
6450 if the @samp{#} appeared in column 1 on the line. Therefore
6451 @option{-Wtraditional} warns about directives that traditional C
6452 understands but ignores because the @samp{#} does not appear as the
6453 first character on the line. It also suggests you hide directives like
6454 @code{#pragma} not understood by traditional C by indenting them. Some
6455 traditional implementations do not recognize @code{#elif}, so this option
6456 suggests avoiding it altogether.
6457
6458 @item
6459 A function-like macro that appears without arguments.
6460
6461 @item
6462 The unary plus operator.
6463
6464 @item
6465 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6466 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6467 constants.) Note, these suffixes appear in macros defined in the system
6468 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6469 Use of these macros in user code might normally lead to spurious
6470 warnings, however GCC's integrated preprocessor has enough context to
6471 avoid warning in these cases.
6472
6473 @item
6474 A function declared external in one block and then used after the end of
6475 the block.
6476
6477 @item
6478 A @code{switch} statement has an operand of type @code{long}.
6479
6480 @item
6481 A non-@code{static} function declaration follows a @code{static} one.
6482 This construct is not accepted by some traditional C compilers.
6483
6484 @item
6485 The ISO type of an integer constant has a different width or
6486 signedness from its traditional type. This warning is only issued if
6487 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6488 typically represent bit patterns, are not warned about.
6489
6490 @item
6491 Usage of ISO string concatenation is detected.
6492
6493 @item
6494 Initialization of automatic aggregates.
6495
6496 @item
6497 Identifier conflicts with labels. Traditional C lacks a separate
6498 namespace for labels.
6499
6500 @item
6501 Initialization of unions. If the initializer is zero, the warning is
6502 omitted. This is done under the assumption that the zero initializer in
6503 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6504 initializer warnings and relies on default initialization to zero in the
6505 traditional C case.
6506
6507 @item
6508 Conversions by prototypes between fixed/floating-point values and vice
6509 versa. The absence of these prototypes when compiling with traditional
6510 C causes serious problems. This is a subset of the possible
6511 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6512
6513 @item
6514 Use of ISO C style function definitions. This warning intentionally is
6515 @emph{not} issued for prototype declarations or variadic functions
6516 because these ISO C features appear in your code when using
6517 libiberty's traditional C compatibility macros, @code{PARAMS} and
6518 @code{VPARAMS}. This warning is also bypassed for nested functions
6519 because that feature is already a GCC extension and thus not relevant to
6520 traditional C compatibility.
6521 @end itemize
6522
6523 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6524 @opindex Wtraditional-conversion
6525 @opindex Wno-traditional-conversion
6526 Warn if a prototype causes a type conversion that is different from what
6527 would happen to the same argument in the absence of a prototype. This
6528 includes conversions of fixed point to floating and vice versa, and
6529 conversions changing the width or signedness of a fixed-point argument
6530 except when the same as the default promotion.
6531
6532 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6533 @opindex Wdeclaration-after-statement
6534 @opindex Wno-declaration-after-statement
6535 Warn when a declaration is found after a statement in a block. This
6536 construct, known from C++, was introduced with ISO C99 and is by default
6537 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6538
6539 @item -Wshadow
6540 @opindex Wshadow
6541 @opindex Wno-shadow
6542 Warn whenever a local variable or type declaration shadows another
6543 variable, parameter, type, class member (in C++), or instance variable
6544 (in Objective-C) or whenever a built-in function is shadowed. Note
6545 that in C++, the compiler warns if a local variable shadows an
6546 explicit typedef, but not if it shadows a struct/class/enum.
6547 If this warning is enabled, it includes also all instances of
6548 local shadowing. This means that @option{-Wno-shadow=local}
6549 and @option{-Wno-shadow=compatible-local} are ignored when
6550 @option{-Wshadow} is used.
6551 Same as @option{-Wshadow=global}.
6552
6553 @item -Wno-shadow-ivar @r{(Objective-C only)}
6554 @opindex Wno-shadow-ivar
6555 @opindex Wshadow-ivar
6556 Do not warn whenever a local variable shadows an instance variable in an
6557 Objective-C method.
6558
6559 @item -Wshadow=global
6560 @opindex Wshadow=global
6561 Warn for any shadowing.
6562 Same as @option{-Wshadow}.
6563
6564 @item -Wshadow=local
6565 @opindex Wshadow=local
6566 Warn when a local variable shadows another local variable or parameter.
6567
6568 @item -Wshadow=compatible-local
6569 @opindex Wshadow=compatible-local
6570 Warn when a local variable shadows another local variable or parameter
6571 whose type is compatible with that of the shadowing variable. In C++,
6572 type compatibility here means the type of the shadowing variable can be
6573 converted to that of the shadowed variable. The creation of this flag
6574 (in addition to @option{-Wshadow=local}) is based on the idea that when
6575 a local variable shadows another one of incompatible type, it is most
6576 likely intentional, not a bug or typo, as shown in the following example:
6577
6578 @smallexample
6579 @group
6580 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6581 @{
6582 for (int i = 0; i < N; ++i)
6583 @{
6584 ...
6585 @}
6586 ...
6587 @}
6588 @end group
6589 @end smallexample
6590
6591 Since the two variable @code{i} in the example above have incompatible types,
6592 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
6593 Because their types are incompatible, if a programmer accidentally uses one
6594 in place of the other, type checking is expected to catch that and emit an
6595 error or warning. Use of this flag instead of @option{-Wshadow=local} can
6596 possibly reduce the number of warnings triggered by intentional shadowing.
6597 Note that this also means that shadowing @code{const char *i} by
6598 @code{char *i} does not emit a warning.
6599
6600 This warning is also enabled by @option{-Wshadow=local}.
6601
6602 @item -Wlarger-than=@var{byte-size}
6603 @opindex Wlarger-than=
6604 @opindex Wlarger-than-@var{byte-size}
6605 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6606 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6607 Warnings controlled by the option can be disabled either by specifying
6608 @var{byte-size} of @samp{SIZE_MAX} or more or by
6609 @option{-Wno-larger-than}.
6610
6611 @item -Wno-larger-than
6612 @opindex Wno-larger-than
6613 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6614 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6615
6616 @item -Wframe-larger-than=@var{byte-size}
6617 @opindex Wframe-larger-than=
6618 @opindex Wno-frame-larger-than
6619 Warn if the size of a function frame exceeds @var{byte-size}.
6620 The computation done to determine the stack frame size is approximate
6621 and not conservative.
6622 The actual requirements may be somewhat greater than @var{byte-size}
6623 even if you do not get a warning. In addition, any space allocated
6624 via @code{alloca}, variable-length arrays, or related constructs
6625 is not included by the compiler when determining
6626 whether or not to issue a warning.
6627 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6628 Warnings controlled by the option can be disabled either by specifying
6629 @var{byte-size} of @samp{SIZE_MAX} or more or by
6630 @option{-Wno-frame-larger-than}.
6631
6632 @item -Wno-frame-larger-than
6633 @opindex Wno-frame-larger-than
6634 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6635 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6636
6637 @item -Wno-free-nonheap-object
6638 @opindex Wno-free-nonheap-object
6639 @opindex Wfree-nonheap-object
6640 Do not warn when attempting to free an object that was not allocated
6641 on the heap.
6642
6643 @item -Wstack-usage=@var{byte-size}
6644 @opindex Wstack-usage
6645 @opindex Wno-stack-usage
6646 Warn if the stack usage of a function might exceed @var{byte-size}.
6647 The computation done to determine the stack usage is conservative.
6648 Any space allocated via @code{alloca}, variable-length arrays, or related
6649 constructs is included by the compiler when determining whether or not to
6650 issue a warning.
6651
6652 The message is in keeping with the output of @option{-fstack-usage}.
6653
6654 @itemize
6655 @item
6656 If the stack usage is fully static but exceeds the specified amount, it's:
6657
6658 @smallexample
6659 warning: stack usage is 1120 bytes
6660 @end smallexample
6661 @item
6662 If the stack usage is (partly) dynamic but bounded, it's:
6663
6664 @smallexample
6665 warning: stack usage might be 1648 bytes
6666 @end smallexample
6667 @item
6668 If the stack usage is (partly) dynamic and not bounded, it's:
6669
6670 @smallexample
6671 warning: stack usage might be unbounded
6672 @end smallexample
6673 @end itemize
6674
6675 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6676 Warnings controlled by the option can be disabled either by specifying
6677 @var{byte-size} of @samp{SIZE_MAX} or more or by
6678 @option{-Wno-stack-usage}.
6679
6680 @item -Wno-stack-usage
6681 @opindex Wno-stack-usage
6682 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6683 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6684
6685 @item -Wunsafe-loop-optimizations
6686 @opindex Wunsafe-loop-optimizations
6687 @opindex Wno-unsafe-loop-optimizations
6688 Warn if the loop cannot be optimized because the compiler cannot
6689 assume anything on the bounds of the loop indices. With
6690 @option{-funsafe-loop-optimizations} warn if the compiler makes
6691 such assumptions.
6692
6693 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6694 @opindex Wno-pedantic-ms-format
6695 @opindex Wpedantic-ms-format
6696 When used in combination with @option{-Wformat}
6697 and @option{-pedantic} without GNU extensions, this option
6698 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6699 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6700 which depend on the MS runtime.
6701
6702 @item -Waligned-new
6703 @opindex Waligned-new
6704 @opindex Wno-aligned-new
6705 Warn about a new-expression of a type that requires greater alignment
6706 than the @code{alignof(std::max_align_t)} but uses an allocation
6707 function without an explicit alignment parameter. This option is
6708 enabled by @option{-Wall}.
6709
6710 Normally this only warns about global allocation functions, but
6711 @option{-Waligned-new=all} also warns about class member allocation
6712 functions.
6713
6714 @item -Wplacement-new
6715 @itemx -Wplacement-new=@var{n}
6716 @opindex Wplacement-new
6717 @opindex Wno-placement-new
6718 Warn about placement new expressions with undefined behavior, such as
6719 constructing an object in a buffer that is smaller than the type of
6720 the object. For example, the placement new expression below is diagnosed
6721 because it attempts to construct an array of 64 integers in a buffer only
6722 64 bytes large.
6723 @smallexample
6724 char buf [64];
6725 new (buf) int[64];
6726 @end smallexample
6727 This warning is enabled by default.
6728
6729 @table @gcctabopt
6730 @item -Wplacement-new=1
6731 This is the default warning level of @option{-Wplacement-new}. At this
6732 level the warning is not issued for some strictly undefined constructs that
6733 GCC allows as extensions for compatibility with legacy code. For example,
6734 the following @code{new} expression is not diagnosed at this level even
6735 though it has undefined behavior according to the C++ standard because
6736 it writes past the end of the one-element array.
6737 @smallexample
6738 struct S @{ int n, a[1]; @};
6739 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6740 new (s->a)int [32]();
6741 @end smallexample
6742
6743 @item -Wplacement-new=2
6744 At this level, in addition to diagnosing all the same constructs as at level
6745 1, a diagnostic is also issued for placement new expressions that construct
6746 an object in the last member of structure whose type is an array of a single
6747 element and whose size is less than the size of the object being constructed.
6748 While the previous example would be diagnosed, the following construct makes
6749 use of the flexible member array extension to avoid the warning at level 2.
6750 @smallexample
6751 struct S @{ int n, a[]; @};
6752 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6753 new (s->a)int [32]();
6754 @end smallexample
6755
6756 @end table
6757
6758 @item -Wpointer-arith
6759 @opindex Wpointer-arith
6760 @opindex Wno-pointer-arith
6761 Warn about anything that depends on the ``size of'' a function type or
6762 of @code{void}. GNU C assigns these types a size of 1, for
6763 convenience in calculations with @code{void *} pointers and pointers
6764 to functions. In C++, warn also when an arithmetic operation involves
6765 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6766
6767 @item -Wpointer-compare
6768 @opindex Wpointer-compare
6769 @opindex Wno-pointer-compare
6770 Warn if a pointer is compared with a zero character constant. This usually
6771 means that the pointer was meant to be dereferenced. For example:
6772
6773 @smallexample
6774 const char *p = foo ();
6775 if (p == '\0')
6776 return 42;
6777 @end smallexample
6778
6779 Note that the code above is invalid in C++11.
6780
6781 This warning is enabled by default.
6782
6783 @item -Wtype-limits
6784 @opindex Wtype-limits
6785 @opindex Wno-type-limits
6786 Warn if a comparison is always true or always false due to the limited
6787 range of the data type, but do not warn for constant expressions. For
6788 example, warn if an unsigned variable is compared against zero with
6789 @code{<} or @code{>=}. This warning is also enabled by
6790 @option{-Wextra}.
6791
6792 @item -Wabsolute-value @r{(C and Objective-C only)}
6793 @opindex Wabsolute-value
6794 @opindex Wno-absolute-value
6795 Warn for calls to standard functions that compute the absolute value
6796 of an argument when a more appropriate standard function is available.
6797 For example, calling @code{abs(3.14)} triggers the warning because the
6798 appropriate function to call to compute the absolute value of a double
6799 argument is @code{fabs}. The option also triggers warnings when the
6800 argument in a call to such a function has an unsigned type. This
6801 warning can be suppressed with an explicit type cast and it is also
6802 enabled by @option{-Wextra}.
6803
6804 @include cppwarnopts.texi
6805
6806 @item -Wbad-function-cast @r{(C and Objective-C only)}
6807 @opindex Wbad-function-cast
6808 @opindex Wno-bad-function-cast
6809 Warn when a function call is cast to a non-matching type.
6810 For example, warn if a call to a function returning an integer type
6811 is cast to a pointer type.
6812
6813 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6814 @opindex Wc90-c99-compat
6815 @opindex Wno-c90-c99-compat
6816 Warn about features not present in ISO C90, but present in ISO C99.
6817 For instance, warn about use of variable length arrays, @code{long long}
6818 type, @code{bool} type, compound literals, designated initializers, and so
6819 on. This option is independent of the standards mode. Warnings are disabled
6820 in the expression that follows @code{__extension__}.
6821
6822 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6823 @opindex Wc99-c11-compat
6824 @opindex Wno-c99-c11-compat
6825 Warn about features not present in ISO C99, but present in ISO C11.
6826 For instance, warn about use of anonymous structures and unions,
6827 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6828 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6829 and so on. This option is independent of the standards mode. Warnings are
6830 disabled in the expression that follows @code{__extension__}.
6831
6832 @item -Wc++-compat @r{(C and Objective-C only)}
6833 @opindex Wc++-compat
6834 @opindex Wno-c++-compat
6835 Warn about ISO C constructs that are outside of the common subset of
6836 ISO C and ISO C++, e.g.@: request for implicit conversion from
6837 @code{void *} to a pointer to non-@code{void} type.
6838
6839 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6840 @opindex Wc++11-compat
6841 @opindex Wno-c++11-compat
6842 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6843 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6844 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6845 enabled by @option{-Wall}.
6846
6847 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6848 @opindex Wc++14-compat
6849 @opindex Wno-c++14-compat
6850 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6851 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6852
6853 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6854 @opindex Wc++17-compat
6855 @opindex Wno-c++17-compat
6856 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6857 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6858
6859 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6860 @opindex Wc++20-compat
6861 @opindex Wno-c++20-compat
6862 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6863 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6864
6865 @item -Wcast-qual
6866 @opindex Wcast-qual
6867 @opindex Wno-cast-qual
6868 Warn whenever a pointer is cast so as to remove a type qualifier from
6869 the target type. For example, warn if a @code{const char *} is cast
6870 to an ordinary @code{char *}.
6871
6872 Also warn when making a cast that introduces a type qualifier in an
6873 unsafe way. For example, casting @code{char **} to @code{const char **}
6874 is unsafe, as in this example:
6875
6876 @smallexample
6877 /* p is char ** value. */
6878 const char **q = (const char **) p;
6879 /* Assignment of readonly string to const char * is OK. */
6880 *q = "string";
6881 /* Now char** pointer points to read-only memory. */
6882 **p = 'b';
6883 @end smallexample
6884
6885 @item -Wcast-align
6886 @opindex Wcast-align
6887 @opindex Wno-cast-align
6888 Warn whenever a pointer is cast such that the required alignment of the
6889 target is increased. For example, warn if a @code{char *} is cast to
6890 an @code{int *} on machines where integers can only be accessed at
6891 two- or four-byte boundaries.
6892
6893 @item -Wcast-align=strict
6894 @opindex Wcast-align=strict
6895 Warn whenever a pointer is cast such that the required alignment of the
6896 target is increased. For example, warn if a @code{char *} is cast to
6897 an @code{int *} regardless of the target machine.
6898
6899 @item -Wcast-function-type
6900 @opindex Wcast-function-type
6901 @opindex Wno-cast-function-type
6902 Warn when a function pointer is cast to an incompatible function pointer.
6903 In a cast involving function types with a variable argument list only
6904 the types of initial arguments that are provided are considered.
6905 Any parameter of pointer-type matches any other pointer-type. Any benign
6906 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6907 on ILP32 targets. Likewise type qualifiers are ignored. The function
6908 type @code{void (*) (void)} is special and matches everything, which can
6909 be used to suppress this warning.
6910 In a cast involving pointer to member types this warning warns whenever
6911 the type cast is changing the pointer to member type.
6912 This warning is enabled by @option{-Wextra}.
6913
6914 @item -Wwrite-strings
6915 @opindex Wwrite-strings
6916 @opindex Wno-write-strings
6917 When compiling C, give string constants the type @code{const
6918 char[@var{length}]} so that copying the address of one into a
6919 non-@code{const} @code{char *} pointer produces a warning. These
6920 warnings help you find at compile time code that can try to write
6921 into a string constant, but only if you have been very careful about
6922 using @code{const} in declarations and prototypes. Otherwise, it is
6923 just a nuisance. This is why we did not make @option{-Wall} request
6924 these warnings.
6925
6926 When compiling C++, warn about the deprecated conversion from string
6927 literals to @code{char *}. This warning is enabled by default for C++
6928 programs.
6929
6930 @item -Wcatch-value
6931 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6932 @opindex Wcatch-value
6933 @opindex Wno-catch-value
6934 Warn about catch handlers that do not catch via reference.
6935 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6936 warn about polymorphic class types that are caught by value.
6937 With @option{-Wcatch-value=2} warn about all class types that are caught
6938 by value. With @option{-Wcatch-value=3} warn about all types that are
6939 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6940
6941 @item -Wclobbered
6942 @opindex Wclobbered
6943 @opindex Wno-clobbered
6944 Warn for variables that might be changed by @code{longjmp} or
6945 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6946
6947 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6948 @opindex Wconditionally-supported
6949 @opindex Wno-conditionally-supported
6950 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6951
6952 @item -Wconversion
6953 @opindex Wconversion
6954 @opindex Wno-conversion
6955 Warn for implicit conversions that may alter a value. This includes
6956 conversions between real and integer, like @code{abs (x)} when
6957 @code{x} is @code{double}; conversions between signed and unsigned,
6958 like @code{unsigned ui = -1}; and conversions to smaller types, like
6959 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6960 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6961 changed by the conversion like in @code{abs (2.0)}. Warnings about
6962 conversions between signed and unsigned integers can be disabled by
6963 using @option{-Wno-sign-conversion}.
6964
6965 For C++, also warn for confusing overload resolution for user-defined
6966 conversions; and conversions that never use a type conversion
6967 operator: conversions to @code{void}, the same type, a base class or a
6968 reference to them. Warnings about conversions between signed and
6969 unsigned integers are disabled by default in C++ unless
6970 @option{-Wsign-conversion} is explicitly enabled.
6971
6972 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6973 @opindex Wconversion-null
6974 @opindex Wno-conversion-null
6975 Do not warn for conversions between @code{NULL} and non-pointer
6976 types. @option{-Wconversion-null} is enabled by default.
6977
6978 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6979 @opindex Wzero-as-null-pointer-constant
6980 @opindex Wno-zero-as-null-pointer-constant
6981 Warn when a literal @samp{0} is used as null pointer constant. This can
6982 be useful to facilitate the conversion to @code{nullptr} in C++11.
6983
6984 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6985 @opindex Wsubobject-linkage
6986 @opindex Wno-subobject-linkage
6987 Warn if a class type has a base or a field whose type uses the anonymous
6988 namespace or depends on a type with no linkage. If a type A depends on
6989 a type B with no or internal linkage, defining it in multiple
6990 translation units would be an ODR violation because the meaning of B
6991 is different in each translation unit. If A only appears in a single
6992 translation unit, the best way to silence the warning is to give it
6993 internal linkage by putting it in an anonymous namespace as well. The
6994 compiler doesn't give this warning for types defined in the main .C
6995 file, as those are unlikely to have multiple definitions.
6996 @option{-Wsubobject-linkage} is enabled by default.
6997
6998 @item -Wdangling-else
6999 @opindex Wdangling-else
7000 @opindex Wno-dangling-else
7001 Warn about constructions where there may be confusion to which
7002 @code{if} statement an @code{else} branch belongs. Here is an example of
7003 such a case:
7004
7005 @smallexample
7006 @group
7007 @{
7008 if (a)
7009 if (b)
7010 foo ();
7011 else
7012 bar ();
7013 @}
7014 @end group
7015 @end smallexample
7016
7017 In C/C++, every @code{else} branch belongs to the innermost possible
7018 @code{if} statement, which in this example is @code{if (b)}. This is
7019 often not what the programmer expected, as illustrated in the above
7020 example by indentation the programmer chose. When there is the
7021 potential for this confusion, GCC issues a warning when this flag
7022 is specified. To eliminate the warning, add explicit braces around
7023 the innermost @code{if} statement so there is no way the @code{else}
7024 can belong to the enclosing @code{if}. The resulting code
7025 looks like this:
7026
7027 @smallexample
7028 @group
7029 @{
7030 if (a)
7031 @{
7032 if (b)
7033 foo ();
7034 else
7035 bar ();
7036 @}
7037 @}
7038 @end group
7039 @end smallexample
7040
7041 This warning is enabled by @option{-Wparentheses}.
7042
7043 @item -Wdate-time
7044 @opindex Wdate-time
7045 @opindex Wno-date-time
7046 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7047 are encountered as they might prevent bit-wise-identical reproducible
7048 compilations.
7049
7050 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
7051 @opindex Wdelete-incomplete
7052 @opindex Wno-delete-incomplete
7053 Warn when deleting a pointer to incomplete type, which may cause
7054 undefined behavior at runtime. This warning is enabled by default.
7055
7056 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
7057 @opindex Wuseless-cast
7058 @opindex Wno-useless-cast
7059 Warn when an expression is casted to its own type.
7060
7061 @item -Wempty-body
7062 @opindex Wempty-body
7063 @opindex Wno-empty-body
7064 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7065 while} statement. This warning is also enabled by @option{-Wextra}.
7066
7067 @item -Wenum-compare
7068 @opindex Wenum-compare
7069 @opindex Wno-enum-compare
7070 Warn about a comparison between values of different enumerated types.
7071 In C++ enumerated type mismatches in conditional expressions are also
7072 diagnosed and the warning is enabled by default. In C this warning is
7073 enabled by @option{-Wall}.
7074
7075 @item -Wenum-conversion @r{(C, Objective-C only)}
7076 @opindex Wenum-conversion
7077 @opindex Wno-enum-conversion
7078 Warn when a value of enumerated type is implicitly converted to a
7079 different enumerated type. This warning is enabled by @option{-Wextra}.
7080
7081 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7082 @opindex Wextra-semi
7083 @opindex Wno-extra-semi
7084 Warn about redundant semicolon after in-class function definition.
7085
7086 @item -Wjump-misses-init @r{(C, Objective-C only)}
7087 @opindex Wjump-misses-init
7088 @opindex Wno-jump-misses-init
7089 Warn if a @code{goto} statement or a @code{switch} statement jumps
7090 forward across the initialization of a variable, or jumps backward to a
7091 label after the variable has been initialized. This only warns about
7092 variables that are initialized when they are declared. This warning is
7093 only supported for C and Objective-C; in C++ this sort of branch is an
7094 error in any case.
7095
7096 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7097 can be disabled with the @option{-Wno-jump-misses-init} option.
7098
7099 @item -Wsign-compare
7100 @opindex Wsign-compare
7101 @opindex Wno-sign-compare
7102 @cindex warning for comparison of signed and unsigned values
7103 @cindex comparison of signed and unsigned values, warning
7104 @cindex signed and unsigned values, comparison warning
7105 Warn when a comparison between signed and unsigned values could produce
7106 an incorrect result when the signed value is converted to unsigned.
7107 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7108 also enabled by @option{-Wextra}.
7109
7110 @item -Wsign-conversion
7111 @opindex Wsign-conversion
7112 @opindex Wno-sign-conversion
7113 Warn for implicit conversions that may change the sign of an integer
7114 value, like assigning a signed integer expression to an unsigned
7115 integer variable. An explicit cast silences the warning. In C, this
7116 option is enabled also by @option{-Wconversion}.
7117
7118 @item -Wfloat-conversion
7119 @opindex Wfloat-conversion
7120 @opindex Wno-float-conversion
7121 Warn for implicit conversions that reduce the precision of a real value.
7122 This includes conversions from real to integer, and from higher precision
7123 real to lower precision real values. This option is also enabled by
7124 @option{-Wconversion}.
7125
7126 @item -Wno-scalar-storage-order
7127 @opindex Wno-scalar-storage-order
7128 @opindex Wscalar-storage-order
7129 Do not warn on suspicious constructs involving reverse scalar storage order.
7130
7131 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7132 @opindex Wsized-deallocation
7133 @opindex Wno-sized-deallocation
7134 Warn about a definition of an unsized deallocation function
7135 @smallexample
7136 void operator delete (void *) noexcept;
7137 void operator delete[] (void *) noexcept;
7138 @end smallexample
7139 without a definition of the corresponding sized deallocation function
7140 @smallexample
7141 void operator delete (void *, std::size_t) noexcept;
7142 void operator delete[] (void *, std::size_t) noexcept;
7143 @end smallexample
7144 or vice versa. Enabled by @option{-Wextra} along with
7145 @option{-fsized-deallocation}.
7146
7147 @item -Wsizeof-pointer-div
7148 @opindex Wsizeof-pointer-div
7149 @opindex Wno-sizeof-pointer-div
7150 Warn for suspicious divisions of two sizeof expressions that divide
7151 the pointer size by the element size, which is the usual way to compute
7152 the array size but won't work out correctly with pointers. This warning
7153 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7154 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7155
7156 @item -Wsizeof-pointer-memaccess
7157 @opindex Wsizeof-pointer-memaccess
7158 @opindex Wno-sizeof-pointer-memaccess
7159 Warn for suspicious length parameters to certain string and memory built-in
7160 functions if the argument uses @code{sizeof}. This warning triggers for
7161 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7162 an array, but a pointer, and suggests a possible fix, or about
7163 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7164 also warns about calls to bounded string copy functions like @code{strncat}
7165 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7166 the source array. For example, in the following function the call to
7167 @code{strncat} specifies the size of the source string as the bound. That
7168 is almost certainly a mistake and so the call is diagnosed.
7169 @smallexample
7170 void make_file (const char *name)
7171 @{
7172 char path[PATH_MAX];
7173 strncpy (path, name, sizeof path - 1);
7174 strncat (path, ".text", sizeof ".text");
7175 @dots{}
7176 @}
7177 @end smallexample
7178
7179 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7180
7181 @item -Wsizeof-array-argument
7182 @opindex Wsizeof-array-argument
7183 @opindex Wno-sizeof-array-argument
7184 Warn when the @code{sizeof} operator is applied to a parameter that is
7185 declared as an array in a function definition. This warning is enabled by
7186 default for C and C++ programs.
7187
7188 @item -Wmemset-elt-size
7189 @opindex Wmemset-elt-size
7190 @opindex Wno-memset-elt-size
7191 Warn for suspicious calls to the @code{memset} built-in function, if the
7192 first argument references an array, and the third argument is a number
7193 equal to the number of elements, but not equal to the size of the array
7194 in memory. This indicates that the user has omitted a multiplication by
7195 the element size. This warning is enabled by @option{-Wall}.
7196
7197 @item -Wmemset-transposed-args
7198 @opindex Wmemset-transposed-args
7199 @opindex Wno-memset-transposed-args
7200 Warn for suspicious calls to the @code{memset} built-in function where
7201 the second argument is not zero and the third argument is zero. For
7202 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7203 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7204 is only emitted if the third argument is a literal zero. Otherwise, if
7205 it is an expression that is folded to zero, or a cast of zero to some
7206 type, it is far less likely that the arguments have been mistakenly
7207 transposed and no warning is emitted. This warning is enabled
7208 by @option{-Wall}.
7209
7210 @item -Waddress
7211 @opindex Waddress
7212 @opindex Wno-address
7213 Warn about suspicious uses of memory addresses. These include using
7214 the address of a function in a conditional expression, such as
7215 @code{void func(void); if (func)}, and comparisons against the memory
7216 address of a string literal, such as @code{if (x == "abc")}. Such
7217 uses typically indicate a programmer error: the address of a function
7218 always evaluates to true, so their use in a conditional usually
7219 indicate that the programmer forgot the parentheses in a function
7220 call; and comparisons against string literals result in unspecified
7221 behavior and are not portable in C, so they usually indicate that the
7222 programmer intended to use @code{strcmp}. This warning is enabled by
7223 @option{-Wall}.
7224
7225 @item -Waddress-of-packed-member
7226 @opindex Waddress-of-packed-member
7227 @opindex Wno-address-of-packed-member
7228 Warn when the address of packed member of struct or union is taken,
7229 which usually results in an unaligned pointer value. This is
7230 enabled by default.
7231
7232 @item -Wlogical-op
7233 @opindex Wlogical-op
7234 @opindex Wno-logical-op
7235 Warn about suspicious uses of logical operators in expressions.
7236 This includes using logical operators in contexts where a
7237 bit-wise operator is likely to be expected. Also warns when
7238 the operands of a logical operator are the same:
7239 @smallexample
7240 extern int a;
7241 if (a < 0 && a < 0) @{ @dots{} @}
7242 @end smallexample
7243
7244 @item -Wlogical-not-parentheses
7245 @opindex Wlogical-not-parentheses
7246 @opindex Wno-logical-not-parentheses
7247 Warn about logical not used on the left hand side operand of a comparison.
7248 This option does not warn if the right operand is considered to be a boolean
7249 expression. Its purpose is to detect suspicious code like the following:
7250 @smallexample
7251 int a;
7252 @dots{}
7253 if (!a > 1) @{ @dots{} @}
7254 @end smallexample
7255
7256 It is possible to suppress the warning by wrapping the LHS into
7257 parentheses:
7258 @smallexample
7259 if ((!a) > 1) @{ @dots{} @}
7260 @end smallexample
7261
7262 This warning is enabled by @option{-Wall}.
7263
7264 @item -Waggregate-return
7265 @opindex Waggregate-return
7266 @opindex Wno-aggregate-return
7267 Warn if any functions that return structures or unions are defined or
7268 called. (In languages where you can return an array, this also elicits
7269 a warning.)
7270
7271 @item -Wno-aggressive-loop-optimizations
7272 @opindex Wno-aggressive-loop-optimizations
7273 @opindex Waggressive-loop-optimizations
7274 Warn if in a loop with constant number of iterations the compiler detects
7275 undefined behavior in some statement during one or more of the iterations.
7276
7277 @item -Wno-attributes
7278 @opindex Wno-attributes
7279 @opindex Wattributes
7280 Do not warn if an unexpected @code{__attribute__} is used, such as
7281 unrecognized attributes, function attributes applied to variables,
7282 etc. This does not stop errors for incorrect use of supported
7283 attributes.
7284
7285 @item -Wno-builtin-declaration-mismatch
7286 @opindex Wno-builtin-declaration-mismatch
7287 @opindex Wbuiltin-declaration-mismatch
7288 Warn if a built-in function is declared with an incompatible signature
7289 or as a non-function, or when a built-in function declared with a type
7290 that does not include a prototype is called with arguments whose promoted
7291 types do not match those expected by the function. When @option{-Wextra}
7292 is specified, also warn when a built-in function that takes arguments is
7293 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7294 warning is enabled by default. To avoid the warning include the appropriate
7295 header to bring the prototypes of built-in functions into scope.
7296
7297 For example, the call to @code{memset} below is diagnosed by the warning
7298 because the function expects a value of type @code{size_t} as its argument
7299 but the type of @code{32} is @code{int}. With @option{-Wextra},
7300 the declaration of the function is diagnosed as well.
7301 @smallexample
7302 extern void* memset ();
7303 void f (void *d)
7304 @{
7305 memset (d, '\0', 32);
7306 @}
7307 @end smallexample
7308
7309 @item -Wno-builtin-macro-redefined
7310 @opindex Wno-builtin-macro-redefined
7311 @opindex Wbuiltin-macro-redefined
7312 Do not warn if certain built-in macros are redefined. This suppresses
7313 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7314 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7315
7316 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7317 @opindex Wstrict-prototypes
7318 @opindex Wno-strict-prototypes
7319 Warn if a function is declared or defined without specifying the
7320 argument types. (An old-style function definition is permitted without
7321 a warning if preceded by a declaration that specifies the argument
7322 types.)
7323
7324 @item -Wold-style-declaration @r{(C and Objective-C only)}
7325 @opindex Wold-style-declaration
7326 @opindex Wno-old-style-declaration
7327 Warn for obsolescent usages, according to the C Standard, in a
7328 declaration. For example, warn if storage-class specifiers like
7329 @code{static} are not the first things in a declaration. This warning
7330 is also enabled by @option{-Wextra}.
7331
7332 @item -Wold-style-definition @r{(C and Objective-C only)}
7333 @opindex Wold-style-definition
7334 @opindex Wno-old-style-definition
7335 Warn if an old-style function definition is used. A warning is given
7336 even if there is a previous prototype.
7337
7338 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7339 @opindex Wmissing-parameter-type
7340 @opindex Wno-missing-parameter-type
7341 A function parameter is declared without a type specifier in K&R-style
7342 functions:
7343
7344 @smallexample
7345 void foo(bar) @{ @}
7346 @end smallexample
7347
7348 This warning is also enabled by @option{-Wextra}.
7349
7350 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7351 @opindex Wmissing-prototypes
7352 @opindex Wno-missing-prototypes
7353 Warn if a global function is defined without a previous prototype
7354 declaration. This warning is issued even if the definition itself
7355 provides a prototype. Use this option to detect global functions
7356 that do not have a matching prototype declaration in a header file.
7357 This option is not valid for C++ because all function declarations
7358 provide prototypes and a non-matching declaration declares an
7359 overload rather than conflict with an earlier declaration.
7360 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7361
7362 @item -Wmissing-declarations
7363 @opindex Wmissing-declarations
7364 @opindex Wno-missing-declarations
7365 Warn if a global function is defined without a previous declaration.
7366 Do so even if the definition itself provides a prototype.
7367 Use this option to detect global functions that are not declared in
7368 header files. In C, no warnings are issued for functions with previous
7369 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7370 missing prototypes. In C++, no warnings are issued for function templates,
7371 or for inline functions, or for functions in anonymous namespaces.
7372
7373 @item -Wmissing-field-initializers
7374 @opindex Wmissing-field-initializers
7375 @opindex Wno-missing-field-initializers
7376 @opindex W
7377 @opindex Wextra
7378 @opindex Wno-extra
7379 Warn if a structure's initializer has some fields missing. For
7380 example, the following code causes such a warning, because
7381 @code{x.h} is implicitly zero:
7382
7383 @smallexample
7384 struct s @{ int f, g, h; @};
7385 struct s x = @{ 3, 4 @};
7386 @end smallexample
7387
7388 This option does not warn about designated initializers, so the following
7389 modification does not trigger a warning:
7390
7391 @smallexample
7392 struct s @{ int f, g, h; @};
7393 struct s x = @{ .f = 3, .g = 4 @};
7394 @end smallexample
7395
7396 In C this option does not warn about the universal zero initializer
7397 @samp{@{ 0 @}}:
7398
7399 @smallexample
7400 struct s @{ int f, g, h; @};
7401 struct s x = @{ 0 @};
7402 @end smallexample
7403
7404 Likewise, in C++ this option does not warn about the empty @{ @}
7405 initializer, for example:
7406
7407 @smallexample
7408 struct s @{ int f, g, h; @};
7409 s x = @{ @};
7410 @end smallexample
7411
7412 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7413 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7414
7415 @item -Wno-multichar
7416 @opindex Wno-multichar
7417 @opindex Wmultichar
7418 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7419 Usually they indicate a typo in the user's code, as they have
7420 implementation-defined values, and should not be used in portable code.
7421
7422 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7423 @opindex Wnormalized=
7424 @opindex Wnormalized
7425 @opindex Wno-normalized
7426 @cindex NFC
7427 @cindex NFKC
7428 @cindex character set, input normalization
7429 In ISO C and ISO C++, two identifiers are different if they are
7430 different sequences of characters. However, sometimes when characters
7431 outside the basic ASCII character set are used, you can have two
7432 different character sequences that look the same. To avoid confusion,
7433 the ISO 10646 standard sets out some @dfn{normalization rules} which
7434 when applied ensure that two sequences that look the same are turned into
7435 the same sequence. GCC can warn you if you are using identifiers that
7436 have not been normalized; this option controls that warning.
7437
7438 There are four levels of warning supported by GCC@. The default is
7439 @option{-Wnormalized=nfc}, which warns about any identifier that is
7440 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7441 recommended form for most uses. It is equivalent to
7442 @option{-Wnormalized}.
7443
7444 Unfortunately, there are some characters allowed in identifiers by
7445 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7446 identifiers. That is, there's no way to use these symbols in portable
7447 ISO C or C++ and have all your identifiers in NFC@.
7448 @option{-Wnormalized=id} suppresses the warning for these characters.
7449 It is hoped that future versions of the standards involved will correct
7450 this, which is why this option is not the default.
7451
7452 You can switch the warning off for all characters by writing
7453 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7454 only do this if you are using some other normalization scheme (like
7455 ``D''), because otherwise you can easily create bugs that are
7456 literally impossible to see.
7457
7458 Some characters in ISO 10646 have distinct meanings but look identical
7459 in some fonts or display methodologies, especially once formatting has
7460 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7461 LETTER N'', displays just like a regular @code{n} that has been
7462 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7463 normalization scheme to convert all these into a standard form as
7464 well, and GCC warns if your code is not in NFKC if you use
7465 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7466 about every identifier that contains the letter O because it might be
7467 confused with the digit 0, and so is not the default, but may be
7468 useful as a local coding convention if the programming environment
7469 cannot be fixed to display these characters distinctly.
7470
7471 @item -Wno-attribute-warning
7472 @opindex Wno-attribute-warning
7473 @opindex Wattribute-warning
7474 Do not warn about usage of functions (@pxref{Function Attributes})
7475 declared with @code{warning} attribute. By default, this warning is
7476 enabled. @option{-Wno-attribute-warning} can be used to disable the
7477 warning or @option{-Wno-error=attribute-warning} can be used to
7478 disable the error when compiled with @option{-Werror} flag.
7479
7480 @item -Wno-deprecated
7481 @opindex Wno-deprecated
7482 @opindex Wdeprecated
7483 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7484
7485 @item -Wno-deprecated-declarations
7486 @opindex Wno-deprecated-declarations
7487 @opindex Wdeprecated-declarations
7488 Do not warn about uses of functions (@pxref{Function Attributes}),
7489 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7490 Attributes}) marked as deprecated by using the @code{deprecated}
7491 attribute.
7492
7493 @item -Wno-overflow
7494 @opindex Wno-overflow
7495 @opindex Woverflow
7496 Do not warn about compile-time overflow in constant expressions.
7497
7498 @item -Wno-odr
7499 @opindex Wno-odr
7500 @opindex Wodr
7501 Warn about One Definition Rule violations during link-time optimization.
7502 Enabled by default.
7503
7504 @item -Wopenmp-simd
7505 @opindex Wopenmp-simd
7506 @opindex Wno-openmp-simd
7507 Warn if the vectorizer cost model overrides the OpenMP
7508 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7509 option can be used to relax the cost model.
7510
7511 @item -Woverride-init @r{(C and Objective-C only)}
7512 @opindex Woverride-init
7513 @opindex Wno-override-init
7514 @opindex W
7515 @opindex Wextra
7516 @opindex Wno-extra
7517 Warn if an initialized field without side effects is overridden when
7518 using designated initializers (@pxref{Designated Inits, , Designated
7519 Initializers}).
7520
7521 This warning is included in @option{-Wextra}. To get other
7522 @option{-Wextra} warnings without this one, use @option{-Wextra
7523 -Wno-override-init}.
7524
7525 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7526 @opindex Woverride-init-side-effects
7527 @opindex Wno-override-init-side-effects
7528 Warn if an initialized field with side effects is overridden when
7529 using designated initializers (@pxref{Designated Inits, , Designated
7530 Initializers}). This warning is enabled by default.
7531
7532 @item -Wpacked
7533 @opindex Wpacked
7534 @opindex Wno-packed
7535 Warn if a structure is given the packed attribute, but the packed
7536 attribute has no effect on the layout or size of the structure.
7537 Such structures may be mis-aligned for little benefit. For
7538 instance, in this code, the variable @code{f.x} in @code{struct bar}
7539 is misaligned even though @code{struct bar} does not itself
7540 have the packed attribute:
7541
7542 @smallexample
7543 @group
7544 struct foo @{
7545 int x;
7546 char a, b, c, d;
7547 @} __attribute__((packed));
7548 struct bar @{
7549 char z;
7550 struct foo f;
7551 @};
7552 @end group
7553 @end smallexample
7554
7555 @item -Wpacked-bitfield-compat
7556 @opindex Wpacked-bitfield-compat
7557 @opindex Wno-packed-bitfield-compat
7558 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7559 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7560 the change can lead to differences in the structure layout. GCC
7561 informs you when the offset of such a field has changed in GCC 4.4.
7562 For example there is no longer a 4-bit padding between field @code{a}
7563 and @code{b} in this structure:
7564
7565 @smallexample
7566 struct foo
7567 @{
7568 char a:4;
7569 char b:8;
7570 @} __attribute__ ((packed));
7571 @end smallexample
7572
7573 This warning is enabled by default. Use
7574 @option{-Wno-packed-bitfield-compat} to disable this warning.
7575
7576 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7577 @opindex Wpacked-not-aligned
7578 @opindex Wno-packed-not-aligned
7579 Warn if a structure field with explicitly specified alignment in a
7580 packed struct or union is misaligned. For example, a warning will
7581 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7582 'struct S' is less than 8}, in this code:
7583
7584 @smallexample
7585 @group
7586 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7587 struct __attribute__ ((packed)) S @{
7588 struct S8 s8;
7589 @};
7590 @end group
7591 @end smallexample
7592
7593 This warning is enabled by @option{-Wall}.
7594
7595 @item -Wpadded
7596 @opindex Wpadded
7597 @opindex Wno-padded
7598 Warn if padding is included in a structure, either to align an element
7599 of the structure or to align the whole structure. Sometimes when this
7600 happens it is possible to rearrange the fields of the structure to
7601 reduce the padding and so make the structure smaller.
7602
7603 @item -Wredundant-decls
7604 @opindex Wredundant-decls
7605 @opindex Wno-redundant-decls
7606 Warn if anything is declared more than once in the same scope, even in
7607 cases where multiple declaration is valid and changes nothing.
7608
7609 @item -Wno-restrict
7610 @opindex Wrestrict
7611 @opindex Wno-restrict
7612 Warn when an object referenced by a @code{restrict}-qualified parameter
7613 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7614 argument, or when copies between such objects overlap. For example,
7615 the call to the @code{strcpy} function below attempts to truncate the string
7616 by replacing its initial characters with the last four. However, because
7617 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7618 the call is diagnosed.
7619
7620 @smallexample
7621 void foo (void)
7622 @{
7623 char a[] = "abcd1234";
7624 strcpy (a, a + 4);
7625 @dots{}
7626 @}
7627 @end smallexample
7628 The @option{-Wrestrict} option detects some instances of simple overlap
7629 even without optimization but works best at @option{-O2} and above. It
7630 is included in @option{-Wall}.
7631
7632 @item -Wnested-externs @r{(C and Objective-C only)}
7633 @opindex Wnested-externs
7634 @opindex Wno-nested-externs
7635 Warn if an @code{extern} declaration is encountered within a function.
7636
7637 @item -Wno-inherited-variadic-ctor
7638 @opindex Winherited-variadic-ctor
7639 @opindex Wno-inherited-variadic-ctor
7640 Suppress warnings about use of C++11 inheriting constructors when the
7641 base class inherited from has a C variadic constructor; the warning is
7642 on by default because the ellipsis is not inherited.
7643
7644 @item -Winline
7645 @opindex Winline
7646 @opindex Wno-inline
7647 Warn if a function that is declared as inline cannot be inlined.
7648 Even with this option, the compiler does not warn about failures to
7649 inline functions declared in system headers.
7650
7651 The compiler uses a variety of heuristics to determine whether or not
7652 to inline a function. For example, the compiler takes into account
7653 the size of the function being inlined and the amount of inlining
7654 that has already been done in the current function. Therefore,
7655 seemingly insignificant changes in the source program can cause the
7656 warnings produced by @option{-Winline} to appear or disappear.
7657
7658 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7659 @opindex Wno-invalid-offsetof
7660 @opindex Winvalid-offsetof
7661 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7662 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7663 to a non-standard-layout type is undefined. In existing C++ implementations,
7664 however, @code{offsetof} typically gives meaningful results.
7665 This flag is for users who are aware that they are
7666 writing nonportable code and who have deliberately chosen to ignore the
7667 warning about it.
7668
7669 The restrictions on @code{offsetof} may be relaxed in a future version
7670 of the C++ standard.
7671
7672 @item -Wint-in-bool-context
7673 @opindex Wint-in-bool-context
7674 @opindex Wno-int-in-bool-context
7675 Warn for suspicious use of integer values where boolean values are expected,
7676 such as conditional expressions (?:) using non-boolean integer constants in
7677 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7678 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7679 for all kinds of multiplications regardless of the data type.
7680 This warning is enabled by @option{-Wall}.
7681
7682 @item -Wno-int-to-pointer-cast
7683 @opindex Wno-int-to-pointer-cast
7684 @opindex Wint-to-pointer-cast
7685 Suppress warnings from casts to pointer type of an integer of a
7686 different size. In C++, casting to a pointer type of smaller size is
7687 an error. @option{Wint-to-pointer-cast} is enabled by default.
7688
7689
7690 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7691 @opindex Wno-pointer-to-int-cast
7692 @opindex Wpointer-to-int-cast
7693 Suppress warnings from casts from a pointer to an integer type of a
7694 different size.
7695
7696 @item -Winvalid-pch
7697 @opindex Winvalid-pch
7698 @opindex Wno-invalid-pch
7699 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7700 the search path but cannot be used.
7701
7702 @item -Wlong-long
7703 @opindex Wlong-long
7704 @opindex Wno-long-long
7705 Warn if @code{long long} type is used. This is enabled by either
7706 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7707 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7708
7709 @item -Wvariadic-macros
7710 @opindex Wvariadic-macros
7711 @opindex Wno-variadic-macros
7712 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7713 alternate syntax is used in ISO C99 mode. This is enabled by either
7714 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7715 messages, use @option{-Wno-variadic-macros}.
7716
7717 @item -Wvarargs
7718 @opindex Wvarargs
7719 @opindex Wno-varargs
7720 Warn upon questionable usage of the macros used to handle variable
7721 arguments like @code{va_start}. This is default. To inhibit the
7722 warning messages, use @option{-Wno-varargs}.
7723
7724 @item -Wvector-operation-performance
7725 @opindex Wvector-operation-performance
7726 @opindex Wno-vector-operation-performance
7727 Warn if vector operation is not implemented via SIMD capabilities of the
7728 architecture. Mainly useful for the performance tuning.
7729 Vector operation can be implemented @code{piecewise}, which means that the
7730 scalar operation is performed on every vector element;
7731 @code{in parallel}, which means that the vector operation is implemented
7732 using scalars of wider type, which normally is more performance efficient;
7733 and @code{as a single scalar}, which means that vector fits into a
7734 scalar type.
7735
7736 @item -Wno-virtual-move-assign
7737 @opindex Wvirtual-move-assign
7738 @opindex Wno-virtual-move-assign
7739 Suppress warnings about inheriting from a virtual base with a
7740 non-trivial C++11 move assignment operator. This is dangerous because
7741 if the virtual base is reachable along more than one path, it is
7742 moved multiple times, which can mean both objects end up in the
7743 moved-from state. If the move assignment operator is written to avoid
7744 moving from a moved-from object, this warning can be disabled.
7745
7746 @item -Wvla
7747 @opindex Wvla
7748 @opindex Wno-vla
7749 Warn if a variable-length array is used in the code.
7750 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7751 the variable-length array.
7752
7753 @item -Wvla-larger-than=@var{byte-size}
7754 @opindex Wvla-larger-than=
7755 @opindex Wno-vla-larger-than
7756 If this option is used, the compiler will warn for declarations of
7757 variable-length arrays whose size is either unbounded, or bounded
7758 by an argument that allows the array size to exceed @var{byte-size}
7759 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7760 works, but with variable-length arrays.
7761
7762 Note that GCC may optimize small variable-length arrays of a known
7763 value into plain arrays, so this warning may not get triggered for
7764 such arrays.
7765
7766 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7767 is typically only effective when @option{-ftree-vrp} is active (default
7768 for @option{-O2} and above).
7769
7770 See also @option{-Walloca-larger-than=@var{byte-size}}.
7771
7772 @item -Wno-vla-larger-than
7773 @opindex Wno-vla-larger-than
7774 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7775 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7776
7777 @item -Wvolatile-register-var
7778 @opindex Wvolatile-register-var
7779 @opindex Wno-volatile-register-var
7780 Warn if a register variable is declared volatile. The volatile
7781 modifier does not inhibit all optimizations that may eliminate reads
7782 and/or writes to register variables. This warning is enabled by
7783 @option{-Wall}.
7784
7785 @item -Wdisabled-optimization
7786 @opindex Wdisabled-optimization
7787 @opindex Wno-disabled-optimization
7788 Warn if a requested optimization pass is disabled. This warning does
7789 not generally indicate that there is anything wrong with your code; it
7790 merely indicates that GCC's optimizers are unable to handle the code
7791 effectively. Often, the problem is that your code is too big or too
7792 complex; GCC refuses to optimize programs when the optimization
7793 itself is likely to take inordinate amounts of time.
7794
7795 @item -Wpointer-sign @r{(C and Objective-C only)}
7796 @opindex Wpointer-sign
7797 @opindex Wno-pointer-sign
7798 Warn for pointer argument passing or assignment with different signedness.
7799 This option is only supported for C and Objective-C@. It is implied by
7800 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7801 @option{-Wno-pointer-sign}.
7802
7803 @item -Wstack-protector
7804 @opindex Wstack-protector
7805 @opindex Wno-stack-protector
7806 This option is only active when @option{-fstack-protector} is active. It
7807 warns about functions that are not protected against stack smashing.
7808
7809 @item -Woverlength-strings
7810 @opindex Woverlength-strings
7811 @opindex Wno-overlength-strings
7812 Warn about string constants that are longer than the ``minimum
7813 maximum'' length specified in the C standard. Modern compilers
7814 generally allow string constants that are much longer than the
7815 standard's minimum limit, but very portable programs should avoid
7816 using longer strings.
7817
7818 The limit applies @emph{after} string constant concatenation, and does
7819 not count the trailing NUL@. In C90, the limit was 509 characters; in
7820 C99, it was raised to 4095. C++98 does not specify a normative
7821 minimum maximum, so we do not diagnose overlength strings in C++@.
7822
7823 This option is implied by @option{-Wpedantic}, and can be disabled with
7824 @option{-Wno-overlength-strings}.
7825
7826 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7827 @opindex Wunsuffixed-float-constants
7828 @opindex Wno-unsuffixed-float-constants
7829
7830 Issue a warning for any floating constant that does not have
7831 a suffix. When used together with @option{-Wsystem-headers} it
7832 warns about such constants in system header files. This can be useful
7833 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7834 from the decimal floating-point extension to C99.
7835
7836 @item -Wno-designated-init @r{(C and Objective-C only)}
7837 Suppress warnings when a positional initializer is used to initialize
7838 a structure that has been marked with the @code{designated_init}
7839 attribute.
7840
7841 @item -Whsa
7842 Issue a warning when HSAIL cannot be emitted for the compiled function or
7843 OpenMP construct.
7844
7845 @end table
7846
7847 @node Debugging Options
7848 @section Options for Debugging Your Program
7849 @cindex options, debugging
7850 @cindex debugging information options
7851
7852 To tell GCC to emit extra information for use by a debugger, in almost
7853 all cases you need only to add @option{-g} to your other options.
7854
7855 GCC allows you to use @option{-g} with
7856 @option{-O}. The shortcuts taken by optimized code may occasionally
7857 be surprising: some variables you declared may not exist
7858 at all; flow of control may briefly move where you did not expect it;
7859 some statements may not be executed because they compute constant
7860 results or their values are already at hand; some statements may
7861 execute in different places because they have been moved out of loops.
7862 Nevertheless it is possible to debug optimized output. This makes
7863 it reasonable to use the optimizer for programs that might have bugs.
7864
7865 If you are not using some other optimization option, consider
7866 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7867 With no @option{-O} option at all, some compiler passes that collect
7868 information useful for debugging do not run at all, so that
7869 @option{-Og} may result in a better debugging experience.
7870
7871 @table @gcctabopt
7872 @item -g
7873 @opindex g
7874 Produce debugging information in the operating system's native format
7875 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7876 information.
7877
7878 On most systems that use stabs format, @option{-g} enables use of extra
7879 debugging information that only GDB can use; this extra information
7880 makes debugging work better in GDB but probably makes other debuggers
7881 crash or
7882 refuse to read the program. If you want to control for certain whether
7883 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7884 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7885
7886 @item -ggdb
7887 @opindex ggdb
7888 Produce debugging information for use by GDB@. This means to use the
7889 most expressive format available (DWARF, stabs, or the native format
7890 if neither of those are supported), including GDB extensions if at all
7891 possible.
7892
7893 @item -gdwarf
7894 @itemx -gdwarf-@var{version}
7895 @opindex gdwarf
7896 Produce debugging information in DWARF format (if that is supported).
7897 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7898 for most targets is 4. DWARF Version 5 is only experimental.
7899
7900 Note that with DWARF Version 2, some ports require and always
7901 use some non-conflicting DWARF 3 extensions in the unwind tables.
7902
7903 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7904 for maximum benefit.
7905
7906 GCC no longer supports DWARF Version 1, which is substantially
7907 different than Version 2 and later. For historical reasons, some
7908 other DWARF-related options such as
7909 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7910 in their names, but apply to all currently-supported versions of DWARF.
7911
7912 @item -gstabs
7913 @opindex gstabs
7914 Produce debugging information in stabs format (if that is supported),
7915 without GDB extensions. This is the format used by DBX on most BSD
7916 systems. On MIPS, Alpha and System V Release 4 systems this option
7917 produces stabs debugging output that is not understood by DBX@.
7918 On System V Release 4 systems this option requires the GNU assembler.
7919
7920 @item -gstabs+
7921 @opindex gstabs+
7922 Produce debugging information in stabs format (if that is supported),
7923 using GNU extensions understood only by the GNU debugger (GDB)@. The
7924 use of these extensions is likely to make other debuggers crash or
7925 refuse to read the program.
7926
7927 @item -gxcoff
7928 @opindex gxcoff
7929 Produce debugging information in XCOFF format (if that is supported).
7930 This is the format used by the DBX debugger on IBM RS/6000 systems.
7931
7932 @item -gxcoff+
7933 @opindex gxcoff+
7934 Produce debugging information in XCOFF format (if that is supported),
7935 using GNU extensions understood only by the GNU debugger (GDB)@. The
7936 use of these extensions is likely to make other debuggers crash or
7937 refuse to read the program, and may cause assemblers other than the GNU
7938 assembler (GAS) to fail with an error.
7939
7940 @item -gvms
7941 @opindex gvms
7942 Produce debugging information in Alpha/VMS debug format (if that is
7943 supported). This is the format used by DEBUG on Alpha/VMS systems.
7944
7945 @item -g@var{level}
7946 @itemx -ggdb@var{level}
7947 @itemx -gstabs@var{level}
7948 @itemx -gxcoff@var{level}
7949 @itemx -gvms@var{level}
7950 Request debugging information and also use @var{level} to specify how
7951 much information. The default level is 2.
7952
7953 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7954 @option{-g}.
7955
7956 Level 1 produces minimal information, enough for making backtraces in
7957 parts of the program that you don't plan to debug. This includes
7958 descriptions of functions and external variables, and line number
7959 tables, but no information about local variables.
7960
7961 Level 3 includes extra information, such as all the macro definitions
7962 present in the program. Some debuggers support macro expansion when
7963 you use @option{-g3}.
7964
7965 If you use multiple @option{-g} options, with or without level numbers,
7966 the last such option is the one that is effective.
7967
7968 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7969 confusion with @option{-gdwarf-@var{level}}.
7970 Instead use an additional @option{-g@var{level}} option to change the
7971 debug level for DWARF.
7972
7973 @item -fno-eliminate-unused-debug-symbols
7974 @opindex feliminate-unused-debug-symbols
7975 @opindex fno-eliminate-unused-debug-symbols
7976 By default, no debug information is produced for symbols that are not actually
7977 used. Use this option if you want debug information for all symbols.
7978
7979 @item -femit-class-debug-always
7980 @opindex femit-class-debug-always
7981 Instead of emitting debugging information for a C++ class in only one
7982 object file, emit it in all object files using the class. This option
7983 should be used only with debuggers that are unable to handle the way GCC
7984 normally emits debugging information for classes because using this
7985 option increases the size of debugging information by as much as a
7986 factor of two.
7987
7988 @item -fno-merge-debug-strings
7989 @opindex fmerge-debug-strings
7990 @opindex fno-merge-debug-strings
7991 Direct the linker to not merge together strings in the debugging
7992 information that are identical in different object files. Merging is
7993 not supported by all assemblers or linkers. Merging decreases the size
7994 of the debug information in the output file at the cost of increasing
7995 link processing time. Merging is enabled by default.
7996
7997 @item -fdebug-prefix-map=@var{old}=@var{new}
7998 @opindex fdebug-prefix-map
7999 When compiling files residing in directory @file{@var{old}}, record
8000 debugging information describing them as if the files resided in
8001 directory @file{@var{new}} instead. This can be used to replace a
8002 build-time path with an install-time path in the debug info. It can
8003 also be used to change an absolute path to a relative path by using
8004 @file{.} for @var{new}. This can give more reproducible builds, which
8005 are location independent, but may require an extra command to tell GDB
8006 where to find the source files. See also @option{-ffile-prefix-map}.
8007
8008 @item -fvar-tracking
8009 @opindex fvar-tracking
8010 Run variable tracking pass. It computes where variables are stored at each
8011 position in code. Better debugging information is then generated
8012 (if the debugging information format supports this information).
8013
8014 It is enabled by default when compiling with optimization (@option{-Os},
8015 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8016 the debug info format supports it.
8017
8018 @item -fvar-tracking-assignments
8019 @opindex fvar-tracking-assignments
8020 @opindex fno-var-tracking-assignments
8021 Annotate assignments to user variables early in the compilation and
8022 attempt to carry the annotations over throughout the compilation all the
8023 way to the end, in an attempt to improve debug information while
8024 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
8025
8026 It can be enabled even if var-tracking is disabled, in which case
8027 annotations are created and maintained, but discarded at the end.
8028 By default, this flag is enabled together with @option{-fvar-tracking},
8029 except when selective scheduling is enabled.
8030
8031 @item -gsplit-dwarf
8032 @opindex gsplit-dwarf
8033 Separate as much DWARF debugging information as possible into a
8034 separate output file with the extension @file{.dwo}. This option allows
8035 the build system to avoid linking files with debug information. To
8036 be useful, this option requires a debugger capable of reading @file{.dwo}
8037 files.
8038
8039 @item -gdescribe-dies
8040 @opindex gdescribe-dies
8041 Add description attributes to some DWARF DIEs that have no name attribute,
8042 such as artificial variables, external references and call site
8043 parameter DIEs.
8044
8045 @item -gpubnames
8046 @opindex gpubnames
8047 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8048
8049 @item -ggnu-pubnames
8050 @opindex ggnu-pubnames
8051 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8052 suitable for conversion into a GDB@ index. This option is only useful
8053 with a linker that can produce GDB@ index version 7.
8054
8055 @item -fdebug-types-section
8056 @opindex fdebug-types-section
8057 @opindex fno-debug-types-section
8058 When using DWARF Version 4 or higher, type DIEs can be put into
8059 their own @code{.debug_types} section instead of making them part of the
8060 @code{.debug_info} section. It is more efficient to put them in a separate
8061 comdat section since the linker can then remove duplicates.
8062 But not all DWARF consumers support @code{.debug_types} sections yet
8063 and on some objects @code{.debug_types} produces larger instead of smaller
8064 debugging information.
8065
8066 @item -grecord-gcc-switches
8067 @itemx -gno-record-gcc-switches
8068 @opindex grecord-gcc-switches
8069 @opindex gno-record-gcc-switches
8070 This switch causes the command-line options used to invoke the
8071 compiler that may affect code generation to be appended to the
8072 DW_AT_producer attribute in DWARF debugging information. The options
8073 are concatenated with spaces separating them from each other and from
8074 the compiler version.
8075 It is enabled by default.
8076 See also @option{-frecord-gcc-switches} for another
8077 way of storing compiler options into the object file.
8078
8079 @item -gstrict-dwarf
8080 @opindex gstrict-dwarf
8081 Disallow using extensions of later DWARF standard version than selected
8082 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8083 DWARF extensions from later standard versions is allowed.
8084
8085 @item -gno-strict-dwarf
8086 @opindex gno-strict-dwarf
8087 Allow using extensions of later DWARF standard version than selected with
8088 @option{-gdwarf-@var{version}}.
8089
8090 @item -gas-loc-support
8091 @opindex gas-loc-support
8092 Inform the compiler that the assembler supports @code{.loc} directives.
8093 It may then use them for the assembler to generate DWARF2+ line number
8094 tables.
8095
8096 This is generally desirable, because assembler-generated line-number
8097 tables are a lot more compact than those the compiler can generate
8098 itself.
8099
8100 This option will be enabled by default if, at GCC configure time, the
8101 assembler was found to support such directives.
8102
8103 @item -gno-as-loc-support
8104 @opindex gno-as-loc-support
8105 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8106 line number tables are to be generated.
8107
8108 @item -gas-locview-support
8109 @opindex gas-locview-support
8110 Inform the compiler that the assembler supports @code{view} assignment
8111 and reset assertion checking in @code{.loc} directives.
8112
8113 This option will be enabled by default if, at GCC configure time, the
8114 assembler was found to support them.
8115
8116 @item -gno-as-locview-support
8117 Force GCC to assign view numbers internally, if
8118 @option{-gvariable-location-views} are explicitly requested.
8119
8120 @item -gcolumn-info
8121 @itemx -gno-column-info
8122 @opindex gcolumn-info
8123 @opindex gno-column-info
8124 Emit location column information into DWARF debugging information, rather
8125 than just file and line.
8126 This option is enabled by default.
8127
8128 @item -gstatement-frontiers
8129 @itemx -gno-statement-frontiers
8130 @opindex gstatement-frontiers
8131 @opindex gno-statement-frontiers
8132 This option causes GCC to create markers in the internal representation
8133 at the beginning of statements, and to keep them roughly in place
8134 throughout compilation, using them to guide the output of @code{is_stmt}
8135 markers in the line number table. This is enabled by default when
8136 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8137 @dots{}), and outputting DWARF 2 debug information at the normal level.
8138
8139 @item -gvariable-location-views
8140 @itemx -gvariable-location-views=incompat5
8141 @itemx -gno-variable-location-views
8142 @opindex gvariable-location-views
8143 @opindex gvariable-location-views=incompat5
8144 @opindex gno-variable-location-views
8145 Augment variable location lists with progressive view numbers implied
8146 from the line number table. This enables debug information consumers to
8147 inspect state at certain points of the program, even if no instructions
8148 associated with the corresponding source locations are present at that
8149 point. If the assembler lacks support for view numbers in line number
8150 tables, this will cause the compiler to emit the line number table,
8151 which generally makes them somewhat less compact. The augmented line
8152 number tables and location lists are fully backward-compatible, so they
8153 can be consumed by debug information consumers that are not aware of
8154 these augmentations, but they won't derive any benefit from them either.
8155
8156 This is enabled by default when outputting DWARF 2 debug information at
8157 the normal level, as long as there is assembler support,
8158 @option{-fvar-tracking-assignments} is enabled and
8159 @option{-gstrict-dwarf} is not. When assembler support is not
8160 available, this may still be enabled, but it will force GCC to output
8161 internal line number tables, and if
8162 @option{-ginternal-reset-location-views} is not enabled, that will most
8163 certainly lead to silently mismatching location views.
8164
8165 There is a proposed representation for view numbers that is not backward
8166 compatible with the location list format introduced in DWARF 5, that can
8167 be enabled with @option{-gvariable-location-views=incompat5}. This
8168 option may be removed in the future, is only provided as a reference
8169 implementation of the proposed representation. Debug information
8170 consumers are not expected to support this extended format, and they
8171 would be rendered unable to decode location lists using it.
8172
8173 @item -ginternal-reset-location-views
8174 @itemx -gnointernal-reset-location-views
8175 @opindex ginternal-reset-location-views
8176 @opindex gno-internal-reset-location-views
8177 Attempt to determine location views that can be omitted from location
8178 view lists. This requires the compiler to have very accurate insn
8179 length estimates, which isn't always the case, and it may cause
8180 incorrect view lists to be generated silently when using an assembler
8181 that does not support location view lists. The GNU assembler will flag
8182 any such error as a @code{view number mismatch}. This is only enabled
8183 on ports that define a reliable estimation function.
8184
8185 @item -ginline-points
8186 @itemx -gno-inline-points
8187 @opindex ginline-points
8188 @opindex gno-inline-points
8189 Generate extended debug information for inlined functions. Location
8190 view tracking markers are inserted at inlined entry points, so that
8191 address and view numbers can be computed and output in debug
8192 information. This can be enabled independently of location views, in
8193 which case the view numbers won't be output, but it can only be enabled
8194 along with statement frontiers, and it is only enabled by default if
8195 location views are enabled.
8196
8197 @item -gz@r{[}=@var{type}@r{]}
8198 @opindex gz
8199 Produce compressed debug sections in DWARF format, if that is supported.
8200 If @var{type} is not given, the default type depends on the capabilities
8201 of the assembler and linker used. @var{type} may be one of
8202 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8203 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8204 compression in traditional GNU format). If the linker doesn't support
8205 writing compressed debug sections, the option is rejected. Otherwise,
8206 if the assembler does not support them, @option{-gz} is silently ignored
8207 when producing object files.
8208
8209 @item -femit-struct-debug-baseonly
8210 @opindex femit-struct-debug-baseonly
8211 Emit debug information for struct-like types
8212 only when the base name of the compilation source file
8213 matches the base name of file in which the struct is defined.
8214
8215 This option substantially reduces the size of debugging information,
8216 but at significant potential loss in type information to the debugger.
8217 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8218 See @option{-femit-struct-debug-detailed} for more detailed control.
8219
8220 This option works only with DWARF debug output.
8221
8222 @item -femit-struct-debug-reduced
8223 @opindex femit-struct-debug-reduced
8224 Emit debug information for struct-like types
8225 only when the base name of the compilation source file
8226 matches the base name of file in which the type is defined,
8227 unless the struct is a template or defined in a system header.
8228
8229 This option significantly reduces the size of debugging information,
8230 with some potential loss in type information to the debugger.
8231 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8232 See @option{-femit-struct-debug-detailed} for more detailed control.
8233
8234 This option works only with DWARF debug output.
8235
8236 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8237 @opindex femit-struct-debug-detailed
8238 Specify the struct-like types
8239 for which the compiler generates debug information.
8240 The intent is to reduce duplicate struct debug information
8241 between different object files within the same program.
8242
8243 This option is a detailed version of
8244 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8245 which serves for most needs.
8246
8247 A specification has the syntax@*
8248 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8249
8250 The optional first word limits the specification to
8251 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8252 A struct type is used directly when it is the type of a variable, member.
8253 Indirect uses arise through pointers to structs.
8254 That is, when use of an incomplete struct is valid, the use is indirect.
8255 An example is
8256 @samp{struct one direct; struct two * indirect;}.
8257
8258 The optional second word limits the specification to
8259 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8260 Generic structs are a bit complicated to explain.
8261 For C++, these are non-explicit specializations of template classes,
8262 or non-template classes within the above.
8263 Other programming languages have generics,
8264 but @option{-femit-struct-debug-detailed} does not yet implement them.
8265
8266 The third word specifies the source files for those
8267 structs for which the compiler should emit debug information.
8268 The values @samp{none} and @samp{any} have the normal meaning.
8269 The value @samp{base} means that
8270 the base of name of the file in which the type declaration appears
8271 must match the base of the name of the main compilation file.
8272 In practice, this means that when compiling @file{foo.c}, debug information
8273 is generated for types declared in that file and @file{foo.h},
8274 but not other header files.
8275 The value @samp{sys} means those types satisfying @samp{base}
8276 or declared in system or compiler headers.
8277
8278 You may need to experiment to determine the best settings for your application.
8279
8280 The default is @option{-femit-struct-debug-detailed=all}.
8281
8282 This option works only with DWARF debug output.
8283
8284 @item -fno-dwarf2-cfi-asm
8285 @opindex fdwarf2-cfi-asm
8286 @opindex fno-dwarf2-cfi-asm
8287 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8288 instead of using GAS @code{.cfi_*} directives.
8289
8290 @item -fno-eliminate-unused-debug-types
8291 @opindex feliminate-unused-debug-types
8292 @opindex fno-eliminate-unused-debug-types
8293 Normally, when producing DWARF output, GCC avoids producing debug symbol
8294 output for types that are nowhere used in the source file being compiled.
8295 Sometimes it is useful to have GCC emit debugging
8296 information for all types declared in a compilation
8297 unit, regardless of whether or not they are actually used
8298 in that compilation unit, for example
8299 if, in the debugger, you want to cast a value to a type that is
8300 not actually used in your program (but is declared). More often,
8301 however, this results in a significant amount of wasted space.
8302 @end table
8303
8304 @node Optimize Options
8305 @section Options That Control Optimization
8306 @cindex optimize options
8307 @cindex options, optimization
8308
8309 These options control various sorts of optimizations.
8310
8311 Without any optimization option, the compiler's goal is to reduce the
8312 cost of compilation and to make debugging produce the expected
8313 results. Statements are independent: if you stop the program with a
8314 breakpoint between statements, you can then assign a new value to any
8315 variable or change the program counter to any other statement in the
8316 function and get exactly the results you expect from the source
8317 code.
8318
8319 Turning on optimization flags makes the compiler attempt to improve
8320 the performance and/or code size at the expense of compilation time
8321 and possibly the ability to debug the program.
8322
8323 The compiler performs optimization based on the knowledge it has of the
8324 program. Compiling multiple files at once to a single output file mode allows
8325 the compiler to use information gained from all of the files when compiling
8326 each of them.
8327
8328 Not all optimizations are controlled directly by a flag. Only
8329 optimizations that have a flag are listed in this section.
8330
8331 Most optimizations are completely disabled at @option{-O0} or if an
8332 @option{-O} level is not set on the command line, even if individual
8333 optimization flags are specified. Similarly, @option{-Og} suppresses
8334 many optimization passes.
8335
8336 Depending on the target and how GCC was configured, a slightly different
8337 set of optimizations may be enabled at each @option{-O} level than
8338 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8339 to find out the exact set of optimizations that are enabled at each level.
8340 @xref{Overall Options}, for examples.
8341
8342 @table @gcctabopt
8343 @item -O
8344 @itemx -O1
8345 @opindex O
8346 @opindex O1
8347 Optimize. Optimizing compilation takes somewhat more time, and a lot
8348 more memory for a large function.
8349
8350 With @option{-O}, the compiler tries to reduce code size and execution
8351 time, without performing any optimizations that take a great deal of
8352 compilation time.
8353
8354 @c Note that in addition to the default_options_table list in opts.c,
8355 @c several optimization flags default to true but control optimization
8356 @c passes that are explicitly disabled at -O0.
8357
8358 @option{-O} turns on the following optimization flags:
8359
8360 @c Please keep the following list alphabetized.
8361 @gccoptlist{-fauto-inc-dec @gol
8362 -fbranch-count-reg @gol
8363 -fcombine-stack-adjustments @gol
8364 -fcompare-elim @gol
8365 -fcprop-registers @gol
8366 -fdce @gol
8367 -fdefer-pop @gol
8368 -fdelayed-branch @gol
8369 -fdse @gol
8370 -fforward-propagate @gol
8371 -fguess-branch-probability @gol
8372 -fif-conversion @gol
8373 -fif-conversion2 @gol
8374 -finline-functions-called-once @gol
8375 -fipa-profile @gol
8376 -fipa-pure-const @gol
8377 -fipa-reference @gol
8378 -fipa-reference-addressable @gol
8379 -fmerge-constants @gol
8380 -fmove-loop-invariants @gol
8381 -fomit-frame-pointer @gol
8382 -freorder-blocks @gol
8383 -fshrink-wrap @gol
8384 -fshrink-wrap-separate @gol
8385 -fsplit-wide-types @gol
8386 -fssa-backprop @gol
8387 -fssa-phiopt @gol
8388 -ftree-bit-ccp @gol
8389 -ftree-ccp @gol
8390 -ftree-ch @gol
8391 -ftree-coalesce-vars @gol
8392 -ftree-copy-prop @gol
8393 -ftree-dce @gol
8394 -ftree-dominator-opts @gol
8395 -ftree-dse @gol
8396 -ftree-forwprop @gol
8397 -ftree-fre @gol
8398 -ftree-phiprop @gol
8399 -ftree-pta @gol
8400 -ftree-scev-cprop @gol
8401 -ftree-sink @gol
8402 -ftree-slsr @gol
8403 -ftree-sra @gol
8404 -ftree-ter @gol
8405 -funit-at-a-time}
8406
8407 @item -O2
8408 @opindex O2
8409 Optimize even more. GCC performs nearly all supported optimizations
8410 that do not involve a space-speed tradeoff.
8411 As compared to @option{-O}, this option increases both compilation time
8412 and the performance of the generated code.
8413
8414 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8415 also turns on the following optimization flags:
8416
8417 @c Please keep the following list alphabetized!
8418 @gccoptlist{-falign-functions -falign-jumps @gol
8419 -falign-labels -falign-loops @gol
8420 -fcaller-saves @gol
8421 -fcode-hoisting @gol
8422 -fcrossjumping @gol
8423 -fcse-follow-jumps -fcse-skip-blocks @gol
8424 -fdelete-null-pointer-checks @gol
8425 -fdevirtualize -fdevirtualize-speculatively @gol
8426 -fexpensive-optimizations @gol
8427 -ffinite-loops @gol
8428 -fgcse -fgcse-lm @gol
8429 -fhoist-adjacent-loads @gol
8430 -finline-functions @gol
8431 -finline-small-functions @gol
8432 -findirect-inlining @gol
8433 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8434 -fipa-ra -fipa-sra -fipa-vrp @gol
8435 -fisolate-erroneous-paths-dereference @gol
8436 -flra-remat @gol
8437 -foptimize-sibling-calls @gol
8438 -foptimize-strlen @gol
8439 -fpartial-inlining @gol
8440 -fpeephole2 @gol
8441 -freorder-blocks-algorithm=stc @gol
8442 -freorder-blocks-and-partition -freorder-functions @gol
8443 -frerun-cse-after-loop @gol
8444 -fschedule-insns -fschedule-insns2 @gol
8445 -fsched-interblock -fsched-spec @gol
8446 -fstore-merging @gol
8447 -fstrict-aliasing @gol
8448 -fthread-jumps @gol
8449 -ftree-builtin-call-dce @gol
8450 -ftree-pre @gol
8451 -ftree-switch-conversion -ftree-tail-merge @gol
8452 -ftree-vrp}
8453
8454 Please note the warning under @option{-fgcse} about
8455 invoking @option{-O2} on programs that use computed gotos.
8456
8457 @item -O3
8458 @opindex O3
8459 Optimize yet more. @option{-O3} turns on all optimizations specified
8460 by @option{-O2} and also turns on the following optimization flags:
8461
8462 @c Please keep the following list alphabetized!
8463 @gccoptlist{-fgcse-after-reload @gol
8464 -fipa-cp-clone
8465 -floop-interchange @gol
8466 -floop-unroll-and-jam @gol
8467 -fpeel-loops @gol
8468 -fpredictive-commoning @gol
8469 -fsplit-paths @gol
8470 -ftree-loop-distribute-patterns @gol
8471 -ftree-loop-distribution @gol
8472 -ftree-loop-vectorize @gol
8473 -ftree-partial-pre @gol
8474 -ftree-slp-vectorize @gol
8475 -funswitch-loops @gol
8476 -fvect-cost-model @gol
8477 -fversion-loops-for-strides}
8478
8479 @item -O0
8480 @opindex O0
8481 Reduce compilation time and make debugging produce the expected
8482 results. This is the default.
8483
8484 @item -Os
8485 @opindex Os
8486 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8487 except those that often increase code size:
8488
8489 @gccoptlist{-falign-functions -falign-jumps @gol
8490 -falign-labels -falign-loops @gol
8491 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8492
8493 It also enables @option{-finline-functions}, causes the compiler to tune for
8494 code size rather than execution speed, and performs further optimizations
8495 designed to reduce code size.
8496
8497 @item -Ofast
8498 @opindex Ofast
8499 Disregard strict standards compliance. @option{-Ofast} enables all
8500 @option{-O3} optimizations. It also enables optimizations that are not
8501 valid for all standard-compliant programs.
8502 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
8503 and the Fortran-specific @option{-fstack-arrays}, unless
8504 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
8505
8506 @item -Og
8507 @opindex Og
8508 Optimize debugging experience. @option{-Og} should be the optimization
8509 level of choice for the standard edit-compile-debug cycle, offering
8510 a reasonable level of optimization while maintaining fast compilation
8511 and a good debugging experience. It is a better choice than @option{-O0}
8512 for producing debuggable code because some compiler passes
8513 that collect debug information are disabled at @option{-O0}.
8514
8515 Like @option{-O0}, @option{-Og} completely disables a number of
8516 optimization passes so that individual options controlling them have
8517 no effect. Otherwise @option{-Og} enables all @option{-O1}
8518 optimization flags except for those that may interfere with debugging:
8519
8520 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8521 -fdse -fif-conversion -fif-conversion2 @gol
8522 -finline-functions-called-once @gol
8523 -fmove-loop-invariants -fssa-phiopt @gol
8524 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8525
8526 @end table
8527
8528 If you use multiple @option{-O} options, with or without level numbers,
8529 the last such option is the one that is effective.
8530
8531 Options of the form @option{-f@var{flag}} specify machine-independent
8532 flags. Most flags have both positive and negative forms; the negative
8533 form of @option{-ffoo} is @option{-fno-foo}. In the table
8534 below, only one of the forms is listed---the one you typically
8535 use. You can figure out the other form by either removing @samp{no-}
8536 or adding it.
8537
8538 The following options control specific optimizations. They are either
8539 activated by @option{-O} options or are related to ones that are. You
8540 can use the following flags in the rare cases when ``fine-tuning'' of
8541 optimizations to be performed is desired.
8542
8543 @table @gcctabopt
8544 @item -fno-defer-pop
8545 @opindex fno-defer-pop
8546 @opindex fdefer-pop
8547 For machines that must pop arguments after a function call, always pop
8548 the arguments as soon as each function returns.
8549 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8550 this allows the compiler to let arguments accumulate on the stack for several
8551 function calls and pop them all at once.
8552
8553 @item -fforward-propagate
8554 @opindex fforward-propagate
8555 Perform a forward propagation pass on RTL@. The pass tries to combine two
8556 instructions and checks if the result can be simplified. If loop unrolling
8557 is active, two passes are performed and the second is scheduled after
8558 loop unrolling.
8559
8560 This option is enabled by default at optimization levels @option{-O},
8561 @option{-O2}, @option{-O3}, @option{-Os}.
8562
8563 @item -ffp-contract=@var{style}
8564 @opindex ffp-contract
8565 @option{-ffp-contract=off} disables floating-point expression contraction.
8566 @option{-ffp-contract=fast} enables floating-point expression contraction
8567 such as forming of fused multiply-add operations if the target has
8568 native support for them.
8569 @option{-ffp-contract=on} enables floating-point expression contraction
8570 if allowed by the language standard. This is currently not implemented
8571 and treated equal to @option{-ffp-contract=off}.
8572
8573 The default is @option{-ffp-contract=fast}.
8574
8575 @item -fomit-frame-pointer
8576 @opindex fomit-frame-pointer
8577 Omit the frame pointer in functions that don't need one. This avoids the
8578 instructions to save, set up and restore the frame pointer; on many targets
8579 it also makes an extra register available.
8580
8581 On some targets this flag has no effect because the standard calling sequence
8582 always uses a frame pointer, so it cannot be omitted.
8583
8584 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8585 is used in all functions. Several targets always omit the frame pointer in
8586 leaf functions.
8587
8588 Enabled by default at @option{-O} and higher.
8589
8590 @item -foptimize-sibling-calls
8591 @opindex foptimize-sibling-calls
8592 Optimize sibling and tail recursive calls.
8593
8594 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8595
8596 @item -foptimize-strlen
8597 @opindex foptimize-strlen
8598 Optimize various standard C string functions (e.g.@: @code{strlen},
8599 @code{strchr} or @code{strcpy}) and
8600 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8601
8602 Enabled at levels @option{-O2}, @option{-O3}.
8603
8604 @item -fno-inline
8605 @opindex fno-inline
8606 @opindex finline
8607 Do not expand any functions inline apart from those marked with
8608 the @code{always_inline} attribute. This is the default when not
8609 optimizing.
8610
8611 Single functions can be exempted from inlining by marking them
8612 with the @code{noinline} attribute.
8613
8614 @item -finline-small-functions
8615 @opindex finline-small-functions
8616 Integrate functions into their callers when their body is smaller than expected
8617 function call code (so overall size of program gets smaller). The compiler
8618 heuristically decides which functions are simple enough to be worth integrating
8619 in this way. This inlining applies to all functions, even those not declared
8620 inline.
8621
8622 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8623
8624 @item -findirect-inlining
8625 @opindex findirect-inlining
8626 Inline also indirect calls that are discovered to be known at compile
8627 time thanks to previous inlining. This option has any effect only
8628 when inlining itself is turned on by the @option{-finline-functions}
8629 or @option{-finline-small-functions} options.
8630
8631 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8632
8633 @item -finline-functions
8634 @opindex finline-functions
8635 Consider all functions for inlining, even if they are not declared inline.
8636 The compiler heuristically decides which functions are worth integrating
8637 in this way.
8638
8639 If all calls to a given function are integrated, and the function is
8640 declared @code{static}, then the function is normally not output as
8641 assembler code in its own right.
8642
8643 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8644 by @option{-fprofile-use} and @option{-fauto-profile}.
8645
8646 @item -finline-functions-called-once
8647 @opindex finline-functions-called-once
8648 Consider all @code{static} functions called once for inlining into their
8649 caller even if they are not marked @code{inline}. If a call to a given
8650 function is integrated, then the function is not output as assembler code
8651 in its own right.
8652
8653 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8654 but not @option{-Og}.
8655
8656 @item -fearly-inlining
8657 @opindex fearly-inlining
8658 Inline functions marked by @code{always_inline} and functions whose body seems
8659 smaller than the function call overhead early before doing
8660 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8661 makes profiling significantly cheaper and usually inlining faster on programs
8662 having large chains of nested wrapper functions.
8663
8664 Enabled by default.
8665
8666 @item -fipa-sra
8667 @opindex fipa-sra
8668 Perform interprocedural scalar replacement of aggregates, removal of
8669 unused parameters and replacement of parameters passed by reference
8670 by parameters passed by value.
8671
8672 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8673
8674 @item -finline-limit=@var{n}
8675 @opindex finline-limit
8676 By default, GCC limits the size of functions that can be inlined. This flag
8677 allows coarse control of this limit. @var{n} is the size of functions that
8678 can be inlined in number of pseudo instructions.
8679
8680 Inlining is actually controlled by a number of parameters, which may be
8681 specified individually by using @option{--param @var{name}=@var{value}}.
8682 The @option{-finline-limit=@var{n}} option sets some of these parameters
8683 as follows:
8684
8685 @table @gcctabopt
8686 @item max-inline-insns-single
8687 is set to @var{n}/2.
8688 @item max-inline-insns-auto
8689 is set to @var{n}/2.
8690 @end table
8691
8692 See below for a documentation of the individual
8693 parameters controlling inlining and for the defaults of these parameters.
8694
8695 @emph{Note:} there may be no value to @option{-finline-limit} that results
8696 in default behavior.
8697
8698 @emph{Note:} pseudo instruction represents, in this particular context, an
8699 abstract measurement of function's size. In no way does it represent a count
8700 of assembly instructions and as such its exact meaning might change from one
8701 release to an another.
8702
8703 @item -fno-keep-inline-dllexport
8704 @opindex fno-keep-inline-dllexport
8705 @opindex fkeep-inline-dllexport
8706 This is a more fine-grained version of @option{-fkeep-inline-functions},
8707 which applies only to functions that are declared using the @code{dllexport}
8708 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8709 Functions}.
8710
8711 @item -fkeep-inline-functions
8712 @opindex fkeep-inline-functions
8713 In C, emit @code{static} functions that are declared @code{inline}
8714 into the object file, even if the function has been inlined into all
8715 of its callers. This switch does not affect functions using the
8716 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8717 inline functions into the object file.
8718
8719 @item -fkeep-static-functions
8720 @opindex fkeep-static-functions
8721 Emit @code{static} functions into the object file, even if the function
8722 is never used.
8723
8724 @item -fkeep-static-consts
8725 @opindex fkeep-static-consts
8726 Emit variables declared @code{static const} when optimization isn't turned
8727 on, even if the variables aren't referenced.
8728
8729 GCC enables this option by default. If you want to force the compiler to
8730 check if a variable is referenced, regardless of whether or not
8731 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8732
8733 @item -fmerge-constants
8734 @opindex fmerge-constants
8735 Attempt to merge identical constants (string constants and floating-point
8736 constants) across compilation units.
8737
8738 This option is the default for optimized compilation if the assembler and
8739 linker support it. Use @option{-fno-merge-constants} to inhibit this
8740 behavior.
8741
8742 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8743
8744 @item -fmerge-all-constants
8745 @opindex fmerge-all-constants
8746 Attempt to merge identical constants and identical variables.
8747
8748 This option implies @option{-fmerge-constants}. In addition to
8749 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8750 arrays or initialized constant variables with integral or floating-point
8751 types. Languages like C or C++ require each variable, including multiple
8752 instances of the same variable in recursive calls, to have distinct locations,
8753 so using this option results in non-conforming
8754 behavior.
8755
8756 @item -fmodulo-sched
8757 @opindex fmodulo-sched
8758 Perform swing modulo scheduling immediately before the first scheduling
8759 pass. This pass looks at innermost loops and reorders their
8760 instructions by overlapping different iterations.
8761
8762 @item -fmodulo-sched-allow-regmoves
8763 @opindex fmodulo-sched-allow-regmoves
8764 Perform more aggressive SMS-based modulo scheduling with register moves
8765 allowed. By setting this flag certain anti-dependences edges are
8766 deleted, which triggers the generation of reg-moves based on the
8767 life-range analysis. This option is effective only with
8768 @option{-fmodulo-sched} enabled.
8769
8770 @item -fno-branch-count-reg
8771 @opindex fno-branch-count-reg
8772 @opindex fbranch-count-reg
8773 Disable the optimization pass that scans for opportunities to use
8774 ``decrement and branch'' instructions on a count register instead of
8775 instruction sequences that decrement a register, compare it against zero, and
8776 then branch based upon the result. This option is only meaningful on
8777 architectures that support such instructions, which include x86, PowerPC,
8778 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8779 doesn't remove the decrement and branch instructions from the generated
8780 instruction stream introduced by other optimization passes.
8781
8782 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8783 except for @option{-Og}.
8784
8785 @item -fno-function-cse
8786 @opindex fno-function-cse
8787 @opindex ffunction-cse
8788 Do not put function addresses in registers; make each instruction that
8789 calls a constant function contain the function's address explicitly.
8790
8791 This option results in less efficient code, but some strange hacks
8792 that alter the assembler output may be confused by the optimizations
8793 performed when this option is not used.
8794
8795 The default is @option{-ffunction-cse}
8796
8797 @item -fno-zero-initialized-in-bss
8798 @opindex fno-zero-initialized-in-bss
8799 @opindex fzero-initialized-in-bss
8800 If the target supports a BSS section, GCC by default puts variables that
8801 are initialized to zero into BSS@. This can save space in the resulting
8802 code.
8803
8804 This option turns off this behavior because some programs explicitly
8805 rely on variables going to the data section---e.g., so that the
8806 resulting executable can find the beginning of that section and/or make
8807 assumptions based on that.
8808
8809 The default is @option{-fzero-initialized-in-bss}.
8810
8811 @item -fthread-jumps
8812 @opindex fthread-jumps
8813 Perform optimizations that check to see if a jump branches to a
8814 location where another comparison subsumed by the first is found. If
8815 so, the first branch is redirected to either the destination of the
8816 second branch or a point immediately following it, depending on whether
8817 the condition is known to be true or false.
8818
8819 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8820
8821 @item -fsplit-wide-types
8822 @opindex fsplit-wide-types
8823 When using a type that occupies multiple registers, such as @code{long
8824 long} on a 32-bit system, split the registers apart and allocate them
8825 independently. This normally generates better code for those types,
8826 but may make debugging more difficult.
8827
8828 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8829 @option{-Os}.
8830
8831 @item -fsplit-wide-types-early
8832 @opindex fsplit-wide-types-early
8833 Fully split wide types early, instead of very late.
8834 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8835
8836 This is the default on some targets.
8837
8838 @item -fcse-follow-jumps
8839 @opindex fcse-follow-jumps
8840 In common subexpression elimination (CSE), scan through jump instructions
8841 when the target of the jump is not reached by any other path. For
8842 example, when CSE encounters an @code{if} statement with an
8843 @code{else} clause, CSE follows the jump when the condition
8844 tested is false.
8845
8846 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8847
8848 @item -fcse-skip-blocks
8849 @opindex fcse-skip-blocks
8850 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8851 follow jumps that conditionally skip over blocks. When CSE
8852 encounters a simple @code{if} statement with no else clause,
8853 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8854 body of the @code{if}.
8855
8856 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8857
8858 @item -frerun-cse-after-loop
8859 @opindex frerun-cse-after-loop
8860 Re-run common subexpression elimination after loop optimizations are
8861 performed.
8862
8863 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8864
8865 @item -fgcse
8866 @opindex fgcse
8867 Perform a global common subexpression elimination pass.
8868 This pass also performs global constant and copy propagation.
8869
8870 @emph{Note:} When compiling a program using computed gotos, a GCC
8871 extension, you may get better run-time performance if you disable
8872 the global common subexpression elimination pass by adding
8873 @option{-fno-gcse} to the command line.
8874
8875 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8876
8877 @item -fgcse-lm
8878 @opindex fgcse-lm
8879 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8880 attempts to move loads that are only killed by stores into themselves. This
8881 allows a loop containing a load/store sequence to be changed to a load outside
8882 the loop, and a copy/store within the loop.
8883
8884 Enabled by default when @option{-fgcse} is enabled.
8885
8886 @item -fgcse-sm
8887 @opindex fgcse-sm
8888 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8889 global common subexpression elimination. This pass attempts to move
8890 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8891 loops containing a load/store sequence can be changed to a load before
8892 the loop and a store after the loop.
8893
8894 Not enabled at any optimization level.
8895
8896 @item -fgcse-las
8897 @opindex fgcse-las
8898 When @option{-fgcse-las} is enabled, the global common subexpression
8899 elimination pass eliminates redundant loads that come after stores to the
8900 same memory location (both partial and full redundancies).
8901
8902 Not enabled at any optimization level.
8903
8904 @item -fgcse-after-reload
8905 @opindex fgcse-after-reload
8906 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8907 pass is performed after reload. The purpose of this pass is to clean up
8908 redundant spilling.
8909
8910 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8911
8912 @item -faggressive-loop-optimizations
8913 @opindex faggressive-loop-optimizations
8914 This option tells the loop optimizer to use language constraints to
8915 derive bounds for the number of iterations of a loop. This assumes that
8916 loop code does not invoke undefined behavior by for example causing signed
8917 integer overflows or out-of-bound array accesses. The bounds for the
8918 number of iterations of a loop are used to guide loop unrolling and peeling
8919 and loop exit test optimizations.
8920 This option is enabled by default.
8921
8922 @item -funconstrained-commons
8923 @opindex funconstrained-commons
8924 This option tells the compiler that variables declared in common blocks
8925 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8926 prevents certain optimizations that depend on knowing the array bounds.
8927
8928 @item -fcrossjumping
8929 @opindex fcrossjumping
8930 Perform cross-jumping transformation.
8931 This transformation unifies equivalent code and saves code size. The
8932 resulting code may or may not perform better than without cross-jumping.
8933
8934 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8935
8936 @item -fauto-inc-dec
8937 @opindex fauto-inc-dec
8938 Combine increments or decrements of addresses with memory accesses.
8939 This pass is always skipped on architectures that do not have
8940 instructions to support this. Enabled by default at @option{-O} and
8941 higher on architectures that support this.
8942
8943 @item -fdce
8944 @opindex fdce
8945 Perform dead code elimination (DCE) on RTL@.
8946 Enabled by default at @option{-O} and higher.
8947
8948 @item -fdse
8949 @opindex fdse
8950 Perform dead store elimination (DSE) on RTL@.
8951 Enabled by default at @option{-O} and higher.
8952
8953 @item -fif-conversion
8954 @opindex fif-conversion
8955 Attempt to transform conditional jumps into branch-less equivalents. This
8956 includes use of conditional moves, min, max, set flags and abs instructions, and
8957 some tricks doable by standard arithmetics. The use of conditional execution
8958 on chips where it is available is controlled by @option{-fif-conversion2}.
8959
8960 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8961 not with @option{-Og}.
8962
8963 @item -fif-conversion2
8964 @opindex fif-conversion2
8965 Use conditional execution (where available) to transform conditional jumps into
8966 branch-less equivalents.
8967
8968 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8969 not with @option{-Og}.
8970
8971 @item -fdeclone-ctor-dtor
8972 @opindex fdeclone-ctor-dtor
8973 The C++ ABI requires multiple entry points for constructors and
8974 destructors: one for a base subobject, one for a complete object, and
8975 one for a virtual destructor that calls operator delete afterwards.
8976 For a hierarchy with virtual bases, the base and complete variants are
8977 clones, which means two copies of the function. With this option, the
8978 base and complete variants are changed to be thunks that call a common
8979 implementation.
8980
8981 Enabled by @option{-Os}.
8982
8983 @item -fdelete-null-pointer-checks
8984 @opindex fdelete-null-pointer-checks
8985 Assume that programs cannot safely dereference null pointers, and that
8986 no code or data element resides at address zero.
8987 This option enables simple constant
8988 folding optimizations at all optimization levels. In addition, other
8989 optimization passes in GCC use this flag to control global dataflow
8990 analyses that eliminate useless checks for null pointers; these assume
8991 that a memory access to address zero always results in a trap, so
8992 that if a pointer is checked after it has already been dereferenced,
8993 it cannot be null.
8994
8995 Note however that in some environments this assumption is not true.
8996 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8997 for programs that depend on that behavior.
8998
8999 This option is enabled by default on most targets. On Nios II ELF, it
9000 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
9001
9002 Passes that use the dataflow information
9003 are enabled independently at different optimization levels.
9004
9005 @item -fdevirtualize
9006 @opindex fdevirtualize
9007 Attempt to convert calls to virtual functions to direct calls. This
9008 is done both within a procedure and interprocedurally as part of
9009 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9010 propagation (@option{-fipa-cp}).
9011 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9012
9013 @item -fdevirtualize-speculatively
9014 @opindex fdevirtualize-speculatively
9015 Attempt to convert calls to virtual functions to speculative direct calls.
9016 Based on the analysis of the type inheritance graph, determine for a given call
9017 the set of likely targets. If the set is small, preferably of size 1, change
9018 the call into a conditional deciding between direct and indirect calls. The
9019 speculative calls enable more optimizations, such as inlining. When they seem
9020 useless after further optimization, they are converted back into original form.
9021
9022 @item -fdevirtualize-at-ltrans
9023 @opindex fdevirtualize-at-ltrans
9024 Stream extra information needed for aggressive devirtualization when running
9025 the link-time optimizer in local transformation mode.
9026 This option enables more devirtualization but
9027 significantly increases the size of streamed data. For this reason it is
9028 disabled by default.
9029
9030 @item -fexpensive-optimizations
9031 @opindex fexpensive-optimizations
9032 Perform a number of minor optimizations that are relatively expensive.
9033
9034 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9035
9036 @item -free
9037 @opindex free
9038 Attempt to remove redundant extension instructions. This is especially
9039 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9040 registers after writing to their lower 32-bit half.
9041
9042 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9043 @option{-O3}, @option{-Os}.
9044
9045 @item -fno-lifetime-dse
9046 @opindex fno-lifetime-dse
9047 @opindex flifetime-dse
9048 In C++ the value of an object is only affected by changes within its
9049 lifetime: when the constructor begins, the object has an indeterminate
9050 value, and any changes during the lifetime of the object are dead when
9051 the object is destroyed. Normally dead store elimination will take
9052 advantage of this; if your code relies on the value of the object
9053 storage persisting beyond the lifetime of the object, you can use this
9054 flag to disable this optimization. To preserve stores before the
9055 constructor starts (e.g.@: because your operator new clears the object
9056 storage) but still treat the object as dead after the destructor you,
9057 can use @option{-flifetime-dse=1}. The default behavior can be
9058 explicitly selected with @option{-flifetime-dse=2}.
9059 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9060
9061 @item -flive-range-shrinkage
9062 @opindex flive-range-shrinkage
9063 Attempt to decrease register pressure through register live range
9064 shrinkage. This is helpful for fast processors with small or moderate
9065 size register sets.
9066
9067 @item -fira-algorithm=@var{algorithm}
9068 @opindex fira-algorithm
9069 Use the specified coloring algorithm for the integrated register
9070 allocator. The @var{algorithm} argument can be @samp{priority}, which
9071 specifies Chow's priority coloring, or @samp{CB}, which specifies
9072 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9073 for all architectures, but for those targets that do support it, it is
9074 the default because it generates better code.
9075
9076 @item -fira-region=@var{region}
9077 @opindex fira-region
9078 Use specified regions for the integrated register allocator. The
9079 @var{region} argument should be one of the following:
9080
9081 @table @samp
9082
9083 @item all
9084 Use all loops as register allocation regions.
9085 This can give the best results for machines with a small and/or
9086 irregular register set.
9087
9088 @item mixed
9089 Use all loops except for loops with small register pressure
9090 as the regions. This value usually gives
9091 the best results in most cases and for most architectures,
9092 and is enabled by default when compiling with optimization for speed
9093 (@option{-O}, @option{-O2}, @dots{}).
9094
9095 @item one
9096 Use all functions as a single region.
9097 This typically results in the smallest code size, and is enabled by default for
9098 @option{-Os} or @option{-O0}.
9099
9100 @end table
9101
9102 @item -fira-hoist-pressure
9103 @opindex fira-hoist-pressure
9104 Use IRA to evaluate register pressure in the code hoisting pass for
9105 decisions to hoist expressions. This option usually results in smaller
9106 code, but it can slow the compiler down.
9107
9108 This option is enabled at level @option{-Os} for all targets.
9109
9110 @item -fira-loop-pressure
9111 @opindex fira-loop-pressure
9112 Use IRA to evaluate register pressure in loops for decisions to move
9113 loop invariants. This option usually results in generation
9114 of faster and smaller code on machines with large register files (>= 32
9115 registers), but it can slow the compiler down.
9116
9117 This option is enabled at level @option{-O3} for some targets.
9118
9119 @item -fno-ira-share-save-slots
9120 @opindex fno-ira-share-save-slots
9121 @opindex fira-share-save-slots
9122 Disable sharing of stack slots used for saving call-used hard
9123 registers living through a call. Each hard register gets a
9124 separate stack slot, and as a result function stack frames are
9125 larger.
9126
9127 @item -fno-ira-share-spill-slots
9128 @opindex fno-ira-share-spill-slots
9129 @opindex fira-share-spill-slots
9130 Disable sharing of stack slots allocated for pseudo-registers. Each
9131 pseudo-register that does not get a hard register gets a separate
9132 stack slot, and as a result function stack frames are larger.
9133
9134 @item -flra-remat
9135 @opindex flra-remat
9136 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9137 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9138 values if it is profitable.
9139
9140 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9141
9142 @item -fdelayed-branch
9143 @opindex fdelayed-branch
9144 If supported for the target machine, attempt to reorder instructions
9145 to exploit instruction slots available after delayed branch
9146 instructions.
9147
9148 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9149 but not at @option{-Og}.
9150
9151 @item -fschedule-insns
9152 @opindex fschedule-insns
9153 If supported for the target machine, attempt to reorder instructions to
9154 eliminate execution stalls due to required data being unavailable. This
9155 helps machines that have slow floating point or memory load instructions
9156 by allowing other instructions to be issued until the result of the load
9157 or floating-point instruction is required.
9158
9159 Enabled at levels @option{-O2}, @option{-O3}.
9160
9161 @item -fschedule-insns2
9162 @opindex fschedule-insns2
9163 Similar to @option{-fschedule-insns}, but requests an additional pass of
9164 instruction scheduling after register allocation has been done. This is
9165 especially useful on machines with a relatively small number of
9166 registers and where memory load instructions take more than one cycle.
9167
9168 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9169
9170 @item -fno-sched-interblock
9171 @opindex fno-sched-interblock
9172 @opindex fsched-interblock
9173 Disable instruction scheduling across basic blocks, which
9174 is normally enabled when scheduling before register allocation, i.e.@:
9175 with @option{-fschedule-insns} or at @option{-O2} or higher.
9176
9177 @item -fno-sched-spec
9178 @opindex fno-sched-spec
9179 @opindex fsched-spec
9180 Disable speculative motion of non-load instructions, which
9181 is normally enabled when scheduling before register allocation, i.e.@:
9182 with @option{-fschedule-insns} or at @option{-O2} or higher.
9183
9184 @item -fsched-pressure
9185 @opindex fsched-pressure
9186 Enable register pressure sensitive insn scheduling before register
9187 allocation. This only makes sense when scheduling before register
9188 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9189 @option{-O2} or higher. Usage of this option can improve the
9190 generated code and decrease its size by preventing register pressure
9191 increase above the number of available hard registers and subsequent
9192 spills in register allocation.
9193
9194 @item -fsched-spec-load
9195 @opindex fsched-spec-load
9196 Allow speculative motion of some load instructions. This only makes
9197 sense when scheduling before register allocation, i.e.@: with
9198 @option{-fschedule-insns} or at @option{-O2} or higher.
9199
9200 @item -fsched-spec-load-dangerous
9201 @opindex fsched-spec-load-dangerous
9202 Allow speculative motion of more load instructions. This only makes
9203 sense when scheduling before register allocation, i.e.@: with
9204 @option{-fschedule-insns} or at @option{-O2} or higher.
9205
9206 @item -fsched-stalled-insns
9207 @itemx -fsched-stalled-insns=@var{n}
9208 @opindex fsched-stalled-insns
9209 Define how many insns (if any) can be moved prematurely from the queue
9210 of stalled insns into the ready list during the second scheduling pass.
9211 @option{-fno-sched-stalled-insns} means that no insns are moved
9212 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9213 on how many queued insns can be moved prematurely.
9214 @option{-fsched-stalled-insns} without a value is equivalent to
9215 @option{-fsched-stalled-insns=1}.
9216
9217 @item -fsched-stalled-insns-dep
9218 @itemx -fsched-stalled-insns-dep=@var{n}
9219 @opindex fsched-stalled-insns-dep
9220 Define how many insn groups (cycles) are examined for a dependency
9221 on a stalled insn that is a candidate for premature removal from the queue
9222 of stalled insns. This has an effect only during the second scheduling pass,
9223 and only if @option{-fsched-stalled-insns} is used.
9224 @option{-fno-sched-stalled-insns-dep} is equivalent to
9225 @option{-fsched-stalled-insns-dep=0}.
9226 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9227 @option{-fsched-stalled-insns-dep=1}.
9228
9229 @item -fsched2-use-superblocks
9230 @opindex fsched2-use-superblocks
9231 When scheduling after register allocation, use superblock scheduling.
9232 This allows motion across basic block boundaries,
9233 resulting in faster schedules. This option is experimental, as not all machine
9234 descriptions used by GCC model the CPU closely enough to avoid unreliable
9235 results from the algorithm.
9236
9237 This only makes sense when scheduling after register allocation, i.e.@: with
9238 @option{-fschedule-insns2} or at @option{-O2} or higher.
9239
9240 @item -fsched-group-heuristic
9241 @opindex fsched-group-heuristic
9242 Enable the group heuristic in the scheduler. This heuristic favors
9243 the instruction that belongs to a schedule group. This is enabled
9244 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9245 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9246
9247 @item -fsched-critical-path-heuristic
9248 @opindex fsched-critical-path-heuristic
9249 Enable the critical-path heuristic in the scheduler. This heuristic favors
9250 instructions on the critical path. This is enabled by default when
9251 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9252 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9253
9254 @item -fsched-spec-insn-heuristic
9255 @opindex fsched-spec-insn-heuristic
9256 Enable the speculative instruction heuristic in the scheduler. This
9257 heuristic favors speculative instructions with greater dependency weakness.
9258 This is enabled by default when scheduling is enabled, i.e.@:
9259 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9260 or at @option{-O2} or higher.
9261
9262 @item -fsched-rank-heuristic
9263 @opindex fsched-rank-heuristic
9264 Enable the rank heuristic in the scheduler. This heuristic favors
9265 the instruction belonging to a basic block with greater size or frequency.
9266 This is enabled by default when scheduling is enabled, i.e.@:
9267 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9268 at @option{-O2} or higher.
9269
9270 @item -fsched-last-insn-heuristic
9271 @opindex fsched-last-insn-heuristic
9272 Enable the last-instruction heuristic in the scheduler. This heuristic
9273 favors the instruction that is less dependent on the last instruction
9274 scheduled. This is enabled by default when scheduling is enabled,
9275 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9276 at @option{-O2} or higher.
9277
9278 @item -fsched-dep-count-heuristic
9279 @opindex fsched-dep-count-heuristic
9280 Enable the dependent-count heuristic in the scheduler. This heuristic
9281 favors the instruction that has more instructions depending on it.
9282 This is enabled by default when scheduling is enabled, i.e.@:
9283 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9284 at @option{-O2} or higher.
9285
9286 @item -freschedule-modulo-scheduled-loops
9287 @opindex freschedule-modulo-scheduled-loops
9288 Modulo scheduling is performed before traditional scheduling. If a loop
9289 is modulo scheduled, later scheduling passes may change its schedule.
9290 Use this option to control that behavior.
9291
9292 @item -fselective-scheduling
9293 @opindex fselective-scheduling
9294 Schedule instructions using selective scheduling algorithm. Selective
9295 scheduling runs instead of the first scheduler pass.
9296
9297 @item -fselective-scheduling2
9298 @opindex fselective-scheduling2
9299 Schedule instructions using selective scheduling algorithm. Selective
9300 scheduling runs instead of the second scheduler pass.
9301
9302 @item -fsel-sched-pipelining
9303 @opindex fsel-sched-pipelining
9304 Enable software pipelining of innermost loops during selective scheduling.
9305 This option has no effect unless one of @option{-fselective-scheduling} or
9306 @option{-fselective-scheduling2} is turned on.
9307
9308 @item -fsel-sched-pipelining-outer-loops
9309 @opindex fsel-sched-pipelining-outer-loops
9310 When pipelining loops during selective scheduling, also pipeline outer loops.
9311 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9312
9313 @item -fsemantic-interposition
9314 @opindex fsemantic-interposition
9315 Some object formats, like ELF, allow interposing of symbols by the
9316 dynamic linker.
9317 This means that for symbols exported from the DSO, the compiler cannot perform
9318 interprocedural propagation, inlining and other optimizations in anticipation
9319 that the function or variable in question may change. While this feature is
9320 useful, for example, to rewrite memory allocation functions by a debugging
9321 implementation, it is expensive in the terms of code quality.
9322 With @option{-fno-semantic-interposition} the compiler assumes that
9323 if interposition happens for functions the overwriting function will have
9324 precisely the same semantics (and side effects).
9325 Similarly if interposition happens
9326 for variables, the constructor of the variable will be the same. The flag
9327 has no effect for functions explicitly declared inline
9328 (where it is never allowed for interposition to change semantics)
9329 and for symbols explicitly declared weak.
9330
9331 @item -fshrink-wrap
9332 @opindex fshrink-wrap
9333 Emit function prologues only before parts of the function that need it,
9334 rather than at the top of the function. This flag is enabled by default at
9335 @option{-O} and higher.
9336
9337 @item -fshrink-wrap-separate
9338 @opindex fshrink-wrap-separate
9339 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9340 those parts are only executed when needed.
9341 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9342 is also turned on and the target supports this.
9343
9344 @item -fcaller-saves
9345 @opindex fcaller-saves
9346 Enable allocation of values to registers that are clobbered by
9347 function calls, by emitting extra instructions to save and restore the
9348 registers around such calls. Such allocation is done only when it
9349 seems to result in better code.
9350
9351 This option is always enabled by default on certain machines, usually
9352 those which have no call-preserved registers to use instead.
9353
9354 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9355
9356 @item -fcombine-stack-adjustments
9357 @opindex fcombine-stack-adjustments
9358 Tracks stack adjustments (pushes and pops) and stack memory references
9359 and then tries to find ways to combine them.
9360
9361 Enabled by default at @option{-O1} and higher.
9362
9363 @item -fipa-ra
9364 @opindex fipa-ra
9365 Use caller save registers for allocation if those registers are not used by
9366 any called function. In that case it is not necessary to save and restore
9367 them around calls. This is only possible if called functions are part of
9368 same compilation unit as current function and they are compiled before it.
9369
9370 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9371 is disabled if generated code will be instrumented for profiling
9372 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9373 exactly (this happens on targets that do not expose prologues
9374 and epilogues in RTL).
9375
9376 @item -fconserve-stack
9377 @opindex fconserve-stack
9378 Attempt to minimize stack usage. The compiler attempts to use less
9379 stack space, even if that makes the program slower. This option
9380 implies setting the @option{large-stack-frame} parameter to 100
9381 and the @option{large-stack-frame-growth} parameter to 400.
9382
9383 @item -ftree-reassoc
9384 @opindex ftree-reassoc
9385 Perform reassociation on trees. This flag is enabled by default
9386 at @option{-O} and higher.
9387
9388 @item -fcode-hoisting
9389 @opindex fcode-hoisting
9390 Perform code hoisting. Code hoisting tries to move the
9391 evaluation of expressions executed on all paths to the function exit
9392 as early as possible. This is especially useful as a code size
9393 optimization, but it often helps for code speed as well.
9394 This flag is enabled by default at @option{-O2} and higher.
9395
9396 @item -ftree-pre
9397 @opindex ftree-pre
9398 Perform partial redundancy elimination (PRE) on trees. This flag is
9399 enabled by default at @option{-O2} and @option{-O3}.
9400
9401 @item -ftree-partial-pre
9402 @opindex ftree-partial-pre
9403 Make partial redundancy elimination (PRE) more aggressive. This flag is
9404 enabled by default at @option{-O3}.
9405
9406 @item -ftree-forwprop
9407 @opindex ftree-forwprop
9408 Perform forward propagation on trees. This flag is enabled by default
9409 at @option{-O} and higher.
9410
9411 @item -ftree-fre
9412 @opindex ftree-fre
9413 Perform full redundancy elimination (FRE) on trees. The difference
9414 between FRE and PRE is that FRE only considers expressions
9415 that are computed on all paths leading to the redundant computation.
9416 This analysis is faster than PRE, though it exposes fewer redundancies.
9417 This flag is enabled by default at @option{-O} and higher.
9418
9419 @item -ftree-phiprop
9420 @opindex ftree-phiprop
9421 Perform hoisting of loads from conditional pointers on trees. This
9422 pass is enabled by default at @option{-O} and higher.
9423
9424 @item -fhoist-adjacent-loads
9425 @opindex fhoist-adjacent-loads
9426 Speculatively hoist loads from both branches of an if-then-else if the
9427 loads are from adjacent locations in the same structure and the target
9428 architecture has a conditional move instruction. This flag is enabled
9429 by default at @option{-O2} and higher.
9430
9431 @item -ftree-copy-prop
9432 @opindex ftree-copy-prop
9433 Perform copy propagation on trees. This pass eliminates unnecessary
9434 copy operations. This flag is enabled by default at @option{-O} and
9435 higher.
9436
9437 @item -fipa-pure-const
9438 @opindex fipa-pure-const
9439 Discover which functions are pure or constant.
9440 Enabled by default at @option{-O} and higher.
9441
9442 @item -fipa-reference
9443 @opindex fipa-reference
9444 Discover which static variables do not escape the
9445 compilation unit.
9446 Enabled by default at @option{-O} and higher.
9447
9448 @item -fipa-reference-addressable
9449 @opindex fipa-reference-addressable
9450 Discover read-only, write-only and non-addressable static variables.
9451 Enabled by default at @option{-O} and higher.
9452
9453 @item -fipa-stack-alignment
9454 @opindex fipa-stack-alignment
9455 Reduce stack alignment on call sites if possible.
9456 Enabled by default.
9457
9458 @item -fipa-pta
9459 @opindex fipa-pta
9460 Perform interprocedural pointer analysis and interprocedural modification
9461 and reference analysis. This option can cause excessive memory and
9462 compile-time usage on large compilation units. It is not enabled by
9463 default at any optimization level.
9464
9465 @item -fipa-profile
9466 @opindex fipa-profile
9467 Perform interprocedural profile propagation. The functions called only from
9468 cold functions are marked as cold. Also functions executed once (such as
9469 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9470 functions and loop less parts of functions executed once are then optimized for
9471 size.
9472 Enabled by default at @option{-O} and higher.
9473
9474 @item -fipa-cp
9475 @opindex fipa-cp
9476 Perform interprocedural constant propagation.
9477 This optimization analyzes the program to determine when values passed
9478 to functions are constants and then optimizes accordingly.
9479 This optimization can substantially increase performance
9480 if the application has constants passed to functions.
9481 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9482 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9483
9484 @item -fipa-cp-clone
9485 @opindex fipa-cp-clone
9486 Perform function cloning to make interprocedural constant propagation stronger.
9487 When enabled, interprocedural constant propagation performs function cloning
9488 when externally visible function can be called with constant arguments.
9489 Because this optimization can create multiple copies of functions,
9490 it may significantly increase code size
9491 (see @option{--param ipcp-unit-growth=@var{value}}).
9492 This flag is enabled by default at @option{-O3}.
9493 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9494
9495 @item -fipa-bit-cp
9496 @opindex fipa-bit-cp
9497 When enabled, perform interprocedural bitwise constant
9498 propagation. This flag is enabled by default at @option{-O2} and
9499 by @option{-fprofile-use} and @option{-fauto-profile}.
9500 It requires that @option{-fipa-cp} is enabled.
9501
9502 @item -fipa-vrp
9503 @opindex fipa-vrp
9504 When enabled, perform interprocedural propagation of value
9505 ranges. This flag is enabled by default at @option{-O2}. It requires
9506 that @option{-fipa-cp} is enabled.
9507
9508 @item -fipa-icf
9509 @opindex fipa-icf
9510 Perform Identical Code Folding for functions and read-only variables.
9511 The optimization reduces code size and may disturb unwind stacks by replacing
9512 a function by equivalent one with a different name. The optimization works
9513 more effectively with link-time optimization enabled.
9514
9515 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9516 works on different levels and thus the optimizations are not same - there are
9517 equivalences that are found only by GCC and equivalences found only by Gold.
9518
9519 This flag is enabled by default at @option{-O2} and @option{-Os}.
9520
9521 @item -flive-patching=@var{level}
9522 @opindex flive-patching
9523 Control GCC's optimizations to produce output suitable for live-patching.
9524
9525 If the compiler's optimization uses a function's body or information extracted
9526 from its body to optimize/change another function, the latter is called an
9527 impacted function of the former. If a function is patched, its impacted
9528 functions should be patched too.
9529
9530 The impacted functions are determined by the compiler's interprocedural
9531 optimizations. For example, a caller is impacted when inlining a function
9532 into its caller,
9533 cloning a function and changing its caller to call this new clone,
9534 or extracting a function's pureness/constness information to optimize
9535 its direct or indirect callers, etc.
9536
9537 Usually, the more IPA optimizations enabled, the larger the number of
9538 impacted functions for each function. In order to control the number of
9539 impacted functions and more easily compute the list of impacted function,
9540 IPA optimizations can be partially enabled at two different levels.
9541
9542 The @var{level} argument should be one of the following:
9543
9544 @table @samp
9545
9546 @item inline-clone
9547
9548 Only enable inlining and cloning optimizations, which includes inlining,
9549 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9550 As a result, when patching a function, all its callers and its clones'
9551 callers are impacted, therefore need to be patched as well.
9552
9553 @option{-flive-patching=inline-clone} disables the following optimization flags:
9554 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9555 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9556 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9557 -fipa-stack-alignment}
9558
9559 @item inline-only-static
9560
9561 Only enable inlining of static functions.
9562 As a result, when patching a static function, all its callers are impacted
9563 and so need to be patched as well.
9564
9565 In addition to all the flags that @option{-flive-patching=inline-clone}
9566 disables,
9567 @option{-flive-patching=inline-only-static} disables the following additional
9568 optimization flags:
9569 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9570
9571 @end table
9572
9573 When @option{-flive-patching} is specified without any value, the default value
9574 is @var{inline-clone}.
9575
9576 This flag is disabled by default.
9577
9578 Note that @option{-flive-patching} is not supported with link-time optimization
9579 (@option{-flto}).
9580
9581 @item -fisolate-erroneous-paths-dereference
9582 @opindex fisolate-erroneous-paths-dereference
9583 Detect paths that trigger erroneous or undefined behavior due to
9584 dereferencing a null pointer. Isolate those paths from the main control
9585 flow and turn the statement with erroneous or undefined behavior into a trap.
9586 This flag is enabled by default at @option{-O2} and higher and depends on
9587 @option{-fdelete-null-pointer-checks} also being enabled.
9588
9589 @item -fisolate-erroneous-paths-attribute
9590 @opindex fisolate-erroneous-paths-attribute
9591 Detect paths that trigger erroneous or undefined behavior due to a null value
9592 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9593 attribute. Isolate those paths from the main control flow and turn the
9594 statement with erroneous or undefined behavior into a trap. This is not
9595 currently enabled, but may be enabled by @option{-O2} in the future.
9596
9597 @item -ftree-sink
9598 @opindex ftree-sink
9599 Perform forward store motion on trees. This flag is
9600 enabled by default at @option{-O} and higher.
9601
9602 @item -ftree-bit-ccp
9603 @opindex ftree-bit-ccp
9604 Perform sparse conditional bit constant propagation on trees and propagate
9605 pointer alignment information.
9606 This pass only operates on local scalar variables and is enabled by default
9607 at @option{-O1} and higher, except for @option{-Og}.
9608 It requires that @option{-ftree-ccp} is enabled.
9609
9610 @item -ftree-ccp
9611 @opindex ftree-ccp
9612 Perform sparse conditional constant propagation (CCP) on trees. This
9613 pass only operates on local scalar variables and is enabled by default
9614 at @option{-O} and higher.
9615
9616 @item -fssa-backprop
9617 @opindex fssa-backprop
9618 Propagate information about uses of a value up the definition chain
9619 in order to simplify the definitions. For example, this pass strips
9620 sign operations if the sign of a value never matters. The flag is
9621 enabled by default at @option{-O} and higher.
9622
9623 @item -fssa-phiopt
9624 @opindex fssa-phiopt
9625 Perform pattern matching on SSA PHI nodes to optimize conditional
9626 code. This pass is enabled by default at @option{-O1} and higher,
9627 except for @option{-Og}.
9628
9629 @item -ftree-switch-conversion
9630 @opindex ftree-switch-conversion
9631 Perform conversion of simple initializations in a switch to
9632 initializations from a scalar array. This flag is enabled by default
9633 at @option{-O2} and higher.
9634
9635 @item -ftree-tail-merge
9636 @opindex ftree-tail-merge
9637 Look for identical code sequences. When found, replace one with a jump to the
9638 other. This optimization is known as tail merging or cross jumping. This flag
9639 is enabled by default at @option{-O2} and higher. The compilation time
9640 in this pass can
9641 be limited using @option{max-tail-merge-comparisons} parameter and
9642 @option{max-tail-merge-iterations} parameter.
9643
9644 @item -ftree-dce
9645 @opindex ftree-dce
9646 Perform dead code elimination (DCE) on trees. This flag is enabled by
9647 default at @option{-O} and higher.
9648
9649 @item -ftree-builtin-call-dce
9650 @opindex ftree-builtin-call-dce
9651 Perform conditional dead code elimination (DCE) for calls to built-in functions
9652 that may set @code{errno} but are otherwise free of side effects. This flag is
9653 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9654 specified.
9655
9656 @item -ffinite-loops
9657 @opindex ffinite-loops
9658 @opindex fno-finite-loops
9659 Assume that a loop with an exit will eventually take the exit and not loop
9660 indefinitely. This allows the compiler to remove loops that otherwise have
9661 no side-effects, not considering eventual endless looping as such.
9662
9663 This option is enabled by default at @option{-O2}.
9664
9665 @item -ftree-dominator-opts
9666 @opindex ftree-dominator-opts
9667 Perform a variety of simple scalar cleanups (constant/copy
9668 propagation, redundancy elimination, range propagation and expression
9669 simplification) based on a dominator tree traversal. This also
9670 performs jump threading (to reduce jumps to jumps). This flag is
9671 enabled by default at @option{-O} and higher.
9672
9673 @item -ftree-dse
9674 @opindex ftree-dse
9675 Perform dead store elimination (DSE) on trees. A dead store is a store into
9676 a memory location that is later overwritten by another store without
9677 any intervening loads. In this case the earlier store can be deleted. This
9678 flag is enabled by default at @option{-O} and higher.
9679
9680 @item -ftree-ch
9681 @opindex ftree-ch
9682 Perform loop header copying on trees. This is beneficial since it increases
9683 effectiveness of code motion optimizations. It also saves one jump. This flag
9684 is enabled by default at @option{-O} and higher. It is not enabled
9685 for @option{-Os}, since it usually increases code size.
9686
9687 @item -ftree-loop-optimize
9688 @opindex ftree-loop-optimize
9689 Perform loop optimizations on trees. This flag is enabled by default
9690 at @option{-O} and higher.
9691
9692 @item -ftree-loop-linear
9693 @itemx -floop-strip-mine
9694 @itemx -floop-block
9695 @opindex ftree-loop-linear
9696 @opindex floop-strip-mine
9697 @opindex floop-block
9698 Perform loop nest optimizations. Same as
9699 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9700 to be configured with @option{--with-isl} to enable the Graphite loop
9701 transformation infrastructure.
9702
9703 @item -fgraphite-identity
9704 @opindex fgraphite-identity
9705 Enable the identity transformation for graphite. For every SCoP we generate
9706 the polyhedral representation and transform it back to gimple. Using
9707 @option{-fgraphite-identity} we can check the costs or benefits of the
9708 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9709 are also performed by the code generator isl, like index splitting and
9710 dead code elimination in loops.
9711
9712 @item -floop-nest-optimize
9713 @opindex floop-nest-optimize
9714 Enable the isl based loop nest optimizer. This is a generic loop nest
9715 optimizer based on the Pluto optimization algorithms. It calculates a loop
9716 structure optimized for data-locality and parallelism. This option
9717 is experimental.
9718
9719 @item -floop-parallelize-all
9720 @opindex floop-parallelize-all
9721 Use the Graphite data dependence analysis to identify loops that can
9722 be parallelized. Parallelize all the loops that can be analyzed to
9723 not contain loop carried dependences without checking that it is
9724 profitable to parallelize the loops.
9725
9726 @item -ftree-coalesce-vars
9727 @opindex ftree-coalesce-vars
9728 While transforming the program out of the SSA representation, attempt to
9729 reduce copying by coalescing versions of different user-defined
9730 variables, instead of just compiler temporaries. This may severely
9731 limit the ability to debug an optimized program compiled with
9732 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9733 prevents SSA coalescing of user variables. This option is enabled by
9734 default if optimization is enabled, and it does very little otherwise.
9735
9736 @item -ftree-loop-if-convert
9737 @opindex ftree-loop-if-convert
9738 Attempt to transform conditional jumps in the innermost loops to
9739 branch-less equivalents. The intent is to remove control-flow from
9740 the innermost loops in order to improve the ability of the
9741 vectorization pass to handle these loops. This is enabled by default
9742 if vectorization is enabled.
9743
9744 @item -ftree-loop-distribution
9745 @opindex ftree-loop-distribution
9746 Perform loop distribution. This flag can improve cache performance on
9747 big loop bodies and allow further loop optimizations, like
9748 parallelization or vectorization, to take place. For example, the loop
9749 @smallexample
9750 DO I = 1, N
9751 A(I) = B(I) + C
9752 D(I) = E(I) * F
9753 ENDDO
9754 @end smallexample
9755 is transformed to
9756 @smallexample
9757 DO I = 1, N
9758 A(I) = B(I) + C
9759 ENDDO
9760 DO I = 1, N
9761 D(I) = E(I) * F
9762 ENDDO
9763 @end smallexample
9764 This flag is enabled by default at @option{-O3}.
9765 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9766
9767 @item -ftree-loop-distribute-patterns
9768 @opindex ftree-loop-distribute-patterns
9769 Perform loop distribution of patterns that can be code generated with
9770 calls to a library. This flag is enabled by default at @option{-O3}, and
9771 by @option{-fprofile-use} and @option{-fauto-profile}.
9772
9773 This pass distributes the initialization loops and generates a call to
9774 memset zero. For example, the loop
9775 @smallexample
9776 DO I = 1, N
9777 A(I) = 0
9778 B(I) = A(I) + I
9779 ENDDO
9780 @end smallexample
9781 is transformed to
9782 @smallexample
9783 DO I = 1, N
9784 A(I) = 0
9785 ENDDO
9786 DO I = 1, N
9787 B(I) = A(I) + I
9788 ENDDO
9789 @end smallexample
9790 and the initialization loop is transformed into a call to memset zero.
9791 This flag is enabled by default at @option{-O3}.
9792 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9793
9794 @item -floop-interchange
9795 @opindex floop-interchange
9796 Perform loop interchange outside of graphite. This flag can improve cache
9797 performance on loop nest and allow further loop optimizations, like
9798 vectorization, to take place. For example, the loop
9799 @smallexample
9800 for (int i = 0; i < N; i++)
9801 for (int j = 0; j < N; j++)
9802 for (int k = 0; k < N; k++)
9803 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9804 @end smallexample
9805 is transformed to
9806 @smallexample
9807 for (int i = 0; i < N; i++)
9808 for (int k = 0; k < N; k++)
9809 for (int j = 0; j < N; j++)
9810 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9811 @end smallexample
9812 This flag is enabled by default at @option{-O3}.
9813 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9814
9815 @item -floop-unroll-and-jam
9816 @opindex floop-unroll-and-jam
9817 Apply unroll and jam transformations on feasible loops. In a loop
9818 nest this unrolls the outer loop by some factor and fuses the resulting
9819 multiple inner loops. This flag is enabled by default at @option{-O3}.
9820 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9821
9822 @item -ftree-loop-im
9823 @opindex ftree-loop-im
9824 Perform loop invariant motion on trees. This pass moves only invariants that
9825 are hard to handle at RTL level (function calls, operations that expand to
9826 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9827 operands of conditions that are invariant out of the loop, so that we can use
9828 just trivial invariantness analysis in loop unswitching. The pass also includes
9829 store motion.
9830
9831 @item -ftree-loop-ivcanon
9832 @opindex ftree-loop-ivcanon
9833 Create a canonical counter for number of iterations in loops for which
9834 determining number of iterations requires complicated analysis. Later
9835 optimizations then may determine the number easily. Useful especially
9836 in connection with unrolling.
9837
9838 @item -ftree-scev-cprop
9839 @opindex ftree-scev-cprop
9840 Perform final value replacement. If a variable is modified in a loop
9841 in such a way that its value when exiting the loop can be determined using
9842 only its initial value and the number of loop iterations, replace uses of
9843 the final value by such a computation, provided it is sufficiently cheap.
9844 This reduces data dependencies and may allow further simplifications.
9845 Enabled by default at @option{-O} and higher.
9846
9847 @item -fivopts
9848 @opindex fivopts
9849 Perform induction variable optimizations (strength reduction, induction
9850 variable merging and induction variable elimination) on trees.
9851
9852 @item -ftree-parallelize-loops=n
9853 @opindex ftree-parallelize-loops
9854 Parallelize loops, i.e., split their iteration space to run in n threads.
9855 This is only possible for loops whose iterations are independent
9856 and can be arbitrarily reordered. The optimization is only
9857 profitable on multiprocessor machines, for loops that are CPU-intensive,
9858 rather than constrained e.g.@: by memory bandwidth. This option
9859 implies @option{-pthread}, and thus is only supported on targets
9860 that have support for @option{-pthread}.
9861
9862 @item -ftree-pta
9863 @opindex ftree-pta
9864 Perform function-local points-to analysis on trees. This flag is
9865 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9866
9867 @item -ftree-sra
9868 @opindex ftree-sra
9869 Perform scalar replacement of aggregates. This pass replaces structure
9870 references with scalars to prevent committing structures to memory too
9871 early. This flag is enabled by default at @option{-O1} and higher,
9872 except for @option{-Og}.
9873
9874 @item -fstore-merging
9875 @opindex fstore-merging
9876 Perform merging of narrow stores to consecutive memory addresses. This pass
9877 merges contiguous stores of immediate values narrower than a word into fewer
9878 wider stores to reduce the number of instructions. This is enabled by default
9879 at @option{-O2} and higher as well as @option{-Os}.
9880
9881 @item -ftree-ter
9882 @opindex ftree-ter
9883 Perform temporary expression replacement during the SSA->normal phase. Single
9884 use/single def temporaries are replaced at their use location with their
9885 defining expression. This results in non-GIMPLE code, but gives the expanders
9886 much more complex trees to work on resulting in better RTL generation. This is
9887 enabled by default at @option{-O} and higher.
9888
9889 @item -ftree-slsr
9890 @opindex ftree-slsr
9891 Perform straight-line strength reduction on trees. This recognizes related
9892 expressions involving multiplications and replaces them by less expensive
9893 calculations when possible. This is enabled by default at @option{-O} and
9894 higher.
9895
9896 @item -ftree-vectorize
9897 @opindex ftree-vectorize
9898 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9899 and @option{-ftree-slp-vectorize} if not explicitly specified.
9900
9901 @item -ftree-loop-vectorize
9902 @opindex ftree-loop-vectorize
9903 Perform loop vectorization on trees. This flag is enabled by default at
9904 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9905 and @option{-fauto-profile}.
9906
9907 @item -ftree-slp-vectorize
9908 @opindex ftree-slp-vectorize
9909 Perform basic block vectorization on trees. This flag is enabled by default at
9910 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9911 and @option{-fauto-profile}.
9912
9913 @item -fvect-cost-model=@var{model}
9914 @opindex fvect-cost-model
9915 Alter the cost model used for vectorization. The @var{model} argument
9916 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9917 With the @samp{unlimited} model the vectorized code-path is assumed
9918 to be profitable while with the @samp{dynamic} model a runtime check
9919 guards the vectorized code-path to enable it only for iteration
9920 counts that will likely execute faster than when executing the original
9921 scalar loop. The @samp{cheap} model disables vectorization of
9922 loops where doing so would be cost prohibitive for example due to
9923 required runtime checks for data dependence or alignment but otherwise
9924 is equal to the @samp{dynamic} model.
9925 The default cost model depends on other optimization flags and is
9926 either @samp{dynamic} or @samp{cheap}.
9927
9928 @item -fsimd-cost-model=@var{model}
9929 @opindex fsimd-cost-model
9930 Alter the cost model used for vectorization of loops marked with the OpenMP
9931 simd directive. The @var{model} argument should be one of
9932 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9933 have the same meaning as described in @option{-fvect-cost-model} and by
9934 default a cost model defined with @option{-fvect-cost-model} is used.
9935
9936 @item -ftree-vrp
9937 @opindex ftree-vrp
9938 Perform Value Range Propagation on trees. This is similar to the
9939 constant propagation pass, but instead of values, ranges of values are
9940 propagated. This allows the optimizers to remove unnecessary range
9941 checks like array bound checks and null pointer checks. This is
9942 enabled by default at @option{-O2} and higher. Null pointer check
9943 elimination is only done if @option{-fdelete-null-pointer-checks} is
9944 enabled.
9945
9946 @item -fsplit-paths
9947 @opindex fsplit-paths
9948 Split paths leading to loop backedges. This can improve dead code
9949 elimination and common subexpression elimination. This is enabled by
9950 default at @option{-O3} and above.
9951
9952 @item -fsplit-ivs-in-unroller
9953 @opindex fsplit-ivs-in-unroller
9954 Enables expression of values of induction variables in later iterations
9955 of the unrolled loop using the value in the first iteration. This breaks
9956 long dependency chains, thus improving efficiency of the scheduling passes.
9957
9958 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9959 same effect. However, that is not reliable in cases where the loop body
9960 is more complicated than a single basic block. It also does not work at all
9961 on some architectures due to restrictions in the CSE pass.
9962
9963 This optimization is enabled by default.
9964
9965 @item -fvariable-expansion-in-unroller
9966 @opindex fvariable-expansion-in-unroller
9967 With this option, the compiler creates multiple copies of some
9968 local variables when unrolling a loop, which can result in superior code.
9969
9970 This optimization is enabled by default for PowerPC targets, but disabled
9971 by default otherwise.
9972
9973 @item -fpartial-inlining
9974 @opindex fpartial-inlining
9975 Inline parts of functions. This option has any effect only
9976 when inlining itself is turned on by the @option{-finline-functions}
9977 or @option{-finline-small-functions} options.
9978
9979 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9980
9981 @item -fpredictive-commoning
9982 @opindex fpredictive-commoning
9983 Perform predictive commoning optimization, i.e., reusing computations
9984 (especially memory loads and stores) performed in previous
9985 iterations of loops.
9986
9987 This option is enabled at level @option{-O3}.
9988 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9989
9990 @item -fprefetch-loop-arrays
9991 @opindex fprefetch-loop-arrays
9992 If supported by the target machine, generate instructions to prefetch
9993 memory to improve the performance of loops that access large arrays.
9994
9995 This option may generate better or worse code; results are highly
9996 dependent on the structure of loops within the source code.
9997
9998 Disabled at level @option{-Os}.
9999
10000 @item -fno-printf-return-value
10001 @opindex fno-printf-return-value
10002 @opindex fprintf-return-value
10003 Do not substitute constants for known return value of formatted output
10004 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10005 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
10006 transformation allows GCC to optimize or even eliminate branches based
10007 on the known return value of these functions called with arguments that
10008 are either constant, or whose values are known to be in a range that
10009 makes determining the exact return value possible. For example, when
10010 @option{-fprintf-return-value} is in effect, both the branch and the
10011 body of the @code{if} statement (but not the call to @code{snprint})
10012 can be optimized away when @code{i} is a 32-bit or smaller integer
10013 because the return value is guaranteed to be at most 8.
10014
10015 @smallexample
10016 char buf[9];
10017 if (snprintf (buf, "%08x", i) >= sizeof buf)
10018 @dots{}
10019 @end smallexample
10020
10021 The @option{-fprintf-return-value} option relies on other optimizations
10022 and yields best results with @option{-O2} and above. It works in tandem
10023 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10024 options. The @option{-fprintf-return-value} option is enabled by default.
10025
10026 @item -fno-peephole
10027 @itemx -fno-peephole2
10028 @opindex fno-peephole
10029 @opindex fpeephole
10030 @opindex fno-peephole2
10031 @opindex fpeephole2
10032 Disable any machine-specific peephole optimizations. The difference
10033 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10034 are implemented in the compiler; some targets use one, some use the
10035 other, a few use both.
10036
10037 @option{-fpeephole} is enabled by default.
10038 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10039
10040 @item -fno-guess-branch-probability
10041 @opindex fno-guess-branch-probability
10042 @opindex fguess-branch-probability
10043 Do not guess branch probabilities using heuristics.
10044
10045 GCC uses heuristics to guess branch probabilities if they are
10046 not provided by profiling feedback (@option{-fprofile-arcs}). These
10047 heuristics are based on the control flow graph. If some branch probabilities
10048 are specified by @code{__builtin_expect}, then the heuristics are
10049 used to guess branch probabilities for the rest of the control flow graph,
10050 taking the @code{__builtin_expect} info into account. The interactions
10051 between the heuristics and @code{__builtin_expect} can be complex, and in
10052 some cases, it may be useful to disable the heuristics so that the effects
10053 of @code{__builtin_expect} are easier to understand.
10054
10055 It is also possible to specify expected probability of the expression
10056 with @code{__builtin_expect_with_probability} built-in function.
10057
10058 The default is @option{-fguess-branch-probability} at levels
10059 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10060
10061 @item -freorder-blocks
10062 @opindex freorder-blocks
10063 Reorder basic blocks in the compiled function in order to reduce number of
10064 taken branches and improve code locality.
10065
10066 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10067
10068 @item -freorder-blocks-algorithm=@var{algorithm}
10069 @opindex freorder-blocks-algorithm
10070 Use the specified algorithm for basic block reordering. The
10071 @var{algorithm} argument can be @samp{simple}, which does not increase
10072 code size (except sometimes due to secondary effects like alignment),
10073 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10074 put all often executed code together, minimizing the number of branches
10075 executed by making extra copies of code.
10076
10077 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10078 @samp{stc} at levels @option{-O2}, @option{-O3}.
10079
10080 @item -freorder-blocks-and-partition
10081 @opindex freorder-blocks-and-partition
10082 In addition to reordering basic blocks in the compiled function, in order
10083 to reduce number of taken branches, partitions hot and cold basic blocks
10084 into separate sections of the assembly and @file{.o} files, to improve
10085 paging and cache locality performance.
10086
10087 This optimization is automatically turned off in the presence of
10088 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10089 section attribute and on any architecture that does not support named
10090 sections. When @option{-fsplit-stack} is used this option is not
10091 enabled by default (to avoid linker errors), but may be enabled
10092 explicitly (if using a working linker).
10093
10094 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10095
10096 @item -freorder-functions
10097 @opindex freorder-functions
10098 Reorder functions in the object file in order to
10099 improve code locality. This is implemented by using special
10100 subsections @code{.text.hot} for most frequently executed functions and
10101 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10102 the linker so object file format must support named sections and linker must
10103 place them in a reasonable way.
10104
10105 This option isn't effective unless you either provide profile feedback
10106 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10107 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10108
10109 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10110
10111 @item -fstrict-aliasing
10112 @opindex fstrict-aliasing
10113 Allow the compiler to assume the strictest aliasing rules applicable to
10114 the language being compiled. For C (and C++), this activates
10115 optimizations based on the type of expressions. In particular, an
10116 object of one type is assumed never to reside at the same address as an
10117 object of a different type, unless the types are almost the same. For
10118 example, an @code{unsigned int} can alias an @code{int}, but not a
10119 @code{void*} or a @code{double}. A character type may alias any other
10120 type.
10121
10122 @anchor{Type-punning}Pay special attention to code like this:
10123 @smallexample
10124 union a_union @{
10125 int i;
10126 double d;
10127 @};
10128
10129 int f() @{
10130 union a_union t;
10131 t.d = 3.0;
10132 return t.i;
10133 @}
10134 @end smallexample
10135 The practice of reading from a different union member than the one most
10136 recently written to (called ``type-punning'') is common. Even with
10137 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10138 is accessed through the union type. So, the code above works as
10139 expected. @xref{Structures unions enumerations and bit-fields
10140 implementation}. However, this code might not:
10141 @smallexample
10142 int f() @{
10143 union a_union t;
10144 int* ip;
10145 t.d = 3.0;
10146 ip = &t.i;
10147 return *ip;
10148 @}
10149 @end smallexample
10150
10151 Similarly, access by taking the address, casting the resulting pointer
10152 and dereferencing the result has undefined behavior, even if the cast
10153 uses a union type, e.g.:
10154 @smallexample
10155 int f() @{
10156 double d = 3.0;
10157 return ((union a_union *) &d)->i;
10158 @}
10159 @end smallexample
10160
10161 The @option{-fstrict-aliasing} option is enabled at levels
10162 @option{-O2}, @option{-O3}, @option{-Os}.
10163
10164 @item -falign-functions
10165 @itemx -falign-functions=@var{n}
10166 @itemx -falign-functions=@var{n}:@var{m}
10167 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10168 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10169 @opindex falign-functions
10170 Align the start of functions to the next power-of-two greater than
10171 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10172 the first @var{m} bytes of the function can be fetched by the CPU
10173 without crossing an @var{n}-byte alignment boundary.
10174
10175 If @var{m} is not specified, it defaults to @var{n}.
10176
10177 Examples: @option{-falign-functions=32} aligns functions to the next
10178 32-byte boundary, @option{-falign-functions=24} aligns to the next
10179 32-byte boundary only if this can be done by skipping 23 bytes or less,
10180 @option{-falign-functions=32:7} aligns to the next
10181 32-byte boundary only if this can be done by skipping 6 bytes or less.
10182
10183 The second pair of @var{n2}:@var{m2} values allows you to specify
10184 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10185 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10186 otherwise aligns to the next 32-byte boundary if this can be done
10187 by skipping 2 bytes or less.
10188 If @var{m2} is not specified, it defaults to @var{n2}.
10189
10190 Some assemblers only support this flag when @var{n} is a power of two;
10191 in that case, it is rounded up.
10192
10193 @option{-fno-align-functions} and @option{-falign-functions=1} are
10194 equivalent and mean that functions are not aligned.
10195
10196 If @var{n} is not specified or is zero, use a machine-dependent default.
10197 The maximum allowed @var{n} option value is 65536.
10198
10199 Enabled at levels @option{-O2}, @option{-O3}.
10200
10201 @item -flimit-function-alignment
10202 If this option is enabled, the compiler tries to avoid unnecessarily
10203 overaligning functions. It attempts to instruct the assembler to align
10204 by the amount specified by @option{-falign-functions}, but not to
10205 skip more bytes than the size of the function.
10206
10207 @item -falign-labels
10208 @itemx -falign-labels=@var{n}
10209 @itemx -falign-labels=@var{n}:@var{m}
10210 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10211 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10212 @opindex falign-labels
10213 Align all branch targets to a power-of-two boundary.
10214
10215 Parameters of this option are analogous to the @option{-falign-functions} option.
10216 @option{-fno-align-labels} and @option{-falign-labels=1} are
10217 equivalent and mean that labels are not aligned.
10218
10219 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10220 are greater than this value, then their values are used instead.
10221
10222 If @var{n} is not specified or is zero, use a machine-dependent default
10223 which is very likely to be @samp{1}, meaning no alignment.
10224 The maximum allowed @var{n} option value is 65536.
10225
10226 Enabled at levels @option{-O2}, @option{-O3}.
10227
10228 @item -falign-loops
10229 @itemx -falign-loops=@var{n}
10230 @itemx -falign-loops=@var{n}:@var{m}
10231 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10232 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10233 @opindex falign-loops
10234 Align loops to a power-of-two boundary. If the loops are executed
10235 many times, this makes up for any execution of the dummy padding
10236 instructions.
10237
10238 Parameters of this option are analogous to the @option{-falign-functions} option.
10239 @option{-fno-align-loops} and @option{-falign-loops=1} are
10240 equivalent and mean that loops are not aligned.
10241 The maximum allowed @var{n} option value is 65536.
10242
10243 If @var{n} is not specified or is zero, use a machine-dependent default.
10244
10245 Enabled at levels @option{-O2}, @option{-O3}.
10246
10247 @item -falign-jumps
10248 @itemx -falign-jumps=@var{n}
10249 @itemx -falign-jumps=@var{n}:@var{m}
10250 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10251 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10252 @opindex falign-jumps
10253 Align branch targets to a power-of-two boundary, for branch targets
10254 where the targets can only be reached by jumping. In this case,
10255 no dummy operations need be executed.
10256
10257 Parameters of this option are analogous to the @option{-falign-functions} option.
10258 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10259 equivalent and mean that loops are not aligned.
10260
10261 If @var{n} is not specified or is zero, use a machine-dependent default.
10262 The maximum allowed @var{n} option value is 65536.
10263
10264 Enabled at levels @option{-O2}, @option{-O3}.
10265
10266 @item -fallow-store-data-races
10267 @opindex fallow-store-data-races
10268 Allow the compiler to introduce new data races on stores.
10269
10270 Enabled at level @option{-Ofast}.
10271
10272 @item -funit-at-a-time
10273 @opindex funit-at-a-time
10274 This option is left for compatibility reasons. @option{-funit-at-a-time}
10275 has no effect, while @option{-fno-unit-at-a-time} implies
10276 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10277
10278 Enabled by default.
10279
10280 @item -fno-toplevel-reorder
10281 @opindex fno-toplevel-reorder
10282 @opindex ftoplevel-reorder
10283 Do not reorder top-level functions, variables, and @code{asm}
10284 statements. Output them in the same order that they appear in the
10285 input file. When this option is used, unreferenced static variables
10286 are not removed. This option is intended to support existing code
10287 that relies on a particular ordering. For new code, it is better to
10288 use attributes when possible.
10289
10290 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10291 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10292 Additionally @option{-fno-toplevel-reorder} implies
10293 @option{-fno-section-anchors}.
10294
10295 @item -fweb
10296 @opindex fweb
10297 Constructs webs as commonly used for register allocation purposes and assign
10298 each web individual pseudo register. This allows the register allocation pass
10299 to operate on pseudos directly, but also strengthens several other optimization
10300 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10301 however, make debugging impossible, since variables no longer stay in a
10302 ``home register''.
10303
10304 Enabled by default with @option{-funroll-loops}.
10305
10306 @item -fwhole-program
10307 @opindex fwhole-program
10308 Assume that the current compilation unit represents the whole program being
10309 compiled. All public functions and variables with the exception of @code{main}
10310 and those merged by attribute @code{externally_visible} become static functions
10311 and in effect are optimized more aggressively by interprocedural optimizers.
10312
10313 This option should not be used in combination with @option{-flto}.
10314 Instead relying on a linker plugin should provide safer and more precise
10315 information.
10316
10317 @item -flto[=@var{n}]
10318 @opindex flto
10319 This option runs the standard link-time optimizer. When invoked
10320 with source code, it generates GIMPLE (one of GCC's internal
10321 representations) and writes it to special ELF sections in the object
10322 file. When the object files are linked together, all the function
10323 bodies are read from these ELF sections and instantiated as if they
10324 had been part of the same translation unit.
10325
10326 To use the link-time optimizer, @option{-flto} and optimization
10327 options should be specified at compile time and during the final link.
10328 It is recommended that you compile all the files participating in the
10329 same link with the same options and also specify those options at
10330 link time.
10331 For example:
10332
10333 @smallexample
10334 gcc -c -O2 -flto foo.c
10335 gcc -c -O2 -flto bar.c
10336 gcc -o myprog -flto -O2 foo.o bar.o
10337 @end smallexample
10338
10339 The first two invocations to GCC save a bytecode representation
10340 of GIMPLE into special ELF sections inside @file{foo.o} and
10341 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10342 @file{foo.o} and @file{bar.o}, merges the two files into a single
10343 internal image, and compiles the result as usual. Since both
10344 @file{foo.o} and @file{bar.o} are merged into a single image, this
10345 causes all the interprocedural analyses and optimizations in GCC to
10346 work across the two files as if they were a single one. This means,
10347 for example, that the inliner is able to inline functions in
10348 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10349
10350 Another (simpler) way to enable link-time optimization is:
10351
10352 @smallexample
10353 gcc -o myprog -flto -O2 foo.c bar.c
10354 @end smallexample
10355
10356 The above generates bytecode for @file{foo.c} and @file{bar.c},
10357 merges them together into a single GIMPLE representation and optimizes
10358 them as usual to produce @file{myprog}.
10359
10360 The important thing to keep in mind is that to enable link-time
10361 optimizations you need to use the GCC driver to perform the link step.
10362 GCC automatically performs link-time optimization if any of the
10363 objects involved were compiled with the @option{-flto} command-line option.
10364 You can always override
10365 the automatic decision to do link-time optimization
10366 by passing @option{-fno-lto} to the link command.
10367
10368 To make whole program optimization effective, it is necessary to make
10369 certain whole program assumptions. The compiler needs to know
10370 what functions and variables can be accessed by libraries and runtime
10371 outside of the link-time optimized unit. When supported by the linker,
10372 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10373 to the compiler about used and externally visible symbols. When
10374 the linker plugin is not available, @option{-fwhole-program} should be
10375 used to allow the compiler to make these assumptions, which leads
10376 to more aggressive optimization decisions.
10377
10378 When a file is compiled with @option{-flto} without
10379 @option{-fuse-linker-plugin}, the generated object file is larger than
10380 a regular object file because it contains GIMPLE bytecodes and the usual
10381 final code (see @option{-ffat-lto-objects}. This means that
10382 object files with LTO information can be linked as normal object
10383 files; if @option{-fno-lto} is passed to the linker, no
10384 interprocedural optimizations are applied. Note that when
10385 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10386 but you cannot perform a regular, non-LTO link on them.
10387
10388 When producing the final binary, GCC only
10389 applies link-time optimizations to those files that contain bytecode.
10390 Therefore, you can mix and match object files and libraries with
10391 GIMPLE bytecodes and final object code. GCC automatically selects
10392 which files to optimize in LTO mode and which files to link without
10393 further processing.
10394
10395 Generally, options specified at link time override those
10396 specified at compile time, although in some cases GCC attempts to infer
10397 link-time options from the settings used to compile the input files.
10398
10399 If you do not specify an optimization level option @option{-O} at
10400 link time, then GCC uses the highest optimization level
10401 used when compiling the object files. Note that it is generally
10402 ineffective to specify an optimization level option only at link time and
10403 not at compile time, for two reasons. First, compiling without
10404 optimization suppresses compiler passes that gather information
10405 needed for effective optimization at link time. Second, some early
10406 optimization passes can be performed only at compile time and
10407 not at link time.
10408
10409 There are some code generation flags preserved by GCC when
10410 generating bytecodes, as they need to be used during the final link.
10411 Currently, the following options and their settings are taken from
10412 the first object file that explicitly specifies them:
10413 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10414 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10415 and all the @option{-m} target flags.
10416
10417 Certain ABI-changing flags are required to match in all compilation units,
10418 and trying to override this at link time with a conflicting value
10419 is ignored. This includes options such as @option{-freg-struct-return}
10420 and @option{-fpcc-struct-return}.
10421
10422 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10423 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10424 are passed through to the link stage and merged conservatively for
10425 conflicting translation units. Specifically
10426 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10427 precedence; and for example @option{-ffp-contract=off} takes precedence
10428 over @option{-ffp-contract=fast}. You can override them at link time.
10429
10430 To enable debug info generation you need to supply @option{-g} at
10431 compile-time. If any of the input files at link time were built
10432 with debug info generation enabled the link will enable debug info
10433 generation as well. Any elaborate debug info settings
10434 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10435 at the linker command line and mixing different settings in different
10436 translation units is discouraged.
10437
10438 If LTO encounters objects with C linkage declared with incompatible
10439 types in separate translation units to be linked together (undefined
10440 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10441 issued. The behavior is still undefined at run time. Similar
10442 diagnostics may be raised for other languages.
10443
10444 Another feature of LTO is that it is possible to apply interprocedural
10445 optimizations on files written in different languages:
10446
10447 @smallexample
10448 gcc -c -flto foo.c
10449 g++ -c -flto bar.cc
10450 gfortran -c -flto baz.f90
10451 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10452 @end smallexample
10453
10454 Notice that the final link is done with @command{g++} to get the C++
10455 runtime libraries and @option{-lgfortran} is added to get the Fortran
10456 runtime libraries. In general, when mixing languages in LTO mode, you
10457 should use the same link command options as when mixing languages in a
10458 regular (non-LTO) compilation.
10459
10460 If object files containing GIMPLE bytecode are stored in a library archive, say
10461 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10462 are using a linker with plugin support. To create static libraries suitable
10463 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10464 and @command{ranlib};
10465 to show the symbols of object files with GIMPLE bytecode, use
10466 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10467 and @command{nm} have been compiled with plugin support. At link time, use the
10468 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10469 the LTO optimization process:
10470
10471 @smallexample
10472 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10473 @end smallexample
10474
10475 With the linker plugin enabled, the linker extracts the needed
10476 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10477 to make them part of the aggregated GIMPLE image to be optimized.
10478
10479 If you are not using a linker with plugin support and/or do not
10480 enable the linker plugin, then the objects inside @file{libfoo.a}
10481 are extracted and linked as usual, but they do not participate
10482 in the LTO optimization process. In order to make a static library suitable
10483 for both LTO optimization and usual linkage, compile its object files with
10484 @option{-flto} @option{-ffat-lto-objects}.
10485
10486 Link-time optimizations do not require the presence of the whole program to
10487 operate. If the program does not require any symbols to be exported, it is
10488 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10489 the interprocedural optimizers to use more aggressive assumptions which may
10490 lead to improved optimization opportunities.
10491 Use of @option{-fwhole-program} is not needed when linker plugin is
10492 active (see @option{-fuse-linker-plugin}).
10493
10494 The current implementation of LTO makes no
10495 attempt to generate bytecode that is portable between different
10496 types of hosts. The bytecode files are versioned and there is a
10497 strict version check, so bytecode files generated in one version of
10498 GCC do not work with an older or newer version of GCC.
10499
10500 Link-time optimization does not work well with generation of debugging
10501 information on systems other than those using a combination of ELF and
10502 DWARF.
10503
10504 If you specify the optional @var{n}, the optimization and code
10505 generation done at link time is executed in parallel using @var{n}
10506 parallel jobs by utilizing an installed @command{make} program. The
10507 environment variable @env{MAKE} may be used to override the program
10508 used.
10509
10510 You can also specify @option{-flto=jobserver} to use GNU make's
10511 job server mode to determine the number of parallel jobs. This
10512 is useful when the Makefile calling GCC is already executing in parallel.
10513 You must prepend a @samp{+} to the command recipe in the parent Makefile
10514 for this to work. This option likely only works if @env{MAKE} is
10515 GNU make. Even without the option value, GCC tries to automatically
10516 detect a running GNU make's job server.
10517
10518 Use @option{-flto=auto} to use GNU make's job server, if available,
10519 or otherwise fall back to autodetection of the number of CPU threads
10520 present in your system.
10521
10522 @item -flto-partition=@var{alg}
10523 @opindex flto-partition
10524 Specify the partitioning algorithm used by the link-time optimizer.
10525 The value is either @samp{1to1} to specify a partitioning mirroring
10526 the original source files or @samp{balanced} to specify partitioning
10527 into equally sized chunks (whenever possible) or @samp{max} to create
10528 new partition for every symbol where possible. Specifying @samp{none}
10529 as an algorithm disables partitioning and streaming completely.
10530 The default value is @samp{balanced}. While @samp{1to1} can be used
10531 as an workaround for various code ordering issues, the @samp{max}
10532 partitioning is intended for internal testing only.
10533 The value @samp{one} specifies that exactly one partition should be
10534 used while the value @samp{none} bypasses partitioning and executes
10535 the link-time optimization step directly from the WPA phase.
10536
10537 @item -flto-compression-level=@var{n}
10538 @opindex flto-compression-level
10539 This option specifies the level of compression used for intermediate
10540 language written to LTO object files, and is only meaningful in
10541 conjunction with LTO mode (@option{-flto}). Valid
10542 values are 0 (no compression) to 9 (maximum compression). Values
10543 outside this range are clamped to either 0 or 9. If the option is not
10544 given, a default balanced compression setting is used.
10545
10546 @item -fuse-linker-plugin
10547 @opindex fuse-linker-plugin
10548 Enables the use of a linker plugin during link-time optimization. This
10549 option relies on plugin support in the linker, which is available in gold
10550 or in GNU ld 2.21 or newer.
10551
10552 This option enables the extraction of object files with GIMPLE bytecode out
10553 of library archives. This improves the quality of optimization by exposing
10554 more code to the link-time optimizer. This information specifies what
10555 symbols can be accessed externally (by non-LTO object or during dynamic
10556 linking). Resulting code quality improvements on binaries (and shared
10557 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10558 See @option{-flto} for a description of the effect of this flag and how to
10559 use it.
10560
10561 This option is enabled by default when LTO support in GCC is enabled
10562 and GCC was configured for use with
10563 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10564
10565 @item -ffat-lto-objects
10566 @opindex ffat-lto-objects
10567 Fat LTO objects are object files that contain both the intermediate language
10568 and the object code. This makes them usable for both LTO linking and normal
10569 linking. This option is effective only when compiling with @option{-flto}
10570 and is ignored at link time.
10571
10572 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10573 requires the complete toolchain to be aware of LTO. It requires a linker with
10574 linker plugin support for basic functionality. Additionally,
10575 @command{nm}, @command{ar} and @command{ranlib}
10576 need to support linker plugins to allow a full-featured build environment
10577 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10578 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10579 to these tools. With non fat LTO makefiles need to be modified to use them.
10580
10581 Note that modern binutils provide plugin auto-load mechanism.
10582 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10583 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10584 @command{gcc-ranlib}).
10585
10586 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10587 support.
10588
10589 @item -fcompare-elim
10590 @opindex fcompare-elim
10591 After register allocation and post-register allocation instruction splitting,
10592 identify arithmetic instructions that compute processor flags similar to a
10593 comparison operation based on that arithmetic. If possible, eliminate the
10594 explicit comparison operation.
10595
10596 This pass only applies to certain targets that cannot explicitly represent
10597 the comparison operation before register allocation is complete.
10598
10599 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10600
10601 @item -fcprop-registers
10602 @opindex fcprop-registers
10603 After register allocation and post-register allocation instruction splitting,
10604 perform a copy-propagation pass to try to reduce scheduling dependencies
10605 and occasionally eliminate the copy.
10606
10607 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10608
10609 @item -fprofile-correction
10610 @opindex fprofile-correction
10611 Profiles collected using an instrumented binary for multi-threaded programs may
10612 be inconsistent due to missed counter updates. When this option is specified,
10613 GCC uses heuristics to correct or smooth out such inconsistencies. By
10614 default, GCC emits an error message when an inconsistent profile is detected.
10615
10616 This option is enabled by @option{-fauto-profile}.
10617
10618 @item -fprofile-use
10619 @itemx -fprofile-use=@var{path}
10620 @opindex fprofile-use
10621 Enable profile feedback-directed optimizations,
10622 and the following optimizations, many of which
10623 are generally profitable only with profile feedback available:
10624
10625 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10626 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10627 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10628 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10629 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10630 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10631 -fprofile-reorder-functions}
10632
10633 Before you can use this option, you must first generate profiling information.
10634 @xref{Instrumentation Options}, for information about the
10635 @option{-fprofile-generate} option.
10636
10637 By default, GCC emits an error message if the feedback profiles do not
10638 match the source code. This error can be turned into a warning by using
10639 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10640 optimized code. Additionally, by default, GCC also emits a warning message if
10641 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10642
10643 If @var{path} is specified, GCC looks at the @var{path} to find
10644 the profile feedback data files. See @option{-fprofile-dir}.
10645
10646 @item -fauto-profile
10647 @itemx -fauto-profile=@var{path}
10648 @opindex fauto-profile
10649 Enable sampling-based feedback-directed optimizations,
10650 and the following optimizations,
10651 many of which are generally profitable only with profile feedback available:
10652
10653 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10654 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10655 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10656 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10657 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10658 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10659 -fprofile-correction}
10660
10661 @var{path} is the name of a file containing AutoFDO profile information.
10662 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10663
10664 Producing an AutoFDO profile data file requires running your program
10665 with the @command{perf} utility on a supported GNU/Linux target system.
10666 For more information, see @uref{https://perf.wiki.kernel.org/}.
10667
10668 E.g.
10669 @smallexample
10670 perf record -e br_inst_retired:near_taken -b -o perf.data \
10671 -- your_program
10672 @end smallexample
10673
10674 Then use the @command{create_gcov} tool to convert the raw profile data
10675 to a format that can be used by GCC.@ You must also supply the
10676 unstripped binary for your program to this tool.
10677 See @uref{https://github.com/google/autofdo}.
10678
10679 E.g.
10680 @smallexample
10681 create_gcov --binary=your_program.unstripped --profile=perf.data \
10682 --gcov=profile.afdo
10683 @end smallexample
10684 @end table
10685
10686 The following options control compiler behavior regarding floating-point
10687 arithmetic. These options trade off between speed and
10688 correctness. All must be specifically enabled.
10689
10690 @table @gcctabopt
10691 @item -ffloat-store
10692 @opindex ffloat-store
10693 Do not store floating-point variables in registers, and inhibit other
10694 options that might change whether a floating-point value is taken from a
10695 register or memory.
10696
10697 @cindex floating-point precision
10698 This option prevents undesirable excess precision on machines such as
10699 the 68000 where the floating registers (of the 68881) keep more
10700 precision than a @code{double} is supposed to have. Similarly for the
10701 x86 architecture. For most programs, the excess precision does only
10702 good, but a few programs rely on the precise definition of IEEE floating
10703 point. Use @option{-ffloat-store} for such programs, after modifying
10704 them to store all pertinent intermediate computations into variables.
10705
10706 @item -fexcess-precision=@var{style}
10707 @opindex fexcess-precision
10708 This option allows further control over excess precision on machines
10709 where floating-point operations occur in a format with more precision or
10710 range than the IEEE standard and interchange floating-point types. By
10711 default, @option{-fexcess-precision=fast} is in effect; this means that
10712 operations may be carried out in a wider precision than the types specified
10713 in the source if that would result in faster code, and it is unpredictable
10714 when rounding to the types specified in the source code takes place.
10715 When compiling C, if @option{-fexcess-precision=standard} is specified then
10716 excess precision follows the rules specified in ISO C99; in particular,
10717 both casts and assignments cause values to be rounded to their
10718 semantic types (whereas @option{-ffloat-store} only affects
10719 assignments). This option is enabled by default for C if a strict
10720 conformance option such as @option{-std=c99} is used.
10721 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10722 regardless of whether a strict conformance option is used.
10723
10724 @opindex mfpmath
10725 @option{-fexcess-precision=standard} is not implemented for languages
10726 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10727 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10728 semantics apply without excess precision, and in the latter, rounding
10729 is unpredictable.
10730
10731 @item -ffast-math
10732 @opindex ffast-math
10733 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10734 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10735 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10736 @option{-fexcess-precision=fast}.
10737
10738 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10739
10740 This option is not turned on by any @option{-O} option besides
10741 @option{-Ofast} since it can result in incorrect output for programs
10742 that depend on an exact implementation of IEEE or ISO rules/specifications
10743 for math functions. It may, however, yield faster code for programs
10744 that do not require the guarantees of these specifications.
10745
10746 @item -fno-math-errno
10747 @opindex fno-math-errno
10748 @opindex fmath-errno
10749 Do not set @code{errno} after calling math functions that are executed
10750 with a single instruction, e.g., @code{sqrt}. A program that relies on
10751 IEEE exceptions for math error handling may want to use this flag
10752 for speed while maintaining IEEE arithmetic compatibility.
10753
10754 This option is not turned on by any @option{-O} option since
10755 it can result in incorrect output for programs that depend on
10756 an exact implementation of IEEE or ISO rules/specifications for
10757 math functions. It may, however, yield faster code for programs
10758 that do not require the guarantees of these specifications.
10759
10760 The default is @option{-fmath-errno}.
10761
10762 On Darwin systems, the math library never sets @code{errno}. There is
10763 therefore no reason for the compiler to consider the possibility that
10764 it might, and @option{-fno-math-errno} is the default.
10765
10766 @item -funsafe-math-optimizations
10767 @opindex funsafe-math-optimizations
10768
10769 Allow optimizations for floating-point arithmetic that (a) assume
10770 that arguments and results are valid and (b) may violate IEEE or
10771 ANSI standards. When used at link time, it may include libraries
10772 or startup files that change the default FPU control word or other
10773 similar optimizations.
10774
10775 This option is not turned on by any @option{-O} option since
10776 it can result in incorrect output for programs that depend on
10777 an exact implementation of IEEE or ISO rules/specifications for
10778 math functions. It may, however, yield faster code for programs
10779 that do not require the guarantees of these specifications.
10780 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10781 @option{-fassociative-math} and @option{-freciprocal-math}.
10782
10783 The default is @option{-fno-unsafe-math-optimizations}.
10784
10785 @item -fassociative-math
10786 @opindex fassociative-math
10787
10788 Allow re-association of operands in series of floating-point operations.
10789 This violates the ISO C and C++ language standard by possibly changing
10790 computation result. NOTE: re-ordering may change the sign of zero as
10791 well as ignore NaNs and inhibit or create underflow or overflow (and
10792 thus cannot be used on code that relies on rounding behavior like
10793 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10794 and thus may not be used when ordered comparisons are required.
10795 This option requires that both @option{-fno-signed-zeros} and
10796 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10797 much sense with @option{-frounding-math}. For Fortran the option
10798 is automatically enabled when both @option{-fno-signed-zeros} and
10799 @option{-fno-trapping-math} are in effect.
10800
10801 The default is @option{-fno-associative-math}.
10802
10803 @item -freciprocal-math
10804 @opindex freciprocal-math
10805
10806 Allow the reciprocal of a value to be used instead of dividing by
10807 the value if this enables optimizations. For example @code{x / y}
10808 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10809 is subject to common subexpression elimination. Note that this loses
10810 precision and increases the number of flops operating on the value.
10811
10812 The default is @option{-fno-reciprocal-math}.
10813
10814 @item -ffinite-math-only
10815 @opindex ffinite-math-only
10816 Allow optimizations for floating-point arithmetic that assume
10817 that arguments and results are not NaNs or +-Infs.
10818
10819 This option is not turned on by any @option{-O} option since
10820 it can result in incorrect output for programs that depend on
10821 an exact implementation of IEEE or ISO rules/specifications for
10822 math functions. It may, however, yield faster code for programs
10823 that do not require the guarantees of these specifications.
10824
10825 The default is @option{-fno-finite-math-only}.
10826
10827 @item -fno-signed-zeros
10828 @opindex fno-signed-zeros
10829 @opindex fsigned-zeros
10830 Allow optimizations for floating-point arithmetic that ignore the
10831 signedness of zero. IEEE arithmetic specifies the behavior of
10832 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10833 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10834 This option implies that the sign of a zero result isn't significant.
10835
10836 The default is @option{-fsigned-zeros}.
10837
10838 @item -fno-trapping-math
10839 @opindex fno-trapping-math
10840 @opindex ftrapping-math
10841 Compile code assuming that floating-point operations cannot generate
10842 user-visible traps. These traps include division by zero, overflow,
10843 underflow, inexact result and invalid operation. This option requires
10844 that @option{-fno-signaling-nans} be in effect. Setting this option may
10845 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10846
10847 This option should never be turned on by any @option{-O} option since
10848 it can result in incorrect output for programs that depend on
10849 an exact implementation of IEEE or ISO rules/specifications for
10850 math functions.
10851
10852 The default is @option{-ftrapping-math}.
10853
10854 @item -frounding-math
10855 @opindex frounding-math
10856 Disable transformations and optimizations that assume default floating-point
10857 rounding behavior. This is round-to-zero for all floating point
10858 to integer conversions, and round-to-nearest for all other arithmetic
10859 truncations. This option should be specified for programs that change
10860 the FP rounding mode dynamically, or that may be executed with a
10861 non-default rounding mode. This option disables constant folding of
10862 floating-point expressions at compile time (which may be affected by
10863 rounding mode) and arithmetic transformations that are unsafe in the
10864 presence of sign-dependent rounding modes.
10865
10866 The default is @option{-fno-rounding-math}.
10867
10868 This option is experimental and does not currently guarantee to
10869 disable all GCC optimizations that are affected by rounding mode.
10870 Future versions of GCC may provide finer control of this setting
10871 using C99's @code{FENV_ACCESS} pragma. This command-line option
10872 will be used to specify the default state for @code{FENV_ACCESS}.
10873
10874 @item -fsignaling-nans
10875 @opindex fsignaling-nans
10876 Compile code assuming that IEEE signaling NaNs may generate user-visible
10877 traps during floating-point operations. Setting this option disables
10878 optimizations that may change the number of exceptions visible with
10879 signaling NaNs. This option implies @option{-ftrapping-math}.
10880
10881 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10882 be defined.
10883
10884 The default is @option{-fno-signaling-nans}.
10885
10886 This option is experimental and does not currently guarantee to
10887 disable all GCC optimizations that affect signaling NaN behavior.
10888
10889 @item -fno-fp-int-builtin-inexact
10890 @opindex fno-fp-int-builtin-inexact
10891 @opindex ffp-int-builtin-inexact
10892 Do not allow the built-in functions @code{ceil}, @code{floor},
10893 @code{round} and @code{trunc}, and their @code{float} and @code{long
10894 double} variants, to generate code that raises the ``inexact''
10895 floating-point exception for noninteger arguments. ISO C99 and C11
10896 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10897 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
10898 ISO C2X, does not allow these functions to do so.
10899
10900 The default is @option{-ffp-int-builtin-inexact}, allowing the
10901 exception to be raised, unless C2X or a later C standard is selected.
10902 This option does nothing unless @option{-ftrapping-math} is in effect.
10903
10904 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10905 generate a call to a library function then the ``inexact'' exception
10906 may be raised if the library implementation does not follow TS 18661.
10907
10908 @item -fsingle-precision-constant
10909 @opindex fsingle-precision-constant
10910 Treat floating-point constants as single precision instead of
10911 implicitly converting them to double-precision constants.
10912
10913 @item -fcx-limited-range
10914 @opindex fcx-limited-range
10915 When enabled, this option states that a range reduction step is not
10916 needed when performing complex division. Also, there is no checking
10917 whether the result of a complex multiplication or division is @code{NaN
10918 + I*NaN}, with an attempt to rescue the situation in that case. The
10919 default is @option{-fno-cx-limited-range}, but is enabled by
10920 @option{-ffast-math}.
10921
10922 This option controls the default setting of the ISO C99
10923 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10924 all languages.
10925
10926 @item -fcx-fortran-rules
10927 @opindex fcx-fortran-rules
10928 Complex multiplication and division follow Fortran rules. Range
10929 reduction is done as part of complex division, but there is no checking
10930 whether the result of a complex multiplication or division is @code{NaN
10931 + I*NaN}, with an attempt to rescue the situation in that case.
10932
10933 The default is @option{-fno-cx-fortran-rules}.
10934
10935 @end table
10936
10937 The following options control optimizations that may improve
10938 performance, but are not enabled by any @option{-O} options. This
10939 section includes experimental options that may produce broken code.
10940
10941 @table @gcctabopt
10942 @item -fbranch-probabilities
10943 @opindex fbranch-probabilities
10944 After running a program compiled with @option{-fprofile-arcs}
10945 (@pxref{Instrumentation Options}),
10946 you can compile it a second time using
10947 @option{-fbranch-probabilities}, to improve optimizations based on
10948 the number of times each branch was taken. When a program
10949 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10950 counts to a file called @file{@var{sourcename}.gcda} for each source
10951 file. The information in this data file is very dependent on the
10952 structure of the generated code, so you must use the same source code
10953 and the same optimization options for both compilations.
10954
10955 With @option{-fbranch-probabilities}, GCC puts a
10956 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10957 These can be used to improve optimization. Currently, they are only
10958 used in one place: in @file{reorg.c}, instead of guessing which path a
10959 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10960 exactly determine which path is taken more often.
10961
10962 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10963
10964 @item -fprofile-values
10965 @opindex fprofile-values
10966 If combined with @option{-fprofile-arcs}, it adds code so that some
10967 data about values of expressions in the program is gathered.
10968
10969 With @option{-fbranch-probabilities}, it reads back the data gathered
10970 from profiling values of expressions for usage in optimizations.
10971
10972 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10973 @option{-fauto-profile}.
10974
10975 @item -fprofile-reorder-functions
10976 @opindex fprofile-reorder-functions
10977 Function reordering based on profile instrumentation collects
10978 first time of execution of a function and orders these functions
10979 in ascending order.
10980
10981 Enabled with @option{-fprofile-use}.
10982
10983 @item -fvpt
10984 @opindex fvpt
10985 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10986 to add code to gather information about values of expressions.
10987
10988 With @option{-fbranch-probabilities}, it reads back the data gathered
10989 and actually performs the optimizations based on them.
10990 Currently the optimizations include specialization of division operations
10991 using the knowledge about the value of the denominator.
10992
10993 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10994
10995 @item -frename-registers
10996 @opindex frename-registers
10997 Attempt to avoid false dependencies in scheduled code by making use
10998 of registers left over after register allocation. This optimization
10999 most benefits processors with lots of registers. Depending on the
11000 debug information format adopted by the target, however, it can
11001 make debugging impossible, since variables no longer stay in
11002 a ``home register''.
11003
11004 Enabled by default with @option{-funroll-loops}.
11005
11006 @item -fschedule-fusion
11007 @opindex fschedule-fusion
11008 Performs a target dependent pass over the instruction stream to schedule
11009 instructions of same type together because target machine can execute them
11010 more efficiently if they are adjacent to each other in the instruction flow.
11011
11012 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11013
11014 @item -ftracer
11015 @opindex ftracer
11016 Perform tail duplication to enlarge superblock size. This transformation
11017 simplifies the control flow of the function allowing other optimizations to do
11018 a better job.
11019
11020 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11021
11022 @item -funroll-loops
11023 @opindex funroll-loops
11024 Unroll loops whose number of iterations can be determined at compile time or
11025 upon entry to the loop. @option{-funroll-loops} implies
11026 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11027 It also turns on complete loop peeling (i.e.@: complete removal of loops with
11028 a small constant number of iterations). This option makes code larger, and may
11029 or may not make it run faster.
11030
11031 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11032
11033 @item -funroll-all-loops
11034 @opindex funroll-all-loops
11035 Unroll all loops, even if their number of iterations is uncertain when
11036 the loop is entered. This usually makes programs run more slowly.
11037 @option{-funroll-all-loops} implies the same options as
11038 @option{-funroll-loops}.
11039
11040 @item -fpeel-loops
11041 @opindex fpeel-loops
11042 Peels loops for which there is enough information that they do not
11043 roll much (from profile feedback or static analysis). It also turns on
11044 complete loop peeling (i.e.@: complete removal of loops with small constant
11045 number of iterations).
11046
11047 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11048
11049 @item -fmove-loop-invariants
11050 @opindex fmove-loop-invariants
11051 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11052 at level @option{-O1} and higher, except for @option{-Og}.
11053
11054 @item -fsplit-loops
11055 @opindex fsplit-loops
11056 Split a loop into two if it contains a condition that's always true
11057 for one side of the iteration space and false for the other.
11058
11059 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11060
11061 @item -funswitch-loops
11062 @opindex funswitch-loops
11063 Move branches with loop invariant conditions out of the loop, with duplicates
11064 of the loop on both branches (modified according to result of the condition).
11065
11066 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11067
11068 @item -fversion-loops-for-strides
11069 @opindex fversion-loops-for-strides
11070 If a loop iterates over an array with a variable stride, create another
11071 version of the loop that assumes the stride is always one. For example:
11072
11073 @smallexample
11074 for (int i = 0; i < n; ++i)
11075 x[i * stride] = @dots{};
11076 @end smallexample
11077
11078 becomes:
11079
11080 @smallexample
11081 if (stride == 1)
11082 for (int i = 0; i < n; ++i)
11083 x[i] = @dots{};
11084 else
11085 for (int i = 0; i < n; ++i)
11086 x[i * stride] = @dots{};
11087 @end smallexample
11088
11089 This is particularly useful for assumed-shape arrays in Fortran where
11090 (for example) it allows better vectorization assuming contiguous accesses.
11091 This flag is enabled by default at @option{-O3}.
11092 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11093
11094 @item -ffunction-sections
11095 @itemx -fdata-sections
11096 @opindex ffunction-sections
11097 @opindex fdata-sections
11098 Place each function or data item into its own section in the output
11099 file if the target supports arbitrary sections. The name of the
11100 function or the name of the data item determines the section's name
11101 in the output file.
11102
11103 Use these options on systems where the linker can perform optimizations to
11104 improve locality of reference in the instruction space. Most systems using the
11105 ELF object format have linkers with such optimizations. On AIX, the linker
11106 rearranges sections (CSECTs) based on the call graph. The performance impact
11107 varies.
11108
11109 Together with a linker garbage collection (linker @option{--gc-sections}
11110 option) these options may lead to smaller statically-linked executables (after
11111 stripping).
11112
11113 On ELF/DWARF systems these options do not degenerate the quality of the debug
11114 information. There could be issues with other object files/debug info formats.
11115
11116 Only use these options when there are significant benefits from doing so. When
11117 you specify these options, the assembler and linker create larger object and
11118 executable files and are also slower. These options affect code generation.
11119 They prevent optimizations by the compiler and assembler using relative
11120 locations inside a translation unit since the locations are unknown until
11121 link time. An example of such an optimization is relaxing calls to short call
11122 instructions.
11123
11124 @item -fstdarg-opt
11125 @opindex fstdarg-opt
11126 Optimize the prologue of variadic argument functions with respect to usage of
11127 those arguments.
11128
11129 @item -fsection-anchors
11130 @opindex fsection-anchors
11131 Try to reduce the number of symbolic address calculations by using
11132 shared ``anchor'' symbols to address nearby objects. This transformation
11133 can help to reduce the number of GOT entries and GOT accesses on some
11134 targets.
11135
11136 For example, the implementation of the following function @code{foo}:
11137
11138 @smallexample
11139 static int a, b, c;
11140 int foo (void) @{ return a + b + c; @}
11141 @end smallexample
11142
11143 @noindent
11144 usually calculates the addresses of all three variables, but if you
11145 compile it with @option{-fsection-anchors}, it accesses the variables
11146 from a common anchor point instead. The effect is similar to the
11147 following pseudocode (which isn't valid C):
11148
11149 @smallexample
11150 int foo (void)
11151 @{
11152 register int *xr = &x;
11153 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11154 @}
11155 @end smallexample
11156
11157 Not all targets support this option.
11158
11159 @item --param @var{name}=@var{value}
11160 @opindex param
11161 In some places, GCC uses various constants to control the amount of
11162 optimization that is done. For example, GCC does not inline functions
11163 that contain more than a certain number of instructions. You can
11164 control some of these constants on the command line using the
11165 @option{--param} option.
11166
11167 The names of specific parameters, and the meaning of the values, are
11168 tied to the internals of the compiler, and are subject to change
11169 without notice in future releases.
11170
11171 In order to get minimal, maximal and default value of a parameter,
11172 one can use @option{--help=param -Q} options.
11173
11174 In each case, the @var{value} is an integer. The allowable choices for
11175 @var{name} are:
11176
11177 @table @gcctabopt
11178 @item predictable-branch-outcome
11179 When branch is predicted to be taken with probability lower than this threshold
11180 (in percent), then it is considered well predictable.
11181
11182 @item max-rtl-if-conversion-insns
11183 RTL if-conversion tries to remove conditional branches around a block and
11184 replace them with conditionally executed instructions. This parameter
11185 gives the maximum number of instructions in a block which should be
11186 considered for if-conversion. The compiler will
11187 also use other heuristics to decide whether if-conversion is likely to be
11188 profitable.
11189
11190 @item max-rtl-if-conversion-predictable-cost
11191 @itemx max-rtl-if-conversion-unpredictable-cost
11192 RTL if-conversion will try to remove conditional branches around a block
11193 and replace them with conditionally executed instructions. These parameters
11194 give the maximum permissible cost for the sequence that would be generated
11195 by if-conversion depending on whether the branch is statically determined
11196 to be predictable or not. The units for this parameter are the same as
11197 those for the GCC internal seq_cost metric. The compiler will try to
11198 provide a reasonable default for this parameter using the BRANCH_COST
11199 target macro.
11200
11201 @item max-crossjump-edges
11202 The maximum number of incoming edges to consider for cross-jumping.
11203 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11204 the number of edges incoming to each block. Increasing values mean
11205 more aggressive optimization, making the compilation time increase with
11206 probably small improvement in executable size.
11207
11208 @item min-crossjump-insns
11209 The minimum number of instructions that must be matched at the end
11210 of two blocks before cross-jumping is performed on them. This
11211 value is ignored in the case where all instructions in the block being
11212 cross-jumped from are matched.
11213
11214 @item max-grow-copy-bb-insns
11215 The maximum code size expansion factor when copying basic blocks
11216 instead of jumping. The expansion is relative to a jump instruction.
11217
11218 @item max-goto-duplication-insns
11219 The maximum number of instructions to duplicate to a block that jumps
11220 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11221 passes, GCC factors computed gotos early in the compilation process,
11222 and unfactors them as late as possible. Only computed jumps at the
11223 end of a basic blocks with no more than max-goto-duplication-insns are
11224 unfactored.
11225
11226 @item max-delay-slot-insn-search
11227 The maximum number of instructions to consider when looking for an
11228 instruction to fill a delay slot. If more than this arbitrary number of
11229 instructions are searched, the time savings from filling the delay slot
11230 are minimal, so stop searching. Increasing values mean more
11231 aggressive optimization, making the compilation time increase with probably
11232 small improvement in execution time.
11233
11234 @item max-delay-slot-live-search
11235 When trying to fill delay slots, the maximum number of instructions to
11236 consider when searching for a block with valid live register
11237 information. Increasing this arbitrarily chosen value means more
11238 aggressive optimization, increasing the compilation time. This parameter
11239 should be removed when the delay slot code is rewritten to maintain the
11240 control-flow graph.
11241
11242 @item max-gcse-memory
11243 The approximate maximum amount of memory that can be allocated in
11244 order to perform the global common subexpression elimination
11245 optimization. If more memory than specified is required, the
11246 optimization is not done.
11247
11248 @item max-gcse-insertion-ratio
11249 If the ratio of expression insertions to deletions is larger than this value
11250 for any expression, then RTL PRE inserts or removes the expression and thus
11251 leaves partially redundant computations in the instruction stream.
11252
11253 @item max-pending-list-length
11254 The maximum number of pending dependencies scheduling allows
11255 before flushing the current state and starting over. Large functions
11256 with few branches or calls can create excessively large lists which
11257 needlessly consume memory and resources.
11258
11259 @item max-modulo-backtrack-attempts
11260 The maximum number of backtrack attempts the scheduler should make
11261 when modulo scheduling a loop. Larger values can exponentially increase
11262 compilation time.
11263
11264 @item max-inline-insns-single
11265 @item max-inline-insns-single-O2
11266 Several parameters control the tree inliner used in GCC@. This number sets the
11267 maximum number of instructions (counted in GCC's internal representation) in a
11268 single function that the tree inliner considers for inlining. This only
11269 affects functions declared inline and methods implemented in a class
11270 declaration (C++).
11271
11272 For functions compiled with optimization levels
11273 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11274 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11275
11276
11277 @item max-inline-insns-auto
11278 @item max-inline-insns-auto-O2
11279 When you use @option{-finline-functions} (included in @option{-O3}),
11280 a lot of functions that would otherwise not be considered for inlining
11281 by the compiler are investigated. To those functions, a different
11282 (more restrictive) limit compared to functions declared inline can
11283 be applied.
11284
11285 For functions compiled with optimization levels
11286 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11287 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11288
11289 @item max-inline-insns-small
11290 This is bound applied to calls which are considered relevant with
11291 @option{-finline-small-functions}.
11292
11293 @item max-inline-insns-size
11294 This is bound applied to calls which are optimized for size. Small growth
11295 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11296
11297 @item uninlined-function-insns
11298 Number of instructions accounted by inliner for function overhead such as
11299 function prologue and epilogue.
11300
11301 @item uninlined-function-time
11302 Extra time accounted by inliner for function overhead such as time needed to
11303 execute function prologue and epilogue
11304
11305 @item inline-heuristics-hint-percent
11306 @item inline-heuristics-hint-percent-O2
11307 The scale (in percents) applied to @option{inline-insns-single},
11308 @option{inline-insns-single-O2}, @option{inline-insns-auto},
11309 @option{inline-insns-auto-O2} when inline heuristics hints that inlining is
11310 very profitable (will enable later optimizations).
11311
11312 For functions compiled with optimization levels
11313 @option{-O3} and @option{-Ofast} parameter
11314 @option{inline-heuristics-hint-percent} is applied. In other cases
11315 @option{inline-heuristics-hint-percent-O2} is applied.
11316
11317 @item uninlined-thunk-insns
11318 @item uninlined-thunk-time
11319 Same as @option{--param uninlined-function-insns} and
11320 @option{--param uninlined-function-time} but applied to function thunks
11321
11322 @item inline-min-speedup
11323 @item inline-min-speedup-O2
11324 When estimated performance improvement of caller + callee runtime exceeds this
11325 threshold (in percent), the function can be inlined regardless of the limit on
11326 @option{--param max-inline-insns-single} and @option{--param
11327 max-inline-insns-auto}.
11328
11329 For functions compiled with optimization levels
11330 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11331 applied. In other cases @option{inline-min-speedup-O2} is applied.
11332
11333 @item large-function-insns
11334 The limit specifying really large functions. For functions larger than this
11335 limit after inlining, inlining is constrained by
11336 @option{--param large-function-growth}. This parameter is useful primarily
11337 to avoid extreme compilation time caused by non-linear algorithms used by the
11338 back end.
11339
11340 @item large-function-growth
11341 Specifies maximal growth of large function caused by inlining in percents.
11342 For example, parameter value 100 limits large function growth to 2.0 times
11343 the original size.
11344
11345 @item large-unit-insns
11346 The limit specifying large translation unit. Growth caused by inlining of
11347 units larger than this limit is limited by @option{--param inline-unit-growth}.
11348 For small units this might be too tight.
11349 For example, consider a unit consisting of function A
11350 that is inline and B that just calls A three times. If B is small relative to
11351 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11352 large units consisting of small inlineable functions, however, the overall unit
11353 growth limit is needed to avoid exponential explosion of code size. Thus for
11354 smaller units, the size is increased to @option{--param large-unit-insns}
11355 before applying @option{--param inline-unit-growth}.
11356
11357 @item inline-unit-growth
11358 Specifies maximal overall growth of the compilation unit caused by inlining.
11359 For example, parameter value 20 limits unit growth to 1.2 times the original
11360 size. Cold functions (either marked cold via an attribute or by profile
11361 feedback) are not accounted into the unit size.
11362
11363 @item ipcp-unit-growth
11364 Specifies maximal overall growth of the compilation unit caused by
11365 interprocedural constant propagation. For example, parameter value 10 limits
11366 unit growth to 1.1 times the original size.
11367
11368 @item large-stack-frame
11369 The limit specifying large stack frames. While inlining the algorithm is trying
11370 to not grow past this limit too much.
11371
11372 @item large-stack-frame-growth
11373 Specifies maximal growth of large stack frames caused by inlining in percents.
11374 For example, parameter value 1000 limits large stack frame growth to 11 times
11375 the original size.
11376
11377 @item max-inline-insns-recursive
11378 @itemx max-inline-insns-recursive-auto
11379 Specifies the maximum number of instructions an out-of-line copy of a
11380 self-recursive inline
11381 function can grow into by performing recursive inlining.
11382
11383 @option{--param max-inline-insns-recursive} applies to functions
11384 declared inline.
11385 For functions not declared inline, recursive inlining
11386 happens only when @option{-finline-functions} (included in @option{-O3}) is
11387 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11388
11389 @item max-inline-recursive-depth
11390 @itemx max-inline-recursive-depth-auto
11391 Specifies the maximum recursion depth used for recursive inlining.
11392
11393 @option{--param max-inline-recursive-depth} applies to functions
11394 declared inline. For functions not declared inline, recursive inlining
11395 happens only when @option{-finline-functions} (included in @option{-O3}) is
11396 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11397
11398 @item min-inline-recursive-probability
11399 Recursive inlining is profitable only for function having deep recursion
11400 in average and can hurt for function having little recursion depth by
11401 increasing the prologue size or complexity of function body to other
11402 optimizers.
11403
11404 When profile feedback is available (see @option{-fprofile-generate}) the actual
11405 recursion depth can be guessed from the probability that function recurses
11406 via a given call expression. This parameter limits inlining only to call
11407 expressions whose probability exceeds the given threshold (in percents).
11408
11409 @item early-inlining-insns
11410 @item early-inlining-insns-O2
11411 Specify growth that the early inliner can make. In effect it increases
11412 the amount of inlining for code having a large abstraction penalty.
11413
11414 For functions compiled with optimization levels
11415 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11416 applied. In other cases @option{early-inlining-insns-O2} is applied.
11417
11418 @item max-early-inliner-iterations
11419 Limit of iterations of the early inliner. This basically bounds
11420 the number of nested indirect calls the early inliner can resolve.
11421 Deeper chains are still handled by late inlining.
11422
11423 @item comdat-sharing-probability
11424 Probability (in percent) that C++ inline function with comdat visibility
11425 are shared across multiple compilation units.
11426
11427 @item profile-func-internal-id
11428 A parameter to control whether to use function internal id in profile
11429 database lookup. If the value is 0, the compiler uses an id that
11430 is based on function assembler name and filename, which makes old profile
11431 data more tolerant to source changes such as function reordering etc.
11432
11433 @item min-vect-loop-bound
11434 The minimum number of iterations under which loops are not vectorized
11435 when @option{-ftree-vectorize} is used. The number of iterations after
11436 vectorization needs to be greater than the value specified by this option
11437 to allow vectorization.
11438
11439 @item gcse-cost-distance-ratio
11440 Scaling factor in calculation of maximum distance an expression
11441 can be moved by GCSE optimizations. This is currently supported only in the
11442 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11443 is with simple expressions, i.e., the expressions that have cost
11444 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11445 hoisting of simple expressions.
11446
11447 @item gcse-unrestricted-cost
11448 Cost, roughly measured as the cost of a single typical machine
11449 instruction, at which GCSE optimizations do not constrain
11450 the distance an expression can travel. This is currently
11451 supported only in the code hoisting pass. The lesser the cost,
11452 the more aggressive code hoisting is. Specifying 0
11453 allows all expressions to travel unrestricted distances.
11454
11455 @item max-hoist-depth
11456 The depth of search in the dominator tree for expressions to hoist.
11457 This is used to avoid quadratic behavior in hoisting algorithm.
11458 The value of 0 does not limit on the search, but may slow down compilation
11459 of huge functions.
11460
11461 @item max-tail-merge-comparisons
11462 The maximum amount of similar bbs to compare a bb with. This is used to
11463 avoid quadratic behavior in tree tail merging.
11464
11465 @item max-tail-merge-iterations
11466 The maximum amount of iterations of the pass over the function. This is used to
11467 limit compilation time in tree tail merging.
11468
11469 @item store-merging-allow-unaligned
11470 Allow the store merging pass to introduce unaligned stores if it is legal to
11471 do so.
11472
11473 @item max-stores-to-merge
11474 The maximum number of stores to attempt to merge into wider stores in the store
11475 merging pass.
11476
11477 @item max-unrolled-insns
11478 The maximum number of instructions that a loop may have to be unrolled.
11479 If a loop is unrolled, this parameter also determines how many times
11480 the loop code is unrolled.
11481
11482 @item max-average-unrolled-insns
11483 The maximum number of instructions biased by probabilities of their execution
11484 that a loop may have to be unrolled. If a loop is unrolled,
11485 this parameter also determines how many times the loop code is unrolled.
11486
11487 @item max-unroll-times
11488 The maximum number of unrollings of a single loop.
11489
11490 @item max-peeled-insns
11491 The maximum number of instructions that a loop may have to be peeled.
11492 If a loop is peeled, this parameter also determines how many times
11493 the loop code is peeled.
11494
11495 @item max-peel-times
11496 The maximum number of peelings of a single loop.
11497
11498 @item max-peel-branches
11499 The maximum number of branches on the hot path through the peeled sequence.
11500
11501 @item max-completely-peeled-insns
11502 The maximum number of insns of a completely peeled loop.
11503
11504 @item max-completely-peel-times
11505 The maximum number of iterations of a loop to be suitable for complete peeling.
11506
11507 @item max-completely-peel-loop-nest-depth
11508 The maximum depth of a loop nest suitable for complete peeling.
11509
11510 @item max-unswitch-insns
11511 The maximum number of insns of an unswitched loop.
11512
11513 @item max-unswitch-level
11514 The maximum number of branches unswitched in a single loop.
11515
11516 @item lim-expensive
11517 The minimum cost of an expensive expression in the loop invariant motion.
11518
11519 @item iv-consider-all-candidates-bound
11520 Bound on number of candidates for induction variables, below which
11521 all candidates are considered for each use in induction variable
11522 optimizations. If there are more candidates than this,
11523 only the most relevant ones are considered to avoid quadratic time complexity.
11524
11525 @item iv-max-considered-uses
11526 The induction variable optimizations give up on loops that contain more
11527 induction variable uses.
11528
11529 @item iv-always-prune-cand-set-bound
11530 If the number of candidates in the set is smaller than this value,
11531 always try to remove unnecessary ivs from the set
11532 when adding a new one.
11533
11534 @item avg-loop-niter
11535 Average number of iterations of a loop.
11536
11537 @item dse-max-object-size
11538 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11539 Larger values may result in larger compilation times.
11540
11541 @item dse-max-alias-queries-per-store
11542 Maximum number of queries into the alias oracle per store.
11543 Larger values result in larger compilation times and may result in more
11544 removed dead stores.
11545
11546 @item scev-max-expr-size
11547 Bound on size of expressions used in the scalar evolutions analyzer.
11548 Large expressions slow the analyzer.
11549
11550 @item scev-max-expr-complexity
11551 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11552 Complex expressions slow the analyzer.
11553
11554 @item max-tree-if-conversion-phi-args
11555 Maximum number of arguments in a PHI supported by TREE if conversion
11556 unless the loop is marked with simd pragma.
11557
11558 @item vect-max-version-for-alignment-checks
11559 The maximum number of run-time checks that can be performed when
11560 doing loop versioning for alignment in the vectorizer.
11561
11562 @item vect-max-version-for-alias-checks
11563 The maximum number of run-time checks that can be performed when
11564 doing loop versioning for alias in the vectorizer.
11565
11566 @item vect-max-peeling-for-alignment
11567 The maximum number of loop peels to enhance access alignment
11568 for vectorizer. Value -1 means no limit.
11569
11570 @item max-iterations-to-track
11571 The maximum number of iterations of a loop the brute-force algorithm
11572 for analysis of the number of iterations of the loop tries to evaluate.
11573
11574 @item hot-bb-count-fraction
11575 The denominator n of fraction 1/n of the maximal execution count of a
11576 basic block in the entire program that a basic block needs to at least
11577 have in order to be considered hot. The default is 10000, which means
11578 that a basic block is considered hot if its execution count is greater
11579 than 1/10000 of the maximal execution count. 0 means that it is never
11580 considered hot. Used in non-LTO mode.
11581
11582 @item hot-bb-count-ws-permille
11583 The number of most executed permilles, ranging from 0 to 1000, of the
11584 profiled execution of the entire program to which the execution count
11585 of a basic block must be part of in order to be considered hot. The
11586 default is 990, which means that a basic block is considered hot if
11587 its execution count contributes to the upper 990 permilles, or 99.0%,
11588 of the profiled execution of the entire program. 0 means that it is
11589 never considered hot. Used in LTO mode.
11590
11591 @item hot-bb-frequency-fraction
11592 The denominator n of fraction 1/n of the execution frequency of the
11593 entry block of a function that a basic block of this function needs
11594 to at least have in order to be considered hot. The default is 1000,
11595 which means that a basic block is considered hot in a function if it
11596 is executed more frequently than 1/1000 of the frequency of the entry
11597 block of the function. 0 means that it is never considered hot.
11598
11599 @item unlikely-bb-count-fraction
11600 The denominator n of fraction 1/n of the number of profiled runs of
11601 the entire program below which the execution count of a basic block
11602 must be in order for the basic block to be considered unlikely executed.
11603 The default is 20, which means that a basic block is considered unlikely
11604 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11605 the program. 0 means that it is always considered unlikely executed.
11606
11607 @item max-predicted-iterations
11608 The maximum number of loop iterations we predict statically. This is useful
11609 in cases where a function contains a single loop with known bound and
11610 another loop with unknown bound.
11611 The known number of iterations is predicted correctly, while
11612 the unknown number of iterations average to roughly 10. This means that the
11613 loop without bounds appears artificially cold relative to the other one.
11614
11615 @item builtin-expect-probability
11616 Control the probability of the expression having the specified value. This
11617 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11618
11619 @item builtin-string-cmp-inline-length
11620 The maximum length of a constant string for a builtin string cmp call
11621 eligible for inlining.
11622
11623 @item align-threshold
11624
11625 Select fraction of the maximal frequency of executions of a basic block in
11626 a function to align the basic block.
11627
11628 @item align-loop-iterations
11629
11630 A loop expected to iterate at least the selected number of iterations is
11631 aligned.
11632
11633 @item tracer-dynamic-coverage
11634 @itemx tracer-dynamic-coverage-feedback
11635
11636 This value is used to limit superblock formation once the given percentage of
11637 executed instructions is covered. This limits unnecessary code size
11638 expansion.
11639
11640 The @option{tracer-dynamic-coverage-feedback} parameter
11641 is used only when profile
11642 feedback is available. The real profiles (as opposed to statically estimated
11643 ones) are much less balanced allowing the threshold to be larger value.
11644
11645 @item tracer-max-code-growth
11646 Stop tail duplication once code growth has reached given percentage. This is
11647 a rather artificial limit, as most of the duplicates are eliminated later in
11648 cross jumping, so it may be set to much higher values than is the desired code
11649 growth.
11650
11651 @item tracer-min-branch-ratio
11652
11653 Stop reverse growth when the reverse probability of best edge is less than this
11654 threshold (in percent).
11655
11656 @item tracer-min-branch-probability
11657 @itemx tracer-min-branch-probability-feedback
11658
11659 Stop forward growth if the best edge has probability lower than this
11660 threshold.
11661
11662 Similarly to @option{tracer-dynamic-coverage} two parameters are
11663 provided. @option{tracer-min-branch-probability-feedback} is used for
11664 compilation with profile feedback and @option{tracer-min-branch-probability}
11665 compilation without. The value for compilation with profile feedback
11666 needs to be more conservative (higher) in order to make tracer
11667 effective.
11668
11669 @item stack-clash-protection-guard-size
11670 Specify the size of the operating system provided stack guard as
11671 2 raised to @var{num} bytes. Higher values may reduce the
11672 number of explicit probes, but a value larger than the operating system
11673 provided guard will leave code vulnerable to stack clash style attacks.
11674
11675 @item stack-clash-protection-probe-interval
11676 Stack clash protection involves probing stack space as it is allocated. This
11677 param controls the maximum distance between probes into the stack as 2 raised
11678 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11679 larger than the operating system provided guard will leave code vulnerable to
11680 stack clash style attacks.
11681
11682 @item max-cse-path-length
11683
11684 The maximum number of basic blocks on path that CSE considers.
11685
11686 @item max-cse-insns
11687 The maximum number of instructions CSE processes before flushing.
11688
11689 @item ggc-min-expand
11690
11691 GCC uses a garbage collector to manage its own memory allocation. This
11692 parameter specifies the minimum percentage by which the garbage
11693 collector's heap should be allowed to expand between collections.
11694 Tuning this may improve compilation speed; it has no effect on code
11695 generation.
11696
11697 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11698 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11699 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11700 GCC is not able to calculate RAM on a particular platform, the lower
11701 bound of 30% is used. Setting this parameter and
11702 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11703 every opportunity. This is extremely slow, but can be useful for
11704 debugging.
11705
11706 @item ggc-min-heapsize
11707
11708 Minimum size of the garbage collector's heap before it begins bothering
11709 to collect garbage. The first collection occurs after the heap expands
11710 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11711 tuning this may improve compilation speed, and has no effect on code
11712 generation.
11713
11714 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11715 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11716 with a lower bound of 4096 (four megabytes) and an upper bound of
11717 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11718 particular platform, the lower bound is used. Setting this parameter
11719 very large effectively disables garbage collection. Setting this
11720 parameter and @option{ggc-min-expand} to zero causes a full collection
11721 to occur at every opportunity.
11722
11723 @item max-reload-search-insns
11724 The maximum number of instruction reload should look backward for equivalent
11725 register. Increasing values mean more aggressive optimization, making the
11726 compilation time increase with probably slightly better performance.
11727
11728 @item max-cselib-memory-locations
11729 The maximum number of memory locations cselib should take into account.
11730 Increasing values mean more aggressive optimization, making the compilation time
11731 increase with probably slightly better performance.
11732
11733 @item max-sched-ready-insns
11734 The maximum number of instructions ready to be issued the scheduler should
11735 consider at any given time during the first scheduling pass. Increasing
11736 values mean more thorough searches, making the compilation time increase
11737 with probably little benefit.
11738
11739 @item max-sched-region-blocks
11740 The maximum number of blocks in a region to be considered for
11741 interblock scheduling.
11742
11743 @item max-pipeline-region-blocks
11744 The maximum number of blocks in a region to be considered for
11745 pipelining in the selective scheduler.
11746
11747 @item max-sched-region-insns
11748 The maximum number of insns in a region to be considered for
11749 interblock scheduling.
11750
11751 @item max-pipeline-region-insns
11752 The maximum number of insns in a region to be considered for
11753 pipelining in the selective scheduler.
11754
11755 @item min-spec-prob
11756 The minimum probability (in percents) of reaching a source block
11757 for interblock speculative scheduling.
11758
11759 @item max-sched-extend-regions-iters
11760 The maximum number of iterations through CFG to extend regions.
11761 A value of 0 disables region extensions.
11762
11763 @item max-sched-insn-conflict-delay
11764 The maximum conflict delay for an insn to be considered for speculative motion.
11765
11766 @item sched-spec-prob-cutoff
11767 The minimal probability of speculation success (in percents), so that
11768 speculative insns are scheduled.
11769
11770 @item sched-state-edge-prob-cutoff
11771 The minimum probability an edge must have for the scheduler to save its
11772 state across it.
11773
11774 @item sched-mem-true-dep-cost
11775 Minimal distance (in CPU cycles) between store and load targeting same
11776 memory locations.
11777
11778 @item selsched-max-lookahead
11779 The maximum size of the lookahead window of selective scheduling. It is a
11780 depth of search for available instructions.
11781
11782 @item selsched-max-sched-times
11783 The maximum number of times that an instruction is scheduled during
11784 selective scheduling. This is the limit on the number of iterations
11785 through which the instruction may be pipelined.
11786
11787 @item selsched-insns-to-rename
11788 The maximum number of best instructions in the ready list that are considered
11789 for renaming in the selective scheduler.
11790
11791 @item sms-min-sc
11792 The minimum value of stage count that swing modulo scheduler
11793 generates.
11794
11795 @item max-last-value-rtl
11796 The maximum size measured as number of RTLs that can be recorded in an expression
11797 in combiner for a pseudo register as last known value of that register.
11798
11799 @item max-combine-insns
11800 The maximum number of instructions the RTL combiner tries to combine.
11801
11802 @item integer-share-limit
11803 Small integer constants can use a shared data structure, reducing the
11804 compiler's memory usage and increasing its speed. This sets the maximum
11805 value of a shared integer constant.
11806
11807 @item ssp-buffer-size
11808 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11809 protection when @option{-fstack-protection} is used.
11810
11811 @item min-size-for-stack-sharing
11812 The minimum size of variables taking part in stack slot sharing when not
11813 optimizing.
11814
11815 @item max-jump-thread-duplication-stmts
11816 Maximum number of statements allowed in a block that needs to be
11817 duplicated when threading jumps.
11818
11819 @item max-fields-for-field-sensitive
11820 Maximum number of fields in a structure treated in
11821 a field sensitive manner during pointer analysis.
11822
11823 @item prefetch-latency
11824 Estimate on average number of instructions that are executed before
11825 prefetch finishes. The distance prefetched ahead is proportional
11826 to this constant. Increasing this number may also lead to less
11827 streams being prefetched (see @option{simultaneous-prefetches}).
11828
11829 @item simultaneous-prefetches
11830 Maximum number of prefetches that can run at the same time.
11831
11832 @item l1-cache-line-size
11833 The size of cache line in L1 data cache, in bytes.
11834
11835 @item l1-cache-size
11836 The size of L1 data cache, in kilobytes.
11837
11838 @item l2-cache-size
11839 The size of L2 data cache, in kilobytes.
11840
11841 @item prefetch-dynamic-strides
11842 Whether the loop array prefetch pass should issue software prefetch hints
11843 for strides that are non-constant. In some cases this may be
11844 beneficial, though the fact the stride is non-constant may make it
11845 hard to predict when there is clear benefit to issuing these hints.
11846
11847 Set to 1 if the prefetch hints should be issued for non-constant
11848 strides. Set to 0 if prefetch hints should be issued only for strides that
11849 are known to be constant and below @option{prefetch-minimum-stride}.
11850
11851 @item prefetch-minimum-stride
11852 Minimum constant stride, in bytes, to start using prefetch hints for. If
11853 the stride is less than this threshold, prefetch hints will not be issued.
11854
11855 This setting is useful for processors that have hardware prefetchers, in
11856 which case there may be conflicts between the hardware prefetchers and
11857 the software prefetchers. If the hardware prefetchers have a maximum
11858 stride they can handle, it should be used here to improve the use of
11859 software prefetchers.
11860
11861 A value of -1 means we don't have a threshold and therefore
11862 prefetch hints can be issued for any constant stride.
11863
11864 This setting is only useful for strides that are known and constant.
11865
11866 @item loop-interchange-max-num-stmts
11867 The maximum number of stmts in a loop to be interchanged.
11868
11869 @item loop-interchange-stride-ratio
11870 The minimum ratio between stride of two loops for interchange to be profitable.
11871
11872 @item min-insn-to-prefetch-ratio
11873 The minimum ratio between the number of instructions and the
11874 number of prefetches to enable prefetching in a loop.
11875
11876 @item prefetch-min-insn-to-mem-ratio
11877 The minimum ratio between the number of instructions and the
11878 number of memory references to enable prefetching in a loop.
11879
11880 @item use-canonical-types
11881 Whether the compiler should use the ``canonical'' type system.
11882 Should always be 1, which uses a more efficient internal
11883 mechanism for comparing types in C++ and Objective-C++. However, if
11884 bugs in the canonical type system are causing compilation failures,
11885 set this value to 0 to disable canonical types.
11886
11887 @item switch-conversion-max-branch-ratio
11888 Switch initialization conversion refuses to create arrays that are
11889 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11890 branches in the switch.
11891
11892 @item max-partial-antic-length
11893 Maximum length of the partial antic set computed during the tree
11894 partial redundancy elimination optimization (@option{-ftree-pre}) when
11895 optimizing at @option{-O3} and above. For some sorts of source code
11896 the enhanced partial redundancy elimination optimization can run away,
11897 consuming all of the memory available on the host machine. This
11898 parameter sets a limit on the length of the sets that are computed,
11899 which prevents the runaway behavior. Setting a value of 0 for
11900 this parameter allows an unlimited set length.
11901
11902 @item rpo-vn-max-loop-depth
11903 Maximum loop depth that is value-numbered optimistically.
11904 When the limit hits the innermost
11905 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11906 loop nest are value-numbered optimistically and the remaining ones not.
11907
11908 @item sccvn-max-alias-queries-per-access
11909 Maximum number of alias-oracle queries we perform when looking for
11910 redundancies for loads and stores. If this limit is hit the search
11911 is aborted and the load or store is not considered redundant. The
11912 number of queries is algorithmically limited to the number of
11913 stores on all paths from the load to the function entry.
11914
11915 @item ira-max-loops-num
11916 IRA uses regional register allocation by default. If a function
11917 contains more loops than the number given by this parameter, only at most
11918 the given number of the most frequently-executed loops form regions
11919 for regional register allocation.
11920
11921 @item ira-max-conflict-table-size
11922 Although IRA uses a sophisticated algorithm to compress the conflict
11923 table, the table can still require excessive amounts of memory for
11924 huge functions. If the conflict table for a function could be more
11925 than the size in MB given by this parameter, the register allocator
11926 instead uses a faster, simpler, and lower-quality
11927 algorithm that does not require building a pseudo-register conflict table.
11928
11929 @item ira-loop-reserved-regs
11930 IRA can be used to evaluate more accurate register pressure in loops
11931 for decisions to move loop invariants (see @option{-O3}). The number
11932 of available registers reserved for some other purposes is given
11933 by this parameter. Default of the parameter
11934 is the best found from numerous experiments.
11935
11936 @item lra-inheritance-ebb-probability-cutoff
11937 LRA tries to reuse values reloaded in registers in subsequent insns.
11938 This optimization is called inheritance. EBB is used as a region to
11939 do this optimization. The parameter defines a minimal fall-through
11940 edge probability in percentage used to add BB to inheritance EBB in
11941 LRA. The default value was chosen
11942 from numerous runs of SPEC2000 on x86-64.
11943
11944 @item loop-invariant-max-bbs-in-loop
11945 Loop invariant motion can be very expensive, both in compilation time and
11946 in amount of needed compile-time memory, with very large loops. Loops
11947 with more basic blocks than this parameter won't have loop invariant
11948 motion optimization performed on them.
11949
11950 @item loop-max-datarefs-for-datadeps
11951 Building data dependencies is expensive for very large loops. This
11952 parameter limits the number of data references in loops that are
11953 considered for data dependence analysis. These large loops are no
11954 handled by the optimizations using loop data dependencies.
11955
11956 @item max-vartrack-size
11957 Sets a maximum number of hash table slots to use during variable
11958 tracking dataflow analysis of any function. If this limit is exceeded
11959 with variable tracking at assignments enabled, analysis for that
11960 function is retried without it, after removing all debug insns from
11961 the function. If the limit is exceeded even without debug insns, var
11962 tracking analysis is completely disabled for the function. Setting
11963 the parameter to zero makes it unlimited.
11964
11965 @item max-vartrack-expr-depth
11966 Sets a maximum number of recursion levels when attempting to map
11967 variable names or debug temporaries to value expressions. This trades
11968 compilation time for more complete debug information. If this is set too
11969 low, value expressions that are available and could be represented in
11970 debug information may end up not being used; setting this higher may
11971 enable the compiler to find more complex debug expressions, but compile
11972 time and memory use may grow.
11973
11974 @item max-debug-marker-count
11975 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11976 markers) to avoid complexity explosion at inlining or expanding to RTL.
11977 If a function has more such gimple stmts than the set limit, such stmts
11978 will be dropped from the inlined copy of a function, and from its RTL
11979 expansion.
11980
11981 @item min-nondebug-insn-uid
11982 Use uids starting at this parameter for nondebug insns. The range below
11983 the parameter is reserved exclusively for debug insns created by
11984 @option{-fvar-tracking-assignments}, but debug insns may get
11985 (non-overlapping) uids above it if the reserved range is exhausted.
11986
11987 @item ipa-sra-ptr-growth-factor
11988 IPA-SRA replaces a pointer to an aggregate with one or more new
11989 parameters only when their cumulative size is less or equal to
11990 @option{ipa-sra-ptr-growth-factor} times the size of the original
11991 pointer parameter.
11992
11993 @item ipa-sra-max-replacements
11994 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11995 consequence, it is also the maximum number of replacements of a formal
11996 parameter.
11997
11998 @item sra-max-scalarization-size-Ospeed
11999 @itemx sra-max-scalarization-size-Osize
12000 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12001 replace scalar parts of aggregates with uses of independent scalar
12002 variables. These parameters control the maximum size, in storage units,
12003 of aggregate which is considered for replacement when compiling for
12004 speed
12005 (@option{sra-max-scalarization-size-Ospeed}) or size
12006 (@option{sra-max-scalarization-size-Osize}) respectively.
12007
12008 @item tm-max-aggregate-size
12009 When making copies of thread-local variables in a transaction, this
12010 parameter specifies the size in bytes after which variables are
12011 saved with the logging functions as opposed to save/restore code
12012 sequence pairs. This option only applies when using
12013 @option{-fgnu-tm}.
12014
12015 @item graphite-max-nb-scop-params
12016 To avoid exponential effects in the Graphite loop transforms, the
12017 number of parameters in a Static Control Part (SCoP) is bounded.
12018 A value of zero can be used to lift
12019 the bound. A variable whose value is unknown at compilation time and
12020 defined outside a SCoP is a parameter of the SCoP.
12021
12022 @item loop-block-tile-size
12023 Loop blocking or strip mining transforms, enabled with
12024 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12025 loop in the loop nest by a given number of iterations. The strip
12026 length can be changed using the @option{loop-block-tile-size}
12027 parameter.
12028
12029 @item ipa-cp-value-list-size
12030 IPA-CP attempts to track all possible values and types passed to a function's
12031 parameter in order to propagate them and perform devirtualization.
12032 @option{ipa-cp-value-list-size} is the maximum number of values and types it
12033 stores per one formal parameter of a function.
12034
12035 @item ipa-cp-eval-threshold
12036 IPA-CP calculates its own score of cloning profitability heuristics
12037 and performs those cloning opportunities with scores that exceed
12038 @option{ipa-cp-eval-threshold}.
12039
12040 @item ipa-cp-recursion-penalty
12041 Percentage penalty the recursive functions will receive when they
12042 are evaluated for cloning.
12043
12044 @item ipa-cp-single-call-penalty
12045 Percentage penalty functions containing a single call to another
12046 function will receive when they are evaluated for cloning.
12047
12048 @item ipa-max-agg-items
12049 IPA-CP is also capable to propagate a number of scalar values passed
12050 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12051 number of such values per one parameter.
12052
12053 @item ipa-cp-loop-hint-bonus
12054 When IPA-CP determines that a cloning candidate would make the number
12055 of iterations of a loop known, it adds a bonus of
12056 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12057 the candidate.
12058
12059 @item ipa-max-aa-steps
12060 During its analysis of function bodies, IPA-CP employs alias analysis
12061 in order to track values pointed to by function parameters. In order
12062 not spend too much time analyzing huge functions, it gives up and
12063 consider all memory clobbered after examining
12064 @option{ipa-max-aa-steps} statements modifying memory.
12065
12066 @item ipa-max-switch-predicate-bounds
12067 Maximal number of boundary endpoints of case ranges of switch statement.
12068 For switch exceeding this limit, IPA-CP will not construct cloning cost
12069 predicate, which is used to estimate cloning benefit, for default case
12070 of the switch statement.
12071
12072 @item ipa-max-param-expr-ops
12073 IPA-CP will analyze conditional statement that references some function
12074 parameter to estimate benefit for cloning upon certain constant value.
12075 But if number of operations in a parameter expression exceeds
12076 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12077 one, and is not handled by IPA analysis.
12078
12079 @item lto-partitions
12080 Specify desired number of partitions produced during WHOPR compilation.
12081 The number of partitions should exceed the number of CPUs used for compilation.
12082
12083 @item lto-min-partition
12084 Size of minimal partition for WHOPR (in estimated instructions).
12085 This prevents expenses of splitting very small programs into too many
12086 partitions.
12087
12088 @item lto-max-partition
12089 Size of max partition for WHOPR (in estimated instructions).
12090 to provide an upper bound for individual size of partition.
12091 Meant to be used only with balanced partitioning.
12092
12093 @item lto-max-streaming-parallelism
12094 Maximal number of parallel processes used for LTO streaming.
12095
12096 @item cxx-max-namespaces-for-diagnostic-help
12097 The maximum number of namespaces to consult for suggestions when C++
12098 name lookup fails for an identifier.
12099
12100 @item sink-frequency-threshold
12101 The maximum relative execution frequency (in percents) of the target block
12102 relative to a statement's original block to allow statement sinking of a
12103 statement. Larger numbers result in more aggressive statement sinking.
12104 A small positive adjustment is applied for
12105 statements with memory operands as those are even more profitable so sink.
12106
12107 @item max-stores-to-sink
12108 The maximum number of conditional store pairs that can be sunk. Set to 0
12109 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12110 (@option{-ftree-loop-if-convert}) is disabled.
12111
12112 @item case-values-threshold
12113 The smallest number of different values for which it is best to use a
12114 jump-table instead of a tree of conditional branches. If the value is
12115 0, use the default for the machine.
12116
12117 @item jump-table-max-growth-ratio-for-size
12118 The maximum code size growth ratio when expanding
12119 into a jump table (in percent). The parameter is used when
12120 optimizing for size.
12121
12122 @item jump-table-max-growth-ratio-for-speed
12123 The maximum code size growth ratio when expanding
12124 into a jump table (in percent). The parameter is used when
12125 optimizing for speed.
12126
12127 @item tree-reassoc-width
12128 Set the maximum number of instructions executed in parallel in
12129 reassociated tree. This parameter overrides target dependent
12130 heuristics used by default if has non zero value.
12131
12132 @item sched-pressure-algorithm
12133 Choose between the two available implementations of
12134 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12135 and is the more likely to prevent instructions from being reordered.
12136 Algorithm 2 was designed to be a compromise between the relatively
12137 conservative approach taken by algorithm 1 and the rather aggressive
12138 approach taken by the default scheduler. It relies more heavily on
12139 having a regular register file and accurate register pressure classes.
12140 See @file{haifa-sched.c} in the GCC sources for more details.
12141
12142 The default choice depends on the target.
12143
12144 @item max-slsr-cand-scan
12145 Set the maximum number of existing candidates that are considered when
12146 seeking a basis for a new straight-line strength reduction candidate.
12147
12148 @item asan-globals
12149 Enable buffer overflow detection for global objects. This kind
12150 of protection is enabled by default if you are using
12151 @option{-fsanitize=address} option.
12152 To disable global objects protection use @option{--param asan-globals=0}.
12153
12154 @item asan-stack
12155 Enable buffer overflow detection for stack objects. This kind of
12156 protection is enabled by default when using @option{-fsanitize=address}.
12157 To disable stack protection use @option{--param asan-stack=0} option.
12158
12159 @item asan-instrument-reads
12160 Enable buffer overflow detection for memory reads. This kind of
12161 protection is enabled by default when using @option{-fsanitize=address}.
12162 To disable memory reads protection use
12163 @option{--param asan-instrument-reads=0}.
12164
12165 @item asan-instrument-writes
12166 Enable buffer overflow detection for memory writes. This kind of
12167 protection is enabled by default when using @option{-fsanitize=address}.
12168 To disable memory writes protection use
12169 @option{--param asan-instrument-writes=0} option.
12170
12171 @item asan-memintrin
12172 Enable detection for built-in functions. This kind of protection
12173 is enabled by default when using @option{-fsanitize=address}.
12174 To disable built-in functions protection use
12175 @option{--param asan-memintrin=0}.
12176
12177 @item asan-use-after-return
12178 Enable detection of use-after-return. This kind of protection
12179 is enabled by default when using the @option{-fsanitize=address} option.
12180 To disable it use @option{--param asan-use-after-return=0}.
12181
12182 Note: By default the check is disabled at run time. To enable it,
12183 add @code{detect_stack_use_after_return=1} to the environment variable
12184 @env{ASAN_OPTIONS}.
12185
12186 @item asan-instrumentation-with-call-threshold
12187 If number of memory accesses in function being instrumented
12188 is greater or equal to this number, use callbacks instead of inline checks.
12189 E.g. to disable inline code use
12190 @option{--param asan-instrumentation-with-call-threshold=0}.
12191
12192 @item use-after-scope-direct-emission-threshold
12193 If the size of a local variable in bytes is smaller or equal to this
12194 number, directly poison (or unpoison) shadow memory instead of using
12195 run-time callbacks.
12196
12197 @item max-fsm-thread-path-insns
12198 Maximum number of instructions to copy when duplicating blocks on a
12199 finite state automaton jump thread path.
12200
12201 @item max-fsm-thread-length
12202 Maximum number of basic blocks on a finite state automaton jump thread
12203 path.
12204
12205 @item max-fsm-thread-paths
12206 Maximum number of new jump thread paths to create for a finite state
12207 automaton.
12208
12209 @item parloops-chunk-size
12210 Chunk size of omp schedule for loops parallelized by parloops.
12211
12212 @item parloops-schedule
12213 Schedule type of omp schedule for loops parallelized by parloops (static,
12214 dynamic, guided, auto, runtime).
12215
12216 @item parloops-min-per-thread
12217 The minimum number of iterations per thread of an innermost parallelized
12218 loop for which the parallelized variant is preferred over the single threaded
12219 one. Note that for a parallelized loop nest the
12220 minimum number of iterations of the outermost loop per thread is two.
12221
12222 @item max-ssa-name-query-depth
12223 Maximum depth of recursion when querying properties of SSA names in things
12224 like fold routines. One level of recursion corresponds to following a
12225 use-def chain.
12226
12227 @item hsa-gen-debug-stores
12228 Enable emission of special debug stores within HSA kernels which are
12229 then read and reported by libgomp plugin. Generation of these stores
12230 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12231 enable it.
12232
12233 @item max-speculative-devirt-maydefs
12234 The maximum number of may-defs we analyze when looking for a must-def
12235 specifying the dynamic type of an object that invokes a virtual call
12236 we may be able to devirtualize speculatively.
12237
12238 @item max-vrp-switch-assertions
12239 The maximum number of assertions to add along the default edge of a switch
12240 statement during VRP.
12241
12242 @item unroll-jam-min-percent
12243 The minimum percentage of memory references that must be optimized
12244 away for the unroll-and-jam transformation to be considered profitable.
12245
12246 @item unroll-jam-max-unroll
12247 The maximum number of times the outer loop should be unrolled by
12248 the unroll-and-jam transformation.
12249
12250 @item max-rtl-if-conversion-unpredictable-cost
12251 Maximum permissible cost for the sequence that would be generated
12252 by the RTL if-conversion pass for a branch that is considered unpredictable.
12253
12254 @item max-variable-expansions-in-unroller
12255 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12256 of times that an individual variable will be expanded during loop unrolling.
12257
12258 @item tracer-min-branch-probability-feedback
12259 Stop forward growth if the probability of best edge is less than
12260 this threshold (in percent). Used when profile feedback is available.
12261
12262 @item partial-inlining-entry-probability
12263 Maximum probability of the entry BB of split region
12264 (in percent relative to entry BB of the function)
12265 to make partial inlining happen.
12266
12267 @item max-tracked-strlens
12268 Maximum number of strings for which strlen optimization pass will
12269 track string lengths.
12270
12271 @item gcse-after-reload-partial-fraction
12272 The threshold ratio for performing partial redundancy
12273 elimination after reload.
12274
12275 @item gcse-after-reload-critical-fraction
12276 The threshold ratio of critical edges execution count that
12277 permit performing redundancy elimination after reload.
12278
12279 @item max-loop-header-insns
12280 The maximum number of insns in loop header duplicated
12281 by the copy loop headers pass.
12282
12283 @item vect-epilogues-nomask
12284 Enable loop epilogue vectorization using smaller vector size.
12285
12286 @item slp-max-insns-in-bb
12287 Maximum number of instructions in basic block to be
12288 considered for SLP vectorization.
12289
12290 @item avoid-fma-max-bits
12291 Maximum number of bits for which we avoid creating FMAs.
12292
12293 @item sms-loop-average-count-threshold
12294 A threshold on the average loop count considered by the swing modulo scheduler.
12295
12296 @item sms-dfa-history
12297 The number of cycles the swing modulo scheduler considers when checking
12298 conflicts using DFA.
12299
12300 @item max-inline-insns-recursive-auto
12301 The maximum number of instructions non-inline function
12302 can grow to via recursive inlining.
12303
12304 @item graphite-allow-codegen-errors
12305 Whether codegen errors should be ICEs when @option{-fchecking}.
12306
12307 @item sms-max-ii-factor
12308 A factor for tuning the upper bound that swing modulo scheduler
12309 uses for scheduling a loop.
12310
12311 @item lra-max-considered-reload-pseudos
12312 The max number of reload pseudos which are considered during
12313 spilling a non-reload pseudo.
12314
12315 @item max-pow-sqrt-depth
12316 Maximum depth of sqrt chains to use when synthesizing exponentiation
12317 by a real constant.
12318
12319 @item max-dse-active-local-stores
12320 Maximum number of active local stores in RTL dead store elimination.
12321
12322 @item asan-instrument-allocas
12323 Enable asan allocas/VLAs protection.
12324
12325 @item max-iterations-computation-cost
12326 Bound on the cost of an expression to compute the number of iterations.
12327
12328 @item max-isl-operations
12329 Maximum number of isl operations, 0 means unlimited.
12330
12331 @item graphite-max-arrays-per-scop
12332 Maximum number of arrays per scop.
12333
12334 @item max-vartrack-reverse-op-size
12335 Max. size of loc list for which reverse ops should be added.
12336
12337 @item tracer-dynamic-coverage-feedback
12338 The percentage of function, weighted by execution frequency,
12339 that must be covered by trace formation.
12340 Used when profile feedback is available.
12341
12342 @item max-inline-recursive-depth-auto
12343 The maximum depth of recursive inlining for non-inline functions.
12344
12345 @item fsm-scale-path-stmts
12346 Scale factor to apply to the number of statements in a threading path
12347 when comparing to the number of (scaled) blocks.
12348
12349 @item fsm-maximum-phi-arguments
12350 Maximum number of arguments a PHI may have before the FSM threader
12351 will not try to thread through its block.
12352
12353 @item uninit-control-dep-attempts
12354 Maximum number of nested calls to search for control dependencies
12355 during uninitialized variable analysis.
12356
12357 @item max-once-peeled-insns
12358 The maximum number of insns of a peeled loop that rolls only once.
12359
12360 @item sra-max-scalarization-size-Osize
12361 Maximum size, in storage units, of an aggregate
12362 which should be considered for scalarization when compiling for size.
12363
12364 @item fsm-scale-path-blocks
12365 Scale factor to apply to the number of blocks in a threading path
12366 when comparing to the number of (scaled) statements.
12367
12368 @item sched-autopref-queue-depth
12369 Hardware autoprefetcher scheduler model control flag.
12370 Number of lookahead cycles the model looks into; at '
12371 ' only enable instruction sorting heuristic.
12372
12373 @item loop-versioning-max-inner-insns
12374 The maximum number of instructions that an inner loop can have
12375 before the loop versioning pass considers it too big to copy.
12376
12377 @item loop-versioning-max-outer-insns
12378 The maximum number of instructions that an outer loop can have
12379 before the loop versioning pass considers it too big to copy,
12380 discounting any instructions in inner loops that directly benefit
12381 from versioning.
12382
12383 @item ssa-name-def-chain-limit
12384 The maximum number of SSA_NAME assignments to follow in determining
12385 a property of a variable such as its value. This limits the number
12386 of iterations or recursive calls GCC performs when optimizing certain
12387 statements or when determining their validity prior to issuing
12388 diagnostics.
12389
12390 @end table
12391 @end table
12392
12393 @node Instrumentation Options
12394 @section Program Instrumentation Options
12395 @cindex instrumentation options
12396 @cindex program instrumentation options
12397 @cindex run-time error checking options
12398 @cindex profiling options
12399 @cindex options, program instrumentation
12400 @cindex options, run-time error checking
12401 @cindex options, profiling
12402
12403 GCC supports a number of command-line options that control adding
12404 run-time instrumentation to the code it normally generates.
12405 For example, one purpose of instrumentation is collect profiling
12406 statistics for use in finding program hot spots, code coverage
12407 analysis, or profile-guided optimizations.
12408 Another class of program instrumentation is adding run-time checking
12409 to detect programming errors like invalid pointer
12410 dereferences or out-of-bounds array accesses, as well as deliberately
12411 hostile attacks such as stack smashing or C++ vtable hijacking.
12412 There is also a general hook which can be used to implement other
12413 forms of tracing or function-level instrumentation for debug or
12414 program analysis purposes.
12415
12416 @table @gcctabopt
12417 @cindex @command{prof}
12418 @cindex @command{gprof}
12419 @item -p
12420 @itemx -pg
12421 @opindex p
12422 @opindex pg
12423 Generate extra code to write profile information suitable for the
12424 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12425 (for @option{-pg}). You must use this option when compiling
12426 the source files you want data about, and you must also use it when
12427 linking.
12428
12429 You can use the function attribute @code{no_instrument_function} to
12430 suppress profiling of individual functions when compiling with these options.
12431 @xref{Common Function Attributes}.
12432
12433 @item -fprofile-arcs
12434 @opindex fprofile-arcs
12435 Add code so that program flow @dfn{arcs} are instrumented. During
12436 execution the program records how many times each branch and call is
12437 executed and how many times it is taken or returns. On targets that support
12438 constructors with priority support, profiling properly handles constructors,
12439 destructors and C++ constructors (and destructors) of classes which are used
12440 as a type of a global variable.
12441
12442 When the compiled
12443 program exits it saves this data to a file called
12444 @file{@var{auxname}.gcda} for each source file. The data may be used for
12445 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12446 test coverage analysis (@option{-ftest-coverage}). Each object file's
12447 @var{auxname} is generated from the name of the output file, if
12448 explicitly specified and it is not the final executable, otherwise it is
12449 the basename of the source file. In both cases any suffix is removed
12450 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12451 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12452 @xref{Cross-profiling}.
12453
12454 @cindex @command{gcov}
12455 @item --coverage
12456 @opindex coverage
12457
12458 This option is used to compile and link code instrumented for coverage
12459 analysis. The option is a synonym for @option{-fprofile-arcs}
12460 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12461 linking). See the documentation for those options for more details.
12462
12463 @itemize
12464
12465 @item
12466 Compile the source files with @option{-fprofile-arcs} plus optimization
12467 and code generation options. For test coverage analysis, use the
12468 additional @option{-ftest-coverage} option. You do not need to profile
12469 every source file in a program.
12470
12471 @item
12472 Compile the source files additionally with @option{-fprofile-abs-path}
12473 to create absolute path names in the @file{.gcno} files. This allows
12474 @command{gcov} to find the correct sources in projects where compilations
12475 occur with different working directories.
12476
12477 @item
12478 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12479 (the latter implies the former).
12480
12481 @item
12482 Run the program on a representative workload to generate the arc profile
12483 information. This may be repeated any number of times. You can run
12484 concurrent instances of your program, and provided that the file system
12485 supports locking, the data files will be correctly updated. Unless
12486 a strict ISO C dialect option is in effect, @code{fork} calls are
12487 detected and correctly handled without double counting.
12488
12489 @item
12490 For profile-directed optimizations, compile the source files again with
12491 the same optimization and code generation options plus
12492 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12493 Control Optimization}).
12494
12495 @item
12496 For test coverage analysis, use @command{gcov} to produce human readable
12497 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12498 @command{gcov} documentation for further information.
12499
12500 @end itemize
12501
12502 With @option{-fprofile-arcs}, for each function of your program GCC
12503 creates a program flow graph, then finds a spanning tree for the graph.
12504 Only arcs that are not on the spanning tree have to be instrumented: the
12505 compiler adds code to count the number of times that these arcs are
12506 executed. When an arc is the only exit or only entrance to a block, the
12507 instrumentation code can be added to the block; otherwise, a new basic
12508 block must be created to hold the instrumentation code.
12509
12510 @need 2000
12511 @item -ftest-coverage
12512 @opindex ftest-coverage
12513 Produce a notes file that the @command{gcov} code-coverage utility
12514 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12515 show program coverage. Each source file's note file is called
12516 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12517 above for a description of @var{auxname} and instructions on how to
12518 generate test coverage data. Coverage data matches the source files
12519 more closely if you do not optimize.
12520
12521 @item -fprofile-abs-path
12522 @opindex fprofile-abs-path
12523 Automatically convert relative source file names to absolute path names
12524 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12525 sources in projects where compilations occur with different working
12526 directories.
12527
12528 @item -fprofile-dir=@var{path}
12529 @opindex fprofile-dir
12530
12531 Set the directory to search for the profile data files in to @var{path}.
12532 This option affects only the profile data generated by
12533 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12534 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12535 and its related options. Both absolute and relative paths can be used.
12536 By default, GCC uses the current directory as @var{path}, thus the
12537 profile data file appears in the same directory as the object file.
12538 In order to prevent the file name clashing, if the object file name is
12539 not an absolute path, we mangle the absolute path of the
12540 @file{@var{sourcename}.gcda} file and use it as the file name of a
12541 @file{.gcda} file. See similar option @option{-fprofile-note}.
12542
12543 When an executable is run in a massive parallel environment, it is recommended
12544 to save profile to different folders. That can be done with variables
12545 in @var{path} that are exported during run-time:
12546
12547 @table @gcctabopt
12548
12549 @item %p
12550 process ID.
12551
12552 @item %q@{VAR@}
12553 value of environment variable @var{VAR}
12554
12555 @end table
12556
12557 @item -fprofile-generate
12558 @itemx -fprofile-generate=@var{path}
12559 @opindex fprofile-generate
12560
12561 Enable options usually used for instrumenting application to produce
12562 profile useful for later recompilation with profile feedback based
12563 optimization. You must use @option{-fprofile-generate} both when
12564 compiling and when linking your program.
12565
12566 The following options are enabled:
12567 @option{-fprofile-arcs}, @option{-fprofile-values},
12568 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12569
12570 If @var{path} is specified, GCC looks at the @var{path} to find
12571 the profile feedback data files. See @option{-fprofile-dir}.
12572
12573 To optimize the program based on the collected profile information, use
12574 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12575
12576 @item -fprofile-note=@var{path}
12577 @opindex fprofile-note
12578
12579 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12580 location. If you combine the option with multiple source files,
12581 the @file{.gcno} file will be overwritten.
12582
12583 @item -fprofile-update=@var{method}
12584 @opindex fprofile-update
12585
12586 Alter the update method for an application instrumented for profile
12587 feedback based optimization. The @var{method} argument should be one of
12588 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12589 The first one is useful for single-threaded applications,
12590 while the second one prevents profile corruption by emitting thread-safe code.
12591
12592 @strong{Warning:} When an application does not properly join all threads
12593 (or creates an detached thread), a profile file can be still corrupted.
12594
12595 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12596 when supported by a target, or to @samp{single} otherwise. The GCC driver
12597 automatically selects @samp{prefer-atomic} when @option{-pthread}
12598 is present in the command line.
12599
12600 @item -fprofile-filter-files=@var{regex}
12601 @opindex fprofile-filter-files
12602
12603 Instrument only functions from files where names match
12604 any regular expression (separated by a semi-colon).
12605
12606 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12607 only @file{main.c} and all C files starting with 'module'.
12608
12609 @item -fprofile-exclude-files=@var{regex}
12610 @opindex fprofile-exclude-files
12611
12612 Instrument only functions from files where names do not match
12613 all the regular expressions (separated by a semi-colon).
12614
12615 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12616 of all files that are located in @file{/usr/} folder.
12617
12618 @item -fsanitize=address
12619 @opindex fsanitize=address
12620 Enable AddressSanitizer, a fast memory error detector.
12621 Memory access instructions are instrumented to detect
12622 out-of-bounds and use-after-free bugs.
12623 The option enables @option{-fsanitize-address-use-after-scope}.
12624 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12625 more details. The run-time behavior can be influenced using the
12626 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12627 the available options are shown at startup of the instrumented program. See
12628 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12629 for a list of supported options.
12630 The option cannot be combined with @option{-fsanitize=thread}.
12631
12632 @item -fsanitize=kernel-address
12633 @opindex fsanitize=kernel-address
12634 Enable AddressSanitizer for Linux kernel.
12635 See @uref{https://github.com/google/kasan/wiki} for more details.
12636
12637 @item -fsanitize=pointer-compare
12638 @opindex fsanitize=pointer-compare
12639 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12640 The option must be combined with either @option{-fsanitize=kernel-address} or
12641 @option{-fsanitize=address}
12642 The option cannot be combined with @option{-fsanitize=thread}.
12643 Note: By default the check is disabled at run time. To enable it,
12644 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12645 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12646 invalid operation only when both pointers are non-null.
12647
12648 @item -fsanitize=pointer-subtract
12649 @opindex fsanitize=pointer-subtract
12650 Instrument subtraction with pointer operands.
12651 The option must be combined with either @option{-fsanitize=kernel-address} or
12652 @option{-fsanitize=address}
12653 The option cannot be combined with @option{-fsanitize=thread}.
12654 Note: By default the check is disabled at run time. To enable it,
12655 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12656 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12657 invalid operation only when both pointers are non-null.
12658
12659 @item -fsanitize=thread
12660 @opindex fsanitize=thread
12661 Enable ThreadSanitizer, a fast data race detector.
12662 Memory access instructions are instrumented to detect
12663 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12664 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12665 environment variable; see
12666 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12667 supported options.
12668 The option cannot be combined with @option{-fsanitize=address},
12669 @option{-fsanitize=leak}.
12670
12671 Note that sanitized atomic builtins cannot throw exceptions when
12672 operating on invalid memory addresses with non-call exceptions
12673 (@option{-fnon-call-exceptions}).
12674
12675 @item -fsanitize=leak
12676 @opindex fsanitize=leak
12677 Enable LeakSanitizer, a memory leak detector.
12678 This option only matters for linking of executables and
12679 the executable is linked against a library that overrides @code{malloc}
12680 and other allocator functions. See
12681 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12682 details. The run-time behavior can be influenced using the
12683 @env{LSAN_OPTIONS} environment variable.
12684 The option cannot be combined with @option{-fsanitize=thread}.
12685
12686 @item -fsanitize=undefined
12687 @opindex fsanitize=undefined
12688 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12689 Various computations are instrumented to detect undefined behavior
12690 at runtime. Current suboptions are:
12691
12692 @table @gcctabopt
12693
12694 @item -fsanitize=shift
12695 @opindex fsanitize=shift
12696 This option enables checking that the result of a shift operation is
12697 not undefined. Note that what exactly is considered undefined differs
12698 slightly between C and C++, as well as between ISO C90 and C99, etc.
12699 This option has two suboptions, @option{-fsanitize=shift-base} and
12700 @option{-fsanitize=shift-exponent}.
12701
12702 @item -fsanitize=shift-exponent
12703 @opindex fsanitize=shift-exponent
12704 This option enables checking that the second argument of a shift operation
12705 is not negative and is smaller than the precision of the promoted first
12706 argument.
12707
12708 @item -fsanitize=shift-base
12709 @opindex fsanitize=shift-base
12710 If the second argument of a shift operation is within range, check that the
12711 result of a shift operation is not undefined. Note that what exactly is
12712 considered undefined differs slightly between C and C++, as well as between
12713 ISO C90 and C99, etc.
12714
12715 @item -fsanitize=integer-divide-by-zero
12716 @opindex fsanitize=integer-divide-by-zero
12717 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12718
12719 @item -fsanitize=unreachable
12720 @opindex fsanitize=unreachable
12721 With this option, the compiler turns the @code{__builtin_unreachable}
12722 call into a diagnostics message call instead. When reaching the
12723 @code{__builtin_unreachable} call, the behavior is undefined.
12724
12725 @item -fsanitize=vla-bound
12726 @opindex fsanitize=vla-bound
12727 This option instructs the compiler to check that the size of a variable
12728 length array is positive.
12729
12730 @item -fsanitize=null
12731 @opindex fsanitize=null
12732 This option enables pointer checking. Particularly, the application
12733 built with this option turned on will issue an error message when it
12734 tries to dereference a NULL pointer, or if a reference (possibly an
12735 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12736 on an object pointed by a NULL pointer.
12737
12738 @item -fsanitize=return
12739 @opindex fsanitize=return
12740 This option enables return statement checking. Programs
12741 built with this option turned on will issue an error message
12742 when the end of a non-void function is reached without actually
12743 returning a value. This option works in C++ only.
12744
12745 @item -fsanitize=signed-integer-overflow
12746 @opindex fsanitize=signed-integer-overflow
12747 This option enables signed integer overflow checking. We check that
12748 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12749 does not overflow in the signed arithmetics. Note, integer promotion
12750 rules must be taken into account. That is, the following is not an
12751 overflow:
12752 @smallexample
12753 signed char a = SCHAR_MAX;
12754 a++;
12755 @end smallexample
12756
12757 @item -fsanitize=bounds
12758 @opindex fsanitize=bounds
12759 This option enables instrumentation of array bounds. Various out of bounds
12760 accesses are detected. Flexible array members, flexible array member-like
12761 arrays, and initializers of variables with static storage are not instrumented.
12762
12763 @item -fsanitize=bounds-strict
12764 @opindex fsanitize=bounds-strict
12765 This option enables strict instrumentation of array bounds. Most out of bounds
12766 accesses are detected, including flexible array members and flexible array
12767 member-like arrays. Initializers of variables with static storage are not
12768 instrumented.
12769
12770 @item -fsanitize=alignment
12771 @opindex fsanitize=alignment
12772
12773 This option enables checking of alignment of pointers when they are
12774 dereferenced, or when a reference is bound to insufficiently aligned target,
12775 or when a method or constructor is invoked on insufficiently aligned object.
12776
12777 @item -fsanitize=object-size
12778 @opindex fsanitize=object-size
12779 This option enables instrumentation of memory references using the
12780 @code{__builtin_object_size} function. Various out of bounds pointer
12781 accesses are detected.
12782
12783 @item -fsanitize=float-divide-by-zero
12784 @opindex fsanitize=float-divide-by-zero
12785 Detect floating-point division by zero. Unlike other similar options,
12786 @option{-fsanitize=float-divide-by-zero} is not enabled by
12787 @option{-fsanitize=undefined}, since floating-point division by zero can
12788 be a legitimate way of obtaining infinities and NaNs.
12789
12790 @item -fsanitize=float-cast-overflow
12791 @opindex fsanitize=float-cast-overflow
12792 This option enables floating-point type to integer conversion checking.
12793 We check that the result of the conversion does not overflow.
12794 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12795 not enabled by @option{-fsanitize=undefined}.
12796 This option does not work well with @code{FE_INVALID} exceptions enabled.
12797
12798 @item -fsanitize=nonnull-attribute
12799 @opindex fsanitize=nonnull-attribute
12800
12801 This option enables instrumentation of calls, checking whether null values
12802 are not passed to arguments marked as requiring a non-null value by the
12803 @code{nonnull} function attribute.
12804
12805 @item -fsanitize=returns-nonnull-attribute
12806 @opindex fsanitize=returns-nonnull-attribute
12807
12808 This option enables instrumentation of return statements in functions
12809 marked with @code{returns_nonnull} function attribute, to detect returning
12810 of null values from such functions.
12811
12812 @item -fsanitize=bool
12813 @opindex fsanitize=bool
12814
12815 This option enables instrumentation of loads from bool. If a value other
12816 than 0/1 is loaded, a run-time error is issued.
12817
12818 @item -fsanitize=enum
12819 @opindex fsanitize=enum
12820
12821 This option enables instrumentation of loads from an enum type. If
12822 a value outside the range of values for the enum type is loaded,
12823 a run-time error is issued.
12824
12825 @item -fsanitize=vptr
12826 @opindex fsanitize=vptr
12827
12828 This option enables instrumentation of C++ member function calls, member
12829 accesses and some conversions between pointers to base and derived classes,
12830 to verify the referenced object has the correct dynamic type.
12831
12832 @item -fsanitize=pointer-overflow
12833 @opindex fsanitize=pointer-overflow
12834
12835 This option enables instrumentation of pointer arithmetics. If the pointer
12836 arithmetics overflows, a run-time error is issued.
12837
12838 @item -fsanitize=builtin
12839 @opindex fsanitize=builtin
12840
12841 This option enables instrumentation of arguments to selected builtin
12842 functions. If an invalid value is passed to such arguments, a run-time
12843 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12844 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12845 by this option.
12846
12847 @end table
12848
12849 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12850 @option{-fsanitize=undefined} gives a diagnostic message.
12851 This currently works only for the C family of languages.
12852
12853 @item -fno-sanitize=all
12854 @opindex fno-sanitize=all
12855
12856 This option disables all previously enabled sanitizers.
12857 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12858 together.
12859
12860 @item -fasan-shadow-offset=@var{number}
12861 @opindex fasan-shadow-offset
12862 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12863 It is useful for experimenting with different shadow memory layouts in
12864 Kernel AddressSanitizer.
12865
12866 @item -fsanitize-sections=@var{s1},@var{s2},...
12867 @opindex fsanitize-sections
12868 Sanitize global variables in selected user-defined sections. @var{si} may
12869 contain wildcards.
12870
12871 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12872 @opindex fsanitize-recover
12873 @opindex fno-sanitize-recover
12874 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12875 mentioned in comma-separated list of @var{opts}. Enabling this option
12876 for a sanitizer component causes it to attempt to continue
12877 running the program as if no error happened. This means multiple
12878 runtime errors can be reported in a single program run, and the exit
12879 code of the program may indicate success even when errors
12880 have been reported. The @option{-fno-sanitize-recover=} option
12881 can be used to alter
12882 this behavior: only the first detected error is reported
12883 and program then exits with a non-zero exit code.
12884
12885 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12886 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12887 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12888 @option{-fsanitize=bounds-strict},
12889 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12890 For these sanitizers error recovery is turned on by default,
12891 except @option{-fsanitize=address}, for which this feature is experimental.
12892 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12893 accepted, the former enables recovery for all sanitizers that support it,
12894 the latter disables recovery for all sanitizers that support it.
12895
12896 Even if a recovery mode is turned on the compiler side, it needs to be also
12897 enabled on the runtime library side, otherwise the failures are still fatal.
12898 The runtime library defaults to @code{halt_on_error=0} for
12899 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12900 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12901 setting the @code{halt_on_error} flag in the corresponding environment variable.
12902
12903 Syntax without an explicit @var{opts} parameter is deprecated. It is
12904 equivalent to specifying an @var{opts} list of:
12905
12906 @smallexample
12907 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12908 @end smallexample
12909
12910 @item -fsanitize-address-use-after-scope
12911 @opindex fsanitize-address-use-after-scope
12912 Enable sanitization of local variables to detect use-after-scope bugs.
12913 The option sets @option{-fstack-reuse} to @samp{none}.
12914
12915 @item -fsanitize-undefined-trap-on-error
12916 @opindex fsanitize-undefined-trap-on-error
12917 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12918 report undefined behavior using @code{__builtin_trap} rather than
12919 a @code{libubsan} library routine. The advantage of this is that the
12920 @code{libubsan} library is not needed and is not linked in, so this
12921 is usable even in freestanding environments.
12922
12923 @item -fsanitize-coverage=trace-pc
12924 @opindex fsanitize-coverage=trace-pc
12925 Enable coverage-guided fuzzing code instrumentation.
12926 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12927
12928 @item -fsanitize-coverage=trace-cmp
12929 @opindex fsanitize-coverage=trace-cmp
12930 Enable dataflow guided fuzzing code instrumentation.
12931 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12932 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12933 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12934 variable or @code{__sanitizer_cov_trace_const_cmp1},
12935 @code{__sanitizer_cov_trace_const_cmp2},
12936 @code{__sanitizer_cov_trace_const_cmp4} or
12937 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12938 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12939 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12940 @code{__sanitizer_cov_trace_switch} for switch statements.
12941
12942 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12943 @opindex fcf-protection
12944 Enable code instrumentation of control-flow transfers to increase
12945 program security by checking that target addresses of control-flow
12946 transfer instructions (such as indirect function call, function return,
12947 indirect jump) are valid. This prevents diverting the flow of control
12948 to an unexpected target. This is intended to protect against such
12949 threats as Return-oriented Programming (ROP), and similarly
12950 call/jmp-oriented programming (COP/JOP).
12951
12952 The value @code{branch} tells the compiler to implement checking of
12953 validity of control-flow transfer at the point of indirect branch
12954 instructions, i.e.@: call/jmp instructions. The value @code{return}
12955 implements checking of validity at the point of returning from a
12956 function. The value @code{full} is an alias for specifying both
12957 @code{branch} and @code{return}. The value @code{none} turns off
12958 instrumentation.
12959
12960 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12961 used. The first bit of @code{__CET__} is set to 1 for the value
12962 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12963 the @code{return}.
12964
12965 You can also use the @code{nocf_check} attribute to identify
12966 which functions and calls should be skipped from instrumentation
12967 (@pxref{Function Attributes}).
12968
12969 Currently the x86 GNU/Linux target provides an implementation based
12970 on Intel Control-flow Enforcement Technology (CET).
12971
12972 @item -fstack-protector
12973 @opindex fstack-protector
12974 Emit extra code to check for buffer overflows, such as stack smashing
12975 attacks. This is done by adding a guard variable to functions with
12976 vulnerable objects. This includes functions that call @code{alloca}, and
12977 functions with buffers larger than 8 bytes. The guards are initialized
12978 when a function is entered and then checked when the function exits.
12979 If a guard check fails, an error message is printed and the program exits.
12980
12981 @item -fstack-protector-all
12982 @opindex fstack-protector-all
12983 Like @option{-fstack-protector} except that all functions are protected.
12984
12985 @item -fstack-protector-strong
12986 @opindex fstack-protector-strong
12987 Like @option{-fstack-protector} but includes additional functions to
12988 be protected --- those that have local array definitions, or have
12989 references to local frame addresses.
12990
12991 @item -fstack-protector-explicit
12992 @opindex fstack-protector-explicit
12993 Like @option{-fstack-protector} but only protects those functions which
12994 have the @code{stack_protect} attribute.
12995
12996 @item -fstack-check
12997 @opindex fstack-check
12998 Generate code to verify that you do not go beyond the boundary of the
12999 stack. You should specify this flag if you are running in an
13000 environment with multiple threads, but you only rarely need to specify it in
13001 a single-threaded environment since stack overflow is automatically
13002 detected on nearly all systems if there is only one stack.
13003
13004 Note that this switch does not actually cause checking to be done; the
13005 operating system or the language runtime must do that. The switch causes
13006 generation of code to ensure that they see the stack being extended.
13007
13008 You can additionally specify a string parameter: @samp{no} means no
13009 checking, @samp{generic} means force the use of old-style checking,
13010 @samp{specific} means use the best checking method and is equivalent
13011 to bare @option{-fstack-check}.
13012
13013 Old-style checking is a generic mechanism that requires no specific
13014 target support in the compiler but comes with the following drawbacks:
13015
13016 @enumerate
13017 @item
13018 Modified allocation strategy for large objects: they are always
13019 allocated dynamically if their size exceeds a fixed threshold. Note this
13020 may change the semantics of some code.
13021
13022 @item
13023 Fixed limit on the size of the static frame of functions: when it is
13024 topped by a particular function, stack checking is not reliable and
13025 a warning is issued by the compiler.
13026
13027 @item
13028 Inefficiency: because of both the modified allocation strategy and the
13029 generic implementation, code performance is hampered.
13030 @end enumerate
13031
13032 Note that old-style stack checking is also the fallback method for
13033 @samp{specific} if no target support has been added in the compiler.
13034
13035 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13036 and stack overflows. @samp{specific} is an excellent choice when compiling
13037 Ada code. It is not generally sufficient to protect against stack-clash
13038 attacks. To protect against those you want @samp{-fstack-clash-protection}.
13039
13040 @item -fstack-clash-protection
13041 @opindex fstack-clash-protection
13042 Generate code to prevent stack clash style attacks. When this option is
13043 enabled, the compiler will only allocate one page of stack space at a time
13044 and each page is accessed immediately after allocation. Thus, it prevents
13045 allocations from jumping over any stack guard page provided by the
13046 operating system.
13047
13048 Most targets do not fully support stack clash protection. However, on
13049 those targets @option{-fstack-clash-protection} will protect dynamic stack
13050 allocations. @option{-fstack-clash-protection} may also provide limited
13051 protection for static stack allocations if the target supports
13052 @option{-fstack-check=specific}.
13053
13054 @item -fstack-limit-register=@var{reg}
13055 @itemx -fstack-limit-symbol=@var{sym}
13056 @itemx -fno-stack-limit
13057 @opindex fstack-limit-register
13058 @opindex fstack-limit-symbol
13059 @opindex fno-stack-limit
13060 Generate code to ensure that the stack does not grow beyond a certain value,
13061 either the value of a register or the address of a symbol. If a larger
13062 stack is required, a signal is raised at run time. For most targets,
13063 the signal is raised before the stack overruns the boundary, so
13064 it is possible to catch the signal without taking special precautions.
13065
13066 For instance, if the stack starts at absolute address @samp{0x80000000}
13067 and grows downwards, you can use the flags
13068 @option{-fstack-limit-symbol=__stack_limit} and
13069 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13070 of 128KB@. Note that this may only work with the GNU linker.
13071
13072 You can locally override stack limit checking by using the
13073 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13074
13075 @item -fsplit-stack
13076 @opindex fsplit-stack
13077 Generate code to automatically split the stack before it overflows.
13078 The resulting program has a discontiguous stack which can only
13079 overflow if the program is unable to allocate any more memory. This
13080 is most useful when running threaded programs, as it is no longer
13081 necessary to calculate a good stack size to use for each thread. This
13082 is currently only implemented for the x86 targets running
13083 GNU/Linux.
13084
13085 When code compiled with @option{-fsplit-stack} calls code compiled
13086 without @option{-fsplit-stack}, there may not be much stack space
13087 available for the latter code to run. If compiling all code,
13088 including library code, with @option{-fsplit-stack} is not an option,
13089 then the linker can fix up these calls so that the code compiled
13090 without @option{-fsplit-stack} always has a large stack. Support for
13091 this is implemented in the gold linker in GNU binutils release 2.21
13092 and later.
13093
13094 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13095 @opindex fvtable-verify
13096 This option is only available when compiling C++ code.
13097 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13098 feature that verifies at run time, for every virtual call, that
13099 the vtable pointer through which the call is made is valid for the type of
13100 the object, and has not been corrupted or overwritten. If an invalid vtable
13101 pointer is detected at run time, an error is reported and execution of the
13102 program is immediately halted.
13103
13104 This option causes run-time data structures to be built at program startup,
13105 which are used for verifying the vtable pointers.
13106 The options @samp{std} and @samp{preinit}
13107 control the timing of when these data structures are built. In both cases the
13108 data structures are built before execution reaches @code{main}. Using
13109 @option{-fvtable-verify=std} causes the data structures to be built after
13110 shared libraries have been loaded and initialized.
13111 @option{-fvtable-verify=preinit} causes them to be built before shared
13112 libraries have been loaded and initialized.
13113
13114 If this option appears multiple times in the command line with different
13115 values specified, @samp{none} takes highest priority over both @samp{std} and
13116 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13117
13118 @item -fvtv-debug
13119 @opindex fvtv-debug
13120 When used in conjunction with @option{-fvtable-verify=std} or
13121 @option{-fvtable-verify=preinit}, causes debug versions of the
13122 runtime functions for the vtable verification feature to be called.
13123 This flag also causes the compiler to log information about which
13124 vtable pointers it finds for each class.
13125 This information is written to a file named @file{vtv_set_ptr_data.log}
13126 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13127 if that is defined or the current working directory otherwise.
13128
13129 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13130 file, be sure to delete any existing one.
13131
13132 @item -fvtv-counts
13133 @opindex fvtv-counts
13134 This is a debugging flag. When used in conjunction with
13135 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13136 causes the compiler to keep track of the total number of virtual calls
13137 it encounters and the number of verifications it inserts. It also
13138 counts the number of calls to certain run-time library functions
13139 that it inserts and logs this information for each compilation unit.
13140 The compiler writes this information to a file named
13141 @file{vtv_count_data.log} in the directory named by the environment
13142 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13143 directory otherwise. It also counts the size of the vtable pointer sets
13144 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13145 in the same directory.
13146
13147 Note: This feature @emph{appends} data to the log files. To get fresh log
13148 files, be sure to delete any existing ones.
13149
13150 @item -finstrument-functions
13151 @opindex finstrument-functions
13152 Generate instrumentation calls for entry and exit to functions. Just
13153 after function entry and just before function exit, the following
13154 profiling functions are called with the address of the current
13155 function and its call site. (On some platforms,
13156 @code{__builtin_return_address} does not work beyond the current
13157 function, so the call site information may not be available to the
13158 profiling functions otherwise.)
13159
13160 @smallexample
13161 void __cyg_profile_func_enter (void *this_fn,
13162 void *call_site);
13163 void __cyg_profile_func_exit (void *this_fn,
13164 void *call_site);
13165 @end smallexample
13166
13167 The first argument is the address of the start of the current function,
13168 which may be looked up exactly in the symbol table.
13169
13170 This instrumentation is also done for functions expanded inline in other
13171 functions. The profiling calls indicate where, conceptually, the
13172 inline function is entered and exited. This means that addressable
13173 versions of such functions must be available. If all your uses of a
13174 function are expanded inline, this may mean an additional expansion of
13175 code size. If you use @code{extern inline} in your C code, an
13176 addressable version of such functions must be provided. (This is
13177 normally the case anyway, but if you get lucky and the optimizer always
13178 expands the functions inline, you might have gotten away without
13179 providing static copies.)
13180
13181 A function may be given the attribute @code{no_instrument_function}, in
13182 which case this instrumentation is not done. This can be used, for
13183 example, for the profiling functions listed above, high-priority
13184 interrupt routines, and any functions from which the profiling functions
13185 cannot safely be called (perhaps signal handlers, if the profiling
13186 routines generate output or allocate memory).
13187 @xref{Common Function Attributes}.
13188
13189 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13190 @opindex finstrument-functions-exclude-file-list
13191
13192 Set the list of functions that are excluded from instrumentation (see
13193 the description of @option{-finstrument-functions}). If the file that
13194 contains a function definition matches with one of @var{file}, then
13195 that function is not instrumented. The match is done on substrings:
13196 if the @var{file} parameter is a substring of the file name, it is
13197 considered to be a match.
13198
13199 For example:
13200
13201 @smallexample
13202 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13203 @end smallexample
13204
13205 @noindent
13206 excludes any inline function defined in files whose pathnames
13207 contain @file{/bits/stl} or @file{include/sys}.
13208
13209 If, for some reason, you want to include letter @samp{,} in one of
13210 @var{sym}, write @samp{\,}. For example,
13211 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13212 (note the single quote surrounding the option).
13213
13214 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13215 @opindex finstrument-functions-exclude-function-list
13216
13217 This is similar to @option{-finstrument-functions-exclude-file-list},
13218 but this option sets the list of function names to be excluded from
13219 instrumentation. The function name to be matched is its user-visible
13220 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13221 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13222 match is done on substrings: if the @var{sym} parameter is a substring
13223 of the function name, it is considered to be a match. For C99 and C++
13224 extended identifiers, the function name must be given in UTF-8, not
13225 using universal character names.
13226
13227 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13228 @opindex fpatchable-function-entry
13229 Generate @var{N} NOPs right at the beginning
13230 of each function, with the function entry point before the @var{M}th NOP.
13231 If @var{M} is omitted, it defaults to @code{0} so the
13232 function entry points to the address just at the first NOP.
13233 The NOP instructions reserve extra space which can be used to patch in
13234 any desired instrumentation at run time, provided that the code segment
13235 is writable. The amount of space is controllable indirectly via
13236 the number of NOPs; the NOP instruction used corresponds to the instruction
13237 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13238 is target-specific and may also depend on the architecture variant and/or
13239 other compilation options.
13240
13241 For run-time identification, the starting addresses of these areas,
13242 which correspond to their respective function entries minus @var{M},
13243 are additionally collected in the @code{__patchable_function_entries}
13244 section of the resulting binary.
13245
13246 Note that the value of @code{__attribute__ ((patchable_function_entry
13247 (N,M)))} takes precedence over command-line option
13248 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13249 the area size or to remove it completely on a single function.
13250 If @code{N=0}, no pad location is recorded.
13251
13252 The NOP instructions are inserted at---and maybe before, depending on
13253 @var{M}---the function entry address, even before the prologue.
13254
13255 @end table
13256
13257
13258 @node Preprocessor Options
13259 @section Options Controlling the Preprocessor
13260 @cindex preprocessor options
13261 @cindex options, preprocessor
13262
13263 These options control the C preprocessor, which is run on each C source
13264 file before actual compilation.
13265
13266 If you use the @option{-E} option, nothing is done except preprocessing.
13267 Some of these options make sense only together with @option{-E} because
13268 they cause the preprocessor output to be unsuitable for actual
13269 compilation.
13270
13271 In addition to the options listed here, there are a number of options
13272 to control search paths for include files documented in
13273 @ref{Directory Options}.
13274 Options to control preprocessor diagnostics are listed in
13275 @ref{Warning Options}.
13276
13277 @table @gcctabopt
13278 @include cppopts.texi
13279
13280 @item -Wp,@var{option}
13281 @opindex Wp
13282 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13283 and pass @var{option} directly through to the preprocessor. If
13284 @var{option} contains commas, it is split into multiple options at the
13285 commas. However, many options are modified, translated or interpreted
13286 by the compiler driver before being passed to the preprocessor, and
13287 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13288 interface is undocumented and subject to change, so whenever possible
13289 you should avoid using @option{-Wp} and let the driver handle the
13290 options instead.
13291
13292 @item -Xpreprocessor @var{option}
13293 @opindex Xpreprocessor
13294 Pass @var{option} as an option to the preprocessor. You can use this to
13295 supply system-specific preprocessor options that GCC does not
13296 recognize.
13297
13298 If you want to pass an option that takes an argument, you must use
13299 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13300
13301 @item -no-integrated-cpp
13302 @opindex no-integrated-cpp
13303 Perform preprocessing as a separate pass before compilation.
13304 By default, GCC performs preprocessing as an integrated part of
13305 input tokenization and parsing.
13306 If this option is provided, the appropriate language front end
13307 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13308 and Objective-C, respectively) is instead invoked twice,
13309 once for preprocessing only and once for actual compilation
13310 of the preprocessed input.
13311 This option may be useful in conjunction with the @option{-B} or
13312 @option{-wrapper} options to specify an alternate preprocessor or
13313 perform additional processing of the program source between
13314 normal preprocessing and compilation.
13315
13316 @end table
13317
13318 @node Assembler Options
13319 @section Passing Options to the Assembler
13320
13321 @c prevent bad page break with this line
13322 You can pass options to the assembler.
13323
13324 @table @gcctabopt
13325 @item -Wa,@var{option}
13326 @opindex Wa
13327 Pass @var{option} as an option to the assembler. If @var{option}
13328 contains commas, it is split into multiple options at the commas.
13329
13330 @item -Xassembler @var{option}
13331 @opindex Xassembler
13332 Pass @var{option} as an option to the assembler. You can use this to
13333 supply system-specific assembler options that GCC does not
13334 recognize.
13335
13336 If you want to pass an option that takes an argument, you must use
13337 @option{-Xassembler} twice, once for the option and once for the argument.
13338
13339 @end table
13340
13341 @node Link Options
13342 @section Options for Linking
13343 @cindex link options
13344 @cindex options, linking
13345
13346 These options come into play when the compiler links object files into
13347 an executable output file. They are meaningless if the compiler is
13348 not doing a link step.
13349
13350 @table @gcctabopt
13351 @cindex file names
13352 @item @var{object-file-name}
13353 A file name that does not end in a special recognized suffix is
13354 considered to name an object file or library. (Object files are
13355 distinguished from libraries by the linker according to the file
13356 contents.) If linking is done, these object files are used as input
13357 to the linker.
13358
13359 @item -c
13360 @itemx -S
13361 @itemx -E
13362 @opindex c
13363 @opindex S
13364 @opindex E
13365 If any of these options is used, then the linker is not run, and
13366 object file names should not be used as arguments. @xref{Overall
13367 Options}.
13368
13369 @item -flinker-output=@var{type}
13370 @opindex flinker-output
13371 This option controls code generation of the link-time optimizer. By
13372 default the linker output is automatically determined by the linker
13373 plugin. For debugging the compiler and if incremental linking with a
13374 non-LTO object file is desired, it may be useful to control the type
13375 manually.
13376
13377 If @var{type} is @samp{exec}, code generation produces a static
13378 binary. In this case @option{-fpic} and @option{-fpie} are both
13379 disabled.
13380
13381 If @var{type} is @samp{dyn}, code generation produces a shared
13382 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13383 but not enabled automatically. This allows to build shared libraries
13384 without position-independent code on architectures where this is
13385 possible, i.e.@: on x86.
13386
13387 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13388 executable. This results in similar optimizations as @samp{exec}
13389 except that @option{-fpie} is not disabled if specified at compilation
13390 time.
13391
13392 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13393 done. The sections containing intermediate code for link-time optimization are
13394 merged, pre-optimized, and output to the resulting object file. In addition, if
13395 @option{-ffat-lto-objects} is specified, binary code is produced for future
13396 non-LTO linking. The object file produced by incremental linking is smaller
13397 than a static library produced from the same object files. At link time the
13398 result of incremental linking also loads faster than a static
13399 library assuming that the majority of objects in the library are used.
13400
13401 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13402 code generation is forced, a final binary is produced, and the intermediate
13403 code for later link-time optimization is stripped. When multiple object files
13404 are linked together the resulting code is better optimized than with
13405 link-time optimizations disabled (for example, cross-module inlining
13406 happens), but most of benefits of whole program optimizations are lost.
13407
13408 During the incremental link (by @option{-r}) the linker plugin defaults to
13409 @option{rel}. With current interfaces to GNU Binutils it is however not
13410 possible to incrementally link LTO objects and non-LTO objects into a single
13411 mixed object file. If any of object files in incremental link cannot
13412 be used for link-time optimization, the linker plugin issues a warning and
13413 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13414 recommended to link such objects into static library instead. Alternatively it
13415 is possible to use H.J. Lu's binutils with support for mixed objects.
13416
13417 @item -fuse-ld=bfd
13418 @opindex fuse-ld=bfd
13419 Use the @command{bfd} linker instead of the default linker.
13420
13421 @item -fuse-ld=gold
13422 @opindex fuse-ld=gold
13423 Use the @command{gold} linker instead of the default linker.
13424
13425 @item -fuse-ld=lld
13426 @opindex fuse-ld=lld
13427 Use the LLVM @command{lld} linker instead of the default linker.
13428
13429 @cindex Libraries
13430 @item -l@var{library}
13431 @itemx -l @var{library}
13432 @opindex l
13433 Search the library named @var{library} when linking. (The second
13434 alternative with the library as a separate argument is only for
13435 POSIX compliance and is not recommended.)
13436
13437 The @option{-l} option is passed directly to the linker by GCC. Refer
13438 to your linker documentation for exact details. The general
13439 description below applies to the GNU linker.
13440
13441 The linker searches a standard list of directories for the library.
13442 The directories searched include several standard system directories
13443 plus any that you specify with @option{-L}.
13444
13445 Static libraries are archives of object files, and have file names
13446 like @file{lib@var{library}.a}. Some targets also support shared
13447 libraries, which typically have names like @file{lib@var{library}.so}.
13448 If both static and shared libraries are found, the linker gives
13449 preference to linking with the shared library unless the
13450 @option{-static} option is used.
13451
13452 It makes a difference where in the command you write this option; the
13453 linker searches and processes libraries and object files in the order they
13454 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13455 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13456 to functions in @samp{z}, those functions may not be loaded.
13457
13458 @item -lobjc
13459 @opindex lobjc
13460 You need this special case of the @option{-l} option in order to
13461 link an Objective-C or Objective-C++ program.
13462
13463 @item -nostartfiles
13464 @opindex nostartfiles
13465 Do not use the standard system startup files when linking.
13466 The standard system libraries are used normally, unless @option{-nostdlib},
13467 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13468
13469 @item -nodefaultlibs
13470 @opindex nodefaultlibs
13471 Do not use the standard system libraries when linking.
13472 Only the libraries you specify are passed to the linker, and options
13473 specifying linkage of the system libraries, such as @option{-static-libgcc}
13474 or @option{-shared-libgcc}, are ignored.
13475 The standard startup files are used normally, unless @option{-nostartfiles}
13476 is used.
13477
13478 The compiler may generate calls to @code{memcmp},
13479 @code{memset}, @code{memcpy} and @code{memmove}.
13480 These entries are usually resolved by entries in
13481 libc. These entry points should be supplied through some other
13482 mechanism when this option is specified.
13483
13484 @item -nolibc
13485 @opindex nolibc
13486 Do not use the C library or system libraries tightly coupled with it when
13487 linking. Still link with the startup files, @file{libgcc} or toolchain
13488 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13489 or @file{libstdc++} unless options preventing their inclusion are used as
13490 well. This typically removes @option{-lc} from the link command line, as well
13491 as system libraries that normally go with it and become meaningless when
13492 absence of a C library is assumed, for example @option{-lpthread} or
13493 @option{-lm} in some configurations. This is intended for bare-board
13494 targets when there is indeed no C library available.
13495
13496 @item -nostdlib
13497 @opindex nostdlib
13498 Do not use the standard system startup files or libraries when linking.
13499 No startup files and only the libraries you specify are passed to
13500 the linker, and options specifying linkage of the system libraries, such as
13501 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13502
13503 The compiler may generate calls to @code{memcmp}, @code{memset},
13504 @code{memcpy} and @code{memmove}.
13505 These entries are usually resolved by entries in
13506 libc. These entry points should be supplied through some other
13507 mechanism when this option is specified.
13508
13509 @cindex @option{-lgcc}, use with @option{-nostdlib}
13510 @cindex @option{-nostdlib} and unresolved references
13511 @cindex unresolved references and @option{-nostdlib}
13512 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13513 @cindex @option{-nodefaultlibs} and unresolved references
13514 @cindex unresolved references and @option{-nodefaultlibs}
13515 One of the standard libraries bypassed by @option{-nostdlib} and
13516 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13517 which GCC uses to overcome shortcomings of particular machines, or special
13518 needs for some languages.
13519 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13520 Collection (GCC) Internals},
13521 for more discussion of @file{libgcc.a}.)
13522 In most cases, you need @file{libgcc.a} even when you want to avoid
13523 other standard libraries. In other words, when you specify @option{-nostdlib}
13524 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13525 This ensures that you have no unresolved references to internal GCC
13526 library subroutines.
13527 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13528 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13529 GNU Compiler Collection (GCC) Internals}.)
13530
13531 @item -e @var{entry}
13532 @itemx --entry=@var{entry}
13533 @opindex e
13534 @opindex entry
13535
13536 Specify that the program entry point is @var{entry}. The argument is
13537 interpreted by the linker; the GNU linker accepts either a symbol name
13538 or an address.
13539
13540 @item -pie
13541 @opindex pie
13542 Produce a dynamically linked position independent executable on targets
13543 that support it. For predictable results, you must also specify the same
13544 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13545 or model suboptions) when you specify this linker option.
13546
13547 @item -no-pie
13548 @opindex no-pie
13549 Don't produce a dynamically linked position independent executable.
13550
13551 @item -static-pie
13552 @opindex static-pie
13553 Produce a static position independent executable on targets that support
13554 it. A static position independent executable is similar to a static
13555 executable, but can be loaded at any address without a dynamic linker.
13556 For predictable results, you must also specify the same set of options
13557 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13558 suboptions) when you specify this linker option.
13559
13560 @item -pthread
13561 @opindex pthread
13562 Link with the POSIX threads library. This option is supported on
13563 GNU/Linux targets, most other Unix derivatives, and also on
13564 x86 Cygwin and MinGW targets. On some targets this option also sets
13565 flags for the preprocessor, so it should be used consistently for both
13566 compilation and linking.
13567
13568 @item -r
13569 @opindex r
13570 Produce a relocatable object as output. This is also known as partial
13571 linking.
13572
13573 @item -rdynamic
13574 @opindex rdynamic
13575 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13576 that support it. This instructs the linker to add all symbols, not
13577 only used ones, to the dynamic symbol table. This option is needed
13578 for some uses of @code{dlopen} or to allow obtaining backtraces
13579 from within a program.
13580
13581 @item -s
13582 @opindex s
13583 Remove all symbol table and relocation information from the executable.
13584
13585 @item -static
13586 @opindex static
13587 On systems that support dynamic linking, this overrides @option{-pie}
13588 and prevents linking with the shared libraries. On other systems, this
13589 option has no effect.
13590
13591 @item -shared
13592 @opindex shared
13593 Produce a shared object which can then be linked with other objects to
13594 form an executable. Not all systems support this option. For predictable
13595 results, you must also specify the same set of options used for compilation
13596 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13597 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13598 needs to build supplementary stub code for constructors to work. On
13599 multi-libbed systems, @samp{gcc -shared} must select the correct support
13600 libraries to link against. Failing to supply the correct flags may lead
13601 to subtle defects. Supplying them in cases where they are not necessary
13602 is innocuous.}
13603
13604 @item -shared-libgcc
13605 @itemx -static-libgcc
13606 @opindex shared-libgcc
13607 @opindex static-libgcc
13608 On systems that provide @file{libgcc} as a shared library, these options
13609 force the use of either the shared or static version, respectively.
13610 If no shared version of @file{libgcc} was built when the compiler was
13611 configured, these options have no effect.
13612
13613 There are several situations in which an application should use the
13614 shared @file{libgcc} instead of the static version. The most common
13615 of these is when the application wishes to throw and catch exceptions
13616 across different shared libraries. In that case, each of the libraries
13617 as well as the application itself should use the shared @file{libgcc}.
13618
13619 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13620 whenever you build a shared library or a main executable, because C++
13621 programs typically use exceptions, so this is the right thing to do.
13622
13623 If, instead, you use the GCC driver to create shared libraries, you may
13624 find that they are not always linked with the shared @file{libgcc}.
13625 If GCC finds, at its configuration time, that you have a non-GNU linker
13626 or a GNU linker that does not support option @option{--eh-frame-hdr},
13627 it links the shared version of @file{libgcc} into shared libraries
13628 by default. Otherwise, it takes advantage of the linker and optimizes
13629 away the linking with the shared version of @file{libgcc}, linking with
13630 the static version of libgcc by default. This allows exceptions to
13631 propagate through such shared libraries, without incurring relocation
13632 costs at library load time.
13633
13634 However, if a library or main executable is supposed to throw or catch
13635 exceptions, you must link it using the G++ driver, or using the option
13636 @option{-shared-libgcc}, such that it is linked with the shared
13637 @file{libgcc}.
13638
13639 @item -static-libasan
13640 @opindex static-libasan
13641 When the @option{-fsanitize=address} option is used to link a program,
13642 the GCC driver automatically links against @option{libasan}. If
13643 @file{libasan} is available as a shared library, and the @option{-static}
13644 option is not used, then this links against the shared version of
13645 @file{libasan}. The @option{-static-libasan} option directs the GCC
13646 driver to link @file{libasan} statically, without necessarily linking
13647 other libraries statically.
13648
13649 @item -static-libtsan
13650 @opindex static-libtsan
13651 When the @option{-fsanitize=thread} option is used to link a program,
13652 the GCC driver automatically links against @option{libtsan}. If
13653 @file{libtsan} is available as a shared library, and the @option{-static}
13654 option is not used, then this links against the shared version of
13655 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13656 driver to link @file{libtsan} statically, without necessarily linking
13657 other libraries statically.
13658
13659 @item -static-liblsan
13660 @opindex static-liblsan
13661 When the @option{-fsanitize=leak} option is used to link a program,
13662 the GCC driver automatically links against @option{liblsan}. If
13663 @file{liblsan} is available as a shared library, and the @option{-static}
13664 option is not used, then this links against the shared version of
13665 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13666 driver to link @file{liblsan} statically, without necessarily linking
13667 other libraries statically.
13668
13669 @item -static-libubsan
13670 @opindex static-libubsan
13671 When the @option{-fsanitize=undefined} option is used to link a program,
13672 the GCC driver automatically links against @option{libubsan}. If
13673 @file{libubsan} is available as a shared library, and the @option{-static}
13674 option is not used, then this links against the shared version of
13675 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13676 driver to link @file{libubsan} statically, without necessarily linking
13677 other libraries statically.
13678
13679 @item -static-libstdc++
13680 @opindex static-libstdc++
13681 When the @command{g++} program is used to link a C++ program, it
13682 normally automatically links against @option{libstdc++}. If
13683 @file{libstdc++} is available as a shared library, and the
13684 @option{-static} option is not used, then this links against the
13685 shared version of @file{libstdc++}. That is normally fine. However, it
13686 is sometimes useful to freeze the version of @file{libstdc++} used by
13687 the program without going all the way to a fully static link. The
13688 @option{-static-libstdc++} option directs the @command{g++} driver to
13689 link @file{libstdc++} statically, without necessarily linking other
13690 libraries statically.
13691
13692 @item -symbolic
13693 @opindex symbolic
13694 Bind references to global symbols when building a shared object. Warn
13695 about any unresolved references (unless overridden by the link editor
13696 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13697 this option.
13698
13699 @item -T @var{script}
13700 @opindex T
13701 @cindex linker script
13702 Use @var{script} as the linker script. This option is supported by most
13703 systems using the GNU linker. On some targets, such as bare-board
13704 targets without an operating system, the @option{-T} option may be required
13705 when linking to avoid references to undefined symbols.
13706
13707 @item -Xlinker @var{option}
13708 @opindex Xlinker
13709 Pass @var{option} as an option to the linker. You can use this to
13710 supply system-specific linker options that GCC does not recognize.
13711
13712 If you want to pass an option that takes a separate argument, you must use
13713 @option{-Xlinker} twice, once for the option and once for the argument.
13714 For example, to pass @option{-assert definitions}, you must write
13715 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13716 @option{-Xlinker "-assert definitions"}, because this passes the entire
13717 string as a single argument, which is not what the linker expects.
13718
13719 When using the GNU linker, it is usually more convenient to pass
13720 arguments to linker options using the @option{@var{option}=@var{value}}
13721 syntax than as separate arguments. For example, you can specify
13722 @option{-Xlinker -Map=output.map} rather than
13723 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13724 this syntax for command-line options.
13725
13726 @item -Wl,@var{option}
13727 @opindex Wl
13728 Pass @var{option} as an option to the linker. If @var{option} contains
13729 commas, it is split into multiple options at the commas. You can use this
13730 syntax to pass an argument to the option.
13731 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13732 linker. When using the GNU linker, you can also get the same effect with
13733 @option{-Wl,-Map=output.map}.
13734
13735 @item -u @var{symbol}
13736 @opindex u
13737 Pretend the symbol @var{symbol} is undefined, to force linking of
13738 library modules to define it. You can use @option{-u} multiple times with
13739 different symbols to force loading of additional library modules.
13740
13741 @item -z @var{keyword}
13742 @opindex z
13743 @option{-z} is passed directly on to the linker along with the keyword
13744 @var{keyword}. See the section in the documentation of your linker for
13745 permitted values and their meanings.
13746 @end table
13747
13748 @node Directory Options
13749 @section Options for Directory Search
13750 @cindex directory options
13751 @cindex options, directory search
13752 @cindex search path
13753
13754 These options specify directories to search for header files, for
13755 libraries and for parts of the compiler:
13756
13757 @table @gcctabopt
13758 @include cppdiropts.texi
13759
13760 @item -iplugindir=@var{dir}
13761 @opindex iplugindir=
13762 Set the directory to search for plugins that are passed
13763 by @option{-fplugin=@var{name}} instead of
13764 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13765 to be used by the user, but only passed by the driver.
13766
13767 @item -L@var{dir}
13768 @opindex L
13769 Add directory @var{dir} to the list of directories to be searched
13770 for @option{-l}.
13771
13772 @item -B@var{prefix}
13773 @opindex B
13774 This option specifies where to find the executables, libraries,
13775 include files, and data files of the compiler itself.
13776
13777 The compiler driver program runs one or more of the subprograms
13778 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13779 @var{prefix} as a prefix for each program it tries to run, both with and
13780 without @samp{@var{machine}/@var{version}/} for the corresponding target
13781 machine and compiler version.
13782
13783 For each subprogram to be run, the compiler driver first tries the
13784 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13785 is not specified, the driver tries two standard prefixes,
13786 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13787 those results in a file name that is found, the unmodified program
13788 name is searched for using the directories specified in your
13789 @env{PATH} environment variable.
13790
13791 The compiler checks to see if the path provided by @option{-B}
13792 refers to a directory, and if necessary it adds a directory
13793 separator character at the end of the path.
13794
13795 @option{-B} prefixes that effectively specify directory names also apply
13796 to libraries in the linker, because the compiler translates these
13797 options into @option{-L} options for the linker. They also apply to
13798 include files in the preprocessor, because the compiler translates these
13799 options into @option{-isystem} options for the preprocessor. In this case,
13800 the compiler appends @samp{include} to the prefix.
13801
13802 The runtime support file @file{libgcc.a} can also be searched for using
13803 the @option{-B} prefix, if needed. If it is not found there, the two
13804 standard prefixes above are tried, and that is all. The file is left
13805 out of the link if it is not found by those means.
13806
13807 Another way to specify a prefix much like the @option{-B} prefix is to use
13808 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13809 Variables}.
13810
13811 As a special kludge, if the path provided by @option{-B} is
13812 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13813 9, then it is replaced by @file{[dir/]include}. This is to help
13814 with boot-strapping the compiler.
13815
13816 @item -no-canonical-prefixes
13817 @opindex no-canonical-prefixes
13818 Do not expand any symbolic links, resolve references to @samp{/../}
13819 or @samp{/./}, or make the path absolute when generating a relative
13820 prefix.
13821
13822 @item --sysroot=@var{dir}
13823 @opindex sysroot
13824 Use @var{dir} as the logical root directory for headers and libraries.
13825 For example, if the compiler normally searches for headers in
13826 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13827 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13828
13829 If you use both this option and the @option{-isysroot} option, then
13830 the @option{--sysroot} option applies to libraries, but the
13831 @option{-isysroot} option applies to header files.
13832
13833 The GNU linker (beginning with version 2.16) has the necessary support
13834 for this option. If your linker does not support this option, the
13835 header file aspect of @option{--sysroot} still works, but the
13836 library aspect does not.
13837
13838 @item --no-sysroot-suffix
13839 @opindex no-sysroot-suffix
13840 For some targets, a suffix is added to the root directory specified
13841 with @option{--sysroot}, depending on the other options used, so that
13842 headers may for example be found in
13843 @file{@var{dir}/@var{suffix}/usr/include} instead of
13844 @file{@var{dir}/usr/include}. This option disables the addition of
13845 such a suffix.
13846
13847 @end table
13848
13849 @node Code Gen Options
13850 @section Options for Code Generation Conventions
13851 @cindex code generation conventions
13852 @cindex options, code generation
13853 @cindex run-time options
13854
13855 These machine-independent options control the interface conventions
13856 used in code generation.
13857
13858 Most of them have both positive and negative forms; the negative form
13859 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13860 one of the forms is listed---the one that is not the default. You
13861 can figure out the other form by either removing @samp{no-} or adding
13862 it.
13863
13864 @table @gcctabopt
13865 @item -fstack-reuse=@var{reuse-level}
13866 @opindex fstack_reuse
13867 This option controls stack space reuse for user declared local/auto variables
13868 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13869 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13870 local variables and temporaries, @samp{named_vars} enables the reuse only for
13871 user defined local variables with names, and @samp{none} disables stack reuse
13872 completely. The default value is @samp{all}. The option is needed when the
13873 program extends the lifetime of a scoped local variable or a compiler generated
13874 temporary beyond the end point defined by the language. When a lifetime of
13875 a variable ends, and if the variable lives in memory, the optimizing compiler
13876 has the freedom to reuse its stack space with other temporaries or scoped
13877 local variables whose live range does not overlap with it. Legacy code extending
13878 local lifetime is likely to break with the stack reuse optimization.
13879
13880 For example,
13881
13882 @smallexample
13883 int *p;
13884 @{
13885 int local1;
13886
13887 p = &local1;
13888 local1 = 10;
13889 ....
13890 @}
13891 @{
13892 int local2;
13893 local2 = 20;
13894 ...
13895 @}
13896
13897 if (*p == 10) // out of scope use of local1
13898 @{
13899
13900 @}
13901 @end smallexample
13902
13903 Another example:
13904 @smallexample
13905
13906 struct A
13907 @{
13908 A(int k) : i(k), j(k) @{ @}
13909 int i;
13910 int j;
13911 @};
13912
13913 A *ap;
13914
13915 void foo(const A& ar)
13916 @{
13917 ap = &ar;
13918 @}
13919
13920 void bar()
13921 @{
13922 foo(A(10)); // temp object's lifetime ends when foo returns
13923
13924 @{
13925 A a(20);
13926 ....
13927 @}
13928 ap->i+= 10; // ap references out of scope temp whose space
13929 // is reused with a. What is the value of ap->i?
13930 @}
13931
13932 @end smallexample
13933
13934 The lifetime of a compiler generated temporary is well defined by the C++
13935 standard. When a lifetime of a temporary ends, and if the temporary lives
13936 in memory, the optimizing compiler has the freedom to reuse its stack
13937 space with other temporaries or scoped local variables whose live range
13938 does not overlap with it. However some of the legacy code relies on
13939 the behavior of older compilers in which temporaries' stack space is
13940 not reused, the aggressive stack reuse can lead to runtime errors. This
13941 option is used to control the temporary stack reuse optimization.
13942
13943 @item -ftrapv
13944 @opindex ftrapv
13945 This option generates traps for signed overflow on addition, subtraction,
13946 multiplication operations.
13947 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13948 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13949 @option{-fwrapv} being effective. Note that only active options override, so
13950 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13951 results in @option{-ftrapv} being effective.
13952
13953 @item -fwrapv
13954 @opindex fwrapv
13955 This option instructs the compiler to assume that signed arithmetic
13956 overflow of addition, subtraction and multiplication wraps around
13957 using twos-complement representation. This flag enables some optimizations
13958 and disables others.
13959 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13960 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13961 @option{-fwrapv} being effective. Note that only active options override, so
13962 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13963 results in @option{-ftrapv} being effective.
13964
13965 @item -fwrapv-pointer
13966 @opindex fwrapv-pointer
13967 This option instructs the compiler to assume that pointer arithmetic
13968 overflow on addition and subtraction wraps around using twos-complement
13969 representation. This flag disables some optimizations which assume
13970 pointer overflow is invalid.
13971
13972 @item -fstrict-overflow
13973 @opindex fstrict-overflow
13974 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13975 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13976
13977 @item -fexceptions
13978 @opindex fexceptions
13979 Enable exception handling. Generates extra code needed to propagate
13980 exceptions. For some targets, this implies GCC generates frame
13981 unwind information for all functions, which can produce significant data
13982 size overhead, although it does not affect execution. If you do not
13983 specify this option, GCC enables it by default for languages like
13984 C++ that normally require exception handling, and disables it for
13985 languages like C that do not normally require it. However, you may need
13986 to enable this option when compiling C code that needs to interoperate
13987 properly with exception handlers written in C++. You may also wish to
13988 disable this option if you are compiling older C++ programs that don't
13989 use exception handling.
13990
13991 @item -fnon-call-exceptions
13992 @opindex fnon-call-exceptions
13993 Generate code that allows trapping instructions to throw exceptions.
13994 Note that this requires platform-specific runtime support that does
13995 not exist everywhere. Moreover, it only allows @emph{trapping}
13996 instructions to throw exceptions, i.e.@: memory references or floating-point
13997 instructions. It does not allow exceptions to be thrown from
13998 arbitrary signal handlers such as @code{SIGALRM}.
13999
14000 @item -fdelete-dead-exceptions
14001 @opindex fdelete-dead-exceptions
14002 Consider that instructions that may throw exceptions but don't otherwise
14003 contribute to the execution of the program can be optimized away.
14004 This option is enabled by default for the Ada front end, as permitted by
14005 the Ada language specification.
14006 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14007
14008 @item -funwind-tables
14009 @opindex funwind-tables
14010 Similar to @option{-fexceptions}, except that it just generates any needed
14011 static data, but does not affect the generated code in any other way.
14012 You normally do not need to enable this option; instead, a language processor
14013 that needs this handling enables it on your behalf.
14014
14015 @item -fasynchronous-unwind-tables
14016 @opindex fasynchronous-unwind-tables
14017 Generate unwind table in DWARF format, if supported by target machine. The
14018 table is exact at each instruction boundary, so it can be used for stack
14019 unwinding from asynchronous events (such as debugger or garbage collector).
14020
14021 @item -fno-gnu-unique
14022 @opindex fno-gnu-unique
14023 @opindex fgnu-unique
14024 On systems with recent GNU assembler and C library, the C++ compiler
14025 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14026 of template static data members and static local variables in inline
14027 functions are unique even in the presence of @code{RTLD_LOCAL}; this
14028 is necessary to avoid problems with a library used by two different
14029 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
14030 therefore disagreeing with the other one about the binding of the
14031 symbol. But this causes @code{dlclose} to be ignored for affected
14032 DSOs; if your program relies on reinitialization of a DSO via
14033 @code{dlclose} and @code{dlopen}, you can use
14034 @option{-fno-gnu-unique}.
14035
14036 @item -fpcc-struct-return
14037 @opindex fpcc-struct-return
14038 Return ``short'' @code{struct} and @code{union} values in memory like
14039 longer ones, rather than in registers. This convention is less
14040 efficient, but it has the advantage of allowing intercallability between
14041 GCC-compiled files and files compiled with other compilers, particularly
14042 the Portable C Compiler (pcc).
14043
14044 The precise convention for returning structures in memory depends
14045 on the target configuration macros.
14046
14047 Short structures and unions are those whose size and alignment match
14048 that of some integer type.
14049
14050 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14051 switch is not binary compatible with code compiled with the
14052 @option{-freg-struct-return} switch.
14053 Use it to conform to a non-default application binary interface.
14054
14055 @item -freg-struct-return
14056 @opindex freg-struct-return
14057 Return @code{struct} and @code{union} values in registers when possible.
14058 This is more efficient for small structures than
14059 @option{-fpcc-struct-return}.
14060
14061 If you specify neither @option{-fpcc-struct-return} nor
14062 @option{-freg-struct-return}, GCC defaults to whichever convention is
14063 standard for the target. If there is no standard convention, GCC
14064 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14065 the principal compiler. In those cases, we can choose the standard, and
14066 we chose the more efficient register return alternative.
14067
14068 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14069 switch is not binary compatible with code compiled with the
14070 @option{-fpcc-struct-return} switch.
14071 Use it to conform to a non-default application binary interface.
14072
14073 @item -fshort-enums
14074 @opindex fshort-enums
14075 Allocate to an @code{enum} type only as many bytes as it needs for the
14076 declared range of possible values. Specifically, the @code{enum} type
14077 is equivalent to the smallest integer type that has enough room.
14078
14079 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14080 code that is not binary compatible with code generated without that switch.
14081 Use it to conform to a non-default application binary interface.
14082
14083 @item -fshort-wchar
14084 @opindex fshort-wchar
14085 Override the underlying type for @code{wchar_t} to be @code{short
14086 unsigned int} instead of the default for the target. This option is
14087 useful for building programs to run under WINE@.
14088
14089 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14090 code that is not binary compatible with code generated without that switch.
14091 Use it to conform to a non-default application binary interface.
14092
14093 @item -fno-common
14094 @opindex fno-common
14095 @opindex fcommon
14096 @cindex tentative definitions
14097 In C code, this option controls the placement of global variables
14098 defined without an initializer, known as @dfn{tentative definitions}
14099 in the C standard. Tentative definitions are distinct from declarations
14100 of a variable with the @code{extern} keyword, which do not allocate storage.
14101
14102 Unix C compilers have traditionally allocated storage for
14103 uninitialized global variables in a common block. This allows the
14104 linker to resolve all tentative definitions of the same variable
14105 in different compilation units to the same object, or to a non-tentative
14106 definition.
14107 This is the behavior specified by @option{-fcommon}, and is the default for
14108 GCC on most targets.
14109 On the other hand, this behavior is not required by ISO
14110 C, and on some targets may carry a speed or code size penalty on
14111 variable references.
14112
14113 The @option{-fno-common} option specifies that the compiler should instead
14114 place uninitialized global variables in the BSS section of the object file.
14115 This inhibits the merging of tentative definitions by the linker so
14116 you get a multiple-definition error if the same
14117 variable is defined in more than one compilation unit.
14118 Compiling with @option{-fno-common} is useful on targets for which
14119 it provides better performance, or if you wish to verify that the
14120 program will work on other systems that always treat uninitialized
14121 variable definitions this way.
14122
14123 @item -fno-ident
14124 @opindex fno-ident
14125 @opindex fident
14126 Ignore the @code{#ident} directive.
14127
14128 @item -finhibit-size-directive
14129 @opindex finhibit-size-directive
14130 Don't output a @code{.size} assembler directive, or anything else that
14131 would cause trouble if the function is split in the middle, and the
14132 two halves are placed at locations far apart in memory. This option is
14133 used when compiling @file{crtstuff.c}; you should not need to use it
14134 for anything else.
14135
14136 @item -fverbose-asm
14137 @opindex fverbose-asm
14138 Put extra commentary information in the generated assembly code to
14139 make it more readable. This option is generally only of use to those
14140 who actually need to read the generated assembly code (perhaps while
14141 debugging the compiler itself).
14142
14143 @option{-fno-verbose-asm}, the default, causes the
14144 extra information to be omitted and is useful when comparing two assembler
14145 files.
14146
14147 The added comments include:
14148
14149 @itemize @bullet
14150
14151 @item
14152 information on the compiler version and command-line options,
14153
14154 @item
14155 the source code lines associated with the assembly instructions,
14156 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14157
14158 @item
14159 hints on which high-level expressions correspond to
14160 the various assembly instruction operands.
14161
14162 @end itemize
14163
14164 For example, given this C source file:
14165
14166 @smallexample
14167 int test (int n)
14168 @{
14169 int i;
14170 int total = 0;
14171
14172 for (i = 0; i < n; i++)
14173 total += i * i;
14174
14175 return total;
14176 @}
14177 @end smallexample
14178
14179 compiling to (x86_64) assembly via @option{-S} and emitting the result
14180 direct to stdout via @option{-o} @option{-}
14181
14182 @smallexample
14183 gcc -S test.c -fverbose-asm -Os -o -
14184 @end smallexample
14185
14186 gives output similar to this:
14187
14188 @smallexample
14189 .file "test.c"
14190 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14191 [...snip...]
14192 # options passed:
14193 [...snip...]
14194
14195 .text
14196 .globl test
14197 .type test, @@function
14198 test:
14199 .LFB0:
14200 .cfi_startproc
14201 # test.c:4: int total = 0;
14202 xorl %eax, %eax # <retval>
14203 # test.c:6: for (i = 0; i < n; i++)
14204 xorl %edx, %edx # i
14205 .L2:
14206 # test.c:6: for (i = 0; i < n; i++)
14207 cmpl %edi, %edx # n, i
14208 jge .L5 #,
14209 # test.c:7: total += i * i;
14210 movl %edx, %ecx # i, tmp92
14211 imull %edx, %ecx # i, tmp92
14212 # test.c:6: for (i = 0; i < n; i++)
14213 incl %edx # i
14214 # test.c:7: total += i * i;
14215 addl %ecx, %eax # tmp92, <retval>
14216 jmp .L2 #
14217 .L5:
14218 # test.c:10: @}
14219 ret
14220 .cfi_endproc
14221 .LFE0:
14222 .size test, .-test
14223 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14224 .section .note.GNU-stack,"",@@progbits
14225 @end smallexample
14226
14227 The comments are intended for humans rather than machines and hence the
14228 precise format of the comments is subject to change.
14229
14230 @item -frecord-gcc-switches
14231 @opindex frecord-gcc-switches
14232 This switch causes the command line used to invoke the
14233 compiler to be recorded into the object file that is being created.
14234 This switch is only implemented on some targets and the exact format
14235 of the recording is target and binary file format dependent, but it
14236 usually takes the form of a section containing ASCII text. This
14237 switch is related to the @option{-fverbose-asm} switch, but that
14238 switch only records information in the assembler output file as
14239 comments, so it never reaches the object file.
14240 See also @option{-grecord-gcc-switches} for another
14241 way of storing compiler options into the object file.
14242
14243 @item -fpic
14244 @opindex fpic
14245 @cindex global offset table
14246 @cindex PIC
14247 Generate position-independent code (PIC) suitable for use in a shared
14248 library, if supported for the target machine. Such code accesses all
14249 constant addresses through a global offset table (GOT)@. The dynamic
14250 loader resolves the GOT entries when the program starts (the dynamic
14251 loader is not part of GCC; it is part of the operating system). If
14252 the GOT size for the linked executable exceeds a machine-specific
14253 maximum size, you get an error message from the linker indicating that
14254 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14255 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14256 on the m68k and RS/6000. The x86 has no such limit.)
14257
14258 Position-independent code requires special support, and therefore works
14259 only on certain machines. For the x86, GCC supports PIC for System V
14260 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14261 position-independent.
14262
14263 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14264 are defined to 1.
14265
14266 @item -fPIC
14267 @opindex fPIC
14268 If supported for the target machine, emit position-independent code,
14269 suitable for dynamic linking and avoiding any limit on the size of the
14270 global offset table. This option makes a difference on AArch64, m68k,
14271 PowerPC and SPARC@.
14272
14273 Position-independent code requires special support, and therefore works
14274 only on certain machines.
14275
14276 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14277 are defined to 2.
14278
14279 @item -fpie
14280 @itemx -fPIE
14281 @opindex fpie
14282 @opindex fPIE
14283 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14284 generated position-independent code can be only linked into executables.
14285 Usually these options are used to compile code that will be linked using
14286 the @option{-pie} GCC option.
14287
14288 @option{-fpie} and @option{-fPIE} both define the macros
14289 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14290 for @option{-fpie} and 2 for @option{-fPIE}.
14291
14292 @item -fno-plt
14293 @opindex fno-plt
14294 @opindex fplt
14295 Do not use the PLT for external function calls in position-independent code.
14296 Instead, load the callee address at call sites from the GOT and branch to it.
14297 This leads to more efficient code by eliminating PLT stubs and exposing
14298 GOT loads to optimizations. On architectures such as 32-bit x86 where
14299 PLT stubs expect the GOT pointer in a specific register, this gives more
14300 register allocation freedom to the compiler.
14301 Lazy binding requires use of the PLT;
14302 with @option{-fno-plt} all external symbols are resolved at load time.
14303
14304 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14305 through the PLT for specific external functions.
14306
14307 In position-dependent code, a few targets also convert calls to
14308 functions that are marked to not use the PLT to use the GOT instead.
14309
14310 @item -fno-jump-tables
14311 @opindex fno-jump-tables
14312 @opindex fjump-tables
14313 Do not use jump tables for switch statements even where it would be
14314 more efficient than other code generation strategies. This option is
14315 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14316 building code that forms part of a dynamic linker and cannot
14317 reference the address of a jump table. On some targets, jump tables
14318 do not require a GOT and this option is not needed.
14319
14320 @item -ffixed-@var{reg}
14321 @opindex ffixed
14322 Treat the register named @var{reg} as a fixed register; generated code
14323 should never refer to it (except perhaps as a stack pointer, frame
14324 pointer or in some other fixed role).
14325
14326 @var{reg} must be the name of a register. The register names accepted
14327 are machine-specific and are defined in the @code{REGISTER_NAMES}
14328 macro in the machine description macro file.
14329
14330 This flag does not have a negative form, because it specifies a
14331 three-way choice.
14332
14333 @item -fcall-used-@var{reg}
14334 @opindex fcall-used
14335 Treat the register named @var{reg} as an allocable register that is
14336 clobbered by function calls. It may be allocated for temporaries or
14337 variables that do not live across a call. Functions compiled this way
14338 do not save and restore the register @var{reg}.
14339
14340 It is an error to use this flag with the frame pointer or stack pointer.
14341 Use of this flag for other registers that have fixed pervasive roles in
14342 the machine's execution model produces disastrous results.
14343
14344 This flag does not have a negative form, because it specifies a
14345 three-way choice.
14346
14347 @item -fcall-saved-@var{reg}
14348 @opindex fcall-saved
14349 Treat the register named @var{reg} as an allocable register saved by
14350 functions. It may be allocated even for temporaries or variables that
14351 live across a call. Functions compiled this way save and restore
14352 the register @var{reg} if they use it.
14353
14354 It is an error to use this flag with the frame pointer or stack pointer.
14355 Use of this flag for other registers that have fixed pervasive roles in
14356 the machine's execution model produces disastrous results.
14357
14358 A different sort of disaster results from the use of this flag for
14359 a register in which function values may be returned.
14360
14361 This flag does not have a negative form, because it specifies a
14362 three-way choice.
14363
14364 @item -fpack-struct[=@var{n}]
14365 @opindex fpack-struct
14366 Without a value specified, pack all structure members together without
14367 holes. When a value is specified (which must be a small power of two), pack
14368 structure members according to this value, representing the maximum
14369 alignment (that is, objects with default alignment requirements larger than
14370 this are output potentially unaligned at the next fitting location.
14371
14372 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14373 code that is not binary compatible with code generated without that switch.
14374 Additionally, it makes the code suboptimal.
14375 Use it to conform to a non-default application binary interface.
14376
14377 @item -fleading-underscore
14378 @opindex fleading-underscore
14379 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14380 change the way C symbols are represented in the object file. One use
14381 is to help link with legacy assembly code.
14382
14383 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14384 generate code that is not binary compatible with code generated without that
14385 switch. Use it to conform to a non-default application binary interface.
14386 Not all targets provide complete support for this switch.
14387
14388 @item -ftls-model=@var{model}
14389 @opindex ftls-model
14390 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14391 The @var{model} argument should be one of @samp{global-dynamic},
14392 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14393 Note that the choice is subject to optimization: the compiler may use
14394 a more efficient model for symbols not visible outside of the translation
14395 unit, or if @option{-fpic} is not given on the command line.
14396
14397 The default without @option{-fpic} is @samp{initial-exec}; with
14398 @option{-fpic} the default is @samp{global-dynamic}.
14399
14400 @item -ftrampolines
14401 @opindex ftrampolines
14402 For targets that normally need trampolines for nested functions, always
14403 generate them instead of using descriptors. Otherwise, for targets that
14404 do not need them, like for example HP-PA or IA-64, do nothing.
14405
14406 A trampoline is a small piece of code that is created at run time on the
14407 stack when the address of a nested function is taken, and is used to call
14408 the nested function indirectly. Therefore, it requires the stack to be
14409 made executable in order for the program to work properly.
14410
14411 @option{-fno-trampolines} is enabled by default on a language by language
14412 basis to let the compiler avoid generating them, if it computes that this
14413 is safe, and replace them with descriptors. Descriptors are made up of data
14414 only, but the generated code must be prepared to deal with them. As of this
14415 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14416
14417 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14418 @option{-fno-trampolines} are not binary compatible if nested functions are
14419 present. This option must therefore be used on a program-wide basis and be
14420 manipulated with extreme care.
14421
14422 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14423 @opindex fvisibility
14424 Set the default ELF image symbol visibility to the specified option---all
14425 symbols are marked with this unless overridden within the code.
14426 Using this feature can very substantially improve linking and
14427 load times of shared object libraries, produce more optimized
14428 code, provide near-perfect API export and prevent symbol clashes.
14429 It is @strong{strongly} recommended that you use this in any shared objects
14430 you distribute.
14431
14432 Despite the nomenclature, @samp{default} always means public; i.e.,
14433 available to be linked against from outside the shared object.
14434 @samp{protected} and @samp{internal} are pretty useless in real-world
14435 usage so the only other commonly used option is @samp{hidden}.
14436 The default if @option{-fvisibility} isn't specified is
14437 @samp{default}, i.e., make every symbol public.
14438
14439 A good explanation of the benefits offered by ensuring ELF
14440 symbols have the correct visibility is given by ``How To Write
14441 Shared Libraries'' by Ulrich Drepper (which can be found at
14442 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14443 solution made possible by this option to marking things hidden when
14444 the default is public is to make the default hidden and mark things
14445 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14446 and @code{__attribute__ ((visibility("default")))} instead of
14447 @code{__declspec(dllexport)} you get almost identical semantics with
14448 identical syntax. This is a great boon to those working with
14449 cross-platform projects.
14450
14451 For those adding visibility support to existing code, you may find
14452 @code{#pragma GCC visibility} of use. This works by you enclosing
14453 the declarations you wish to set visibility for with (for example)
14454 @code{#pragma GCC visibility push(hidden)} and
14455 @code{#pragma GCC visibility pop}.
14456 Bear in mind that symbol visibility should be viewed @strong{as
14457 part of the API interface contract} and thus all new code should
14458 always specify visibility when it is not the default; i.e., declarations
14459 only for use within the local DSO should @strong{always} be marked explicitly
14460 as hidden as so to avoid PLT indirection overheads---making this
14461 abundantly clear also aids readability and self-documentation of the code.
14462 Note that due to ISO C++ specification requirements, @code{operator new} and
14463 @code{operator delete} must always be of default visibility.
14464
14465 Be aware that headers from outside your project, in particular system
14466 headers and headers from any other library you use, may not be
14467 expecting to be compiled with visibility other than the default. You
14468 may need to explicitly say @code{#pragma GCC visibility push(default)}
14469 before including any such headers.
14470
14471 @code{extern} declarations are not affected by @option{-fvisibility}, so
14472 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14473 no modifications. However, this means that calls to @code{extern}
14474 functions with no explicit visibility use the PLT, so it is more
14475 effective to use @code{__attribute ((visibility))} and/or
14476 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14477 declarations should be treated as hidden.
14478
14479 Note that @option{-fvisibility} does affect C++ vague linkage
14480 entities. This means that, for instance, an exception class that is
14481 be thrown between DSOs must be explicitly marked with default
14482 visibility so that the @samp{type_info} nodes are unified between
14483 the DSOs.
14484
14485 An overview of these techniques, their benefits and how to use them
14486 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14487
14488 @item -fstrict-volatile-bitfields
14489 @opindex fstrict-volatile-bitfields
14490 This option should be used if accesses to volatile bit-fields (or other
14491 structure fields, although the compiler usually honors those types
14492 anyway) should use a single access of the width of the
14493 field's type, aligned to a natural alignment if possible. For
14494 example, targets with memory-mapped peripheral registers might require
14495 all such accesses to be 16 bits wide; with this flag you can
14496 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14497 is 16 bits on these targets) to force GCC to use 16-bit accesses
14498 instead of, perhaps, a more efficient 32-bit access.
14499
14500 If this option is disabled, the compiler uses the most efficient
14501 instruction. In the previous example, that might be a 32-bit load
14502 instruction, even though that accesses bytes that do not contain
14503 any portion of the bit-field, or memory-mapped registers unrelated to
14504 the one being updated.
14505
14506 In some cases, such as when the @code{packed} attribute is applied to a
14507 structure field, it may not be possible to access the field with a single
14508 read or write that is correctly aligned for the target machine. In this
14509 case GCC falls back to generating multiple accesses rather than code that
14510 will fault or truncate the result at run time.
14511
14512 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14513 not allowed to touch non bit-field members. It is therefore recommended
14514 to define all bits of the field's type as bit-field members.
14515
14516 The default value of this option is determined by the application binary
14517 interface for the target processor.
14518
14519 @item -fsync-libcalls
14520 @opindex fsync-libcalls
14521 This option controls whether any out-of-line instance of the @code{__sync}
14522 family of functions may be used to implement the C++11 @code{__atomic}
14523 family of functions.
14524
14525 The default value of this option is enabled, thus the only useful form
14526 of the option is @option{-fno-sync-libcalls}. This option is used in
14527 the implementation of the @file{libatomic} runtime library.
14528
14529 @end table
14530
14531 @node Developer Options
14532 @section GCC Developer Options
14533 @cindex developer options
14534 @cindex debugging GCC
14535 @cindex debug dump options
14536 @cindex dump options
14537 @cindex compilation statistics
14538
14539 This section describes command-line options that are primarily of
14540 interest to GCC developers, including options to support compiler
14541 testing and investigation of compiler bugs and compile-time
14542 performance problems. This includes options that produce debug dumps
14543 at various points in the compilation; that print statistics such as
14544 memory use and execution time; and that print information about GCC's
14545 configuration, such as where it searches for libraries. You should
14546 rarely need to use any of these options for ordinary compilation and
14547 linking tasks.
14548
14549 Many developer options that cause GCC to dump output to a file take an
14550 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14551 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14552 error.
14553
14554 If @samp{=@var{filename}} is omitted, a default dump file name is
14555 constructed by concatenating the base dump file name, a pass number,
14556 phase letter, and pass name. The base dump file name is the name of
14557 output file produced by the compiler if explicitly specified and not
14558 an executable; otherwise it is the source file name.
14559 The pass number is determined by the order passes are registered with
14560 the compiler's pass manager.
14561 This is generally the same as the order of execution, but passes
14562 registered by plugins, target-specific passes, or passes that are
14563 otherwise registered late are numbered higher than the pass named
14564 @samp{final}, even if they are executed earlier. The phase letter is
14565 one of @samp{i} (inter-procedural analysis), @samp{l}
14566 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14567 The files are created in the directory of the output file.
14568
14569 @table @gcctabopt
14570
14571 @item -fcallgraph-info
14572 @itemx -fcallgraph-info=@var{MARKERS}
14573 @opindex fcallgraph-info
14574 Makes the compiler output callgraph information for the program, on a
14575 per-object-file basis. The information is generated in the common VCG
14576 format. It can be decorated with additional, per-node and/or per-edge
14577 information, if a list of comma-separated markers is additionally
14578 specified. When the @code{su} marker is specified, the callgraph is
14579 decorated with stack usage information; it is equivalent to
14580 @option{-fstack-usage}. When the @code{da} marker is specified, the
14581 callgraph is decorated with information about dynamically allocated
14582 objects.
14583
14584 When compiling with @option{-flto}, no callgraph information is output
14585 along with the object file. At LTO link time, @option{-fcallgraph-info}
14586 may generate multiple callgraph information files next to intermediate
14587 LTO output files.
14588
14589 @item -d@var{letters}
14590 @itemx -fdump-rtl-@var{pass}
14591 @itemx -fdump-rtl-@var{pass}=@var{filename}
14592 @opindex d
14593 @opindex fdump-rtl-@var{pass}
14594 Says to make debugging dumps during compilation at times specified by
14595 @var{letters}. This is used for debugging the RTL-based passes of the
14596 compiler.
14597
14598 Some @option{-d@var{letters}} switches have different meaning when
14599 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14600 for information about preprocessor-specific dump options.
14601
14602 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14603 @option{-d} option @var{letters}. Here are the possible
14604 letters for use in @var{pass} and @var{letters}, and their meanings:
14605
14606 @table @gcctabopt
14607
14608 @item -fdump-rtl-alignments
14609 @opindex fdump-rtl-alignments
14610 Dump after branch alignments have been computed.
14611
14612 @item -fdump-rtl-asmcons
14613 @opindex fdump-rtl-asmcons
14614 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14615
14616 @item -fdump-rtl-auto_inc_dec
14617 @opindex fdump-rtl-auto_inc_dec
14618 Dump after auto-inc-dec discovery. This pass is only run on
14619 architectures that have auto inc or auto dec instructions.
14620
14621 @item -fdump-rtl-barriers
14622 @opindex fdump-rtl-barriers
14623 Dump after cleaning up the barrier instructions.
14624
14625 @item -fdump-rtl-bbpart
14626 @opindex fdump-rtl-bbpart
14627 Dump after partitioning hot and cold basic blocks.
14628
14629 @item -fdump-rtl-bbro
14630 @opindex fdump-rtl-bbro
14631 Dump after block reordering.
14632
14633 @item -fdump-rtl-btl1
14634 @itemx -fdump-rtl-btl2
14635 @opindex fdump-rtl-btl2
14636 @opindex fdump-rtl-btl2
14637 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14638 after the two branch
14639 target load optimization passes.
14640
14641 @item -fdump-rtl-bypass
14642 @opindex fdump-rtl-bypass
14643 Dump after jump bypassing and control flow optimizations.
14644
14645 @item -fdump-rtl-combine
14646 @opindex fdump-rtl-combine
14647 Dump after the RTL instruction combination pass.
14648
14649 @item -fdump-rtl-compgotos
14650 @opindex fdump-rtl-compgotos
14651 Dump after duplicating the computed gotos.
14652
14653 @item -fdump-rtl-ce1
14654 @itemx -fdump-rtl-ce2
14655 @itemx -fdump-rtl-ce3
14656 @opindex fdump-rtl-ce1
14657 @opindex fdump-rtl-ce2
14658 @opindex fdump-rtl-ce3
14659 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14660 @option{-fdump-rtl-ce3} enable dumping after the three
14661 if conversion passes.
14662
14663 @item -fdump-rtl-cprop_hardreg
14664 @opindex fdump-rtl-cprop_hardreg
14665 Dump after hard register copy propagation.
14666
14667 @item -fdump-rtl-csa
14668 @opindex fdump-rtl-csa
14669 Dump after combining stack adjustments.
14670
14671 @item -fdump-rtl-cse1
14672 @itemx -fdump-rtl-cse2
14673 @opindex fdump-rtl-cse1
14674 @opindex fdump-rtl-cse2
14675 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14676 the two common subexpression elimination passes.
14677
14678 @item -fdump-rtl-dce
14679 @opindex fdump-rtl-dce
14680 Dump after the standalone dead code elimination passes.
14681
14682 @item -fdump-rtl-dbr
14683 @opindex fdump-rtl-dbr
14684 Dump after delayed branch scheduling.
14685
14686 @item -fdump-rtl-dce1
14687 @itemx -fdump-rtl-dce2
14688 @opindex fdump-rtl-dce1
14689 @opindex fdump-rtl-dce2
14690 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14691 the two dead store elimination passes.
14692
14693 @item -fdump-rtl-eh
14694 @opindex fdump-rtl-eh
14695 Dump after finalization of EH handling code.
14696
14697 @item -fdump-rtl-eh_ranges
14698 @opindex fdump-rtl-eh_ranges
14699 Dump after conversion of EH handling range regions.
14700
14701 @item -fdump-rtl-expand
14702 @opindex fdump-rtl-expand
14703 Dump after RTL generation.
14704
14705 @item -fdump-rtl-fwprop1
14706 @itemx -fdump-rtl-fwprop2
14707 @opindex fdump-rtl-fwprop1
14708 @opindex fdump-rtl-fwprop2
14709 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14710 dumping after the two forward propagation passes.
14711
14712 @item -fdump-rtl-gcse1
14713 @itemx -fdump-rtl-gcse2
14714 @opindex fdump-rtl-gcse1
14715 @opindex fdump-rtl-gcse2
14716 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14717 after global common subexpression elimination.
14718
14719 @item -fdump-rtl-init-regs
14720 @opindex fdump-rtl-init-regs
14721 Dump after the initialization of the registers.
14722
14723 @item -fdump-rtl-initvals
14724 @opindex fdump-rtl-initvals
14725 Dump after the computation of the initial value sets.
14726
14727 @item -fdump-rtl-into_cfglayout
14728 @opindex fdump-rtl-into_cfglayout
14729 Dump after converting to cfglayout mode.
14730
14731 @item -fdump-rtl-ira
14732 @opindex fdump-rtl-ira
14733 Dump after iterated register allocation.
14734
14735 @item -fdump-rtl-jump
14736 @opindex fdump-rtl-jump
14737 Dump after the second jump optimization.
14738
14739 @item -fdump-rtl-loop2
14740 @opindex fdump-rtl-loop2
14741 @option{-fdump-rtl-loop2} enables dumping after the rtl
14742 loop optimization passes.
14743
14744 @item -fdump-rtl-mach
14745 @opindex fdump-rtl-mach
14746 Dump after performing the machine dependent reorganization pass, if that
14747 pass exists.
14748
14749 @item -fdump-rtl-mode_sw
14750 @opindex fdump-rtl-mode_sw
14751 Dump after removing redundant mode switches.
14752
14753 @item -fdump-rtl-rnreg
14754 @opindex fdump-rtl-rnreg
14755 Dump after register renumbering.
14756
14757 @item -fdump-rtl-outof_cfglayout
14758 @opindex fdump-rtl-outof_cfglayout
14759 Dump after converting from cfglayout mode.
14760
14761 @item -fdump-rtl-peephole2
14762 @opindex fdump-rtl-peephole2
14763 Dump after the peephole pass.
14764
14765 @item -fdump-rtl-postreload
14766 @opindex fdump-rtl-postreload
14767 Dump after post-reload optimizations.
14768
14769 @item -fdump-rtl-pro_and_epilogue
14770 @opindex fdump-rtl-pro_and_epilogue
14771 Dump after generating the function prologues and epilogues.
14772
14773 @item -fdump-rtl-sched1
14774 @itemx -fdump-rtl-sched2
14775 @opindex fdump-rtl-sched1
14776 @opindex fdump-rtl-sched2
14777 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14778 after the basic block scheduling passes.
14779
14780 @item -fdump-rtl-ree
14781 @opindex fdump-rtl-ree
14782 Dump after sign/zero extension elimination.
14783
14784 @item -fdump-rtl-seqabstr
14785 @opindex fdump-rtl-seqabstr
14786 Dump after common sequence discovery.
14787
14788 @item -fdump-rtl-shorten
14789 @opindex fdump-rtl-shorten
14790 Dump after shortening branches.
14791
14792 @item -fdump-rtl-sibling
14793 @opindex fdump-rtl-sibling
14794 Dump after sibling call optimizations.
14795
14796 @item -fdump-rtl-split1
14797 @itemx -fdump-rtl-split2
14798 @itemx -fdump-rtl-split3
14799 @itemx -fdump-rtl-split4
14800 @itemx -fdump-rtl-split5
14801 @opindex fdump-rtl-split1
14802 @opindex fdump-rtl-split2
14803 @opindex fdump-rtl-split3
14804 @opindex fdump-rtl-split4
14805 @opindex fdump-rtl-split5
14806 These options enable dumping after five rounds of
14807 instruction splitting.
14808
14809 @item -fdump-rtl-sms
14810 @opindex fdump-rtl-sms
14811 Dump after modulo scheduling. This pass is only run on some
14812 architectures.
14813
14814 @item -fdump-rtl-stack
14815 @opindex fdump-rtl-stack
14816 Dump after conversion from GCC's ``flat register file'' registers to the
14817 x87's stack-like registers. This pass is only run on x86 variants.
14818
14819 @item -fdump-rtl-subreg1
14820 @itemx -fdump-rtl-subreg2
14821 @opindex fdump-rtl-subreg1
14822 @opindex fdump-rtl-subreg2
14823 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14824 the two subreg expansion passes.
14825
14826 @item -fdump-rtl-unshare
14827 @opindex fdump-rtl-unshare
14828 Dump after all rtl has been unshared.
14829
14830 @item -fdump-rtl-vartrack
14831 @opindex fdump-rtl-vartrack
14832 Dump after variable tracking.
14833
14834 @item -fdump-rtl-vregs
14835 @opindex fdump-rtl-vregs
14836 Dump after converting virtual registers to hard registers.
14837
14838 @item -fdump-rtl-web
14839 @opindex fdump-rtl-web
14840 Dump after live range splitting.
14841
14842 @item -fdump-rtl-regclass
14843 @itemx -fdump-rtl-subregs_of_mode_init
14844 @itemx -fdump-rtl-subregs_of_mode_finish
14845 @itemx -fdump-rtl-dfinit
14846 @itemx -fdump-rtl-dfinish
14847 @opindex fdump-rtl-regclass
14848 @opindex fdump-rtl-subregs_of_mode_init
14849 @opindex fdump-rtl-subregs_of_mode_finish
14850 @opindex fdump-rtl-dfinit
14851 @opindex fdump-rtl-dfinish
14852 These dumps are defined but always produce empty files.
14853
14854 @item -da
14855 @itemx -fdump-rtl-all
14856 @opindex da
14857 @opindex fdump-rtl-all
14858 Produce all the dumps listed above.
14859
14860 @item -dA
14861 @opindex dA
14862 Annotate the assembler output with miscellaneous debugging information.
14863
14864 @item -dD
14865 @opindex dD
14866 Dump all macro definitions, at the end of preprocessing, in addition to
14867 normal output.
14868
14869 @item -dH
14870 @opindex dH
14871 Produce a core dump whenever an error occurs.
14872
14873 @item -dp
14874 @opindex dp
14875 Annotate the assembler output with a comment indicating which
14876 pattern and alternative is used. The length and cost of each instruction are
14877 also printed.
14878
14879 @item -dP
14880 @opindex dP
14881 Dump the RTL in the assembler output as a comment before each instruction.
14882 Also turns on @option{-dp} annotation.
14883
14884 @item -dx
14885 @opindex dx
14886 Just generate RTL for a function instead of compiling it. Usually used
14887 with @option{-fdump-rtl-expand}.
14888 @end table
14889
14890 @item -fdump-debug
14891 @opindex fdump-debug
14892 Dump debugging information generated during the debug
14893 generation phase.
14894
14895 @item -fdump-earlydebug
14896 @opindex fdump-earlydebug
14897 Dump debugging information generated during the early debug
14898 generation phase.
14899
14900 @item -fdump-noaddr
14901 @opindex fdump-noaddr
14902 When doing debugging dumps, suppress address output. This makes it more
14903 feasible to use diff on debugging dumps for compiler invocations with
14904 different compiler binaries and/or different
14905 text / bss / data / heap / stack / dso start locations.
14906
14907 @item -freport-bug
14908 @opindex freport-bug
14909 Collect and dump debug information into a temporary file if an
14910 internal compiler error (ICE) occurs.
14911
14912 @item -fdump-unnumbered
14913 @opindex fdump-unnumbered
14914 When doing debugging dumps, suppress instruction numbers and address output.
14915 This makes it more feasible to use diff on debugging dumps for compiler
14916 invocations with different options, in particular with and without
14917 @option{-g}.
14918
14919 @item -fdump-unnumbered-links
14920 @opindex fdump-unnumbered-links
14921 When doing debugging dumps (see @option{-d} option above), suppress
14922 instruction numbers for the links to the previous and next instructions
14923 in a sequence.
14924
14925 @item -fdump-ipa-@var{switch}
14926 @itemx -fdump-ipa-@var{switch}-@var{options}
14927 @opindex fdump-ipa
14928 Control the dumping at various stages of inter-procedural analysis
14929 language tree to a file. The file name is generated by appending a
14930 switch specific suffix to the source file name, and the file is created
14931 in the same directory as the output file. The following dumps are
14932 possible:
14933
14934 @table @samp
14935 @item all
14936 Enables all inter-procedural analysis dumps.
14937
14938 @item cgraph
14939 Dumps information about call-graph optimization, unused function removal,
14940 and inlining decisions.
14941
14942 @item inline
14943 Dump after function inlining.
14944
14945 @end table
14946
14947 Additionally, the options @option{-optimized}, @option{-missed},
14948 @option{-note}, and @option{-all} can be provided, with the same meaning
14949 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14950
14951 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14952 information on callsites that were inlined, along with callsites
14953 that were not inlined.
14954
14955 By default, the dump will contain messages about successful
14956 optimizations (equivalent to @option{-optimized}) together with
14957 low-level details about the analysis.
14958
14959 @item -fdump-lang-all
14960 @itemx -fdump-lang-@var{switch}
14961 @itemx -fdump-lang-@var{switch}-@var{options}
14962 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14963 @opindex fdump-lang-all
14964 @opindex fdump-lang
14965 Control the dumping of language-specific information. The @var{options}
14966 and @var{filename} portions behave as described in the
14967 @option{-fdump-tree} option. The following @var{switch} values are
14968 accepted:
14969
14970 @table @samp
14971 @item all
14972
14973 Enable all language-specific dumps.
14974
14975 @item class
14976 Dump class hierarchy information. Virtual table information is emitted
14977 unless '@option{slim}' is specified. This option is applicable to C++ only.
14978
14979 @item raw
14980 Dump the raw internal tree data. This option is applicable to C++ only.
14981
14982 @end table
14983
14984 @item -fdump-passes
14985 @opindex fdump-passes
14986 Print on @file{stderr} the list of optimization passes that are turned
14987 on and off by the current command-line options.
14988
14989 @item -fdump-statistics-@var{option}
14990 @opindex fdump-statistics
14991 Enable and control dumping of pass statistics in a separate file. The
14992 file name is generated by appending a suffix ending in
14993 @samp{.statistics} to the source file name, and the file is created in
14994 the same directory as the output file. If the @samp{-@var{option}}
14995 form is used, @samp{-stats} causes counters to be summed over the
14996 whole compilation unit while @samp{-details} dumps every event as
14997 the passes generate them. The default with no option is to sum
14998 counters for each function compiled.
14999
15000 @item -fdump-tree-all
15001 @itemx -fdump-tree-@var{switch}
15002 @itemx -fdump-tree-@var{switch}-@var{options}
15003 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15004 @opindex fdump-tree-all
15005 @opindex fdump-tree
15006 Control the dumping at various stages of processing the intermediate
15007 language tree to a file. If the @samp{-@var{options}}
15008 form is used, @var{options} is a list of @samp{-} separated options
15009 which control the details of the dump. Not all options are applicable
15010 to all dumps; those that are not meaningful are ignored. The
15011 following options are available
15012
15013 @table @samp
15014 @item address
15015 Print the address of each node. Usually this is not meaningful as it
15016 changes according to the environment and source file. Its primary use
15017 is for tying up a dump file with a debug environment.
15018 @item asmname
15019 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15020 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
15021 use working backward from mangled names in the assembly file.
15022 @item slim
15023 When dumping front-end intermediate representations, inhibit dumping
15024 of members of a scope or body of a function merely because that scope
15025 has been reached. Only dump such items when they are directly reachable
15026 by some other path.
15027
15028 When dumping pretty-printed trees, this option inhibits dumping the
15029 bodies of control structures.
15030
15031 When dumping RTL, print the RTL in slim (condensed) form instead of
15032 the default LISP-like representation.
15033 @item raw
15034 Print a raw representation of the tree. By default, trees are
15035 pretty-printed into a C-like representation.
15036 @item details
15037 Enable more detailed dumps (not honored by every dump option). Also
15038 include information from the optimization passes.
15039 @item stats
15040 Enable dumping various statistics about the pass (not honored by every dump
15041 option).
15042 @item blocks
15043 Enable showing basic block boundaries (disabled in raw dumps).
15044 @item graph
15045 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15046 dump a representation of the control flow graph suitable for viewing with
15047 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
15048 the file is pretty-printed as a subgraph, so that GraphViz can render them
15049 all in a single plot.
15050
15051 This option currently only works for RTL dumps, and the RTL is always
15052 dumped in slim form.
15053 @item vops
15054 Enable showing virtual operands for every statement.
15055 @item lineno
15056 Enable showing line numbers for statements.
15057 @item uid
15058 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15059 @item verbose
15060 Enable showing the tree dump for each statement.
15061 @item eh
15062 Enable showing the EH region number holding each statement.
15063 @item scev
15064 Enable showing scalar evolution analysis details.
15065 @item optimized
15066 Enable showing optimization information (only available in certain
15067 passes).
15068 @item missed
15069 Enable showing missed optimization information (only available in certain
15070 passes).
15071 @item note
15072 Enable other detailed optimization information (only available in
15073 certain passes).
15074 @item all
15075 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15076 and @option{lineno}.
15077 @item optall
15078 Turn on all optimization options, i.e., @option{optimized},
15079 @option{missed}, and @option{note}.
15080 @end table
15081
15082 To determine what tree dumps are available or find the dump for a pass
15083 of interest follow the steps below.
15084
15085 @enumerate
15086 @item
15087 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15088 look for a code that corresponds to the pass you are interested in.
15089 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15090 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15091 The number at the end distinguishes distinct invocations of the same pass.
15092 @item
15093 To enable the creation of the dump file, append the pass code to
15094 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15095 to enable the dump from the Early Value Range Propagation pass, invoke
15096 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15097 specify the name of the dump file. If you don't specify one, GCC
15098 creates as described below.
15099 @item
15100 Find the pass dump in a file whose name is composed of three components
15101 separated by a period: the name of the source file GCC was invoked to
15102 compile, a numeric suffix indicating the pass number followed by the
15103 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15104 and finally the pass code. For example, the Early VRP pass dump might
15105 be in a file named @file{myfile.c.038t.evrp} in the current working
15106 directory. Note that the numeric codes are not stable and may change
15107 from one version of GCC to another.
15108 @end enumerate
15109
15110 @item -fopt-info
15111 @itemx -fopt-info-@var{options}
15112 @itemx -fopt-info-@var{options}=@var{filename}
15113 @opindex fopt-info
15114 Controls optimization dumps from various optimization passes. If the
15115 @samp{-@var{options}} form is used, @var{options} is a list of
15116 @samp{-} separated option keywords to select the dump details and
15117 optimizations.
15118
15119 The @var{options} can be divided into three groups:
15120 @enumerate
15121 @item
15122 options describing what kinds of messages should be emitted,
15123 @item
15124 options describing the verbosity of the dump, and
15125 @item
15126 options describing which optimizations should be included.
15127 @end enumerate
15128 The options from each group can be freely mixed as they are
15129 non-overlapping. However, in case of any conflicts,
15130 the later options override the earlier options on the command
15131 line.
15132
15133 The following options control which kinds of messages should be emitted:
15134
15135 @table @samp
15136 @item optimized
15137 Print information when an optimization is successfully applied. It is
15138 up to a pass to decide which information is relevant. For example, the
15139 vectorizer passes print the source location of loops which are
15140 successfully vectorized.
15141 @item missed
15142 Print information about missed optimizations. Individual passes
15143 control which information to include in the output.
15144 @item note
15145 Print verbose information about optimizations, such as certain
15146 transformations, more detailed messages about decisions etc.
15147 @item all
15148 Print detailed optimization information. This includes
15149 @samp{optimized}, @samp{missed}, and @samp{note}.
15150 @end table
15151
15152 The following option controls the dump verbosity:
15153
15154 @table @samp
15155 @item internals
15156 By default, only ``high-level'' messages are emitted. This option enables
15157 additional, more detailed, messages, which are likely to only be of interest
15158 to GCC developers.
15159 @end table
15160
15161 One or more of the following option keywords can be used to describe a
15162 group of optimizations:
15163
15164 @table @samp
15165 @item ipa
15166 Enable dumps from all interprocedural optimizations.
15167 @item loop
15168 Enable dumps from all loop optimizations.
15169 @item inline
15170 Enable dumps from all inlining optimizations.
15171 @item omp
15172 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15173 @item vec
15174 Enable dumps from all vectorization optimizations.
15175 @item optall
15176 Enable dumps from all optimizations. This is a superset of
15177 the optimization groups listed above.
15178 @end table
15179
15180 If @var{options} is
15181 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15182 about successful optimizations from all the passes, omitting messages
15183 that are treated as ``internals''.
15184
15185 If the @var{filename} is provided, then the dumps from all the
15186 applicable optimizations are concatenated into the @var{filename}.
15187 Otherwise the dump is output onto @file{stderr}. Though multiple
15188 @option{-fopt-info} options are accepted, only one of them can include
15189 a @var{filename}. If other filenames are provided then all but the
15190 first such option are ignored.
15191
15192 Note that the output @var{filename} is overwritten
15193 in case of multiple translation units. If a combined output from
15194 multiple translation units is desired, @file{stderr} should be used
15195 instead.
15196
15197 In the following example, the optimization info is output to
15198 @file{stderr}:
15199
15200 @smallexample
15201 gcc -O3 -fopt-info
15202 @end smallexample
15203
15204 This example:
15205 @smallexample
15206 gcc -O3 -fopt-info-missed=missed.all
15207 @end smallexample
15208
15209 @noindent
15210 outputs missed optimization report from all the passes into
15211 @file{missed.all}, and this one:
15212
15213 @smallexample
15214 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15215 @end smallexample
15216
15217 @noindent
15218 prints information about missed optimization opportunities from
15219 vectorization passes on @file{stderr}.
15220 Note that @option{-fopt-info-vec-missed} is equivalent to
15221 @option{-fopt-info-missed-vec}. The order of the optimization group
15222 names and message types listed after @option{-fopt-info} does not matter.
15223
15224 As another example,
15225 @smallexample
15226 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15227 @end smallexample
15228
15229 @noindent
15230 outputs information about missed optimizations as well as
15231 optimized locations from all the inlining passes into
15232 @file{inline.txt}.
15233
15234 Finally, consider:
15235
15236 @smallexample
15237 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15238 @end smallexample
15239
15240 @noindent
15241 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15242 in conflict since only one output file is allowed. In this case, only
15243 the first option takes effect and the subsequent options are
15244 ignored. Thus only @file{vec.miss} is produced which contains
15245 dumps from the vectorizer about missed opportunities.
15246
15247 @item -fsave-optimization-record
15248 @opindex fsave-optimization-record
15249 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15250 were performed, for those optimizations that support @option{-fopt-info}.
15251
15252 This option is experimental and the format of the data within the
15253 compressed JSON file is subject to change.
15254
15255 It is roughly equivalent to a machine-readable version of
15256 @option{-fopt-info-all}, as a collection of messages with source file,
15257 line number and column number, with the following additional data for
15258 each message:
15259
15260 @itemize @bullet
15261
15262 @item
15263 the execution count of the code being optimized, along with metadata about
15264 whether this was from actual profile data, or just an estimate, allowing
15265 consumers to prioritize messages by code hotness,
15266
15267 @item
15268 the function name of the code being optimized, where applicable,
15269
15270 @item
15271 the ``inlining chain'' for the code being optimized, so that when
15272 a function is inlined into several different places (which might
15273 themselves be inlined), the reader can distinguish between the copies,
15274
15275 @item
15276 objects identifying those parts of the message that refer to expressions,
15277 statements or symbol-table nodes, which of these categories they are, and,
15278 when available, their source code location,
15279
15280 @item
15281 the GCC pass that emitted the message, and
15282
15283 @item
15284 the location in GCC's own code from which the message was emitted
15285
15286 @end itemize
15287
15288 Additionally, some messages are logically nested within other
15289 messages, reflecting implementation details of the optimization
15290 passes.
15291
15292 @item -fsched-verbose=@var{n}
15293 @opindex fsched-verbose
15294 On targets that use instruction scheduling, this option controls the
15295 amount of debugging output the scheduler prints to the dump files.
15296
15297 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15298 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15299 For @var{n} greater than one, it also output basic block probabilities,
15300 detailed ready list information and unit/insn info. For @var{n} greater
15301 than two, it includes RTL at abort point, control-flow and regions info.
15302 And for @var{n} over four, @option{-fsched-verbose} also includes
15303 dependence info.
15304
15305
15306
15307 @item -fenable-@var{kind}-@var{pass}
15308 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15309 @opindex fdisable-
15310 @opindex fenable-
15311
15312 This is a set of options that are used to explicitly disable/enable
15313 optimization passes. These options are intended for use for debugging GCC.
15314 Compiler users should use regular options for enabling/disabling
15315 passes instead.
15316
15317 @table @gcctabopt
15318
15319 @item -fdisable-ipa-@var{pass}
15320 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15321 statically invoked in the compiler multiple times, the pass name should be
15322 appended with a sequential number starting from 1.
15323
15324 @item -fdisable-rtl-@var{pass}
15325 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15326 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15327 statically invoked in the compiler multiple times, the pass name should be
15328 appended with a sequential number starting from 1. @var{range-list} is a
15329 comma-separated list of function ranges or assembler names. Each range is a number
15330 pair separated by a colon. The range is inclusive in both ends. If the range
15331 is trivial, the number pair can be simplified as a single number. If the
15332 function's call graph node's @var{uid} falls within one of the specified ranges,
15333 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15334 function header of a dump file, and the pass names can be dumped by using
15335 option @option{-fdump-passes}.
15336
15337 @item -fdisable-tree-@var{pass}
15338 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15339 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15340 option arguments.
15341
15342 @item -fenable-ipa-@var{pass}
15343 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15344 statically invoked in the compiler multiple times, the pass name should be
15345 appended with a sequential number starting from 1.
15346
15347 @item -fenable-rtl-@var{pass}
15348 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15349 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15350 description and examples.
15351
15352 @item -fenable-tree-@var{pass}
15353 @itemx -fenable-tree-@var{pass}=@var{range-list}
15354 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15355 of option arguments.
15356
15357 @end table
15358
15359 Here are some examples showing uses of these options.
15360
15361 @smallexample
15362
15363 # disable ccp1 for all functions
15364 -fdisable-tree-ccp1
15365 # disable complete unroll for function whose cgraph node uid is 1
15366 -fenable-tree-cunroll=1
15367 # disable gcse2 for functions at the following ranges [1,1],
15368 # [300,400], and [400,1000]
15369 # disable gcse2 for functions foo and foo2
15370 -fdisable-rtl-gcse2=foo,foo2
15371 # disable early inlining
15372 -fdisable-tree-einline
15373 # disable ipa inlining
15374 -fdisable-ipa-inline
15375 # enable tree full unroll
15376 -fenable-tree-unroll
15377
15378 @end smallexample
15379
15380 @item -fchecking
15381 @itemx -fchecking=@var{n}
15382 @opindex fchecking
15383 @opindex fno-checking
15384 Enable internal consistency checking. The default depends on
15385 the compiler configuration. @option{-fchecking=2} enables further
15386 internal consistency checking that might affect code generation.
15387
15388 @item -frandom-seed=@var{string}
15389 @opindex frandom-seed
15390 This option provides a seed that GCC uses in place of
15391 random numbers in generating certain symbol names
15392 that have to be different in every compiled file. It is also used to
15393 place unique stamps in coverage data files and the object files that
15394 produce them. You can use the @option{-frandom-seed} option to produce
15395 reproducibly identical object files.
15396
15397 The @var{string} can either be a number (decimal, octal or hex) or an
15398 arbitrary string (in which case it's converted to a number by
15399 computing CRC32).
15400
15401 The @var{string} should be different for every file you compile.
15402
15403 @item -save-temps
15404 @itemx -save-temps=cwd
15405 @opindex save-temps
15406 Store the usual ``temporary'' intermediate files permanently; place them
15407 in the current directory and name them based on the source file. Thus,
15408 compiling @file{foo.c} with @option{-c -save-temps} produces files
15409 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15410 preprocessed @file{foo.i} output file even though the compiler now
15411 normally uses an integrated preprocessor.
15412
15413 When used in combination with the @option{-x} command-line option,
15414 @option{-save-temps} is sensible enough to avoid over writing an
15415 input source file with the same extension as an intermediate file.
15416 The corresponding intermediate file may be obtained by renaming the
15417 source file before using @option{-save-temps}.
15418
15419 If you invoke GCC in parallel, compiling several different source
15420 files that share a common base name in different subdirectories or the
15421 same source file compiled for multiple output destinations, it is
15422 likely that the different parallel compilers will interfere with each
15423 other, and overwrite the temporary files. For instance:
15424
15425 @smallexample
15426 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15427 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15428 @end smallexample
15429
15430 may result in @file{foo.i} and @file{foo.o} being written to
15431 simultaneously by both compilers.
15432
15433 @item -save-temps=obj
15434 @opindex save-temps=obj
15435 Store the usual ``temporary'' intermediate files permanently. If the
15436 @option{-o} option is used, the temporary files are based on the
15437 object file. If the @option{-o} option is not used, the
15438 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15439
15440 For example:
15441
15442 @smallexample
15443 gcc -save-temps=obj -c foo.c
15444 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15445 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15446 @end smallexample
15447
15448 @noindent
15449 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15450 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15451 @file{dir2/yfoobar.o}.
15452
15453 @item -time@r{[}=@var{file}@r{]}
15454 @opindex time
15455 Report the CPU time taken by each subprocess in the compilation
15456 sequence. For C source files, this is the compiler proper and assembler
15457 (plus the linker if linking is done).
15458
15459 Without the specification of an output file, the output looks like this:
15460
15461 @smallexample
15462 # cc1 0.12 0.01
15463 # as 0.00 0.01
15464 @end smallexample
15465
15466 The first number on each line is the ``user time'', that is time spent
15467 executing the program itself. The second number is ``system time'',
15468 time spent executing operating system routines on behalf of the program.
15469 Both numbers are in seconds.
15470
15471 With the specification of an output file, the output is appended to the
15472 named file, and it looks like this:
15473
15474 @smallexample
15475 0.12 0.01 cc1 @var{options}
15476 0.00 0.01 as @var{options}
15477 @end smallexample
15478
15479 The ``user time'' and the ``system time'' are moved before the program
15480 name, and the options passed to the program are displayed, so that one
15481 can later tell what file was being compiled, and with which options.
15482
15483 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15484 @opindex fdump-final-insns
15485 Dump the final internal representation (RTL) to @var{file}. If the
15486 optional argument is omitted (or if @var{file} is @code{.}), the name
15487 of the dump file is determined by appending @code{.gkd} to the
15488 compilation output file name.
15489
15490 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15491 @opindex fcompare-debug
15492 @opindex fno-compare-debug
15493 If no error occurs during compilation, run the compiler a second time,
15494 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15495 passed to the second compilation. Dump the final internal
15496 representation in both compilations, and print an error if they differ.
15497
15498 If the equal sign is omitted, the default @option{-gtoggle} is used.
15499
15500 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15501 and nonzero, implicitly enables @option{-fcompare-debug}. If
15502 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15503 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15504 is used.
15505
15506 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15507 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15508 of the final representation and the second compilation, preventing even
15509 @env{GCC_COMPARE_DEBUG} from taking effect.
15510
15511 To verify full coverage during @option{-fcompare-debug} testing, set
15512 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15513 which GCC rejects as an invalid option in any actual compilation
15514 (rather than preprocessing, assembly or linking). To get just a
15515 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15516 not overridden} will do.
15517
15518 @item -fcompare-debug-second
15519 @opindex fcompare-debug-second
15520 This option is implicitly passed to the compiler for the second
15521 compilation requested by @option{-fcompare-debug}, along with options to
15522 silence warnings, and omitting other options that would cause the compiler
15523 to produce output to files or to standard output as a side effect. Dump
15524 files and preserved temporary files are renamed so as to contain the
15525 @code{.gk} additional extension during the second compilation, to avoid
15526 overwriting those generated by the first.
15527
15528 When this option is passed to the compiler driver, it causes the
15529 @emph{first} compilation to be skipped, which makes it useful for little
15530 other than debugging the compiler proper.
15531
15532 @item -gtoggle
15533 @opindex gtoggle
15534 Turn off generation of debug info, if leaving out this option
15535 generates it, or turn it on at level 2 otherwise. The position of this
15536 argument in the command line does not matter; it takes effect after all
15537 other options are processed, and it does so only once, no matter how
15538 many times it is given. This is mainly intended to be used with
15539 @option{-fcompare-debug}.
15540
15541 @item -fvar-tracking-assignments-toggle
15542 @opindex fvar-tracking-assignments-toggle
15543 @opindex fno-var-tracking-assignments-toggle
15544 Toggle @option{-fvar-tracking-assignments}, in the same way that
15545 @option{-gtoggle} toggles @option{-g}.
15546
15547 @item -Q
15548 @opindex Q
15549 Makes the compiler print out each function name as it is compiled, and
15550 print some statistics about each pass when it finishes.
15551
15552 @item -ftime-report
15553 @opindex ftime-report
15554 Makes the compiler print some statistics about the time consumed by each
15555 pass when it finishes.
15556
15557 @item -ftime-report-details
15558 @opindex ftime-report-details
15559 Record the time consumed by infrastructure parts separately for each pass.
15560
15561 @item -fira-verbose=@var{n}
15562 @opindex fira-verbose
15563 Control the verbosity of the dump file for the integrated register allocator.
15564 The default value is 5. If the value @var{n} is greater or equal to 10,
15565 the dump output is sent to stderr using the same format as @var{n} minus 10.
15566
15567 @item -flto-report
15568 @opindex flto-report
15569 Prints a report with internal details on the workings of the link-time
15570 optimizer. The contents of this report vary from version to version.
15571 It is meant to be useful to GCC developers when processing object
15572 files in LTO mode (via @option{-flto}).
15573
15574 Disabled by default.
15575
15576 @item -flto-report-wpa
15577 @opindex flto-report-wpa
15578 Like @option{-flto-report}, but only print for the WPA phase of link-time
15579 optimization.
15580
15581 @item -fmem-report
15582 @opindex fmem-report
15583 Makes the compiler print some statistics about permanent memory
15584 allocation when it finishes.
15585
15586 @item -fmem-report-wpa
15587 @opindex fmem-report-wpa
15588 Makes the compiler print some statistics about permanent memory
15589 allocation for the WPA phase only.
15590
15591 @item -fpre-ipa-mem-report
15592 @opindex fpre-ipa-mem-report
15593 @item -fpost-ipa-mem-report
15594 @opindex fpost-ipa-mem-report
15595 Makes the compiler print some statistics about permanent memory
15596 allocation before or after interprocedural optimization.
15597
15598 @item -fprofile-report
15599 @opindex fprofile-report
15600 Makes the compiler print some statistics about consistency of the
15601 (estimated) profile and effect of individual passes.
15602
15603 @item -fstack-usage
15604 @opindex fstack-usage
15605 Makes the compiler output stack usage information for the program, on a
15606 per-function basis. The filename for the dump is made by appending
15607 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15608 the output file, if explicitly specified and it is not an executable,
15609 otherwise it is the basename of the source file. An entry is made up
15610 of three fields:
15611
15612 @itemize
15613 @item
15614 The name of the function.
15615 @item
15616 A number of bytes.
15617 @item
15618 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15619 @end itemize
15620
15621 The qualifier @code{static} means that the function manipulates the stack
15622 statically: a fixed number of bytes are allocated for the frame on function
15623 entry and released on function exit; no stack adjustments are otherwise made
15624 in the function. The second field is this fixed number of bytes.
15625
15626 The qualifier @code{dynamic} means that the function manipulates the stack
15627 dynamically: in addition to the static allocation described above, stack
15628 adjustments are made in the body of the function, for example to push/pop
15629 arguments around function calls. If the qualifier @code{bounded} is also
15630 present, the amount of these adjustments is bounded at compile time and
15631 the second field is an upper bound of the total amount of stack used by
15632 the function. If it is not present, the amount of these adjustments is
15633 not bounded at compile time and the second field only represents the
15634 bounded part.
15635
15636 @item -fstats
15637 @opindex fstats
15638 Emit statistics about front-end processing at the end of the compilation.
15639 This option is supported only by the C++ front end, and
15640 the information is generally only useful to the G++ development team.
15641
15642 @item -fdbg-cnt-list
15643 @opindex fdbg-cnt-list
15644 Print the name and the counter upper bound for all debug counters.
15645
15646
15647 @item -fdbg-cnt=@var{counter-value-list}
15648 @opindex fdbg-cnt
15649 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15650 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15651 tuples which sets the lower and the upper bound of each debug
15652 counter @var{name}. The @var{lower_bound} is optional and is zero
15653 initialized if not set.
15654 All debug counters have the initial upper bound of @code{UINT_MAX};
15655 thus @code{dbg_cnt} returns true always unless the upper bound
15656 is set by this option.
15657 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15658 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15659 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15660
15661 @item -print-file-name=@var{library}
15662 @opindex print-file-name
15663 Print the full absolute name of the library file @var{library} that
15664 would be used when linking---and don't do anything else. With this
15665 option, GCC does not compile or link anything; it just prints the
15666 file name.
15667
15668 @item -print-multi-directory
15669 @opindex print-multi-directory
15670 Print the directory name corresponding to the multilib selected by any
15671 other switches present in the command line. This directory is supposed
15672 to exist in @env{GCC_EXEC_PREFIX}.
15673
15674 @item -print-multi-lib
15675 @opindex print-multi-lib
15676 Print the mapping from multilib directory names to compiler switches
15677 that enable them. The directory name is separated from the switches by
15678 @samp{;}, and each switch starts with an @samp{@@} instead of the
15679 @samp{-}, without spaces between multiple switches. This is supposed to
15680 ease shell processing.
15681
15682 @item -print-multi-os-directory
15683 @opindex print-multi-os-directory
15684 Print the path to OS libraries for the selected
15685 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15686 present in the @file{lib} subdirectory and no multilibs are used, this is
15687 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15688 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15689 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15690 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15691
15692 @item -print-multiarch
15693 @opindex print-multiarch
15694 Print the path to OS libraries for the selected multiarch,
15695 relative to some @file{lib} subdirectory.
15696
15697 @item -print-prog-name=@var{program}
15698 @opindex print-prog-name
15699 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15700
15701 @item -print-libgcc-file-name
15702 @opindex print-libgcc-file-name
15703 Same as @option{-print-file-name=libgcc.a}.
15704
15705 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15706 but you do want to link with @file{libgcc.a}. You can do:
15707
15708 @smallexample
15709 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15710 @end smallexample
15711
15712 @item -print-search-dirs
15713 @opindex print-search-dirs
15714 Print the name of the configured installation directory and a list of
15715 program and library directories @command{gcc} searches---and don't do anything else.
15716
15717 This is useful when @command{gcc} prints the error message
15718 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15719 To resolve this you either need to put @file{cpp0} and the other compiler
15720 components where @command{gcc} expects to find them, or you can set the environment
15721 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15722 Don't forget the trailing @samp{/}.
15723 @xref{Environment Variables}.
15724
15725 @item -print-sysroot
15726 @opindex print-sysroot
15727 Print the target sysroot directory that is used during
15728 compilation. This is the target sysroot specified either at configure
15729 time or using the @option{--sysroot} option, possibly with an extra
15730 suffix that depends on compilation options. If no target sysroot is
15731 specified, the option prints nothing.
15732
15733 @item -print-sysroot-headers-suffix
15734 @opindex print-sysroot-headers-suffix
15735 Print the suffix added to the target sysroot when searching for
15736 headers, or give an error if the compiler is not configured with such
15737 a suffix---and don't do anything else.
15738
15739 @item -dumpmachine
15740 @opindex dumpmachine
15741 Print the compiler's target machine (for example,
15742 @samp{i686-pc-linux-gnu})---and don't do anything else.
15743
15744 @item -dumpversion
15745 @opindex dumpversion
15746 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15747 anything else. This is the compiler version used in filesystem paths and
15748 specs. Depending on how the compiler has been configured it can be just
15749 a single number (major version), two numbers separated by a dot (major and
15750 minor version) or three numbers separated by dots (major, minor and patchlevel
15751 version).
15752
15753 @item -dumpfullversion
15754 @opindex dumpfullversion
15755 Print the full compiler version---and don't do anything else. The output is
15756 always three numbers separated by dots, major, minor and patchlevel version.
15757
15758 @item -dumpspecs
15759 @opindex dumpspecs
15760 Print the compiler's built-in specs---and don't do anything else. (This
15761 is used when GCC itself is being built.) @xref{Spec Files}.
15762 @end table
15763
15764 @node Submodel Options
15765 @section Machine-Dependent Options
15766 @cindex submodel options
15767 @cindex specifying hardware config
15768 @cindex hardware models and configurations, specifying
15769 @cindex target-dependent options
15770 @cindex machine-dependent options
15771
15772 Each target machine supported by GCC can have its own options---for
15773 example, to allow you to compile for a particular processor variant or
15774 ABI, or to control optimizations specific to that machine. By
15775 convention, the names of machine-specific options start with
15776 @samp{-m}.
15777
15778 Some configurations of the compiler also support additional target-specific
15779 options, usually for compatibility with other compilers on the same
15780 platform.
15781
15782 @c This list is ordered alphanumerically by subsection name.
15783 @c It should be the same order and spelling as these options are listed
15784 @c in Machine Dependent Options
15785
15786 @menu
15787 * AArch64 Options::
15788 * Adapteva Epiphany Options::
15789 * AMD GCN Options::
15790 * ARC Options::
15791 * ARM Options::
15792 * AVR Options::
15793 * Blackfin Options::
15794 * C6X Options::
15795 * CRIS Options::
15796 * CR16 Options::
15797 * C-SKY Options::
15798 * Darwin Options::
15799 * DEC Alpha Options::
15800 * eBPF Options::
15801 * FR30 Options::
15802 * FT32 Options::
15803 * FRV Options::
15804 * GNU/Linux Options::
15805 * H8/300 Options::
15806 * HPPA Options::
15807 * IA-64 Options::
15808 * LM32 Options::
15809 * M32C Options::
15810 * M32R/D Options::
15811 * M680x0 Options::
15812 * MCore Options::
15813 * MeP Options::
15814 * MicroBlaze Options::
15815 * MIPS Options::
15816 * MMIX Options::
15817 * MN10300 Options::
15818 * Moxie Options::
15819 * MSP430 Options::
15820 * NDS32 Options::
15821 * Nios II Options::
15822 * Nvidia PTX Options::
15823 * OpenRISC Options::
15824 * PDP-11 Options::
15825 * picoChip Options::
15826 * PowerPC Options::
15827 * PRU Options::
15828 * RISC-V Options::
15829 * RL78 Options::
15830 * RS/6000 and PowerPC Options::
15831 * RX Options::
15832 * S/390 and zSeries Options::
15833 * Score Options::
15834 * SH Options::
15835 * Solaris 2 Options::
15836 * SPARC Options::
15837 * System V Options::
15838 * TILE-Gx Options::
15839 * TILEPro Options::
15840 * V850 Options::
15841 * VAX Options::
15842 * Visium Options::
15843 * VMS Options::
15844 * VxWorks Options::
15845 * x86 Options::
15846 * x86 Windows Options::
15847 * Xstormy16 Options::
15848 * Xtensa Options::
15849 * zSeries Options::
15850 @end menu
15851
15852 @node AArch64 Options
15853 @subsection AArch64 Options
15854 @cindex AArch64 Options
15855
15856 These options are defined for AArch64 implementations:
15857
15858 @table @gcctabopt
15859
15860 @item -mabi=@var{name}
15861 @opindex mabi
15862 Generate code for the specified data model. Permissible values
15863 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15864 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15865 but long int and pointers are 64 bits.
15866
15867 The default depends on the specific target configuration. Note that
15868 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15869 entire program with the same ABI, and link with a compatible set of libraries.
15870
15871 @item -mbig-endian
15872 @opindex mbig-endian
15873 Generate big-endian code. This is the default when GCC is configured for an
15874 @samp{aarch64_be-*-*} target.
15875
15876 @item -mgeneral-regs-only
15877 @opindex mgeneral-regs-only
15878 Generate code which uses only the general-purpose registers. This will prevent
15879 the compiler from using floating-point and Advanced SIMD registers but will not
15880 impose any restrictions on the assembler.
15881
15882 @item -mlittle-endian
15883 @opindex mlittle-endian
15884 Generate little-endian code. This is the default when GCC is configured for an
15885 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15886
15887 @item -mcmodel=tiny
15888 @opindex mcmodel=tiny
15889 Generate code for the tiny code model. The program and its statically defined
15890 symbols must be within 1MB of each other. Programs can be statically or
15891 dynamically linked.
15892
15893 @item -mcmodel=small
15894 @opindex mcmodel=small
15895 Generate code for the small code model. The program and its statically defined
15896 symbols must be within 4GB of each other. Programs can be statically or
15897 dynamically linked. This is the default code model.
15898
15899 @item -mcmodel=large
15900 @opindex mcmodel=large
15901 Generate code for the large code model. This makes no assumptions about
15902 addresses and sizes of sections. Programs can be statically linked only.
15903
15904 @item -mstrict-align
15905 @itemx -mno-strict-align
15906 @opindex mstrict-align
15907 @opindex mno-strict-align
15908 Avoid or allow generating memory accesses that may not be aligned on a natural
15909 object boundary as described in the architecture specification.
15910
15911 @item -momit-leaf-frame-pointer
15912 @itemx -mno-omit-leaf-frame-pointer
15913 @opindex momit-leaf-frame-pointer
15914 @opindex mno-omit-leaf-frame-pointer
15915 Omit or keep the frame pointer in leaf functions. The former behavior is the
15916 default.
15917
15918 @item -mstack-protector-guard=@var{guard}
15919 @itemx -mstack-protector-guard-reg=@var{reg}
15920 @itemx -mstack-protector-guard-offset=@var{offset}
15921 @opindex mstack-protector-guard
15922 @opindex mstack-protector-guard-reg
15923 @opindex mstack-protector-guard-offset
15924 Generate stack protection code using canary at @var{guard}. Supported
15925 locations are @samp{global} for a global canary or @samp{sysreg} for a
15926 canary in an appropriate system register.
15927
15928 With the latter choice the options
15929 @option{-mstack-protector-guard-reg=@var{reg}} and
15930 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15931 which system register to use as base register for reading the canary,
15932 and from what offset from that base register. There is no default
15933 register or offset as this is entirely for use within the Linux
15934 kernel.
15935
15936 @item -mstack-protector-guard=@var{guard}
15937 @itemx -mstack-protector-guard-reg=@var{reg}
15938 @itemx -mstack-protector-guard-offset=@var{offset}
15939 @opindex mstack-protector-guard
15940 @opindex mstack-protector-guard-reg
15941 @opindex mstack-protector-guard-offset
15942 Generate stack protection code using canary at @var{guard}. Supported
15943 locations are @samp{global} for a global canary or @samp{sysreg} for a
15944 canary in an appropriate system register.
15945
15946 With the latter choice the options
15947 @option{-mstack-protector-guard-reg=@var{reg}} and
15948 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15949 which system register to use as base register for reading the canary,
15950 and from what offset from that base register. There is no default
15951 register or offset as this is entirely for use within the Linux
15952 kernel.
15953
15954 @item -mtls-dialect=desc
15955 @opindex mtls-dialect=desc
15956 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15957 of TLS variables. This is the default.
15958
15959 @item -mtls-dialect=traditional
15960 @opindex mtls-dialect=traditional
15961 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15962 of TLS variables.
15963
15964 @item -mtls-size=@var{size}
15965 @opindex mtls-size
15966 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15967 This option requires binutils 2.26 or newer.
15968
15969 @item -mfix-cortex-a53-835769
15970 @itemx -mno-fix-cortex-a53-835769
15971 @opindex mfix-cortex-a53-835769
15972 @opindex mno-fix-cortex-a53-835769
15973 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15974 This involves inserting a NOP instruction between memory instructions and
15975 64-bit integer multiply-accumulate instructions.
15976
15977 @item -mfix-cortex-a53-843419
15978 @itemx -mno-fix-cortex-a53-843419
15979 @opindex mfix-cortex-a53-843419
15980 @opindex mno-fix-cortex-a53-843419
15981 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15982 This erratum workaround is made at link time and this will only pass the
15983 corresponding flag to the linker.
15984
15985 @item -mlow-precision-recip-sqrt
15986 @itemx -mno-low-precision-recip-sqrt
15987 @opindex mlow-precision-recip-sqrt
15988 @opindex mno-low-precision-recip-sqrt
15989 Enable or disable the reciprocal square root approximation.
15990 This option only has an effect if @option{-ffast-math} or
15991 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15992 precision of reciprocal square root results to about 16 bits for
15993 single precision and to 32 bits for double precision.
15994
15995 @item -mlow-precision-sqrt
15996 @itemx -mno-low-precision-sqrt
15997 @opindex mlow-precision-sqrt
15998 @opindex mno-low-precision-sqrt
15999 Enable or disable the square root approximation.
16000 This option only has an effect if @option{-ffast-math} or
16001 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16002 precision of square root results to about 16 bits for
16003 single precision and to 32 bits for double precision.
16004 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16005
16006 @item -mlow-precision-div
16007 @itemx -mno-low-precision-div
16008 @opindex mlow-precision-div
16009 @opindex mno-low-precision-div
16010 Enable or disable the division approximation.
16011 This option only has an effect if @option{-ffast-math} or
16012 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16013 precision of division results to about 16 bits for
16014 single precision and to 32 bits for double precision.
16015
16016 @item -mtrack-speculation
16017 @itemx -mno-track-speculation
16018 Enable or disable generation of additional code to track speculative
16019 execution through conditional branches. The tracking state can then
16020 be used by the compiler when expanding calls to
16021 @code{__builtin_speculation_safe_copy} to permit a more efficient code
16022 sequence to be generated.
16023
16024 @item -moutline-atomics
16025 @itemx -mno-outline-atomics
16026 Enable or disable calls to out-of-line helpers to implement atomic operations.
16027 These helpers will, at runtime, determine if the LSE instructions from
16028 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16029 instructions that are present in the base ARMv8.0 ISA.
16030
16031 This option is only applicable when compiling for the base ARMv8.0
16032 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
16033 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16034 used directly. The same applies when using @option{-mcpu=} when the
16035 selected cpu supports the @samp{lse} feature.
16036
16037 @item -march=@var{name}
16038 @opindex march
16039 Specify the name of the target architecture and, optionally, one or
16040 more feature modifiers. This option has the form
16041 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16042
16043 The permissible values for @var{arch} are @samp{armv8-a},
16044 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
16045 @samp{armv8.5-a} or @var{native}.
16046
16047 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
16048 support for the ARMv8.5-A architecture extensions.
16049
16050 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
16051 support for the ARMv8.4-A architecture extensions.
16052
16053 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
16054 support for the ARMv8.3-A architecture extensions.
16055
16056 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
16057 support for the ARMv8.2-A architecture extensions.
16058
16059 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
16060 support for the ARMv8.1-A architecture extension. In particular, it
16061 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
16062
16063 The value @samp{native} is available on native AArch64 GNU/Linux and
16064 causes the compiler to pick the architecture of the host system. This
16065 option has no effect if the compiler is unable to recognize the
16066 architecture of the host system,
16067
16068 The permissible values for @var{feature} are listed in the sub-section
16069 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16070 Feature Modifiers}. Where conflicting feature modifiers are
16071 specified, the right-most feature is used.
16072
16073 GCC uses @var{name} to determine what kind of instructions it can emit
16074 when generating assembly code. If @option{-march} is specified
16075 without either of @option{-mtune} or @option{-mcpu} also being
16076 specified, the code is tuned to perform well across a range of target
16077 processors implementing the target architecture.
16078
16079 @item -mtune=@var{name}
16080 @opindex mtune
16081 Specify the name of the target processor for which GCC should tune the
16082 performance of the code. Permissible values for this option are:
16083 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16084 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16085 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16086 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16087 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16088 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16089 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16090 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
16091 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16092 @samp{thunderxt83}, @samp{thunderx2t99},
16093 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16094 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16095 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16096 @samp{native}.
16097
16098 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16099 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16100 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16101 should tune for a big.LITTLE system.
16102
16103 Additionally on native AArch64 GNU/Linux systems the value
16104 @samp{native} tunes performance to the host system. This option has no effect
16105 if the compiler is unable to recognize the processor of the host system.
16106
16107 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16108 are specified, the code is tuned to perform well across a range
16109 of target processors.
16110
16111 This option cannot be suffixed by feature modifiers.
16112
16113 @item -mcpu=@var{name}
16114 @opindex mcpu
16115 Specify the name of the target processor, optionally suffixed by one
16116 or more feature modifiers. This option has the form
16117 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16118 the permissible values for @var{cpu} are the same as those available
16119 for @option{-mtune}. The permissible values for @var{feature} are
16120 documented in the sub-section on
16121 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16122 Feature Modifiers}. Where conflicting feature modifiers are
16123 specified, the right-most feature is used.
16124
16125 GCC uses @var{name} to determine what kind of instructions it can emit when
16126 generating assembly code (as if by @option{-march}) and to determine
16127 the target processor for which to tune for performance (as if
16128 by @option{-mtune}). Where this option is used in conjunction
16129 with @option{-march} or @option{-mtune}, those options take precedence
16130 over the appropriate part of this option.
16131
16132 @item -moverride=@var{string}
16133 @opindex moverride
16134 Override tuning decisions made by the back-end in response to a
16135 @option{-mtune=} switch. The syntax, semantics, and accepted values
16136 for @var{string} in this option are not guaranteed to be consistent
16137 across releases.
16138
16139 This option is only intended to be useful when developing GCC.
16140
16141 @item -mverbose-cost-dump
16142 @opindex mverbose-cost-dump
16143 Enable verbose cost model dumping in the debug dump files. This option is
16144 provided for use in debugging the compiler.
16145
16146 @item -mpc-relative-literal-loads
16147 @itemx -mno-pc-relative-literal-loads
16148 @opindex mpc-relative-literal-loads
16149 @opindex mno-pc-relative-literal-loads
16150 Enable or disable PC-relative literal loads. With this option literal pools are
16151 accessed using a single instruction and emitted after each function. This
16152 limits the maximum size of functions to 1MB. This is enabled by default for
16153 @option{-mcmodel=tiny}.
16154
16155 @item -msign-return-address=@var{scope}
16156 @opindex msign-return-address
16157 Select the function scope on which return address signing will be applied.
16158 Permissible values are @samp{none}, which disables return address signing,
16159 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16160 functions, and @samp{all}, which enables pointer signing for all functions. The
16161 default value is @samp{none}. This option has been deprecated by
16162 -mbranch-protection.
16163
16164 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16165 @opindex mbranch-protection
16166 Select the branch protection features to use.
16167 @samp{none} is the default and turns off all types of branch protection.
16168 @samp{standard} turns on all types of branch protection features. If a feature
16169 has additional tuning options, then @samp{standard} sets it to its standard
16170 level.
16171 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16172 level: signing functions that save the return address to memory (non-leaf
16173 functions will practically always do this) using the a-key. The optional
16174 argument @samp{leaf} can be used to extend the signing to include leaf
16175 functions. The optional argument @samp{b-key} can be used to sign the functions
16176 with the B-key instead of the A-key.
16177 @samp{bti} turns on branch target identification mechanism.
16178
16179 @item -msve-vector-bits=@var{bits}
16180 @opindex msve-vector-bits
16181 Specify the number of bits in an SVE vector register. This option only has
16182 an effect when SVE is enabled.
16183
16184 GCC supports two forms of SVE code generation: ``vector-length
16185 agnostic'' output that works with any size of vector register and
16186 ``vector-length specific'' output that allows GCC to make assumptions
16187 about the vector length when it is useful for optimization reasons.
16188 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16189 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16190 Specifying @samp{scalable} selects vector-length agnostic
16191 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16192 agnostic output. All other values generate vector-length specific code.
16193 The behavior of these values may change in future releases and no value except
16194 @samp{scalable} should be relied on for producing code that is portable across
16195 different hardware SVE vector lengths.
16196
16197 The default is @samp{-msve-vector-bits=scalable}, which produces
16198 vector-length agnostic code.
16199 @end table
16200
16201 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16202 @anchor{aarch64-feature-modifiers}
16203 @cindex @option{-march} feature modifiers
16204 @cindex @option{-mcpu} feature modifiers
16205 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16206 the following and their inverses @option{no@var{feature}}:
16207
16208 @table @samp
16209 @item crc
16210 Enable CRC extension. This is on by default for
16211 @option{-march=armv8.1-a}.
16212 @item crypto
16213 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16214 instructions.
16215 @item fp
16216 Enable floating-point instructions. This is on by default for all possible
16217 values for options @option{-march} and @option{-mcpu}.
16218 @item simd
16219 Enable Advanced SIMD instructions. This also enables floating-point
16220 instructions. This is on by default for all possible values for options
16221 @option{-march} and @option{-mcpu}.
16222 @item sve
16223 Enable Scalable Vector Extension instructions. This also enables Advanced
16224 SIMD and floating-point instructions.
16225 @item lse
16226 Enable Large System Extension instructions. This is on by default for
16227 @option{-march=armv8.1-a}.
16228 @item rdma
16229 Enable Round Double Multiply Accumulate instructions. This is on by default
16230 for @option{-march=armv8.1-a}.
16231 @item fp16
16232 Enable FP16 extension. This also enables floating-point instructions.
16233 @item fp16fml
16234 Enable FP16 fmla extension. This also enables FP16 extensions and
16235 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.
16236
16237 @item rcpc
16238 Enable the RcPc extension. This does not change code generation from GCC,
16239 but is passed on to the assembler, enabling inline asm statements to use
16240 instructions from the RcPc extension.
16241 @item dotprod
16242 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16243 @item aes
16244 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16245 SIMD instructions.
16246 @item sha2
16247 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16248 @item sha3
16249 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16250 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16251 @item sm4
16252 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16253 Use of this option with architectures prior to Armv8.2-A is not supported.
16254 @item profile
16255 Enable the Statistical Profiling extension. This option is only to enable the
16256 extension at the assembler level and does not affect code generation.
16257 @item rng
16258 Enable the Armv8.5-a Random Number instructions. This option is only to
16259 enable the extension at the assembler level and does not affect code
16260 generation.
16261 @item memtag
16262 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16263 enable the extension at the assembler level and does not affect code
16264 generation.
16265 @item sb
16266 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16267 enable the extension at the assembler level and does not affect code
16268 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16269 @item ssbs
16270 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16271 is only to enable the extension at the assembler level and does not affect code
16272 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16273 @item predres
16274 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16275 This option is only to enable the extension at the assembler level and does
16276 not affect code generation. This option is enabled by default for
16277 @item sve2
16278 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16279 instructions.
16280 @item sve2-bitperm
16281 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16282 @item sve2-sm4
16283 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16284 @item sve2-aes
16285 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16286 @item sve2-sha3
16287 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16288 @option{-march=armv8.5-a}.
16289 @item tme
16290 Enable the Transactional Memory Extension.
16291
16292 @end table
16293
16294 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16295 which implies @option{fp}.
16296 Conversely, @option{nofp} implies @option{nosimd}, which implies
16297 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16298
16299 @node Adapteva Epiphany Options
16300 @subsection Adapteva Epiphany Options
16301
16302 These @samp{-m} options are defined for Adapteva Epiphany:
16303
16304 @table @gcctabopt
16305 @item -mhalf-reg-file
16306 @opindex mhalf-reg-file
16307 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16308 That allows code to run on hardware variants that lack these registers.
16309
16310 @item -mprefer-short-insn-regs
16311 @opindex mprefer-short-insn-regs
16312 Preferentially allocate registers that allow short instruction generation.
16313 This can result in increased instruction count, so this may either reduce or
16314 increase overall code size.
16315
16316 @item -mbranch-cost=@var{num}
16317 @opindex mbranch-cost
16318 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16319 This cost is only a heuristic and is not guaranteed to produce
16320 consistent results across releases.
16321
16322 @item -mcmove
16323 @opindex mcmove
16324 Enable the generation of conditional moves.
16325
16326 @item -mnops=@var{num}
16327 @opindex mnops
16328 Emit @var{num} NOPs before every other generated instruction.
16329
16330 @item -mno-soft-cmpsf
16331 @opindex mno-soft-cmpsf
16332 @opindex msoft-cmpsf
16333 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16334 and test the flags. This is faster than a software comparison, but can
16335 get incorrect results in the presence of NaNs, or when two different small
16336 numbers are compared such that their difference is calculated as zero.
16337 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16338 software comparisons.
16339
16340 @item -mstack-offset=@var{num}
16341 @opindex mstack-offset
16342 Set the offset between the top of the stack and the stack pointer.
16343 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16344 can be used by leaf functions without stack allocation.
16345 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16346 Note also that this option changes the ABI; compiling a program with a
16347 different stack offset than the libraries have been compiled with
16348 generally does not work.
16349 This option can be useful if you want to evaluate if a different stack
16350 offset would give you better code, but to actually use a different stack
16351 offset to build working programs, it is recommended to configure the
16352 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16353
16354 @item -mno-round-nearest
16355 @opindex mno-round-nearest
16356 @opindex mround-nearest
16357 Make the scheduler assume that the rounding mode has been set to
16358 truncating. The default is @option{-mround-nearest}.
16359
16360 @item -mlong-calls
16361 @opindex mlong-calls
16362 If not otherwise specified by an attribute, assume all calls might be beyond
16363 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16364 function address into a register before performing a (otherwise direct) call.
16365 This is the default.
16366
16367 @item -mshort-calls
16368 @opindex short-calls
16369 If not otherwise specified by an attribute, assume all direct calls are
16370 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16371 for direct calls. The default is @option{-mlong-calls}.
16372
16373 @item -msmall16
16374 @opindex msmall16
16375 Assume addresses can be loaded as 16-bit unsigned values. This does not
16376 apply to function addresses for which @option{-mlong-calls} semantics
16377 are in effect.
16378
16379 @item -mfp-mode=@var{mode}
16380 @opindex mfp-mode
16381 Set the prevailing mode of the floating-point unit.
16382 This determines the floating-point mode that is provided and expected
16383 at function call and return time. Making this mode match the mode you
16384 predominantly need at function start can make your programs smaller and
16385 faster by avoiding unnecessary mode switches.
16386
16387 @var{mode} can be set to one the following values:
16388
16389 @table @samp
16390 @item caller
16391 Any mode at function entry is valid, and retained or restored when
16392 the function returns, and when it calls other functions.
16393 This mode is useful for compiling libraries or other compilation units
16394 you might want to incorporate into different programs with different
16395 prevailing FPU modes, and the convenience of being able to use a single
16396 object file outweighs the size and speed overhead for any extra
16397 mode switching that might be needed, compared with what would be needed
16398 with a more specific choice of prevailing FPU mode.
16399
16400 @item truncate
16401 This is the mode used for floating-point calculations with
16402 truncating (i.e.@: round towards zero) rounding mode. That includes
16403 conversion from floating point to integer.
16404
16405 @item round-nearest
16406 This is the mode used for floating-point calculations with
16407 round-to-nearest-or-even rounding mode.
16408
16409 @item int
16410 This is the mode used to perform integer calculations in the FPU, e.g.@:
16411 integer multiply, or integer multiply-and-accumulate.
16412 @end table
16413
16414 The default is @option{-mfp-mode=caller}
16415
16416 @item -mno-split-lohi
16417 @itemx -mno-postinc
16418 @itemx -mno-postmodify
16419 @opindex mno-split-lohi
16420 @opindex msplit-lohi
16421 @opindex mno-postinc
16422 @opindex mpostinc
16423 @opindex mno-postmodify
16424 @opindex mpostmodify
16425 Code generation tweaks that disable, respectively, splitting of 32-bit
16426 loads, generation of post-increment addresses, and generation of
16427 post-modify addresses. The defaults are @option{msplit-lohi},
16428 @option{-mpost-inc}, and @option{-mpost-modify}.
16429
16430 @item -mnovect-double
16431 @opindex mno-vect-double
16432 @opindex mvect-double
16433 Change the preferred SIMD mode to SImode. The default is
16434 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16435
16436 @item -max-vect-align=@var{num}
16437 @opindex max-vect-align
16438 The maximum alignment for SIMD vector mode types.
16439 @var{num} may be 4 or 8. The default is 8.
16440 Note that this is an ABI change, even though many library function
16441 interfaces are unaffected if they don't use SIMD vector modes
16442 in places that affect size and/or alignment of relevant types.
16443
16444 @item -msplit-vecmove-early
16445 @opindex msplit-vecmove-early
16446 Split vector moves into single word moves before reload. In theory this
16447 can give better register allocation, but so far the reverse seems to be
16448 generally the case.
16449
16450 @item -m1reg-@var{reg}
16451 @opindex m1reg-
16452 Specify a register to hold the constant @minus{}1, which makes loading small negative
16453 constants and certain bitmasks faster.
16454 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16455 which specify use of that register as a fixed register,
16456 and @samp{none}, which means that no register is used for this
16457 purpose. The default is @option{-m1reg-none}.
16458
16459 @end table
16460
16461 @node AMD GCN Options
16462 @subsection AMD GCN Options
16463 @cindex AMD GCN Options
16464
16465 These options are defined specifically for the AMD GCN port.
16466
16467 @table @gcctabopt
16468
16469 @item -march=@var{gpu}
16470 @opindex march
16471 @itemx -mtune=@var{gpu}
16472 @opindex mtune
16473 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16474 are
16475
16476 @table @samp
16477 @opindex fiji
16478 @item fiji
16479 Compile for GCN3 Fiji devices (gfx803).
16480
16481 @item gfx900
16482 Compile for GCN5 Vega 10 devices (gfx900).
16483
16484 @item gfx906
16485 Compile for GCN5 Vega 20 devices (gfx906).
16486
16487 @end table
16488
16489 @item -mstack-size=@var{bytes}
16490 @opindex mstack-size
16491 Specify how many @var{bytes} of stack space will be requested for each GPU
16492 thread (wave-front). Beware that there may be many threads and limited memory
16493 available. The size of the stack allocation may also have an impact on
16494 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16495 1MB otherwise.
16496
16497 @end table
16498
16499 @node ARC Options
16500 @subsection ARC Options
16501 @cindex ARC options
16502
16503 The following options control the architecture variant for which code
16504 is being compiled:
16505
16506 @c architecture variants
16507 @table @gcctabopt
16508
16509 @item -mbarrel-shifter
16510 @opindex mbarrel-shifter
16511 Generate instructions supported by barrel shifter. This is the default
16512 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16513
16514 @item -mjli-always
16515 @opindex mjli-alawys
16516 Force to call a function using jli_s instruction. This option is
16517 valid only for ARCv2 architecture.
16518
16519 @item -mcpu=@var{cpu}
16520 @opindex mcpu
16521 Set architecture type, register usage, and instruction scheduling
16522 parameters for @var{cpu}. There are also shortcut alias options
16523 available for backward compatibility and convenience. Supported
16524 values for @var{cpu} are
16525
16526 @table @samp
16527 @opindex mA6
16528 @opindex mARC600
16529 @item arc600
16530 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16531
16532 @item arc601
16533 @opindex mARC601
16534 Compile for ARC601. Alias: @option{-mARC601}.
16535
16536 @item arc700
16537 @opindex mA7
16538 @opindex mARC700
16539 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16540 This is the default when configured with @option{--with-cpu=arc700}@.
16541
16542 @item arcem
16543 Compile for ARC EM.
16544
16545 @item archs
16546 Compile for ARC HS.
16547
16548 @item em
16549 Compile for ARC EM CPU with no hardware extensions.
16550
16551 @item em4
16552 Compile for ARC EM4 CPU.
16553
16554 @item em4_dmips
16555 Compile for ARC EM4 DMIPS CPU.
16556
16557 @item em4_fpus
16558 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16559 extension.
16560
16561 @item em4_fpuda
16562 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16563 double assist instructions.
16564
16565 @item hs
16566 Compile for ARC HS CPU with no hardware extensions except the atomic
16567 instructions.
16568
16569 @item hs34
16570 Compile for ARC HS34 CPU.
16571
16572 @item hs38
16573 Compile for ARC HS38 CPU.
16574
16575 @item hs38_linux
16576 Compile for ARC HS38 CPU with all hardware extensions on.
16577
16578 @item arc600_norm
16579 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16580
16581 @item arc600_mul32x16
16582 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16583 instructions enabled.
16584
16585 @item arc600_mul64
16586 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16587 instructions enabled.
16588
16589 @item arc601_norm
16590 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16591
16592 @item arc601_mul32x16
16593 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16594 instructions enabled.
16595
16596 @item arc601_mul64
16597 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16598 instructions enabled.
16599
16600 @item nps400
16601 Compile for ARC 700 on NPS400 chip.
16602
16603 @item em_mini
16604 Compile for ARC EM minimalist configuration featuring reduced register
16605 set.
16606
16607 @end table
16608
16609 @item -mdpfp
16610 @opindex mdpfp
16611 @itemx -mdpfp-compact
16612 @opindex mdpfp-compact
16613 Generate double-precision FPX instructions, tuned for the compact
16614 implementation.
16615
16616 @item -mdpfp-fast
16617 @opindex mdpfp-fast
16618 Generate double-precision FPX instructions, tuned for the fast
16619 implementation.
16620
16621 @item -mno-dpfp-lrsr
16622 @opindex mno-dpfp-lrsr
16623 Disable @code{lr} and @code{sr} instructions from using FPX extension
16624 aux registers.
16625
16626 @item -mea
16627 @opindex mea
16628 Generate extended arithmetic instructions. Currently only
16629 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16630 supported. Only valid for @option{-mcpu=ARC700}.
16631
16632 @item -mno-mpy
16633 @opindex mno-mpy
16634 @opindex mmpy
16635 Do not generate @code{mpy}-family instructions for ARC700. This option is
16636 deprecated.
16637
16638 @item -mmul32x16
16639 @opindex mmul32x16
16640 Generate 32x16-bit multiply and multiply-accumulate instructions.
16641
16642 @item -mmul64
16643 @opindex mmul64
16644 Generate @code{mul64} and @code{mulu64} instructions.
16645 Only valid for @option{-mcpu=ARC600}.
16646
16647 @item -mnorm
16648 @opindex mnorm
16649 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16650 is in effect.
16651
16652 @item -mspfp
16653 @opindex mspfp
16654 @itemx -mspfp-compact
16655 @opindex mspfp-compact
16656 Generate single-precision FPX instructions, tuned for the compact
16657 implementation.
16658
16659 @item -mspfp-fast
16660 @opindex mspfp-fast
16661 Generate single-precision FPX instructions, tuned for the fast
16662 implementation.
16663
16664 @item -msimd
16665 @opindex msimd
16666 Enable generation of ARC SIMD instructions via target-specific
16667 builtins. Only valid for @option{-mcpu=ARC700}.
16668
16669 @item -msoft-float
16670 @opindex msoft-float
16671 This option ignored; it is provided for compatibility purposes only.
16672 Software floating-point code is emitted by default, and this default
16673 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16674 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16675 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16676
16677 @item -mswap
16678 @opindex mswap
16679 Generate @code{swap} instructions.
16680
16681 @item -matomic
16682 @opindex matomic
16683 This enables use of the locked load/store conditional extension to implement
16684 atomic memory built-in functions. Not available for ARC 6xx or ARC
16685 EM cores.
16686
16687 @item -mdiv-rem
16688 @opindex mdiv-rem
16689 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16690
16691 @item -mcode-density
16692 @opindex mcode-density
16693 Enable code density instructions for ARC EM.
16694 This option is on by default for ARC HS.
16695
16696 @item -mll64
16697 @opindex mll64
16698 Enable double load/store operations for ARC HS cores.
16699
16700 @item -mtp-regno=@var{regno}
16701 @opindex mtp-regno
16702 Specify thread pointer register number.
16703
16704 @item -mmpy-option=@var{multo}
16705 @opindex mmpy-option
16706 Compile ARCv2 code with a multiplier design option. You can specify
16707 the option using either a string or numeric value for @var{multo}.
16708 @samp{wlh1} is the default value. The recognized values are:
16709
16710 @table @samp
16711 @item 0
16712 @itemx none
16713 No multiplier available.
16714
16715 @item 1
16716 @itemx w
16717 16x16 multiplier, fully pipelined.
16718 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16719
16720 @item 2
16721 @itemx wlh1
16722 32x32 multiplier, fully
16723 pipelined (1 stage). The following instructions are additionally
16724 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16725
16726 @item 3
16727 @itemx wlh2
16728 32x32 multiplier, fully pipelined
16729 (2 stages). The following instructions are additionally enabled: @code{mpy},
16730 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16731
16732 @item 4
16733 @itemx wlh3
16734 Two 16x16 multipliers, blocking,
16735 sequential. The following instructions are additionally enabled: @code{mpy},
16736 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16737
16738 @item 5
16739 @itemx wlh4
16740 One 16x16 multiplier, blocking,
16741 sequential. The following instructions are additionally enabled: @code{mpy},
16742 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16743
16744 @item 6
16745 @itemx wlh5
16746 One 32x4 multiplier, blocking,
16747 sequential. The following instructions are additionally enabled: @code{mpy},
16748 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16749
16750 @item 7
16751 @itemx plus_dmpy
16752 ARC HS SIMD support.
16753
16754 @item 8
16755 @itemx plus_macd
16756 ARC HS SIMD support.
16757
16758 @item 9
16759 @itemx plus_qmacw
16760 ARC HS SIMD support.
16761
16762 @end table
16763
16764 This option is only available for ARCv2 cores@.
16765
16766 @item -mfpu=@var{fpu}
16767 @opindex mfpu
16768 Enables support for specific floating-point hardware extensions for ARCv2
16769 cores. Supported values for @var{fpu} are:
16770
16771 @table @samp
16772
16773 @item fpus
16774 Enables support for single-precision floating-point hardware
16775 extensions@.
16776
16777 @item fpud
16778 Enables support for double-precision floating-point hardware
16779 extensions. The single-precision floating-point extension is also
16780 enabled. Not available for ARC EM@.
16781
16782 @item fpuda
16783 Enables support for double-precision floating-point hardware
16784 extensions using double-precision assist instructions. The single-precision
16785 floating-point extension is also enabled. This option is
16786 only available for ARC EM@.
16787
16788 @item fpuda_div
16789 Enables support for double-precision floating-point hardware
16790 extensions using double-precision assist instructions.
16791 The single-precision floating-point, square-root, and divide
16792 extensions are also enabled. This option is
16793 only available for ARC EM@.
16794
16795 @item fpuda_fma
16796 Enables support for double-precision floating-point hardware
16797 extensions using double-precision assist instructions.
16798 The single-precision floating-point and fused multiply and add
16799 hardware extensions are also enabled. This option is
16800 only available for ARC EM@.
16801
16802 @item fpuda_all
16803 Enables support for double-precision floating-point hardware
16804 extensions using double-precision assist instructions.
16805 All single-precision floating-point hardware extensions are also
16806 enabled. This option is only available for ARC EM@.
16807
16808 @item fpus_div
16809 Enables support for single-precision floating-point, square-root and divide
16810 hardware extensions@.
16811
16812 @item fpud_div
16813 Enables support for double-precision floating-point, square-root and divide
16814 hardware extensions. This option
16815 includes option @samp{fpus_div}. Not available for ARC EM@.
16816
16817 @item fpus_fma
16818 Enables support for single-precision floating-point and
16819 fused multiply and add hardware extensions@.
16820
16821 @item fpud_fma
16822 Enables support for double-precision floating-point and
16823 fused multiply and add hardware extensions. This option
16824 includes option @samp{fpus_fma}. Not available for ARC EM@.
16825
16826 @item fpus_all
16827 Enables support for all single-precision floating-point hardware
16828 extensions@.
16829
16830 @item fpud_all
16831 Enables support for all single- and double-precision floating-point
16832 hardware extensions. Not available for ARC EM@.
16833
16834 @end table
16835
16836 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16837 @opindex mirq-ctrl-saved
16838 Specifies general-purposes registers that the processor automatically
16839 saves/restores on interrupt entry and exit. @var{register-range} is
16840 specified as two registers separated by a dash. The register range
16841 always starts with @code{r0}, the upper limit is @code{fp} register.
16842 @var{blink} and @var{lp_count} are optional. This option is only
16843 valid for ARC EM and ARC HS cores.
16844
16845 @item -mrgf-banked-regs=@var{number}
16846 @opindex mrgf-banked-regs
16847 Specifies the number of registers replicated in second register bank
16848 on entry to fast interrupt. Fast interrupts are interrupts with the
16849 highest priority level P0. These interrupts save only PC and STATUS32
16850 registers to avoid memory transactions during interrupt entry and exit
16851 sequences. Use this option when you are using fast interrupts in an
16852 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16853
16854 @item -mlpc-width=@var{width}
16855 @opindex mlpc-width
16856 Specify the width of the @code{lp_count} register. Valid values for
16857 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16858 fixed to 32 bits. If the width is less than 32, the compiler does not
16859 attempt to transform loops in your program to use the zero-delay loop
16860 mechanism unless it is known that the @code{lp_count} register can
16861 hold the required loop-counter value. Depending on the width
16862 specified, the compiler and run-time library might continue to use the
16863 loop mechanism for various needs. This option defines macro
16864 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16865
16866 @item -mrf16
16867 @opindex mrf16
16868 This option instructs the compiler to generate code for a 16-entry
16869 register file. This option defines the @code{__ARC_RF16__}
16870 preprocessor macro.
16871
16872 @item -mbranch-index
16873 @opindex mbranch-index
16874 Enable use of @code{bi} or @code{bih} instructions to implement jump
16875 tables.
16876
16877 @end table
16878
16879 The following options are passed through to the assembler, and also
16880 define preprocessor macro symbols.
16881
16882 @c Flags used by the assembler, but for which we define preprocessor
16883 @c macro symbols as well.
16884 @table @gcctabopt
16885 @item -mdsp-packa
16886 @opindex mdsp-packa
16887 Passed down to the assembler to enable the DSP Pack A extensions.
16888 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16889 deprecated.
16890
16891 @item -mdvbf
16892 @opindex mdvbf
16893 Passed down to the assembler to enable the dual Viterbi butterfly
16894 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16895 option is deprecated.
16896
16897 @c ARC700 4.10 extension instruction
16898 @item -mlock
16899 @opindex mlock
16900 Passed down to the assembler to enable the locked load/store
16901 conditional extension. Also sets the preprocessor symbol
16902 @code{__Xlock}.
16903
16904 @item -mmac-d16
16905 @opindex mmac-d16
16906 Passed down to the assembler. Also sets the preprocessor symbol
16907 @code{__Xxmac_d16}. This option is deprecated.
16908
16909 @item -mmac-24
16910 @opindex mmac-24
16911 Passed down to the assembler. Also sets the preprocessor symbol
16912 @code{__Xxmac_24}. This option is deprecated.
16913
16914 @c ARC700 4.10 extension instruction
16915 @item -mrtsc
16916 @opindex mrtsc
16917 Passed down to the assembler to enable the 64-bit time-stamp counter
16918 extension instruction. Also sets the preprocessor symbol
16919 @code{__Xrtsc}. This option is deprecated.
16920
16921 @c ARC700 4.10 extension instruction
16922 @item -mswape
16923 @opindex mswape
16924 Passed down to the assembler to enable the swap byte ordering
16925 extension instruction. Also sets the preprocessor symbol
16926 @code{__Xswape}.
16927
16928 @item -mtelephony
16929 @opindex mtelephony
16930 Passed down to the assembler to enable dual- and single-operand
16931 instructions for telephony. Also sets the preprocessor symbol
16932 @code{__Xtelephony}. This option is deprecated.
16933
16934 @item -mxy
16935 @opindex mxy
16936 Passed down to the assembler to enable the XY memory extension. Also
16937 sets the preprocessor symbol @code{__Xxy}.
16938
16939 @end table
16940
16941 The following options control how the assembly code is annotated:
16942
16943 @c Assembly annotation options
16944 @table @gcctabopt
16945 @item -misize
16946 @opindex misize
16947 Annotate assembler instructions with estimated addresses.
16948
16949 @item -mannotate-align
16950 @opindex mannotate-align
16951 Explain what alignment considerations lead to the decision to make an
16952 instruction short or long.
16953
16954 @end table
16955
16956 The following options are passed through to the linker:
16957
16958 @c options passed through to the linker
16959 @table @gcctabopt
16960 @item -marclinux
16961 @opindex marclinux
16962 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16963 This option is enabled by default in tool chains built for
16964 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16965 when profiling is not requested.
16966
16967 @item -marclinux_prof
16968 @opindex marclinux_prof
16969 Passed through to the linker, to specify use of the
16970 @code{arclinux_prof} emulation. This option is enabled by default in
16971 tool chains built for @w{@code{arc-linux-uclibc}} and
16972 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16973
16974 @end table
16975
16976 The following options control the semantics of generated code:
16977
16978 @c semantically relevant code generation options
16979 @table @gcctabopt
16980 @item -mlong-calls
16981 @opindex mlong-calls
16982 Generate calls as register indirect calls, thus providing access
16983 to the full 32-bit address range.
16984
16985 @item -mmedium-calls
16986 @opindex mmedium-calls
16987 Don't use less than 25-bit addressing range for calls, which is the
16988 offset available for an unconditional branch-and-link
16989 instruction. Conditional execution of function calls is suppressed, to
16990 allow use of the 25-bit range, rather than the 21-bit range with
16991 conditional branch-and-link. This is the default for tool chains built
16992 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16993
16994 @item -G @var{num}
16995 @opindex G
16996 Put definitions of externally-visible data in a small data section if
16997 that data is no bigger than @var{num} bytes. The default value of
16998 @var{num} is 4 for any ARC configuration, or 8 when we have double
16999 load/store operations.
17000
17001 @item -mno-sdata
17002 @opindex mno-sdata
17003 @opindex msdata
17004 Do not generate sdata references. This is the default for tool chains
17005 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17006 targets.
17007
17008 @item -mvolatile-cache
17009 @opindex mvolatile-cache
17010 Use ordinarily cached memory accesses for volatile references. This is the
17011 default.
17012
17013 @item -mno-volatile-cache
17014 @opindex mno-volatile-cache
17015 @opindex mvolatile-cache
17016 Enable cache bypass for volatile references.
17017
17018 @end table
17019
17020 The following options fine tune code generation:
17021 @c code generation tuning options
17022 @table @gcctabopt
17023 @item -malign-call
17024 @opindex malign-call
17025 Do alignment optimizations for call instructions.
17026
17027 @item -mauto-modify-reg
17028 @opindex mauto-modify-reg
17029 Enable the use of pre/post modify with register displacement.
17030
17031 @item -mbbit-peephole
17032 @opindex mbbit-peephole
17033 Enable bbit peephole2.
17034
17035 @item -mno-brcc
17036 @opindex mno-brcc
17037 This option disables a target-specific pass in @file{arc_reorg} to
17038 generate compare-and-branch (@code{br@var{cc}}) instructions.
17039 It has no effect on
17040 generation of these instructions driven by the combiner pass.
17041
17042 @item -mcase-vector-pcrel
17043 @opindex mcase-vector-pcrel
17044 Use PC-relative switch case tables to enable case table shortening.
17045 This is the default for @option{-Os}.
17046
17047 @item -mcompact-casesi
17048 @opindex mcompact-casesi
17049 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
17050 and only available for ARCv1 cores. This option is deprecated.
17051
17052 @item -mno-cond-exec
17053 @opindex mno-cond-exec
17054 Disable the ARCompact-specific pass to generate conditional
17055 execution instructions.
17056
17057 Due to delay slot scheduling and interactions between operand numbers,
17058 literal sizes, instruction lengths, and the support for conditional execution,
17059 the target-independent pass to generate conditional execution is often lacking,
17060 so the ARC port has kept a special pass around that tries to find more
17061 conditional execution generation opportunities after register allocation,
17062 branch shortening, and delay slot scheduling have been done. This pass
17063 generally, but not always, improves performance and code size, at the cost of
17064 extra compilation time, which is why there is an option to switch it off.
17065 If you have a problem with call instructions exceeding their allowable
17066 offset range because they are conditionalized, you should consider using
17067 @option{-mmedium-calls} instead.
17068
17069 @item -mearly-cbranchsi
17070 @opindex mearly-cbranchsi
17071 Enable pre-reload use of the @code{cbranchsi} pattern.
17072
17073 @item -mexpand-adddi
17074 @opindex mexpand-adddi
17075 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17076 @code{add.f}, @code{adc} etc. This option is deprecated.
17077
17078 @item -mindexed-loads
17079 @opindex mindexed-loads
17080 Enable the use of indexed loads. This can be problematic because some
17081 optimizers then assume that indexed stores exist, which is not
17082 the case.
17083
17084 @item -mlra
17085 @opindex mlra
17086 Enable Local Register Allocation. This is still experimental for ARC,
17087 so by default the compiler uses standard reload
17088 (i.e.@: @option{-mno-lra}).
17089
17090 @item -mlra-priority-none
17091 @opindex mlra-priority-none
17092 Don't indicate any priority for target registers.
17093
17094 @item -mlra-priority-compact
17095 @opindex mlra-priority-compact
17096 Indicate target register priority for r0..r3 / r12..r15.
17097
17098 @item -mlra-priority-noncompact
17099 @opindex mlra-priority-noncompact
17100 Reduce target register priority for r0..r3 / r12..r15.
17101
17102 @item -mmillicode
17103 @opindex mmillicode
17104 When optimizing for size (using @option{-Os}), prologues and epilogues
17105 that have to save or restore a large number of registers are often
17106 shortened by using call to a special function in libgcc; this is
17107 referred to as a @emph{millicode} call. As these calls can pose
17108 performance issues, and/or cause linking issues when linking in a
17109 nonstandard way, this option is provided to turn on or off millicode
17110 call generation.
17111
17112 @item -mcode-density-frame
17113 @opindex mcode-density-frame
17114 This option enable the compiler to emit @code{enter} and @code{leave}
17115 instructions. These instructions are only valid for CPUs with
17116 code-density feature.
17117
17118 @item -mmixed-code
17119 @opindex mmixed-code
17120 Tweak register allocation to help 16-bit instruction generation.
17121 This generally has the effect of decreasing the average instruction size
17122 while increasing the instruction count.
17123
17124 @item -mq-class
17125 @opindex mq-class
17126 Enable @samp{q} instruction alternatives.
17127 This is the default for @option{-Os}.
17128
17129 @item -mRcq
17130 @opindex mRcq
17131 Enable @samp{Rcq} constraint handling.
17132 Most short code generation depends on this.
17133 This is the default.
17134
17135 @item -mRcw
17136 @opindex mRcw
17137 Enable @samp{Rcw} constraint handling.
17138 Most ccfsm condexec mostly depends on this.
17139 This is the default.
17140
17141 @item -msize-level=@var{level}
17142 @opindex msize-level
17143 Fine-tune size optimization with regards to instruction lengths and alignment.
17144 The recognized values for @var{level} are:
17145 @table @samp
17146 @item 0
17147 No size optimization. This level is deprecated and treated like @samp{1}.
17148
17149 @item 1
17150 Short instructions are used opportunistically.
17151
17152 @item 2
17153 In addition, alignment of loops and of code after barriers are dropped.
17154
17155 @item 3
17156 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17157
17158 @end table
17159
17160 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17161 the behavior when this is not set is equivalent to level @samp{1}.
17162
17163 @item -mtune=@var{cpu}
17164 @opindex mtune
17165 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17166 by @option{-mcpu=}.
17167
17168 Supported values for @var{cpu} are
17169
17170 @table @samp
17171 @item ARC600
17172 Tune for ARC600 CPU.
17173
17174 @item ARC601
17175 Tune for ARC601 CPU.
17176
17177 @item ARC700
17178 Tune for ARC700 CPU with standard multiplier block.
17179
17180 @item ARC700-xmac
17181 Tune for ARC700 CPU with XMAC block.
17182
17183 @item ARC725D
17184 Tune for ARC725D CPU.
17185
17186 @item ARC750D
17187 Tune for ARC750D CPU.
17188
17189 @end table
17190
17191 @item -mmultcost=@var{num}
17192 @opindex mmultcost
17193 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17194 normal instruction.
17195
17196 @item -munalign-prob-threshold=@var{probability}
17197 @opindex munalign-prob-threshold
17198 Set probability threshold for unaligning branches.
17199 When tuning for @samp{ARC700} and optimizing for speed, branches without
17200 filled delay slot are preferably emitted unaligned and long, unless
17201 profiling indicates that the probability for the branch to be taken
17202 is below @var{probability}. @xref{Cross-profiling}.
17203 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17204
17205 @end table
17206
17207 The following options are maintained for backward compatibility, but
17208 are now deprecated and will be removed in a future release:
17209
17210 @c Deprecated options
17211 @table @gcctabopt
17212
17213 @item -margonaut
17214 @opindex margonaut
17215 Obsolete FPX.
17216
17217 @item -mbig-endian
17218 @opindex mbig-endian
17219 @itemx -EB
17220 @opindex EB
17221 Compile code for big-endian targets. Use of these options is now
17222 deprecated. Big-endian code is supported by configuring GCC to build
17223 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17224 for which big endian is the default.
17225
17226 @item -mlittle-endian
17227 @opindex mlittle-endian
17228 @itemx -EL
17229 @opindex EL
17230 Compile code for little-endian targets. Use of these options is now
17231 deprecated. Little-endian code is supported by configuring GCC to build
17232 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17233 for which little endian is the default.
17234
17235 @item -mbarrel_shifter
17236 @opindex mbarrel_shifter
17237 Replaced by @option{-mbarrel-shifter}.
17238
17239 @item -mdpfp_compact
17240 @opindex mdpfp_compact
17241 Replaced by @option{-mdpfp-compact}.
17242
17243 @item -mdpfp_fast
17244 @opindex mdpfp_fast
17245 Replaced by @option{-mdpfp-fast}.
17246
17247 @item -mdsp_packa
17248 @opindex mdsp_packa
17249 Replaced by @option{-mdsp-packa}.
17250
17251 @item -mEA
17252 @opindex mEA
17253 Replaced by @option{-mea}.
17254
17255 @item -mmac_24
17256 @opindex mmac_24
17257 Replaced by @option{-mmac-24}.
17258
17259 @item -mmac_d16
17260 @opindex mmac_d16
17261 Replaced by @option{-mmac-d16}.
17262
17263 @item -mspfp_compact
17264 @opindex mspfp_compact
17265 Replaced by @option{-mspfp-compact}.
17266
17267 @item -mspfp_fast
17268 @opindex mspfp_fast
17269 Replaced by @option{-mspfp-fast}.
17270
17271 @item -mtune=@var{cpu}
17272 @opindex mtune
17273 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17274 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17275 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17276
17277 @item -multcost=@var{num}
17278 @opindex multcost
17279 Replaced by @option{-mmultcost}.
17280
17281 @end table
17282
17283 @node ARM Options
17284 @subsection ARM Options
17285 @cindex ARM options
17286
17287 These @samp{-m} options are defined for the ARM port:
17288
17289 @table @gcctabopt
17290 @item -mabi=@var{name}
17291 @opindex mabi
17292 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17293 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17294
17295 @item -mapcs-frame
17296 @opindex mapcs-frame
17297 Generate a stack frame that is compliant with the ARM Procedure Call
17298 Standard for all functions, even if this is not strictly necessary for
17299 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17300 with this option causes the stack frames not to be generated for
17301 leaf functions. The default is @option{-mno-apcs-frame}.
17302 This option is deprecated.
17303
17304 @item -mapcs
17305 @opindex mapcs
17306 This is a synonym for @option{-mapcs-frame} and is deprecated.
17307
17308 @ignore
17309 @c not currently implemented
17310 @item -mapcs-stack-check
17311 @opindex mapcs-stack-check
17312 Generate code to check the amount of stack space available upon entry to
17313 every function (that actually uses some stack space). If there is
17314 insufficient space available then either the function
17315 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17316 called, depending upon the amount of stack space required. The runtime
17317 system is required to provide these functions. The default is
17318 @option{-mno-apcs-stack-check}, since this produces smaller code.
17319
17320 @c not currently implemented
17321 @item -mapcs-reentrant
17322 @opindex mapcs-reentrant
17323 Generate reentrant, position-independent code. The default is
17324 @option{-mno-apcs-reentrant}.
17325 @end ignore
17326
17327 @item -mthumb-interwork
17328 @opindex mthumb-interwork
17329 Generate code that supports calling between the ARM and Thumb
17330 instruction sets. Without this option, on pre-v5 architectures, the
17331 two instruction sets cannot be reliably used inside one program. The
17332 default is @option{-mno-thumb-interwork}, since slightly larger code
17333 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17334 configurations this option is meaningless.
17335
17336 @item -mno-sched-prolog
17337 @opindex mno-sched-prolog
17338 @opindex msched-prolog
17339 Prevent the reordering of instructions in the function prologue, or the
17340 merging of those instruction with the instructions in the function's
17341 body. This means that all functions start with a recognizable set
17342 of instructions (or in fact one of a choice from a small set of
17343 different function prologues), and this information can be used to
17344 locate the start of functions inside an executable piece of code. The
17345 default is @option{-msched-prolog}.
17346
17347 @item -mfloat-abi=@var{name}
17348 @opindex mfloat-abi
17349 Specifies which floating-point ABI to use. Permissible values
17350 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17351
17352 Specifying @samp{soft} causes GCC to generate output containing
17353 library calls for floating-point operations.
17354 @samp{softfp} allows the generation of code using hardware floating-point
17355 instructions, but still uses the soft-float calling conventions.
17356 @samp{hard} allows generation of floating-point instructions
17357 and uses FPU-specific calling conventions.
17358
17359 The default depends on the specific target configuration. Note that
17360 the hard-float and soft-float ABIs are not link-compatible; you must
17361 compile your entire program with the same ABI, and link with a
17362 compatible set of libraries.
17363
17364 @item -mgeneral-regs-only
17365 @opindex mgeneral-regs-only
17366 Generate code which uses only the general-purpose registers. This will prevent
17367 the compiler from using floating-point and Advanced SIMD registers but will not
17368 impose any restrictions on the assembler.
17369
17370 @item -mlittle-endian
17371 @opindex mlittle-endian
17372 Generate code for a processor running in little-endian mode. This is
17373 the default for all standard configurations.
17374
17375 @item -mbig-endian
17376 @opindex mbig-endian
17377 Generate code for a processor running in big-endian mode; the default is
17378 to compile code for a little-endian processor.
17379
17380 @item -mbe8
17381 @itemx -mbe32
17382 @opindex mbe8
17383 When linking a big-endian image select between BE8 and BE32 formats.
17384 The option has no effect for little-endian images and is ignored. The
17385 default is dependent on the selected target architecture. For ARMv6
17386 and later architectures the default is BE8, for older architectures
17387 the default is BE32. BE32 format has been deprecated by ARM.
17388
17389 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17390 @opindex march
17391 This specifies the name of the target ARM architecture. GCC uses this
17392 name to determine what kind of instructions it can emit when generating
17393 assembly code. This option can be used in conjunction with or instead
17394 of the @option{-mcpu=} option.
17395
17396 Permissible names are:
17397 @samp{armv4t},
17398 @samp{armv5t}, @samp{armv5te},
17399 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17400 @samp{armv6z}, @samp{armv6zk},
17401 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17402 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17403 @samp{armv8.4-a},
17404 @samp{armv8.5-a},
17405 @samp{armv7-r},
17406 @samp{armv8-r},
17407 @samp{armv6-m}, @samp{armv6s-m},
17408 @samp{armv7-m}, @samp{armv7e-m},
17409 @samp{armv8-m.base}, @samp{armv8-m.main},
17410 @samp{iwmmxt} and @samp{iwmmxt2}.
17411
17412 Additionally, the following architectures, which lack support for the
17413 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17414
17415 Many of the architectures support extensions. These can be added by
17416 appending @samp{+@var{extension}} to the architecture name. Extension
17417 options are processed in order and capabilities accumulate. An extension
17418 will also enable any necessary base extensions
17419 upon which it depends. For example, the @samp{+crypto} extension
17420 will always enable the @samp{+simd} extension. The exception to the
17421 additive construction is for extensions that are prefixed with
17422 @samp{+no@dots{}}: these extensions disable the specified option and
17423 any other extensions that may depend on the presence of that
17424 extension.
17425
17426 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17427 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17428 entirely disabled by the @samp{+nofp} option that follows it.
17429
17430 Most extension names are generically named, but have an effect that is
17431 dependent upon the architecture to which it is applied. For example,
17432 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17433 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17434 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17435 variant for @samp{armv8-a}.
17436
17437 The table below lists the supported extensions for each architecture.
17438 Architectures not mentioned do not support any extensions.
17439
17440 @table @samp
17441 @item armv5te
17442 @itemx armv6
17443 @itemx armv6j
17444 @itemx armv6k
17445 @itemx armv6kz
17446 @itemx armv6t2
17447 @itemx armv6z
17448 @itemx armv6zk
17449 @table @samp
17450 @item +fp
17451 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17452 used as an alias for this extension.
17453
17454 @item +nofp
17455 Disable the floating-point instructions.
17456 @end table
17457
17458 @item armv7
17459 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17460 @table @samp
17461 @item +fp
17462 The VFPv3 floating-point instructions, with 16 double-precision
17463 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17464 for this extension. Note that floating-point is not supported by the
17465 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17466 ARMv7-R architectures.
17467
17468 @item +nofp
17469 Disable the floating-point instructions.
17470 @end table
17471
17472 @item armv7-a
17473 @table @samp
17474 @item +mp
17475 The multiprocessing extension.
17476
17477 @item +sec
17478 The security extension.
17479
17480 @item +fp
17481 The VFPv3 floating-point instructions, with 16 double-precision
17482 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17483 for this extension.
17484
17485 @item +simd
17486 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17487 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17488 for this extension.
17489
17490 @item +vfpv3
17491 The VFPv3 floating-point instructions, with 32 double-precision
17492 registers.
17493
17494 @item +vfpv3-d16-fp16
17495 The VFPv3 floating-point instructions, with 16 double-precision
17496 registers and the half-precision floating-point conversion operations.
17497
17498 @item +vfpv3-fp16
17499 The VFPv3 floating-point instructions, with 32 double-precision
17500 registers and the half-precision floating-point conversion operations.
17501
17502 @item +vfpv4-d16
17503 The VFPv4 floating-point instructions, with 16 double-precision
17504 registers.
17505
17506 @item +vfpv4
17507 The VFPv4 floating-point instructions, with 32 double-precision
17508 registers.
17509
17510 @item +neon-fp16
17511 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17512 the half-precision floating-point conversion operations.
17513
17514 @item +neon-vfpv4
17515 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17516
17517 @item +nosimd
17518 Disable the Advanced SIMD instructions (does not disable floating point).
17519
17520 @item +nofp
17521 Disable the floating-point and Advanced SIMD instructions.
17522 @end table
17523
17524 @item armv7ve
17525 The extended version of the ARMv7-A architecture with support for
17526 virtualization.
17527 @table @samp
17528 @item +fp
17529 The VFPv4 floating-point instructions, with 16 double-precision registers.
17530 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17531
17532 @item +simd
17533 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17534 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17535
17536 @item +vfpv3-d16
17537 The VFPv3 floating-point instructions, with 16 double-precision
17538 registers.
17539
17540 @item +vfpv3
17541 The VFPv3 floating-point instructions, with 32 double-precision
17542 registers.
17543
17544 @item +vfpv3-d16-fp16
17545 The VFPv3 floating-point instructions, with 16 double-precision
17546 registers and the half-precision floating-point conversion operations.
17547
17548 @item +vfpv3-fp16
17549 The VFPv3 floating-point instructions, with 32 double-precision
17550 registers and the half-precision floating-point conversion operations.
17551
17552 @item +vfpv4-d16
17553 The VFPv4 floating-point instructions, with 16 double-precision
17554 registers.
17555
17556 @item +vfpv4
17557 The VFPv4 floating-point instructions, with 32 double-precision
17558 registers.
17559
17560 @item +neon
17561 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17562 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17563
17564 @item +neon-fp16
17565 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17566 the half-precision floating-point conversion operations.
17567
17568 @item +nosimd
17569 Disable the Advanced SIMD instructions (does not disable floating point).
17570
17571 @item +nofp
17572 Disable the floating-point and Advanced SIMD instructions.
17573 @end table
17574
17575 @item armv8-a
17576 @table @samp
17577 @item +crc
17578 The Cyclic Redundancy Check (CRC) instructions.
17579 @item +simd
17580 The ARMv8-A Advanced SIMD and floating-point instructions.
17581 @item +crypto
17582 The cryptographic instructions.
17583 @item +nocrypto
17584 Disable the cryptographic instructions.
17585 @item +nofp
17586 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17587 @item +sb
17588 Speculation Barrier Instruction.
17589 @item +predres
17590 Execution and Data Prediction Restriction Instructions.
17591 @end table
17592
17593 @item armv8.1-a
17594 @table @samp
17595 @item +simd
17596 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17597
17598 @item +crypto
17599 The cryptographic instructions. This also enables the Advanced SIMD and
17600 floating-point instructions.
17601
17602 @item +nocrypto
17603 Disable the cryptographic instructions.
17604
17605 @item +nofp
17606 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17607
17608 @item +sb
17609 Speculation Barrier Instruction.
17610
17611 @item +predres
17612 Execution and Data Prediction Restriction Instructions.
17613 @end table
17614
17615 @item armv8.2-a
17616 @itemx armv8.3-a
17617 @table @samp
17618 @item +fp16
17619 The half-precision floating-point data processing instructions.
17620 This also enables the Advanced SIMD and floating-point instructions.
17621
17622 @item +fp16fml
17623 The half-precision floating-point fmla extension. This also enables
17624 the half-precision floating-point extension and Advanced SIMD and
17625 floating-point instructions.
17626
17627 @item +simd
17628 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17629
17630 @item +crypto
17631 The cryptographic instructions. This also enables the Advanced SIMD and
17632 floating-point instructions.
17633
17634 @item +dotprod
17635 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17636
17637 @item +nocrypto
17638 Disable the cryptographic extension.
17639
17640 @item +nofp
17641 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17642
17643 @item +sb
17644 Speculation Barrier Instruction.
17645
17646 @item +predres
17647 Execution and Data Prediction Restriction Instructions.
17648 @end table
17649
17650 @item armv8.4-a
17651 @table @samp
17652 @item +fp16
17653 The half-precision floating-point data processing instructions.
17654 This also enables the Advanced SIMD and floating-point instructions as well
17655 as the Dot Product extension and the half-precision floating-point fmla
17656 extension.
17657
17658 @item +simd
17659 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17660 Dot Product extension.
17661
17662 @item +crypto
17663 The cryptographic instructions. This also enables the Advanced SIMD and
17664 floating-point instructions as well as the Dot Product extension.
17665
17666 @item +nocrypto
17667 Disable the cryptographic extension.
17668
17669 @item +nofp
17670 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17671
17672 @item +sb
17673 Speculation Barrier Instruction.
17674
17675 @item +predres
17676 Execution and Data Prediction Restriction Instructions.
17677 @end table
17678
17679 @item armv8.5-a
17680 @table @samp
17681 @item +fp16
17682 The half-precision floating-point data processing instructions.
17683 This also enables the Advanced SIMD and floating-point instructions as well
17684 as the Dot Product extension and the half-precision floating-point fmla
17685 extension.
17686
17687 @item +simd
17688 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17689 Dot Product extension.
17690
17691 @item +crypto
17692 The cryptographic instructions. This also enables the Advanced SIMD and
17693 floating-point instructions as well as the Dot Product extension.
17694
17695 @item +nocrypto
17696 Disable the cryptographic extension.
17697
17698 @item +nofp
17699 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17700 @end table
17701
17702 @item armv7-r
17703 @table @samp
17704 @item +fp.sp
17705 The single-precision VFPv3 floating-point instructions. The extension
17706 @samp{+vfpv3xd} can be used as an alias for this extension.
17707
17708 @item +fp
17709 The VFPv3 floating-point instructions with 16 double-precision registers.
17710 The extension +vfpv3-d16 can be used as an alias for this extension.
17711
17712 @item +vfpv3xd-d16-fp16
17713 The single-precision VFPv3 floating-point instructions with 16 double-precision
17714 registers and the half-precision floating-point conversion operations.
17715
17716 @item +vfpv3-d16-fp16
17717 The VFPv3 floating-point instructions with 16 double-precision
17718 registers and the half-precision floating-point conversion operations.
17719
17720 @item +nofp
17721 Disable the floating-point extension.
17722
17723 @item +idiv
17724 The ARM-state integer division instructions.
17725
17726 @item +noidiv
17727 Disable the ARM-state integer division extension.
17728 @end table
17729
17730 @item armv7e-m
17731 @table @samp
17732 @item +fp
17733 The single-precision VFPv4 floating-point instructions.
17734
17735 @item +fpv5
17736 The single-precision FPv5 floating-point instructions.
17737
17738 @item +fp.dp
17739 The single- and double-precision FPv5 floating-point instructions.
17740
17741 @item +nofp
17742 Disable the floating-point extensions.
17743 @end table
17744
17745 @item armv8-m.main
17746 @table @samp
17747 @item +dsp
17748 The DSP instructions.
17749
17750 @item +nodsp
17751 Disable the DSP extension.
17752
17753 @item +fp
17754 The single-precision floating-point instructions.
17755
17756 @item +fp.dp
17757 The single- and double-precision floating-point instructions.
17758
17759 @item +nofp
17760 Disable the floating-point extension.
17761 @end table
17762
17763 @item armv8-r
17764 @table @samp
17765 @item +crc
17766 The Cyclic Redundancy Check (CRC) instructions.
17767 @item +fp.sp
17768 The single-precision FPv5 floating-point instructions.
17769 @item +simd
17770 The ARMv8-A Advanced SIMD and floating-point instructions.
17771 @item +crypto
17772 The cryptographic instructions.
17773 @item +nocrypto
17774 Disable the cryptographic instructions.
17775 @item +nofp
17776 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17777 @end table
17778
17779 @end table
17780
17781 @option{-march=native} causes the compiler to auto-detect the architecture
17782 of the build computer. At present, this feature is only supported on
17783 GNU/Linux, and not all architectures are recognized. If the auto-detect
17784 is unsuccessful the option has no effect.
17785
17786 @item -mtune=@var{name}
17787 @opindex mtune
17788 This option specifies the name of the target ARM processor for
17789 which GCC should tune the performance of the code.
17790 For some ARM implementations better performance can be obtained by using
17791 this option.
17792 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17793 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17794 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17795 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17796 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17797 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17798 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17799 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17800 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17801 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17802 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17803 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17804 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17805 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17806 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17807 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17808 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17809 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17810 @samp{cortex-m35p},
17811 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17812 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17813 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17814 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17815 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17816
17817 Additionally, this option can specify that GCC should tune the performance
17818 of the code for a big.LITTLE system. Permissible names are:
17819 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17820 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17821 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17822 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17823
17824 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17825 performance for a blend of processors within architecture @var{arch}.
17826 The aim is to generate code that run well on the current most popular
17827 processors, balancing between optimizations that benefit some CPUs in the
17828 range, and avoiding performance pitfalls of other CPUs. The effects of
17829 this option may change in future GCC versions as CPU models come and go.
17830
17831 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17832 the extension options do not affect the tuning of the generated code.
17833
17834 @option{-mtune=native} causes the compiler to auto-detect the CPU
17835 of the build computer. At present, this feature is only supported on
17836 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17837 unsuccessful the option has no effect.
17838
17839 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17840 @opindex mcpu
17841 This specifies the name of the target ARM processor. GCC uses this name
17842 to derive the name of the target ARM architecture (as if specified
17843 by @option{-march}) and the ARM processor type for which to tune for
17844 performance (as if specified by @option{-mtune}). Where this option
17845 is used in conjunction with @option{-march} or @option{-mtune},
17846 those options take precedence over the appropriate part of this option.
17847
17848 Many of the supported CPUs implement optional architectural
17849 extensions. Where this is so the architectural extensions are
17850 normally enabled by default. If implementations that lack the
17851 extension exist, then the extension syntax can be used to disable
17852 those extensions that have been omitted. For floating-point and
17853 Advanced SIMD (Neon) instructions, the settings of the options
17854 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17855 floating-point and Advanced SIMD instructions will only be used if
17856 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17857 @option{-mfpu} other than @samp{auto} will override the available
17858 floating-point and SIMD extension instructions.
17859
17860 For example, @samp{cortex-a9} can be found in three major
17861 configurations: integer only, with just a floating-point unit or with
17862 floating-point and Advanced SIMD. The default is to enable all the
17863 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17864 be used to disable just the SIMD or both the SIMD and floating-point
17865 instructions respectively.
17866
17867 Permissible names for this option are the same as those for
17868 @option{-mtune}.
17869
17870 The following extension options are common to the listed CPUs:
17871
17872 @table @samp
17873 @item +nodsp
17874 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17875
17876 @item +nofp
17877 Disables the floating-point instructions on @samp{arm9e},
17878 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17879 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17880 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17881 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17882 Disables the floating-point and SIMD instructions on
17883 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17884 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17885 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17886 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17887 @samp{cortex-a53} and @samp{cortex-a55}.
17888
17889 @item +nofp.dp
17890 Disables the double-precision component of the floating-point instructions
17891 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17892 @samp{cortex-m7}.
17893
17894 @item +nosimd
17895 Disables the SIMD (but not floating-point) instructions on
17896 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17897 and @samp{cortex-a9}.
17898
17899 @item +crypto
17900 Enables the cryptographic instructions on @samp{cortex-a32},
17901 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17902 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17903 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17904 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17905 @samp{cortex-a75.cortex-a55}.
17906 @end table
17907
17908 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17909 VFPv3 with 16 double-precision registers. It supports the following
17910 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17911 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17912 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17913 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17914 the extensions to @option{-march=armv7-a}.
17915
17916 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17917 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17918 See @option{-mtune} for more information.
17919
17920 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17921 of the build computer. At present, this feature is only supported on
17922 GNU/Linux, and not all architectures are recognized. If the auto-detect
17923 is unsuccessful the option has no effect.
17924
17925 @item -mfpu=@var{name}
17926 @opindex mfpu
17927 This specifies what floating-point hardware (or hardware emulation) is
17928 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17929 @samp{vfpv3},
17930 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17931 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17932 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17933 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17934 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17935 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17936 is an alias for @samp{vfpv2}.
17937
17938 The setting @samp{auto} is the default and is special. It causes the
17939 compiler to select the floating-point and Advanced SIMD instructions
17940 based on the settings of @option{-mcpu} and @option{-march}.
17941
17942 If the selected floating-point hardware includes the NEON extension
17943 (e.g.@: @option{-mfpu=neon}), note that floating-point
17944 operations are not generated by GCC's auto-vectorization pass unless
17945 @option{-funsafe-math-optimizations} is also specified. This is
17946 because NEON hardware does not fully implement the IEEE 754 standard for
17947 floating-point arithmetic (in particular denormal values are treated as
17948 zero), so the use of NEON instructions may lead to a loss of precision.
17949
17950 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}).
17951
17952 @item -mfp16-format=@var{name}
17953 @opindex mfp16-format
17954 Specify the format of the @code{__fp16} half-precision floating-point type.
17955 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17956 the default is @samp{none}, in which case the @code{__fp16} type is not
17957 defined. @xref{Half-Precision}, for more information.
17958
17959 @item -mstructure-size-boundary=@var{n}
17960 @opindex mstructure-size-boundary
17961 The sizes of all structures and unions are rounded up to a multiple
17962 of the number of bits set by this option. Permissible values are 8, 32
17963 and 64. The default value varies for different toolchains. For the COFF
17964 targeted toolchain the default value is 8. A value of 64 is only allowed
17965 if the underlying ABI supports it.
17966
17967 Specifying a larger number can produce faster, more efficient code, but
17968 can also increase the size of the program. Different values are potentially
17969 incompatible. Code compiled with one value cannot necessarily expect to
17970 work with code or libraries compiled with another value, if they exchange
17971 information using structures or unions.
17972
17973 This option is deprecated.
17974
17975 @item -mabort-on-noreturn
17976 @opindex mabort-on-noreturn
17977 Generate a call to the function @code{abort} at the end of a
17978 @code{noreturn} function. It is executed if the function tries to
17979 return.
17980
17981 @item -mlong-calls
17982 @itemx -mno-long-calls
17983 @opindex mlong-calls
17984 @opindex mno-long-calls
17985 Tells the compiler to perform function calls by first loading the
17986 address of the function into a register and then performing a subroutine
17987 call on this register. This switch is needed if the target function
17988 lies outside of the 64-megabyte addressing range of the offset-based
17989 version of subroutine call instruction.
17990
17991 Even if this switch is enabled, not all function calls are turned
17992 into long calls. The heuristic is that static functions, functions
17993 that have the @code{short_call} attribute, functions that are inside
17994 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17995 definitions have already been compiled within the current compilation
17996 unit are not turned into long calls. The exceptions to this rule are
17997 that weak function definitions, functions with the @code{long_call}
17998 attribute or the @code{section} attribute, and functions that are within
17999 the scope of a @code{#pragma long_calls} directive are always
18000 turned into long calls.
18001
18002 This feature is not enabled by default. Specifying
18003 @option{-mno-long-calls} restores the default behavior, as does
18004 placing the function calls within the scope of a @code{#pragma
18005 long_calls_off} directive. Note these switches have no effect on how
18006 the compiler generates code to handle function calls via function
18007 pointers.
18008
18009 @item -msingle-pic-base
18010 @opindex msingle-pic-base
18011 Treat the register used for PIC addressing as read-only, rather than
18012 loading it in the prologue for each function. The runtime system is
18013 responsible for initializing this register with an appropriate value
18014 before execution begins.
18015
18016 @item -mpic-register=@var{reg}
18017 @opindex mpic-register
18018 Specify the register to be used for PIC addressing.
18019 For standard PIC base case, the default is any suitable register
18020 determined by compiler. For single PIC base case, the default is
18021 @samp{R9} if target is EABI based or stack-checking is enabled,
18022 otherwise the default is @samp{R10}.
18023
18024 @item -mpic-data-is-text-relative
18025 @opindex mpic-data-is-text-relative
18026 Assume that the displacement between the text and data segments is fixed
18027 at static link time. This permits using PC-relative addressing
18028 operations to access data known to be in the data segment. For
18029 non-VxWorks RTP targets, this option is enabled by default. When
18030 disabled on such targets, it will enable @option{-msingle-pic-base} by
18031 default.
18032
18033 @item -mpoke-function-name
18034 @opindex mpoke-function-name
18035 Write the name of each function into the text section, directly
18036 preceding the function prologue. The generated code is similar to this:
18037
18038 @smallexample
18039 t0
18040 .ascii "arm_poke_function_name", 0
18041 .align
18042 t1
18043 .word 0xff000000 + (t1 - t0)
18044 arm_poke_function_name
18045 mov ip, sp
18046 stmfd sp!, @{fp, ip, lr, pc@}
18047 sub fp, ip, #4
18048 @end smallexample
18049
18050 When performing a stack backtrace, code can inspect the value of
18051 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
18052 location @code{pc - 12} and the top 8 bits are set, then we know that
18053 there is a function name embedded immediately preceding this location
18054 and has length @code{((pc[-3]) & 0xff000000)}.
18055
18056 @item -mthumb
18057 @itemx -marm
18058 @opindex marm
18059 @opindex mthumb
18060
18061 Select between generating code that executes in ARM and Thumb
18062 states. The default for most configurations is to generate code
18063 that executes in ARM state, but the default can be changed by
18064 configuring GCC with the @option{--with-mode=}@var{state}
18065 configure option.
18066
18067 You can also override the ARM and Thumb mode for each function
18068 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18069 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18070
18071 @item -mflip-thumb
18072 @opindex mflip-thumb
18073 Switch ARM/Thumb modes on alternating functions.
18074 This option is provided for regression testing of mixed Thumb/ARM code
18075 generation, and is not intended for ordinary use in compiling code.
18076
18077 @item -mtpcs-frame
18078 @opindex mtpcs-frame
18079 Generate a stack frame that is compliant with the Thumb Procedure Call
18080 Standard for all non-leaf functions. (A leaf function is one that does
18081 not call any other functions.) The default is @option{-mno-tpcs-frame}.
18082
18083 @item -mtpcs-leaf-frame
18084 @opindex mtpcs-leaf-frame
18085 Generate a stack frame that is compliant with the Thumb Procedure Call
18086 Standard for all leaf functions. (A leaf function is one that does
18087 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
18088
18089 @item -mcallee-super-interworking
18090 @opindex mcallee-super-interworking
18091 Gives all externally visible functions in the file being compiled an ARM
18092 instruction set header which switches to Thumb mode before executing the
18093 rest of the function. This allows these functions to be called from
18094 non-interworking code. This option is not valid in AAPCS configurations
18095 because interworking is enabled by default.
18096
18097 @item -mcaller-super-interworking
18098 @opindex mcaller-super-interworking
18099 Allows calls via function pointers (including virtual functions) to
18100 execute correctly regardless of whether the target code has been
18101 compiled for interworking or not. There is a small overhead in the cost
18102 of executing a function pointer if this option is enabled. This option
18103 is not valid in AAPCS configurations because interworking is enabled
18104 by default.
18105
18106 @item -mtp=@var{name}
18107 @opindex mtp
18108 Specify the access model for the thread local storage pointer. The valid
18109 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18110 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18111 (supported in the arm6k architecture), and @samp{auto}, which uses the
18112 best available method for the selected processor. The default setting is
18113 @samp{auto}.
18114
18115 @item -mtls-dialect=@var{dialect}
18116 @opindex mtls-dialect
18117 Specify the dialect to use for accessing thread local storage. Two
18118 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
18119 @samp{gnu} dialect selects the original GNU scheme for supporting
18120 local and global dynamic TLS models. The @samp{gnu2} dialect
18121 selects the GNU descriptor scheme, which provides better performance
18122 for shared libraries. The GNU descriptor scheme is compatible with
18123 the original scheme, but does require new assembler, linker and
18124 library support. Initial and local exec TLS models are unaffected by
18125 this option and always use the original scheme.
18126
18127 @item -mword-relocations
18128 @opindex mword-relocations
18129 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18130 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18131 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18132 is specified. This option conflicts with @option{-mslow-flash-data}.
18133
18134 @item -mfix-cortex-m3-ldrd
18135 @opindex mfix-cortex-m3-ldrd
18136 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18137 with overlapping destination and base registers are used. This option avoids
18138 generating these instructions. This option is enabled by default when
18139 @option{-mcpu=cortex-m3} is specified.
18140
18141 @item -munaligned-access
18142 @itemx -mno-unaligned-access
18143 @opindex munaligned-access
18144 @opindex mno-unaligned-access
18145 Enables (or disables) reading and writing of 16- and 32- bit values
18146 from addresses that are not 16- or 32- bit aligned. By default
18147 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18148 ARMv8-M Baseline architectures, and enabled for all other
18149 architectures. If unaligned access is not enabled then words in packed
18150 data structures are accessed a byte at a time.
18151
18152 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18153 generated object file to either true or false, depending upon the
18154 setting of this option. If unaligned access is enabled then the
18155 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18156 defined.
18157
18158 @item -mneon-for-64bits
18159 @opindex mneon-for-64bits
18160 This option is deprecated and has no effect.
18161
18162 @item -mslow-flash-data
18163 @opindex mslow-flash-data
18164 Assume loading data from flash is slower than fetching instruction.
18165 Therefore literal load is minimized for better performance.
18166 This option is only supported when compiling for ARMv7 M-profile and
18167 off by default. It conflicts with @option{-mword-relocations}.
18168
18169 @item -masm-syntax-unified
18170 @opindex masm-syntax-unified
18171 Assume inline assembler is using unified asm syntax. The default is
18172 currently off which implies divided syntax. This option has no impact
18173 on Thumb2. However, this may change in future releases of GCC.
18174 Divided syntax should be considered deprecated.
18175
18176 @item -mrestrict-it
18177 @opindex mrestrict-it
18178 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18179 IT blocks can only contain a single 16-bit instruction from a select
18180 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18181
18182 @item -mprint-tune-info
18183 @opindex mprint-tune-info
18184 Print CPU tuning information as comment in assembler file. This is
18185 an option used only for regression testing of the compiler and not
18186 intended for ordinary use in compiling code. This option is disabled
18187 by default.
18188
18189 @item -mverbose-cost-dump
18190 @opindex mverbose-cost-dump
18191 Enable verbose cost model dumping in the debug dump files. This option is
18192 provided for use in debugging the compiler.
18193
18194 @item -mpure-code
18195 @opindex mpure-code
18196 Do not allow constant data to be placed in code sections.
18197 Additionally, when compiling for ELF object format give all text sections the
18198 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18199 is only available when generating non-pic code for M-profile targets with the
18200 MOVT instruction.
18201
18202 @item -mcmse
18203 @opindex mcmse
18204 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18205 Development Tools Engineering Specification", which can be found on
18206 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18207
18208 @item -mfdpic
18209 @itemx -mno-fdpic
18210 @opindex mfdpic
18211 @opindex mno-fdpic
18212 Select the FDPIC ABI, which uses 64-bit function descriptors to
18213 represent pointers to functions. When the compiler is configured for
18214 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18215 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18216 provided. On other targets, it only enables the FDPIC-specific code
18217 generation features, and the user should explicitly provide the
18218 PIC/PIE-related options as needed.
18219
18220 Note that static linking is not supported because it would still
18221 involve the dynamic linker when the program self-relocates. If such
18222 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18223
18224 The opposite @option{-mno-fdpic} option is useful (and required) to
18225 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18226 toolchain as the one used to build the userland programs.
18227
18228 @end table
18229
18230 @node AVR Options
18231 @subsection AVR Options
18232 @cindex AVR Options
18233
18234 These options are defined for AVR implementations:
18235
18236 @table @gcctabopt
18237 @item -mmcu=@var{mcu}
18238 @opindex mmcu
18239 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18240
18241 The default for this option is@tie{}@samp{avr2}.
18242
18243 GCC supports the following AVR devices and ISAs:
18244
18245 @include avr-mmcu.texi
18246
18247 @item -mabsdata
18248 @opindex mabsdata
18249
18250 Assume that all data in static storage can be accessed by LDS / STS
18251 instructions. This option has only an effect on reduced Tiny devices like
18252 ATtiny40. See also the @code{absdata}
18253 @ref{AVR Variable Attributes,variable attribute}.
18254
18255 @item -maccumulate-args
18256 @opindex maccumulate-args
18257 Accumulate outgoing function arguments and acquire/release the needed
18258 stack space for outgoing function arguments once in function
18259 prologue/epilogue. Without this option, outgoing arguments are pushed
18260 before calling a function and popped afterwards.
18261
18262 Popping the arguments after the function call can be expensive on
18263 AVR so that accumulating the stack space might lead to smaller
18264 executables because arguments need not be removed from the
18265 stack after such a function call.
18266
18267 This option can lead to reduced code size for functions that perform
18268 several calls to functions that get their arguments on the stack like
18269 calls to printf-like functions.
18270
18271 @item -mbranch-cost=@var{cost}
18272 @opindex mbranch-cost
18273 Set the branch costs for conditional branch instructions to
18274 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18275 integers. The default branch cost is 0.
18276
18277 @item -mcall-prologues
18278 @opindex mcall-prologues
18279 Functions prologues/epilogues are expanded as calls to appropriate
18280 subroutines. Code size is smaller.
18281
18282 @item -mgas-isr-prologues
18283 @opindex mgas-isr-prologues
18284 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18285 instruction supported by GNU Binutils.
18286 If this option is on, the feature can still be disabled for individual
18287 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18288 function attribute. This feature is activated per default
18289 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18290 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18291
18292 @item -mint8
18293 @opindex mint8
18294 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18295 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18296 and @code{long long} is 4 bytes. Please note that this option does not
18297 conform to the C standards, but it results in smaller code
18298 size.
18299
18300 @item -mmain-is-OS_task
18301 @opindex mmain-is-OS_task
18302 Do not save registers in @code{main}. The effect is the same like
18303 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18304 to @code{main}. It is activated per default if optimization is on.
18305
18306 @item -mn-flash=@var{num}
18307 @opindex mn-flash
18308 Assume that the flash memory has a size of
18309 @var{num} times 64@tie{}KiB.
18310
18311 @item -mno-interrupts
18312 @opindex mno-interrupts
18313 Generated code is not compatible with hardware interrupts.
18314 Code size is smaller.
18315
18316 @item -mrelax
18317 @opindex mrelax
18318 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18319 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18320 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18321 the assembler's command line and the @option{--relax} option to the
18322 linker's command line.
18323
18324 Jump relaxing is performed by the linker because jump offsets are not
18325 known before code is located. Therefore, the assembler code generated by the
18326 compiler is the same, but the instructions in the executable may
18327 differ from instructions in the assembler code.
18328
18329 Relaxing must be turned on if linker stubs are needed, see the
18330 section on @code{EIND} and linker stubs below.
18331
18332 @item -mrmw
18333 @opindex mrmw
18334 Assume that the device supports the Read-Modify-Write
18335 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18336
18337 @item -mshort-calls
18338 @opindex mshort-calls
18339
18340 Assume that @code{RJMP} and @code{RCALL} can target the whole
18341 program memory.
18342
18343 This option is used internally for multilib selection. It is
18344 not an optimization option, and you don't need to set it by hand.
18345
18346 @item -msp8
18347 @opindex msp8
18348 Treat the stack pointer register as an 8-bit register,
18349 i.e.@: assume the high byte of the stack pointer is zero.
18350 In general, you don't need to set this option by hand.
18351
18352 This option is used internally by the compiler to select and
18353 build multilibs for architectures @code{avr2} and @code{avr25}.
18354 These architectures mix devices with and without @code{SPH}.
18355 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18356 the compiler driver adds or removes this option from the compiler
18357 proper's command line, because the compiler then knows if the device
18358 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18359 register or not.
18360
18361 @item -mstrict-X
18362 @opindex mstrict-X
18363 Use address register @code{X} in a way proposed by the hardware. This means
18364 that @code{X} is only used in indirect, post-increment or
18365 pre-decrement addressing.
18366
18367 Without this option, the @code{X} register may be used in the same way
18368 as @code{Y} or @code{Z} which then is emulated by additional
18369 instructions.
18370 For example, loading a value with @code{X+const} addressing with a
18371 small non-negative @code{const < 64} to a register @var{Rn} is
18372 performed as
18373
18374 @example
18375 adiw r26, const ; X += const
18376 ld @var{Rn}, X ; @var{Rn} = *X
18377 sbiw r26, const ; X -= const
18378 @end example
18379
18380 @item -mtiny-stack
18381 @opindex mtiny-stack
18382 Only change the lower 8@tie{}bits of the stack pointer.
18383
18384 @item -mfract-convert-truncate
18385 @opindex mfract-convert-truncate
18386 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18387
18388 @item -nodevicelib
18389 @opindex nodevicelib
18390 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18391
18392 @item -Waddr-space-convert
18393 @opindex Waddr-space-convert
18394 @opindex Wno-addr-space-convert
18395 Warn about conversions between address spaces in the case where the
18396 resulting address space is not contained in the incoming address space.
18397
18398 @item -Wmisspelled-isr
18399 @opindex Wmisspelled-isr
18400 @opindex Wno-misspelled-isr
18401 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18402 Enabled by default.
18403 @end table
18404
18405 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18406 @cindex @code{EIND}
18407 Pointers in the implementation are 16@tie{}bits wide.
18408 The address of a function or label is represented as word address so
18409 that indirect jumps and calls can target any code address in the
18410 range of 64@tie{}Ki words.
18411
18412 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18413 bytes of program memory space, there is a special function register called
18414 @code{EIND} that serves as most significant part of the target address
18415 when @code{EICALL} or @code{EIJMP} instructions are used.
18416
18417 Indirect jumps and calls on these devices are handled as follows by
18418 the compiler and are subject to some limitations:
18419
18420 @itemize @bullet
18421
18422 @item
18423 The compiler never sets @code{EIND}.
18424
18425 @item
18426 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18427 instructions or might read @code{EIND} directly in order to emulate an
18428 indirect call/jump by means of a @code{RET} instruction.
18429
18430 @item
18431 The compiler assumes that @code{EIND} never changes during the startup
18432 code or during the application. In particular, @code{EIND} is not
18433 saved/restored in function or interrupt service routine
18434 prologue/epilogue.
18435
18436 @item
18437 For indirect calls to functions and computed goto, the linker
18438 generates @emph{stubs}. Stubs are jump pads sometimes also called
18439 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18440 The stub contains a direct jump to the desired address.
18441
18442 @item
18443 Linker relaxation must be turned on so that the linker generates
18444 the stubs correctly in all situations. See the compiler option
18445 @option{-mrelax} and the linker option @option{--relax}.
18446 There are corner cases where the linker is supposed to generate stubs
18447 but aborts without relaxation and without a helpful error message.
18448
18449 @item
18450 The default linker script is arranged for code with @code{EIND = 0}.
18451 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18452 linker script has to be used in order to place the sections whose
18453 name start with @code{.trampolines} into the segment where @code{EIND}
18454 points to.
18455
18456 @item
18457 The startup code from libgcc never sets @code{EIND}.
18458 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18459 For the impact of AVR-LibC on @code{EIND}, see the
18460 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18461
18462 @item
18463 It is legitimate for user-specific startup code to set up @code{EIND}
18464 early, for example by means of initialization code located in
18465 section @code{.init3}. Such code runs prior to general startup code
18466 that initializes RAM and calls constructors, but after the bit
18467 of startup code from AVR-LibC that sets @code{EIND} to the segment
18468 where the vector table is located.
18469 @example
18470 #include <avr/io.h>
18471
18472 static void
18473 __attribute__((section(".init3"),naked,used,no_instrument_function))
18474 init3_set_eind (void)
18475 @{
18476 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18477 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18478 @}
18479 @end example
18480
18481 @noindent
18482 The @code{__trampolines_start} symbol is defined in the linker script.
18483
18484 @item
18485 Stubs are generated automatically by the linker if
18486 the following two conditions are met:
18487 @itemize @minus
18488
18489 @item The address of a label is taken by means of the @code{gs} modifier
18490 (short for @emph{generate stubs}) like so:
18491 @example
18492 LDI r24, lo8(gs(@var{func}))
18493 LDI r25, hi8(gs(@var{func}))
18494 @end example
18495 @item The final location of that label is in a code segment
18496 @emph{outside} the segment where the stubs are located.
18497 @end itemize
18498
18499 @item
18500 The compiler emits such @code{gs} modifiers for code labels in the
18501 following situations:
18502 @itemize @minus
18503 @item Taking address of a function or code label.
18504 @item Computed goto.
18505 @item If prologue-save function is used, see @option{-mcall-prologues}
18506 command-line option.
18507 @item Switch/case dispatch tables. If you do not want such dispatch
18508 tables you can specify the @option{-fno-jump-tables} command-line option.
18509 @item C and C++ constructors/destructors called during startup/shutdown.
18510 @item If the tools hit a @code{gs()} modifier explained above.
18511 @end itemize
18512
18513 @item
18514 Jumping to non-symbolic addresses like so is @emph{not} supported:
18515
18516 @example
18517 int main (void)
18518 @{
18519 /* Call function at word address 0x2 */
18520 return ((int(*)(void)) 0x2)();
18521 @}
18522 @end example
18523
18524 Instead, a stub has to be set up, i.e.@: the function has to be called
18525 through a symbol (@code{func_4} in the example):
18526
18527 @example
18528 int main (void)
18529 @{
18530 extern int func_4 (void);
18531
18532 /* Call function at byte address 0x4 */
18533 return func_4();
18534 @}
18535 @end example
18536
18537 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18538 Alternatively, @code{func_4} can be defined in the linker script.
18539 @end itemize
18540
18541 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18542 @cindex @code{RAMPD}
18543 @cindex @code{RAMPX}
18544 @cindex @code{RAMPY}
18545 @cindex @code{RAMPZ}
18546 Some AVR devices support memories larger than the 64@tie{}KiB range
18547 that can be accessed with 16-bit pointers. To access memory locations
18548 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18549 register is used as high part of the address:
18550 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18551 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18552 register, respectively, to get a wide address. Similarly,
18553 @code{RAMPD} is used together with direct addressing.
18554
18555 @itemize
18556 @item
18557 The startup code initializes the @code{RAMP} special function
18558 registers with zero.
18559
18560 @item
18561 If a @ref{AVR Named Address Spaces,named address space} other than
18562 generic or @code{__flash} is used, then @code{RAMPZ} is set
18563 as needed before the operation.
18564
18565 @item
18566 If the device supports RAM larger than 64@tie{}KiB and the compiler
18567 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18568 is reset to zero after the operation.
18569
18570 @item
18571 If the device comes with a specific @code{RAMP} register, the ISR
18572 prologue/epilogue saves/restores that SFR and initializes it with
18573 zero in case the ISR code might (implicitly) use it.
18574
18575 @item
18576 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18577 If you use inline assembler to read from locations outside the
18578 16-bit address range and change one of the @code{RAMP} registers,
18579 you must reset it to zero after the access.
18580
18581 @end itemize
18582
18583 @subsubsection AVR Built-in Macros
18584
18585 GCC defines several built-in macros so that the user code can test
18586 for the presence or absence of features. Almost any of the following
18587 built-in macros are deduced from device capabilities and thus
18588 triggered by the @option{-mmcu=} command-line option.
18589
18590 For even more AVR-specific built-in macros see
18591 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18592
18593 @table @code
18594
18595 @item __AVR_ARCH__
18596 Build-in macro that resolves to a decimal number that identifies the
18597 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18598 Possible values are:
18599
18600 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18601 @code{4}, @code{5}, @code{51}, @code{6}
18602
18603 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18604 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18605
18606 respectively and
18607
18608 @code{100},
18609 @code{102}, @code{103}, @code{104},
18610 @code{105}, @code{106}, @code{107}
18611
18612 for @var{mcu}=@code{avrtiny},
18613 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18614 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18615 If @var{mcu} specifies a device, this built-in macro is set
18616 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18617 defined to @code{4}.
18618
18619 @item __AVR_@var{Device}__
18620 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18621 the device's name. For example, @option{-mmcu=atmega8} defines the
18622 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18623 @code{__AVR_ATtiny261A__}, etc.
18624
18625 The built-in macros' names follow
18626 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18627 the device name as from the AVR user manual. The difference between
18628 @var{Device} in the built-in macro and @var{device} in
18629 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18630
18631 If @var{device} is not a device but only a core architecture like
18632 @samp{avr51}, this macro is not defined.
18633
18634 @item __AVR_DEVICE_NAME__
18635 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18636 the device's name. For example, with @option{-mmcu=atmega8} the macro
18637 is defined to @code{atmega8}.
18638
18639 If @var{device} is not a device but only a core architecture like
18640 @samp{avr51}, this macro is not defined.
18641
18642 @item __AVR_XMEGA__
18643 The device / architecture belongs to the XMEGA family of devices.
18644
18645 @item __AVR_HAVE_ELPM__
18646 The device has the @code{ELPM} instruction.
18647
18648 @item __AVR_HAVE_ELPMX__
18649 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18650 R@var{n},Z+} instructions.
18651
18652 @item __AVR_HAVE_MOVW__
18653 The device has the @code{MOVW} instruction to perform 16-bit
18654 register-register moves.
18655
18656 @item __AVR_HAVE_LPMX__
18657 The device has the @code{LPM R@var{n},Z} and
18658 @code{LPM R@var{n},Z+} instructions.
18659
18660 @item __AVR_HAVE_MUL__
18661 The device has a hardware multiplier.
18662
18663 @item __AVR_HAVE_JMP_CALL__
18664 The device has the @code{JMP} and @code{CALL} instructions.
18665 This is the case for devices with more than 8@tie{}KiB of program
18666 memory.
18667
18668 @item __AVR_HAVE_EIJMP_EICALL__
18669 @itemx __AVR_3_BYTE_PC__
18670 The device has the @code{EIJMP} and @code{EICALL} instructions.
18671 This is the case for devices with more than 128@tie{}KiB of program memory.
18672 This also means that the program counter
18673 (PC) is 3@tie{}bytes wide.
18674
18675 @item __AVR_2_BYTE_PC__
18676 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18677 with up to 128@tie{}KiB of program memory.
18678
18679 @item __AVR_HAVE_8BIT_SP__
18680 @itemx __AVR_HAVE_16BIT_SP__
18681 The stack pointer (SP) register is treated as 8-bit respectively
18682 16-bit register by the compiler.
18683 The definition of these macros is affected by @option{-mtiny-stack}.
18684
18685 @item __AVR_HAVE_SPH__
18686 @itemx __AVR_SP8__
18687 The device has the SPH (high part of stack pointer) special function
18688 register or has an 8-bit stack pointer, respectively.
18689 The definition of these macros is affected by @option{-mmcu=} and
18690 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18691 by @option{-msp8}.
18692
18693 @item __AVR_HAVE_RAMPD__
18694 @itemx __AVR_HAVE_RAMPX__
18695 @itemx __AVR_HAVE_RAMPY__
18696 @itemx __AVR_HAVE_RAMPZ__
18697 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18698 @code{RAMPZ} special function register, respectively.
18699
18700 @item __NO_INTERRUPTS__
18701 This macro reflects the @option{-mno-interrupts} command-line option.
18702
18703 @item __AVR_ERRATA_SKIP__
18704 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18705 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18706 instructions because of a hardware erratum. Skip instructions are
18707 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18708 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18709 set.
18710
18711 @item __AVR_ISA_RMW__
18712 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18713
18714 @item __AVR_SFR_OFFSET__=@var{offset}
18715 Instructions that can address I/O special function registers directly
18716 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18717 address as if addressed by an instruction to access RAM like @code{LD}
18718 or @code{STS}. This offset depends on the device architecture and has
18719 to be subtracted from the RAM address in order to get the
18720 respective I/O@tie{}address.
18721
18722 @item __AVR_SHORT_CALLS__
18723 The @option{-mshort-calls} command line option is set.
18724
18725 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18726 Some devices support reading from flash memory by means of @code{LD*}
18727 instructions. The flash memory is seen in the data address space
18728 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18729 is not defined, this feature is not available. If defined,
18730 the address space is linear and there is no need to put
18731 @code{.rodata} into RAM. This is handled by the default linker
18732 description file, and is currently available for
18733 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18734 there is no need to use address spaces like @code{__flash} or
18735 features like attribute @code{progmem} and @code{pgm_read_*}.
18736
18737 @item __WITH_AVRLIBC__
18738 The compiler is configured to be used together with AVR-Libc.
18739 See the @option{--with-avrlibc} configure option.
18740
18741 @end table
18742
18743 @node Blackfin Options
18744 @subsection Blackfin Options
18745 @cindex Blackfin Options
18746
18747 @table @gcctabopt
18748 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18749 @opindex mcpu=
18750 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18751 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18752 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18753 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18754 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18755 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18756 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18757 @samp{bf561}, @samp{bf592}.
18758
18759 The optional @var{sirevision} specifies the silicon revision of the target
18760 Blackfin processor. Any workarounds available for the targeted silicon revision
18761 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18762 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18763 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18764 hexadecimal digits representing the major and minor numbers in the silicon
18765 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18766 is not defined. If @var{sirevision} is @samp{any}, the
18767 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18768 If this optional @var{sirevision} is not used, GCC assumes the latest known
18769 silicon revision of the targeted Blackfin processor.
18770
18771 GCC defines a preprocessor macro for the specified @var{cpu}.
18772 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18773 provided by libgloss to be linked in if @option{-msim} is not given.
18774
18775 Without this option, @samp{bf532} is used as the processor by default.
18776
18777 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18778 only the preprocessor macro is defined.
18779
18780 @item -msim
18781 @opindex msim
18782 Specifies that the program will be run on the simulator. This causes
18783 the simulator BSP provided by libgloss to be linked in. This option
18784 has effect only for @samp{bfin-elf} toolchain.
18785 Certain other options, such as @option{-mid-shared-library} and
18786 @option{-mfdpic}, imply @option{-msim}.
18787
18788 @item -momit-leaf-frame-pointer
18789 @opindex momit-leaf-frame-pointer
18790 Don't keep the frame pointer in a register for leaf functions. This
18791 avoids the instructions to save, set up and restore frame pointers and
18792 makes an extra register available in leaf functions.
18793
18794 @item -mspecld-anomaly
18795 @opindex mspecld-anomaly
18796 When enabled, the compiler ensures that the generated code does not
18797 contain speculative loads after jump instructions. If this option is used,
18798 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18799
18800 @item -mno-specld-anomaly
18801 @opindex mno-specld-anomaly
18802 @opindex mspecld-anomaly
18803 Don't generate extra code to prevent speculative loads from occurring.
18804
18805 @item -mcsync-anomaly
18806 @opindex mcsync-anomaly
18807 When enabled, the compiler ensures that the generated code does not
18808 contain CSYNC or SSYNC instructions too soon after conditional branches.
18809 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18810
18811 @item -mno-csync-anomaly
18812 @opindex mno-csync-anomaly
18813 @opindex mcsync-anomaly
18814 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18815 occurring too soon after a conditional branch.
18816
18817 @item -mlow64k
18818 @opindex mlow64k
18819 When enabled, the compiler is free to take advantage of the knowledge that
18820 the entire program fits into the low 64k of memory.
18821
18822 @item -mno-low64k
18823 @opindex mno-low64k
18824 Assume that the program is arbitrarily large. This is the default.
18825
18826 @item -mstack-check-l1
18827 @opindex mstack-check-l1
18828 Do stack checking using information placed into L1 scratchpad memory by the
18829 uClinux kernel.
18830
18831 @item -mid-shared-library
18832 @opindex mid-shared-library
18833 Generate code that supports shared libraries via the library ID method.
18834 This allows for execute in place and shared libraries in an environment
18835 without virtual memory management. This option implies @option{-fPIC}.
18836 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18837
18838 @item -mno-id-shared-library
18839 @opindex mno-id-shared-library
18840 @opindex mid-shared-library
18841 Generate code that doesn't assume ID-based shared libraries are being used.
18842 This is the default.
18843
18844 @item -mleaf-id-shared-library
18845 @opindex mleaf-id-shared-library
18846 Generate code that supports shared libraries via the library ID method,
18847 but assumes that this library or executable won't link against any other
18848 ID shared libraries. That allows the compiler to use faster code for jumps
18849 and calls.
18850
18851 @item -mno-leaf-id-shared-library
18852 @opindex mno-leaf-id-shared-library
18853 @opindex mleaf-id-shared-library
18854 Do not assume that the code being compiled won't link against any ID shared
18855 libraries. Slower code is generated for jump and call insns.
18856
18857 @item -mshared-library-id=n
18858 @opindex mshared-library-id
18859 Specifies the identification number of the ID-based shared library being
18860 compiled. Specifying a value of 0 generates more compact code; specifying
18861 other values forces the allocation of that number to the current
18862 library but is no more space- or time-efficient than omitting this option.
18863
18864 @item -msep-data
18865 @opindex msep-data
18866 Generate code that allows the data segment to be located in a different
18867 area of memory from the text segment. This allows for execute in place in
18868 an environment without virtual memory management by eliminating relocations
18869 against the text section.
18870
18871 @item -mno-sep-data
18872 @opindex mno-sep-data
18873 @opindex msep-data
18874 Generate code that assumes that the data segment follows the text segment.
18875 This is the default.
18876
18877 @item -mlong-calls
18878 @itemx -mno-long-calls
18879 @opindex mlong-calls
18880 @opindex mno-long-calls
18881 Tells the compiler to perform function calls by first loading the
18882 address of the function into a register and then performing a subroutine
18883 call on this register. This switch is needed if the target function
18884 lies outside of the 24-bit addressing range of the offset-based
18885 version of subroutine call instruction.
18886
18887 This feature is not enabled by default. Specifying
18888 @option{-mno-long-calls} restores the default behavior. Note these
18889 switches have no effect on how the compiler generates code to handle
18890 function calls via function pointers.
18891
18892 @item -mfast-fp
18893 @opindex mfast-fp
18894 Link with the fast floating-point library. This library relaxes some of
18895 the IEEE floating-point standard's rules for checking inputs against
18896 Not-a-Number (NAN), in the interest of performance.
18897
18898 @item -minline-plt
18899 @opindex minline-plt
18900 Enable inlining of PLT entries in function calls to functions that are
18901 not known to bind locally. It has no effect without @option{-mfdpic}.
18902
18903 @item -mmulticore
18904 @opindex mmulticore
18905 Build a standalone application for multicore Blackfin processors.
18906 This option causes proper start files and link scripts supporting
18907 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18908 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18909
18910 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18911 selects the one-application-per-core programming model. Without
18912 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18913 programming model is used. In this model, the main function of Core B
18914 should be named as @code{coreb_main}.
18915
18916 If this option is not used, the single-core application programming
18917 model is used.
18918
18919 @item -mcorea
18920 @opindex mcorea
18921 Build a standalone application for Core A of BF561 when using
18922 the one-application-per-core programming model. Proper start files
18923 and link scripts are used to support Core A, and the macro
18924 @code{__BFIN_COREA} is defined.
18925 This option can only be used in conjunction with @option{-mmulticore}.
18926
18927 @item -mcoreb
18928 @opindex mcoreb
18929 Build a standalone application for Core B of BF561 when using
18930 the one-application-per-core programming model. Proper start files
18931 and link scripts are used to support Core B, and the macro
18932 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18933 should be used instead of @code{main}.
18934 This option can only be used in conjunction with @option{-mmulticore}.
18935
18936 @item -msdram
18937 @opindex msdram
18938 Build a standalone application for SDRAM. Proper start files and
18939 link scripts are used to put the application into SDRAM, and the macro
18940 @code{__BFIN_SDRAM} is defined.
18941 The loader should initialize SDRAM before loading the application.
18942
18943 @item -micplb
18944 @opindex micplb
18945 Assume that ICPLBs are enabled at run time. This has an effect on certain
18946 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18947 are enabled; for standalone applications the default is off.
18948 @end table
18949
18950 @node C6X Options
18951 @subsection C6X Options
18952 @cindex C6X Options
18953
18954 @table @gcctabopt
18955 @item -march=@var{name}
18956 @opindex march
18957 This specifies the name of the target architecture. GCC uses this
18958 name to determine what kind of instructions it can emit when generating
18959 assembly code. Permissible names are: @samp{c62x},
18960 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18961
18962 @item -mbig-endian
18963 @opindex mbig-endian
18964 Generate code for a big-endian target.
18965
18966 @item -mlittle-endian
18967 @opindex mlittle-endian
18968 Generate code for a little-endian target. This is the default.
18969
18970 @item -msim
18971 @opindex msim
18972 Choose startup files and linker script suitable for the simulator.
18973
18974 @item -msdata=default
18975 @opindex msdata=default
18976 Put small global and static data in the @code{.neardata} section,
18977 which is pointed to by register @code{B14}. Put small uninitialized
18978 global and static data in the @code{.bss} section, which is adjacent
18979 to the @code{.neardata} section. Put small read-only data into the
18980 @code{.rodata} section. The corresponding sections used for large
18981 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18982
18983 @item -msdata=all
18984 @opindex msdata=all
18985 Put all data, not just small objects, into the sections reserved for
18986 small data, and use addressing relative to the @code{B14} register to
18987 access them.
18988
18989 @item -msdata=none
18990 @opindex msdata=none
18991 Make no use of the sections reserved for small data, and use absolute
18992 addresses to access all data. Put all initialized global and static
18993 data in the @code{.fardata} section, and all uninitialized data in the
18994 @code{.far} section. Put all constant data into the @code{.const}
18995 section.
18996 @end table
18997
18998 @node CRIS Options
18999 @subsection CRIS Options
19000 @cindex CRIS Options
19001
19002 These options are defined specifically for the CRIS ports.
19003
19004 @table @gcctabopt
19005 @item -march=@var{architecture-type}
19006 @itemx -mcpu=@var{architecture-type}
19007 @opindex march
19008 @opindex mcpu
19009 Generate code for the specified architecture. The choices for
19010 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
19011 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
19012 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
19013 @samp{v10}.
19014
19015 @item -mtune=@var{architecture-type}
19016 @opindex mtune
19017 Tune to @var{architecture-type} everything applicable about the generated
19018 code, except for the ABI and the set of available instructions. The
19019 choices for @var{architecture-type} are the same as for
19020 @option{-march=@var{architecture-type}}.
19021
19022 @item -mmax-stack-frame=@var{n}
19023 @opindex mmax-stack-frame
19024 Warn when the stack frame of a function exceeds @var{n} bytes.
19025
19026 @item -metrax4
19027 @itemx -metrax100
19028 @opindex metrax4
19029 @opindex metrax100
19030 The options @option{-metrax4} and @option{-metrax100} are synonyms for
19031 @option{-march=v3} and @option{-march=v8} respectively.
19032
19033 @item -mmul-bug-workaround
19034 @itemx -mno-mul-bug-workaround
19035 @opindex mmul-bug-workaround
19036 @opindex mno-mul-bug-workaround
19037 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
19038 models where it applies. This option is active by default.
19039
19040 @item -mpdebug
19041 @opindex mpdebug
19042 Enable CRIS-specific verbose debug-related information in the assembly
19043 code. This option also has the effect of turning off the @samp{#NO_APP}
19044 formatted-code indicator to the assembler at the beginning of the
19045 assembly file.
19046
19047 @item -mcc-init
19048 @opindex mcc-init
19049 Do not use condition-code results from previous instruction; always emit
19050 compare and test instructions before use of condition codes.
19051
19052 @item -mno-side-effects
19053 @opindex mno-side-effects
19054 @opindex mside-effects
19055 Do not emit instructions with side effects in addressing modes other than
19056 post-increment.
19057
19058 @item -mstack-align
19059 @itemx -mno-stack-align
19060 @itemx -mdata-align
19061 @itemx -mno-data-align
19062 @itemx -mconst-align
19063 @itemx -mno-const-align
19064 @opindex mstack-align
19065 @opindex mno-stack-align
19066 @opindex mdata-align
19067 @opindex mno-data-align
19068 @opindex mconst-align
19069 @opindex mno-const-align
19070 These options (@samp{no-} options) arrange (eliminate arrangements) for the
19071 stack frame, individual data and constants to be aligned for the maximum
19072 single data access size for the chosen CPU model. The default is to
19073 arrange for 32-bit alignment. ABI details such as structure layout are
19074 not affected by these options.
19075
19076 @item -m32-bit
19077 @itemx -m16-bit
19078 @itemx -m8-bit
19079 @opindex m32-bit
19080 @opindex m16-bit
19081 @opindex m8-bit
19082 Similar to the stack- data- and const-align options above, these options
19083 arrange for stack frame, writable data and constants to all be 32-bit,
19084 16-bit or 8-bit aligned. The default is 32-bit alignment.
19085
19086 @item -mno-prologue-epilogue
19087 @itemx -mprologue-epilogue
19088 @opindex mno-prologue-epilogue
19089 @opindex mprologue-epilogue
19090 With @option{-mno-prologue-epilogue}, the normal function prologue and
19091 epilogue which set up the stack frame are omitted and no return
19092 instructions or return sequences are generated in the code. Use this
19093 option only together with visual inspection of the compiled code: no
19094 warnings or errors are generated when call-saved registers must be saved,
19095 or storage for local variables needs to be allocated.
19096
19097 @item -mno-gotplt
19098 @itemx -mgotplt
19099 @opindex mno-gotplt
19100 @opindex mgotplt
19101 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
19102 instruction sequences that load addresses for functions from the PLT part
19103 of the GOT rather than (traditional on other architectures) calls to the
19104 PLT@. The default is @option{-mgotplt}.
19105
19106 @item -melf
19107 @opindex melf
19108 Legacy no-op option only recognized with the cris-axis-elf and
19109 cris-axis-linux-gnu targets.
19110
19111 @item -mlinux
19112 @opindex mlinux
19113 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
19114
19115 @item -sim
19116 @opindex sim
19117 This option, recognized for the cris-axis-elf, arranges
19118 to link with input-output functions from a simulator library. Code,
19119 initialized data and zero-initialized data are allocated consecutively.
19120
19121 @item -sim2
19122 @opindex sim2
19123 Like @option{-sim}, but pass linker options to locate initialized data at
19124 0x40000000 and zero-initialized data at 0x80000000.
19125 @end table
19126
19127 @node CR16 Options
19128 @subsection CR16 Options
19129 @cindex CR16 Options
19130
19131 These options are defined specifically for the CR16 ports.
19132
19133 @table @gcctabopt
19134
19135 @item -mmac
19136 @opindex mmac
19137 Enable the use of multiply-accumulate instructions. Disabled by default.
19138
19139 @item -mcr16cplus
19140 @itemx -mcr16c
19141 @opindex mcr16cplus
19142 @opindex mcr16c
19143 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19144 is default.
19145
19146 @item -msim
19147 @opindex msim
19148 Links the library libsim.a which is in compatible with simulator. Applicable
19149 to ELF compiler only.
19150
19151 @item -mint32
19152 @opindex mint32
19153 Choose integer type as 32-bit wide.
19154
19155 @item -mbit-ops
19156 @opindex mbit-ops
19157 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19158
19159 @item -mdata-model=@var{model}
19160 @opindex mdata-model
19161 Choose a data model. The choices for @var{model} are @samp{near},
19162 @samp{far} or @samp{medium}. @samp{medium} is default.
19163 However, @samp{far} is not valid with @option{-mcr16c}, as the
19164 CR16C architecture does not support the far data model.
19165 @end table
19166
19167 @node C-SKY Options
19168 @subsection C-SKY Options
19169 @cindex C-SKY Options
19170
19171 GCC supports these options when compiling for C-SKY V2 processors.
19172
19173 @table @gcctabopt
19174
19175 @item -march=@var{arch}
19176 @opindex march=
19177 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19178 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19179 The default is @samp{ck810}.
19180
19181 @item -mcpu=@var{cpu}
19182 @opindex mcpu=
19183 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19184 @samp{ck801}, @samp{ck801t},
19185 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19186 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19187 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19188 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19189 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19190 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19191 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19192 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19193 @samp{ck803eftr1}, @samp{ck803efhtr1},
19194 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19195 @samp{ck803sef}, @samp{ck803seft},
19196 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19197 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19198 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19199 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19200
19201 @item -mbig-endian
19202 @opindex mbig-endian
19203 @itemx -EB
19204 @opindex EB
19205 @itemx -mlittle-endian
19206 @opindex mlittle-endian
19207 @itemx -EL
19208 @opindex EL
19209
19210 Select big- or little-endian code. The default is little-endian.
19211
19212 @item -mhard-float
19213 @opindex mhard-float
19214 @itemx -msoft-float
19215 @opindex msoft-float
19216
19217 Select hardware or software floating-point implementations.
19218 The default is soft float.
19219
19220 @item -mdouble-float
19221 @itemx -mno-double-float
19222 @opindex mdouble-float
19223 When @option{-mhard-float} is in effect, enable generation of
19224 double-precision float instructions. This is the default except
19225 when compiling for CK803.
19226
19227 @item -mfdivdu
19228 @itemx -mno-fdivdu
19229 @opindex mfdivdu
19230 When @option{-mhard-float} is in effect, enable generation of
19231 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19232 This is the default except when compiling for CK803.
19233
19234 @item -mfpu=@var{fpu}
19235 @opindex mfpu=
19236 Select the floating-point processor. This option can only be used with
19237 @option{-mhard-float}.
19238 Values for @var{fpu} are
19239 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19240 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19241 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19242
19243 @item -melrw
19244 @itemx -mno-elrw
19245 @opindex melrw
19246 Enable the extended @code{lrw} instruction. This option defaults to on
19247 for CK801 and off otherwise.
19248
19249 @item -mistack
19250 @itemx -mno-istack
19251 @opindex mistack
19252 Enable interrupt stack instructions; the default is off.
19253
19254 The @option{-mistack} option is required to handle the
19255 @code{interrupt} and @code{isr} function attributes
19256 (@pxref{C-SKY Function Attributes}).
19257
19258 @item -mmp
19259 @opindex mmp
19260 Enable multiprocessor instructions; the default is off.
19261
19262 @item -mcp
19263 @opindex mcp
19264 Enable coprocessor instructions; the default is off.
19265
19266 @item -mcache
19267 @opindex mcache
19268 Enable coprocessor instructions; the default is off.
19269
19270 @item -msecurity
19271 @opindex msecurity
19272 Enable C-SKY security instructions; the default is off.
19273
19274 @item -mtrust
19275 @opindex mtrust
19276 Enable C-SKY trust instructions; the default is off.
19277
19278 @item -mdsp
19279 @opindex mdsp
19280 @itemx -medsp
19281 @opindex medsp
19282 @itemx -mvdsp
19283 @opindex mvdsp
19284 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19285 All of these options default to off.
19286
19287 @item -mdiv
19288 @itemx -mno-div
19289 @opindex mdiv
19290 Generate divide instructions. Default is off.
19291
19292 @item -msmart
19293 @itemx -mno-smart
19294 @opindex msmart
19295 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19296 use of 16-bit instructions. This option is ignored for CK801 where this
19297 is the required behavior, and it defaults to on for CK802.
19298 For other targets, the default is off.
19299
19300 @item -mhigh-registers
19301 @itemx -mno-high-registers
19302 @opindex mhigh-registers
19303 Generate code using the high registers numbered 16-31. This option
19304 is not supported on CK801, CK802, or CK803, and is enabled by default
19305 for other processors.
19306
19307 @item -manchor
19308 @itemx -mno-anchor
19309 @opindex manchor
19310 Generate code using global anchor symbol addresses.
19311
19312 @item -mpushpop
19313 @itemx -mno-pushpop
19314 @opindex mpushpop
19315 Generate code using @code{push} and @code{pop} instructions. This option
19316 defaults to on.
19317
19318 @item -mmultiple-stld
19319 @itemx -mstm
19320 @itemx -mno-multiple-stld
19321 @itemx -mno-stm
19322 @opindex mmultiple-stld
19323 Generate code using @code{stm} and @code{ldm} instructions. This option
19324 isn't supported on CK801 but is enabled by default on other processors.
19325
19326 @item -mconstpool
19327 @itemx -mno-constpool
19328 @opindex mconstpool
19329 Create constant pools in the compiler instead of deferring it to the
19330 assembler. This option is the default and required for correct code
19331 generation on CK801 and CK802, and is optional on other processors.
19332
19333 @item -mstack-size
19334 @item -mno-stack-size
19335 @opindex mstack-size
19336 Emit @code{.stack_size} directives for each function in the assembly
19337 output. This option defaults to off.
19338
19339 @item -mccrt
19340 @itemx -mno-ccrt
19341 @opindex mccrt
19342 Generate code for the C-SKY compiler runtime instead of libgcc. This
19343 option defaults to off.
19344
19345 @item -mbranch-cost=@var{n}
19346 @opindex mbranch-cost=
19347 Set the branch costs to roughly @code{n} instructions. The default is 1.
19348
19349 @item -msched-prolog
19350 @itemx -mno-sched-prolog
19351 @opindex msched-prolog
19352 Permit scheduling of function prologue and epilogue sequences. Using
19353 this option can result in code that is not compliant with the C-SKY V2 ABI
19354 prologue requirements and that cannot be debugged or backtraced.
19355 It is disabled by default.
19356
19357 @end table
19358
19359 @node Darwin Options
19360 @subsection Darwin Options
19361 @cindex Darwin options
19362
19363 These options are defined for all architectures running the Darwin operating
19364 system.
19365
19366 FSF GCC on Darwin does not create ``fat'' object files; it creates
19367 an object file for the single architecture that GCC was built to
19368 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19369 @option{-arch} options are used; it does so by running the compiler or
19370 linker multiple times and joining the results together with
19371 @file{lipo}.
19372
19373 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19374 @samp{i686}) is determined by the flags that specify the ISA
19375 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19376 @option{-force_cpusubtype_ALL} option can be used to override this.
19377
19378 The Darwin tools vary in their behavior when presented with an ISA
19379 mismatch. The assembler, @file{as}, only permits instructions to
19380 be used that are valid for the subtype of the file it is generating,
19381 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19382 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19383 and prints an error if asked to create a shared library with a less
19384 restrictive subtype than its input files (for instance, trying to put
19385 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19386 for executables, @command{ld}, quietly gives the executable the most
19387 restrictive subtype of any of its input files.
19388
19389 @table @gcctabopt
19390 @item -F@var{dir}
19391 @opindex F
19392 Add the framework directory @var{dir} to the head of the list of
19393 directories to be searched for header files. These directories are
19394 interleaved with those specified by @option{-I} options and are
19395 scanned in a left-to-right order.
19396
19397 A framework directory is a directory with frameworks in it. A
19398 framework is a directory with a @file{Headers} and/or
19399 @file{PrivateHeaders} directory contained directly in it that ends
19400 in @file{.framework}. The name of a framework is the name of this
19401 directory excluding the @file{.framework}. Headers associated with
19402 the framework are found in one of those two directories, with
19403 @file{Headers} being searched first. A subframework is a framework
19404 directory that is in a framework's @file{Frameworks} directory.
19405 Includes of subframework headers can only appear in a header of a
19406 framework that contains the subframework, or in a sibling subframework
19407 header. Two subframeworks are siblings if they occur in the same
19408 framework. A subframework should not have the same name as a
19409 framework; a warning is issued if this is violated. Currently a
19410 subframework cannot have subframeworks; in the future, the mechanism
19411 may be extended to support this. The standard frameworks can be found
19412 in @file{/System/Library/Frameworks} and
19413 @file{/Library/Frameworks}. An example include looks like
19414 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19415 the name of the framework and @file{header.h} is found in the
19416 @file{PrivateHeaders} or @file{Headers} directory.
19417
19418 @item -iframework@var{dir}
19419 @opindex iframework
19420 Like @option{-F} except the directory is a treated as a system
19421 directory. The main difference between this @option{-iframework} and
19422 @option{-F} is that with @option{-iframework} the compiler does not
19423 warn about constructs contained within header files found via
19424 @var{dir}. This option is valid only for the C family of languages.
19425
19426 @item -gused
19427 @opindex gused
19428 Emit debugging information for symbols that are used. For stabs
19429 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19430 This is by default ON@.
19431
19432 @item -gfull
19433 @opindex gfull
19434 Emit debugging information for all symbols and types.
19435
19436 @item -mmacosx-version-min=@var{version}
19437 The earliest version of MacOS X that this executable will run on
19438 is @var{version}. Typical values of @var{version} include @code{10.1},
19439 @code{10.2}, and @code{10.3.9}.
19440
19441 If the compiler was built to use the system's headers by default,
19442 then the default for this option is the system version on which the
19443 compiler is running, otherwise the default is to make choices that
19444 are compatible with as many systems and code bases as possible.
19445
19446 @item -mkernel
19447 @opindex mkernel
19448 Enable kernel development mode. The @option{-mkernel} option sets
19449 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19450 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19451 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19452 applicable. This mode also sets @option{-mno-altivec},
19453 @option{-msoft-float}, @option{-fno-builtin} and
19454 @option{-mlong-branch} for PowerPC targets.
19455
19456 @item -mone-byte-bool
19457 @opindex mone-byte-bool
19458 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19459 By default @code{sizeof(bool)} is @code{4} when compiling for
19460 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19461 option has no effect on x86.
19462
19463 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19464 to generate code that is not binary compatible with code generated
19465 without that switch. Using this switch may require recompiling all
19466 other modules in a program, including system libraries. Use this
19467 switch to conform to a non-default data model.
19468
19469 @item -mfix-and-continue
19470 @itemx -ffix-and-continue
19471 @itemx -findirect-data
19472 @opindex mfix-and-continue
19473 @opindex ffix-and-continue
19474 @opindex findirect-data
19475 Generate code suitable for fast turnaround development, such as to
19476 allow GDB to dynamically load @file{.o} files into already-running
19477 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19478 are provided for backwards compatibility.
19479
19480 @item -all_load
19481 @opindex all_load
19482 Loads all members of static archive libraries.
19483 See man ld(1) for more information.
19484
19485 @item -arch_errors_fatal
19486 @opindex arch_errors_fatal
19487 Cause the errors having to do with files that have the wrong architecture
19488 to be fatal.
19489
19490 @item -bind_at_load
19491 @opindex bind_at_load
19492 Causes the output file to be marked such that the dynamic linker will
19493 bind all undefined references when the file is loaded or launched.
19494
19495 @item -bundle
19496 @opindex bundle
19497 Produce a Mach-o bundle format file.
19498 See man ld(1) for more information.
19499
19500 @item -bundle_loader @var{executable}
19501 @opindex bundle_loader
19502 This option specifies the @var{executable} that will load the build
19503 output file being linked. See man ld(1) for more information.
19504
19505 @item -dynamiclib
19506 @opindex dynamiclib
19507 When passed this option, GCC produces a dynamic library instead of
19508 an executable when linking, using the Darwin @file{libtool} command.
19509
19510 @item -force_cpusubtype_ALL
19511 @opindex force_cpusubtype_ALL
19512 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19513 one controlled by the @option{-mcpu} or @option{-march} option.
19514
19515 @item -allowable_client @var{client_name}
19516 @itemx -client_name
19517 @itemx -compatibility_version
19518 @itemx -current_version
19519 @itemx -dead_strip
19520 @itemx -dependency-file
19521 @itemx -dylib_file
19522 @itemx -dylinker_install_name
19523 @itemx -dynamic
19524 @itemx -exported_symbols_list
19525 @itemx -filelist
19526 @need 800
19527 @itemx -flat_namespace
19528 @itemx -force_flat_namespace
19529 @itemx -headerpad_max_install_names
19530 @itemx -image_base
19531 @itemx -init
19532 @itemx -install_name
19533 @itemx -keep_private_externs
19534 @itemx -multi_module
19535 @itemx -multiply_defined
19536 @itemx -multiply_defined_unused
19537 @need 800
19538 @itemx -noall_load
19539 @itemx -no_dead_strip_inits_and_terms
19540 @itemx -nofixprebinding
19541 @itemx -nomultidefs
19542 @itemx -noprebind
19543 @itemx -noseglinkedit
19544 @itemx -pagezero_size
19545 @itemx -prebind
19546 @itemx -prebind_all_twolevel_modules
19547 @itemx -private_bundle
19548 @need 800
19549 @itemx -read_only_relocs
19550 @itemx -sectalign
19551 @itemx -sectobjectsymbols
19552 @itemx -whyload
19553 @itemx -seg1addr
19554 @itemx -sectcreate
19555 @itemx -sectobjectsymbols
19556 @itemx -sectorder
19557 @itemx -segaddr
19558 @itemx -segs_read_only_addr
19559 @need 800
19560 @itemx -segs_read_write_addr
19561 @itemx -seg_addr_table
19562 @itemx -seg_addr_table_filename
19563 @itemx -seglinkedit
19564 @itemx -segprot
19565 @itemx -segs_read_only_addr
19566 @itemx -segs_read_write_addr
19567 @itemx -single_module
19568 @itemx -static
19569 @itemx -sub_library
19570 @need 800
19571 @itemx -sub_umbrella
19572 @itemx -twolevel_namespace
19573 @itemx -umbrella
19574 @itemx -undefined
19575 @itemx -unexported_symbols_list
19576 @itemx -weak_reference_mismatches
19577 @itemx -whatsloaded
19578 @opindex allowable_client
19579 @opindex client_name
19580 @opindex compatibility_version
19581 @opindex current_version
19582 @opindex dead_strip
19583 @opindex dependency-file
19584 @opindex dylib_file
19585 @opindex dylinker_install_name
19586 @opindex dynamic
19587 @opindex exported_symbols_list
19588 @opindex filelist
19589 @opindex flat_namespace
19590 @opindex force_flat_namespace
19591 @opindex headerpad_max_install_names
19592 @opindex image_base
19593 @opindex init
19594 @opindex install_name
19595 @opindex keep_private_externs
19596 @opindex multi_module
19597 @opindex multiply_defined
19598 @opindex multiply_defined_unused
19599 @opindex noall_load
19600 @opindex no_dead_strip_inits_and_terms
19601 @opindex nofixprebinding
19602 @opindex nomultidefs
19603 @opindex noprebind
19604 @opindex noseglinkedit
19605 @opindex pagezero_size
19606 @opindex prebind
19607 @opindex prebind_all_twolevel_modules
19608 @opindex private_bundle
19609 @opindex read_only_relocs
19610 @opindex sectalign
19611 @opindex sectobjectsymbols
19612 @opindex whyload
19613 @opindex seg1addr
19614 @opindex sectcreate
19615 @opindex sectobjectsymbols
19616 @opindex sectorder
19617 @opindex segaddr
19618 @opindex segs_read_only_addr
19619 @opindex segs_read_write_addr
19620 @opindex seg_addr_table
19621 @opindex seg_addr_table_filename
19622 @opindex seglinkedit
19623 @opindex segprot
19624 @opindex segs_read_only_addr
19625 @opindex segs_read_write_addr
19626 @opindex single_module
19627 @opindex static
19628 @opindex sub_library
19629 @opindex sub_umbrella
19630 @opindex twolevel_namespace
19631 @opindex umbrella
19632 @opindex undefined
19633 @opindex unexported_symbols_list
19634 @opindex weak_reference_mismatches
19635 @opindex whatsloaded
19636 These options are passed to the Darwin linker. The Darwin linker man page
19637 describes them in detail.
19638 @end table
19639
19640 @node DEC Alpha Options
19641 @subsection DEC Alpha Options
19642
19643 These @samp{-m} options are defined for the DEC Alpha implementations:
19644
19645 @table @gcctabopt
19646 @item -mno-soft-float
19647 @itemx -msoft-float
19648 @opindex mno-soft-float
19649 @opindex msoft-float
19650 Use (do not use) the hardware floating-point instructions for
19651 floating-point operations. When @option{-msoft-float} is specified,
19652 functions in @file{libgcc.a} are used to perform floating-point
19653 operations. Unless they are replaced by routines that emulate the
19654 floating-point operations, or compiled in such a way as to call such
19655 emulations routines, these routines issue floating-point
19656 operations. If you are compiling for an Alpha without floating-point
19657 operations, you must ensure that the library is built so as not to call
19658 them.
19659
19660 Note that Alpha implementations without floating-point operations are
19661 required to have floating-point registers.
19662
19663 @item -mfp-reg
19664 @itemx -mno-fp-regs
19665 @opindex mfp-reg
19666 @opindex mno-fp-regs
19667 Generate code that uses (does not use) the floating-point register set.
19668 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19669 register set is not used, floating-point operands are passed in integer
19670 registers as if they were integers and floating-point results are passed
19671 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19672 so any function with a floating-point argument or return value called by code
19673 compiled with @option{-mno-fp-regs} must also be compiled with that
19674 option.
19675
19676 A typical use of this option is building a kernel that does not use,
19677 and hence need not save and restore, any floating-point registers.
19678
19679 @item -mieee
19680 @opindex mieee
19681 The Alpha architecture implements floating-point hardware optimized for
19682 maximum performance. It is mostly compliant with the IEEE floating-point
19683 standard. However, for full compliance, software assistance is
19684 required. This option generates code fully IEEE-compliant code
19685 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19686 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19687 defined during compilation. The resulting code is less efficient but is
19688 able to correctly support denormalized numbers and exceptional IEEE
19689 values such as not-a-number and plus/minus infinity. Other Alpha
19690 compilers call this option @option{-ieee_with_no_inexact}.
19691
19692 @item -mieee-with-inexact
19693 @opindex mieee-with-inexact
19694 This is like @option{-mieee} except the generated code also maintains
19695 the IEEE @var{inexact-flag}. Turning on this option causes the
19696 generated code to implement fully-compliant IEEE math. In addition to
19697 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19698 macro. On some Alpha implementations the resulting code may execute
19699 significantly slower than the code generated by default. Since there is
19700 very little code that depends on the @var{inexact-flag}, you should
19701 normally not specify this option. Other Alpha compilers call this
19702 option @option{-ieee_with_inexact}.
19703
19704 @item -mfp-trap-mode=@var{trap-mode}
19705 @opindex mfp-trap-mode
19706 This option controls what floating-point related traps are enabled.
19707 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19708 The trap mode can be set to one of four values:
19709
19710 @table @samp
19711 @item n
19712 This is the default (normal) setting. The only traps that are enabled
19713 are the ones that cannot be disabled in software (e.g., division by zero
19714 trap).
19715
19716 @item u
19717 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19718 as well.
19719
19720 @item su
19721 Like @samp{u}, but the instructions are marked to be safe for software
19722 completion (see Alpha architecture manual for details).
19723
19724 @item sui
19725 Like @samp{su}, but inexact traps are enabled as well.
19726 @end table
19727
19728 @item -mfp-rounding-mode=@var{rounding-mode}
19729 @opindex mfp-rounding-mode
19730 Selects the IEEE rounding mode. Other Alpha compilers call this option
19731 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19732 of:
19733
19734 @table @samp
19735 @item n
19736 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19737 the nearest machine number or towards the even machine number in case
19738 of a tie.
19739
19740 @item m
19741 Round towards minus infinity.
19742
19743 @item c
19744 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19745
19746 @item d
19747 Dynamic rounding mode. A field in the floating-point control register
19748 (@var{fpcr}, see Alpha architecture reference manual) controls the
19749 rounding mode in effect. The C library initializes this register for
19750 rounding towards plus infinity. Thus, unless your program modifies the
19751 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19752 @end table
19753
19754 @item -mtrap-precision=@var{trap-precision}
19755 @opindex mtrap-precision
19756 In the Alpha architecture, floating-point traps are imprecise. This
19757 means without software assistance it is impossible to recover from a
19758 floating trap and program execution normally needs to be terminated.
19759 GCC can generate code that can assist operating system trap handlers
19760 in determining the exact location that caused a floating-point trap.
19761 Depending on the requirements of an application, different levels of
19762 precisions can be selected:
19763
19764 @table @samp
19765 @item p
19766 Program precision. This option is the default and means a trap handler
19767 can only identify which program caused a floating-point exception.
19768
19769 @item f
19770 Function precision. The trap handler can determine the function that
19771 caused a floating-point exception.
19772
19773 @item i
19774 Instruction precision. The trap handler can determine the exact
19775 instruction that caused a floating-point exception.
19776 @end table
19777
19778 Other Alpha compilers provide the equivalent options called
19779 @option{-scope_safe} and @option{-resumption_safe}.
19780
19781 @item -mieee-conformant
19782 @opindex mieee-conformant
19783 This option marks the generated code as IEEE conformant. You must not
19784 use this option unless you also specify @option{-mtrap-precision=i} and either
19785 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19786 is to emit the line @samp{.eflag 48} in the function prologue of the
19787 generated assembly file.
19788
19789 @item -mbuild-constants
19790 @opindex mbuild-constants
19791 Normally GCC examines a 32- or 64-bit integer constant to
19792 see if it can construct it from smaller constants in two or three
19793 instructions. If it cannot, it outputs the constant as a literal and
19794 generates code to load it from the data segment at run time.
19795
19796 Use this option to require GCC to construct @emph{all} integer constants
19797 using code, even if it takes more instructions (the maximum is six).
19798
19799 You typically use this option to build a shared library dynamic
19800 loader. Itself a shared library, it must relocate itself in memory
19801 before it can find the variables and constants in its own data segment.
19802
19803 @item -mbwx
19804 @itemx -mno-bwx
19805 @itemx -mcix
19806 @itemx -mno-cix
19807 @itemx -mfix
19808 @itemx -mno-fix
19809 @itemx -mmax
19810 @itemx -mno-max
19811 @opindex mbwx
19812 @opindex mno-bwx
19813 @opindex mcix
19814 @opindex mno-cix
19815 @opindex mfix
19816 @opindex mno-fix
19817 @opindex mmax
19818 @opindex mno-max
19819 Indicate whether GCC should generate code to use the optional BWX,
19820 CIX, FIX and MAX instruction sets. The default is to use the instruction
19821 sets supported by the CPU type specified via @option{-mcpu=} option or that
19822 of the CPU on which GCC was built if none is specified.
19823
19824 @item -mfloat-vax
19825 @itemx -mfloat-ieee
19826 @opindex mfloat-vax
19827 @opindex mfloat-ieee
19828 Generate code that uses (does not use) VAX F and G floating-point
19829 arithmetic instead of IEEE single and double precision.
19830
19831 @item -mexplicit-relocs
19832 @itemx -mno-explicit-relocs
19833 @opindex mexplicit-relocs
19834 @opindex mno-explicit-relocs
19835 Older Alpha assemblers provided no way to generate symbol relocations
19836 except via assembler macros. Use of these macros does not allow
19837 optimal instruction scheduling. GNU binutils as of version 2.12
19838 supports a new syntax that allows the compiler to explicitly mark
19839 which relocations should apply to which instructions. This option
19840 is mostly useful for debugging, as GCC detects the capabilities of
19841 the assembler when it is built and sets the default accordingly.
19842
19843 @item -msmall-data
19844 @itemx -mlarge-data
19845 @opindex msmall-data
19846 @opindex mlarge-data
19847 When @option{-mexplicit-relocs} is in effect, static data is
19848 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19849 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19850 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19851 16-bit relocations off of the @code{$gp} register. This limits the
19852 size of the small data area to 64KB, but allows the variables to be
19853 directly accessed via a single instruction.
19854
19855 The default is @option{-mlarge-data}. With this option the data area
19856 is limited to just below 2GB@. Programs that require more than 2GB of
19857 data must use @code{malloc} or @code{mmap} to allocate the data in the
19858 heap instead of in the program's data segment.
19859
19860 When generating code for shared libraries, @option{-fpic} implies
19861 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19862
19863 @item -msmall-text
19864 @itemx -mlarge-text
19865 @opindex msmall-text
19866 @opindex mlarge-text
19867 When @option{-msmall-text} is used, the compiler assumes that the
19868 code of the entire program (or shared library) fits in 4MB, and is
19869 thus reachable with a branch instruction. When @option{-msmall-data}
19870 is used, the compiler can assume that all local symbols share the
19871 same @code{$gp} value, and thus reduce the number of instructions
19872 required for a function call from 4 to 1.
19873
19874 The default is @option{-mlarge-text}.
19875
19876 @item -mcpu=@var{cpu_type}
19877 @opindex mcpu
19878 Set the instruction set and instruction scheduling parameters for
19879 machine type @var{cpu_type}. You can specify either the @samp{EV}
19880 style name or the corresponding chip number. GCC supports scheduling
19881 parameters for the EV4, EV5 and EV6 family of processors and
19882 chooses the default values for the instruction set from the processor
19883 you specify. If you do not specify a processor type, GCC defaults
19884 to the processor on which the compiler was built.
19885
19886 Supported values for @var{cpu_type} are
19887
19888 @table @samp
19889 @item ev4
19890 @itemx ev45
19891 @itemx 21064
19892 Schedules as an EV4 and has no instruction set extensions.
19893
19894 @item ev5
19895 @itemx 21164
19896 Schedules as an EV5 and has no instruction set extensions.
19897
19898 @item ev56
19899 @itemx 21164a
19900 Schedules as an EV5 and supports the BWX extension.
19901
19902 @item pca56
19903 @itemx 21164pc
19904 @itemx 21164PC
19905 Schedules as an EV5 and supports the BWX and MAX extensions.
19906
19907 @item ev6
19908 @itemx 21264
19909 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19910
19911 @item ev67
19912 @itemx 21264a
19913 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19914 @end table
19915
19916 Native toolchains also support the value @samp{native},
19917 which selects the best architecture option for the host processor.
19918 @option{-mcpu=native} has no effect if GCC does not recognize
19919 the processor.
19920
19921 @item -mtune=@var{cpu_type}
19922 @opindex mtune
19923 Set only the instruction scheduling parameters for machine type
19924 @var{cpu_type}. The instruction set is not changed.
19925
19926 Native toolchains also support the value @samp{native},
19927 which selects the best architecture option for the host processor.
19928 @option{-mtune=native} has no effect if GCC does not recognize
19929 the processor.
19930
19931 @item -mmemory-latency=@var{time}
19932 @opindex mmemory-latency
19933 Sets the latency the scheduler should assume for typical memory
19934 references as seen by the application. This number is highly
19935 dependent on the memory access patterns used by the application
19936 and the size of the external cache on the machine.
19937
19938 Valid options for @var{time} are
19939
19940 @table @samp
19941 @item @var{number}
19942 A decimal number representing clock cycles.
19943
19944 @item L1
19945 @itemx L2
19946 @itemx L3
19947 @itemx main
19948 The compiler contains estimates of the number of clock cycles for
19949 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19950 (also called Dcache, Scache, and Bcache), as well as to main memory.
19951 Note that L3 is only valid for EV5.
19952
19953 @end table
19954 @end table
19955
19956 @node eBPF Options
19957 @subsection eBPF Options
19958 @cindex eBPF Options
19959
19960 @table @gcctabopt
19961 @item -mframe-limit=@var{bytes}
19962 This specifies the hard limit for frame sizes, in bytes. Currently,
19963 the value that can be specified should be less than or equal to
19964 @samp{32767}. Defaults to whatever limit is imposed by the version of
19965 the Linux kernel targeted.
19966
19967 @item -mkernel=@var{version}
19968 @opindex mkernel
19969 This specifies the minimum version of the kernel that will run the
19970 compiled program. GCC uses this version to determine which
19971 instructions to use, what kernel helpers to allow, etc. Currently,
19972 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19973 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19974 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19975 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19976 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19977 @samp{5.2}, @samp{latest} and @samp{native}.
19978
19979 @item -mbig-endian
19980 @opindex mbig-endian
19981 Generate code for a big-endian target.
19982
19983 @item -mlittle-endian
19984 @opindex mlittle-endian
19985 Generate code for a little-endian target. This is the default.
19986 @end table
19987
19988 @node FR30 Options
19989 @subsection FR30 Options
19990 @cindex FR30 Options
19991
19992 These options are defined specifically for the FR30 port.
19993
19994 @table @gcctabopt
19995
19996 @item -msmall-model
19997 @opindex msmall-model
19998 Use the small address space model. This can produce smaller code, but
19999 it does assume that all symbolic values and addresses fit into a
20000 20-bit range.
20001
20002 @item -mno-lsim
20003 @opindex mno-lsim
20004 Assume that runtime support has been provided and so there is no need
20005 to include the simulator library (@file{libsim.a}) on the linker
20006 command line.
20007
20008 @end table
20009
20010 @node FT32 Options
20011 @subsection FT32 Options
20012 @cindex FT32 Options
20013
20014 These options are defined specifically for the FT32 port.
20015
20016 @table @gcctabopt
20017
20018 @item -msim
20019 @opindex msim
20020 Specifies that the program will be run on the simulator. This causes
20021 an alternate runtime startup and library to be linked.
20022 You must not use this option when generating programs that will run on
20023 real hardware; you must provide your own runtime library for whatever
20024 I/O functions are needed.
20025
20026 @item -mlra
20027 @opindex mlra
20028 Enable Local Register Allocation. This is still experimental for FT32,
20029 so by default the compiler uses standard reload.
20030
20031 @item -mnodiv
20032 @opindex mnodiv
20033 Do not use div and mod instructions.
20034
20035 @item -mft32b
20036 @opindex mft32b
20037 Enable use of the extended instructions of the FT32B processor.
20038
20039 @item -mcompress
20040 @opindex mcompress
20041 Compress all code using the Ft32B code compression scheme.
20042
20043 @item -mnopm
20044 @opindex mnopm
20045 Do not generate code that reads program memory.
20046
20047 @end table
20048
20049 @node FRV Options
20050 @subsection FRV Options
20051 @cindex FRV Options
20052
20053 @table @gcctabopt
20054 @item -mgpr-32
20055 @opindex mgpr-32
20056
20057 Only use the first 32 general-purpose registers.
20058
20059 @item -mgpr-64
20060 @opindex mgpr-64
20061
20062 Use all 64 general-purpose registers.
20063
20064 @item -mfpr-32
20065 @opindex mfpr-32
20066
20067 Use only the first 32 floating-point registers.
20068
20069 @item -mfpr-64
20070 @opindex mfpr-64
20071
20072 Use all 64 floating-point registers.
20073
20074 @item -mhard-float
20075 @opindex mhard-float
20076
20077 Use hardware instructions for floating-point operations.
20078
20079 @item -msoft-float
20080 @opindex msoft-float
20081
20082 Use library routines for floating-point operations.
20083
20084 @item -malloc-cc
20085 @opindex malloc-cc
20086
20087 Dynamically allocate condition code registers.
20088
20089 @item -mfixed-cc
20090 @opindex mfixed-cc
20091
20092 Do not try to dynamically allocate condition code registers, only
20093 use @code{icc0} and @code{fcc0}.
20094
20095 @item -mdword
20096 @opindex mdword
20097
20098 Change ABI to use double word insns.
20099
20100 @item -mno-dword
20101 @opindex mno-dword
20102 @opindex mdword
20103
20104 Do not use double word instructions.
20105
20106 @item -mdouble
20107 @opindex mdouble
20108
20109 Use floating-point double instructions.
20110
20111 @item -mno-double
20112 @opindex mno-double
20113
20114 Do not use floating-point double instructions.
20115
20116 @item -mmedia
20117 @opindex mmedia
20118
20119 Use media instructions.
20120
20121 @item -mno-media
20122 @opindex mno-media
20123
20124 Do not use media instructions.
20125
20126 @item -mmuladd
20127 @opindex mmuladd
20128
20129 Use multiply and add/subtract instructions.
20130
20131 @item -mno-muladd
20132 @opindex mno-muladd
20133
20134 Do not use multiply and add/subtract instructions.
20135
20136 @item -mfdpic
20137 @opindex mfdpic
20138
20139 Select the FDPIC ABI, which uses function descriptors to represent
20140 pointers to functions. Without any PIC/PIE-related options, it
20141 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20142 assumes GOT entries and small data are within a 12-bit range from the
20143 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20144 are computed with 32 bits.
20145 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20146
20147 @item -minline-plt
20148 @opindex minline-plt
20149
20150 Enable inlining of PLT entries in function calls to functions that are
20151 not known to bind locally. It has no effect without @option{-mfdpic}.
20152 It's enabled by default if optimizing for speed and compiling for
20153 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20154 optimization option such as @option{-O3} or above is present in the
20155 command line.
20156
20157 @item -mTLS
20158 @opindex mTLS
20159
20160 Assume a large TLS segment when generating thread-local code.
20161
20162 @item -mtls
20163 @opindex mtls
20164
20165 Do not assume a large TLS segment when generating thread-local code.
20166
20167 @item -mgprel-ro
20168 @opindex mgprel-ro
20169
20170 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20171 that is known to be in read-only sections. It's enabled by default,
20172 except for @option{-fpic} or @option{-fpie}: even though it may help
20173 make the global offset table smaller, it trades 1 instruction for 4.
20174 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20175 one of which may be shared by multiple symbols, and it avoids the need
20176 for a GOT entry for the referenced symbol, so it's more likely to be a
20177 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20178
20179 @item -multilib-library-pic
20180 @opindex multilib-library-pic
20181
20182 Link with the (library, not FD) pic libraries. It's implied by
20183 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20184 @option{-fpic} without @option{-mfdpic}. You should never have to use
20185 it explicitly.
20186
20187 @item -mlinked-fp
20188 @opindex mlinked-fp
20189
20190 Follow the EABI requirement of always creating a frame pointer whenever
20191 a stack frame is allocated. This option is enabled by default and can
20192 be disabled with @option{-mno-linked-fp}.
20193
20194 @item -mlong-calls
20195 @opindex mlong-calls
20196
20197 Use indirect addressing to call functions outside the current
20198 compilation unit. This allows the functions to be placed anywhere
20199 within the 32-bit address space.
20200
20201 @item -malign-labels
20202 @opindex malign-labels
20203
20204 Try to align labels to an 8-byte boundary by inserting NOPs into the
20205 previous packet. This option only has an effect when VLIW packing
20206 is enabled. It doesn't create new packets; it merely adds NOPs to
20207 existing ones.
20208
20209 @item -mlibrary-pic
20210 @opindex mlibrary-pic
20211
20212 Generate position-independent EABI code.
20213
20214 @item -macc-4
20215 @opindex macc-4
20216
20217 Use only the first four media accumulator registers.
20218
20219 @item -macc-8
20220 @opindex macc-8
20221
20222 Use all eight media accumulator registers.
20223
20224 @item -mpack
20225 @opindex mpack
20226
20227 Pack VLIW instructions.
20228
20229 @item -mno-pack
20230 @opindex mno-pack
20231
20232 Do not pack VLIW instructions.
20233
20234 @item -mno-eflags
20235 @opindex mno-eflags
20236
20237 Do not mark ABI switches in e_flags.
20238
20239 @item -mcond-move
20240 @opindex mcond-move
20241
20242 Enable the use of conditional-move instructions (default).
20243
20244 This switch is mainly for debugging the compiler and will likely be removed
20245 in a future version.
20246
20247 @item -mno-cond-move
20248 @opindex mno-cond-move
20249
20250 Disable the use of conditional-move instructions.
20251
20252 This switch is mainly for debugging the compiler and will likely be removed
20253 in a future version.
20254
20255 @item -mscc
20256 @opindex mscc
20257
20258 Enable the use of conditional set instructions (default).
20259
20260 This switch is mainly for debugging the compiler and will likely be removed
20261 in a future version.
20262
20263 @item -mno-scc
20264 @opindex mno-scc
20265
20266 Disable the use of conditional set instructions.
20267
20268 This switch is mainly for debugging the compiler and will likely be removed
20269 in a future version.
20270
20271 @item -mcond-exec
20272 @opindex mcond-exec
20273
20274 Enable the use of conditional execution (default).
20275
20276 This switch is mainly for debugging the compiler and will likely be removed
20277 in a future version.
20278
20279 @item -mno-cond-exec
20280 @opindex mno-cond-exec
20281
20282 Disable the use of conditional execution.
20283
20284 This switch is mainly for debugging the compiler and will likely be removed
20285 in a future version.
20286
20287 @item -mvliw-branch
20288 @opindex mvliw-branch
20289
20290 Run a pass to pack branches into VLIW instructions (default).
20291
20292 This switch is mainly for debugging the compiler and will likely be removed
20293 in a future version.
20294
20295 @item -mno-vliw-branch
20296 @opindex mno-vliw-branch
20297
20298 Do not run a pass to pack branches into VLIW instructions.
20299
20300 This switch is mainly for debugging the compiler and will likely be removed
20301 in a future version.
20302
20303 @item -mmulti-cond-exec
20304 @opindex mmulti-cond-exec
20305
20306 Enable optimization of @code{&&} and @code{||} in conditional execution
20307 (default).
20308
20309 This switch is mainly for debugging the compiler and will likely be removed
20310 in a future version.
20311
20312 @item -mno-multi-cond-exec
20313 @opindex mno-multi-cond-exec
20314
20315 Disable optimization of @code{&&} and @code{||} in conditional execution.
20316
20317 This switch is mainly for debugging the compiler and will likely be removed
20318 in a future version.
20319
20320 @item -mnested-cond-exec
20321 @opindex mnested-cond-exec
20322
20323 Enable nested conditional execution optimizations (default).
20324
20325 This switch is mainly for debugging the compiler and will likely be removed
20326 in a future version.
20327
20328 @item -mno-nested-cond-exec
20329 @opindex mno-nested-cond-exec
20330
20331 Disable nested conditional execution optimizations.
20332
20333 This switch is mainly for debugging the compiler and will likely be removed
20334 in a future version.
20335
20336 @item -moptimize-membar
20337 @opindex moptimize-membar
20338
20339 This switch removes redundant @code{membar} instructions from the
20340 compiler-generated code. It is enabled by default.
20341
20342 @item -mno-optimize-membar
20343 @opindex mno-optimize-membar
20344 @opindex moptimize-membar
20345
20346 This switch disables the automatic removal of redundant @code{membar}
20347 instructions from the generated code.
20348
20349 @item -mtomcat-stats
20350 @opindex mtomcat-stats
20351
20352 Cause gas to print out tomcat statistics.
20353
20354 @item -mcpu=@var{cpu}
20355 @opindex mcpu
20356
20357 Select the processor type for which to generate code. Possible values are
20358 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20359 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20360
20361 @end table
20362
20363 @node GNU/Linux Options
20364 @subsection GNU/Linux Options
20365
20366 These @samp{-m} options are defined for GNU/Linux targets:
20367
20368 @table @gcctabopt
20369 @item -mglibc
20370 @opindex mglibc
20371 Use the GNU C library. This is the default except
20372 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20373 @samp{*-*-linux-*android*} targets.
20374
20375 @item -muclibc
20376 @opindex muclibc
20377 Use uClibc C library. This is the default on
20378 @samp{*-*-linux-*uclibc*} targets.
20379
20380 @item -mmusl
20381 @opindex mmusl
20382 Use the musl C library. This is the default on
20383 @samp{*-*-linux-*musl*} targets.
20384
20385 @item -mbionic
20386 @opindex mbionic
20387 Use Bionic C library. This is the default on
20388 @samp{*-*-linux-*android*} targets.
20389
20390 @item -mandroid
20391 @opindex mandroid
20392 Compile code compatible with Android platform. This is the default on
20393 @samp{*-*-linux-*android*} targets.
20394
20395 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20396 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20397 this option makes the GCC driver pass Android-specific options to the linker.
20398 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20399 to be defined.
20400
20401 @item -tno-android-cc
20402 @opindex tno-android-cc
20403 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20404 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20405 @option{-fno-rtti} by default.
20406
20407 @item -tno-android-ld
20408 @opindex tno-android-ld
20409 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20410 linking options to the linker.
20411
20412 @end table
20413
20414 @node H8/300 Options
20415 @subsection H8/300 Options
20416
20417 These @samp{-m} options are defined for the H8/300 implementations:
20418
20419 @table @gcctabopt
20420 @item -mrelax
20421 @opindex mrelax
20422 Shorten some address references at link time, when possible; uses the
20423 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20424 ld, Using ld}, for a fuller description.
20425
20426 @item -mh
20427 @opindex mh
20428 Generate code for the H8/300H@.
20429
20430 @item -ms
20431 @opindex ms
20432 Generate code for the H8S@.
20433
20434 @item -mn
20435 @opindex mn
20436 Generate code for the H8S and H8/300H in the normal mode. This switch
20437 must be used either with @option{-mh} or @option{-ms}.
20438
20439 @item -ms2600
20440 @opindex ms2600
20441 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20442
20443 @item -mexr
20444 @opindex mexr
20445 Extended registers are stored on stack before execution of function
20446 with monitor attribute. Default option is @option{-mexr}.
20447 This option is valid only for H8S targets.
20448
20449 @item -mno-exr
20450 @opindex mno-exr
20451 @opindex mexr
20452 Extended registers are not stored on stack before execution of function
20453 with monitor attribute. Default option is @option{-mno-exr}.
20454 This option is valid only for H8S targets.
20455
20456 @item -mint32
20457 @opindex mint32
20458 Make @code{int} data 32 bits by default.
20459
20460 @item -malign-300
20461 @opindex malign-300
20462 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20463 The default for the H8/300H and H8S is to align longs and floats on
20464 4-byte boundaries.
20465 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20466 This option has no effect on the H8/300.
20467 @end table
20468
20469 @node HPPA Options
20470 @subsection HPPA Options
20471 @cindex HPPA Options
20472
20473 These @samp{-m} options are defined for the HPPA family of computers:
20474
20475 @table @gcctabopt
20476 @item -march=@var{architecture-type}
20477 @opindex march
20478 Generate code for the specified architecture. The choices for
20479 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20480 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20481 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20482 architecture option for your machine. Code compiled for lower numbered
20483 architectures runs on higher numbered architectures, but not the
20484 other way around.
20485
20486 @item -mpa-risc-1-0
20487 @itemx -mpa-risc-1-1
20488 @itemx -mpa-risc-2-0
20489 @opindex mpa-risc-1-0
20490 @opindex mpa-risc-1-1
20491 @opindex mpa-risc-2-0
20492 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20493
20494 @item -mcaller-copies
20495 @opindex mcaller-copies
20496 The caller copies function arguments passed by hidden reference. This
20497 option should be used with care as it is not compatible with the default
20498 32-bit runtime. However, only aggregates larger than eight bytes are
20499 passed by hidden reference and the option provides better compatibility
20500 with OpenMP.
20501
20502 @item -mjump-in-delay
20503 @opindex mjump-in-delay
20504 This option is ignored and provided for compatibility purposes only.
20505
20506 @item -mdisable-fpregs
20507 @opindex mdisable-fpregs
20508 Prevent floating-point registers from being used in any manner. This is
20509 necessary for compiling kernels that perform lazy context switching of
20510 floating-point registers. If you use this option and attempt to perform
20511 floating-point operations, the compiler aborts.
20512
20513 @item -mdisable-indexing
20514 @opindex mdisable-indexing
20515 Prevent the compiler from using indexing address modes. This avoids some
20516 rather obscure problems when compiling MIG generated code under MACH@.
20517
20518 @item -mno-space-regs
20519 @opindex mno-space-regs
20520 @opindex mspace-regs
20521 Generate code that assumes the target has no space registers. This allows
20522 GCC to generate faster indirect calls and use unscaled index address modes.
20523
20524 Such code is suitable for level 0 PA systems and kernels.
20525
20526 @item -mfast-indirect-calls
20527 @opindex mfast-indirect-calls
20528 Generate code that assumes calls never cross space boundaries. This
20529 allows GCC to emit code that performs faster indirect calls.
20530
20531 This option does not work in the presence of shared libraries or nested
20532 functions.
20533
20534 @item -mfixed-range=@var{register-range}
20535 @opindex mfixed-range
20536 Generate code treating the given register range as fixed registers.
20537 A fixed register is one that the register allocator cannot use. This is
20538 useful when compiling kernel code. A register range is specified as
20539 two registers separated by a dash. Multiple register ranges can be
20540 specified separated by a comma.
20541
20542 @item -mlong-load-store
20543 @opindex mlong-load-store
20544 Generate 3-instruction load and store sequences as sometimes required by
20545 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20546 the HP compilers.
20547
20548 @item -mportable-runtime
20549 @opindex mportable-runtime
20550 Use the portable calling conventions proposed by HP for ELF systems.
20551
20552 @item -mgas
20553 @opindex mgas
20554 Enable the use of assembler directives only GAS understands.
20555
20556 @item -mschedule=@var{cpu-type}
20557 @opindex mschedule
20558 Schedule code according to the constraints for the machine type
20559 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20560 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20561 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20562 proper scheduling option for your machine. The default scheduling is
20563 @samp{8000}.
20564
20565 @item -mlinker-opt
20566 @opindex mlinker-opt
20567 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20568 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20569 linkers in which they give bogus error messages when linking some programs.
20570
20571 @item -msoft-float
20572 @opindex msoft-float
20573 Generate output containing library calls for floating point.
20574 @strong{Warning:} the requisite libraries are not available for all HPPA
20575 targets. Normally the facilities of the machine's usual C compiler are
20576 used, but this cannot be done directly in cross-compilation. You must make
20577 your own arrangements to provide suitable library functions for
20578 cross-compilation.
20579
20580 @option{-msoft-float} changes the calling convention in the output file;
20581 therefore, it is only useful if you compile @emph{all} of a program with
20582 this option. In particular, you need to compile @file{libgcc.a}, the
20583 library that comes with GCC, with @option{-msoft-float} in order for
20584 this to work.
20585
20586 @item -msio
20587 @opindex msio
20588 Generate the predefine, @code{_SIO}, for server IO@. The default is
20589 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20590 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20591 options are available under HP-UX and HI-UX@.
20592
20593 @item -mgnu-ld
20594 @opindex mgnu-ld
20595 Use options specific to GNU @command{ld}.
20596 This passes @option{-shared} to @command{ld} when
20597 building a shared library. It is the default when GCC is configured,
20598 explicitly or implicitly, with the GNU linker. This option does not
20599 affect which @command{ld} is called; it only changes what parameters
20600 are passed to that @command{ld}.
20601 The @command{ld} that is called is determined by the
20602 @option{--with-ld} configure option, GCC's program search path, and
20603 finally by the user's @env{PATH}. The linker used by GCC can be printed
20604 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20605 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20606
20607 @item -mhp-ld
20608 @opindex mhp-ld
20609 Use options specific to HP @command{ld}.
20610 This passes @option{-b} to @command{ld} when building
20611 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20612 links. It is the default when GCC is configured, explicitly or
20613 implicitly, with the HP linker. This option does not affect
20614 which @command{ld} is called; it only changes what parameters are passed to that
20615 @command{ld}.
20616 The @command{ld} that is called is determined by the @option{--with-ld}
20617 configure option, GCC's program search path, and finally by the user's
20618 @env{PATH}. The linker used by GCC can be printed using @samp{which
20619 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20620 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20621
20622 @item -mlong-calls
20623 @opindex mno-long-calls
20624 @opindex mlong-calls
20625 Generate code that uses long call sequences. This ensures that a call
20626 is always able to reach linker generated stubs. The default is to generate
20627 long calls only when the distance from the call site to the beginning
20628 of the function or translation unit, as the case may be, exceeds a
20629 predefined limit set by the branch type being used. The limits for
20630 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20631 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20632 240,000 bytes.
20633
20634 Distances are measured from the beginning of functions when using the
20635 @option{-ffunction-sections} option, or when using the @option{-mgas}
20636 and @option{-mno-portable-runtime} options together under HP-UX with
20637 the SOM linker.
20638
20639 It is normally not desirable to use this option as it degrades
20640 performance. However, it may be useful in large applications,
20641 particularly when partial linking is used to build the application.
20642
20643 The types of long calls used depends on the capabilities of the
20644 assembler and linker, and the type of code being generated. The
20645 impact on systems that support long absolute calls, and long pic
20646 symbol-difference or pc-relative calls should be relatively small.
20647 However, an indirect call is used on 32-bit ELF systems in pic code
20648 and it is quite long.
20649
20650 @item -munix=@var{unix-std}
20651 @opindex march
20652 Generate compiler predefines and select a startfile for the specified
20653 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20654 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20655 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20656 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20657 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20658 and later.
20659
20660 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20661 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20662 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20663 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20664 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20665 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20666
20667 It is @emph{important} to note that this option changes the interfaces
20668 for various library routines. It also affects the operational behavior
20669 of the C library. Thus, @emph{extreme} care is needed in using this
20670 option.
20671
20672 Library code that is intended to operate with more than one UNIX
20673 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20674 as appropriate. Most GNU software doesn't provide this capability.
20675
20676 @item -nolibdld
20677 @opindex nolibdld
20678 Suppress the generation of link options to search libdld.sl when the
20679 @option{-static} option is specified on HP-UX 10 and later.
20680
20681 @item -static
20682 @opindex static
20683 The HP-UX implementation of setlocale in libc has a dependency on
20684 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20685 when the @option{-static} option is specified, special link options
20686 are needed to resolve this dependency.
20687
20688 On HP-UX 10 and later, the GCC driver adds the necessary options to
20689 link with libdld.sl when the @option{-static} option is specified.
20690 This causes the resulting binary to be dynamic. On the 64-bit port,
20691 the linkers generate dynamic binaries by default in any case. The
20692 @option{-nolibdld} option can be used to prevent the GCC driver from
20693 adding these link options.
20694
20695 @item -threads
20696 @opindex threads
20697 Add support for multithreading with the @dfn{dce thread} library
20698 under HP-UX@. This option sets flags for both the preprocessor and
20699 linker.
20700 @end table
20701
20702 @node IA-64 Options
20703 @subsection IA-64 Options
20704 @cindex IA-64 Options
20705
20706 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20707
20708 @table @gcctabopt
20709 @item -mbig-endian
20710 @opindex mbig-endian
20711 Generate code for a big-endian target. This is the default for HP-UX@.
20712
20713 @item -mlittle-endian
20714 @opindex mlittle-endian
20715 Generate code for a little-endian target. This is the default for AIX5
20716 and GNU/Linux.
20717
20718 @item -mgnu-as
20719 @itemx -mno-gnu-as
20720 @opindex mgnu-as
20721 @opindex mno-gnu-as
20722 Generate (or don't) code for the GNU assembler. This is the default.
20723 @c Also, this is the default if the configure option @option{--with-gnu-as}
20724 @c is used.
20725
20726 @item -mgnu-ld
20727 @itemx -mno-gnu-ld
20728 @opindex mgnu-ld
20729 @opindex mno-gnu-ld
20730 Generate (or don't) code for the GNU linker. This is the default.
20731 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20732 @c is used.
20733
20734 @item -mno-pic
20735 @opindex mno-pic
20736 Generate code that does not use a global pointer register. The result
20737 is not position independent code, and violates the IA-64 ABI@.
20738
20739 @item -mvolatile-asm-stop
20740 @itemx -mno-volatile-asm-stop
20741 @opindex mvolatile-asm-stop
20742 @opindex mno-volatile-asm-stop
20743 Generate (or don't) a stop bit immediately before and after volatile asm
20744 statements.
20745
20746 @item -mregister-names
20747 @itemx -mno-register-names
20748 @opindex mregister-names
20749 @opindex mno-register-names
20750 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20751 the stacked registers. This may make assembler output more readable.
20752
20753 @item -mno-sdata
20754 @itemx -msdata
20755 @opindex mno-sdata
20756 @opindex msdata
20757 Disable (or enable) optimizations that use the small data section. This may
20758 be useful for working around optimizer bugs.
20759
20760 @item -mconstant-gp
20761 @opindex mconstant-gp
20762 Generate code that uses a single constant global pointer value. This is
20763 useful when compiling kernel code.
20764
20765 @item -mauto-pic
20766 @opindex mauto-pic
20767 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20768 This is useful when compiling firmware code.
20769
20770 @item -minline-float-divide-min-latency
20771 @opindex minline-float-divide-min-latency
20772 Generate code for inline divides of floating-point values
20773 using the minimum latency algorithm.
20774
20775 @item -minline-float-divide-max-throughput
20776 @opindex minline-float-divide-max-throughput
20777 Generate code for inline divides of floating-point values
20778 using the maximum throughput algorithm.
20779
20780 @item -mno-inline-float-divide
20781 @opindex mno-inline-float-divide
20782 Do not generate inline code for divides of floating-point values.
20783
20784 @item -minline-int-divide-min-latency
20785 @opindex minline-int-divide-min-latency
20786 Generate code for inline divides of integer values
20787 using the minimum latency algorithm.
20788
20789 @item -minline-int-divide-max-throughput
20790 @opindex minline-int-divide-max-throughput
20791 Generate code for inline divides of integer values
20792 using the maximum throughput algorithm.
20793
20794 @item -mno-inline-int-divide
20795 @opindex mno-inline-int-divide
20796 @opindex minline-int-divide
20797 Do not generate inline code for divides of integer values.
20798
20799 @item -minline-sqrt-min-latency
20800 @opindex minline-sqrt-min-latency
20801 Generate code for inline square roots
20802 using the minimum latency algorithm.
20803
20804 @item -minline-sqrt-max-throughput
20805 @opindex minline-sqrt-max-throughput
20806 Generate code for inline square roots
20807 using the maximum throughput algorithm.
20808
20809 @item -mno-inline-sqrt
20810 @opindex mno-inline-sqrt
20811 Do not generate inline code for @code{sqrt}.
20812
20813 @item -mfused-madd
20814 @itemx -mno-fused-madd
20815 @opindex mfused-madd
20816 @opindex mno-fused-madd
20817 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20818 instructions. The default is to use these instructions.
20819
20820 @item -mno-dwarf2-asm
20821 @itemx -mdwarf2-asm
20822 @opindex mno-dwarf2-asm
20823 @opindex mdwarf2-asm
20824 Don't (or do) generate assembler code for the DWARF line number debugging
20825 info. This may be useful when not using the GNU assembler.
20826
20827 @item -mearly-stop-bits
20828 @itemx -mno-early-stop-bits
20829 @opindex mearly-stop-bits
20830 @opindex mno-early-stop-bits
20831 Allow stop bits to be placed earlier than immediately preceding the
20832 instruction that triggered the stop bit. This can improve instruction
20833 scheduling, but does not always do so.
20834
20835 @item -mfixed-range=@var{register-range}
20836 @opindex mfixed-range
20837 Generate code treating the given register range as fixed registers.
20838 A fixed register is one that the register allocator cannot use. This is
20839 useful when compiling kernel code. A register range is specified as
20840 two registers separated by a dash. Multiple register ranges can be
20841 specified separated by a comma.
20842
20843 @item -mtls-size=@var{tls-size}
20844 @opindex mtls-size
20845 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20846 64.
20847
20848 @item -mtune=@var{cpu-type}
20849 @opindex mtune
20850 Tune the instruction scheduling for a particular CPU, Valid values are
20851 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20852 and @samp{mckinley}.
20853
20854 @item -milp32
20855 @itemx -mlp64
20856 @opindex milp32
20857 @opindex mlp64
20858 Generate code for a 32-bit or 64-bit environment.
20859 The 32-bit environment sets int, long and pointer to 32 bits.
20860 The 64-bit environment sets int to 32 bits and long and pointer
20861 to 64 bits. These are HP-UX specific flags.
20862
20863 @item -mno-sched-br-data-spec
20864 @itemx -msched-br-data-spec
20865 @opindex mno-sched-br-data-spec
20866 @opindex msched-br-data-spec
20867 (Dis/En)able data speculative scheduling before reload.
20868 This results in generation of @code{ld.a} instructions and
20869 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20870 The default setting is disabled.
20871
20872 @item -msched-ar-data-spec
20873 @itemx -mno-sched-ar-data-spec
20874 @opindex msched-ar-data-spec
20875 @opindex mno-sched-ar-data-spec
20876 (En/Dis)able data speculative scheduling after reload.
20877 This results in generation of @code{ld.a} instructions and
20878 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20879 The default setting is enabled.
20880
20881 @item -mno-sched-control-spec
20882 @itemx -msched-control-spec
20883 @opindex mno-sched-control-spec
20884 @opindex msched-control-spec
20885 (Dis/En)able control speculative scheduling. This feature is
20886 available only during region scheduling (i.e.@: before reload).
20887 This results in generation of the @code{ld.s} instructions and
20888 the corresponding check instructions @code{chk.s}.
20889 The default setting is disabled.
20890
20891 @item -msched-br-in-data-spec
20892 @itemx -mno-sched-br-in-data-spec
20893 @opindex msched-br-in-data-spec
20894 @opindex mno-sched-br-in-data-spec
20895 (En/Dis)able speculative scheduling of the instructions that
20896 are dependent on the data speculative loads before reload.
20897 This is effective only with @option{-msched-br-data-spec} enabled.
20898 The default setting is enabled.
20899
20900 @item -msched-ar-in-data-spec
20901 @itemx -mno-sched-ar-in-data-spec
20902 @opindex msched-ar-in-data-spec
20903 @opindex mno-sched-ar-in-data-spec
20904 (En/Dis)able speculative scheduling of the instructions that
20905 are dependent on the data speculative loads after reload.
20906 This is effective only with @option{-msched-ar-data-spec} enabled.
20907 The default setting is enabled.
20908
20909 @item -msched-in-control-spec
20910 @itemx -mno-sched-in-control-spec
20911 @opindex msched-in-control-spec
20912 @opindex mno-sched-in-control-spec
20913 (En/Dis)able speculative scheduling of the instructions that
20914 are dependent on the control speculative loads.
20915 This is effective only with @option{-msched-control-spec} enabled.
20916 The default setting is enabled.
20917
20918 @item -mno-sched-prefer-non-data-spec-insns
20919 @itemx -msched-prefer-non-data-spec-insns
20920 @opindex mno-sched-prefer-non-data-spec-insns
20921 @opindex msched-prefer-non-data-spec-insns
20922 If enabled, data-speculative instructions are chosen for schedule
20923 only if there are no other choices at the moment. This makes
20924 the use of the data speculation much more conservative.
20925 The default setting is disabled.
20926
20927 @item -mno-sched-prefer-non-control-spec-insns
20928 @itemx -msched-prefer-non-control-spec-insns
20929 @opindex mno-sched-prefer-non-control-spec-insns
20930 @opindex msched-prefer-non-control-spec-insns
20931 If enabled, control-speculative instructions are chosen for schedule
20932 only if there are no other choices at the moment. This makes
20933 the use of the control speculation much more conservative.
20934 The default setting is disabled.
20935
20936 @item -mno-sched-count-spec-in-critical-path
20937 @itemx -msched-count-spec-in-critical-path
20938 @opindex mno-sched-count-spec-in-critical-path
20939 @opindex msched-count-spec-in-critical-path
20940 If enabled, speculative dependencies are considered during
20941 computation of the instructions priorities. This makes the use of the
20942 speculation a bit more conservative.
20943 The default setting is disabled.
20944
20945 @item -msched-spec-ldc
20946 @opindex msched-spec-ldc
20947 Use a simple data speculation check. This option is on by default.
20948
20949 @item -msched-control-spec-ldc
20950 @opindex msched-spec-ldc
20951 Use a simple check for control speculation. This option is on by default.
20952
20953 @item -msched-stop-bits-after-every-cycle
20954 @opindex msched-stop-bits-after-every-cycle
20955 Place a stop bit after every cycle when scheduling. This option is on
20956 by default.
20957
20958 @item -msched-fp-mem-deps-zero-cost
20959 @opindex msched-fp-mem-deps-zero-cost
20960 Assume that floating-point stores and loads are not likely to cause a conflict
20961 when placed into the same instruction group. This option is disabled by
20962 default.
20963
20964 @item -msel-sched-dont-check-control-spec
20965 @opindex msel-sched-dont-check-control-spec
20966 Generate checks for control speculation in selective scheduling.
20967 This flag is disabled by default.
20968
20969 @item -msched-max-memory-insns=@var{max-insns}
20970 @opindex msched-max-memory-insns
20971 Limit on the number of memory insns per instruction group, giving lower
20972 priority to subsequent memory insns attempting to schedule in the same
20973 instruction group. Frequently useful to prevent cache bank conflicts.
20974 The default value is 1.
20975
20976 @item -msched-max-memory-insns-hard-limit
20977 @opindex msched-max-memory-insns-hard-limit
20978 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20979 disallowing more than that number in an instruction group.
20980 Otherwise, the limit is ``soft'', meaning that non-memory operations
20981 are preferred when the limit is reached, but memory operations may still
20982 be scheduled.
20983
20984 @end table
20985
20986 @node LM32 Options
20987 @subsection LM32 Options
20988 @cindex LM32 options
20989
20990 These @option{-m} options are defined for the LatticeMico32 architecture:
20991
20992 @table @gcctabopt
20993 @item -mbarrel-shift-enabled
20994 @opindex mbarrel-shift-enabled
20995 Enable barrel-shift instructions.
20996
20997 @item -mdivide-enabled
20998 @opindex mdivide-enabled
20999 Enable divide and modulus instructions.
21000
21001 @item -mmultiply-enabled
21002 @opindex multiply-enabled
21003 Enable multiply instructions.
21004
21005 @item -msign-extend-enabled
21006 @opindex msign-extend-enabled
21007 Enable sign extend instructions.
21008
21009 @item -muser-enabled
21010 @opindex muser-enabled
21011 Enable user-defined instructions.
21012
21013 @end table
21014
21015 @node M32C Options
21016 @subsection M32C Options
21017 @cindex M32C options
21018
21019 @table @gcctabopt
21020 @item -mcpu=@var{name}
21021 @opindex mcpu=
21022 Select the CPU for which code is generated. @var{name} may be one of
21023 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
21024 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
21025 the M32C/80 series.
21026
21027 @item -msim
21028 @opindex msim
21029 Specifies that the program will be run on the simulator. This causes
21030 an alternate runtime library to be linked in which supports, for
21031 example, file I/O@. You must not use this option when generating
21032 programs that will run on real hardware; you must provide your own
21033 runtime library for whatever I/O functions are needed.
21034
21035 @item -memregs=@var{number}
21036 @opindex memregs=
21037 Specifies the number of memory-based pseudo-registers GCC uses
21038 during code generation. These pseudo-registers are used like real
21039 registers, so there is a tradeoff between GCC's ability to fit the
21040 code into available registers, and the performance penalty of using
21041 memory instead of registers. Note that all modules in a program must
21042 be compiled with the same value for this option. Because of that, you
21043 must not use this option with GCC's default runtime libraries.
21044
21045 @end table
21046
21047 @node M32R/D Options
21048 @subsection M32R/D Options
21049 @cindex M32R/D options
21050
21051 These @option{-m} options are defined for Renesas M32R/D architectures:
21052
21053 @table @gcctabopt
21054 @item -m32r2
21055 @opindex m32r2
21056 Generate code for the M32R/2@.
21057
21058 @item -m32rx
21059 @opindex m32rx
21060 Generate code for the M32R/X@.
21061
21062 @item -m32r
21063 @opindex m32r
21064 Generate code for the M32R@. This is the default.
21065
21066 @item -mmodel=small
21067 @opindex mmodel=small
21068 Assume all objects live in the lower 16MB of memory (so that their addresses
21069 can be loaded with the @code{ld24} instruction), and assume all subroutines
21070 are reachable with the @code{bl} instruction.
21071 This is the default.
21072
21073 The addressability of a particular object can be set with the
21074 @code{model} attribute.
21075
21076 @item -mmodel=medium
21077 @opindex mmodel=medium
21078 Assume objects may be anywhere in the 32-bit address space (the compiler
21079 generates @code{seth/add3} instructions to load their addresses), and
21080 assume all subroutines are reachable with the @code{bl} instruction.
21081
21082 @item -mmodel=large
21083 @opindex mmodel=large
21084 Assume objects may be anywhere in the 32-bit address space (the compiler
21085 generates @code{seth/add3} instructions to load their addresses), and
21086 assume subroutines may not be reachable with the @code{bl} instruction
21087 (the compiler generates the much slower @code{seth/add3/jl}
21088 instruction sequence).
21089
21090 @item -msdata=none
21091 @opindex msdata=none
21092 Disable use of the small data area. Variables are put into
21093 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
21094 @code{section} attribute has been specified).
21095 This is the default.
21096
21097 The small data area consists of sections @code{.sdata} and @code{.sbss}.
21098 Objects may be explicitly put in the small data area with the
21099 @code{section} attribute using one of these sections.
21100
21101 @item -msdata=sdata
21102 @opindex msdata=sdata
21103 Put small global and static data in the small data area, but do not
21104 generate special code to reference them.
21105
21106 @item -msdata=use
21107 @opindex msdata=use
21108 Put small global and static data in the small data area, and generate
21109 special instructions to reference them.
21110
21111 @item -G @var{num}
21112 @opindex G
21113 @cindex smaller data references
21114 Put global and static objects less than or equal to @var{num} bytes
21115 into the small data or BSS sections instead of the normal data or BSS
21116 sections. The default value of @var{num} is 8.
21117 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
21118 for this option to have any effect.
21119
21120 All modules should be compiled with the same @option{-G @var{num}} value.
21121 Compiling with different values of @var{num} may or may not work; if it
21122 doesn't the linker gives an error message---incorrect code is not
21123 generated.
21124
21125 @item -mdebug
21126 @opindex mdebug
21127 Makes the M32R-specific code in the compiler display some statistics
21128 that might help in debugging programs.
21129
21130 @item -malign-loops
21131 @opindex malign-loops
21132 Align all loops to a 32-byte boundary.
21133
21134 @item -mno-align-loops
21135 @opindex mno-align-loops
21136 Do not enforce a 32-byte alignment for loops. This is the default.
21137
21138 @item -missue-rate=@var{number}
21139 @opindex missue-rate=@var{number}
21140 Issue @var{number} instructions per cycle. @var{number} can only be 1
21141 or 2.
21142
21143 @item -mbranch-cost=@var{number}
21144 @opindex mbranch-cost=@var{number}
21145 @var{number} can only be 1 or 2. If it is 1 then branches are
21146 preferred over conditional code, if it is 2, then the opposite applies.
21147
21148 @item -mflush-trap=@var{number}
21149 @opindex mflush-trap=@var{number}
21150 Specifies the trap number to use to flush the cache. The default is
21151 12. Valid numbers are between 0 and 15 inclusive.
21152
21153 @item -mno-flush-trap
21154 @opindex mno-flush-trap
21155 Specifies that the cache cannot be flushed by using a trap.
21156
21157 @item -mflush-func=@var{name}
21158 @opindex mflush-func=@var{name}
21159 Specifies the name of the operating system function to call to flush
21160 the cache. The default is @samp{_flush_cache}, but a function call
21161 is only used if a trap is not available.
21162
21163 @item -mno-flush-func
21164 @opindex mno-flush-func
21165 Indicates that there is no OS function for flushing the cache.
21166
21167 @end table
21168
21169 @node M680x0 Options
21170 @subsection M680x0 Options
21171 @cindex M680x0 options
21172
21173 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21174 The default settings depend on which architecture was selected when
21175 the compiler was configured; the defaults for the most common choices
21176 are given below.
21177
21178 @table @gcctabopt
21179 @item -march=@var{arch}
21180 @opindex march
21181 Generate code for a specific M680x0 or ColdFire instruction set
21182 architecture. Permissible values of @var{arch} for M680x0
21183 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21184 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21185 architectures are selected according to Freescale's ISA classification
21186 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21187 @samp{isab} and @samp{isac}.
21188
21189 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21190 code for a ColdFire target. The @var{arch} in this macro is one of the
21191 @option{-march} arguments given above.
21192
21193 When used together, @option{-march} and @option{-mtune} select code
21194 that runs on a family of similar processors but that is optimized
21195 for a particular microarchitecture.
21196
21197 @item -mcpu=@var{cpu}
21198 @opindex mcpu
21199 Generate code for a specific M680x0 or ColdFire processor.
21200 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21201 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21202 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21203 below, which also classifies the CPUs into families:
21204
21205 @multitable @columnfractions 0.20 0.80
21206 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21207 @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}
21208 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21209 @item @samp{5206e} @tab @samp{5206e}
21210 @item @samp{5208} @tab @samp{5207} @samp{5208}
21211 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21212 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21213 @item @samp{5216} @tab @samp{5214} @samp{5216}
21214 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21215 @item @samp{5225} @tab @samp{5224} @samp{5225}
21216 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21217 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21218 @item @samp{5249} @tab @samp{5249}
21219 @item @samp{5250} @tab @samp{5250}
21220 @item @samp{5271} @tab @samp{5270} @samp{5271}
21221 @item @samp{5272} @tab @samp{5272}
21222 @item @samp{5275} @tab @samp{5274} @samp{5275}
21223 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21224 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21225 @item @samp{5307} @tab @samp{5307}
21226 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21227 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21228 @item @samp{5407} @tab @samp{5407}
21229 @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}
21230 @end multitable
21231
21232 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21233 @var{arch} is compatible with @var{cpu}. Other combinations of
21234 @option{-mcpu} and @option{-march} are rejected.
21235
21236 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21237 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21238 where the value of @var{family} is given by the table above.
21239
21240 @item -mtune=@var{tune}
21241 @opindex mtune
21242 Tune the code for a particular microarchitecture within the
21243 constraints set by @option{-march} and @option{-mcpu}.
21244 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21245 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21246 and @samp{cpu32}. The ColdFire microarchitectures
21247 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21248
21249 You can also use @option{-mtune=68020-40} for code that needs
21250 to run relatively well on 68020, 68030 and 68040 targets.
21251 @option{-mtune=68020-60} is similar but includes 68060 targets
21252 as well. These two options select the same tuning decisions as
21253 @option{-m68020-40} and @option{-m68020-60} respectively.
21254
21255 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21256 when tuning for 680x0 architecture @var{arch}. It also defines
21257 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21258 option is used. If GCC is tuning for a range of architectures,
21259 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21260 it defines the macros for every architecture in the range.
21261
21262 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21263 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21264 of the arguments given above.
21265
21266 @item -m68000
21267 @itemx -mc68000
21268 @opindex m68000
21269 @opindex mc68000
21270 Generate output for a 68000. This is the default
21271 when the compiler is configured for 68000-based systems.
21272 It is equivalent to @option{-march=68000}.
21273
21274 Use this option for microcontrollers with a 68000 or EC000 core,
21275 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21276
21277 @item -m68010
21278 @opindex m68010
21279 Generate output for a 68010. This is the default
21280 when the compiler is configured for 68010-based systems.
21281 It is equivalent to @option{-march=68010}.
21282
21283 @item -m68020
21284 @itemx -mc68020
21285 @opindex m68020
21286 @opindex mc68020
21287 Generate output for a 68020. This is the default
21288 when the compiler is configured for 68020-based systems.
21289 It is equivalent to @option{-march=68020}.
21290
21291 @item -m68030
21292 @opindex m68030
21293 Generate output for a 68030. This is the default when the compiler is
21294 configured for 68030-based systems. It is equivalent to
21295 @option{-march=68030}.
21296
21297 @item -m68040
21298 @opindex m68040
21299 Generate output for a 68040. This is the default when the compiler is
21300 configured for 68040-based systems. It is equivalent to
21301 @option{-march=68040}.
21302
21303 This option inhibits the use of 68881/68882 instructions that have to be
21304 emulated by software on the 68040. Use this option if your 68040 does not
21305 have code to emulate those instructions.
21306
21307 @item -m68060
21308 @opindex m68060
21309 Generate output for a 68060. This is the default when the compiler is
21310 configured for 68060-based systems. It is equivalent to
21311 @option{-march=68060}.
21312
21313 This option inhibits the use of 68020 and 68881/68882 instructions that
21314 have to be emulated by software on the 68060. Use this option if your 68060
21315 does not have code to emulate those instructions.
21316
21317 @item -mcpu32
21318 @opindex mcpu32
21319 Generate output for a CPU32. This is the default
21320 when the compiler is configured for CPU32-based systems.
21321 It is equivalent to @option{-march=cpu32}.
21322
21323 Use this option for microcontrollers with a
21324 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21325 68336, 68340, 68341, 68349 and 68360.
21326
21327 @item -m5200
21328 @opindex m5200
21329 Generate output for a 520X ColdFire CPU@. This is the default
21330 when the compiler is configured for 520X-based systems.
21331 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21332 in favor of that option.
21333
21334 Use this option for microcontroller with a 5200 core, including
21335 the MCF5202, MCF5203, MCF5204 and MCF5206.
21336
21337 @item -m5206e
21338 @opindex m5206e
21339 Generate output for a 5206e ColdFire CPU@. The option is now
21340 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21341
21342 @item -m528x
21343 @opindex m528x
21344 Generate output for a member of the ColdFire 528X family.
21345 The option is now deprecated in favor of the equivalent
21346 @option{-mcpu=528x}.
21347
21348 @item -m5307
21349 @opindex m5307
21350 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21351 in favor of the equivalent @option{-mcpu=5307}.
21352
21353 @item -m5407
21354 @opindex m5407
21355 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21356 in favor of the equivalent @option{-mcpu=5407}.
21357
21358 @item -mcfv4e
21359 @opindex mcfv4e
21360 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21361 This includes use of hardware floating-point instructions.
21362 The option is equivalent to @option{-mcpu=547x}, and is now
21363 deprecated in favor of that option.
21364
21365 @item -m68020-40
21366 @opindex m68020-40
21367 Generate output for a 68040, without using any of the new instructions.
21368 This results in code that can run relatively efficiently on either a
21369 68020/68881 or a 68030 or a 68040. The generated code does use the
21370 68881 instructions that are emulated on the 68040.
21371
21372 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21373
21374 @item -m68020-60
21375 @opindex m68020-60
21376 Generate output for a 68060, without using any of the new instructions.
21377 This results in code that can run relatively efficiently on either a
21378 68020/68881 or a 68030 or a 68040. The generated code does use the
21379 68881 instructions that are emulated on the 68060.
21380
21381 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21382
21383 @item -mhard-float
21384 @itemx -m68881
21385 @opindex mhard-float
21386 @opindex m68881
21387 Generate floating-point instructions. This is the default for 68020
21388 and above, and for ColdFire devices that have an FPU@. It defines the
21389 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21390 on ColdFire targets.
21391
21392 @item -msoft-float
21393 @opindex msoft-float
21394 Do not generate floating-point instructions; use library calls instead.
21395 This is the default for 68000, 68010, and 68832 targets. It is also
21396 the default for ColdFire devices that have no FPU.
21397
21398 @item -mdiv
21399 @itemx -mno-div
21400 @opindex mdiv
21401 @opindex mno-div
21402 Generate (do not generate) ColdFire hardware divide and remainder
21403 instructions. If @option{-march} is used without @option{-mcpu},
21404 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21405 architectures. Otherwise, the default is taken from the target CPU
21406 (either the default CPU, or the one specified by @option{-mcpu}). For
21407 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21408 @option{-mcpu=5206e}.
21409
21410 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21411
21412 @item -mshort
21413 @opindex mshort
21414 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21415 Additionally, parameters passed on the stack are also aligned to a
21416 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21417
21418 @item -mno-short
21419 @opindex mno-short
21420 Do not consider type @code{int} to be 16 bits wide. This is the default.
21421
21422 @item -mnobitfield
21423 @itemx -mno-bitfield
21424 @opindex mnobitfield
21425 @opindex mno-bitfield
21426 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21427 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21428
21429 @item -mbitfield
21430 @opindex mbitfield
21431 Do use the bit-field instructions. The @option{-m68020} option implies
21432 @option{-mbitfield}. This is the default if you use a configuration
21433 designed for a 68020.
21434
21435 @item -mrtd
21436 @opindex mrtd
21437 Use a different function-calling convention, in which functions
21438 that take a fixed number of arguments return with the @code{rtd}
21439 instruction, which pops their arguments while returning. This
21440 saves one instruction in the caller since there is no need to pop
21441 the arguments there.
21442
21443 This calling convention is incompatible with the one normally
21444 used on Unix, so you cannot use it if you need to call libraries
21445 compiled with the Unix compiler.
21446
21447 Also, you must provide function prototypes for all functions that
21448 take variable numbers of arguments (including @code{printf});
21449 otherwise incorrect code is generated for calls to those
21450 functions.
21451
21452 In addition, seriously incorrect code results if you call a
21453 function with too many arguments. (Normally, extra arguments are
21454 harmlessly ignored.)
21455
21456 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21457 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21458
21459 The default is @option{-mno-rtd}.
21460
21461 @item -malign-int
21462 @itemx -mno-align-int
21463 @opindex malign-int
21464 @opindex mno-align-int
21465 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21466 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21467 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21468 Aligning variables on 32-bit boundaries produces code that runs somewhat
21469 faster on processors with 32-bit busses at the expense of more memory.
21470
21471 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21472 aligns structures containing the above types differently than
21473 most published application binary interface specifications for the m68k.
21474
21475 @item -mpcrel
21476 @opindex mpcrel
21477 Use the pc-relative addressing mode of the 68000 directly, instead of
21478 using a global offset table. At present, this option implies @option{-fpic},
21479 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21480 not presently supported with @option{-mpcrel}, though this could be supported for
21481 68020 and higher processors.
21482
21483 @item -mno-strict-align
21484 @itemx -mstrict-align
21485 @opindex mno-strict-align
21486 @opindex mstrict-align
21487 Do not (do) assume that unaligned memory references are handled by
21488 the system.
21489
21490 @item -msep-data
21491 Generate code that allows the data segment to be located in a different
21492 area of memory from the text segment. This allows for execute-in-place in
21493 an environment without virtual memory management. This option implies
21494 @option{-fPIC}.
21495
21496 @item -mno-sep-data
21497 Generate code that assumes that the data segment follows the text segment.
21498 This is the default.
21499
21500 @item -mid-shared-library
21501 Generate code that supports shared libraries via the library ID method.
21502 This allows for execute-in-place and shared libraries in an environment
21503 without virtual memory management. This option implies @option{-fPIC}.
21504
21505 @item -mno-id-shared-library
21506 Generate code that doesn't assume ID-based shared libraries are being used.
21507 This is the default.
21508
21509 @item -mshared-library-id=n
21510 Specifies the identification number of the ID-based shared library being
21511 compiled. Specifying a value of 0 generates more compact code; specifying
21512 other values forces the allocation of that number to the current
21513 library, but is no more space- or time-efficient than omitting this option.
21514
21515 @item -mxgot
21516 @itemx -mno-xgot
21517 @opindex mxgot
21518 @opindex mno-xgot
21519 When generating position-independent code for ColdFire, generate code
21520 that works if the GOT has more than 8192 entries. This code is
21521 larger and slower than code generated without this option. On M680x0
21522 processors, this option is not needed; @option{-fPIC} suffices.
21523
21524 GCC normally uses a single instruction to load values from the GOT@.
21525 While this is relatively efficient, it only works if the GOT
21526 is smaller than about 64k. Anything larger causes the linker
21527 to report an error such as:
21528
21529 @cindex relocation truncated to fit (ColdFire)
21530 @smallexample
21531 relocation truncated to fit: R_68K_GOT16O foobar
21532 @end smallexample
21533
21534 If this happens, you should recompile your code with @option{-mxgot}.
21535 It should then work with very large GOTs. However, code generated with
21536 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21537 the value of a global symbol.
21538
21539 Note that some linkers, including newer versions of the GNU linker,
21540 can create multiple GOTs and sort GOT entries. If you have such a linker,
21541 you should only need to use @option{-mxgot} when compiling a single
21542 object file that accesses more than 8192 GOT entries. Very few do.
21543
21544 These options have no effect unless GCC is generating
21545 position-independent code.
21546
21547 @item -mlong-jump-table-offsets
21548 @opindex mlong-jump-table-offsets
21549 Use 32-bit offsets in @code{switch} tables. The default is to use
21550 16-bit offsets.
21551
21552 @end table
21553
21554 @node MCore Options
21555 @subsection MCore Options
21556 @cindex MCore options
21557
21558 These are the @samp{-m} options defined for the Motorola M*Core
21559 processors.
21560
21561 @table @gcctabopt
21562
21563 @item -mhardlit
21564 @itemx -mno-hardlit
21565 @opindex mhardlit
21566 @opindex mno-hardlit
21567 Inline constants into the code stream if it can be done in two
21568 instructions or less.
21569
21570 @item -mdiv
21571 @itemx -mno-div
21572 @opindex mdiv
21573 @opindex mno-div
21574 Use the divide instruction. (Enabled by default).
21575
21576 @item -mrelax-immediate
21577 @itemx -mno-relax-immediate
21578 @opindex mrelax-immediate
21579 @opindex mno-relax-immediate
21580 Allow arbitrary-sized immediates in bit operations.
21581
21582 @item -mwide-bitfields
21583 @itemx -mno-wide-bitfields
21584 @opindex mwide-bitfields
21585 @opindex mno-wide-bitfields
21586 Always treat bit-fields as @code{int}-sized.
21587
21588 @item -m4byte-functions
21589 @itemx -mno-4byte-functions
21590 @opindex m4byte-functions
21591 @opindex mno-4byte-functions
21592 Force all functions to be aligned to a 4-byte boundary.
21593
21594 @item -mcallgraph-data
21595 @itemx -mno-callgraph-data
21596 @opindex mcallgraph-data
21597 @opindex mno-callgraph-data
21598 Emit callgraph information.
21599
21600 @item -mslow-bytes
21601 @itemx -mno-slow-bytes
21602 @opindex mslow-bytes
21603 @opindex mno-slow-bytes
21604 Prefer word access when reading byte quantities.
21605
21606 @item -mlittle-endian
21607 @itemx -mbig-endian
21608 @opindex mlittle-endian
21609 @opindex mbig-endian
21610 Generate code for a little-endian target.
21611
21612 @item -m210
21613 @itemx -m340
21614 @opindex m210
21615 @opindex m340
21616 Generate code for the 210 processor.
21617
21618 @item -mno-lsim
21619 @opindex mno-lsim
21620 Assume that runtime support has been provided and so omit the
21621 simulator library (@file{libsim.a)} from the linker command line.
21622
21623 @item -mstack-increment=@var{size}
21624 @opindex mstack-increment
21625 Set the maximum amount for a single stack increment operation. Large
21626 values can increase the speed of programs that contain functions
21627 that need a large amount of stack space, but they can also trigger a
21628 segmentation fault if the stack is extended too much. The default
21629 value is 0x1000.
21630
21631 @end table
21632
21633 @node MeP Options
21634 @subsection MeP Options
21635 @cindex MeP options
21636
21637 @table @gcctabopt
21638
21639 @item -mabsdiff
21640 @opindex mabsdiff
21641 Enables the @code{abs} instruction, which is the absolute difference
21642 between two registers.
21643
21644 @item -mall-opts
21645 @opindex mall-opts
21646 Enables all the optional instructions---average, multiply, divide, bit
21647 operations, leading zero, absolute difference, min/max, clip, and
21648 saturation.
21649
21650
21651 @item -maverage
21652 @opindex maverage
21653 Enables the @code{ave} instruction, which computes the average of two
21654 registers.
21655
21656 @item -mbased=@var{n}
21657 @opindex mbased=
21658 Variables of size @var{n} bytes or smaller are placed in the
21659 @code{.based} section by default. Based variables use the @code{$tp}
21660 register as a base register, and there is a 128-byte limit to the
21661 @code{.based} section.
21662
21663 @item -mbitops
21664 @opindex mbitops
21665 Enables the bit operation instructions---bit test (@code{btstm}), set
21666 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21667 test-and-set (@code{tas}).
21668
21669 @item -mc=@var{name}
21670 @opindex mc=
21671 Selects which section constant data is placed in. @var{name} may
21672 be @samp{tiny}, @samp{near}, or @samp{far}.
21673
21674 @item -mclip
21675 @opindex mclip
21676 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21677 useful unless you also provide @option{-mminmax}.
21678
21679 @item -mconfig=@var{name}
21680 @opindex mconfig=
21681 Selects one of the built-in core configurations. Each MeP chip has
21682 one or more modules in it; each module has a core CPU and a variety of
21683 coprocessors, optional instructions, and peripherals. The
21684 @code{MeP-Integrator} tool, not part of GCC, provides these
21685 configurations through this option; using this option is the same as
21686 using all the corresponding command-line options. The default
21687 configuration is @samp{default}.
21688
21689 @item -mcop
21690 @opindex mcop
21691 Enables the coprocessor instructions. By default, this is a 32-bit
21692 coprocessor. Note that the coprocessor is normally enabled via the
21693 @option{-mconfig=} option.
21694
21695 @item -mcop32
21696 @opindex mcop32
21697 Enables the 32-bit coprocessor's instructions.
21698
21699 @item -mcop64
21700 @opindex mcop64
21701 Enables the 64-bit coprocessor's instructions.
21702
21703 @item -mivc2
21704 @opindex mivc2
21705 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21706
21707 @item -mdc
21708 @opindex mdc
21709 Causes constant variables to be placed in the @code{.near} section.
21710
21711 @item -mdiv
21712 @opindex mdiv
21713 Enables the @code{div} and @code{divu} instructions.
21714
21715 @item -meb
21716 @opindex meb
21717 Generate big-endian code.
21718
21719 @item -mel
21720 @opindex mel
21721 Generate little-endian code.
21722
21723 @item -mio-volatile
21724 @opindex mio-volatile
21725 Tells the compiler that any variable marked with the @code{io}
21726 attribute is to be considered volatile.
21727
21728 @item -ml
21729 @opindex ml
21730 Causes variables to be assigned to the @code{.far} section by default.
21731
21732 @item -mleadz
21733 @opindex mleadz
21734 Enables the @code{leadz} (leading zero) instruction.
21735
21736 @item -mm
21737 @opindex mm
21738 Causes variables to be assigned to the @code{.near} section by default.
21739
21740 @item -mminmax
21741 @opindex mminmax
21742 Enables the @code{min} and @code{max} instructions.
21743
21744 @item -mmult
21745 @opindex mmult
21746 Enables the multiplication and multiply-accumulate instructions.
21747
21748 @item -mno-opts
21749 @opindex mno-opts
21750 Disables all the optional instructions enabled by @option{-mall-opts}.
21751
21752 @item -mrepeat
21753 @opindex mrepeat
21754 Enables the @code{repeat} and @code{erepeat} instructions, used for
21755 low-overhead looping.
21756
21757 @item -ms
21758 @opindex ms
21759 Causes all variables to default to the @code{.tiny} section. Note
21760 that there is a 65536-byte limit to this section. Accesses to these
21761 variables use the @code{%gp} base register.
21762
21763 @item -msatur
21764 @opindex msatur
21765 Enables the saturation instructions. Note that the compiler does not
21766 currently generate these itself, but this option is included for
21767 compatibility with other tools, like @code{as}.
21768
21769 @item -msdram
21770 @opindex msdram
21771 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21772
21773 @item -msim
21774 @opindex msim
21775 Link the simulator run-time libraries.
21776
21777 @item -msimnovec
21778 @opindex msimnovec
21779 Link the simulator runtime libraries, excluding built-in support
21780 for reset and exception vectors and tables.
21781
21782 @item -mtf
21783 @opindex mtf
21784 Causes all functions to default to the @code{.far} section. Without
21785 this option, functions default to the @code{.near} section.
21786
21787 @item -mtiny=@var{n}
21788 @opindex mtiny=
21789 Variables that are @var{n} bytes or smaller are allocated to the
21790 @code{.tiny} section. These variables use the @code{$gp} base
21791 register. The default for this option is 4, but note that there's a
21792 65536-byte limit to the @code{.tiny} section.
21793
21794 @end table
21795
21796 @node MicroBlaze Options
21797 @subsection MicroBlaze Options
21798 @cindex MicroBlaze Options
21799
21800 @table @gcctabopt
21801
21802 @item -msoft-float
21803 @opindex msoft-float
21804 Use software emulation for floating point (default).
21805
21806 @item -mhard-float
21807 @opindex mhard-float
21808 Use hardware floating-point instructions.
21809
21810 @item -mmemcpy
21811 @opindex mmemcpy
21812 Do not optimize block moves, use @code{memcpy}.
21813
21814 @item -mno-clearbss
21815 @opindex mno-clearbss
21816 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21817
21818 @item -mcpu=@var{cpu-type}
21819 @opindex mcpu=
21820 Use features of, and schedule code for, the given CPU.
21821 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21822 where @var{X} is a major version, @var{YY} is the minor version, and
21823 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21824 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21825
21826 @item -mxl-soft-mul
21827 @opindex mxl-soft-mul
21828 Use software multiply emulation (default).
21829
21830 @item -mxl-soft-div
21831 @opindex mxl-soft-div
21832 Use software emulation for divides (default).
21833
21834 @item -mxl-barrel-shift
21835 @opindex mxl-barrel-shift
21836 Use the hardware barrel shifter.
21837
21838 @item -mxl-pattern-compare
21839 @opindex mxl-pattern-compare
21840 Use pattern compare instructions.
21841
21842 @item -msmall-divides
21843 @opindex msmall-divides
21844 Use table lookup optimization for small signed integer divisions.
21845
21846 @item -mxl-stack-check
21847 @opindex mxl-stack-check
21848 This option is deprecated. Use @option{-fstack-check} instead.
21849
21850 @item -mxl-gp-opt
21851 @opindex mxl-gp-opt
21852 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21853
21854 @item -mxl-multiply-high
21855 @opindex mxl-multiply-high
21856 Use multiply high instructions for high part of 32x32 multiply.
21857
21858 @item -mxl-float-convert
21859 @opindex mxl-float-convert
21860 Use hardware floating-point conversion instructions.
21861
21862 @item -mxl-float-sqrt
21863 @opindex mxl-float-sqrt
21864 Use hardware floating-point square root instruction.
21865
21866 @item -mbig-endian
21867 @opindex mbig-endian
21868 Generate code for a big-endian target.
21869
21870 @item -mlittle-endian
21871 @opindex mlittle-endian
21872 Generate code for a little-endian target.
21873
21874 @item -mxl-reorder
21875 @opindex mxl-reorder
21876 Use reorder instructions (swap and byte reversed load/store).
21877
21878 @item -mxl-mode-@var{app-model}
21879 Select application model @var{app-model}. Valid models are
21880 @table @samp
21881 @item executable
21882 normal executable (default), uses startup code @file{crt0.o}.
21883
21884 @item -mpic-data-is-text-relative
21885 @opindex mpic-data-is-text-relative
21886 Assume that the displacement between the text and data segments is fixed
21887 at static link time. This allows data to be referenced by offset from start of
21888 text address instead of GOT since PC-relative addressing is not supported.
21889
21890 @item xmdstub
21891 for use with Xilinx Microprocessor Debugger (XMD) based
21892 software intrusive debug agent called xmdstub. This uses startup file
21893 @file{crt1.o} and sets the start address of the program to 0x800.
21894
21895 @item bootstrap
21896 for applications that are loaded using a bootloader.
21897 This model uses startup file @file{crt2.o} which does not contain a processor
21898 reset vector handler. This is suitable for transferring control on a
21899 processor reset to the bootloader rather than the application.
21900
21901 @item novectors
21902 for applications that do not require any of the
21903 MicroBlaze vectors. This option may be useful for applications running
21904 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21905 @end table
21906
21907 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21908 @option{-mxl-mode-@var{app-model}}.
21909
21910 @end table
21911
21912 @node MIPS Options
21913 @subsection MIPS Options
21914 @cindex MIPS options
21915
21916 @table @gcctabopt
21917
21918 @item -EB
21919 @opindex EB
21920 Generate big-endian code.
21921
21922 @item -EL
21923 @opindex EL
21924 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21925 configurations.
21926
21927 @item -march=@var{arch}
21928 @opindex march
21929 Generate code that runs on @var{arch}, which can be the name of a
21930 generic MIPS ISA, or the name of a particular processor.
21931 The ISA names are:
21932 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21933 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21934 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21935 @samp{mips64r5} and @samp{mips64r6}.
21936 The processor names are:
21937 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21938 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21939 @samp{5kc}, @samp{5kf},
21940 @samp{20kc},
21941 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21942 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21943 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21944 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21945 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21946 @samp{i6400}, @samp{i6500},
21947 @samp{interaptiv},
21948 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21949 @samp{gs464e}, @samp{gs264e},
21950 @samp{m4k},
21951 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21952 @samp{m5100}, @samp{m5101},
21953 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21954 @samp{orion},
21955 @samp{p5600}, @samp{p6600},
21956 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21957 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21958 @samp{r6000}, @samp{r8000},
21959 @samp{rm7000}, @samp{rm9000},
21960 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21961 @samp{sb1},
21962 @samp{sr71000},
21963 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21964 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21965 @samp{xlr} and @samp{xlp}.
21966 The special value @samp{from-abi} selects the
21967 most compatible architecture for the selected ABI (that is,
21968 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21969
21970 The native Linux/GNU toolchain also supports the value @samp{native},
21971 which selects the best architecture option for the host processor.
21972 @option{-march=native} has no effect if GCC does not recognize
21973 the processor.
21974
21975 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21976 (for example, @option{-march=r2k}). Prefixes are optional, and
21977 @samp{vr} may be written @samp{r}.
21978
21979 Names of the form @samp{@var{n}f2_1} refer to processors with
21980 FPUs clocked at half the rate of the core, names of the form
21981 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21982 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21983 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21984 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21985 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21986 accepted as synonyms for @samp{@var{n}f1_1}.
21987
21988 GCC defines two macros based on the value of this option. The first
21989 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21990 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21991 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21992 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21993 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21994
21995 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21996 above. In other words, it has the full prefix and does not
21997 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21998 the macro names the resolved architecture (either @code{"mips1"} or
21999 @code{"mips3"}). It names the default architecture when no
22000 @option{-march} option is given.
22001
22002 @item -mtune=@var{arch}
22003 @opindex mtune
22004 Optimize for @var{arch}. Among other things, this option controls
22005 the way instructions are scheduled, and the perceived cost of arithmetic
22006 operations. The list of @var{arch} values is the same as for
22007 @option{-march}.
22008
22009 When this option is not used, GCC optimizes for the processor
22010 specified by @option{-march}. By using @option{-march} and
22011 @option{-mtune} together, it is possible to generate code that
22012 runs on a family of processors, but optimize the code for one
22013 particular member of that family.
22014
22015 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
22016 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
22017 @option{-march} ones described above.
22018
22019 @item -mips1
22020 @opindex mips1
22021 Equivalent to @option{-march=mips1}.
22022
22023 @item -mips2
22024 @opindex mips2
22025 Equivalent to @option{-march=mips2}.
22026
22027 @item -mips3
22028 @opindex mips3
22029 Equivalent to @option{-march=mips3}.
22030
22031 @item -mips4
22032 @opindex mips4
22033 Equivalent to @option{-march=mips4}.
22034
22035 @item -mips32
22036 @opindex mips32
22037 Equivalent to @option{-march=mips32}.
22038
22039 @item -mips32r3
22040 @opindex mips32r3
22041 Equivalent to @option{-march=mips32r3}.
22042
22043 @item -mips32r5
22044 @opindex mips32r5
22045 Equivalent to @option{-march=mips32r5}.
22046
22047 @item -mips32r6
22048 @opindex mips32r6
22049 Equivalent to @option{-march=mips32r6}.
22050
22051 @item -mips64
22052 @opindex mips64
22053 Equivalent to @option{-march=mips64}.
22054
22055 @item -mips64r2
22056 @opindex mips64r2
22057 Equivalent to @option{-march=mips64r2}.
22058
22059 @item -mips64r3
22060 @opindex mips64r3
22061 Equivalent to @option{-march=mips64r3}.
22062
22063 @item -mips64r5
22064 @opindex mips64r5
22065 Equivalent to @option{-march=mips64r5}.
22066
22067 @item -mips64r6
22068 @opindex mips64r6
22069 Equivalent to @option{-march=mips64r6}.
22070
22071 @item -mips16
22072 @itemx -mno-mips16
22073 @opindex mips16
22074 @opindex mno-mips16
22075 Generate (do not generate) MIPS16 code. If GCC is targeting a
22076 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
22077
22078 MIPS16 code generation can also be controlled on a per-function basis
22079 by means of @code{mips16} and @code{nomips16} attributes.
22080 @xref{Function Attributes}, for more information.
22081
22082 @item -mflip-mips16
22083 @opindex mflip-mips16
22084 Generate MIPS16 code on alternating functions. This option is provided
22085 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
22086 not intended for ordinary use in compiling user code.
22087
22088 @item -minterlink-compressed
22089 @itemx -mno-interlink-compressed
22090 @opindex minterlink-compressed
22091 @opindex mno-interlink-compressed
22092 Require (do not require) that code using the standard (uncompressed) MIPS ISA
22093 be link-compatible with MIPS16 and microMIPS code, and vice versa.
22094
22095 For example, code using the standard ISA encoding cannot jump directly
22096 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
22097 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
22098 knows that the target of the jump is not compressed.
22099
22100 @item -minterlink-mips16
22101 @itemx -mno-interlink-mips16
22102 @opindex minterlink-mips16
22103 @opindex mno-interlink-mips16
22104 Aliases of @option{-minterlink-compressed} and
22105 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
22106 and are retained for backwards compatibility.
22107
22108 @item -mabi=32
22109 @itemx -mabi=o64
22110 @itemx -mabi=n32
22111 @itemx -mabi=64
22112 @itemx -mabi=eabi
22113 @opindex mabi=32
22114 @opindex mabi=o64
22115 @opindex mabi=n32
22116 @opindex mabi=64
22117 @opindex mabi=eabi
22118 Generate code for the given ABI@.
22119
22120 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22121 generates 64-bit code when you select a 64-bit architecture, but you
22122 can use @option{-mgp32} to get 32-bit code instead.
22123
22124 For information about the O64 ABI, see
22125 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22126
22127 GCC supports a variant of the o32 ABI in which floating-point registers
22128 are 64 rather than 32 bits wide. You can select this combination with
22129 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22130 and @code{mfhc1} instructions and is therefore only supported for
22131 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22132
22133 The register assignments for arguments and return values remain the
22134 same, but each scalar value is passed in a single 64-bit register
22135 rather than a pair of 32-bit registers. For example, scalar
22136 floating-point values are returned in @samp{$f0} only, not a
22137 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22138 remains the same in that the even-numbered double-precision registers
22139 are saved.
22140
22141 Two additional variants of the o32 ABI are supported to enable
22142 a transition from 32-bit to 64-bit registers. These are FPXX
22143 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22144 The FPXX extension mandates that all code must execute correctly
22145 when run using 32-bit or 64-bit registers. The code can be interlinked
22146 with either FP32 or FP64, but not both.
22147 The FP64A extension is similar to the FP64 extension but forbids the
22148 use of odd-numbered single-precision registers. This can be used
22149 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22150 processors and allows both FP32 and FP64A code to interlink and
22151 run in the same process without changing FPU modes.
22152
22153 @item -mabicalls
22154 @itemx -mno-abicalls
22155 @opindex mabicalls
22156 @opindex mno-abicalls
22157 Generate (do not generate) code that is suitable for SVR4-style
22158 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22159 systems.
22160
22161 @item -mshared
22162 @itemx -mno-shared
22163 Generate (do not generate) code that is fully position-independent,
22164 and that can therefore be linked into shared libraries. This option
22165 only affects @option{-mabicalls}.
22166
22167 All @option{-mabicalls} code has traditionally been position-independent,
22168 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22169 as an extension, the GNU toolchain allows executables to use absolute
22170 accesses for locally-binding symbols. It can also use shorter GP
22171 initialization sequences and generate direct calls to locally-defined
22172 functions. This mode is selected by @option{-mno-shared}.
22173
22174 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22175 objects that can only be linked by the GNU linker. However, the option
22176 does not affect the ABI of the final executable; it only affects the ABI
22177 of relocatable objects. Using @option{-mno-shared} generally makes
22178 executables both smaller and quicker.
22179
22180 @option{-mshared} is the default.
22181
22182 @item -mplt
22183 @itemx -mno-plt
22184 @opindex mplt
22185 @opindex mno-plt
22186 Assume (do not assume) that the static and dynamic linkers
22187 support PLTs and copy relocations. This option only affects
22188 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22189 has no effect without @option{-msym32}.
22190
22191 You can make @option{-mplt} the default by configuring
22192 GCC with @option{--with-mips-plt}. The default is
22193 @option{-mno-plt} otherwise.
22194
22195 @item -mxgot
22196 @itemx -mno-xgot
22197 @opindex mxgot
22198 @opindex mno-xgot
22199 Lift (do not lift) the usual restrictions on the size of the global
22200 offset table.
22201
22202 GCC normally uses a single instruction to load values from the GOT@.
22203 While this is relatively efficient, it only works if the GOT
22204 is smaller than about 64k. Anything larger causes the linker
22205 to report an error such as:
22206
22207 @cindex relocation truncated to fit (MIPS)
22208 @smallexample
22209 relocation truncated to fit: R_MIPS_GOT16 foobar
22210 @end smallexample
22211
22212 If this happens, you should recompile your code with @option{-mxgot}.
22213 This works with very large GOTs, although the code is also
22214 less efficient, since it takes three instructions to fetch the
22215 value of a global symbol.
22216
22217 Note that some linkers can create multiple GOTs. If you have such a
22218 linker, you should only need to use @option{-mxgot} when a single object
22219 file accesses more than 64k's worth of GOT entries. Very few do.
22220
22221 These options have no effect unless GCC is generating position
22222 independent code.
22223
22224 @item -mgp32
22225 @opindex mgp32
22226 Assume that general-purpose registers are 32 bits wide.
22227
22228 @item -mgp64
22229 @opindex mgp64
22230 Assume that general-purpose registers are 64 bits wide.
22231
22232 @item -mfp32
22233 @opindex mfp32
22234 Assume that floating-point registers are 32 bits wide.
22235
22236 @item -mfp64
22237 @opindex mfp64
22238 Assume that floating-point registers are 64 bits wide.
22239
22240 @item -mfpxx
22241 @opindex mfpxx
22242 Do not assume the width of floating-point registers.
22243
22244 @item -mhard-float
22245 @opindex mhard-float
22246 Use floating-point coprocessor instructions.
22247
22248 @item -msoft-float
22249 @opindex msoft-float
22250 Do not use floating-point coprocessor instructions. Implement
22251 floating-point calculations using library calls instead.
22252
22253 @item -mno-float
22254 @opindex mno-float
22255 Equivalent to @option{-msoft-float}, but additionally asserts that the
22256 program being compiled does not perform any floating-point operations.
22257 This option is presently supported only by some bare-metal MIPS
22258 configurations, where it may select a special set of libraries
22259 that lack all floating-point support (including, for example, the
22260 floating-point @code{printf} formats).
22261 If code compiled with @option{-mno-float} accidentally contains
22262 floating-point operations, it is likely to suffer a link-time
22263 or run-time failure.
22264
22265 @item -msingle-float
22266 @opindex msingle-float
22267 Assume that the floating-point coprocessor only supports single-precision
22268 operations.
22269
22270 @item -mdouble-float
22271 @opindex mdouble-float
22272 Assume that the floating-point coprocessor supports double-precision
22273 operations. This is the default.
22274
22275 @item -modd-spreg
22276 @itemx -mno-odd-spreg
22277 @opindex modd-spreg
22278 @opindex mno-odd-spreg
22279 Enable the use of odd-numbered single-precision floating-point registers
22280 for the o32 ABI. This is the default for processors that are known to
22281 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22282 is set by default.
22283
22284 @item -mabs=2008
22285 @itemx -mabs=legacy
22286 @opindex mabs=2008
22287 @opindex mabs=legacy
22288 These options control the treatment of the special not-a-number (NaN)
22289 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22290 @code{neg.@i{fmt}} machine instructions.
22291
22292 By default or when @option{-mabs=legacy} is used the legacy
22293 treatment is selected. In this case these instructions are considered
22294 arithmetic and avoided where correct operation is required and the
22295 input operand might be a NaN. A longer sequence of instructions that
22296 manipulate the sign bit of floating-point datum manually is used
22297 instead unless the @option{-ffinite-math-only} option has also been
22298 specified.
22299
22300 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22301 this case these instructions are considered non-arithmetic and therefore
22302 operating correctly in all cases, including in particular where the
22303 input operand is a NaN. These instructions are therefore always used
22304 for the respective operations.
22305
22306 @item -mnan=2008
22307 @itemx -mnan=legacy
22308 @opindex mnan=2008
22309 @opindex mnan=legacy
22310 These options control the encoding of the special not-a-number (NaN)
22311 IEEE 754 floating-point data.
22312
22313 The @option{-mnan=legacy} option selects the legacy encoding. In this
22314 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22315 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22316 by the first bit of their trailing significand field being 1.
22317
22318 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22319 this case qNaNs are denoted by the first bit of their trailing
22320 significand field being 1, whereas sNaNs are denoted by the first bit of
22321 their trailing significand field being 0.
22322
22323 The default is @option{-mnan=legacy} unless GCC has been configured with
22324 @option{--with-nan=2008}.
22325
22326 @item -mllsc
22327 @itemx -mno-llsc
22328 @opindex mllsc
22329 @opindex mno-llsc
22330 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22331 implement atomic memory built-in functions. When neither option is
22332 specified, GCC uses the instructions if the target architecture
22333 supports them.
22334
22335 @option{-mllsc} is useful if the runtime environment can emulate the
22336 instructions and @option{-mno-llsc} can be useful when compiling for
22337 nonstandard ISAs. You can make either option the default by
22338 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22339 respectively. @option{--with-llsc} is the default for some
22340 configurations; see the installation documentation for details.
22341
22342 @item -mdsp
22343 @itemx -mno-dsp
22344 @opindex mdsp
22345 @opindex mno-dsp
22346 Use (do not use) revision 1 of the MIPS DSP ASE@.
22347 @xref{MIPS DSP Built-in Functions}. This option defines the
22348 preprocessor macro @code{__mips_dsp}. It also defines
22349 @code{__mips_dsp_rev} to 1.
22350
22351 @item -mdspr2
22352 @itemx -mno-dspr2
22353 @opindex mdspr2
22354 @opindex mno-dspr2
22355 Use (do not use) revision 2 of the MIPS DSP ASE@.
22356 @xref{MIPS DSP Built-in Functions}. This option defines the
22357 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22358 It also defines @code{__mips_dsp_rev} to 2.
22359
22360 @item -msmartmips
22361 @itemx -mno-smartmips
22362 @opindex msmartmips
22363 @opindex mno-smartmips
22364 Use (do not use) the MIPS SmartMIPS ASE.
22365
22366 @item -mpaired-single
22367 @itemx -mno-paired-single
22368 @opindex mpaired-single
22369 @opindex mno-paired-single
22370 Use (do not use) paired-single floating-point instructions.
22371 @xref{MIPS Paired-Single Support}. This option requires
22372 hardware floating-point support to be enabled.
22373
22374 @item -mdmx
22375 @itemx -mno-mdmx
22376 @opindex mdmx
22377 @opindex mno-mdmx
22378 Use (do not use) MIPS Digital Media Extension instructions.
22379 This option can only be used when generating 64-bit code and requires
22380 hardware floating-point support to be enabled.
22381
22382 @item -mips3d
22383 @itemx -mno-mips3d
22384 @opindex mips3d
22385 @opindex mno-mips3d
22386 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22387 The option @option{-mips3d} implies @option{-mpaired-single}.
22388
22389 @item -mmicromips
22390 @itemx -mno-micromips
22391 @opindex mmicromips
22392 @opindex mno-mmicromips
22393 Generate (do not generate) microMIPS code.
22394
22395 MicroMIPS code generation can also be controlled on a per-function basis
22396 by means of @code{micromips} and @code{nomicromips} attributes.
22397 @xref{Function Attributes}, for more information.
22398
22399 @item -mmt
22400 @itemx -mno-mt
22401 @opindex mmt
22402 @opindex mno-mt
22403 Use (do not use) MT Multithreading instructions.
22404
22405 @item -mmcu
22406 @itemx -mno-mcu
22407 @opindex mmcu
22408 @opindex mno-mcu
22409 Use (do not use) the MIPS MCU ASE instructions.
22410
22411 @item -meva
22412 @itemx -mno-eva
22413 @opindex meva
22414 @opindex mno-eva
22415 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22416
22417 @item -mvirt
22418 @itemx -mno-virt
22419 @opindex mvirt
22420 @opindex mno-virt
22421 Use (do not use) the MIPS Virtualization (VZ) instructions.
22422
22423 @item -mxpa
22424 @itemx -mno-xpa
22425 @opindex mxpa
22426 @opindex mno-xpa
22427 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22428
22429 @item -mcrc
22430 @itemx -mno-crc
22431 @opindex mcrc
22432 @opindex mno-crc
22433 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22434
22435 @item -mginv
22436 @itemx -mno-ginv
22437 @opindex mginv
22438 @opindex mno-ginv
22439 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22440
22441 @item -mloongson-mmi
22442 @itemx -mno-loongson-mmi
22443 @opindex mloongson-mmi
22444 @opindex mno-loongson-mmi
22445 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22446
22447 @item -mloongson-ext
22448 @itemx -mno-loongson-ext
22449 @opindex mloongson-ext
22450 @opindex mno-loongson-ext
22451 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22452
22453 @item -mloongson-ext2
22454 @itemx -mno-loongson-ext2
22455 @opindex mloongson-ext2
22456 @opindex mno-loongson-ext2
22457 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22458
22459 @item -mlong64
22460 @opindex mlong64
22461 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22462 an explanation of the default and the way that the pointer size is
22463 determined.
22464
22465 @item -mlong32
22466 @opindex mlong32
22467 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22468
22469 The default size of @code{int}s, @code{long}s and pointers depends on
22470 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22471 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22472 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22473 or the same size as integer registers, whichever is smaller.
22474
22475 @item -msym32
22476 @itemx -mno-sym32
22477 @opindex msym32
22478 @opindex mno-sym32
22479 Assume (do not assume) that all symbols have 32-bit values, regardless
22480 of the selected ABI@. This option is useful in combination with
22481 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22482 to generate shorter and faster references to symbolic addresses.
22483
22484 @item -G @var{num}
22485 @opindex G
22486 Put definitions of externally-visible data in a small data section
22487 if that data is no bigger than @var{num} bytes. GCC can then generate
22488 more efficient accesses to the data; see @option{-mgpopt} for details.
22489
22490 The default @option{-G} option depends on the configuration.
22491
22492 @item -mlocal-sdata
22493 @itemx -mno-local-sdata
22494 @opindex mlocal-sdata
22495 @opindex mno-local-sdata
22496 Extend (do not extend) the @option{-G} behavior to local data too,
22497 such as to static variables in C@. @option{-mlocal-sdata} is the
22498 default for all configurations.
22499
22500 If the linker complains that an application is using too much small data,
22501 you might want to try rebuilding the less performance-critical parts with
22502 @option{-mno-local-sdata}. You might also want to build large
22503 libraries with @option{-mno-local-sdata}, so that the libraries leave
22504 more room for the main program.
22505
22506 @item -mextern-sdata
22507 @itemx -mno-extern-sdata
22508 @opindex mextern-sdata
22509 @opindex mno-extern-sdata
22510 Assume (do not assume) that externally-defined data is in
22511 a small data section if the size of that data is within the @option{-G} limit.
22512 @option{-mextern-sdata} is the default for all configurations.
22513
22514 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22515 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22516 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22517 is placed in a small data section. If @var{Var} is defined by another
22518 module, you must either compile that module with a high-enough
22519 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22520 definition. If @var{Var} is common, you must link the application
22521 with a high-enough @option{-G} setting.
22522
22523 The easiest way of satisfying these restrictions is to compile
22524 and link every module with the same @option{-G} option. However,
22525 you may wish to build a library that supports several different
22526 small data limits. You can do this by compiling the library with
22527 the highest supported @option{-G} setting and additionally using
22528 @option{-mno-extern-sdata} to stop the library from making assumptions
22529 about externally-defined data.
22530
22531 @item -mgpopt
22532 @itemx -mno-gpopt
22533 @opindex mgpopt
22534 @opindex mno-gpopt
22535 Use (do not use) GP-relative accesses for symbols that are known to be
22536 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22537 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22538 configurations.
22539
22540 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22541 might not hold the value of @code{_gp}. For example, if the code is
22542 part of a library that might be used in a boot monitor, programs that
22543 call boot monitor routines pass an unknown value in @code{$gp}.
22544 (In such situations, the boot monitor itself is usually compiled
22545 with @option{-G0}.)
22546
22547 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22548 @option{-mno-extern-sdata}.
22549
22550 @item -membedded-data
22551 @itemx -mno-embedded-data
22552 @opindex membedded-data
22553 @opindex mno-embedded-data
22554 Allocate variables to the read-only data section first if possible, then
22555 next in the small data section if possible, otherwise in data. This gives
22556 slightly slower code than the default, but reduces the amount of RAM required
22557 when executing, and thus may be preferred for some embedded systems.
22558
22559 @item -muninit-const-in-rodata
22560 @itemx -mno-uninit-const-in-rodata
22561 @opindex muninit-const-in-rodata
22562 @opindex mno-uninit-const-in-rodata
22563 Put uninitialized @code{const} variables in the read-only data section.
22564 This option is only meaningful in conjunction with @option{-membedded-data}.
22565
22566 @item -mcode-readable=@var{setting}
22567 @opindex mcode-readable
22568 Specify whether GCC may generate code that reads from executable sections.
22569 There are three possible settings:
22570
22571 @table @gcctabopt
22572 @item -mcode-readable=yes
22573 Instructions may freely access executable sections. This is the
22574 default setting.
22575
22576 @item -mcode-readable=pcrel
22577 MIPS16 PC-relative load instructions can access executable sections,
22578 but other instructions must not do so. This option is useful on 4KSc
22579 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22580 It is also useful on processors that can be configured to have a dual
22581 instruction/data SRAM interface and that, like the M4K, automatically
22582 redirect PC-relative loads to the instruction RAM.
22583
22584 @item -mcode-readable=no
22585 Instructions must not access executable sections. This option can be
22586 useful on targets that are configured to have a dual instruction/data
22587 SRAM interface but that (unlike the M4K) do not automatically redirect
22588 PC-relative loads to the instruction RAM.
22589 @end table
22590
22591 @item -msplit-addresses
22592 @itemx -mno-split-addresses
22593 @opindex msplit-addresses
22594 @opindex mno-split-addresses
22595 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22596 relocation operators. This option has been superseded by
22597 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22598
22599 @item -mexplicit-relocs
22600 @itemx -mno-explicit-relocs
22601 @opindex mexplicit-relocs
22602 @opindex mno-explicit-relocs
22603 Use (do not use) assembler relocation operators when dealing with symbolic
22604 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22605 is to use assembler macros instead.
22606
22607 @option{-mexplicit-relocs} is the default if GCC was configured
22608 to use an assembler that supports relocation operators.
22609
22610 @item -mcheck-zero-division
22611 @itemx -mno-check-zero-division
22612 @opindex mcheck-zero-division
22613 @opindex mno-check-zero-division
22614 Trap (do not trap) on integer division by zero.
22615
22616 The default is @option{-mcheck-zero-division}.
22617
22618 @item -mdivide-traps
22619 @itemx -mdivide-breaks
22620 @opindex mdivide-traps
22621 @opindex mdivide-breaks
22622 MIPS systems check for division by zero by generating either a
22623 conditional trap or a break instruction. Using traps results in
22624 smaller code, but is only supported on MIPS II and later. Also, some
22625 versions of the Linux kernel have a bug that prevents trap from
22626 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22627 allow conditional traps on architectures that support them and
22628 @option{-mdivide-breaks} to force the use of breaks.
22629
22630 The default is usually @option{-mdivide-traps}, but this can be
22631 overridden at configure time using @option{--with-divide=breaks}.
22632 Divide-by-zero checks can be completely disabled using
22633 @option{-mno-check-zero-division}.
22634
22635 @item -mload-store-pairs
22636 @itemx -mno-load-store-pairs
22637 @opindex mload-store-pairs
22638 @opindex mno-load-store-pairs
22639 Enable (disable) an optimization that pairs consecutive load or store
22640 instructions to enable load/store bonding. This option is enabled by
22641 default but only takes effect when the selected architecture is known
22642 to support bonding.
22643
22644 @item -mmemcpy
22645 @itemx -mno-memcpy
22646 @opindex mmemcpy
22647 @opindex mno-memcpy
22648 Force (do not force) the use of @code{memcpy} for non-trivial block
22649 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22650 most constant-sized copies.
22651
22652 @item -mlong-calls
22653 @itemx -mno-long-calls
22654 @opindex mlong-calls
22655 @opindex mno-long-calls
22656 Disable (do not disable) use of the @code{jal} instruction. Calling
22657 functions using @code{jal} is more efficient but requires the caller
22658 and callee to be in the same 256 megabyte segment.
22659
22660 This option has no effect on abicalls code. The default is
22661 @option{-mno-long-calls}.
22662
22663 @item -mmad
22664 @itemx -mno-mad
22665 @opindex mmad
22666 @opindex mno-mad
22667 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22668 instructions, as provided by the R4650 ISA@.
22669
22670 @item -mimadd
22671 @itemx -mno-imadd
22672 @opindex mimadd
22673 @opindex mno-imadd
22674 Enable (disable) use of the @code{madd} and @code{msub} integer
22675 instructions. The default is @option{-mimadd} on architectures
22676 that support @code{madd} and @code{msub} except for the 74k
22677 architecture where it was found to generate slower code.
22678
22679 @item -mfused-madd
22680 @itemx -mno-fused-madd
22681 @opindex mfused-madd
22682 @opindex mno-fused-madd
22683 Enable (disable) use of the floating-point multiply-accumulate
22684 instructions, when they are available. The default is
22685 @option{-mfused-madd}.
22686
22687 On the R8000 CPU when multiply-accumulate instructions are used,
22688 the intermediate product is calculated to infinite precision
22689 and is not subject to the FCSR Flush to Zero bit. This may be
22690 undesirable in some circumstances. On other processors the result
22691 is numerically identical to the equivalent computation using
22692 separate multiply, add, subtract and negate instructions.
22693
22694 @item -nocpp
22695 @opindex nocpp
22696 Tell the MIPS assembler to not run its preprocessor over user
22697 assembler files (with a @samp{.s} suffix) when assembling them.
22698
22699 @item -mfix-24k
22700 @itemx -mno-fix-24k
22701 @opindex mfix-24k
22702 @opindex mno-fix-24k
22703 Work around the 24K E48 (lost data on stores during refill) errata.
22704 The workarounds are implemented by the assembler rather than by GCC@.
22705
22706 @item -mfix-r4000
22707 @itemx -mno-fix-r4000
22708 @opindex mfix-r4000
22709 @opindex mno-fix-r4000
22710 Work around certain R4000 CPU errata:
22711 @itemize @minus
22712 @item
22713 A double-word or a variable shift may give an incorrect result if executed
22714 immediately after starting an integer division.
22715 @item
22716 A double-word or a variable shift may give an incorrect result if executed
22717 while an integer multiplication is in progress.
22718 @item
22719 An integer division may give an incorrect result if started in a delay slot
22720 of a taken branch or a jump.
22721 @end itemize
22722
22723 @item -mfix-r4400
22724 @itemx -mno-fix-r4400
22725 @opindex mfix-r4400
22726 @opindex mno-fix-r4400
22727 Work around certain R4400 CPU errata:
22728 @itemize @minus
22729 @item
22730 A double-word or a variable shift may give an incorrect result if executed
22731 immediately after starting an integer division.
22732 @end itemize
22733
22734 @item -mfix-r10000
22735 @itemx -mno-fix-r10000
22736 @opindex mfix-r10000
22737 @opindex mno-fix-r10000
22738 Work around certain R10000 errata:
22739 @itemize @minus
22740 @item
22741 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22742 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22743 @end itemize
22744
22745 This option can only be used if the target architecture supports
22746 branch-likely instructions. @option{-mfix-r10000} is the default when
22747 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22748 otherwise.
22749
22750 @item -mfix-r5900
22751 @itemx -mno-fix-r5900
22752 @opindex mfix-r5900
22753 Do not attempt to schedule the preceding instruction into the delay slot
22754 of a branch instruction placed at the end of a short loop of six
22755 instructions or fewer and always schedule a @code{nop} instruction there
22756 instead. The short loop bug under certain conditions causes loops to
22757 execute only once or twice, due to a hardware bug in the R5900 chip. The
22758 workaround is implemented by the assembler rather than by GCC@.
22759
22760 @item -mfix-rm7000
22761 @itemx -mno-fix-rm7000
22762 @opindex mfix-rm7000
22763 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22764 workarounds are implemented by the assembler rather than by GCC@.
22765
22766 @item -mfix-vr4120
22767 @itemx -mno-fix-vr4120
22768 @opindex mfix-vr4120
22769 Work around certain VR4120 errata:
22770 @itemize @minus
22771 @item
22772 @code{dmultu} does not always produce the correct result.
22773 @item
22774 @code{div} and @code{ddiv} do not always produce the correct result if one
22775 of the operands is negative.
22776 @end itemize
22777 The workarounds for the division errata rely on special functions in
22778 @file{libgcc.a}. At present, these functions are only provided by
22779 the @code{mips64vr*-elf} configurations.
22780
22781 Other VR4120 errata require a NOP to be inserted between certain pairs of
22782 instructions. These errata are handled by the assembler, not by GCC itself.
22783
22784 @item -mfix-vr4130
22785 @opindex mfix-vr4130
22786 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22787 workarounds are implemented by the assembler rather than by GCC,
22788 although GCC avoids using @code{mflo} and @code{mfhi} if the
22789 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22790 instructions are available instead.
22791
22792 @item -mfix-sb1
22793 @itemx -mno-fix-sb1
22794 @opindex mfix-sb1
22795 Work around certain SB-1 CPU core errata.
22796 (This flag currently works around the SB-1 revision 2
22797 ``F1'' and ``F2'' floating-point errata.)
22798
22799 @item -mr10k-cache-barrier=@var{setting}
22800 @opindex mr10k-cache-barrier
22801 Specify whether GCC should insert cache barriers to avoid the
22802 side effects of speculation on R10K processors.
22803
22804 In common with many processors, the R10K tries to predict the outcome
22805 of a conditional branch and speculatively executes instructions from
22806 the ``taken'' branch. It later aborts these instructions if the
22807 predicted outcome is wrong. However, on the R10K, even aborted
22808 instructions can have side effects.
22809
22810 This problem only affects kernel stores and, depending on the system,
22811 kernel loads. As an example, a speculatively-executed store may load
22812 the target memory into cache and mark the cache line as dirty, even if
22813 the store itself is later aborted. If a DMA operation writes to the
22814 same area of memory before the ``dirty'' line is flushed, the cached
22815 data overwrites the DMA-ed data. See the R10K processor manual
22816 for a full description, including other potential problems.
22817
22818 One workaround is to insert cache barrier instructions before every memory
22819 access that might be speculatively executed and that might have side
22820 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22821 controls GCC's implementation of this workaround. It assumes that
22822 aborted accesses to any byte in the following regions does not have
22823 side effects:
22824
22825 @enumerate
22826 @item
22827 the memory occupied by the current function's stack frame;
22828
22829 @item
22830 the memory occupied by an incoming stack argument;
22831
22832 @item
22833 the memory occupied by an object with a link-time-constant address.
22834 @end enumerate
22835
22836 It is the kernel's responsibility to ensure that speculative
22837 accesses to these regions are indeed safe.
22838
22839 If the input program contains a function declaration such as:
22840
22841 @smallexample
22842 void foo (void);
22843 @end smallexample
22844
22845 then the implementation of @code{foo} must allow @code{j foo} and
22846 @code{jal foo} to be executed speculatively. GCC honors this
22847 restriction for functions it compiles itself. It expects non-GCC
22848 functions (such as hand-written assembly code) to do the same.
22849
22850 The option has three forms:
22851
22852 @table @gcctabopt
22853 @item -mr10k-cache-barrier=load-store
22854 Insert a cache barrier before a load or store that might be
22855 speculatively executed and that might have side effects even
22856 if aborted.
22857
22858 @item -mr10k-cache-barrier=store
22859 Insert a cache barrier before a store that might be speculatively
22860 executed and that might have side effects even if aborted.
22861
22862 @item -mr10k-cache-barrier=none
22863 Disable the insertion of cache barriers. This is the default setting.
22864 @end table
22865
22866 @item -mflush-func=@var{func}
22867 @itemx -mno-flush-func
22868 @opindex mflush-func
22869 Specifies the function to call to flush the I and D caches, or to not
22870 call any such function. If called, the function must take the same
22871 arguments as the common @code{_flush_func}, that is, the address of the
22872 memory range for which the cache is being flushed, the size of the
22873 memory range, and the number 3 (to flush both caches). The default
22874 depends on the target GCC was configured for, but commonly is either
22875 @code{_flush_func} or @code{__cpu_flush}.
22876
22877 @item mbranch-cost=@var{num}
22878 @opindex mbranch-cost
22879 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22880 This cost is only a heuristic and is not guaranteed to produce
22881 consistent results across releases. A zero cost redundantly selects
22882 the default, which is based on the @option{-mtune} setting.
22883
22884 @item -mbranch-likely
22885 @itemx -mno-branch-likely
22886 @opindex mbranch-likely
22887 @opindex mno-branch-likely
22888 Enable or disable use of Branch Likely instructions, regardless of the
22889 default for the selected architecture. By default, Branch Likely
22890 instructions may be generated if they are supported by the selected
22891 architecture. An exception is for the MIPS32 and MIPS64 architectures
22892 and processors that implement those architectures; for those, Branch
22893 Likely instructions are not be generated by default because the MIPS32
22894 and MIPS64 architectures specifically deprecate their use.
22895
22896 @item -mcompact-branches=never
22897 @itemx -mcompact-branches=optimal
22898 @itemx -mcompact-branches=always
22899 @opindex mcompact-branches=never
22900 @opindex mcompact-branches=optimal
22901 @opindex mcompact-branches=always
22902 These options control which form of branches will be generated. The
22903 default is @option{-mcompact-branches=optimal}.
22904
22905 The @option{-mcompact-branches=never} option ensures that compact branch
22906 instructions will never be generated.
22907
22908 The @option{-mcompact-branches=always} option ensures that a compact
22909 branch instruction will be generated if available. If a compact branch
22910 instruction is not available, a delay slot form of the branch will be
22911 used instead.
22912
22913 This option is supported from MIPS Release 6 onwards.
22914
22915 The @option{-mcompact-branches=optimal} option will cause a delay slot
22916 branch to be used if one is available in the current ISA and the delay
22917 slot is successfully filled. If the delay slot is not filled, a compact
22918 branch will be chosen if one is available.
22919
22920 @item -mfp-exceptions
22921 @itemx -mno-fp-exceptions
22922 @opindex mfp-exceptions
22923 Specifies whether FP exceptions are enabled. This affects how
22924 FP instructions are scheduled for some processors.
22925 The default is that FP exceptions are
22926 enabled.
22927
22928 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22929 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22930 FP pipe.
22931
22932 @item -mvr4130-align
22933 @itemx -mno-vr4130-align
22934 @opindex mvr4130-align
22935 The VR4130 pipeline is two-way superscalar, but can only issue two
22936 instructions together if the first one is 8-byte aligned. When this
22937 option is enabled, GCC aligns pairs of instructions that it
22938 thinks should execute in parallel.
22939
22940 This option only has an effect when optimizing for the VR4130.
22941 It normally makes code faster, but at the expense of making it bigger.
22942 It is enabled by default at optimization level @option{-O3}.
22943
22944 @item -msynci
22945 @itemx -mno-synci
22946 @opindex msynci
22947 Enable (disable) generation of @code{synci} instructions on
22948 architectures that support it. The @code{synci} instructions (if
22949 enabled) are generated when @code{__builtin___clear_cache} is
22950 compiled.
22951
22952 This option defaults to @option{-mno-synci}, but the default can be
22953 overridden by configuring GCC with @option{--with-synci}.
22954
22955 When compiling code for single processor systems, it is generally safe
22956 to use @code{synci}. However, on many multi-core (SMP) systems, it
22957 does not invalidate the instruction caches on all cores and may lead
22958 to undefined behavior.
22959
22960 @item -mrelax-pic-calls
22961 @itemx -mno-relax-pic-calls
22962 @opindex mrelax-pic-calls
22963 Try to turn PIC calls that are normally dispatched via register
22964 @code{$25} into direct calls. This is only possible if the linker can
22965 resolve the destination at link time and if the destination is within
22966 range for a direct call.
22967
22968 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22969 an assembler and a linker that support the @code{.reloc} assembly
22970 directive and @option{-mexplicit-relocs} is in effect. With
22971 @option{-mno-explicit-relocs}, this optimization can be performed by the
22972 assembler and the linker alone without help from the compiler.
22973
22974 @item -mmcount-ra-address
22975 @itemx -mno-mcount-ra-address
22976 @opindex mmcount-ra-address
22977 @opindex mno-mcount-ra-address
22978 Emit (do not emit) code that allows @code{_mcount} to modify the
22979 calling function's return address. When enabled, this option extends
22980 the usual @code{_mcount} interface with a new @var{ra-address}
22981 parameter, which has type @code{intptr_t *} and is passed in register
22982 @code{$12}. @code{_mcount} can then modify the return address by
22983 doing both of the following:
22984 @itemize
22985 @item
22986 Returning the new address in register @code{$31}.
22987 @item
22988 Storing the new address in @code{*@var{ra-address}},
22989 if @var{ra-address} is nonnull.
22990 @end itemize
22991
22992 The default is @option{-mno-mcount-ra-address}.
22993
22994 @item -mframe-header-opt
22995 @itemx -mno-frame-header-opt
22996 @opindex mframe-header-opt
22997 Enable (disable) frame header optimization in the o32 ABI. When using the
22998 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22999 function to write out register arguments. When enabled, this optimization
23000 will suppress the allocation of the frame header if it can be determined that
23001 it is unused.
23002
23003 This optimization is off by default at all optimization levels.
23004
23005 @item -mlxc1-sxc1
23006 @itemx -mno-lxc1-sxc1
23007 @opindex mlxc1-sxc1
23008 When applicable, enable (disable) the generation of @code{lwxc1},
23009 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
23010
23011 @item -mmadd4
23012 @itemx -mno-madd4
23013 @opindex mmadd4
23014 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
23015 @code{madd.d} and related instructions. Enabled by default.
23016
23017 @end table
23018
23019 @node MMIX Options
23020 @subsection MMIX Options
23021 @cindex MMIX Options
23022
23023 These options are defined for the MMIX:
23024
23025 @table @gcctabopt
23026 @item -mlibfuncs
23027 @itemx -mno-libfuncs
23028 @opindex mlibfuncs
23029 @opindex mno-libfuncs
23030 Specify that intrinsic library functions are being compiled, passing all
23031 values in registers, no matter the size.
23032
23033 @item -mepsilon
23034 @itemx -mno-epsilon
23035 @opindex mepsilon
23036 @opindex mno-epsilon
23037 Generate floating-point comparison instructions that compare with respect
23038 to the @code{rE} epsilon register.
23039
23040 @item -mabi=mmixware
23041 @itemx -mabi=gnu
23042 @opindex mabi=mmixware
23043 @opindex mabi=gnu
23044 Generate code that passes function parameters and return values that (in
23045 the called function) are seen as registers @code{$0} and up, as opposed to
23046 the GNU ABI which uses global registers @code{$231} and up.
23047
23048 @item -mzero-extend
23049 @itemx -mno-zero-extend
23050 @opindex mzero-extend
23051 @opindex mno-zero-extend
23052 When reading data from memory in sizes shorter than 64 bits, use (do not
23053 use) zero-extending load instructions by default, rather than
23054 sign-extending ones.
23055
23056 @item -mknuthdiv
23057 @itemx -mno-knuthdiv
23058 @opindex mknuthdiv
23059 @opindex mno-knuthdiv
23060 Make the result of a division yielding a remainder have the same sign as
23061 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
23062 remainder follows the sign of the dividend. Both methods are
23063 arithmetically valid, the latter being almost exclusively used.
23064
23065 @item -mtoplevel-symbols
23066 @itemx -mno-toplevel-symbols
23067 @opindex mtoplevel-symbols
23068 @opindex mno-toplevel-symbols
23069 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
23070 code can be used with the @code{PREFIX} assembly directive.
23071
23072 @item -melf
23073 @opindex melf
23074 Generate an executable in the ELF format, rather than the default
23075 @samp{mmo} format used by the @command{mmix} simulator.
23076
23077 @item -mbranch-predict
23078 @itemx -mno-branch-predict
23079 @opindex mbranch-predict
23080 @opindex mno-branch-predict
23081 Use (do not use) the probable-branch instructions, when static branch
23082 prediction indicates a probable branch.
23083
23084 @item -mbase-addresses
23085 @itemx -mno-base-addresses
23086 @opindex mbase-addresses
23087 @opindex mno-base-addresses
23088 Generate (do not generate) code that uses @emph{base addresses}. Using a
23089 base address automatically generates a request (handled by the assembler
23090 and the linker) for a constant to be set up in a global register. The
23091 register is used for one or more base address requests within the range 0
23092 to 255 from the value held in the register. The generally leads to short
23093 and fast code, but the number of different data items that can be
23094 addressed is limited. This means that a program that uses lots of static
23095 data may require @option{-mno-base-addresses}.
23096
23097 @item -msingle-exit
23098 @itemx -mno-single-exit
23099 @opindex msingle-exit
23100 @opindex mno-single-exit
23101 Force (do not force) generated code to have a single exit point in each
23102 function.
23103 @end table
23104
23105 @node MN10300 Options
23106 @subsection MN10300 Options
23107 @cindex MN10300 options
23108
23109 These @option{-m} options are defined for Matsushita MN10300 architectures:
23110
23111 @table @gcctabopt
23112 @item -mmult-bug
23113 @opindex mmult-bug
23114 Generate code to avoid bugs in the multiply instructions for the MN10300
23115 processors. This is the default.
23116
23117 @item -mno-mult-bug
23118 @opindex mno-mult-bug
23119 Do not generate code to avoid bugs in the multiply instructions for the
23120 MN10300 processors.
23121
23122 @item -mam33
23123 @opindex mam33
23124 Generate code using features specific to the AM33 processor.
23125
23126 @item -mno-am33
23127 @opindex mno-am33
23128 Do not generate code using features specific to the AM33 processor. This
23129 is the default.
23130
23131 @item -mam33-2
23132 @opindex mam33-2
23133 Generate code using features specific to the AM33/2.0 processor.
23134
23135 @item -mam34
23136 @opindex mam34
23137 Generate code using features specific to the AM34 processor.
23138
23139 @item -mtune=@var{cpu-type}
23140 @opindex mtune
23141 Use the timing characteristics of the indicated CPU type when
23142 scheduling instructions. This does not change the targeted processor
23143 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23144 @samp{am33-2} or @samp{am34}.
23145
23146 @item -mreturn-pointer-on-d0
23147 @opindex mreturn-pointer-on-d0
23148 When generating a function that returns a pointer, return the pointer
23149 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23150 only in @code{a0}, and attempts to call such functions without a prototype
23151 result in errors. Note that this option is on by default; use
23152 @option{-mno-return-pointer-on-d0} to disable it.
23153
23154 @item -mno-crt0
23155 @opindex mno-crt0
23156 Do not link in the C run-time initialization object file.
23157
23158 @item -mrelax
23159 @opindex mrelax
23160 Indicate to the linker that it should perform a relaxation optimization pass
23161 to shorten branches, calls and absolute memory addresses. This option only
23162 has an effect when used on the command line for the final link step.
23163
23164 This option makes symbolic debugging impossible.
23165
23166 @item -mliw
23167 @opindex mliw
23168 Allow the compiler to generate @emph{Long Instruction Word}
23169 instructions if the target is the @samp{AM33} or later. This is the
23170 default. This option defines the preprocessor macro @code{__LIW__}.
23171
23172 @item -mno-liw
23173 @opindex mno-liw
23174 Do not allow the compiler to generate @emph{Long Instruction Word}
23175 instructions. This option defines the preprocessor macro
23176 @code{__NO_LIW__}.
23177
23178 @item -msetlb
23179 @opindex msetlb
23180 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23181 instructions if the target is the @samp{AM33} or later. This is the
23182 default. This option defines the preprocessor macro @code{__SETLB__}.
23183
23184 @item -mno-setlb
23185 @opindex mno-setlb
23186 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23187 instructions. This option defines the preprocessor macro
23188 @code{__NO_SETLB__}.
23189
23190 @end table
23191
23192 @node Moxie Options
23193 @subsection Moxie Options
23194 @cindex Moxie Options
23195
23196 @table @gcctabopt
23197
23198 @item -meb
23199 @opindex meb
23200 Generate big-endian code. This is the default for @samp{moxie-*-*}
23201 configurations.
23202
23203 @item -mel
23204 @opindex mel
23205 Generate little-endian code.
23206
23207 @item -mmul.x
23208 @opindex mmul.x
23209 Generate mul.x and umul.x instructions. This is the default for
23210 @samp{moxiebox-*-*} configurations.
23211
23212 @item -mno-crt0
23213 @opindex mno-crt0
23214 Do not link in the C run-time initialization object file.
23215
23216 @end table
23217
23218 @node MSP430 Options
23219 @subsection MSP430 Options
23220 @cindex MSP430 Options
23221
23222 These options are defined for the MSP430:
23223
23224 @table @gcctabopt
23225
23226 @item -masm-hex
23227 @opindex masm-hex
23228 Force assembly output to always use hex constants. Normally such
23229 constants are signed decimals, but this option is available for
23230 testsuite and/or aesthetic purposes.
23231
23232 @item -mmcu=
23233 @opindex mmcu=
23234 Select the MCU to target. This is used to create a C preprocessor
23235 symbol based upon the MCU name, converted to upper case and pre- and
23236 post-fixed with @samp{__}. This in turn is used by the
23237 @file{msp430.h} header file to select an MCU-specific supplementary
23238 header file.
23239
23240 The option also sets the ISA to use. If the MCU name is one that is
23241 known to only support the 430 ISA then that is selected, otherwise the
23242 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23243 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23244 name selects the 430X ISA.
23245
23246 In addition an MCU-specific linker script is added to the linker
23247 command line. The script's name is the name of the MCU with
23248 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23249 command line defines the C preprocessor symbol @code{__XXX__} and
23250 cause the linker to search for a script called @file{xxx.ld}.
23251
23252 The ISA and hardware multiply supported for the different MCUs is hard-coded
23253 into GCC. However, an external @samp{devices.csv} file can be used to
23254 extend device support beyond those that have been hard-coded.
23255
23256 GCC searches for the @samp{devices.csv} file using the following methods in the
23257 given precedence order, where the first method takes precendence over the
23258 second which takes precedence over the third.
23259
23260 @table @asis
23261 @item Include path specified with @code{-I} and @code{-L}
23262 @samp{devices.csv} will be searched for in each of the directories specified by
23263 include paths and linker library search paths.
23264 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
23265 Define the value of the global environment variable
23266 @samp{MSP430_GCC_INCLUDE_DIR}
23267 to the full path to the directory containing devices.csv, and GCC will search
23268 this directory for devices.csv. If devices.csv is found, this directory will
23269 also be registered as an include path, and linker library path. Header files
23270 and linker scripts in this directory can therefore be used without manually
23271 specifying @code{-I} and @code{-L} on the command line.
23272 @item The @samp{msp430-elf/include/devices} directory
23273 Finally, GCC will examine @samp{msp430-elf/include/devices} from the
23274 toolchain root directory. This directory does not exist in a default
23275 installation, but if the user has created it and copied @samp{devices.csv}
23276 there, then the MCU data will be read. As above, this directory will
23277 also be registered as an include path, and linker library path.
23278
23279 @end table
23280 If none of the above search methods find @samp{devices.csv}, then the
23281 hard-coded MCU data is used.
23282
23283
23284 @item -mwarn-mcu
23285 @itemx -mno-warn-mcu
23286 @opindex mwarn-mcu
23287 @opindex mno-warn-mcu
23288 This option enables or disables warnings about conflicts between the
23289 MCU name specified by the @option{-mmcu} option and the ISA set by the
23290 @option{-mcpu} option and/or the hardware multiply support set by the
23291 @option{-mhwmult} option. It also toggles warnings about unrecognized
23292 MCU names. This option is on by default.
23293
23294 @item -mcpu=
23295 @opindex mcpu=
23296 Specifies the ISA to use. Accepted values are @samp{msp430},
23297 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23298 @option{-mmcu=} option should be used to select the ISA.
23299
23300 @item -msim
23301 @opindex msim
23302 Link to the simulator runtime libraries and linker script. Overrides
23303 any scripts that would be selected by the @option{-mmcu=} option.
23304
23305 @item -mlarge
23306 @opindex mlarge
23307 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23308
23309 @item -msmall
23310 @opindex msmall
23311 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23312
23313 @item -mrelax
23314 @opindex mrelax
23315 This option is passed to the assembler and linker, and allows the
23316 linker to perform certain optimizations that cannot be done until
23317 the final link.
23318
23319 @item mhwmult=
23320 @opindex mhwmult=
23321 Describes the type of hardware multiply supported by the target.
23322 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23323 for the original 16-bit-only multiply supported by early MCUs.
23324 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23325 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23326 A value of @samp{auto} can also be given. This tells GCC to deduce
23327 the hardware multiply support based upon the MCU name provided by the
23328 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23329 the MCU name is not recognized then no hardware multiply support is
23330 assumed. @code{auto} is the default setting.
23331
23332 Hardware multiplies are normally performed by calling a library
23333 routine. This saves space in the generated code. When compiling at
23334 @option{-O3} or higher however the hardware multiplier is invoked
23335 inline. This makes for bigger, but faster code.
23336
23337 The hardware multiply routines disable interrupts whilst running and
23338 restore the previous interrupt state when they finish. This makes
23339 them safe to use inside interrupt handlers as well as in normal code.
23340
23341 @item -minrt
23342 @opindex minrt
23343 Enable the use of a minimum runtime environment - no static
23344 initializers or constructors. This is intended for memory-constrained
23345 devices. The compiler includes special symbols in some objects
23346 that tell the linker and runtime which code fragments are required.
23347
23348 @item -mtiny-printf
23349 @opindex mtiny-printf
23350 Enable reduced code size @code{printf} and @code{puts} library functions.
23351 The @samp{tiny} implementations of these functions are not reentrant, so
23352 must be used with caution in multi-threaded applications.
23353
23354 Support for streams has been removed and the string to be printed will
23355 always be sent to stdout via the @code{write} syscall. The string is not
23356 buffered before it is sent to write.
23357
23358 This option requires Newlib Nano IO, so GCC must be configured with
23359 @samp{--enable-newlib-nano-formatted-io}.
23360
23361 @item -mcode-region=
23362 @itemx -mdata-region=
23363 @opindex mcode-region
23364 @opindex mdata-region
23365 These options tell the compiler where to place functions and data that
23366 do not have one of the @code{lower}, @code{upper}, @code{either} or
23367 @code{section} attributes. Possible values are @code{lower},
23368 @code{upper}, @code{either} or @code{any}. The first three behave
23369 like the corresponding attribute. The fourth possible value -
23370 @code{any} - is the default. It leaves placement entirely up to the
23371 linker script and how it assigns the standard sections
23372 (@code{.text}, @code{.data}, etc) to the memory regions.
23373
23374 @item -msilicon-errata=
23375 @opindex msilicon-errata
23376 This option passes on a request to assembler to enable the fixes for
23377 the named silicon errata.
23378
23379 @item -msilicon-errata-warn=
23380 @opindex msilicon-errata-warn
23381 This option passes on a request to the assembler to enable warning
23382 messages when a silicon errata might need to be applied.
23383
23384 @item -mwarn-devices-csv
23385 @itemx -mno-warn-devices-csv
23386 @opindex mwarn-devices-csv
23387 @opindex mno-warn-devices-csv
23388 Warn if @samp{devices.csv} is not found or there are problem parsing it
23389 (default: on).
23390
23391 @end table
23392
23393 @node NDS32 Options
23394 @subsection NDS32 Options
23395 @cindex NDS32 Options
23396
23397 These options are defined for NDS32 implementations:
23398
23399 @table @gcctabopt
23400
23401 @item -mbig-endian
23402 @opindex mbig-endian
23403 Generate code in big-endian mode.
23404
23405 @item -mlittle-endian
23406 @opindex mlittle-endian
23407 Generate code in little-endian mode.
23408
23409 @item -mreduced-regs
23410 @opindex mreduced-regs
23411 Use reduced-set registers for register allocation.
23412
23413 @item -mfull-regs
23414 @opindex mfull-regs
23415 Use full-set registers for register allocation.
23416
23417 @item -mcmov
23418 @opindex mcmov
23419 Generate conditional move instructions.
23420
23421 @item -mno-cmov
23422 @opindex mno-cmov
23423 Do not generate conditional move instructions.
23424
23425 @item -mext-perf
23426 @opindex mext-perf
23427 Generate performance extension instructions.
23428
23429 @item -mno-ext-perf
23430 @opindex mno-ext-perf
23431 Do not generate performance extension instructions.
23432
23433 @item -mext-perf2
23434 @opindex mext-perf2
23435 Generate performance extension 2 instructions.
23436
23437 @item -mno-ext-perf2
23438 @opindex mno-ext-perf2
23439 Do not generate performance extension 2 instructions.
23440
23441 @item -mext-string
23442 @opindex mext-string
23443 Generate string extension instructions.
23444
23445 @item -mno-ext-string
23446 @opindex mno-ext-string
23447 Do not generate string extension instructions.
23448
23449 @item -mv3push
23450 @opindex mv3push
23451 Generate v3 push25/pop25 instructions.
23452
23453 @item -mno-v3push
23454 @opindex mno-v3push
23455 Do not generate v3 push25/pop25 instructions.
23456
23457 @item -m16-bit
23458 @opindex m16-bit
23459 Generate 16-bit instructions.
23460
23461 @item -mno-16-bit
23462 @opindex mno-16-bit
23463 Do not generate 16-bit instructions.
23464
23465 @item -misr-vector-size=@var{num}
23466 @opindex misr-vector-size
23467 Specify the size of each interrupt vector, which must be 4 or 16.
23468
23469 @item -mcache-block-size=@var{num}
23470 @opindex mcache-block-size
23471 Specify the size of each cache block,
23472 which must be a power of 2 between 4 and 512.
23473
23474 @item -march=@var{arch}
23475 @opindex march
23476 Specify the name of the target architecture.
23477
23478 @item -mcmodel=@var{code-model}
23479 @opindex mcmodel
23480 Set the code model to one of
23481 @table @asis
23482 @item @samp{small}
23483 All the data and read-only data segments must be within 512KB addressing space.
23484 The text segment must be within 16MB addressing space.
23485 @item @samp{medium}
23486 The data segment must be within 512KB while the read-only data segment can be
23487 within 4GB addressing space. The text segment should be still within 16MB
23488 addressing space.
23489 @item @samp{large}
23490 All the text and data segments can be within 4GB addressing space.
23491 @end table
23492
23493 @item -mctor-dtor
23494 @opindex mctor-dtor
23495 Enable constructor/destructor feature.
23496
23497 @item -mrelax
23498 @opindex mrelax
23499 Guide linker to relax instructions.
23500
23501 @end table
23502
23503 @node Nios II Options
23504 @subsection Nios II Options
23505 @cindex Nios II options
23506 @cindex Altera Nios II options
23507
23508 These are the options defined for the Altera Nios II processor.
23509
23510 @table @gcctabopt
23511
23512 @item -G @var{num}
23513 @opindex G
23514 @cindex smaller data references
23515 Put global and static objects less than or equal to @var{num} bytes
23516 into the small data or BSS sections instead of the normal data or BSS
23517 sections. The default value of @var{num} is 8.
23518
23519 @item -mgpopt=@var{option}
23520 @itemx -mgpopt
23521 @itemx -mno-gpopt
23522 @opindex mgpopt
23523 @opindex mno-gpopt
23524 Generate (do not generate) GP-relative accesses. The following
23525 @var{option} names are recognized:
23526
23527 @table @samp
23528
23529 @item none
23530 Do not generate GP-relative accesses.
23531
23532 @item local
23533 Generate GP-relative accesses for small data objects that are not
23534 external, weak, or uninitialized common symbols.
23535 Also use GP-relative addressing for objects that
23536 have been explicitly placed in a small data section via a @code{section}
23537 attribute.
23538
23539 @item global
23540 As for @samp{local}, but also generate GP-relative accesses for
23541 small data objects that are external, weak, or common. If you use this option,
23542 you must ensure that all parts of your program (including libraries) are
23543 compiled with the same @option{-G} setting.
23544
23545 @item data
23546 Generate GP-relative accesses for all data objects in the program. If you
23547 use this option, the entire data and BSS segments
23548 of your program must fit in 64K of memory and you must use an appropriate
23549 linker script to allocate them within the addressable range of the
23550 global pointer.
23551
23552 @item all
23553 Generate GP-relative addresses for function pointers as well as data
23554 pointers. If you use this option, the entire text, data, and BSS segments
23555 of your program must fit in 64K of memory and you must use an appropriate
23556 linker script to allocate them within the addressable range of the
23557 global pointer.
23558
23559 @end table
23560
23561 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23562 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23563
23564 The default is @option{-mgpopt} except when @option{-fpic} or
23565 @option{-fPIC} is specified to generate position-independent code.
23566 Note that the Nios II ABI does not permit GP-relative accesses from
23567 shared libraries.
23568
23569 You may need to specify @option{-mno-gpopt} explicitly when building
23570 programs that include large amounts of small data, including large
23571 GOT data sections. In this case, the 16-bit offset for GP-relative
23572 addressing may not be large enough to allow access to the entire
23573 small data section.
23574
23575 @item -mgprel-sec=@var{regexp}
23576 @opindex mgprel-sec
23577 This option specifies additional section names that can be accessed via
23578 GP-relative addressing. It is most useful in conjunction with
23579 @code{section} attributes on variable declarations
23580 (@pxref{Common Variable Attributes}) and a custom linker script.
23581 The @var{regexp} is a POSIX Extended Regular Expression.
23582
23583 This option does not affect the behavior of the @option{-G} option, and
23584 the specified sections are in addition to the standard @code{.sdata}
23585 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23586
23587 @item -mr0rel-sec=@var{regexp}
23588 @opindex mr0rel-sec
23589 This option specifies names of sections that can be accessed via a
23590 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23591 of the 32-bit address space. It is most useful in conjunction with
23592 @code{section} attributes on variable declarations
23593 (@pxref{Common Variable Attributes}) and a custom linker script.
23594 The @var{regexp} is a POSIX Extended Regular Expression.
23595
23596 In contrast to the use of GP-relative addressing for small data,
23597 zero-based addressing is never generated by default and there are no
23598 conventional section names used in standard linker scripts for sections
23599 in the low or high areas of memory.
23600
23601 @item -mel
23602 @itemx -meb
23603 @opindex mel
23604 @opindex meb
23605 Generate little-endian (default) or big-endian (experimental) code,
23606 respectively.
23607
23608 @item -march=@var{arch}
23609 @opindex march
23610 This specifies the name of the target Nios II architecture. GCC uses this
23611 name to determine what kind of instructions it can emit when generating
23612 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23613
23614 The preprocessor macro @code{__nios2_arch__} is available to programs,
23615 with value 1 or 2, indicating the targeted ISA level.
23616
23617 @item -mbypass-cache
23618 @itemx -mno-bypass-cache
23619 @opindex mno-bypass-cache
23620 @opindex mbypass-cache
23621 Force all load and store instructions to always bypass cache by
23622 using I/O variants of the instructions. The default is not to
23623 bypass the cache.
23624
23625 @item -mno-cache-volatile
23626 @itemx -mcache-volatile
23627 @opindex mcache-volatile
23628 @opindex mno-cache-volatile
23629 Volatile memory access bypass the cache using the I/O variants of
23630 the load and store instructions. The default is not to bypass the cache.
23631
23632 @item -mno-fast-sw-div
23633 @itemx -mfast-sw-div
23634 @opindex mno-fast-sw-div
23635 @opindex mfast-sw-div
23636 Do not use table-based fast divide for small numbers. The default
23637 is to use the fast divide at @option{-O3} and above.
23638
23639 @item -mno-hw-mul
23640 @itemx -mhw-mul
23641 @itemx -mno-hw-mulx
23642 @itemx -mhw-mulx
23643 @itemx -mno-hw-div
23644 @itemx -mhw-div
23645 @opindex mno-hw-mul
23646 @opindex mhw-mul
23647 @opindex mno-hw-mulx
23648 @opindex mhw-mulx
23649 @opindex mno-hw-div
23650 @opindex mhw-div
23651 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23652 instructions by the compiler. The default is to emit @code{mul}
23653 and not emit @code{div} and @code{mulx}.
23654
23655 @item -mbmx
23656 @itemx -mno-bmx
23657 @itemx -mcdx
23658 @itemx -mno-cdx
23659 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23660 CDX (code density) instructions. Enabling these instructions also
23661 requires @option{-march=r2}. Since these instructions are optional
23662 extensions to the R2 architecture, the default is not to emit them.
23663
23664 @item -mcustom-@var{insn}=@var{N}
23665 @itemx -mno-custom-@var{insn}
23666 @opindex mcustom-@var{insn}
23667 @opindex mno-custom-@var{insn}
23668 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23669 custom instruction with encoding @var{N} when generating code that uses
23670 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23671 instruction 253 for single-precision floating-point add operations instead
23672 of the default behavior of using a library call.
23673
23674 The following values of @var{insn} are supported. Except as otherwise
23675 noted, floating-point operations are expected to be implemented with
23676 normal IEEE 754 semantics and correspond directly to the C operators or the
23677 equivalent GCC built-in functions (@pxref{Other Builtins}).
23678
23679 Single-precision floating point:
23680 @table @asis
23681
23682 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23683 Binary arithmetic operations.
23684
23685 @item @samp{fnegs}
23686 Unary negation.
23687
23688 @item @samp{fabss}
23689 Unary absolute value.
23690
23691 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23692 Comparison operations.
23693
23694 @item @samp{fmins}, @samp{fmaxs}
23695 Floating-point minimum and maximum. These instructions are only
23696 generated if @option{-ffinite-math-only} is specified.
23697
23698 @item @samp{fsqrts}
23699 Unary square root operation.
23700
23701 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23702 Floating-point trigonometric and exponential functions. These instructions
23703 are only generated if @option{-funsafe-math-optimizations} is also specified.
23704
23705 @end table
23706
23707 Double-precision floating point:
23708 @table @asis
23709
23710 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23711 Binary arithmetic operations.
23712
23713 @item @samp{fnegd}
23714 Unary negation.
23715
23716 @item @samp{fabsd}
23717 Unary absolute value.
23718
23719 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23720 Comparison operations.
23721
23722 @item @samp{fmind}, @samp{fmaxd}
23723 Double-precision minimum and maximum. These instructions are only
23724 generated if @option{-ffinite-math-only} is specified.
23725
23726 @item @samp{fsqrtd}
23727 Unary square root operation.
23728
23729 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23730 Double-precision trigonometric and exponential functions. These instructions
23731 are only generated if @option{-funsafe-math-optimizations} is also specified.
23732
23733 @end table
23734
23735 Conversions:
23736 @table @asis
23737 @item @samp{fextsd}
23738 Conversion from single precision to double precision.
23739
23740 @item @samp{ftruncds}
23741 Conversion from double precision to single precision.
23742
23743 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23744 Conversion from floating point to signed or unsigned integer types, with
23745 truncation towards zero.
23746
23747 @item @samp{round}
23748 Conversion from single-precision floating point to signed integer,
23749 rounding to the nearest integer and ties away from zero.
23750 This corresponds to the @code{__builtin_lroundf} function when
23751 @option{-fno-math-errno} is used.
23752
23753 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23754 Conversion from signed or unsigned integer types to floating-point types.
23755
23756 @end table
23757
23758 In addition, all of the following transfer instructions for internal
23759 registers X and Y must be provided to use any of the double-precision
23760 floating-point instructions. Custom instructions taking two
23761 double-precision source operands expect the first operand in the
23762 64-bit register X. The other operand (or only operand of a unary
23763 operation) is given to the custom arithmetic instruction with the
23764 least significant half in source register @var{src1} and the most
23765 significant half in @var{src2}. A custom instruction that returns a
23766 double-precision result returns the most significant 32 bits in the
23767 destination register and the other half in 32-bit register Y.
23768 GCC automatically generates the necessary code sequences to write
23769 register X and/or read register Y when double-precision floating-point
23770 instructions are used.
23771
23772 @table @asis
23773
23774 @item @samp{fwrx}
23775 Write @var{src1} into the least significant half of X and @var{src2} into
23776 the most significant half of X.
23777
23778 @item @samp{fwry}
23779 Write @var{src1} into Y.
23780
23781 @item @samp{frdxhi}, @samp{frdxlo}
23782 Read the most or least (respectively) significant half of X and store it in
23783 @var{dest}.
23784
23785 @item @samp{frdy}
23786 Read the value of Y and store it into @var{dest}.
23787 @end table
23788
23789 Note that you can gain more local control over generation of Nios II custom
23790 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23791 and @code{target("no-custom-@var{insn}")} function attributes
23792 (@pxref{Function Attributes})
23793 or pragmas (@pxref{Function Specific Option Pragmas}).
23794
23795 @item -mcustom-fpu-cfg=@var{name}
23796 @opindex mcustom-fpu-cfg
23797
23798 This option enables a predefined, named set of custom instruction encodings
23799 (see @option{-mcustom-@var{insn}} above).
23800 Currently, the following sets are defined:
23801
23802 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23803 @gccoptlist{-mcustom-fmuls=252 @gol
23804 -mcustom-fadds=253 @gol
23805 -mcustom-fsubs=254 @gol
23806 -fsingle-precision-constant}
23807
23808 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23809 @gccoptlist{-mcustom-fmuls=252 @gol
23810 -mcustom-fadds=253 @gol
23811 -mcustom-fsubs=254 @gol
23812 -mcustom-fdivs=255 @gol
23813 -fsingle-precision-constant}
23814
23815 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23816 @gccoptlist{-mcustom-floatus=243 @gol
23817 -mcustom-fixsi=244 @gol
23818 -mcustom-floatis=245 @gol
23819 -mcustom-fcmpgts=246 @gol
23820 -mcustom-fcmples=249 @gol
23821 -mcustom-fcmpeqs=250 @gol
23822 -mcustom-fcmpnes=251 @gol
23823 -mcustom-fmuls=252 @gol
23824 -mcustom-fadds=253 @gol
23825 -mcustom-fsubs=254 @gol
23826 -mcustom-fdivs=255 @gol
23827 -fsingle-precision-constant}
23828
23829 Custom instruction assignments given by individual
23830 @option{-mcustom-@var{insn}=} options override those given by
23831 @option{-mcustom-fpu-cfg=}, regardless of the
23832 order of the options on the command line.
23833
23834 Note that you can gain more local control over selection of a FPU
23835 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23836 function attribute (@pxref{Function Attributes})
23837 or pragma (@pxref{Function Specific Option Pragmas}).
23838
23839 @end table
23840
23841 These additional @samp{-m} options are available for the Altera Nios II
23842 ELF (bare-metal) target:
23843
23844 @table @gcctabopt
23845
23846 @item -mhal
23847 @opindex mhal
23848 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23849 startup and termination code, and is typically used in conjunction with
23850 @option{-msys-crt0=} to specify the location of the alternate startup code
23851 provided by the HAL BSP.
23852
23853 @item -msmallc
23854 @opindex msmallc
23855 Link with a limited version of the C library, @option{-lsmallc}, rather than
23856 Newlib.
23857
23858 @item -msys-crt0=@var{startfile}
23859 @opindex msys-crt0
23860 @var{startfile} is the file name of the startfile (crt0) to use
23861 when linking. This option is only useful in conjunction with @option{-mhal}.
23862
23863 @item -msys-lib=@var{systemlib}
23864 @opindex msys-lib
23865 @var{systemlib} is the library name of the library that provides
23866 low-level system calls required by the C library,
23867 e.g.@: @code{read} and @code{write}.
23868 This option is typically used to link with a library provided by a HAL BSP.
23869
23870 @end table
23871
23872 @node Nvidia PTX Options
23873 @subsection Nvidia PTX Options
23874 @cindex Nvidia PTX options
23875 @cindex nvptx options
23876
23877 These options are defined for Nvidia PTX:
23878
23879 @table @gcctabopt
23880
23881 @item -m32
23882 @itemx -m64
23883 @opindex m32
23884 @opindex m64
23885 Generate code for 32-bit or 64-bit ABI.
23886
23887 @item -misa=@var{ISA-string}
23888 @opindex march
23889 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23890 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23891 @samp{sm_35}. The default ISA is sm_30.
23892
23893 @item -mmainkernel
23894 @opindex mmainkernel
23895 Link in code for a __main kernel. This is for stand-alone instead of
23896 offloading execution.
23897
23898 @item -moptimize
23899 @opindex moptimize
23900 Apply partitioned execution optimizations. This is the default when any
23901 level of optimization is selected.
23902
23903 @item -msoft-stack
23904 @opindex msoft-stack
23905 Generate code that does not use @code{.local} memory
23906 directly for stack storage. Instead, a per-warp stack pointer is
23907 maintained explicitly. This enables variable-length stack allocation (with
23908 variable-length arrays or @code{alloca}), and when global memory is used for
23909 underlying storage, makes it possible to access automatic variables from other
23910 threads, or with atomic instructions. This code generation variant is used
23911 for OpenMP offloading, but the option is exposed on its own for the purpose
23912 of testing the compiler; to generate code suitable for linking into programs
23913 using OpenMP offloading, use option @option{-mgomp}.
23914
23915 @item -muniform-simt
23916 @opindex muniform-simt
23917 Switch to code generation variant that allows to execute all threads in each
23918 warp, while maintaining memory state and side effects as if only one thread
23919 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23920 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23921 current lane index equals the master lane index), and the register being
23922 assigned is copied via a shuffle instruction from the master lane. Outside of
23923 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23924 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23925 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23926 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23927 with current lane index to compute the master lane index.
23928
23929 @item -mgomp
23930 @opindex mgomp
23931 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23932 @option{-muniform-simt} options, and selects corresponding multilib variant.
23933
23934 @end table
23935
23936 @node OpenRISC Options
23937 @subsection OpenRISC Options
23938 @cindex OpenRISC Options
23939
23940 These options are defined for OpenRISC:
23941
23942 @table @gcctabopt
23943
23944 @item -mboard=@var{name}
23945 @opindex mboard
23946 Configure a board specific runtime. This will be passed to the linker for
23947 newlib board library linking. The default is @code{or1ksim}.
23948
23949 @item -mnewlib
23950 @opindex mnewlib
23951 This option is ignored; it is for compatibility purposes only. This used to
23952 select linker and preprocessor options for use with newlib.
23953
23954 @item -msoft-div
23955 @itemx -mhard-div
23956 @opindex msoft-div
23957 @opindex mhard-div
23958 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23959 This default is hardware divide.
23960
23961 @item -msoft-mul
23962 @itemx -mhard-mul
23963 @opindex msoft-mul
23964 @opindex mhard-mul
23965 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23966 This default is hardware multiply.
23967
23968 @item -msoft-float
23969 @itemx -mhard-float
23970 @opindex msoft-float
23971 @opindex mhard-float
23972 Select software or hardware for floating point operations.
23973 The default is software.
23974
23975 @item -mdouble-float
23976 @opindex mdouble-float
23977 When @option{-mhard-float} is selected, enables generation of double-precision
23978 floating point instructions. By default functions from @file{libgcc} are used
23979 to perform double-precision floating point operations.
23980
23981 @item -munordered-float
23982 @opindex munordered-float
23983 When @option{-mhard-float} is selected, enables generation of unordered
23984 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23985 functions from @file{libgcc} are used to perform unordered floating point
23986 compare and set flag operations.
23987
23988 @item -mcmov
23989 @opindex mcmov
23990 Enable generation of conditional move (@code{l.cmov}) instructions. By
23991 default the equivalent will be generated using using set and branch.
23992
23993 @item -mror
23994 @opindex mror
23995 Enable generation of rotate right (@code{l.ror}) instructions. By default
23996 functions from @file{libgcc} are used to perform rotate right operations.
23997
23998 @item -mrori
23999 @opindex mrori
24000 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
24001 By default functions from @file{libgcc} are used to perform rotate right with
24002 immediate operations.
24003
24004 @item -msext
24005 @opindex msext
24006 Enable generation of sign extension (@code{l.ext*}) instructions. By default
24007 memory loads are used to perform sign extension.
24008
24009 @item -msfimm
24010 @opindex msfimm
24011 Enable generation of compare and set flag with immediate (@code{l.sf*i})
24012 instructions. By default extra instructions will be generated to store the
24013 immediate to a register first.
24014
24015 @item -mshftimm
24016 @opindex mshftimm
24017 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
24018 @code{l.slli}) instructions. By default extra instructions will be generated
24019 to store the immediate to a register first.
24020
24021
24022 @end table
24023
24024 @node PDP-11 Options
24025 @subsection PDP-11 Options
24026 @cindex PDP-11 Options
24027
24028 These options are defined for the PDP-11:
24029
24030 @table @gcctabopt
24031 @item -mfpu
24032 @opindex mfpu
24033 Use hardware FPP floating point. This is the default. (FIS floating
24034 point on the PDP-11/40 is not supported.) Implies -m45.
24035
24036 @item -msoft-float
24037 @opindex msoft-float
24038 Do not use hardware floating point.
24039
24040 @item -mac0
24041 @opindex mac0
24042 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
24043
24044 @item -mno-ac0
24045 @opindex mno-ac0
24046 Return floating-point results in memory. This is the default.
24047
24048 @item -m40
24049 @opindex m40
24050 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24051
24052 @item -m45
24053 @opindex m45
24054 Generate code for a PDP-11/45. This is the default.
24055
24056 @item -m10
24057 @opindex m10
24058 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24059
24060 @item -mint16
24061 @itemx -mno-int32
24062 @opindex mint16
24063 @opindex mno-int32
24064 Use 16-bit @code{int}. This is the default.
24065
24066 @item -mint32
24067 @itemx -mno-int16
24068 @opindex mint32
24069 @opindex mno-int16
24070 Use 32-bit @code{int}.
24071
24072 @item -msplit
24073 @opindex msplit
24074 Target has split instruction and data space. Implies -m45.
24075
24076 @item -munix-asm
24077 @opindex munix-asm
24078 Use Unix assembler syntax.
24079
24080 @item -mdec-asm
24081 @opindex mdec-asm
24082 Use DEC assembler syntax.
24083
24084 @item -mgnu-asm
24085 @opindex mgnu-asm
24086 Use GNU assembler syntax. This is the default.
24087
24088 @item -mlra
24089 @opindex mlra
24090 Use the new LRA register allocator. By default, the old ``reload''
24091 allocator is used.
24092 @end table
24093
24094 @node picoChip Options
24095 @subsection picoChip Options
24096 @cindex picoChip options
24097
24098 These @samp{-m} options are defined for picoChip implementations:
24099
24100 @table @gcctabopt
24101
24102 @item -mae=@var{ae_type}
24103 @opindex mcpu
24104 Set the instruction set, register set, and instruction scheduling
24105 parameters for array element type @var{ae_type}. Supported values
24106 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
24107
24108 @option{-mae=ANY} selects a completely generic AE type. Code
24109 generated with this option runs on any of the other AE types. The
24110 code is not as efficient as it would be if compiled for a specific
24111 AE type, and some types of operation (e.g., multiplication) do not
24112 work properly on all types of AE.
24113
24114 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
24115 for compiled code, and is the default.
24116
24117 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
24118 option may suffer from poor performance of byte (char) manipulation,
24119 since the DSP AE does not provide hardware support for byte load/stores.
24120
24121 @item -msymbol-as-address
24122 Enable the compiler to directly use a symbol name as an address in a
24123 load/store instruction, without first loading it into a
24124 register. Typically, the use of this option generates larger
24125 programs, which run faster than when the option isn't used. However, the
24126 results vary from program to program, so it is left as a user option,
24127 rather than being permanently enabled.
24128
24129 @item -mno-inefficient-warnings
24130 Disables warnings about the generation of inefficient code. These
24131 warnings can be generated, for example, when compiling code that
24132 performs byte-level memory operations on the MAC AE type. The MAC AE has
24133 no hardware support for byte-level memory operations, so all byte
24134 load/stores must be synthesized from word load/store operations. This is
24135 inefficient and a warning is generated to indicate
24136 that you should rewrite the code to avoid byte operations, or to target
24137 an AE type that has the necessary hardware support. This option disables
24138 these warnings.
24139
24140 @end table
24141
24142 @node PowerPC Options
24143 @subsection PowerPC Options
24144 @cindex PowerPC options
24145
24146 These are listed under @xref{RS/6000 and PowerPC Options}.
24147
24148 @node PRU Options
24149 @subsection PRU Options
24150 @cindex PRU Options
24151
24152 These command-line options are defined for PRU target:
24153
24154 @table @gcctabopt
24155 @item -minrt
24156 @opindex minrt
24157 Link with a minimum runtime environment, with no support for static
24158 initializers and constructors. Using this option can significantly reduce
24159 the size of the final ELF binary. Beware that the compiler could still
24160 generate code with static initializers and constructors. It is up to the
24161 programmer to ensure that the source program will not use those features.
24162
24163 @item -mmcu=@var{mcu}
24164 @opindex mmcu
24165 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24166 supported MCUs.
24167
24168 @item -mno-relax
24169 @opindex mno-relax
24170 Make GCC pass the @option{--no-relax} command-line option to the linker
24171 instead of the @option{--relax} option.
24172
24173 @item -mloop
24174 @opindex mloop
24175 Allow (or do not allow) GCC to use the LOOP instruction.
24176
24177 @item -mabi=@var{variant}
24178 @opindex mabi
24179 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24180 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24181 more naturally with certain GCC assumptions. These are the differences:
24182
24183 @table @samp
24184 @item Function Pointer Size
24185 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24186 supports only 32-bit data and code pointers.
24187
24188 @item Optional Return Value Pointer
24189 Function return values larger than 64 bits are passed by using a hidden
24190 pointer as the first argument of the function. TI ABI, though, mandates that
24191 the pointer can be NULL in case the caller is not using the returned value.
24192 GNU always passes and expects a valid return value pointer.
24193
24194 @end table
24195
24196 The current @option{-mabi=ti} implementation simply raises a compile error
24197 when any of the above code constructs is detected. As a consequence
24198 the standard C library cannot be built and it is omitted when linking with
24199 @option{-mabi=ti}.
24200
24201 Relaxation is a GNU feature and for safety reasons is disabled when using
24202 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24203 instructions, so the GNU linker cannot adjust them when shortening adjacent
24204 LDI32 pseudo instructions.
24205
24206 @end table
24207
24208 @node RISC-V Options
24209 @subsection RISC-V Options
24210 @cindex RISC-V Options
24211
24212 These command-line options are defined for RISC-V targets:
24213
24214 @table @gcctabopt
24215 @item -mbranch-cost=@var{n}
24216 @opindex mbranch-cost
24217 Set the cost of branches to roughly @var{n} instructions.
24218
24219 @item -mplt
24220 @itemx -mno-plt
24221 @opindex plt
24222 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24223 non-PIC. The default is @option{-mplt}.
24224
24225 @item -mabi=@var{ABI-string}
24226 @opindex mabi
24227 Specify integer and floating-point calling convention. @var{ABI-string}
24228 contains two parts: the size of integer types and the registers used for
24229 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24230 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24231 32-bit), and that floating-point values up to 64 bits wide are passed in F
24232 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24233 allows the compiler to generate code that uses the F and D extensions but only
24234 allows floating-point values up to 32 bits long to be passed in registers; or
24235 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24236 passed in registers.
24237
24238 The default for this argument is system dependent, users who want a specific
24239 calling convention should specify one explicitly. The valid calling
24240 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24241 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24242 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24243 invalid because the ABI requires 64-bit values be passed in F registers, but F
24244 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24245 only be used with the @samp{rv32e} architecture. This ABI is not well
24246 specified at present, and is subject to change.
24247
24248 @item -mfdiv
24249 @itemx -mno-fdiv
24250 @opindex mfdiv
24251 Do or don't use hardware floating-point divide and square root instructions.
24252 This requires the F or D extensions for floating-point registers. The default
24253 is to use them if the specified architecture has these instructions.
24254
24255 @item -mdiv
24256 @itemx -mno-div
24257 @opindex mdiv
24258 Do or don't use hardware instructions for integer division. This requires the
24259 M extension. The default is to use them if the specified architecture has
24260 these instructions.
24261
24262 @item -march=@var{ISA-string}
24263 @opindex march
24264 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24265 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24266 @samp{rv32imaf}.
24267
24268 @item -mtune=@var{processor-string}
24269 @opindex mtune
24270 Optimize the output for the given processor, specified by microarchitecture
24271 name. Permissible values for this option are: @samp{rocket},
24272 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24273 and @samp{size}.
24274
24275 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24276
24277 The @samp{size} choice is not intended for use by end-users. This is used
24278 when @option{-Os} is specified. It overrides the instruction cost info
24279 provided by @option{-mtune=}, but does not override the pipeline info. This
24280 helps reduce code size while still giving good performance.
24281
24282 @item -mpreferred-stack-boundary=@var{num}
24283 @opindex mpreferred-stack-boundary
24284 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24285 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24286 the default is 4 (16 bytes or 128-bits).
24287
24288 @strong{Warning:} If you use this switch, then you must build all modules with
24289 the same value, including any libraries. This includes the system libraries
24290 and startup modules.
24291
24292 @item -msmall-data-limit=@var{n}
24293 @opindex msmall-data-limit
24294 Put global and static data smaller than @var{n} bytes into a special section
24295 (on some targets).
24296
24297 @item -msave-restore
24298 @itemx -mno-save-restore
24299 @opindex msave-restore
24300 Do or don't use smaller but slower prologue and epilogue code that uses
24301 library function calls. The default is to use fast inline prologues and
24302 epilogues.
24303
24304 @item -mstrict-align
24305 @itemx -mno-strict-align
24306 @opindex mstrict-align
24307 Do not or do generate unaligned memory accesses. The default is set depending
24308 on whether the processor we are optimizing for supports fast unaligned access
24309 or not.
24310
24311 @item -mcmodel=medlow
24312 @opindex mcmodel=medlow
24313 Generate code for the medium-low code model. The program and its statically
24314 defined symbols must lie within a single 2 GiB address range and must lie
24315 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24316 statically or dynamically linked. This is the default code model.
24317
24318 @item -mcmodel=medany
24319 @opindex mcmodel=medany
24320 Generate code for the medium-any code model. The program and its statically
24321 defined symbols must be within any single 2 GiB address range. Programs can be
24322 statically or dynamically linked.
24323
24324 @item -mexplicit-relocs
24325 @itemx -mno-exlicit-relocs
24326 Use or do not use assembler relocation operators when dealing with symbolic
24327 addresses. The alternative is to use assembler macros instead, which may
24328 limit optimization.
24329
24330 @item -mrelax
24331 @itemx -mno-relax
24332 Take advantage of linker relaxations to reduce the number of instructions
24333 required to materialize symbol addresses. The default is to take advantage of
24334 linker relaxations.
24335
24336 @item -memit-attribute
24337 @itemx -mno-emit-attribute
24338 Emit (do not emit) RISC-V attribute to record extra information into ELF
24339 objects. This feature requires at least binutils 2.32.
24340
24341 @item -malign-data=@var{type}
24342 @opindex malign-data
24343 Control how GCC aligns variables and constants of array, structure, or union
24344 types. Supported values for @var{type} are @samp{xlen} which uses x register
24345 width as the alignment value, and @samp{natural} which uses natural alignment.
24346 @samp{xlen} is the default.
24347 @end table
24348
24349 @node RL78 Options
24350 @subsection RL78 Options
24351 @cindex RL78 Options
24352
24353 @table @gcctabopt
24354
24355 @item -msim
24356 @opindex msim
24357 Links in additional target libraries to support operation within a
24358 simulator.
24359
24360 @item -mmul=none
24361 @itemx -mmul=g10
24362 @itemx -mmul=g13
24363 @itemx -mmul=g14
24364 @itemx -mmul=rl78
24365 @opindex mmul
24366 Specifies the type of hardware multiplication and division support to
24367 be used. The simplest is @code{none}, which uses software for both
24368 multiplication and division. This is the default. The @code{g13}
24369 value is for the hardware multiply/divide peripheral found on the
24370 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24371 the multiplication and division instructions supported by the RL78/G14
24372 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24373 the value @code{mg10} is an alias for @code{none}.
24374
24375 In addition a C preprocessor macro is defined, based upon the setting
24376 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24377 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24378
24379 @item -mcpu=g10
24380 @itemx -mcpu=g13
24381 @itemx -mcpu=g14
24382 @itemx -mcpu=rl78
24383 @opindex mcpu
24384 Specifies the RL78 core to target. The default is the G14 core, also
24385 known as an S3 core or just RL78. The G13 or S2 core does not have
24386 multiply or divide instructions, instead it uses a hardware peripheral
24387 for these operations. The G10 or S1 core does not have register
24388 banks, so it uses a different calling convention.
24389
24390 If this option is set it also selects the type of hardware multiply
24391 support to use, unless this is overridden by an explicit
24392 @option{-mmul=none} option on the command line. Thus specifying
24393 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24394 peripheral and specifying @option{-mcpu=g10} disables the use of
24395 hardware multiplications altogether.
24396
24397 Note, although the RL78/G14 core is the default target, specifying
24398 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24399 change the behavior of the toolchain since it also enables G14
24400 hardware multiply support. If these options are not specified on the
24401 command line then software multiplication routines will be used even
24402 though the code targets the RL78 core. This is for backwards
24403 compatibility with older toolchains which did not have hardware
24404 multiply and divide support.
24405
24406 In addition a C preprocessor macro is defined, based upon the setting
24407 of this option. Possible values are: @code{__RL78_G10__},
24408 @code{__RL78_G13__} or @code{__RL78_G14__}.
24409
24410 @item -mg10
24411 @itemx -mg13
24412 @itemx -mg14
24413 @itemx -mrl78
24414 @opindex mg10
24415 @opindex mg13
24416 @opindex mg14
24417 @opindex mrl78
24418 These are aliases for the corresponding @option{-mcpu=} option. They
24419 are provided for backwards compatibility.
24420
24421 @item -mallregs
24422 @opindex mallregs
24423 Allow the compiler to use all of the available registers. By default
24424 registers @code{r24..r31} are reserved for use in interrupt handlers.
24425 With this option enabled these registers can be used in ordinary
24426 functions as well.
24427
24428 @item -m64bit-doubles
24429 @itemx -m32bit-doubles
24430 @opindex m64bit-doubles
24431 @opindex m32bit-doubles
24432 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24433 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24434 @option{-m32bit-doubles}.
24435
24436 @item -msave-mduc-in-interrupts
24437 @itemx -mno-save-mduc-in-interrupts
24438 @opindex msave-mduc-in-interrupts
24439 @opindex mno-save-mduc-in-interrupts
24440 Specifies that interrupt handler functions should preserve the
24441 MDUC registers. This is only necessary if normal code might use
24442 the MDUC registers, for example because it performs multiplication
24443 and division operations. The default is to ignore the MDUC registers
24444 as this makes the interrupt handlers faster. The target option -mg13
24445 needs to be passed for this to work as this feature is only available
24446 on the G13 target (S2 core). The MDUC registers will only be saved
24447 if the interrupt handler performs a multiplication or division
24448 operation or it calls another function.
24449
24450 @end table
24451
24452 @node RS/6000 and PowerPC Options
24453 @subsection IBM RS/6000 and PowerPC Options
24454 @cindex RS/6000 and PowerPC Options
24455 @cindex IBM RS/6000 and PowerPC Options
24456
24457 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24458 @table @gcctabopt
24459 @item -mpowerpc-gpopt
24460 @itemx -mno-powerpc-gpopt
24461 @itemx -mpowerpc-gfxopt
24462 @itemx -mno-powerpc-gfxopt
24463 @need 800
24464 @itemx -mpowerpc64
24465 @itemx -mno-powerpc64
24466 @itemx -mmfcrf
24467 @itemx -mno-mfcrf
24468 @itemx -mpopcntb
24469 @itemx -mno-popcntb
24470 @itemx -mpopcntd
24471 @itemx -mno-popcntd
24472 @itemx -mfprnd
24473 @itemx -mno-fprnd
24474 @need 800
24475 @itemx -mcmpb
24476 @itemx -mno-cmpb
24477 @itemx -mhard-dfp
24478 @itemx -mno-hard-dfp
24479 @opindex mpowerpc-gpopt
24480 @opindex mno-powerpc-gpopt
24481 @opindex mpowerpc-gfxopt
24482 @opindex mno-powerpc-gfxopt
24483 @opindex mpowerpc64
24484 @opindex mno-powerpc64
24485 @opindex mmfcrf
24486 @opindex mno-mfcrf
24487 @opindex mpopcntb
24488 @opindex mno-popcntb
24489 @opindex mpopcntd
24490 @opindex mno-popcntd
24491 @opindex mfprnd
24492 @opindex mno-fprnd
24493 @opindex mcmpb
24494 @opindex mno-cmpb
24495 @opindex mhard-dfp
24496 @opindex mno-hard-dfp
24497 You use these options to specify which instructions are available on the
24498 processor you are using. The default value of these options is
24499 determined when configuring GCC@. Specifying the
24500 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24501 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24502 rather than the options listed above.
24503
24504 Specifying @option{-mpowerpc-gpopt} allows
24505 GCC to use the optional PowerPC architecture instructions in the
24506 General Purpose group, including floating-point square root. Specifying
24507 @option{-mpowerpc-gfxopt} allows GCC to
24508 use the optional PowerPC architecture instructions in the Graphics
24509 group, including floating-point select.
24510
24511 The @option{-mmfcrf} option allows GCC to generate the move from
24512 condition register field instruction implemented on the POWER4
24513 processor and other processors that support the PowerPC V2.01
24514 architecture.
24515 The @option{-mpopcntb} option allows GCC to generate the popcount and
24516 double-precision FP reciprocal estimate instruction implemented on the
24517 POWER5 processor and other processors that support the PowerPC V2.02
24518 architecture.
24519 The @option{-mpopcntd} option allows GCC to generate the popcount
24520 instruction implemented on the POWER7 processor and other processors
24521 that support the PowerPC V2.06 architecture.
24522 The @option{-mfprnd} option allows GCC to generate the FP round to
24523 integer instructions implemented on the POWER5+ processor and other
24524 processors that support the PowerPC V2.03 architecture.
24525 The @option{-mcmpb} option allows GCC to generate the compare bytes
24526 instruction implemented on the POWER6 processor and other processors
24527 that support the PowerPC V2.05 architecture.
24528 The @option{-mhard-dfp} option allows GCC to generate the decimal
24529 floating-point instructions implemented on some POWER processors.
24530
24531 The @option{-mpowerpc64} option allows GCC to generate the additional
24532 64-bit instructions that are found in the full PowerPC64 architecture
24533 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24534 @option{-mno-powerpc64}.
24535
24536 @item -mcpu=@var{cpu_type}
24537 @opindex mcpu
24538 Set architecture type, register usage, and
24539 instruction scheduling parameters for machine type @var{cpu_type}.
24540 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24541 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24542 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24543 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24544 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24545 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24546 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24547 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24548 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24549 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24550 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24551 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24552
24553 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24554 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24555 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24556 architecture machine types, with an appropriate, generic processor
24557 model assumed for scheduling purposes.
24558
24559 Specifying @samp{native} as cpu type detects and selects the
24560 architecture option that corresponds to the host processor of the
24561 system performing the compilation.
24562 @option{-mcpu=native} has no effect if GCC does not recognize the
24563 processor.
24564
24565 The other options specify a specific processor. Code generated under
24566 those options runs best on that processor, and may not run at all on
24567 others.
24568
24569 The @option{-mcpu} options automatically enable or disable the
24570 following options:
24571
24572 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24573 -mpopcntb -mpopcntd -mpowerpc64 @gol
24574 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24575 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24576 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24577 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24578
24579 The particular options set for any particular CPU varies between
24580 compiler versions, depending on what setting seems to produce optimal
24581 code for that CPU; it doesn't necessarily reflect the actual hardware's
24582 capabilities. If you wish to set an individual option to a particular
24583 value, you may specify it after the @option{-mcpu} option, like
24584 @option{-mcpu=970 -mno-altivec}.
24585
24586 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24587 not enabled or disabled by the @option{-mcpu} option at present because
24588 AIX does not have full support for these options. You may still
24589 enable or disable them individually if you're sure it'll work in your
24590 environment.
24591
24592 @item -mtune=@var{cpu_type}
24593 @opindex mtune
24594 Set the instruction scheduling parameters for machine type
24595 @var{cpu_type}, but do not set the architecture type or register usage,
24596 as @option{-mcpu=@var{cpu_type}} does. The same
24597 values for @var{cpu_type} are used for @option{-mtune} as for
24598 @option{-mcpu}. If both are specified, the code generated uses the
24599 architecture and registers set by @option{-mcpu}, but the
24600 scheduling parameters set by @option{-mtune}.
24601
24602 @item -mcmodel=small
24603 @opindex mcmodel=small
24604 Generate PowerPC64 code for the small model: The TOC is limited to
24605 64k.
24606
24607 @item -mcmodel=medium
24608 @opindex mcmodel=medium
24609 Generate PowerPC64 code for the medium model: The TOC and other static
24610 data may be up to a total of 4G in size. This is the default for 64-bit
24611 Linux.
24612
24613 @item -mcmodel=large
24614 @opindex mcmodel=large
24615 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24616 in size. Other data and code is only limited by the 64-bit address
24617 space.
24618
24619 @item -maltivec
24620 @itemx -mno-altivec
24621 @opindex maltivec
24622 @opindex mno-altivec
24623 Generate code that uses (does not use) AltiVec instructions, and also
24624 enable the use of built-in functions that allow more direct access to
24625 the AltiVec instruction set. You may also need to set
24626 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24627 enhancements.
24628
24629 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24630 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24631 match array element order corresponding to the endianness of the
24632 target. That is, element zero identifies the leftmost element in a
24633 vector register when targeting a big-endian platform, and identifies
24634 the rightmost element in a vector register when targeting a
24635 little-endian platform.
24636
24637 @item -mvrsave
24638 @itemx -mno-vrsave
24639 @opindex mvrsave
24640 @opindex mno-vrsave
24641 Generate VRSAVE instructions when generating AltiVec code.
24642
24643 @item -msecure-plt
24644 @opindex msecure-plt
24645 Generate code that allows @command{ld} and @command{ld.so}
24646 to build executables and shared
24647 libraries with non-executable @code{.plt} and @code{.got} sections.
24648 This is a PowerPC
24649 32-bit SYSV ABI option.
24650
24651 @item -mbss-plt
24652 @opindex mbss-plt
24653 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24654 fills in, and
24655 requires @code{.plt} and @code{.got}
24656 sections that are both writable and executable.
24657 This is a PowerPC 32-bit SYSV ABI option.
24658
24659 @item -misel
24660 @itemx -mno-isel
24661 @opindex misel
24662 @opindex mno-isel
24663 This switch enables or disables the generation of ISEL instructions.
24664
24665 @item -mvsx
24666 @itemx -mno-vsx
24667 @opindex mvsx
24668 @opindex mno-vsx
24669 Generate code that uses (does not use) vector/scalar (VSX)
24670 instructions, and also enable the use of built-in functions that allow
24671 more direct access to the VSX instruction set.
24672
24673 @item -mcrypto
24674 @itemx -mno-crypto
24675 @opindex mcrypto
24676 @opindex mno-crypto
24677 Enable the use (disable) of the built-in functions that allow direct
24678 access to the cryptographic instructions that were added in version
24679 2.07 of the PowerPC ISA.
24680
24681 @item -mhtm
24682 @itemx -mno-htm
24683 @opindex mhtm
24684 @opindex mno-htm
24685 Enable (disable) the use of the built-in functions that allow direct
24686 access to the Hardware Transactional Memory (HTM) instructions that
24687 were added in version 2.07 of the PowerPC ISA.
24688
24689 @item -mpower8-fusion
24690 @itemx -mno-power8-fusion
24691 @opindex mpower8-fusion
24692 @opindex mno-power8-fusion
24693 Generate code that keeps (does not keeps) some integer operations
24694 adjacent so that the instructions can be fused together on power8 and
24695 later processors.
24696
24697 @item -mpower8-vector
24698 @itemx -mno-power8-vector
24699 @opindex mpower8-vector
24700 @opindex mno-power8-vector
24701 Generate code that uses (does not use) the vector and scalar
24702 instructions that were added in version 2.07 of the PowerPC ISA. Also
24703 enable the use of built-in functions that allow more direct access to
24704 the vector instructions.
24705
24706 @item -mquad-memory
24707 @itemx -mno-quad-memory
24708 @opindex mquad-memory
24709 @opindex mno-quad-memory
24710 Generate code that uses (does not use) the non-atomic quad word memory
24711 instructions. The @option{-mquad-memory} option requires use of
24712 64-bit mode.
24713
24714 @item -mquad-memory-atomic
24715 @itemx -mno-quad-memory-atomic
24716 @opindex mquad-memory-atomic
24717 @opindex mno-quad-memory-atomic
24718 Generate code that uses (does not use) the atomic quad word memory
24719 instructions. The @option{-mquad-memory-atomic} option requires use of
24720 64-bit mode.
24721
24722 @item -mfloat128
24723 @itemx -mno-float128
24724 @opindex mfloat128
24725 @opindex mno-float128
24726 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24727 and use either software emulation for IEEE 128-bit floating point or
24728 hardware instructions.
24729
24730 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24731 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24732 use the IEEE 128-bit floating point support. The IEEE 128-bit
24733 floating point support only works on PowerPC Linux systems.
24734
24735 The default for @option{-mfloat128} is enabled on PowerPC Linux
24736 systems using the VSX instruction set, and disabled on other systems.
24737
24738 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24739 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24740 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24741 floating point instructions. Otherwise, if you do not specify to
24742 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24743 system, IEEE 128-bit floating point will be done with software
24744 emulation.
24745
24746 @item -mfloat128-hardware
24747 @itemx -mno-float128-hardware
24748 @opindex mfloat128-hardware
24749 @opindex mno-float128-hardware
24750 Enable/disable using ISA 3.0 hardware instructions to support the
24751 @var{__float128} data type.
24752
24753 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24754 Linux systems using the ISA 3.0 instruction set, and disabled on other
24755 systems.
24756
24757 @item -m32
24758 @itemx -m64
24759 @opindex m32
24760 @opindex m64
24761 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24762 targets (including GNU/Linux). The 32-bit environment sets int, long
24763 and pointer to 32 bits and generates code that runs on any PowerPC
24764 variant. The 64-bit environment sets int to 32 bits and long and
24765 pointer to 64 bits, and generates code for PowerPC64, as for
24766 @option{-mpowerpc64}.
24767
24768 @item -mfull-toc
24769 @itemx -mno-fp-in-toc
24770 @itemx -mno-sum-in-toc
24771 @itemx -mminimal-toc
24772 @opindex mfull-toc
24773 @opindex mno-fp-in-toc
24774 @opindex mno-sum-in-toc
24775 @opindex mminimal-toc
24776 Modify generation of the TOC (Table Of Contents), which is created for
24777 every executable file. The @option{-mfull-toc} option is selected by
24778 default. In that case, GCC allocates at least one TOC entry for
24779 each unique non-automatic variable reference in your program. GCC
24780 also places floating-point constants in the TOC@. However, only
24781 16,384 entries are available in the TOC@.
24782
24783 If you receive a linker error message that saying you have overflowed
24784 the available TOC space, you can reduce the amount of TOC space used
24785 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24786 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24787 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24788 generate code to calculate the sum of an address and a constant at
24789 run time instead of putting that sum into the TOC@. You may specify one
24790 or both of these options. Each causes GCC to produce very slightly
24791 slower and larger code at the expense of conserving TOC space.
24792
24793 If you still run out of space in the TOC even when you specify both of
24794 these options, specify @option{-mminimal-toc} instead. This option causes
24795 GCC to make only one TOC entry for every file. When you specify this
24796 option, GCC produces code that is slower and larger but which
24797 uses extremely little TOC space. You may wish to use this option
24798 only on files that contain less frequently-executed code.
24799
24800 @item -maix64
24801 @itemx -maix32
24802 @opindex maix64
24803 @opindex maix32
24804 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24805 @code{long} type, and the infrastructure needed to support them.
24806 Specifying @option{-maix64} implies @option{-mpowerpc64},
24807 while @option{-maix32} disables the 64-bit ABI and
24808 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24809
24810 @item -mxl-compat
24811 @itemx -mno-xl-compat
24812 @opindex mxl-compat
24813 @opindex mno-xl-compat
24814 Produce code that conforms more closely to IBM XL compiler semantics
24815 when using AIX-compatible ABI@. Pass floating-point arguments to
24816 prototyped functions beyond the register save area (RSA) on the stack
24817 in addition to argument FPRs. Do not assume that most significant
24818 double in 128-bit long double value is properly rounded when comparing
24819 values and converting to double. Use XL symbol names for long double
24820 support routines.
24821
24822 The AIX calling convention was extended but not initially documented to
24823 handle an obscure K&R C case of calling a function that takes the
24824 address of its arguments with fewer arguments than declared. IBM XL
24825 compilers access floating-point arguments that do not fit in the
24826 RSA from the stack when a subroutine is compiled without
24827 optimization. Because always storing floating-point arguments on the
24828 stack is inefficient and rarely needed, this option is not enabled by
24829 default and only is necessary when calling subroutines compiled by IBM
24830 XL compilers without optimization.
24831
24832 @item -mpe
24833 @opindex mpe
24834 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24835 application written to use message passing with special startup code to
24836 enable the application to run. The system must have PE installed in the
24837 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24838 must be overridden with the @option{-specs=} option to specify the
24839 appropriate directory location. The Parallel Environment does not
24840 support threads, so the @option{-mpe} option and the @option{-pthread}
24841 option are incompatible.
24842
24843 @item -malign-natural
24844 @itemx -malign-power
24845 @opindex malign-natural
24846 @opindex malign-power
24847 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24848 @option{-malign-natural} overrides the ABI-defined alignment of larger
24849 types, such as floating-point doubles, on their natural size-based boundary.
24850 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24851 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24852
24853 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24854 is not supported.
24855
24856 @item -msoft-float
24857 @itemx -mhard-float
24858 @opindex msoft-float
24859 @opindex mhard-float
24860 Generate code that does not use (uses) the floating-point register set.
24861 Software floating-point emulation is provided if you use the
24862 @option{-msoft-float} option, and pass the option to GCC when linking.
24863
24864 @item -mmultiple
24865 @itemx -mno-multiple
24866 @opindex mmultiple
24867 @opindex mno-multiple
24868 Generate code that uses (does not use) the load multiple word
24869 instructions and the store multiple word instructions. These
24870 instructions are generated by default on POWER systems, and not
24871 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24872 PowerPC systems, since those instructions do not work when the
24873 processor is in little-endian mode. The exceptions are PPC740 and
24874 PPC750 which permit these instructions in little-endian mode.
24875
24876 @item -mupdate
24877 @itemx -mno-update
24878 @opindex mupdate
24879 @opindex mno-update
24880 Generate code that uses (does not use) the load or store instructions
24881 that update the base register to the address of the calculated memory
24882 location. These instructions are generated by default. If you use
24883 @option{-mno-update}, there is a small window between the time that the
24884 stack pointer is updated and the address of the previous frame is
24885 stored, which means code that walks the stack frame across interrupts or
24886 signals may get corrupted data.
24887
24888 @item -mavoid-indexed-addresses
24889 @itemx -mno-avoid-indexed-addresses
24890 @opindex mavoid-indexed-addresses
24891 @opindex mno-avoid-indexed-addresses
24892 Generate code that tries to avoid (not avoid) the use of indexed load
24893 or store instructions. These instructions can incur a performance
24894 penalty on Power6 processors in certain situations, such as when
24895 stepping through large arrays that cross a 16M boundary. This option
24896 is enabled by default when targeting Power6 and disabled otherwise.
24897
24898 @item -mfused-madd
24899 @itemx -mno-fused-madd
24900 @opindex mfused-madd
24901 @opindex mno-fused-madd
24902 Generate code that uses (does not use) the floating-point multiply and
24903 accumulate instructions. These instructions are generated by default
24904 if hardware floating point is used. The machine-dependent
24905 @option{-mfused-madd} option is now mapped to the machine-independent
24906 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24907 mapped to @option{-ffp-contract=off}.
24908
24909 @item -mmulhw
24910 @itemx -mno-mulhw
24911 @opindex mmulhw
24912 @opindex mno-mulhw
24913 Generate code that uses (does not use) the half-word multiply and
24914 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24915 These instructions are generated by default when targeting those
24916 processors.
24917
24918 @item -mdlmzb
24919 @itemx -mno-dlmzb
24920 @opindex mdlmzb
24921 @opindex mno-dlmzb
24922 Generate code that uses (does not use) the string-search @samp{dlmzb}
24923 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24924 generated by default when targeting those processors.
24925
24926 @item -mno-bit-align
24927 @itemx -mbit-align
24928 @opindex mno-bit-align
24929 @opindex mbit-align
24930 On System V.4 and embedded PowerPC systems do not (do) force structures
24931 and unions that contain bit-fields to be aligned to the base type of the
24932 bit-field.
24933
24934 For example, by default a structure containing nothing but 8
24935 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24936 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24937 the structure is aligned to a 1-byte boundary and is 1 byte in
24938 size.
24939
24940 @item -mno-strict-align
24941 @itemx -mstrict-align
24942 @opindex mno-strict-align
24943 @opindex mstrict-align
24944 On System V.4 and embedded PowerPC systems do not (do) assume that
24945 unaligned memory references are handled by the system.
24946
24947 @item -mrelocatable
24948 @itemx -mno-relocatable
24949 @opindex mrelocatable
24950 @opindex mno-relocatable
24951 Generate code that allows (does not allow) a static executable to be
24952 relocated to a different address at run time. A simple embedded
24953 PowerPC system loader should relocate the entire contents of
24954 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24955 a table of 32-bit addresses generated by this option. For this to
24956 work, all objects linked together must be compiled with
24957 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24958 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24959
24960 @item -mrelocatable-lib
24961 @itemx -mno-relocatable-lib
24962 @opindex mrelocatable-lib
24963 @opindex mno-relocatable-lib
24964 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24965 @code{.fixup} section to allow static executables to be relocated at
24966 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24967 alignment of @option{-mrelocatable}. Objects compiled with
24968 @option{-mrelocatable-lib} may be linked with objects compiled with
24969 any combination of the @option{-mrelocatable} options.
24970
24971 @item -mno-toc
24972 @itemx -mtoc
24973 @opindex mno-toc
24974 @opindex mtoc
24975 On System V.4 and embedded PowerPC systems do not (do) assume that
24976 register 2 contains a pointer to a global area pointing to the addresses
24977 used in the program.
24978
24979 @item -mlittle
24980 @itemx -mlittle-endian
24981 @opindex mlittle
24982 @opindex mlittle-endian
24983 On System V.4 and embedded PowerPC systems compile code for the
24984 processor in little-endian mode. The @option{-mlittle-endian} option is
24985 the same as @option{-mlittle}.
24986
24987 @item -mbig
24988 @itemx -mbig-endian
24989 @opindex mbig
24990 @opindex mbig-endian
24991 On System V.4 and embedded PowerPC systems compile code for the
24992 processor in big-endian mode. The @option{-mbig-endian} option is
24993 the same as @option{-mbig}.
24994
24995 @item -mdynamic-no-pic
24996 @opindex mdynamic-no-pic
24997 On Darwin and Mac OS X systems, compile code so that it is not
24998 relocatable, but that its external references are relocatable. The
24999 resulting code is suitable for applications, but not shared
25000 libraries.
25001
25002 @item -msingle-pic-base
25003 @opindex msingle-pic-base
25004 Treat the register used for PIC addressing as read-only, rather than
25005 loading it in the prologue for each function. The runtime system is
25006 responsible for initializing this register with an appropriate value
25007 before execution begins.
25008
25009 @item -mprioritize-restricted-insns=@var{priority}
25010 @opindex mprioritize-restricted-insns
25011 This option controls the priority that is assigned to
25012 dispatch-slot restricted instructions during the second scheduling
25013 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
25014 or @samp{2} to assign no, highest, or second-highest (respectively)
25015 priority to dispatch-slot restricted
25016 instructions.
25017
25018 @item -msched-costly-dep=@var{dependence_type}
25019 @opindex msched-costly-dep
25020 This option controls which dependences are considered costly
25021 by the target during instruction scheduling. The argument
25022 @var{dependence_type} takes one of the following values:
25023
25024 @table @asis
25025 @item @samp{no}
25026 No dependence is costly.
25027
25028 @item @samp{all}
25029 All dependences are costly.
25030
25031 @item @samp{true_store_to_load}
25032 A true dependence from store to load is costly.
25033
25034 @item @samp{store_to_load}
25035 Any dependence from store to load is costly.
25036
25037 @item @var{number}
25038 Any dependence for which the latency is greater than or equal to
25039 @var{number} is costly.
25040 @end table
25041
25042 @item -minsert-sched-nops=@var{scheme}
25043 @opindex minsert-sched-nops
25044 This option controls which NOP insertion scheme is used during
25045 the second scheduling pass. The argument @var{scheme} takes one of the
25046 following values:
25047
25048 @table @asis
25049 @item @samp{no}
25050 Don't insert NOPs.
25051
25052 @item @samp{pad}
25053 Pad with NOPs any dispatch group that has vacant issue slots,
25054 according to the scheduler's grouping.
25055
25056 @item @samp{regroup_exact}
25057 Insert NOPs to force costly dependent insns into
25058 separate groups. Insert exactly as many NOPs as needed to force an insn
25059 to a new group, according to the estimated processor grouping.
25060
25061 @item @var{number}
25062 Insert NOPs to force costly dependent insns into
25063 separate groups. Insert @var{number} NOPs to force an insn to a new group.
25064 @end table
25065
25066 @item -mcall-sysv
25067 @opindex mcall-sysv
25068 On System V.4 and embedded PowerPC systems compile code using calling
25069 conventions that adhere to the March 1995 draft of the System V
25070 Application Binary Interface, PowerPC processor supplement. This is the
25071 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25072
25073 @item -mcall-sysv-eabi
25074 @itemx -mcall-eabi
25075 @opindex mcall-sysv-eabi
25076 @opindex mcall-eabi
25077 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25078
25079 @item -mcall-sysv-noeabi
25080 @opindex mcall-sysv-noeabi
25081 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25082
25083 @item -mcall-aixdesc
25084 @opindex m
25085 On System V.4 and embedded PowerPC systems compile code for the AIX
25086 operating system.
25087
25088 @item -mcall-linux
25089 @opindex mcall-linux
25090 On System V.4 and embedded PowerPC systems compile code for the
25091 Linux-based GNU system.
25092
25093 @item -mcall-freebsd
25094 @opindex mcall-freebsd
25095 On System V.4 and embedded PowerPC systems compile code for the
25096 FreeBSD operating system.
25097
25098 @item -mcall-netbsd
25099 @opindex mcall-netbsd
25100 On System V.4 and embedded PowerPC systems compile code for the
25101 NetBSD operating system.
25102
25103 @item -mcall-openbsd
25104 @opindex mcall-netbsd
25105 On System V.4 and embedded PowerPC systems compile code for the
25106 OpenBSD operating system.
25107
25108 @item -mtraceback=@var{traceback_type}
25109 @opindex mtraceback
25110 Select the type of traceback table. Valid values for @var{traceback_type}
25111 are @samp{full}, @samp{part}, and @samp{no}.
25112
25113 @item -maix-struct-return
25114 @opindex maix-struct-return
25115 Return all structures in memory (as specified by the AIX ABI)@.
25116
25117 @item -msvr4-struct-return
25118 @opindex msvr4-struct-return
25119 Return structures smaller than 8 bytes in registers (as specified by the
25120 SVR4 ABI)@.
25121
25122 @item -mabi=@var{abi-type}
25123 @opindex mabi
25124 Extend the current ABI with a particular extension, or remove such extension.
25125 Valid values are @samp{altivec}, @samp{no-altivec},
25126 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25127 @samp{elfv1}, @samp{elfv2}@.
25128
25129 @item -mabi=ibmlongdouble
25130 @opindex mabi=ibmlongdouble
25131 Change the current ABI to use IBM extended-precision long double.
25132 This is not likely to work if your system defaults to using IEEE
25133 extended-precision long double. If you change the long double type
25134 from IEEE extended-precision, the compiler will issue a warning unless
25135 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25136 to be enabled.
25137
25138 @item -mabi=ieeelongdouble
25139 @opindex mabi=ieeelongdouble
25140 Change the current ABI to use IEEE extended-precision long double.
25141 This is not likely to work if your system defaults to using IBM
25142 extended-precision long double. If you change the long double type
25143 from IBM extended-precision, the compiler will issue a warning unless
25144 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25145 to be enabled.
25146
25147 @item -mabi=elfv1
25148 @opindex mabi=elfv1
25149 Change the current ABI to use the ELFv1 ABI.
25150 This is the default ABI for big-endian PowerPC 64-bit Linux.
25151 Overriding the default ABI requires special system support and is
25152 likely to fail in spectacular ways.
25153
25154 @item -mabi=elfv2
25155 @opindex mabi=elfv2
25156 Change the current ABI to use the ELFv2 ABI.
25157 This is the default ABI for little-endian PowerPC 64-bit Linux.
25158 Overriding the default ABI requires special system support and is
25159 likely to fail in spectacular ways.
25160
25161 @item -mgnu-attribute
25162 @itemx -mno-gnu-attribute
25163 @opindex mgnu-attribute
25164 @opindex mno-gnu-attribute
25165 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25166 .gnu.attributes section that specify ABI variations in function
25167 parameters or return values.
25168
25169 @item -mprototype
25170 @itemx -mno-prototype
25171 @opindex mprototype
25172 @opindex mno-prototype
25173 On System V.4 and embedded PowerPC systems assume that all calls to
25174 variable argument functions are properly prototyped. Otherwise, the
25175 compiler must insert an instruction before every non-prototyped call to
25176 set or clear bit 6 of the condition code register (@code{CR}) to
25177 indicate whether floating-point values are passed in the floating-point
25178 registers in case the function takes variable arguments. With
25179 @option{-mprototype}, only calls to prototyped variable argument functions
25180 set or clear the bit.
25181
25182 @item -msim
25183 @opindex msim
25184 On embedded PowerPC systems, assume that the startup module is called
25185 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25186 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25187 configurations.
25188
25189 @item -mmvme
25190 @opindex mmvme
25191 On embedded PowerPC systems, assume that the startup module is called
25192 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25193 @file{libc.a}.
25194
25195 @item -mads
25196 @opindex mads
25197 On embedded PowerPC systems, assume that the startup module is called
25198 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25199 @file{libc.a}.
25200
25201 @item -myellowknife
25202 @opindex myellowknife
25203 On embedded PowerPC systems, assume that the startup module is called
25204 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25205 @file{libc.a}.
25206
25207 @item -mvxworks
25208 @opindex mvxworks
25209 On System V.4 and embedded PowerPC systems, specify that you are
25210 compiling for a VxWorks system.
25211
25212 @item -memb
25213 @opindex memb
25214 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25215 header to indicate that @samp{eabi} extended relocations are used.
25216
25217 @item -meabi
25218 @itemx -mno-eabi
25219 @opindex meabi
25220 @opindex mno-eabi
25221 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25222 Embedded Applications Binary Interface (EABI), which is a set of
25223 modifications to the System V.4 specifications. Selecting @option{-meabi}
25224 means that the stack is aligned to an 8-byte boundary, a function
25225 @code{__eabi} is called from @code{main} to set up the EABI
25226 environment, and the @option{-msdata} option can use both @code{r2} and
25227 @code{r13} to point to two separate small data areas. Selecting
25228 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25229 no EABI initialization function is called from @code{main}, and the
25230 @option{-msdata} option only uses @code{r13} to point to a single
25231 small data area. The @option{-meabi} option is on by default if you
25232 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25233
25234 @item -msdata=eabi
25235 @opindex msdata=eabi
25236 On System V.4 and embedded PowerPC systems, put small initialized
25237 @code{const} global and static data in the @code{.sdata2} section, which
25238 is pointed to by register @code{r2}. Put small initialized
25239 non-@code{const} global and static data in the @code{.sdata} section,
25240 which is pointed to by register @code{r13}. Put small uninitialized
25241 global and static data in the @code{.sbss} section, which is adjacent to
25242 the @code{.sdata} section. The @option{-msdata=eabi} option is
25243 incompatible with the @option{-mrelocatable} option. The
25244 @option{-msdata=eabi} option also sets the @option{-memb} option.
25245
25246 @item -msdata=sysv
25247 @opindex msdata=sysv
25248 On System V.4 and embedded PowerPC systems, put small global and static
25249 data in the @code{.sdata} section, which is pointed to by register
25250 @code{r13}. Put small uninitialized global and static data in the
25251 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25252 The @option{-msdata=sysv} option is incompatible with the
25253 @option{-mrelocatable} option.
25254
25255 @item -msdata=default
25256 @itemx -msdata
25257 @opindex msdata=default
25258 @opindex msdata
25259 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25260 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25261 same as @option{-msdata=sysv}.
25262
25263 @item -msdata=data
25264 @opindex msdata=data
25265 On System V.4 and embedded PowerPC systems, put small global
25266 data in the @code{.sdata} section. Put small uninitialized global
25267 data in the @code{.sbss} section. Do not use register @code{r13}
25268 to address small data however. This is the default behavior unless
25269 other @option{-msdata} options are used.
25270
25271 @item -msdata=none
25272 @itemx -mno-sdata
25273 @opindex msdata=none
25274 @opindex mno-sdata
25275 On embedded PowerPC systems, put all initialized global and static data
25276 in the @code{.data} section, and all uninitialized data in the
25277 @code{.bss} section.
25278
25279 @item -mreadonly-in-sdata
25280 @opindex mreadonly-in-sdata
25281 @opindex mno-readonly-in-sdata
25282 Put read-only objects in the @code{.sdata} section as well. This is the
25283 default.
25284
25285 @item -mblock-move-inline-limit=@var{num}
25286 @opindex mblock-move-inline-limit
25287 Inline all block moves (such as calls to @code{memcpy} or structure
25288 copies) less than or equal to @var{num} bytes. The minimum value for
25289 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25290 targets. The default value is target-specific.
25291
25292 @item -mblock-compare-inline-limit=@var{num}
25293 @opindex mblock-compare-inline-limit
25294 Generate non-looping inline code for all block compares (such as calls
25295 to @code{memcmp} or structure compares) less than or equal to @var{num}
25296 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25297 block compare is disabled. The default value is target-specific.
25298
25299 @item -mblock-compare-inline-loop-limit=@var{num}
25300 @opindex mblock-compare-inline-loop-limit
25301 Generate an inline expansion using loop code for all block compares that
25302 are less than or equal to @var{num} bytes, but greater than the limit
25303 for non-loop inline block compare expansion. If the block length is not
25304 constant, at most @var{num} bytes will be compared before @code{memcmp}
25305 is called to compare the remainder of the block. The default value is
25306 target-specific.
25307
25308 @item -mstring-compare-inline-limit=@var{num}
25309 @opindex mstring-compare-inline-limit
25310 Compare at most @var{num} string bytes with inline code.
25311 If the difference or end of string is not found at the
25312 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25313 take care of the rest of the comparison. The default is 64 bytes.
25314
25315 @item -G @var{num}
25316 @opindex G
25317 @cindex smaller data references (PowerPC)
25318 @cindex .sdata/.sdata2 references (PowerPC)
25319 On embedded PowerPC systems, put global and static items less than or
25320 equal to @var{num} bytes into the small data or BSS sections instead of
25321 the normal data or BSS section. By default, @var{num} is 8. The
25322 @option{-G @var{num}} switch is also passed to the linker.
25323 All modules should be compiled with the same @option{-G @var{num}} value.
25324
25325 @item -mregnames
25326 @itemx -mno-regnames
25327 @opindex mregnames
25328 @opindex mno-regnames
25329 On System V.4 and embedded PowerPC systems do (do not) emit register
25330 names in the assembly language output using symbolic forms.
25331
25332 @item -mlongcall
25333 @itemx -mno-longcall
25334 @opindex mlongcall
25335 @opindex mno-longcall
25336 By default assume that all calls are far away so that a longer and more
25337 expensive calling sequence is required. This is required for calls
25338 farther than 32 megabytes (33,554,432 bytes) from the current location.
25339 A short call is generated if the compiler knows
25340 the call cannot be that far away. This setting can be overridden by
25341 the @code{shortcall} function attribute, or by @code{#pragma
25342 longcall(0)}.
25343
25344 Some linkers are capable of detecting out-of-range calls and generating
25345 glue code on the fly. On these systems, long calls are unnecessary and
25346 generate slower code. As of this writing, the AIX linker can do this,
25347 as can the GNU linker for PowerPC/64. It is planned to add this feature
25348 to the GNU linker for 32-bit PowerPC systems as well.
25349
25350 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25351 GCC can generate long calls using an inline PLT call sequence (see
25352 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25353 ELFv1 (big-endian) do not support inline PLT calls.
25354
25355 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25356 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25357 addresses represent the callee and the branch island. The
25358 Darwin/PPC linker prefers the first address and generates a @code{bl
25359 callee} if the PPC @code{bl} instruction reaches the callee directly;
25360 otherwise, the linker generates @code{bl L42} to call the branch
25361 island. The branch island is appended to the body of the
25362 calling function; it computes the full 32-bit address of the callee
25363 and jumps to it.
25364
25365 On Mach-O (Darwin) systems, this option directs the compiler emit to
25366 the glue for every direct call, and the Darwin linker decides whether
25367 to use or discard it.
25368
25369 In the future, GCC may ignore all longcall specifications
25370 when the linker is known to generate glue.
25371
25372 @item -mpltseq
25373 @itemx -mno-pltseq
25374 @opindex mpltseq
25375 @opindex mno-pltseq
25376 Implement (do not implement) -fno-plt and long calls using an inline
25377 PLT call sequence that supports lazy linking and long calls to
25378 functions in dlopen'd shared libraries. Inline PLT calls are only
25379 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25380 linkers, and are enabled by default if the support is detected when
25381 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25382 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25383 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25384 linked together.
25385
25386 @item -mtls-markers
25387 @itemx -mno-tls-markers
25388 @opindex mtls-markers
25389 @opindex mno-tls-markers
25390 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25391 specifying the function argument. The relocation allows the linker to
25392 reliably associate function call with argument setup instructions for
25393 TLS optimization, which in turn allows GCC to better schedule the
25394 sequence.
25395
25396 @item -mrecip
25397 @itemx -mno-recip
25398 @opindex mrecip
25399 This option enables use of the reciprocal estimate and
25400 reciprocal square root estimate instructions with additional
25401 Newton-Raphson steps to increase precision instead of doing a divide or
25402 square root and divide for floating-point arguments. You should use
25403 the @option{-ffast-math} option when using @option{-mrecip} (or at
25404 least @option{-funsafe-math-optimizations},
25405 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25406 @option{-fno-trapping-math}). Note that while the throughput of the
25407 sequence is generally higher than the throughput of the non-reciprocal
25408 instruction, the precision of the sequence can be decreased by up to 2
25409 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25410 roots.
25411
25412 @item -mrecip=@var{opt}
25413 @opindex mrecip=opt
25414 This option controls which reciprocal estimate instructions
25415 may be used. @var{opt} is a comma-separated list of options, which may
25416 be preceded by a @code{!} to invert the option:
25417
25418 @table @samp
25419
25420 @item all
25421 Enable all estimate instructions.
25422
25423 @item default
25424 Enable the default instructions, equivalent to @option{-mrecip}.
25425
25426 @item none
25427 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25428
25429 @item div
25430 Enable the reciprocal approximation instructions for both
25431 single and double precision.
25432
25433 @item divf
25434 Enable the single-precision reciprocal approximation instructions.
25435
25436 @item divd
25437 Enable the double-precision reciprocal approximation instructions.
25438
25439 @item rsqrt
25440 Enable the reciprocal square root approximation instructions for both
25441 single and double precision.
25442
25443 @item rsqrtf
25444 Enable the single-precision reciprocal square root approximation instructions.
25445
25446 @item rsqrtd
25447 Enable the double-precision reciprocal square root approximation instructions.
25448
25449 @end table
25450
25451 So, for example, @option{-mrecip=all,!rsqrtd} enables
25452 all of the reciprocal estimate instructions, except for the
25453 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25454 which handle the double-precision reciprocal square root calculations.
25455
25456 @item -mrecip-precision
25457 @itemx -mno-recip-precision
25458 @opindex mrecip-precision
25459 Assume (do not assume) that the reciprocal estimate instructions
25460 provide higher-precision estimates than is mandated by the PowerPC
25461 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25462 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25463 The double-precision square root estimate instructions are not generated by
25464 default on low-precision machines, since they do not provide an
25465 estimate that converges after three steps.
25466
25467 @item -mveclibabi=@var{type}
25468 @opindex mveclibabi
25469 Specifies the ABI type to use for vectorizing intrinsics using an
25470 external library. The only type supported at present is @samp{mass},
25471 which specifies to use IBM's Mathematical Acceleration Subsystem
25472 (MASS) libraries for vectorizing intrinsics using external libraries.
25473 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25474 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25475 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25476 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25477 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25478 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25479 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25480 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25481 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25482 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25483 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25484 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25485 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25486 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25487 for power7. Both @option{-ftree-vectorize} and
25488 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25489 libraries must be specified at link time.
25490
25491 @item -mfriz
25492 @itemx -mno-friz
25493 @opindex mfriz
25494 Generate (do not generate) the @code{friz} instruction when the
25495 @option{-funsafe-math-optimizations} option is used to optimize
25496 rounding of floating-point values to 64-bit integer and back to floating
25497 point. The @code{friz} instruction does not return the same value if
25498 the floating-point number is too large to fit in an integer.
25499
25500 @item -mpointers-to-nested-functions
25501 @itemx -mno-pointers-to-nested-functions
25502 @opindex mpointers-to-nested-functions
25503 Generate (do not generate) code to load up the static chain register
25504 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25505 systems where a function pointer points to a 3-word descriptor giving
25506 the function address, TOC value to be loaded in register @code{r2}, and
25507 static chain value to be loaded in register @code{r11}. The
25508 @option{-mpointers-to-nested-functions} is on by default. You cannot
25509 call through pointers to nested functions or pointers
25510 to functions compiled in other languages that use the static chain if
25511 you use @option{-mno-pointers-to-nested-functions}.
25512
25513 @item -msave-toc-indirect
25514 @itemx -mno-save-toc-indirect
25515 @opindex msave-toc-indirect
25516 Generate (do not generate) code to save the TOC value in the reserved
25517 stack location in the function prologue if the function calls through
25518 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25519 saved in the prologue, it is saved just before the call through the
25520 pointer. The @option{-mno-save-toc-indirect} option is the default.
25521
25522 @item -mcompat-align-parm
25523 @itemx -mno-compat-align-parm
25524 @opindex mcompat-align-parm
25525 Generate (do not generate) code to pass structure parameters with a
25526 maximum alignment of 64 bits, for compatibility with older versions
25527 of GCC.
25528
25529 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25530 structure parameter on a 128-bit boundary when that structure contained
25531 a member requiring 128-bit alignment. This is corrected in more
25532 recent versions of GCC. This option may be used to generate code
25533 that is compatible with functions compiled with older versions of
25534 GCC.
25535
25536 The @option{-mno-compat-align-parm} option is the default.
25537
25538 @item -mstack-protector-guard=@var{guard}
25539 @itemx -mstack-protector-guard-reg=@var{reg}
25540 @itemx -mstack-protector-guard-offset=@var{offset}
25541 @itemx -mstack-protector-guard-symbol=@var{symbol}
25542 @opindex mstack-protector-guard
25543 @opindex mstack-protector-guard-reg
25544 @opindex mstack-protector-guard-offset
25545 @opindex mstack-protector-guard-symbol
25546 Generate stack protection code using canary at @var{guard}. Supported
25547 locations are @samp{global} for global canary or @samp{tls} for per-thread
25548 canary in the TLS block (the default with GNU libc version 2.4 or later).
25549
25550 With the latter choice the options
25551 @option{-mstack-protector-guard-reg=@var{reg}} and
25552 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25553 which register to use as base register for reading the canary, and from what
25554 offset from that base register. The default for those is as specified in the
25555 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25556 the offset with a symbol reference to a canary in the TLS block.
25557
25558 @item -mpcrel
25559 @itemx -mno-pcrel
25560 @opindex mpcrel
25561 @opindex mno-pcrel
25562 Generate (do not generate) pc-relative addressing when the option
25563 @option{-mcpu=future} is used.
25564 @end table
25565
25566 @node RX Options
25567 @subsection RX Options
25568 @cindex RX Options
25569
25570 These command-line options are defined for RX targets:
25571
25572 @table @gcctabopt
25573 @item -m64bit-doubles
25574 @itemx -m32bit-doubles
25575 @opindex m64bit-doubles
25576 @opindex m32bit-doubles
25577 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25578 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25579 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25580 works on 32-bit values, which is why the default is
25581 @option{-m32bit-doubles}.
25582
25583 @item -fpu
25584 @itemx -nofpu
25585 @opindex fpu
25586 @opindex nofpu
25587 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25588 floating-point hardware. The default is enabled for the RX600
25589 series and disabled for the RX200 series.
25590
25591 Floating-point instructions are only generated for 32-bit floating-point
25592 values, however, so the FPU hardware is not used for doubles if the
25593 @option{-m64bit-doubles} option is used.
25594
25595 @emph{Note} If the @option{-fpu} option is enabled then
25596 @option{-funsafe-math-optimizations} is also enabled automatically.
25597 This is because the RX FPU instructions are themselves unsafe.
25598
25599 @item -mcpu=@var{name}
25600 @opindex mcpu
25601 Selects the type of RX CPU to be targeted. Currently three types are
25602 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25603 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25604
25605 The only difference between @samp{RX600} and @samp{RX610} is that the
25606 @samp{RX610} does not support the @code{MVTIPL} instruction.
25607
25608 The @samp{RX200} series does not have a hardware floating-point unit
25609 and so @option{-nofpu} is enabled by default when this type is
25610 selected.
25611
25612 @item -mbig-endian-data
25613 @itemx -mlittle-endian-data
25614 @opindex mbig-endian-data
25615 @opindex mlittle-endian-data
25616 Store data (but not code) in the big-endian format. The default is
25617 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25618 format.
25619
25620 @item -msmall-data-limit=@var{N}
25621 @opindex msmall-data-limit
25622 Specifies the maximum size in bytes of global and static variables
25623 which can be placed into the small data area. Using the small data
25624 area can lead to smaller and faster code, but the size of area is
25625 limited and it is up to the programmer to ensure that the area does
25626 not overflow. Also when the small data area is used one of the RX's
25627 registers (usually @code{r13}) is reserved for use pointing to this
25628 area, so it is no longer available for use by the compiler. This
25629 could result in slower and/or larger code if variables are pushed onto
25630 the stack instead of being held in this register.
25631
25632 Note, common variables (variables that have not been initialized) and
25633 constants are not placed into the small data area as they are assigned
25634 to other sections in the output executable.
25635
25636 The default value is zero, which disables this feature. Note, this
25637 feature is not enabled by default with higher optimization levels
25638 (@option{-O2} etc) because of the potentially detrimental effects of
25639 reserving a register. It is up to the programmer to experiment and
25640 discover whether this feature is of benefit to their program. See the
25641 description of the @option{-mpid} option for a description of how the
25642 actual register to hold the small data area pointer is chosen.
25643
25644 @item -msim
25645 @itemx -mno-sim
25646 @opindex msim
25647 @opindex mno-sim
25648 Use the simulator runtime. The default is to use the libgloss
25649 board-specific runtime.
25650
25651 @item -mas100-syntax
25652 @itemx -mno-as100-syntax
25653 @opindex mas100-syntax
25654 @opindex mno-as100-syntax
25655 When generating assembler output use a syntax that is compatible with
25656 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25657 assembler, but it has some restrictions so it is not generated by default.
25658
25659 @item -mmax-constant-size=@var{N}
25660 @opindex mmax-constant-size
25661 Specifies the maximum size, in bytes, of a constant that can be used as
25662 an operand in a RX instruction. Although the RX instruction set does
25663 allow constants of up to 4 bytes in length to be used in instructions,
25664 a longer value equates to a longer instruction. Thus in some
25665 circumstances it can be beneficial to restrict the size of constants
25666 that are used in instructions. Constants that are too big are instead
25667 placed into a constant pool and referenced via register indirection.
25668
25669 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25670 or 4 means that constants of any size are allowed.
25671
25672 @item -mrelax
25673 @opindex mrelax
25674 Enable linker relaxation. Linker relaxation is a process whereby the
25675 linker attempts to reduce the size of a program by finding shorter
25676 versions of various instructions. Disabled by default.
25677
25678 @item -mint-register=@var{N}
25679 @opindex mint-register
25680 Specify the number of registers to reserve for fast interrupt handler
25681 functions. The value @var{N} can be between 0 and 4. A value of 1
25682 means that register @code{r13} is reserved for the exclusive use
25683 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25684 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25685 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25686 A value of 0, the default, does not reserve any registers.
25687
25688 @item -msave-acc-in-interrupts
25689 @opindex msave-acc-in-interrupts
25690 Specifies that interrupt handler functions should preserve the
25691 accumulator register. This is only necessary if normal code might use
25692 the accumulator register, for example because it performs 64-bit
25693 multiplications. The default is to ignore the accumulator as this
25694 makes the interrupt handlers faster.
25695
25696 @item -mpid
25697 @itemx -mno-pid
25698 @opindex mpid
25699 @opindex mno-pid
25700 Enables the generation of position independent data. When enabled any
25701 access to constant data is done via an offset from a base address
25702 held in a register. This allows the location of constant data to be
25703 determined at run time without requiring the executable to be
25704 relocated, which is a benefit to embedded applications with tight
25705 memory constraints. Data that can be modified is not affected by this
25706 option.
25707
25708 Note, using this feature reserves a register, usually @code{r13}, for
25709 the constant data base address. This can result in slower and/or
25710 larger code, especially in complicated functions.
25711
25712 The actual register chosen to hold the constant data base address
25713 depends upon whether the @option{-msmall-data-limit} and/or the
25714 @option{-mint-register} command-line options are enabled. Starting
25715 with register @code{r13} and proceeding downwards, registers are
25716 allocated first to satisfy the requirements of @option{-mint-register},
25717 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25718 is possible for the small data area register to be @code{r8} if both
25719 @option{-mint-register=4} and @option{-mpid} are specified on the
25720 command line.
25721
25722 By default this feature is not enabled. The default can be restored
25723 via the @option{-mno-pid} command-line option.
25724
25725 @item -mno-warn-multiple-fast-interrupts
25726 @itemx -mwarn-multiple-fast-interrupts
25727 @opindex mno-warn-multiple-fast-interrupts
25728 @opindex mwarn-multiple-fast-interrupts
25729 Prevents GCC from issuing a warning message if it finds more than one
25730 fast interrupt handler when it is compiling a file. The default is to
25731 issue a warning for each extra fast interrupt handler found, as the RX
25732 only supports one such interrupt.
25733
25734 @item -mallow-string-insns
25735 @itemx -mno-allow-string-insns
25736 @opindex mallow-string-insns
25737 @opindex mno-allow-string-insns
25738 Enables or disables the use of the string manipulation instructions
25739 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25740 @code{SWHILE} and also the @code{RMPA} instruction. These
25741 instructions may prefetch data, which is not safe to do if accessing
25742 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25743 for more information).
25744
25745 The default is to allow these instructions, but it is not possible for
25746 GCC to reliably detect all circumstances where a string instruction
25747 might be used to access an I/O register, so their use cannot be
25748 disabled automatically. Instead it is reliant upon the programmer to
25749 use the @option{-mno-allow-string-insns} option if their program
25750 accesses I/O space.
25751
25752 When the instructions are enabled GCC defines the C preprocessor
25753 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25754 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25755
25756 @item -mjsr
25757 @itemx -mno-jsr
25758 @opindex mjsr
25759 @opindex mno-jsr
25760 Use only (or not only) @code{JSR} instructions to access functions.
25761 This option can be used when code size exceeds the range of @code{BSR}
25762 instructions. Note that @option{-mno-jsr} does not mean to not use
25763 @code{JSR} but instead means that any type of branch may be used.
25764 @end table
25765
25766 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25767 has special significance to the RX port when used with the
25768 @code{interrupt} function attribute. This attribute indicates a
25769 function intended to process fast interrupts. GCC ensures
25770 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25771 and/or @code{r13} and only provided that the normal use of the
25772 corresponding registers have been restricted via the
25773 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25774 options.
25775
25776 @node S/390 and zSeries Options
25777 @subsection S/390 and zSeries Options
25778 @cindex S/390 and zSeries Options
25779
25780 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25781
25782 @table @gcctabopt
25783 @item -mhard-float
25784 @itemx -msoft-float
25785 @opindex mhard-float
25786 @opindex msoft-float
25787 Use (do not use) the hardware floating-point instructions and registers
25788 for floating-point operations. When @option{-msoft-float} is specified,
25789 functions in @file{libgcc.a} are used to perform floating-point
25790 operations. When @option{-mhard-float} is specified, the compiler
25791 generates IEEE floating-point instructions. This is the default.
25792
25793 @item -mhard-dfp
25794 @itemx -mno-hard-dfp
25795 @opindex mhard-dfp
25796 @opindex mno-hard-dfp
25797 Use (do not use) the hardware decimal-floating-point instructions for
25798 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25799 specified, functions in @file{libgcc.a} are used to perform
25800 decimal-floating-point operations. When @option{-mhard-dfp} is
25801 specified, the compiler generates decimal-floating-point hardware
25802 instructions. This is the default for @option{-march=z9-ec} or higher.
25803
25804 @item -mlong-double-64
25805 @itemx -mlong-double-128
25806 @opindex mlong-double-64
25807 @opindex mlong-double-128
25808 These switches control the size of @code{long double} type. A size
25809 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25810 type. This is the default.
25811
25812 @item -mbackchain
25813 @itemx -mno-backchain
25814 @opindex mbackchain
25815 @opindex mno-backchain
25816 Store (do not store) the address of the caller's frame as backchain pointer
25817 into the callee's stack frame.
25818 A backchain may be needed to allow debugging using tools that do not understand
25819 DWARF call frame information.
25820 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25821 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25822 the backchain is placed into the topmost word of the 96/160 byte register
25823 save area.
25824
25825 In general, code compiled with @option{-mbackchain} is call-compatible with
25826 code compiled with @option{-mmo-backchain}; however, use of the backchain
25827 for debugging purposes usually requires that the whole binary is built with
25828 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25829 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25830 to build a linux kernel use @option{-msoft-float}.
25831
25832 The default is to not maintain the backchain.
25833
25834 @item -mpacked-stack
25835 @itemx -mno-packed-stack
25836 @opindex mpacked-stack
25837 @opindex mno-packed-stack
25838 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25839 specified, the compiler uses the all fields of the 96/160 byte register save
25840 area only for their default purpose; unused fields still take up stack space.
25841 When @option{-mpacked-stack} is specified, register save slots are densely
25842 packed at the top of the register save area; unused space is reused for other
25843 purposes, allowing for more efficient use of the available stack space.
25844 However, when @option{-mbackchain} is also in effect, the topmost word of
25845 the save area is always used to store the backchain, and the return address
25846 register is always saved two words below the backchain.
25847
25848 As long as the stack frame backchain is not used, code generated with
25849 @option{-mpacked-stack} is call-compatible with code generated with
25850 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25851 S/390 or zSeries generated code that uses the stack frame backchain at run
25852 time, not just for debugging purposes. Such code is not call-compatible
25853 with code compiled with @option{-mpacked-stack}. Also, note that the
25854 combination of @option{-mbackchain},
25855 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25856 to build a linux kernel use @option{-msoft-float}.
25857
25858 The default is to not use the packed stack layout.
25859
25860 @item -msmall-exec
25861 @itemx -mno-small-exec
25862 @opindex msmall-exec
25863 @opindex mno-small-exec
25864 Generate (or do not generate) code using the @code{bras} instruction
25865 to do subroutine calls.
25866 This only works reliably if the total executable size does not
25867 exceed 64k. The default is to use the @code{basr} instruction instead,
25868 which does not have this limitation.
25869
25870 @item -m64
25871 @itemx -m31
25872 @opindex m64
25873 @opindex m31
25874 When @option{-m31} is specified, generate code compliant to the
25875 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25876 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25877 particular to generate 64-bit instructions. For the @samp{s390}
25878 targets, the default is @option{-m31}, while the @samp{s390x}
25879 targets default to @option{-m64}.
25880
25881 @item -mzarch
25882 @itemx -mesa
25883 @opindex mzarch
25884 @opindex mesa
25885 When @option{-mzarch} is specified, generate code using the
25886 instructions available on z/Architecture.
25887 When @option{-mesa} is specified, generate code using the
25888 instructions available on ESA/390. Note that @option{-mesa} is
25889 not possible with @option{-m64}.
25890 When generating code compliant to the GNU/Linux for S/390 ABI,
25891 the default is @option{-mesa}. When generating code compliant
25892 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25893
25894 @item -mhtm
25895 @itemx -mno-htm
25896 @opindex mhtm
25897 @opindex mno-htm
25898 The @option{-mhtm} option enables a set of builtins making use of
25899 instructions available with the transactional execution facility
25900 introduced with the IBM zEnterprise EC12 machine generation
25901 @ref{S/390 System z Built-in Functions}.
25902 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25903
25904 @item -mvx
25905 @itemx -mno-vx
25906 @opindex mvx
25907 @opindex mno-vx
25908 When @option{-mvx} is specified, generate code using the instructions
25909 available with the vector extension facility introduced with the IBM
25910 z13 machine generation.
25911 This option changes the ABI for some vector type values with regard to
25912 alignment and calling conventions. In case vector type values are
25913 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25914 command will be added to mark the resulting binary with the ABI used.
25915 @option{-mvx} is enabled by default when using @option{-march=z13}.
25916
25917 @item -mzvector
25918 @itemx -mno-zvector
25919 @opindex mzvector
25920 @opindex mno-zvector
25921 The @option{-mzvector} option enables vector language extensions and
25922 builtins using instructions available with the vector extension
25923 facility introduced with the IBM z13 machine generation.
25924 This option adds support for @samp{vector} to be used as a keyword to
25925 define vector type variables and arguments. @samp{vector} is only
25926 available when GNU extensions are enabled. It will not be expanded
25927 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25928 In addition to the GCC low-level builtins @option{-mzvector} enables
25929 a set of builtins added for compatibility with AltiVec-style
25930 implementations like Power and Cell. In order to make use of these
25931 builtins the header file @file{vecintrin.h} needs to be included.
25932 @option{-mzvector} is disabled by default.
25933
25934 @item -mmvcle
25935 @itemx -mno-mvcle
25936 @opindex mmvcle
25937 @opindex mno-mvcle
25938 Generate (or do not generate) code using the @code{mvcle} instruction
25939 to perform block moves. When @option{-mno-mvcle} is specified,
25940 use a @code{mvc} loop instead. This is the default unless optimizing for
25941 size.
25942
25943 @item -mdebug
25944 @itemx -mno-debug
25945 @opindex mdebug
25946 @opindex mno-debug
25947 Print (or do not print) additional debug information when compiling.
25948 The default is to not print debug information.
25949
25950 @item -march=@var{cpu-type}
25951 @opindex march
25952 Generate code that runs on @var{cpu-type}, which is the name of a
25953 system representing a certain processor type. Possible values for
25954 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25955 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25956 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25957 @samp{z14}/@samp{arch12}, and @samp{native}.
25958
25959 The default is @option{-march=z900}.
25960
25961 Specifying @samp{native} as cpu type can be used to select the best
25962 architecture option for the host processor.
25963 @option{-march=native} has no effect if GCC does not recognize the
25964 processor.
25965
25966 @item -mtune=@var{cpu-type}
25967 @opindex mtune
25968 Tune to @var{cpu-type} everything applicable about the generated code,
25969 except for the ABI and the set of available instructions.
25970 The list of @var{cpu-type} values is the same as for @option{-march}.
25971 The default is the value used for @option{-march}.
25972
25973 @item -mtpf-trace
25974 @itemx -mno-tpf-trace
25975 @opindex mtpf-trace
25976 @opindex mno-tpf-trace
25977 Generate code that adds (does not add) in TPF OS specific branches to trace
25978 routines in the operating system. This option is off by default, even
25979 when compiling for the TPF OS@.
25980
25981 @item -mfused-madd
25982 @itemx -mno-fused-madd
25983 @opindex mfused-madd
25984 @opindex mno-fused-madd
25985 Generate code that uses (does not use) the floating-point multiply and
25986 accumulate instructions. These instructions are generated by default if
25987 hardware floating point is used.
25988
25989 @item -mwarn-framesize=@var{framesize}
25990 @opindex mwarn-framesize
25991 Emit a warning if the current function exceeds the given frame size. Because
25992 this is a compile-time check it doesn't need to be a real problem when the program
25993 runs. It is intended to identify functions that most probably cause
25994 a stack overflow. It is useful to be used in an environment with limited stack
25995 size e.g.@: the linux kernel.
25996
25997 @item -mwarn-dynamicstack
25998 @opindex mwarn-dynamicstack
25999 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
26000 arrays. This is generally a bad idea with a limited stack size.
26001
26002 @item -mstack-guard=@var{stack-guard}
26003 @itemx -mstack-size=@var{stack-size}
26004 @opindex mstack-guard
26005 @opindex mstack-size
26006 If these options are provided the S/390 back end emits additional instructions in
26007 the function prologue that trigger a trap if the stack size is @var{stack-guard}
26008 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
26009 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
26010 the frame size of the compiled function is chosen.
26011 These options are intended to be used to help debugging stack overflow problems.
26012 The additionally emitted code causes only little overhead and hence can also be
26013 used in production-like systems without greater performance degradation. The given
26014 values have to be exact powers of 2 and @var{stack-size} has to be greater than
26015 @var{stack-guard} without exceeding 64k.
26016 In order to be efficient the extra code makes the assumption that the stack starts
26017 at an address aligned to the value given by @var{stack-size}.
26018 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
26019
26020 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
26021 @opindex mhotpatch
26022 If the hotpatch option is enabled, a ``hot-patching'' function
26023 prologue is generated for all functions in the compilation unit.
26024 The funtion label is prepended with the given number of two-byte
26025 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
26026 the label, 2 * @var{post-halfwords} bytes are appended, using the
26027 largest NOP like instructions the architecture allows (maximum
26028 1000000).
26029
26030 If both arguments are zero, hotpatching is disabled.
26031
26032 This option can be overridden for individual functions with the
26033 @code{hotpatch} attribute.
26034 @end table
26035
26036 @node Score Options
26037 @subsection Score Options
26038 @cindex Score Options
26039
26040 These options are defined for Score implementations:
26041
26042 @table @gcctabopt
26043 @item -meb
26044 @opindex meb
26045 Compile code for big-endian mode. This is the default.
26046
26047 @item -mel
26048 @opindex mel
26049 Compile code for little-endian mode.
26050
26051 @item -mnhwloop
26052 @opindex mnhwloop
26053 Disable generation of @code{bcnz} instructions.
26054
26055 @item -muls
26056 @opindex muls
26057 Enable generation of unaligned load and store instructions.
26058
26059 @item -mmac
26060 @opindex mmac
26061 Enable the use of multiply-accumulate instructions. Disabled by default.
26062
26063 @item -mscore5
26064 @opindex mscore5
26065 Specify the SCORE5 as the target architecture.
26066
26067 @item -mscore5u
26068 @opindex mscore5u
26069 Specify the SCORE5U of the target architecture.
26070
26071 @item -mscore7
26072 @opindex mscore7
26073 Specify the SCORE7 as the target architecture. This is the default.
26074
26075 @item -mscore7d
26076 @opindex mscore7d
26077 Specify the SCORE7D as the target architecture.
26078 @end table
26079
26080 @node SH Options
26081 @subsection SH Options
26082
26083 These @samp{-m} options are defined for the SH implementations:
26084
26085 @table @gcctabopt
26086 @item -m1
26087 @opindex m1
26088 Generate code for the SH1.
26089
26090 @item -m2
26091 @opindex m2
26092 Generate code for the SH2.
26093
26094 @item -m2e
26095 Generate code for the SH2e.
26096
26097 @item -m2a-nofpu
26098 @opindex m2a-nofpu
26099 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26100 that the floating-point unit is not used.
26101
26102 @item -m2a-single-only
26103 @opindex m2a-single-only
26104 Generate code for the SH2a-FPU, in such a way that no double-precision
26105 floating-point operations are used.
26106
26107 @item -m2a-single
26108 @opindex m2a-single
26109 Generate code for the SH2a-FPU assuming the floating-point unit is in
26110 single-precision mode by default.
26111
26112 @item -m2a
26113 @opindex m2a
26114 Generate code for the SH2a-FPU assuming the floating-point unit is in
26115 double-precision mode by default.
26116
26117 @item -m3
26118 @opindex m3
26119 Generate code for the SH3.
26120
26121 @item -m3e
26122 @opindex m3e
26123 Generate code for the SH3e.
26124
26125 @item -m4-nofpu
26126 @opindex m4-nofpu
26127 Generate code for the SH4 without a floating-point unit.
26128
26129 @item -m4-single-only
26130 @opindex m4-single-only
26131 Generate code for the SH4 with a floating-point unit that only
26132 supports single-precision arithmetic.
26133
26134 @item -m4-single
26135 @opindex m4-single
26136 Generate code for the SH4 assuming the floating-point unit is in
26137 single-precision mode by default.
26138
26139 @item -m4
26140 @opindex m4
26141 Generate code for the SH4.
26142
26143 @item -m4-100
26144 @opindex m4-100
26145 Generate code for SH4-100.
26146
26147 @item -m4-100-nofpu
26148 @opindex m4-100-nofpu
26149 Generate code for SH4-100 in such a way that the
26150 floating-point unit is not used.
26151
26152 @item -m4-100-single
26153 @opindex m4-100-single
26154 Generate code for SH4-100 assuming the floating-point unit is in
26155 single-precision mode by default.
26156
26157 @item -m4-100-single-only
26158 @opindex m4-100-single-only
26159 Generate code for SH4-100 in such a way that no double-precision
26160 floating-point operations are used.
26161
26162 @item -m4-200
26163 @opindex m4-200
26164 Generate code for SH4-200.
26165
26166 @item -m4-200-nofpu
26167 @opindex m4-200-nofpu
26168 Generate code for SH4-200 without in such a way that the
26169 floating-point unit is not used.
26170
26171 @item -m4-200-single
26172 @opindex m4-200-single
26173 Generate code for SH4-200 assuming the floating-point unit is in
26174 single-precision mode by default.
26175
26176 @item -m4-200-single-only
26177 @opindex m4-200-single-only
26178 Generate code for SH4-200 in such a way that no double-precision
26179 floating-point operations are used.
26180
26181 @item -m4-300
26182 @opindex m4-300
26183 Generate code for SH4-300.
26184
26185 @item -m4-300-nofpu
26186 @opindex m4-300-nofpu
26187 Generate code for SH4-300 without in such a way that the
26188 floating-point unit is not used.
26189
26190 @item -m4-300-single
26191 @opindex m4-300-single
26192 Generate code for SH4-300 in such a way that no double-precision
26193 floating-point operations are used.
26194
26195 @item -m4-300-single-only
26196 @opindex m4-300-single-only
26197 Generate code for SH4-300 in such a way that no double-precision
26198 floating-point operations are used.
26199
26200 @item -m4-340
26201 @opindex m4-340
26202 Generate code for SH4-340 (no MMU, no FPU).
26203
26204 @item -m4-500
26205 @opindex m4-500
26206 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26207 assembler.
26208
26209 @item -m4a-nofpu
26210 @opindex m4a-nofpu
26211 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26212 floating-point unit is not used.
26213
26214 @item -m4a-single-only
26215 @opindex m4a-single-only
26216 Generate code for the SH4a, in such a way that no double-precision
26217 floating-point operations are used.
26218
26219 @item -m4a-single
26220 @opindex m4a-single
26221 Generate code for the SH4a assuming the floating-point unit is in
26222 single-precision mode by default.
26223
26224 @item -m4a
26225 @opindex m4a
26226 Generate code for the SH4a.
26227
26228 @item -m4al
26229 @opindex m4al
26230 Same as @option{-m4a-nofpu}, except that it implicitly passes
26231 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26232 instructions at the moment.
26233
26234 @item -mb
26235 @opindex mb
26236 Compile code for the processor in big-endian mode.
26237
26238 @item -ml
26239 @opindex ml
26240 Compile code for the processor in little-endian mode.
26241
26242 @item -mdalign
26243 @opindex mdalign
26244 Align doubles at 64-bit boundaries. Note that this changes the calling
26245 conventions, and thus some functions from the standard C library do
26246 not work unless you recompile it first with @option{-mdalign}.
26247
26248 @item -mrelax
26249 @opindex mrelax
26250 Shorten some address references at link time, when possible; uses the
26251 linker option @option{-relax}.
26252
26253 @item -mbigtable
26254 @opindex mbigtable
26255 Use 32-bit offsets in @code{switch} tables. The default is to use
26256 16-bit offsets.
26257
26258 @item -mbitops
26259 @opindex mbitops
26260 Enable the use of bit manipulation instructions on SH2A.
26261
26262 @item -mfmovd
26263 @opindex mfmovd
26264 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26265 alignment constraints.
26266
26267 @item -mrenesas
26268 @opindex mrenesas
26269 Comply with the calling conventions defined by Renesas.
26270
26271 @item -mno-renesas
26272 @opindex mno-renesas
26273 Comply with the calling conventions defined for GCC before the Renesas
26274 conventions were available. This option is the default for all
26275 targets of the SH toolchain.
26276
26277 @item -mnomacsave
26278 @opindex mnomacsave
26279 Mark the @code{MAC} register as call-clobbered, even if
26280 @option{-mrenesas} is given.
26281
26282 @item -mieee
26283 @itemx -mno-ieee
26284 @opindex mieee
26285 @opindex mno-ieee
26286 Control the IEEE compliance of floating-point comparisons, which affects the
26287 handling of cases where the result of a comparison is unordered. By default
26288 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26289 enabled @option{-mno-ieee} is implicitly set, which results in faster
26290 floating-point greater-equal and less-equal comparisons. The implicit settings
26291 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26292
26293 @item -minline-ic_invalidate
26294 @opindex minline-ic_invalidate
26295 Inline code to invalidate instruction cache entries after setting up
26296 nested function trampolines.
26297 This option has no effect if @option{-musermode} is in effect and the selected
26298 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26299 instruction.
26300 If the selected code generation option does not allow the use of the @code{icbi}
26301 instruction, and @option{-musermode} is not in effect, the inlined code
26302 manipulates the instruction cache address array directly with an associative
26303 write. This not only requires privileged mode at run time, but it also
26304 fails if the cache line had been mapped via the TLB and has become unmapped.
26305
26306 @item -misize
26307 @opindex misize
26308 Dump instruction size and location in the assembly code.
26309
26310 @item -mpadstruct
26311 @opindex mpadstruct
26312 This option is deprecated. It pads structures to multiple of 4 bytes,
26313 which is incompatible with the SH ABI@.
26314
26315 @item -matomic-model=@var{model}
26316 @opindex matomic-model=@var{model}
26317 Sets the model of atomic operations and additional parameters as a comma
26318 separated list. For details on the atomic built-in functions see
26319 @ref{__atomic Builtins}. The following models and parameters are supported:
26320
26321 @table @samp
26322
26323 @item none
26324 Disable compiler generated atomic sequences and emit library calls for atomic
26325 operations. This is the default if the target is not @code{sh*-*-linux*}.
26326
26327 @item soft-gusa
26328 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26329 built-in functions. The generated atomic sequences require additional support
26330 from the interrupt/exception handling code of the system and are only suitable
26331 for SH3* and SH4* single-core systems. This option is enabled by default when
26332 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26333 this option also partially utilizes the hardware atomic instructions
26334 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26335 @samp{strict} is specified.
26336
26337 @item soft-tcb
26338 Generate software atomic sequences that use a variable in the thread control
26339 block. This is a variation of the gUSA sequences which can also be used on
26340 SH1* and SH2* targets. The generated atomic sequences require additional
26341 support from the interrupt/exception handling code of the system and are only
26342 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26343 parameter has to be specified as well.
26344
26345 @item soft-imask
26346 Generate software atomic sequences that temporarily disable interrupts by
26347 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26348 in privileged mode and is only suitable for single-core systems. Additional
26349 support from the interrupt/exception handling code of the system is not
26350 required. This model is enabled by default when the target is
26351 @code{sh*-*-linux*} and SH1* or SH2*.
26352
26353 @item hard-llcs
26354 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26355 instructions only. This is only available on SH4A and is suitable for
26356 multi-core systems. Since the hardware instructions support only 32 bit atomic
26357 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26358 Code compiled with this option is also compatible with other software
26359 atomic model interrupt/exception handling systems if executed on an SH4A
26360 system. Additional support from the interrupt/exception handling code of the
26361 system is not required for this model.
26362
26363 @item gbr-offset=
26364 This parameter specifies the offset in bytes of the variable in the thread
26365 control block structure that should be used by the generated atomic sequences
26366 when the @samp{soft-tcb} model has been selected. For other models this
26367 parameter is ignored. The specified value must be an integer multiple of four
26368 and in the range 0-1020.
26369
26370 @item strict
26371 This parameter prevents mixed usage of multiple atomic models, even if they
26372 are compatible, and makes the compiler generate atomic sequences of the
26373 specified model only.
26374
26375 @end table
26376
26377 @item -mtas
26378 @opindex mtas
26379 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26380 Notice that depending on the particular hardware and software configuration
26381 this can degrade overall performance due to the operand cache line flushes
26382 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26383 processors the @code{tas.b} instruction must be used with caution since it
26384 can result in data corruption for certain cache configurations.
26385
26386 @item -mprefergot
26387 @opindex mprefergot
26388 When generating position-independent code, emit function calls using
26389 the Global Offset Table instead of the Procedure Linkage Table.
26390
26391 @item -musermode
26392 @itemx -mno-usermode
26393 @opindex musermode
26394 @opindex mno-usermode
26395 Don't allow (allow) the compiler generating privileged mode code. Specifying
26396 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26397 inlined code would not work in user mode. @option{-musermode} is the default
26398 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26399 @option{-musermode} has no effect, since there is no user mode.
26400
26401 @item -multcost=@var{number}
26402 @opindex multcost=@var{number}
26403 Set the cost to assume for a multiply insn.
26404
26405 @item -mdiv=@var{strategy}
26406 @opindex mdiv=@var{strategy}
26407 Set the division strategy to be used for integer division operations.
26408 @var{strategy} can be one of:
26409
26410 @table @samp
26411
26412 @item call-div1
26413 Calls a library function that uses the single-step division instruction
26414 @code{div1} to perform the operation. Division by zero calculates an
26415 unspecified result and does not trap. This is the default except for SH4,
26416 SH2A and SHcompact.
26417
26418 @item call-fp
26419 Calls a library function that performs the operation in double precision
26420 floating point. Division by zero causes a floating-point exception. This is
26421 the default for SHcompact with FPU. Specifying this for targets that do not
26422 have a double precision FPU defaults to @code{call-div1}.
26423
26424 @item call-table
26425 Calls a library function that uses a lookup table for small divisors and
26426 the @code{div1} instruction with case distinction for larger divisors. Division
26427 by zero calculates an unspecified result and does not trap. This is the default
26428 for SH4. Specifying this for targets that do not have dynamic shift
26429 instructions defaults to @code{call-div1}.
26430
26431 @end table
26432
26433 When a division strategy has not been specified the default strategy is
26434 selected based on the current target. For SH2A the default strategy is to
26435 use the @code{divs} and @code{divu} instructions instead of library function
26436 calls.
26437
26438 @item -maccumulate-outgoing-args
26439 @opindex maccumulate-outgoing-args
26440 Reserve space once for outgoing arguments in the function prologue rather
26441 than around each call. Generally beneficial for performance and size. Also
26442 needed for unwinding to avoid changing the stack frame around conditional code.
26443
26444 @item -mdivsi3_libfunc=@var{name}
26445 @opindex mdivsi3_libfunc=@var{name}
26446 Set the name of the library function used for 32-bit signed division to
26447 @var{name}.
26448 This only affects the name used in the @samp{call} division strategies, and
26449 the compiler still expects the same sets of input/output/clobbered registers as
26450 if this option were not present.
26451
26452 @item -mfixed-range=@var{register-range}
26453 @opindex mfixed-range
26454 Generate code treating the given register range as fixed registers.
26455 A fixed register is one that the register allocator cannot use. This is
26456 useful when compiling kernel code. A register range is specified as
26457 two registers separated by a dash. Multiple register ranges can be
26458 specified separated by a comma.
26459
26460 @item -mbranch-cost=@var{num}
26461 @opindex mbranch-cost=@var{num}
26462 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26463 make the compiler try to generate more branch-free code if possible.
26464 If not specified the value is selected depending on the processor type that
26465 is being compiled for.
26466
26467 @item -mzdcbranch
26468 @itemx -mno-zdcbranch
26469 @opindex mzdcbranch
26470 @opindex mno-zdcbranch
26471 Assume (do not assume) that zero displacement conditional branch instructions
26472 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26473 compiler prefers zero displacement branch code sequences. This is
26474 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26475 disabled by specifying @option{-mno-zdcbranch}.
26476
26477 @item -mcbranch-force-delay-slot
26478 @opindex mcbranch-force-delay-slot
26479 Force the usage of delay slots for conditional branches, which stuffs the delay
26480 slot with a @code{nop} if a suitable instruction cannot be found. By default
26481 this option is disabled. It can be enabled to work around hardware bugs as
26482 found in the original SH7055.
26483
26484 @item -mfused-madd
26485 @itemx -mno-fused-madd
26486 @opindex mfused-madd
26487 @opindex mno-fused-madd
26488 Generate code that uses (does not use) the floating-point multiply and
26489 accumulate instructions. These instructions are generated by default
26490 if hardware floating point is used. The machine-dependent
26491 @option{-mfused-madd} option is now mapped to the machine-independent
26492 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26493 mapped to @option{-ffp-contract=off}.
26494
26495 @item -mfsca
26496 @itemx -mno-fsca
26497 @opindex mfsca
26498 @opindex mno-fsca
26499 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26500 and cosine approximations. The option @option{-mfsca} must be used in
26501 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26502 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26503 approximations even if @option{-funsafe-math-optimizations} is in effect.
26504
26505 @item -mfsrra
26506 @itemx -mno-fsrra
26507 @opindex mfsrra
26508 @opindex mno-fsrra
26509 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26510 reciprocal square root approximations. The option @option{-mfsrra} must be used
26511 in combination with @option{-funsafe-math-optimizations} and
26512 @option{-ffinite-math-only}. It is enabled by default when generating code for
26513 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26514 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26515 in effect.
26516
26517 @item -mpretend-cmove
26518 @opindex mpretend-cmove
26519 Prefer zero-displacement conditional branches for conditional move instruction
26520 patterns. This can result in faster code on the SH4 processor.
26521
26522 @item -mfdpic
26523 @opindex fdpic
26524 Generate code using the FDPIC ABI.
26525
26526 @end table
26527
26528 @node Solaris 2 Options
26529 @subsection Solaris 2 Options
26530 @cindex Solaris 2 options
26531
26532 These @samp{-m} options are supported on Solaris 2:
26533
26534 @table @gcctabopt
26535 @item -mclear-hwcap
26536 @opindex mclear-hwcap
26537 @option{-mclear-hwcap} tells the compiler to remove the hardware
26538 capabilities generated by the Solaris assembler. This is only necessary
26539 when object files use ISA extensions not supported by the current
26540 machine, but check at runtime whether or not to use them.
26541
26542 @item -mimpure-text
26543 @opindex mimpure-text
26544 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26545 the compiler to not pass @option{-z text} to the linker when linking a
26546 shared object. Using this option, you can link position-dependent
26547 code into a shared object.
26548
26549 @option{-mimpure-text} suppresses the ``relocations remain against
26550 allocatable but non-writable sections'' linker error message.
26551 However, the necessary relocations trigger copy-on-write, and the
26552 shared object is not actually shared across processes. Instead of
26553 using @option{-mimpure-text}, you should compile all source code with
26554 @option{-fpic} or @option{-fPIC}.
26555
26556 @end table
26557
26558 These switches are supported in addition to the above on Solaris 2:
26559
26560 @table @gcctabopt
26561 @item -pthreads
26562 @opindex pthreads
26563 This is a synonym for @option{-pthread}.
26564 @end table
26565
26566 @node SPARC Options
26567 @subsection SPARC Options
26568 @cindex SPARC options
26569
26570 These @samp{-m} options are supported on the SPARC:
26571
26572 @table @gcctabopt
26573 @item -mno-app-regs
26574 @itemx -mapp-regs
26575 @opindex mno-app-regs
26576 @opindex mapp-regs
26577 Specify @option{-mapp-regs} to generate output using the global registers
26578 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26579 global register 1, each global register 2 through 4 is then treated as an
26580 allocable register that is clobbered by function calls. This is the default.
26581
26582 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26583 specify @option{-mno-app-regs}. You should compile libraries and system
26584 software with this option.
26585
26586 @item -mflat
26587 @itemx -mno-flat
26588 @opindex mflat
26589 @opindex mno-flat
26590 With @option{-mflat}, the compiler does not generate save/restore instructions
26591 and uses a ``flat'' or single register window model. This model is compatible
26592 with the regular register window model. The local registers and the input
26593 registers (0--5) are still treated as ``call-saved'' registers and are
26594 saved on the stack as needed.
26595
26596 With @option{-mno-flat} (the default), the compiler generates save/restore
26597 instructions (except for leaf functions). This is the normal operating mode.
26598
26599 @item -mfpu
26600 @itemx -mhard-float
26601 @opindex mfpu
26602 @opindex mhard-float
26603 Generate output containing floating-point instructions. This is the
26604 default.
26605
26606 @item -mno-fpu
26607 @itemx -msoft-float
26608 @opindex mno-fpu
26609 @opindex msoft-float
26610 Generate output containing library calls for floating point.
26611 @strong{Warning:} the requisite libraries are not available for all SPARC
26612 targets. Normally the facilities of the machine's usual C compiler are
26613 used, but this cannot be done directly in cross-compilation. You must make
26614 your own arrangements to provide suitable library functions for
26615 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26616 @samp{sparclite-*-*} do provide software floating-point support.
26617
26618 @option{-msoft-float} changes the calling convention in the output file;
26619 therefore, it is only useful if you compile @emph{all} of a program with
26620 this option. In particular, you need to compile @file{libgcc.a}, the
26621 library that comes with GCC, with @option{-msoft-float} in order for
26622 this to work.
26623
26624 @item -mhard-quad-float
26625 @opindex mhard-quad-float
26626 Generate output containing quad-word (long double) floating-point
26627 instructions.
26628
26629 @item -msoft-quad-float
26630 @opindex msoft-quad-float
26631 Generate output containing library calls for quad-word (long double)
26632 floating-point instructions. The functions called are those specified
26633 in the SPARC ABI@. This is the default.
26634
26635 As of this writing, there are no SPARC implementations that have hardware
26636 support for the quad-word floating-point instructions. They all invoke
26637 a trap handler for one of these instructions, and then the trap handler
26638 emulates the effect of the instruction. Because of the trap handler overhead,
26639 this is much slower than calling the ABI library routines. Thus the
26640 @option{-msoft-quad-float} option is the default.
26641
26642 @item -mno-unaligned-doubles
26643 @itemx -munaligned-doubles
26644 @opindex mno-unaligned-doubles
26645 @opindex munaligned-doubles
26646 Assume that doubles have 8-byte alignment. This is the default.
26647
26648 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26649 alignment only if they are contained in another type, or if they have an
26650 absolute address. Otherwise, it assumes they have 4-byte alignment.
26651 Specifying this option avoids some rare compatibility problems with code
26652 generated by other compilers. It is not the default because it results
26653 in a performance loss, especially for floating-point code.
26654
26655 @item -muser-mode
26656 @itemx -mno-user-mode
26657 @opindex muser-mode
26658 @opindex mno-user-mode
26659 Do not generate code that can only run in supervisor mode. This is relevant
26660 only for the @code{casa} instruction emitted for the LEON3 processor. This
26661 is the default.
26662
26663 @item -mfaster-structs
26664 @itemx -mno-faster-structs
26665 @opindex mfaster-structs
26666 @opindex mno-faster-structs
26667 With @option{-mfaster-structs}, the compiler assumes that structures
26668 should have 8-byte alignment. This enables the use of pairs of
26669 @code{ldd} and @code{std} instructions for copies in structure
26670 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26671 However, the use of this changed alignment directly violates the SPARC
26672 ABI@. Thus, it's intended only for use on targets where the developer
26673 acknowledges that their resulting code is not directly in line with
26674 the rules of the ABI@.
26675
26676 @item -mstd-struct-return
26677 @itemx -mno-std-struct-return
26678 @opindex mstd-struct-return
26679 @opindex mno-std-struct-return
26680 With @option{-mstd-struct-return}, the compiler generates checking code
26681 in functions returning structures or unions to detect size mismatches
26682 between the two sides of function calls, as per the 32-bit ABI@.
26683
26684 The default is @option{-mno-std-struct-return}. This option has no effect
26685 in 64-bit mode.
26686
26687 @item -mlra
26688 @itemx -mno-lra
26689 @opindex mlra
26690 @opindex mno-lra
26691 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26692 so @option{-mno-lra} needs to be passed to get old Reload.
26693
26694 @item -mcpu=@var{cpu_type}
26695 @opindex mcpu
26696 Set the instruction set, register set, and instruction scheduling parameters
26697 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26698 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26699 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26700 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26701 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26702 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26703
26704 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26705 which selects the best architecture option for the host processor.
26706 @option{-mcpu=native} has no effect if GCC does not recognize
26707 the processor.
26708
26709 Default instruction scheduling parameters are used for values that select
26710 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26711 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26712
26713 Here is a list of each supported architecture and their supported
26714 implementations.
26715
26716 @table @asis
26717 @item v7
26718 cypress, leon3v7
26719
26720 @item v8
26721 supersparc, hypersparc, leon, leon3
26722
26723 @item sparclite
26724 f930, f934, sparclite86x
26725
26726 @item sparclet
26727 tsc701
26728
26729 @item v9
26730 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26731 niagara7, m8
26732 @end table
26733
26734 By default (unless configured otherwise), GCC generates code for the V7
26735 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26736 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26737 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26738 SPARCStation 1, 2, IPX etc.
26739
26740 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26741 architecture. The only difference from V7 code is that the compiler emits
26742 the integer multiply and integer divide instructions which exist in SPARC-V8
26743 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26744 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26745 2000 series.
26746
26747 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26748 the SPARC architecture. This adds the integer multiply, integer divide step
26749 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26750 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26751 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26752 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26753 MB86934 chip, which is the more recent SPARClite with FPU@.
26754
26755 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26756 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26757 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26758 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26759 optimizes it for the TEMIC SPARClet chip.
26760
26761 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26762 architecture. This adds 64-bit integer and floating-point move instructions,
26763 3 additional floating-point condition code registers and conditional move
26764 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26765 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26766 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26767 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26768 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26769 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26770 additionally optimizes it for Sun UltraSPARC T2 chips. With
26771 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26772 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26773 additionally optimizes it for Sun UltraSPARC T4 chips. With
26774 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26775 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26776 additionally optimizes it for Oracle M8 chips.
26777
26778 @item -mtune=@var{cpu_type}
26779 @opindex mtune
26780 Set the instruction scheduling parameters for machine type
26781 @var{cpu_type}, but do not set the instruction set or register set that the
26782 option @option{-mcpu=@var{cpu_type}} does.
26783
26784 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26785 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26786 that select a particular CPU implementation. Those are
26787 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26788 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26789 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26790 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26791 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26792 and GNU/Linux toolchains, @samp{native} can also be used.
26793
26794 @item -mv8plus
26795 @itemx -mno-v8plus
26796 @opindex mv8plus
26797 @opindex mno-v8plus
26798 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26799 difference from the V8 ABI is that the global and out registers are
26800 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26801 mode for all SPARC-V9 processors.
26802
26803 @item -mvis
26804 @itemx -mno-vis
26805 @opindex mvis
26806 @opindex mno-vis
26807 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26808 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26809
26810 @item -mvis2
26811 @itemx -mno-vis2
26812 @opindex mvis2
26813 @opindex mno-vis2
26814 With @option{-mvis2}, GCC generates code that takes advantage of
26815 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26816 default is @option{-mvis2} when targeting a cpu that supports such
26817 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26818 also sets @option{-mvis}.
26819
26820 @item -mvis3
26821 @itemx -mno-vis3
26822 @opindex mvis3
26823 @opindex mno-vis3
26824 With @option{-mvis3}, GCC generates code that takes advantage of
26825 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26826 default is @option{-mvis3} when targeting a cpu that supports such
26827 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26828 also sets @option{-mvis2} and @option{-mvis}.
26829
26830 @item -mvis4
26831 @itemx -mno-vis4
26832 @opindex mvis4
26833 @opindex mno-vis4
26834 With @option{-mvis4}, GCC generates code that takes advantage of
26835 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26836 default is @option{-mvis4} when targeting a cpu that supports such
26837 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26838 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26839
26840 @item -mvis4b
26841 @itemx -mno-vis4b
26842 @opindex mvis4b
26843 @opindex mno-vis4b
26844 With @option{-mvis4b}, GCC generates code that takes advantage of
26845 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26846 the additional VIS instructions introduced in the Oracle SPARC
26847 Architecture 2017. The default is @option{-mvis4b} when targeting a
26848 cpu that supports such instructions, such as m8 and later. Setting
26849 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26850 @option{-mvis2} and @option{-mvis}.
26851
26852 @item -mcbcond
26853 @itemx -mno-cbcond
26854 @opindex mcbcond
26855 @opindex mno-cbcond
26856 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26857 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26858 when targeting a CPU that supports such instructions, such as Niagara-4 and
26859 later.
26860
26861 @item -mfmaf
26862 @itemx -mno-fmaf
26863 @opindex mfmaf
26864 @opindex mno-fmaf
26865 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26866 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26867 when targeting a CPU that supports such instructions, such as Niagara-3 and
26868 later.
26869
26870 @item -mfsmuld
26871 @itemx -mno-fsmuld
26872 @opindex mfsmuld
26873 @opindex mno-fsmuld
26874 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26875 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26876 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26877 or V9 with FPU except @option{-mcpu=leon}.
26878
26879 @item -mpopc
26880 @itemx -mno-popc
26881 @opindex mpopc
26882 @opindex mno-popc
26883 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26884 Population Count instruction. The default is @option{-mpopc}
26885 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26886 later.
26887
26888 @item -msubxc
26889 @itemx -mno-subxc
26890 @opindex msubxc
26891 @opindex mno-subxc
26892 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26893 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26894 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26895 later.
26896
26897 @item -mfix-at697f
26898 @opindex mfix-at697f
26899 Enable the documented workaround for the single erratum of the Atmel AT697F
26900 processor (which corresponds to erratum #13 of the AT697E processor).
26901
26902 @item -mfix-ut699
26903 @opindex mfix-ut699
26904 Enable the documented workarounds for the floating-point errata and the data
26905 cache nullify errata of the UT699 processor.
26906
26907 @item -mfix-ut700
26908 @opindex mfix-ut700
26909 Enable the documented workaround for the back-to-back store errata of
26910 the UT699E/UT700 processor.
26911
26912 @item -mfix-gr712rc
26913 @opindex mfix-gr712rc
26914 Enable the documented workaround for the back-to-back store errata of
26915 the GR712RC processor.
26916 @end table
26917
26918 These @samp{-m} options are supported in addition to the above
26919 on SPARC-V9 processors in 64-bit environments:
26920
26921 @table @gcctabopt
26922 @item -m32
26923 @itemx -m64
26924 @opindex m32
26925 @opindex m64
26926 Generate code for a 32-bit or 64-bit environment.
26927 The 32-bit environment sets int, long and pointer to 32 bits.
26928 The 64-bit environment sets int to 32 bits and long and pointer
26929 to 64 bits.
26930
26931 @item -mcmodel=@var{which}
26932 @opindex mcmodel
26933 Set the code model to one of
26934
26935 @table @samp
26936 @item medlow
26937 The Medium/Low code model: 64-bit addresses, programs
26938 must be linked in the low 32 bits of memory. Programs can be statically
26939 or dynamically linked.
26940
26941 @item medmid
26942 The Medium/Middle code model: 64-bit addresses, programs
26943 must be linked in the low 44 bits of memory, the text and data segments must
26944 be less than 2GB in size and the data segment must be located within 2GB of
26945 the text segment.
26946
26947 @item medany
26948 The Medium/Anywhere code model: 64-bit addresses, programs
26949 may be linked anywhere in memory, the text and data segments must be less
26950 than 2GB in size and the data segment must be located within 2GB of the
26951 text segment.
26952
26953 @item embmedany
26954 The Medium/Anywhere code model for embedded systems:
26955 64-bit addresses, the text and data segments must be less than 2GB in
26956 size, both starting anywhere in memory (determined at link time). The
26957 global register %g4 points to the base of the data segment. Programs
26958 are statically linked and PIC is not supported.
26959 @end table
26960
26961 @item -mmemory-model=@var{mem-model}
26962 @opindex mmemory-model
26963 Set the memory model in force on the processor to one of
26964
26965 @table @samp
26966 @item default
26967 The default memory model for the processor and operating system.
26968
26969 @item rmo
26970 Relaxed Memory Order
26971
26972 @item pso
26973 Partial Store Order
26974
26975 @item tso
26976 Total Store Order
26977
26978 @item sc
26979 Sequential Consistency
26980 @end table
26981
26982 These memory models are formally defined in Appendix D of the SPARC-V9
26983 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26984
26985 @item -mstack-bias
26986 @itemx -mno-stack-bias
26987 @opindex mstack-bias
26988 @opindex mno-stack-bias
26989 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26990 frame pointer if present, are offset by @minus{}2047 which must be added back
26991 when making stack frame references. This is the default in 64-bit mode.
26992 Otherwise, assume no such offset is present.
26993 @end table
26994
26995 @node System V Options
26996 @subsection Options for System V
26997
26998 These additional options are available on System V Release 4 for
26999 compatibility with other compilers on those systems:
27000
27001 @table @gcctabopt
27002 @item -G
27003 @opindex G
27004 Create a shared object.
27005 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
27006
27007 @item -Qy
27008 @opindex Qy
27009 Identify the versions of each tool used by the compiler, in a
27010 @code{.ident} assembler directive in the output.
27011
27012 @item -Qn
27013 @opindex Qn
27014 Refrain from adding @code{.ident} directives to the output file (this is
27015 the default).
27016
27017 @item -YP,@var{dirs}
27018 @opindex YP
27019 Search the directories @var{dirs}, and no others, for libraries
27020 specified with @option{-l}.
27021
27022 @item -Ym,@var{dir}
27023 @opindex Ym
27024 Look in the directory @var{dir} to find the M4 preprocessor.
27025 The assembler uses this option.
27026 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27027 @c the generic assembler that comes with Solaris takes just -Ym.
27028 @end table
27029
27030 @node TILE-Gx Options
27031 @subsection TILE-Gx Options
27032 @cindex TILE-Gx options
27033
27034 These @samp{-m} options are supported on the TILE-Gx:
27035
27036 @table @gcctabopt
27037 @item -mcmodel=small
27038 @opindex mcmodel=small
27039 Generate code for the small model. The distance for direct calls is
27040 limited to 500M in either direction. PC-relative addresses are 32
27041 bits. Absolute addresses support the full address range.
27042
27043 @item -mcmodel=large
27044 @opindex mcmodel=large
27045 Generate code for the large model. There is no limitation on call
27046 distance, pc-relative addresses, or absolute addresses.
27047
27048 @item -mcpu=@var{name}
27049 @opindex mcpu
27050 Selects the type of CPU to be targeted. Currently the only supported
27051 type is @samp{tilegx}.
27052
27053 @item -m32
27054 @itemx -m64
27055 @opindex m32
27056 @opindex m64
27057 Generate code for a 32-bit or 64-bit environment. The 32-bit
27058 environment sets int, long, and pointer to 32 bits. The 64-bit
27059 environment sets int to 32 bits and long and pointer to 64 bits.
27060
27061 @item -mbig-endian
27062 @itemx -mlittle-endian
27063 @opindex mbig-endian
27064 @opindex mlittle-endian
27065 Generate code in big/little endian mode, respectively.
27066 @end table
27067
27068 @node TILEPro Options
27069 @subsection TILEPro Options
27070 @cindex TILEPro options
27071
27072 These @samp{-m} options are supported on the TILEPro:
27073
27074 @table @gcctabopt
27075 @item -mcpu=@var{name}
27076 @opindex mcpu
27077 Selects the type of CPU to be targeted. Currently the only supported
27078 type is @samp{tilepro}.
27079
27080 @item -m32
27081 @opindex m32
27082 Generate code for a 32-bit environment, which sets int, long, and
27083 pointer to 32 bits. This is the only supported behavior so the flag
27084 is essentially ignored.
27085 @end table
27086
27087 @node V850 Options
27088 @subsection V850 Options
27089 @cindex V850 Options
27090
27091 These @samp{-m} options are defined for V850 implementations:
27092
27093 @table @gcctabopt
27094 @item -mlong-calls
27095 @itemx -mno-long-calls
27096 @opindex mlong-calls
27097 @opindex mno-long-calls
27098 Treat all calls as being far away (near). If calls are assumed to be
27099 far away, the compiler always loads the function's address into a
27100 register, and calls indirect through the pointer.
27101
27102 @item -mno-ep
27103 @itemx -mep
27104 @opindex mno-ep
27105 @opindex mep
27106 Do not optimize (do optimize) basic blocks that use the same index
27107 pointer 4 or more times to copy pointer into the @code{ep} register, and
27108 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27109 option is on by default if you optimize.
27110
27111 @item -mno-prolog-function
27112 @itemx -mprolog-function
27113 @opindex mno-prolog-function
27114 @opindex mprolog-function
27115 Do not use (do use) external functions to save and restore registers
27116 at the prologue and epilogue of a function. The external functions
27117 are slower, but use less code space if more than one function saves
27118 the same number of registers. The @option{-mprolog-function} option
27119 is on by default if you optimize.
27120
27121 @item -mspace
27122 @opindex mspace
27123 Try to make the code as small as possible. At present, this just turns
27124 on the @option{-mep} and @option{-mprolog-function} options.
27125
27126 @item -mtda=@var{n}
27127 @opindex mtda
27128 Put static or global variables whose size is @var{n} bytes or less into
27129 the tiny data area that register @code{ep} points to. The tiny data
27130 area can hold up to 256 bytes in total (128 bytes for byte references).
27131
27132 @item -msda=@var{n}
27133 @opindex msda
27134 Put static or global variables whose size is @var{n} bytes or less into
27135 the small data area that register @code{gp} points to. The small data
27136 area can hold up to 64 kilobytes.
27137
27138 @item -mzda=@var{n}
27139 @opindex mzda
27140 Put static or global variables whose size is @var{n} bytes or less into
27141 the first 32 kilobytes of memory.
27142
27143 @item -mv850
27144 @opindex mv850
27145 Specify that the target processor is the V850.
27146
27147 @item -mv850e3v5
27148 @opindex mv850e3v5
27149 Specify that the target processor is the V850E3V5. The preprocessor
27150 constant @code{__v850e3v5__} is defined if this option is used.
27151
27152 @item -mv850e2v4
27153 @opindex mv850e2v4
27154 Specify that the target processor is the V850E3V5. This is an alias for
27155 the @option{-mv850e3v5} option.
27156
27157 @item -mv850e2v3
27158 @opindex mv850e2v3
27159 Specify that the target processor is the V850E2V3. The preprocessor
27160 constant @code{__v850e2v3__} is defined if this option is used.
27161
27162 @item -mv850e2
27163 @opindex mv850e2
27164 Specify that the target processor is the V850E2. The preprocessor
27165 constant @code{__v850e2__} is defined if this option is used.
27166
27167 @item -mv850e1
27168 @opindex mv850e1
27169 Specify that the target processor is the V850E1. The preprocessor
27170 constants @code{__v850e1__} and @code{__v850e__} are defined if
27171 this option is used.
27172
27173 @item -mv850es
27174 @opindex mv850es
27175 Specify that the target processor is the V850ES. This is an alias for
27176 the @option{-mv850e1} option.
27177
27178 @item -mv850e
27179 @opindex mv850e
27180 Specify that the target processor is the V850E@. The preprocessor
27181 constant @code{__v850e__} is defined if this option is used.
27182
27183 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27184 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27185 are defined then a default target processor is chosen and the
27186 relevant @samp{__v850*__} preprocessor constant is defined.
27187
27188 The preprocessor constants @code{__v850} and @code{__v851__} are always
27189 defined, regardless of which processor variant is the target.
27190
27191 @item -mdisable-callt
27192 @itemx -mno-disable-callt
27193 @opindex mdisable-callt
27194 @opindex mno-disable-callt
27195 This option suppresses generation of the @code{CALLT} instruction for the
27196 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27197 architecture.
27198
27199 This option is enabled by default when the RH850 ABI is
27200 in use (see @option{-mrh850-abi}), and disabled by default when the
27201 GCC ABI is in use. If @code{CALLT} instructions are being generated
27202 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27203
27204 @item -mrelax
27205 @itemx -mno-relax
27206 @opindex mrelax
27207 @opindex mno-relax
27208 Pass on (or do not pass on) the @option{-mrelax} command-line option
27209 to the assembler.
27210
27211 @item -mlong-jumps
27212 @itemx -mno-long-jumps
27213 @opindex mlong-jumps
27214 @opindex mno-long-jumps
27215 Disable (or re-enable) the generation of PC-relative jump instructions.
27216
27217 @item -msoft-float
27218 @itemx -mhard-float
27219 @opindex msoft-float
27220 @opindex mhard-float
27221 Disable (or re-enable) the generation of hardware floating point
27222 instructions. This option is only significant when the target
27223 architecture is @samp{V850E2V3} or higher. If hardware floating point
27224 instructions are being generated then the C preprocessor symbol
27225 @code{__FPU_OK__} is defined, otherwise the symbol
27226 @code{__NO_FPU__} is defined.
27227
27228 @item -mloop
27229 @opindex mloop
27230 Enables the use of the e3v5 LOOP instruction. The use of this
27231 instruction is not enabled by default when the e3v5 architecture is
27232 selected because its use is still experimental.
27233
27234 @item -mrh850-abi
27235 @itemx -mghs
27236 @opindex mrh850-abi
27237 @opindex mghs
27238 Enables support for the RH850 version of the V850 ABI. This is the
27239 default. With this version of the ABI the following rules apply:
27240
27241 @itemize
27242 @item
27243 Integer sized structures and unions are returned via a memory pointer
27244 rather than a register.
27245
27246 @item
27247 Large structures and unions (more than 8 bytes in size) are passed by
27248 value.
27249
27250 @item
27251 Functions are aligned to 16-bit boundaries.
27252
27253 @item
27254 The @option{-m8byte-align} command-line option is supported.
27255
27256 @item
27257 The @option{-mdisable-callt} command-line option is enabled by
27258 default. The @option{-mno-disable-callt} command-line option is not
27259 supported.
27260 @end itemize
27261
27262 When this version of the ABI is enabled the C preprocessor symbol
27263 @code{__V850_RH850_ABI__} is defined.
27264
27265 @item -mgcc-abi
27266 @opindex mgcc-abi
27267 Enables support for the old GCC version of the V850 ABI. With this
27268 version of the ABI the following rules apply:
27269
27270 @itemize
27271 @item
27272 Integer sized structures and unions are returned in register @code{r10}.
27273
27274 @item
27275 Large structures and unions (more than 8 bytes in size) are passed by
27276 reference.
27277
27278 @item
27279 Functions are aligned to 32-bit boundaries, unless optimizing for
27280 size.
27281
27282 @item
27283 The @option{-m8byte-align} command-line option is not supported.
27284
27285 @item
27286 The @option{-mdisable-callt} command-line option is supported but not
27287 enabled by default.
27288 @end itemize
27289
27290 When this version of the ABI is enabled the C preprocessor symbol
27291 @code{__V850_GCC_ABI__} is defined.
27292
27293 @item -m8byte-align
27294 @itemx -mno-8byte-align
27295 @opindex m8byte-align
27296 @opindex mno-8byte-align
27297 Enables support for @code{double} and @code{long long} types to be
27298 aligned on 8-byte boundaries. The default is to restrict the
27299 alignment of all objects to at most 4-bytes. When
27300 @option{-m8byte-align} is in effect the C preprocessor symbol
27301 @code{__V850_8BYTE_ALIGN__} is defined.
27302
27303 @item -mbig-switch
27304 @opindex mbig-switch
27305 Generate code suitable for big switch tables. Use this option only if
27306 the assembler/linker complain about out of range branches within a switch
27307 table.
27308
27309 @item -mapp-regs
27310 @opindex mapp-regs
27311 This option causes r2 and r5 to be used in the code generated by
27312 the compiler. This setting is the default.
27313
27314 @item -mno-app-regs
27315 @opindex mno-app-regs
27316 This option causes r2 and r5 to be treated as fixed registers.
27317
27318 @end table
27319
27320 @node VAX Options
27321 @subsection VAX Options
27322 @cindex VAX options
27323
27324 These @samp{-m} options are defined for the VAX:
27325
27326 @table @gcctabopt
27327 @item -munix
27328 @opindex munix
27329 Do not output certain jump instructions (@code{aobleq} and so on)
27330 that the Unix assembler for the VAX cannot handle across long
27331 ranges.
27332
27333 @item -mgnu
27334 @opindex mgnu
27335 Do output those jump instructions, on the assumption that the
27336 GNU assembler is being used.
27337
27338 @item -mg
27339 @opindex mg
27340 Output code for G-format floating-point numbers instead of D-format.
27341 @end table
27342
27343 @node Visium Options
27344 @subsection Visium Options
27345 @cindex Visium options
27346
27347 @table @gcctabopt
27348
27349 @item -mdebug
27350 @opindex mdebug
27351 A program which performs file I/O and is destined to run on an MCM target
27352 should be linked with this option. It causes the libraries libc.a and
27353 libdebug.a to be linked. The program should be run on the target under
27354 the control of the GDB remote debugging stub.
27355
27356 @item -msim
27357 @opindex msim
27358 A program which performs file I/O and is destined to run on the simulator
27359 should be linked with option. This causes libraries libc.a and libsim.a to
27360 be linked.
27361
27362 @item -mfpu
27363 @itemx -mhard-float
27364 @opindex mfpu
27365 @opindex mhard-float
27366 Generate code containing floating-point instructions. This is the
27367 default.
27368
27369 @item -mno-fpu
27370 @itemx -msoft-float
27371 @opindex mno-fpu
27372 @opindex msoft-float
27373 Generate code containing library calls for floating-point.
27374
27375 @option{-msoft-float} changes the calling convention in the output file;
27376 therefore, it is only useful if you compile @emph{all} of a program with
27377 this option. In particular, you need to compile @file{libgcc.a}, the
27378 library that comes with GCC, with @option{-msoft-float} in order for
27379 this to work.
27380
27381 @item -mcpu=@var{cpu_type}
27382 @opindex mcpu
27383 Set the instruction set, register set, and instruction scheduling parameters
27384 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27385 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27386
27387 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27388
27389 By default (unless configured otherwise), GCC generates code for the GR5
27390 variant of the Visium architecture.
27391
27392 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27393 architecture. The only difference from GR5 code is that the compiler will
27394 generate block move instructions.
27395
27396 @item -mtune=@var{cpu_type}
27397 @opindex mtune
27398 Set the instruction scheduling parameters for machine type @var{cpu_type},
27399 but do not set the instruction set or register set that the option
27400 @option{-mcpu=@var{cpu_type}} would.
27401
27402 @item -msv-mode
27403 @opindex msv-mode
27404 Generate code for the supervisor mode, where there are no restrictions on
27405 the access to general registers. This is the default.
27406
27407 @item -muser-mode
27408 @opindex muser-mode
27409 Generate code for the user mode, where the access to some general registers
27410 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27411 mode; on the GR6, only registers r29 to r31 are affected.
27412 @end table
27413
27414 @node VMS Options
27415 @subsection VMS Options
27416
27417 These @samp{-m} options are defined for the VMS implementations:
27418
27419 @table @gcctabopt
27420 @item -mvms-return-codes
27421 @opindex mvms-return-codes
27422 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27423 condition (e.g.@: error) codes.
27424
27425 @item -mdebug-main=@var{prefix}
27426 @opindex mdebug-main=@var{prefix}
27427 Flag the first routine whose name starts with @var{prefix} as the main
27428 routine for the debugger.
27429
27430 @item -mmalloc64
27431 @opindex mmalloc64
27432 Default to 64-bit memory allocation routines.
27433
27434 @item -mpointer-size=@var{size}
27435 @opindex mpointer-size=@var{size}
27436 Set the default size of pointers. Possible options for @var{size} are
27437 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27438 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27439 The later option disables @code{pragma pointer_size}.
27440 @end table
27441
27442 @node VxWorks Options
27443 @subsection VxWorks Options
27444 @cindex VxWorks Options
27445
27446 The options in this section are defined for all VxWorks targets.
27447 Options specific to the target hardware are listed with the other
27448 options for that target.
27449
27450 @table @gcctabopt
27451 @item -mrtp
27452 @opindex mrtp
27453 GCC can generate code for both VxWorks kernels and real time processes
27454 (RTPs). This option switches from the former to the latter. It also
27455 defines the preprocessor macro @code{__RTP__}.
27456
27457 @item -non-static
27458 @opindex non-static
27459 Link an RTP executable against shared libraries rather than static
27460 libraries. The options @option{-static} and @option{-shared} can
27461 also be used for RTPs (@pxref{Link Options}); @option{-static}
27462 is the default.
27463
27464 @item -Bstatic
27465 @itemx -Bdynamic
27466 @opindex Bstatic
27467 @opindex Bdynamic
27468 These options are passed down to the linker. They are defined for
27469 compatibility with Diab.
27470
27471 @item -Xbind-lazy
27472 @opindex Xbind-lazy
27473 Enable lazy binding of function calls. This option is equivalent to
27474 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27475
27476 @item -Xbind-now
27477 @opindex Xbind-now
27478 Disable lazy binding of function calls. This option is the default and
27479 is defined for compatibility with Diab.
27480 @end table
27481
27482 @node x86 Options
27483 @subsection x86 Options
27484 @cindex x86 Options
27485
27486 These @samp{-m} options are defined for the x86 family of computers.
27487
27488 @table @gcctabopt
27489
27490 @item -march=@var{cpu-type}
27491 @opindex march
27492 Generate instructions for the machine type @var{cpu-type}. In contrast to
27493 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27494 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27495 to generate code that may not run at all on processors other than the one
27496 indicated. Specifying @option{-march=@var{cpu-type}} implies
27497 @option{-mtune=@var{cpu-type}}.
27498
27499 The choices for @var{cpu-type} are:
27500
27501 @table @samp
27502 @item native
27503 This selects the CPU to generate code for at compilation time by determining
27504 the processor type of the compiling machine. Using @option{-march=native}
27505 enables all instruction subsets supported by the local machine (hence
27506 the result might not run on different machines). Using @option{-mtune=native}
27507 produces code optimized for the local machine under the constraints
27508 of the selected instruction set.
27509
27510 @item x86-64
27511 A generic CPU with 64-bit extensions.
27512
27513 @item i386
27514 Original Intel i386 CPU@.
27515
27516 @item i486
27517 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27518
27519 @item i586
27520 @itemx pentium
27521 Intel Pentium CPU with no MMX support.
27522
27523 @item lakemont
27524 Intel Lakemont MCU, based on Intel Pentium CPU.
27525
27526 @item pentium-mmx
27527 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27528
27529 @item pentiumpro
27530 Intel Pentium Pro CPU@.
27531
27532 @item i686
27533 When used with @option{-march}, the Pentium Pro
27534 instruction set is used, so the code runs on all i686 family chips.
27535 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27536
27537 @item pentium2
27538 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27539 support.
27540
27541 @item pentium3
27542 @itemx pentium3m
27543 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27544 set support.
27545
27546 @item pentium-m
27547 Intel Pentium M; low-power version of Intel Pentium III CPU
27548 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27549
27550 @item pentium4
27551 @itemx pentium4m
27552 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27553
27554 @item prescott
27555 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27556 set support.
27557
27558 @item nocona
27559 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27560 SSE2 and SSE3 instruction set support.
27561
27562 @item core2
27563 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27564 instruction set support.
27565
27566 @item nehalem
27567 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27568 SSE4.1, SSE4.2 and POPCNT instruction set support.
27569
27570 @item westmere
27571 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27572 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27573
27574 @item sandybridge
27575 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27576 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27577
27578 @item ivybridge
27579 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27580 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27581 instruction set support.
27582
27583 @item haswell
27584 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27585 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27586 BMI, BMI2 and F16C instruction set support.
27587
27588 @item broadwell
27589 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27590 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27591 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27592
27593 @item skylake
27594 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27595 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27596 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27597 XSAVES instruction set support.
27598
27599 @item bonnell
27600 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27601 instruction set support.
27602
27603 @item silvermont
27604 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27605 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27606
27607 @item goldmont
27608 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27609 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27610 instruction set support.
27611
27612 @item goldmont-plus
27613 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27614 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27615 PTWRITE, RDPID, SGX and UMIP instruction set support.
27616
27617 @item tremont
27618 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27619 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27620 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27621
27622 @item knl
27623 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27624 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27625 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27626 AVX512CD instruction set support.
27627
27628 @item knm
27629 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27630 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27631 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27632 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27633
27634 @item skylake-avx512
27635 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27636 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27637 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27638 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27639
27640 @item cannonlake
27641 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27642 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27643 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27644 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27645 AVX512IFMA, SHA and UMIP instruction set support.
27646
27647 @item icelake-client
27648 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27649 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27650 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27651 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27652 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27653 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27654
27655 @item icelake-server
27656 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27657 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27658 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27659 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27660 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27661 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27662 set support.
27663
27664 @item cascadelake
27665 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27666 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27667 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27668 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27669
27670 @item cooperlake
27671 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27672 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27673 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27674 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27675 set support.
27676
27677 @item tigerlake
27678 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27679 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27680 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27681 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27682 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27683 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27684 set support.
27685
27686 @item k6
27687 AMD K6 CPU with MMX instruction set support.
27688
27689 @item k6-2
27690 @itemx k6-3
27691 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27692
27693 @item athlon
27694 @itemx athlon-tbird
27695 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27696 support.
27697
27698 @item athlon-4
27699 @itemx athlon-xp
27700 @itemx athlon-mp
27701 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27702 instruction set support.
27703
27704 @item k8
27705 @itemx opteron
27706 @itemx athlon64
27707 @itemx athlon-fx
27708 Processors based on the AMD K8 core with x86-64 instruction set support,
27709 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27710 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27711 instruction set extensions.)
27712
27713 @item k8-sse3
27714 @itemx opteron-sse3
27715 @itemx athlon64-sse3
27716 Improved versions of AMD K8 cores with SSE3 instruction set support.
27717
27718 @item amdfam10
27719 @itemx barcelona
27720 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27721 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27722 instruction set extensions.)
27723
27724 @item bdver1
27725 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27726 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27727 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27728 @item bdver2
27729 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27730 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27731 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27732 extensions.)
27733 @item bdver3
27734 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27735 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27736 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27737 64-bit instruction set extensions.
27738 @item bdver4
27739 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27740 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27741 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27742 SSE4.2, ABM and 64-bit instruction set extensions.
27743
27744 @item znver1
27745 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27746 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27747 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27748 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27749 instruction set extensions.
27750 @item znver2
27751 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27752 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27753 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27754 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27755 instruction set extensions.)
27756
27757
27758 @item btver1
27759 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27760 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27761 instruction set extensions.)
27762
27763 @item btver2
27764 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27765 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27766 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27767
27768 @item winchip-c6
27769 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27770 set support.
27771
27772 @item winchip2
27773 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27774 instruction set support.
27775
27776 @item c3
27777 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27778 (No scheduling is implemented for this chip.)
27779
27780 @item c3-2
27781 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27782 (No scheduling is implemented for this chip.)
27783
27784 @item c7
27785 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27786 (No scheduling is implemented for this chip.)
27787
27788 @item samuel-2
27789 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27790 (No scheduling is implemented for this chip.)
27791
27792 @item nehemiah
27793 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27794 (No scheduling is implemented for this chip.)
27795
27796 @item esther
27797 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27798 (No scheduling is implemented for this chip.)
27799
27800 @item eden-x2
27801 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27802 (No scheduling is implemented for this chip.)
27803
27804 @item eden-x4
27805 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27806 AVX and AVX2 instruction set support.
27807 (No scheduling is implemented for this chip.)
27808
27809 @item nano
27810 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27811 instruction set support.
27812 (No scheduling is implemented for this chip.)
27813
27814 @item nano-1000
27815 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27816 instruction set support.
27817 (No scheduling is implemented for this chip.)
27818
27819 @item nano-2000
27820 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27821 instruction set support.
27822 (No scheduling is implemented for this chip.)
27823
27824 @item nano-3000
27825 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27826 instruction set support.
27827 (No scheduling is implemented for this chip.)
27828
27829 @item nano-x2
27830 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27831 instruction set support.
27832 (No scheduling is implemented for this chip.)
27833
27834 @item nano-x4
27835 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27836 instruction set support.
27837 (No scheduling is implemented for this chip.)
27838
27839 @item geode
27840 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27841 @end table
27842
27843 @item -mtune=@var{cpu-type}
27844 @opindex mtune
27845 Tune to @var{cpu-type} everything applicable about the generated code, except
27846 for the ABI and the set of available instructions.
27847 While picking a specific @var{cpu-type} schedules things appropriately
27848 for that particular chip, the compiler does not generate any code that
27849 cannot run on the default machine type unless you use a
27850 @option{-march=@var{cpu-type}} option.
27851 For example, if GCC is configured for i686-pc-linux-gnu
27852 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27853 but still runs on i686 machines.
27854
27855 The choices for @var{cpu-type} are the same as for @option{-march}.
27856 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27857
27858 @table @samp
27859 @item generic
27860 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27861 If you know the CPU on which your code will run, then you should use
27862 the corresponding @option{-mtune} or @option{-march} option instead of
27863 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27864 of your application will have, then you should use this option.
27865
27866 As new processors are deployed in the marketplace, the behavior of this
27867 option will change. Therefore, if you upgrade to a newer version of
27868 GCC, code generation controlled by this option will change to reflect
27869 the processors
27870 that are most common at the time that version of GCC is released.
27871
27872 There is no @option{-march=generic} option because @option{-march}
27873 indicates the instruction set the compiler can use, and there is no
27874 generic instruction set applicable to all processors. In contrast,
27875 @option{-mtune} indicates the processor (or, in this case, collection of
27876 processors) for which the code is optimized.
27877
27878 @item intel
27879 Produce code optimized for the most current Intel processors, which are
27880 Haswell and Silvermont for this version of GCC. If you know the CPU
27881 on which your code will run, then you should use the corresponding
27882 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27883 But, if you want your application performs better on both Haswell and
27884 Silvermont, then you should use this option.
27885
27886 As new Intel processors are deployed in the marketplace, the behavior of
27887 this option will change. Therefore, if you upgrade to a newer version of
27888 GCC, code generation controlled by this option will change to reflect
27889 the most current Intel processors at the time that version of GCC is
27890 released.
27891
27892 There is no @option{-march=intel} option because @option{-march} indicates
27893 the instruction set the compiler can use, and there is no common
27894 instruction set applicable to all processors. In contrast,
27895 @option{-mtune} indicates the processor (or, in this case, collection of
27896 processors) for which the code is optimized.
27897 @end table
27898
27899 @item -mcpu=@var{cpu-type}
27900 @opindex mcpu
27901 A deprecated synonym for @option{-mtune}.
27902
27903 @item -mfpmath=@var{unit}
27904 @opindex mfpmath
27905 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27906 for @var{unit} are:
27907
27908 @table @samp
27909 @item 387
27910 Use the standard 387 floating-point coprocessor present on the majority of chips and
27911 emulated otherwise. Code compiled with this option runs almost everywhere.
27912 The temporary results are computed in 80-bit precision instead of the precision
27913 specified by the type, resulting in slightly different results compared to most
27914 of other chips. See @option{-ffloat-store} for more detailed description.
27915
27916 This is the default choice for non-Darwin x86-32 targets.
27917
27918 @item sse
27919 Use scalar floating-point instructions present in the SSE instruction set.
27920 This instruction set is supported by Pentium III and newer chips,
27921 and in the AMD line
27922 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27923 instruction set supports only single-precision arithmetic, thus the double and
27924 extended-precision arithmetic are still done using 387. A later version, present
27925 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27926 arithmetic too.
27927
27928 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27929 or @option{-msse2} switches to enable SSE extensions and make this option
27930 effective. For the x86-64 compiler, these extensions are enabled by default.
27931
27932 The resulting code should be considerably faster in the majority of cases and avoid
27933 the numerical instability problems of 387 code, but may break some existing
27934 code that expects temporaries to be 80 bits.
27935
27936 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27937 and the default choice for x86-32 targets with the SSE2 instruction set
27938 when @option{-ffast-math} is enabled.
27939
27940 @item sse,387
27941 @itemx sse+387
27942 @itemx both
27943 Attempt to utilize both instruction sets at once. This effectively doubles the
27944 amount of available registers, and on chips with separate execution units for
27945 387 and SSE the execution resources too. Use this option with care, as it is
27946 still experimental, because the GCC register allocator does not model separate
27947 functional units well, resulting in unstable performance.
27948 @end table
27949
27950 @item -masm=@var{dialect}
27951 @opindex masm=@var{dialect}
27952 Output assembly instructions using selected @var{dialect}. Also affects
27953 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27954 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27955 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27956 not support @samp{intel}.
27957
27958 @item -mieee-fp
27959 @itemx -mno-ieee-fp
27960 @opindex mieee-fp
27961 @opindex mno-ieee-fp
27962 Control whether or not the compiler uses IEEE floating-point
27963 comparisons. These correctly handle the case where the result of a
27964 comparison is unordered.
27965
27966 @item -m80387
27967 @itemx -mhard-float
27968 @opindex 80387
27969 @opindex mhard-float
27970 Generate output containing 80387 instructions for floating point.
27971
27972 @item -mno-80387
27973 @itemx -msoft-float
27974 @opindex no-80387
27975 @opindex msoft-float
27976 Generate output containing library calls for floating point.
27977
27978 @strong{Warning:} the requisite libraries are not part of GCC@.
27979 Normally the facilities of the machine's usual C compiler are used, but
27980 this cannot be done directly in cross-compilation. You must make your
27981 own arrangements to provide suitable library functions for
27982 cross-compilation.
27983
27984 On machines where a function returns floating-point results in the 80387
27985 register stack, some floating-point opcodes may be emitted even if
27986 @option{-msoft-float} is used.
27987
27988 @item -mno-fp-ret-in-387
27989 @opindex mno-fp-ret-in-387
27990 @opindex mfp-ret-in-387
27991 Do not use the FPU registers for return values of functions.
27992
27993 The usual calling convention has functions return values of types
27994 @code{float} and @code{double} in an FPU register, even if there
27995 is no FPU@. The idea is that the operating system should emulate
27996 an FPU@.
27997
27998 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27999 in ordinary CPU registers instead.
28000
28001 @item -mno-fancy-math-387
28002 @opindex mno-fancy-math-387
28003 @opindex mfancy-math-387
28004 Some 387 emulators do not support the @code{sin}, @code{cos} and
28005 @code{sqrt} instructions for the 387. Specify this option to avoid
28006 generating those instructions.
28007 This option is overridden when @option{-march}
28008 indicates that the target CPU always has an FPU and so the
28009 instruction does not need emulation. These
28010 instructions are not generated unless you also use the
28011 @option{-funsafe-math-optimizations} switch.
28012
28013 @item -malign-double
28014 @itemx -mno-align-double
28015 @opindex malign-double
28016 @opindex mno-align-double
28017 Control whether GCC aligns @code{double}, @code{long double}, and
28018 @code{long long} variables on a two-word boundary or a one-word
28019 boundary. Aligning @code{double} variables on a two-word boundary
28020 produces code that runs somewhat faster on a Pentium at the
28021 expense of more memory.
28022
28023 On x86-64, @option{-malign-double} is enabled by default.
28024
28025 @strong{Warning:} if you use the @option{-malign-double} switch,
28026 structures containing the above types are aligned differently than
28027 the published application binary interface specifications for the x86-32
28028 and are not binary compatible with structures in code compiled
28029 without that switch.
28030
28031 @item -m96bit-long-double
28032 @itemx -m128bit-long-double
28033 @opindex m96bit-long-double
28034 @opindex m128bit-long-double
28035 These switches control the size of @code{long double} type. The x86-32
28036 application binary interface specifies the size to be 96 bits,
28037 so @option{-m96bit-long-double} is the default in 32-bit mode.
28038
28039 Modern architectures (Pentium and newer) prefer @code{long double}
28040 to be aligned to an 8- or 16-byte boundary. In arrays or structures
28041 conforming to the ABI, this is not possible. So specifying
28042 @option{-m128bit-long-double} aligns @code{long double}
28043 to a 16-byte boundary by padding the @code{long double} with an additional
28044 32-bit zero.
28045
28046 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28047 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28048
28049 Notice that neither of these options enable any extra precision over the x87
28050 standard of 80 bits for a @code{long double}.
28051
28052 @strong{Warning:} if you override the default value for your target ABI, this
28053 changes the size of
28054 structures and arrays containing @code{long double} variables,
28055 as well as modifying the function calling convention for functions taking
28056 @code{long double}. Hence they are not binary-compatible
28057 with code compiled without that switch.
28058
28059 @item -mlong-double-64
28060 @itemx -mlong-double-80
28061 @itemx -mlong-double-128
28062 @opindex mlong-double-64
28063 @opindex mlong-double-80
28064 @opindex mlong-double-128
28065 These switches control the size of @code{long double} type. A size
28066 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28067 type. This is the default for 32-bit Bionic C library. A size
28068 of 128 bits makes the @code{long double} type equivalent to the
28069 @code{__float128} type. This is the default for 64-bit Bionic C library.
28070
28071 @strong{Warning:} if you override the default value for your target ABI, this
28072 changes the size of
28073 structures and arrays containing @code{long double} variables,
28074 as well as modifying the function calling convention for functions taking
28075 @code{long double}. Hence they are not binary-compatible
28076 with code compiled without that switch.
28077
28078 @item -malign-data=@var{type}
28079 @opindex malign-data
28080 Control how GCC aligns variables. Supported values for @var{type} are
28081 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28082 and earlier, @samp{abi} uses alignment value as specified by the
28083 psABI, and @samp{cacheline} uses increased alignment value to match
28084 the cache line size. @samp{compat} is the default.
28085
28086 @item -mlarge-data-threshold=@var{threshold}
28087 @opindex mlarge-data-threshold
28088 When @option{-mcmodel=medium} is specified, data objects larger than
28089 @var{threshold} are placed in the large data section. This value must be the
28090 same across all objects linked into the binary, and defaults to 65535.
28091
28092 @item -mrtd
28093 @opindex mrtd
28094 Use a different function-calling convention, in which functions that
28095 take a fixed number of arguments return with the @code{ret @var{num}}
28096 instruction, which pops their arguments while returning. This saves one
28097 instruction in the caller since there is no need to pop the arguments
28098 there.
28099
28100 You can specify that an individual function is called with this calling
28101 sequence with the function attribute @code{stdcall}. You can also
28102 override the @option{-mrtd} option by using the function attribute
28103 @code{cdecl}. @xref{Function Attributes}.
28104
28105 @strong{Warning:} this calling convention is incompatible with the one
28106 normally used on Unix, so you cannot use it if you need to call
28107 libraries compiled with the Unix compiler.
28108
28109 Also, you must provide function prototypes for all functions that
28110 take variable numbers of arguments (including @code{printf});
28111 otherwise incorrect code is generated for calls to those
28112 functions.
28113
28114 In addition, seriously incorrect code results if you call a
28115 function with too many arguments. (Normally, extra arguments are
28116 harmlessly ignored.)
28117
28118 @item -mregparm=@var{num}
28119 @opindex mregparm
28120 Control how many registers are used to pass integer arguments. By
28121 default, no registers are used to pass arguments, and at most 3
28122 registers can be used. You can control this behavior for a specific
28123 function by using the function attribute @code{regparm}.
28124 @xref{Function Attributes}.
28125
28126 @strong{Warning:} if you use this switch, and
28127 @var{num} is nonzero, then you must build all modules with the same
28128 value, including any libraries. This includes the system libraries and
28129 startup modules.
28130
28131 @item -msseregparm
28132 @opindex msseregparm
28133 Use SSE register passing conventions for float and double arguments
28134 and return values. You can control this behavior for a specific
28135 function by using the function attribute @code{sseregparm}.
28136 @xref{Function Attributes}.
28137
28138 @strong{Warning:} if you use this switch then you must build all
28139 modules with the same value, including any libraries. This includes
28140 the system libraries and startup modules.
28141
28142 @item -mvect8-ret-in-mem
28143 @opindex mvect8-ret-in-mem
28144 Return 8-byte vectors in memory instead of MMX registers. This is the
28145 default on VxWorks to match the ABI of the Sun Studio compilers until
28146 version 12. @emph{Only} use this option if you need to remain
28147 compatible with existing code produced by those previous compiler
28148 versions or older versions of GCC@.
28149
28150 @item -mpc32
28151 @itemx -mpc64
28152 @itemx -mpc80
28153 @opindex mpc32
28154 @opindex mpc64
28155 @opindex mpc80
28156
28157 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28158 is specified, the significands of results of floating-point operations are
28159 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28160 significands of results of floating-point operations to 53 bits (double
28161 precision) and @option{-mpc80} rounds the significands of results of
28162 floating-point operations to 64 bits (extended double precision), which is
28163 the default. When this option is used, floating-point operations in higher
28164 precisions are not available to the programmer without setting the FPU
28165 control word explicitly.
28166
28167 Setting the rounding of floating-point operations to less than the default
28168 80 bits can speed some programs by 2% or more. Note that some mathematical
28169 libraries assume that extended-precision (80-bit) floating-point operations
28170 are enabled by default; routines in such libraries could suffer significant
28171 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28172 when this option is used to set the precision to less than extended precision.
28173
28174 @item -mstackrealign
28175 @opindex mstackrealign
28176 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28177 option generates an alternate prologue and epilogue that realigns the
28178 run-time stack if necessary. This supports mixing legacy codes that keep
28179 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28180 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28181 applicable to individual functions.
28182
28183 @item -mpreferred-stack-boundary=@var{num}
28184 @opindex mpreferred-stack-boundary
28185 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28186 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28187 the default is 4 (16 bytes or 128 bits).
28188
28189 @strong{Warning:} When generating code for the x86-64 architecture with
28190 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28191 used to keep the stack boundary aligned to 8 byte boundary. Since
28192 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28193 intended to be used in controlled environment where stack space is
28194 important limitation. This option leads to wrong code when functions
28195 compiled with 16 byte stack alignment (such as functions from a standard
28196 library) are called with misaligned stack. In this case, SSE
28197 instructions may lead to misaligned memory access traps. In addition,
28198 variable arguments are handled incorrectly for 16 byte aligned
28199 objects (including x87 long double and __int128), leading to wrong
28200 results. You must build all modules with
28201 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28202 includes the system libraries and startup modules.
28203
28204 @item -mincoming-stack-boundary=@var{num}
28205 @opindex mincoming-stack-boundary
28206 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28207 boundary. If @option{-mincoming-stack-boundary} is not specified,
28208 the one specified by @option{-mpreferred-stack-boundary} is used.
28209
28210 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28211 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28212 suffer significant run time performance penalties. On Pentium III, the
28213 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28214 properly if it is not 16-byte aligned.
28215
28216 To ensure proper alignment of this values on the stack, the stack boundary
28217 must be as aligned as that required by any value stored on the stack.
28218 Further, every function must be generated such that it keeps the stack
28219 aligned. Thus calling a function compiled with a higher preferred
28220 stack boundary from a function compiled with a lower preferred stack
28221 boundary most likely misaligns the stack. It is recommended that
28222 libraries that use callbacks always use the default setting.
28223
28224 This extra alignment does consume extra stack space, and generally
28225 increases code size. Code that is sensitive to stack space usage, such
28226 as embedded systems and operating system kernels, may want to reduce the
28227 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28228
28229 @need 200
28230 @item -mmmx
28231 @opindex mmmx
28232 @need 200
28233 @itemx -msse
28234 @opindex msse
28235 @need 200
28236 @itemx -msse2
28237 @opindex msse2
28238 @need 200
28239 @itemx -msse3
28240 @opindex msse3
28241 @need 200
28242 @itemx -mssse3
28243 @opindex mssse3
28244 @need 200
28245 @itemx -msse4
28246 @opindex msse4
28247 @need 200
28248 @itemx -msse4a
28249 @opindex msse4a
28250 @need 200
28251 @itemx -msse4.1
28252 @opindex msse4.1
28253 @need 200
28254 @itemx -msse4.2
28255 @opindex msse4.2
28256 @need 200
28257 @itemx -mavx
28258 @opindex mavx
28259 @need 200
28260 @itemx -mavx2
28261 @opindex mavx2
28262 @need 200
28263 @itemx -mavx512f
28264 @opindex mavx512f
28265 @need 200
28266 @itemx -mavx512pf
28267 @opindex mavx512pf
28268 @need 200
28269 @itemx -mavx512er
28270 @opindex mavx512er
28271 @need 200
28272 @itemx -mavx512cd
28273 @opindex mavx512cd
28274 @need 200
28275 @itemx -mavx512vl
28276 @opindex mavx512vl
28277 @need 200
28278 @itemx -mavx512bw
28279 @opindex mavx512bw
28280 @need 200
28281 @itemx -mavx512dq
28282 @opindex mavx512dq
28283 @need 200
28284 @itemx -mavx512ifma
28285 @opindex mavx512ifma
28286 @need 200
28287 @itemx -mavx512vbmi
28288 @opindex mavx512vbmi
28289 @need 200
28290 @itemx -msha
28291 @opindex msha
28292 @need 200
28293 @itemx -maes
28294 @opindex maes
28295 @need 200
28296 @itemx -mpclmul
28297 @opindex mpclmul
28298 @need 200
28299 @itemx -mclflushopt
28300 @opindex mclflushopt
28301 @need 200
28302 @itemx -mclwb
28303 @opindex mclwb
28304 @need 200
28305 @itemx -mfsgsbase
28306 @opindex mfsgsbase
28307 @need 200
28308 @itemx -mptwrite
28309 @opindex mptwrite
28310 @need 200
28311 @itemx -mrdrnd
28312 @opindex mrdrnd
28313 @need 200
28314 @itemx -mf16c
28315 @opindex mf16c
28316 @need 200
28317 @itemx -mfma
28318 @opindex mfma
28319 @need 200
28320 @itemx -mpconfig
28321 @opindex mpconfig
28322 @need 200
28323 @itemx -mwbnoinvd
28324 @opindex mwbnoinvd
28325 @need 200
28326 @itemx -mfma4
28327 @opindex mfma4
28328 @need 200
28329 @itemx -mprfchw
28330 @opindex mprfchw
28331 @need 200
28332 @itemx -mrdpid
28333 @opindex mrdpid
28334 @need 200
28335 @itemx -mprefetchwt1
28336 @opindex mprefetchwt1
28337 @need 200
28338 @itemx -mrdseed
28339 @opindex mrdseed
28340 @need 200
28341 @itemx -msgx
28342 @opindex msgx
28343 @need 200
28344 @itemx -mxop
28345 @opindex mxop
28346 @need 200
28347 @itemx -mlwp
28348 @opindex mlwp
28349 @need 200
28350 @itemx -m3dnow
28351 @opindex m3dnow
28352 @need 200
28353 @itemx -m3dnowa
28354 @opindex m3dnowa
28355 @need 200
28356 @itemx -mpopcnt
28357 @opindex mpopcnt
28358 @need 200
28359 @itemx -mabm
28360 @opindex mabm
28361 @need 200
28362 @itemx -madx
28363 @opindex madx
28364 @need 200
28365 @itemx -mbmi
28366 @opindex mbmi
28367 @need 200
28368 @itemx -mbmi2
28369 @opindex mbmi2
28370 @need 200
28371 @itemx -mlzcnt
28372 @opindex mlzcnt
28373 @need 200
28374 @itemx -mfxsr
28375 @opindex mfxsr
28376 @need 200
28377 @itemx -mxsave
28378 @opindex mxsave
28379 @need 200
28380 @itemx -mxsaveopt
28381 @opindex mxsaveopt
28382 @need 200
28383 @itemx -mxsavec
28384 @opindex mxsavec
28385 @need 200
28386 @itemx -mxsaves
28387 @opindex mxsaves
28388 @need 200
28389 @itemx -mrtm
28390 @opindex mrtm
28391 @need 200
28392 @itemx -mhle
28393 @opindex mhle
28394 @need 200
28395 @itemx -mtbm
28396 @opindex mtbm
28397 @need 200
28398 @itemx -mmwaitx
28399 @opindex mmwaitx
28400 @need 200
28401 @itemx -mclzero
28402 @opindex mclzero
28403 @need 200
28404 @itemx -mpku
28405 @opindex mpku
28406 @need 200
28407 @itemx -mavx512vbmi2
28408 @opindex mavx512vbmi2
28409 @need 200
28410 @itemx -mavx512bf16
28411 @opindex mavx512bf16
28412 @need 200
28413 @itemx -mgfni
28414 @opindex mgfni
28415 @need 200
28416 @itemx -mvaes
28417 @opindex mvaes
28418 @need 200
28419 @itemx -mwaitpkg
28420 @opindex mwaitpkg
28421 @need 200
28422 @itemx -mvpclmulqdq
28423 @opindex mvpclmulqdq
28424 @need 200
28425 @itemx -mavx512bitalg
28426 @opindex mavx512bitalg
28427 @need 200
28428 @itemx -mmovdiri
28429 @opindex mmovdiri
28430 @need 200
28431 @itemx -mmovdir64b
28432 @opindex mmovdir64b
28433 @need 200
28434 @itemx -menqcmd
28435 @opindex menqcmd
28436 @need 200
28437 @itemx -mavx512vpopcntdq
28438 @opindex mavx512vpopcntdq
28439 @need 200
28440 @itemx -mavx512vp2intersect
28441 @opindex mavx512vp2intersect
28442 @need 200
28443 @itemx -mavx5124fmaps
28444 @opindex mavx5124fmaps
28445 @need 200
28446 @itemx -mavx512vnni
28447 @opindex mavx512vnni
28448 @need 200
28449 @itemx -mavx5124vnniw
28450 @opindex mavx5124vnniw
28451 @need 200
28452 @itemx -mcldemote
28453 @opindex mcldemote
28454 These switches enable the use of instructions in the MMX, SSE,
28455 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28456 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28457 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28458 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28459 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28460 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28461 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28462 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28463 extended instruction sets. Each has a corresponding @option{-mno-} option to
28464 disable use of these instructions.
28465
28466 These extensions are also available as built-in functions: see
28467 @ref{x86 Built-in Functions}, for details of the functions enabled and
28468 disabled by these switches.
28469
28470 To generate SSE/SSE2 instructions automatically from floating-point
28471 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28472
28473 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28474 generates new AVX instructions or AVX equivalence for all SSEx instructions
28475 when needed.
28476
28477 These options enable GCC to use these extended instructions in
28478 generated code, even without @option{-mfpmath=sse}. Applications that
28479 perform run-time CPU detection must compile separate files for each
28480 supported architecture, using the appropriate flags. In particular,
28481 the file containing the CPU detection code should be compiled without
28482 these options.
28483
28484 @item -mdump-tune-features
28485 @opindex mdump-tune-features
28486 This option instructs GCC to dump the names of the x86 performance
28487 tuning features and default settings. The names can be used in
28488 @option{-mtune-ctrl=@var{feature-list}}.
28489
28490 @item -mtune-ctrl=@var{feature-list}
28491 @opindex mtune-ctrl=@var{feature-list}
28492 This option is used to do fine grain control of x86 code generation features.
28493 @var{feature-list} is a comma separated list of @var{feature} names. See also
28494 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28495 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28496 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28497 developers. Using it may lead to code paths not covered by testing and can
28498 potentially result in compiler ICEs or runtime errors.
28499
28500 @item -mno-default
28501 @opindex mno-default
28502 This option instructs GCC to turn off all tunable features. See also
28503 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28504
28505 @item -mcld
28506 @opindex mcld
28507 This option instructs GCC to emit a @code{cld} instruction in the prologue
28508 of functions that use string instructions. String instructions depend on
28509 the DF flag to select between autoincrement or autodecrement mode. While the
28510 ABI specifies the DF flag to be cleared on function entry, some operating
28511 systems violate this specification by not clearing the DF flag in their
28512 exception dispatchers. The exception handler can be invoked with the DF flag
28513 set, which leads to wrong direction mode when string instructions are used.
28514 This option can be enabled by default on 32-bit x86 targets by configuring
28515 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28516 instructions can be suppressed with the @option{-mno-cld} compiler option
28517 in this case.
28518
28519 @item -mvzeroupper
28520 @opindex mvzeroupper
28521 This option instructs GCC to emit a @code{vzeroupper} instruction
28522 before a transfer of control flow out of the function to minimize
28523 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28524 intrinsics.
28525
28526 @item -mprefer-avx128
28527 @opindex mprefer-avx128
28528 This option instructs GCC to use 128-bit AVX instructions instead of
28529 256-bit AVX instructions in the auto-vectorizer.
28530
28531 @item -mprefer-vector-width=@var{opt}
28532 @opindex mprefer-vector-width
28533 This option instructs GCC to use @var{opt}-bit vector width in instructions
28534 instead of default on the selected platform.
28535
28536 @table @samp
28537 @item none
28538 No extra limitations applied to GCC other than defined by the selected platform.
28539
28540 @item 128
28541 Prefer 128-bit vector width for instructions.
28542
28543 @item 256
28544 Prefer 256-bit vector width for instructions.
28545
28546 @item 512
28547 Prefer 512-bit vector width for instructions.
28548 @end table
28549
28550 @item -mcx16
28551 @opindex mcx16
28552 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28553 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28554 objects. This is useful for atomic updates of data structures exceeding one
28555 machine word in size. The compiler uses this instruction to implement
28556 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28557 128-bit integers, a library call is always used.
28558
28559 @item -msahf
28560 @opindex msahf
28561 This option enables generation of @code{SAHF} instructions in 64-bit code.
28562 Early Intel Pentium 4 CPUs with Intel 64 support,
28563 prior to the introduction of Pentium 4 G1 step in December 2005,
28564 lacked the @code{LAHF} and @code{SAHF} instructions
28565 which are supported by AMD64.
28566 These are load and store instructions, respectively, for certain status flags.
28567 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28568 @code{drem}, and @code{remainder} built-in functions;
28569 see @ref{Other Builtins} for details.
28570
28571 @item -mmovbe
28572 @opindex mmovbe
28573 This option enables use of the @code{movbe} instruction to implement
28574 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28575
28576 @item -mshstk
28577 @opindex mshstk
28578 The @option{-mshstk} option enables shadow stack built-in functions
28579 from x86 Control-flow Enforcement Technology (CET).
28580
28581 @item -mcrc32
28582 @opindex mcrc32
28583 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28584 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28585 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28586
28587 @item -mrecip
28588 @opindex mrecip
28589 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28590 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28591 with an additional Newton-Raphson step
28592 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28593 (and their vectorized
28594 variants) for single-precision floating-point arguments. These instructions
28595 are generated only when @option{-funsafe-math-optimizations} is enabled
28596 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28597 Note that while the throughput of the sequence is higher than the throughput
28598 of the non-reciprocal instruction, the precision of the sequence can be
28599 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28600
28601 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28602 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28603 combination), and doesn't need @option{-mrecip}.
28604
28605 Also note that GCC emits the above sequence with additional Newton-Raphson step
28606 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28607 already with @option{-ffast-math} (or the above option combination), and
28608 doesn't need @option{-mrecip}.
28609
28610 @item -mrecip=@var{opt}
28611 @opindex mrecip=opt
28612 This option controls which reciprocal estimate instructions
28613 may be used. @var{opt} is a comma-separated list of options, which may
28614 be preceded by a @samp{!} to invert the option:
28615
28616 @table @samp
28617 @item all
28618 Enable all estimate instructions.
28619
28620 @item default
28621 Enable the default instructions, equivalent to @option{-mrecip}.
28622
28623 @item none
28624 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28625
28626 @item div
28627 Enable the approximation for scalar division.
28628
28629 @item vec-div
28630 Enable the approximation for vectorized division.
28631
28632 @item sqrt
28633 Enable the approximation for scalar square root.
28634
28635 @item vec-sqrt
28636 Enable the approximation for vectorized square root.
28637 @end table
28638
28639 So, for example, @option{-mrecip=all,!sqrt} enables
28640 all of the reciprocal approximations, except for square root.
28641
28642 @item -mveclibabi=@var{type}
28643 @opindex mveclibabi
28644 Specifies the ABI type to use for vectorizing intrinsics using an
28645 external library. Supported values for @var{type} are @samp{svml}
28646 for the Intel short
28647 vector math library and @samp{acml} for the AMD math core library.
28648 To use this option, both @option{-ftree-vectorize} and
28649 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28650 ABI-compatible library must be specified at link time.
28651
28652 GCC currently emits calls to @code{vmldExp2},
28653 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28654 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28655 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28656 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28657 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28658 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28659 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28660 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28661 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28662 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28663 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28664 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28665 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28666 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28667 when @option{-mveclibabi=acml} is used.
28668
28669 @item -mabi=@var{name}
28670 @opindex mabi
28671 Generate code for the specified calling convention. Permissible values
28672 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28673 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28674 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28675 You can control this behavior for specific functions by
28676 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28677 @xref{Function Attributes}.
28678
28679 @item -mforce-indirect-call
28680 @opindex mforce-indirect-call
28681 Force all calls to functions to be indirect. This is useful
28682 when using Intel Processor Trace where it generates more precise timing
28683 information for function calls.
28684
28685 @item -mmanual-endbr
28686 @opindex mmanual-endbr
28687 Insert ENDBR instruction at function entry only via the @code{cf_check}
28688 function attribute. This is useful when used with the option
28689 @option{-fcf-protection=branch} to control ENDBR insertion at the
28690 function entry.
28691
28692 @item -mcall-ms2sysv-xlogues
28693 @opindex mcall-ms2sysv-xlogues
28694 @opindex mno-call-ms2sysv-xlogues
28695 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28696 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28697 default, the code for saving and restoring these registers is emitted inline,
28698 resulting in fairly lengthy prologues and epilogues. Using
28699 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28700 use stubs in the static portion of libgcc to perform these saves and restores,
28701 thus reducing function size at the cost of a few extra instructions.
28702
28703 @item -mtls-dialect=@var{type}
28704 @opindex mtls-dialect
28705 Generate code to access thread-local storage using the @samp{gnu} or
28706 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28707 @samp{gnu2} is more efficient, but it may add compile- and run-time
28708 requirements that cannot be satisfied on all systems.
28709
28710 @item -mpush-args
28711 @itemx -mno-push-args
28712 @opindex mpush-args
28713 @opindex mno-push-args
28714 Use PUSH operations to store outgoing parameters. This method is shorter
28715 and usually equally fast as method using SUB/MOV operations and is enabled
28716 by default. In some cases disabling it may improve performance because of
28717 improved scheduling and reduced dependencies.
28718
28719 @item -maccumulate-outgoing-args
28720 @opindex maccumulate-outgoing-args
28721 If enabled, the maximum amount of space required for outgoing arguments is
28722 computed in the function prologue. This is faster on most modern CPUs
28723 because of reduced dependencies, improved scheduling and reduced stack usage
28724 when the preferred stack boundary is not equal to 2. The drawback is a notable
28725 increase in code size. This switch implies @option{-mno-push-args}.
28726
28727 @item -mthreads
28728 @opindex mthreads
28729 Support thread-safe exception handling on MinGW. Programs that rely
28730 on thread-safe exception handling must compile and link all code with the
28731 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28732 @option{-D_MT}; when linking, it links in a special thread helper library
28733 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28734
28735 @item -mms-bitfields
28736 @itemx -mno-ms-bitfields
28737 @opindex mms-bitfields
28738 @opindex mno-ms-bitfields
28739
28740 Enable/disable bit-field layout compatible with the native Microsoft
28741 Windows compiler.
28742
28743 If @code{packed} is used on a structure, or if bit-fields are used,
28744 it may be that the Microsoft ABI lays out the structure differently
28745 than the way GCC normally does. Particularly when moving packed
28746 data between functions compiled with GCC and the native Microsoft compiler
28747 (either via function call or as data in a file), it may be necessary to access
28748 either format.
28749
28750 This option is enabled by default for Microsoft Windows
28751 targets. This behavior can also be controlled locally by use of variable
28752 or type attributes. For more information, see @ref{x86 Variable Attributes}
28753 and @ref{x86 Type Attributes}.
28754
28755 The Microsoft structure layout algorithm is fairly simple with the exception
28756 of the bit-field packing.
28757 The padding and alignment of members of structures and whether a bit-field
28758 can straddle a storage-unit boundary are determine by these rules:
28759
28760 @enumerate
28761 @item Structure members are stored sequentially in the order in which they are
28762 declared: the first member has the lowest memory address and the last member
28763 the highest.
28764
28765 @item Every data object has an alignment requirement. The alignment requirement
28766 for all data except structures, unions, and arrays is either the size of the
28767 object or the current packing size (specified with either the
28768 @code{aligned} attribute or the @code{pack} pragma),
28769 whichever is less. For structures, unions, and arrays,
28770 the alignment requirement is the largest alignment requirement of its members.
28771 Every object is allocated an offset so that:
28772
28773 @smallexample
28774 offset % alignment_requirement == 0
28775 @end smallexample
28776
28777 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28778 unit if the integral types are the same size and if the next bit-field fits
28779 into the current allocation unit without crossing the boundary imposed by the
28780 common alignment requirements of the bit-fields.
28781 @end enumerate
28782
28783 MSVC interprets zero-length bit-fields in the following ways:
28784
28785 @enumerate
28786 @item If a zero-length bit-field is inserted between two bit-fields that
28787 are normally coalesced, the bit-fields are not coalesced.
28788
28789 For example:
28790
28791 @smallexample
28792 struct
28793 @{
28794 unsigned long bf_1 : 12;
28795 unsigned long : 0;
28796 unsigned long bf_2 : 12;
28797 @} t1;
28798 @end smallexample
28799
28800 @noindent
28801 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28802 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28803
28804 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28805 alignment of the zero-length bit-field is greater than the member that follows it,
28806 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28807
28808 For example:
28809
28810 @smallexample
28811 struct
28812 @{
28813 char foo : 4;
28814 short : 0;
28815 char bar;
28816 @} t2;
28817
28818 struct
28819 @{
28820 char foo : 4;
28821 short : 0;
28822 double bar;
28823 @} t3;
28824 @end smallexample
28825
28826 @noindent
28827 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28828 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28829 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28830 of the structure.
28831
28832 Taking this into account, it is important to note the following:
28833
28834 @enumerate
28835 @item If a zero-length bit-field follows a normal bit-field, the type of the
28836 zero-length bit-field may affect the alignment of the structure as whole. For
28837 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28838 normal bit-field, and is of type short.
28839
28840 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28841 still affect the alignment of the structure:
28842
28843 @smallexample
28844 struct
28845 @{
28846 char foo : 6;
28847 long : 0;
28848 @} t4;
28849 @end smallexample
28850
28851 @noindent
28852 Here, @code{t4} takes up 4 bytes.
28853 @end enumerate
28854
28855 @item Zero-length bit-fields following non-bit-field members are ignored:
28856
28857 @smallexample
28858 struct
28859 @{
28860 char foo;
28861 long : 0;
28862 char bar;
28863 @} t5;
28864 @end smallexample
28865
28866 @noindent
28867 Here, @code{t5} takes up 2 bytes.
28868 @end enumerate
28869
28870
28871 @item -mno-align-stringops
28872 @opindex mno-align-stringops
28873 @opindex malign-stringops
28874 Do not align the destination of inlined string operations. This switch reduces
28875 code size and improves performance in case the destination is already aligned,
28876 but GCC doesn't know about it.
28877
28878 @item -minline-all-stringops
28879 @opindex minline-all-stringops
28880 By default GCC inlines string operations only when the destination is
28881 known to be aligned to least a 4-byte boundary.
28882 This enables more inlining and increases code
28883 size, but may improve performance of code that depends on fast
28884 @code{memcpy} and @code{memset} for short lengths.
28885 The option enables inline expansion of @code{strlen} for all
28886 pointer alignments.
28887
28888 @item -minline-stringops-dynamically
28889 @opindex minline-stringops-dynamically
28890 For string operations of unknown size, use run-time checks with
28891 inline code for small blocks and a library call for large blocks.
28892
28893 @item -mstringop-strategy=@var{alg}
28894 @opindex mstringop-strategy=@var{alg}
28895 Override the internal decision heuristic for the particular algorithm to use
28896 for inlining string operations. The allowed values for @var{alg} are:
28897
28898 @table @samp
28899 @item rep_byte
28900 @itemx rep_4byte
28901 @itemx rep_8byte
28902 Expand using i386 @code{rep} prefix of the specified size.
28903
28904 @item byte_loop
28905 @itemx loop
28906 @itemx unrolled_loop
28907 Expand into an inline loop.
28908
28909 @item libcall
28910 Always use a library call.
28911 @end table
28912
28913 @item -mmemcpy-strategy=@var{strategy}
28914 @opindex mmemcpy-strategy=@var{strategy}
28915 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28916 should be inlined and what inline algorithm to use when the expected size
28917 of the copy operation is known. @var{strategy}
28918 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28919 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28920 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28921 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28922 in the list must be specified in increasing order. The minimal byte size for
28923 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28924 preceding range.
28925
28926 @item -mmemset-strategy=@var{strategy}
28927 @opindex mmemset-strategy=@var{strategy}
28928 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28929 @code{__builtin_memset} expansion.
28930
28931 @item -momit-leaf-frame-pointer
28932 @opindex momit-leaf-frame-pointer
28933 Don't keep the frame pointer in a register for leaf functions. This
28934 avoids the instructions to save, set up, and restore frame pointers and
28935 makes an extra register available in leaf functions. The option
28936 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28937 which might make debugging harder.
28938
28939 @item -mtls-direct-seg-refs
28940 @itemx -mno-tls-direct-seg-refs
28941 @opindex mtls-direct-seg-refs
28942 Controls whether TLS variables may be accessed with offsets from the
28943 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28944 or whether the thread base pointer must be added. Whether or not this
28945 is valid depends on the operating system, and whether it maps the
28946 segment to cover the entire TLS area.
28947
28948 For systems that use the GNU C Library, the default is on.
28949
28950 @item -msse2avx
28951 @itemx -mno-sse2avx
28952 @opindex msse2avx
28953 Specify that the assembler should encode SSE instructions with VEX
28954 prefix. The option @option{-mavx} turns this on by default.
28955
28956 @item -mfentry
28957 @itemx -mno-fentry
28958 @opindex mfentry
28959 If profiling is active (@option{-pg}), put the profiling
28960 counter call before the prologue.
28961 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28962 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28963
28964 @item -mrecord-mcount
28965 @itemx -mno-record-mcount
28966 @opindex mrecord-mcount
28967 If profiling is active (@option{-pg}), generate a __mcount_loc section
28968 that contains pointers to each profiling call. This is useful for
28969 automatically patching and out calls.
28970
28971 @item -mnop-mcount
28972 @itemx -mno-nop-mcount
28973 @opindex mnop-mcount
28974 If profiling is active (@option{-pg}), generate the calls to
28975 the profiling functions as NOPs. This is useful when they
28976 should be patched in later dynamically. This is likely only
28977 useful together with @option{-mrecord-mcount}.
28978
28979 @item -minstrument-return=@var{type}
28980 @opindex minstrument-return
28981 Instrument function exit in -pg -mfentry instrumented functions with
28982 call to specified function. This only instruments true returns ending
28983 with ret, but not sibling calls ending with jump. Valid types
28984 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28985 or @var{nop5} to generate a 5 byte nop.
28986
28987 @item -mrecord-return
28988 @itemx -mno-record-return
28989 @opindex mrecord-return
28990 Generate a __return_loc section pointing to all return instrumentation code.
28991
28992 @item -mfentry-name=@var{name}
28993 @opindex mfentry-name
28994 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28995
28996 @item -mfentry-section=@var{name}
28997 @opindex mfentry-section
28998 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28999
29000 @item -mskip-rax-setup
29001 @itemx -mno-skip-rax-setup
29002 @opindex mskip-rax-setup
29003 When generating code for the x86-64 architecture with SSE extensions
29004 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
29005 register when there are no variable arguments passed in vector registers.
29006
29007 @strong{Warning:} Since RAX register is used to avoid unnecessarily
29008 saving vector registers on stack when passing variable arguments, the
29009 impacts of this option are callees may waste some stack space,
29010 misbehave or jump to a random location. GCC 4.4 or newer don't have
29011 those issues, regardless the RAX register value.
29012
29013 @item -m8bit-idiv
29014 @itemx -mno-8bit-idiv
29015 @opindex m8bit-idiv
29016 On some processors, like Intel Atom, 8-bit unsigned integer divide is
29017 much faster than 32-bit/64-bit integer divide. This option generates a
29018 run-time check. If both dividend and divisor are within range of 0
29019 to 255, 8-bit unsigned integer divide is used instead of
29020 32-bit/64-bit integer divide.
29021
29022 @item -mavx256-split-unaligned-load
29023 @itemx -mavx256-split-unaligned-store
29024 @opindex mavx256-split-unaligned-load
29025 @opindex mavx256-split-unaligned-store
29026 Split 32-byte AVX unaligned load and store.
29027
29028 @item -mstack-protector-guard=@var{guard}
29029 @itemx -mstack-protector-guard-reg=@var{reg}
29030 @itemx -mstack-protector-guard-offset=@var{offset}
29031 @opindex mstack-protector-guard
29032 @opindex mstack-protector-guard-reg
29033 @opindex mstack-protector-guard-offset
29034 Generate stack protection code using canary at @var{guard}. Supported
29035 locations are @samp{global} for global canary or @samp{tls} for per-thread
29036 canary in the TLS block (the default). This option has effect only when
29037 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29038
29039 With the latter choice the options
29040 @option{-mstack-protector-guard-reg=@var{reg}} and
29041 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29042 which segment register (@code{%fs} or @code{%gs}) to use as base register
29043 for reading the canary, and from what offset from that base register.
29044 The default for those is as specified in the relevant ABI.
29045
29046 @item -mgeneral-regs-only
29047 @opindex mgeneral-regs-only
29048 Generate code that uses only the general-purpose registers. This
29049 prevents the compiler from using floating-point, vector, mask and bound
29050 registers.
29051
29052 @item -mindirect-branch=@var{choice}
29053 @opindex mindirect-branch
29054 Convert indirect call and jump with @var{choice}. The default is
29055 @samp{keep}, which keeps indirect call and jump unmodified.
29056 @samp{thunk} converts indirect call and jump to call and return thunk.
29057 @samp{thunk-inline} converts indirect call and jump to inlined call
29058 and return thunk. @samp{thunk-extern} converts indirect call and jump
29059 to external call and return thunk provided in a separate object file.
29060 You can control this behavior for a specific function by using the
29061 function attribute @code{indirect_branch}. @xref{Function Attributes}.
29062
29063 Note that @option{-mcmodel=large} is incompatible with
29064 @option{-mindirect-branch=thunk} and
29065 @option{-mindirect-branch=thunk-extern} since the thunk function may
29066 not be reachable in the large code model.
29067
29068 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29069 @option{-fcf-protection=branch} since the external thunk cannot be modified
29070 to disable control-flow check.
29071
29072 @item -mfunction-return=@var{choice}
29073 @opindex mfunction-return
29074 Convert function return with @var{choice}. The default is @samp{keep},
29075 which keeps function return unmodified. @samp{thunk} converts function
29076 return to call and return thunk. @samp{thunk-inline} converts function
29077 return to inlined call and return thunk. @samp{thunk-extern} converts
29078 function return to external call and return thunk provided in a separate
29079 object file. You can control this behavior for a specific function by
29080 using the function attribute @code{function_return}.
29081 @xref{Function Attributes}.
29082
29083 Note that @option{-mcmodel=large} is incompatible with
29084 @option{-mfunction-return=thunk} and
29085 @option{-mfunction-return=thunk-extern} since the thunk function may
29086 not be reachable in the large code model.
29087
29088
29089 @item -mindirect-branch-register
29090 @opindex mindirect-branch-register
29091 Force indirect call and jump via register.
29092
29093 @end table
29094
29095 These @samp{-m} switches are supported in addition to the above
29096 on x86-64 processors in 64-bit environments.
29097
29098 @table @gcctabopt
29099 @item -m32
29100 @itemx -m64
29101 @itemx -mx32
29102 @itemx -m16
29103 @itemx -miamcu
29104 @opindex m32
29105 @opindex m64
29106 @opindex mx32
29107 @opindex m16
29108 @opindex miamcu
29109 Generate code for a 16-bit, 32-bit or 64-bit environment.
29110 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29111 to 32 bits, and
29112 generates code that runs on any i386 system.
29113
29114 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29115 types to 64 bits, and generates code for the x86-64 architecture.
29116 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29117 and @option{-mdynamic-no-pic} options.
29118
29119 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29120 to 32 bits, and
29121 generates code for the x86-64 architecture.
29122
29123 The @option{-m16} option is the same as @option{-m32}, except for that
29124 it outputs the @code{.code16gcc} assembly directive at the beginning of
29125 the assembly output so that the binary can run in 16-bit mode.
29126
29127 The @option{-miamcu} option generates code which conforms to Intel MCU
29128 psABI. It requires the @option{-m32} option to be turned on.
29129
29130 @item -mno-red-zone
29131 @opindex mno-red-zone
29132 @opindex mred-zone
29133 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29134 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29135 stack pointer that is not modified by signal or interrupt handlers
29136 and therefore can be used for temporary data without adjusting the stack
29137 pointer. The flag @option{-mno-red-zone} disables this red zone.
29138
29139 @item -mcmodel=small
29140 @opindex mcmodel=small
29141 Generate code for the small code model: the program and its symbols must
29142 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29143 Programs can be statically or dynamically linked. This is the default
29144 code model.
29145
29146 @item -mcmodel=kernel
29147 @opindex mcmodel=kernel
29148 Generate code for the kernel code model. The kernel runs in the
29149 negative 2 GB of the address space.
29150 This model has to be used for Linux kernel code.
29151
29152 @item -mcmodel=medium
29153 @opindex mcmodel=medium
29154 Generate code for the medium model: the program is linked in the lower 2
29155 GB of the address space. Small symbols are also placed there. Symbols
29156 with sizes larger than @option{-mlarge-data-threshold} are put into
29157 large data or BSS sections and can be located above 2GB. Programs can
29158 be statically or dynamically linked.
29159
29160 @item -mcmodel=large
29161 @opindex mcmodel=large
29162 Generate code for the large model. This model makes no assumptions
29163 about addresses and sizes of sections.
29164
29165 @item -maddress-mode=long
29166 @opindex maddress-mode=long
29167 Generate code for long address mode. This is only supported for 64-bit
29168 and x32 environments. It is the default address mode for 64-bit
29169 environments.
29170
29171 @item -maddress-mode=short
29172 @opindex maddress-mode=short
29173 Generate code for short address mode. This is only supported for 32-bit
29174 and x32 environments. It is the default address mode for 32-bit and
29175 x32 environments.
29176 @end table
29177
29178 @node x86 Windows Options
29179 @subsection x86 Windows Options
29180 @cindex x86 Windows Options
29181 @cindex Windows Options for x86
29182
29183 These additional options are available for Microsoft Windows targets:
29184
29185 @table @gcctabopt
29186 @item -mconsole
29187 @opindex mconsole
29188 This option
29189 specifies that a console application is to be generated, by
29190 instructing the linker to set the PE header subsystem type
29191 required for console applications.
29192 This option is available for Cygwin and MinGW targets and is
29193 enabled by default on those targets.
29194
29195 @item -mdll
29196 @opindex mdll
29197 This option is available for Cygwin and MinGW targets. It
29198 specifies that a DLL---a dynamic link library---is to be
29199 generated, enabling the selection of the required runtime
29200 startup object and entry point.
29201
29202 @item -mnop-fun-dllimport
29203 @opindex mnop-fun-dllimport
29204 This option is available for Cygwin and MinGW targets. It
29205 specifies that the @code{dllimport} attribute should be ignored.
29206
29207 @item -mthread
29208 @opindex mthread
29209 This option is available for MinGW targets. It specifies
29210 that MinGW-specific thread support is to be used.
29211
29212 @item -municode
29213 @opindex municode
29214 This option is available for MinGW-w64 targets. It causes
29215 the @code{UNICODE} preprocessor macro to be predefined, and
29216 chooses Unicode-capable runtime startup code.
29217
29218 @item -mwin32
29219 @opindex mwin32
29220 This option is available for Cygwin and MinGW targets. It
29221 specifies that the typical Microsoft Windows predefined macros are to
29222 be set in the pre-processor, but does not influence the choice
29223 of runtime library/startup code.
29224
29225 @item -mwindows
29226 @opindex mwindows
29227 This option is available for Cygwin and MinGW targets. It
29228 specifies that a GUI application is to be generated by
29229 instructing the linker to set the PE header subsystem type
29230 appropriately.
29231
29232 @item -fno-set-stack-executable
29233 @opindex fno-set-stack-executable
29234 @opindex fset-stack-executable
29235 This option is available for MinGW targets. It specifies that
29236 the executable flag for the stack used by nested functions isn't
29237 set. This is necessary for binaries running in kernel mode of
29238 Microsoft Windows, as there the User32 API, which is used to set executable
29239 privileges, isn't available.
29240
29241 @item -fwritable-relocated-rdata
29242 @opindex fno-writable-relocated-rdata
29243 @opindex fwritable-relocated-rdata
29244 This option is available for MinGW and Cygwin targets. It specifies
29245 that relocated-data in read-only section is put into the @code{.data}
29246 section. This is a necessary for older runtimes not supporting
29247 modification of @code{.rdata} sections for pseudo-relocation.
29248
29249 @item -mpe-aligned-commons
29250 @opindex mpe-aligned-commons
29251 This option is available for Cygwin and MinGW targets. It
29252 specifies that the GNU extension to the PE file format that
29253 permits the correct alignment of COMMON variables should be
29254 used when generating code. It is enabled by default if
29255 GCC detects that the target assembler found during configuration
29256 supports the feature.
29257 @end table
29258
29259 See also under @ref{x86 Options} for standard options.
29260
29261 @node Xstormy16 Options
29262 @subsection Xstormy16 Options
29263 @cindex Xstormy16 Options
29264
29265 These options are defined for Xstormy16:
29266
29267 @table @gcctabopt
29268 @item -msim
29269 @opindex msim
29270 Choose startup files and linker script suitable for the simulator.
29271 @end table
29272
29273 @node Xtensa Options
29274 @subsection Xtensa Options
29275 @cindex Xtensa Options
29276
29277 These options are supported for Xtensa targets:
29278
29279 @table @gcctabopt
29280 @item -mconst16
29281 @itemx -mno-const16
29282 @opindex mconst16
29283 @opindex mno-const16
29284 Enable or disable use of @code{CONST16} instructions for loading
29285 constant values. The @code{CONST16} instruction is currently not a
29286 standard option from Tensilica. When enabled, @code{CONST16}
29287 instructions are always used in place of the standard @code{L32R}
29288 instructions. The use of @code{CONST16} is enabled by default only if
29289 the @code{L32R} instruction is not available.
29290
29291 @item -mfused-madd
29292 @itemx -mno-fused-madd
29293 @opindex mfused-madd
29294 @opindex mno-fused-madd
29295 Enable or disable use of fused multiply/add and multiply/subtract
29296 instructions in the floating-point option. This has no effect if the
29297 floating-point option is not also enabled. Disabling fused multiply/add
29298 and multiply/subtract instructions forces the compiler to use separate
29299 instructions for the multiply and add/subtract operations. This may be
29300 desirable in some cases where strict IEEE 754-compliant results are
29301 required: the fused multiply add/subtract instructions do not round the
29302 intermediate result, thereby producing results with @emph{more} bits of
29303 precision than specified by the IEEE standard. Disabling fused multiply
29304 add/subtract instructions also ensures that the program output is not
29305 sensitive to the compiler's ability to combine multiply and add/subtract
29306 operations.
29307
29308 @item -mserialize-volatile
29309 @itemx -mno-serialize-volatile
29310 @opindex mserialize-volatile
29311 @opindex mno-serialize-volatile
29312 When this option is enabled, GCC inserts @code{MEMW} instructions before
29313 @code{volatile} memory references to guarantee sequential consistency.
29314 The default is @option{-mserialize-volatile}. Use
29315 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29316
29317 @item -mforce-no-pic
29318 @opindex mforce-no-pic
29319 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29320 position-independent code (PIC), this option disables PIC for compiling
29321 kernel code.
29322
29323 @item -mtext-section-literals
29324 @itemx -mno-text-section-literals
29325 @opindex mtext-section-literals
29326 @opindex mno-text-section-literals
29327 These options control the treatment of literal pools. The default is
29328 @option{-mno-text-section-literals}, which places literals in a separate
29329 section in the output file. This allows the literal pool to be placed
29330 in a data RAM/ROM, and it also allows the linker to combine literal
29331 pools from separate object files to remove redundant literals and
29332 improve code size. With @option{-mtext-section-literals}, the literals
29333 are interspersed in the text section in order to keep them as close as
29334 possible to their references. This may be necessary for large assembly
29335 files. Literals for each function are placed right before that function.
29336
29337 @item -mauto-litpools
29338 @itemx -mno-auto-litpools
29339 @opindex mauto-litpools
29340 @opindex mno-auto-litpools
29341 These options control the treatment of literal pools. The default is
29342 @option{-mno-auto-litpools}, which places literals in a separate
29343 section in the output file unless @option{-mtext-section-literals} is
29344 used. With @option{-mauto-litpools} the literals are interspersed in
29345 the text section by the assembler. Compiler does not produce explicit
29346 @code{.literal} directives and loads literals into registers with
29347 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29348 do relaxation and place literals as necessary. This option allows
29349 assembler to create several literal pools per function and assemble
29350 very big functions, which may not be possible with
29351 @option{-mtext-section-literals}.
29352
29353 @item -mtarget-align
29354 @itemx -mno-target-align
29355 @opindex mtarget-align
29356 @opindex mno-target-align
29357 When this option is enabled, GCC instructs the assembler to
29358 automatically align instructions to reduce branch penalties at the
29359 expense of some code density. The assembler attempts to widen density
29360 instructions to align branch targets and the instructions following call
29361 instructions. If there are not enough preceding safe density
29362 instructions to align a target, no widening is performed. The
29363 default is @option{-mtarget-align}. These options do not affect the
29364 treatment of auto-aligned instructions like @code{LOOP}, which the
29365 assembler always aligns, either by widening density instructions or
29366 by inserting NOP instructions.
29367
29368 @item -mlongcalls
29369 @itemx -mno-longcalls
29370 @opindex mlongcalls
29371 @opindex mno-longcalls
29372 When this option is enabled, GCC instructs the assembler to translate
29373 direct calls to indirect calls unless it can determine that the target
29374 of a direct call is in the range allowed by the call instruction. This
29375 translation typically occurs for calls to functions in other source
29376 files. Specifically, the assembler translates a direct @code{CALL}
29377 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29378 The default is @option{-mno-longcalls}. This option should be used in
29379 programs where the call target can potentially be out of range. This
29380 option is implemented in the assembler, not the compiler, so the
29381 assembly code generated by GCC still shows direct call
29382 instructions---look at the disassembled object code to see the actual
29383 instructions. Note that the assembler uses an indirect call for
29384 every cross-file call, not just those that really are out of range.
29385 @end table
29386
29387 @node zSeries Options
29388 @subsection zSeries Options
29389 @cindex zSeries options
29390
29391 These are listed under @xref{S/390 and zSeries Options}.
29392
29393
29394 @c man end
29395
29396 @node Spec Files
29397 @section Specifying Subprocesses and the Switches to Pass to Them
29398 @cindex Spec Files
29399
29400 @command{gcc} is a driver program. It performs its job by invoking a
29401 sequence of other programs to do the work of compiling, assembling and
29402 linking. GCC interprets its command-line parameters and uses these to
29403 deduce which programs it should invoke, and which command-line options
29404 it ought to place on their command lines. This behavior is controlled
29405 by @dfn{spec strings}. In most cases there is one spec string for each
29406 program that GCC can invoke, but a few programs have multiple spec
29407 strings to control their behavior. The spec strings built into GCC can
29408 be overridden by using the @option{-specs=} command-line switch to specify
29409 a spec file.
29410
29411 @dfn{Spec files} are plain-text files that are used to construct spec
29412 strings. They consist of a sequence of directives separated by blank
29413 lines. The type of directive is determined by the first non-whitespace
29414 character on the line, which can be one of the following:
29415
29416 @table @code
29417 @item %@var{command}
29418 Issues a @var{command} to the spec file processor. The commands that can
29419 appear here are:
29420
29421 @table @code
29422 @item %include <@var{file}>
29423 @cindex @code{%include}
29424 Search for @var{file} and insert its text at the current point in the
29425 specs file.
29426
29427 @item %include_noerr <@var{file}>
29428 @cindex @code{%include_noerr}
29429 Just like @samp{%include}, but do not generate an error message if the include
29430 file cannot be found.
29431
29432 @item %rename @var{old_name} @var{new_name}
29433 @cindex @code{%rename}
29434 Rename the spec string @var{old_name} to @var{new_name}.
29435
29436 @end table
29437
29438 @item *[@var{spec_name}]:
29439 This tells the compiler to create, override or delete the named spec
29440 string. All lines after this directive up to the next directive or
29441 blank line are considered to be the text for the spec string. If this
29442 results in an empty string then the spec is deleted. (Or, if the
29443 spec did not exist, then nothing happens.) Otherwise, if the spec
29444 does not currently exist a new spec is created. If the spec does
29445 exist then its contents are overridden by the text of this
29446 directive, unless the first character of that text is the @samp{+}
29447 character, in which case the text is appended to the spec.
29448
29449 @item [@var{suffix}]:
29450 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29451 and up to the next directive or blank line are considered to make up the
29452 spec string for the indicated suffix. When the compiler encounters an
29453 input file with the named suffix, it processes the spec string in
29454 order to work out how to compile that file. For example:
29455
29456 @smallexample
29457 .ZZ:
29458 z-compile -input %i
29459 @end smallexample
29460
29461 This says that any input file whose name ends in @samp{.ZZ} should be
29462 passed to the program @samp{z-compile}, which should be invoked with the
29463 command-line switch @option{-input} and with the result of performing the
29464 @samp{%i} substitution. (See below.)
29465
29466 As an alternative to providing a spec string, the text following a
29467 suffix directive can be one of the following:
29468
29469 @table @code
29470 @item @@@var{language}
29471 This says that the suffix is an alias for a known @var{language}. This is
29472 similar to using the @option{-x} command-line switch to GCC to specify a
29473 language explicitly. For example:
29474
29475 @smallexample
29476 .ZZ:
29477 @@c++
29478 @end smallexample
29479
29480 Says that .ZZ files are, in fact, C++ source files.
29481
29482 @item #@var{name}
29483 This causes an error messages saying:
29484
29485 @smallexample
29486 @var{name} compiler not installed on this system.
29487 @end smallexample
29488 @end table
29489
29490 GCC already has an extensive list of suffixes built into it.
29491 This directive adds an entry to the end of the list of suffixes, but
29492 since the list is searched from the end backwards, it is effectively
29493 possible to override earlier entries using this technique.
29494
29495 @end table
29496
29497 GCC has the following spec strings built into it. Spec files can
29498 override these strings or create their own. Note that individual
29499 targets can also add their own spec strings to this list.
29500
29501 @smallexample
29502 asm Options to pass to the assembler
29503 asm_final Options to pass to the assembler post-processor
29504 cpp Options to pass to the C preprocessor
29505 cc1 Options to pass to the C compiler
29506 cc1plus Options to pass to the C++ compiler
29507 endfile Object files to include at the end of the link
29508 link Options to pass to the linker
29509 lib Libraries to include on the command line to the linker
29510 libgcc Decides which GCC support library to pass to the linker
29511 linker Sets the name of the linker
29512 predefines Defines to be passed to the C preprocessor
29513 signed_char Defines to pass to CPP to say whether @code{char} is signed
29514 by default
29515 startfile Object files to include at the start of the link
29516 @end smallexample
29517
29518 Here is a small example of a spec file:
29519
29520 @smallexample
29521 %rename lib old_lib
29522
29523 *lib:
29524 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29525 @end smallexample
29526
29527 This example renames the spec called @samp{lib} to @samp{old_lib} and
29528 then overrides the previous definition of @samp{lib} with a new one.
29529 The new definition adds in some extra command-line options before
29530 including the text of the old definition.
29531
29532 @dfn{Spec strings} are a list of command-line options to be passed to their
29533 corresponding program. In addition, the spec strings can contain
29534 @samp{%}-prefixed sequences to substitute variable text or to
29535 conditionally insert text into the command line. Using these constructs
29536 it is possible to generate quite complex command lines.
29537
29538 Here is a table of all defined @samp{%}-sequences for spec
29539 strings. Note that spaces are not generated automatically around the
29540 results of expanding these sequences. Therefore you can concatenate them
29541 together or combine them with constant text in a single argument.
29542
29543 @table @code
29544 @item %%
29545 Substitute one @samp{%} into the program name or argument.
29546
29547 @item %i
29548 Substitute the name of the input file being processed.
29549
29550 @item %b
29551 Substitute the basename of the input file being processed.
29552 This is the substring up to (and not including) the last period
29553 and not including the directory.
29554
29555 @item %B
29556 This is the same as @samp{%b}, but include the file suffix (text after
29557 the last period).
29558
29559 @item %d
29560 Marks the argument containing or following the @samp{%d} as a
29561 temporary file name, so that that file is deleted if GCC exits
29562 successfully. Unlike @samp{%g}, this contributes no text to the
29563 argument.
29564
29565 @item %g@var{suffix}
29566 Substitute a file name that has suffix @var{suffix} and is chosen
29567 once per compilation, and mark the argument in the same way as
29568 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29569 name is now chosen in a way that is hard to predict even when previously
29570 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29571 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29572 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29573 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29574 was simply substituted with a file name chosen once per compilation,
29575 without regard to any appended suffix (which was therefore treated
29576 just like ordinary text), making such attacks more likely to succeed.
29577
29578 @item %u@var{suffix}
29579 Like @samp{%g}, but generates a new temporary file name
29580 each time it appears instead of once per compilation.
29581
29582 @item %U@var{suffix}
29583 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29584 new one if there is no such last file name. In the absence of any
29585 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29586 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29587 involves the generation of two distinct file names, one
29588 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29589 simply substituted with a file name chosen for the previous @samp{%u},
29590 without regard to any appended suffix.
29591
29592 @item %j@var{suffix}
29593 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29594 writable, and if @option{-save-temps} is not used;
29595 otherwise, substitute the name
29596 of a temporary file, just like @samp{%u}. This temporary file is not
29597 meant for communication between processes, but rather as a junk
29598 disposal mechanism.
29599
29600 @item %|@var{suffix}
29601 @itemx %m@var{suffix}
29602 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29603 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29604 all. These are the two most common ways to instruct a program that it
29605 should read from standard input or write to standard output. If you
29606 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29607 construct: see for example @file{gcc/fortran/lang-specs.h}.
29608
29609 @item %.@var{SUFFIX}
29610 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29611 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29612 terminated by the next space or %.
29613
29614 @item %w
29615 Marks the argument containing or following the @samp{%w} as the
29616 designated output file of this compilation. This puts the argument
29617 into the sequence of arguments that @samp{%o} substitutes.
29618
29619 @item %o
29620 Substitutes the names of all the output files, with spaces
29621 automatically placed around them. You should write spaces
29622 around the @samp{%o} as well or the results are undefined.
29623 @samp{%o} is for use in the specs for running the linker.
29624 Input files whose names have no recognized suffix are not compiled
29625 at all, but they are included among the output files, so they are
29626 linked.
29627
29628 @item %O
29629 Substitutes the suffix for object files. Note that this is
29630 handled specially when it immediately follows @samp{%g, %u, or %U},
29631 because of the need for those to form complete file names. The
29632 handling is such that @samp{%O} is treated exactly as if it had already
29633 been substituted, except that @samp{%g, %u, and %U} do not currently
29634 support additional @var{suffix} characters following @samp{%O} as they do
29635 following, for example, @samp{.o}.
29636
29637 @item %p
29638 Substitutes the standard macro predefinitions for the
29639 current target machine. Use this when running @command{cpp}.
29640
29641 @item %P
29642 Like @samp{%p}, but puts @samp{__} before and after the name of each
29643 predefined macro, except for macros that start with @samp{__} or with
29644 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29645 C@.
29646
29647 @item %I
29648 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29649 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29650 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29651 and @option{-imultilib} as necessary.
29652
29653 @item %s
29654 Current argument is the name of a library or startup file of some sort.
29655 Search for that file in a standard list of directories and substitute
29656 the full name found. The current working directory is included in the
29657 list of directories scanned.
29658
29659 @item %T
29660 Current argument is the name of a linker script. Search for that file
29661 in the current list of directories to scan for libraries. If the file
29662 is located insert a @option{--script} option into the command line
29663 followed by the full path name found. If the file is not found then
29664 generate an error message. Note: the current working directory is not
29665 searched.
29666
29667 @item %e@var{str}
29668 Print @var{str} as an error message. @var{str} is terminated by a newline.
29669 Use this when inconsistent options are detected.
29670
29671 @item %(@var{name})
29672 Substitute the contents of spec string @var{name} at this point.
29673
29674 @item %x@{@var{option}@}
29675 Accumulate an option for @samp{%X}.
29676
29677 @item %X
29678 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29679 spec string.
29680
29681 @item %Y
29682 Output the accumulated assembler options specified by @option{-Wa}.
29683
29684 @item %Z
29685 Output the accumulated preprocessor options specified by @option{-Wp}.
29686
29687 @item %a
29688 Process the @code{asm} spec. This is used to compute the
29689 switches to be passed to the assembler.
29690
29691 @item %A
29692 Process the @code{asm_final} spec. This is a spec string for
29693 passing switches to an assembler post-processor, if such a program is
29694 needed.
29695
29696 @item %l
29697 Process the @code{link} spec. This is the spec for computing the
29698 command line passed to the linker. Typically it makes use of the
29699 @samp{%L %G %S %D and %E} sequences.
29700
29701 @item %D
29702 Dump out a @option{-L} option for each directory that GCC believes might
29703 contain startup files. If the target supports multilibs then the
29704 current multilib directory is prepended to each of these paths.
29705
29706 @item %L
29707 Process the @code{lib} spec. This is a spec string for deciding which
29708 libraries are included on the command line to the linker.
29709
29710 @item %G
29711 Process the @code{libgcc} spec. This is a spec string for deciding
29712 which GCC support library is included on the command line to the linker.
29713
29714 @item %S
29715 Process the @code{startfile} spec. This is a spec for deciding which
29716 object files are the first ones passed to the linker. Typically
29717 this might be a file named @file{crt0.o}.
29718
29719 @item %E
29720 Process the @code{endfile} spec. This is a spec string that specifies
29721 the last object files that are passed to the linker.
29722
29723 @item %C
29724 Process the @code{cpp} spec. This is used to construct the arguments
29725 to be passed to the C preprocessor.
29726
29727 @item %1
29728 Process the @code{cc1} spec. This is used to construct the options to be
29729 passed to the actual C compiler (@command{cc1}).
29730
29731 @item %2
29732 Process the @code{cc1plus} spec. This is used to construct the options to be
29733 passed to the actual C++ compiler (@command{cc1plus}).
29734
29735 @item %*
29736 Substitute the variable part of a matched option. See below.
29737 Note that each comma in the substituted string is replaced by
29738 a single space.
29739
29740 @item %<S
29741 Remove all occurrences of @code{-S} from the command line. Note---this
29742 command is position dependent. @samp{%} commands in the spec string
29743 before this one see @code{-S}, @samp{%} commands in the spec string
29744 after this one do not.
29745
29746 @item %:@var{function}(@var{args})
29747 Call the named function @var{function}, passing it @var{args}.
29748 @var{args} is first processed as a nested spec string, then split
29749 into an argument vector in the usual fashion. The function returns
29750 a string which is processed as if it had appeared literally as part
29751 of the current spec.
29752
29753 The following built-in spec functions are provided:
29754
29755 @table @code
29756 @item @code{getenv}
29757 The @code{getenv} spec function takes two arguments: an environment
29758 variable name and a string. If the environment variable is not
29759 defined, a fatal error is issued. Otherwise, the return value is the
29760 value of the environment variable concatenated with the string. For
29761 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29762
29763 @smallexample
29764 %:getenv(TOPDIR /include)
29765 @end smallexample
29766
29767 expands to @file{/path/to/top/include}.
29768
29769 @item @code{if-exists}
29770 The @code{if-exists} spec function takes one argument, an absolute
29771 pathname to a file. If the file exists, @code{if-exists} returns the
29772 pathname. Here is a small example of its usage:
29773
29774 @smallexample
29775 *startfile:
29776 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29777 @end smallexample
29778
29779 @item @code{if-exists-else}
29780 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29781 spec function, except that it takes two arguments. The first argument is
29782 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29783 returns the pathname. If it does not exist, it returns the second argument.
29784 This way, @code{if-exists-else} can be used to select one file or another,
29785 based on the existence of the first. Here is a small example of its usage:
29786
29787 @smallexample
29788 *startfile:
29789 crt0%O%s %:if-exists(crti%O%s) \
29790 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29791 @end smallexample
29792
29793 @item @code{replace-outfile}
29794 The @code{replace-outfile} spec function takes two arguments. It looks for the
29795 first argument in the outfiles array and replaces it with the second argument. Here
29796 is a small example of its usage:
29797
29798 @smallexample
29799 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29800 @end smallexample
29801
29802 @item @code{remove-outfile}
29803 The @code{remove-outfile} spec function takes one argument. It looks for the
29804 first argument in the outfiles array and removes it. Here is a small example
29805 its usage:
29806
29807 @smallexample
29808 %:remove-outfile(-lm)
29809 @end smallexample
29810
29811 @item @code{pass-through-libs}
29812 The @code{pass-through-libs} spec function takes any number of arguments. It
29813 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29814 assumes are the names of linker input library archive files) and returns a
29815 result containing all the found arguments each prepended by
29816 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29817 intended to be passed to the LTO linker plugin.
29818
29819 @smallexample
29820 %:pass-through-libs(%G %L %G)
29821 @end smallexample
29822
29823 @item @code{print-asm-header}
29824 The @code{print-asm-header} function takes no arguments and simply
29825 prints a banner like:
29826
29827 @smallexample
29828 Assembler options
29829 =================
29830
29831 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29832 @end smallexample
29833
29834 It is used to separate compiler options from assembler options
29835 in the @option{--target-help} output.
29836 @end table
29837
29838 @item %@{S@}
29839 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29840 If that switch is not specified, this substitutes nothing. Note that
29841 the leading dash is omitted when specifying this option, and it is
29842 automatically inserted if the substitution is performed. Thus the spec
29843 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29844 and outputs the command-line option @option{-foo}.
29845
29846 @item %W@{S@}
29847 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29848 deleted on failure.
29849
29850 @item %@{S*@}
29851 Substitutes all the switches specified to GCC whose names start
29852 with @code{-S}, but which also take an argument. This is used for
29853 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29854 GCC considers @option{-o foo} as being
29855 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29856 text, including the space. Thus two arguments are generated.
29857
29858 @item %@{S*&T*@}
29859 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29860 (the order of @code{S} and @code{T} in the spec is not significant).
29861 There can be any number of ampersand-separated variables; for each the
29862 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29863
29864 @item %@{S:X@}
29865 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29866
29867 @item %@{!S:X@}
29868 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29869
29870 @item %@{S*:X@}
29871 Substitutes @code{X} if one or more switches whose names start with
29872 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29873 once, no matter how many such switches appeared. However, if @code{%*}
29874 appears somewhere in @code{X}, then @code{X} is substituted once
29875 for each matching switch, with the @code{%*} replaced by the part of
29876 that switch matching the @code{*}.
29877
29878 If @code{%*} appears as the last part of a spec sequence then a space
29879 is added after the end of the last substitution. If there is more
29880 text in the sequence, however, then a space is not generated. This
29881 allows the @code{%*} substitution to be used as part of a larger
29882 string. For example, a spec string like this:
29883
29884 @smallexample
29885 %@{mcu=*:--script=%*/memory.ld@}
29886 @end smallexample
29887
29888 @noindent
29889 when matching an option like @option{-mcu=newchip} produces:
29890
29891 @smallexample
29892 --script=newchip/memory.ld
29893 @end smallexample
29894
29895 @item %@{.S:X@}
29896 Substitutes @code{X}, if processing a file with suffix @code{S}.
29897
29898 @item %@{!.S:X@}
29899 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29900
29901 @item %@{,S:X@}
29902 Substitutes @code{X}, if processing a file for language @code{S}.
29903
29904 @item %@{!,S:X@}
29905 Substitutes @code{X}, if not processing a file for language @code{S}.
29906
29907 @item %@{S|P:X@}
29908 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29909 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29910 @code{*} sequences as well, although they have a stronger binding than
29911 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29912 alternatives must be starred, and only the first matching alternative
29913 is substituted.
29914
29915 For example, a spec string like this:
29916
29917 @smallexample
29918 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29919 @end smallexample
29920
29921 @noindent
29922 outputs the following command-line options from the following input
29923 command-line options:
29924
29925 @smallexample
29926 fred.c -foo -baz
29927 jim.d -bar -boggle
29928 -d fred.c -foo -baz -boggle
29929 -d jim.d -bar -baz -boggle
29930 @end smallexample
29931
29932 @item %@{S:X; T:Y; :D@}
29933
29934 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29935 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29936 be as many clauses as you need. This may be combined with @code{.},
29937 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29938
29939
29940 @end table
29941
29942 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29943 or similar construct can use a backslash to ignore the special meaning
29944 of the character following it, thus allowing literal matching of a
29945 character that is otherwise specially treated. For example,
29946 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29947 @option{-std=iso9899:1999} option is given.
29948
29949 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29950 construct may contain other nested @samp{%} constructs or spaces, or
29951 even newlines. They are processed as usual, as described above.
29952 Trailing white space in @code{X} is ignored. White space may also
29953 appear anywhere on the left side of the colon in these constructs,
29954 except between @code{.} or @code{*} and the corresponding word.
29955
29956 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29957 handled specifically in these constructs. If another value of
29958 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29959 @option{-W} switch is found later in the command line, the earlier
29960 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29961 just one letter, which passes all matching options.
29962
29963 The character @samp{|} at the beginning of the predicate text is used to
29964 indicate that a command should be piped to the following command, but
29965 only if @option{-pipe} is specified.
29966
29967 It is built into GCC which switches take arguments and which do not.
29968 (You might think it would be useful to generalize this to allow each
29969 compiler's spec to say which switches take arguments. But this cannot
29970 be done in a consistent fashion. GCC cannot even decide which input
29971 files have been specified without knowing which switches take arguments,
29972 and it must know which input files to compile in order to tell which
29973 compilers to run).
29974
29975 GCC also knows implicitly that arguments starting in @option{-l} are to be
29976 treated as compiler output files, and passed to the linker in their
29977 proper position among the other output files.
29978
29979 @node Environment Variables
29980 @section Environment Variables Affecting GCC
29981 @cindex environment variables
29982
29983 @c man begin ENVIRONMENT
29984 This section describes several environment variables that affect how GCC
29985 operates. Some of them work by specifying directories or prefixes to use
29986 when searching for various kinds of files. Some are used to specify other
29987 aspects of the compilation environment.
29988
29989 Note that you can also specify places to search using options such as
29990 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29991 take precedence over places specified using environment variables, which
29992 in turn take precedence over those specified by the configuration of GCC@.
29993 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29994 GNU Compiler Collection (GCC) Internals}.
29995
29996 @table @env
29997 @item LANG
29998 @itemx LC_CTYPE
29999 @c @itemx LC_COLLATE
30000 @itemx LC_MESSAGES
30001 @c @itemx LC_MONETARY
30002 @c @itemx LC_NUMERIC
30003 @c @itemx LC_TIME
30004 @itemx LC_ALL
30005 @findex LANG
30006 @findex LC_CTYPE
30007 @c @findex LC_COLLATE
30008 @findex LC_MESSAGES
30009 @c @findex LC_MONETARY
30010 @c @findex LC_NUMERIC
30011 @c @findex LC_TIME
30012 @findex LC_ALL
30013 @cindex locale
30014 These environment variables control the way that GCC uses
30015 localization information which allows GCC to work with different
30016 national conventions. GCC inspects the locale categories
30017 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
30018 so. These locale categories can be set to any value supported by your
30019 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
30020 Kingdom encoded in UTF-8.
30021
30022 The @env{LC_CTYPE} environment variable specifies character
30023 classification. GCC uses it to determine the character boundaries in
30024 a string; this is needed for some multibyte encodings that contain quote
30025 and escape characters that are otherwise interpreted as a string
30026 end or escape.
30027
30028 The @env{LC_MESSAGES} environment variable specifies the language to
30029 use in diagnostic messages.
30030
30031 If the @env{LC_ALL} environment variable is set, it overrides the value
30032 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30033 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30034 environment variable. If none of these variables are set, GCC
30035 defaults to traditional C English behavior.
30036
30037 @item TMPDIR
30038 @findex TMPDIR
30039 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30040 files. GCC uses temporary files to hold the output of one stage of
30041 compilation which is to be used as input to the next stage: for example,
30042 the output of the preprocessor, which is the input to the compiler
30043 proper.
30044
30045 @item GCC_COMPARE_DEBUG
30046 @findex GCC_COMPARE_DEBUG
30047 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30048 @option{-fcompare-debug} to the compiler driver. See the documentation
30049 of this option for more details.
30050
30051 @item GCC_EXEC_PREFIX
30052 @findex GCC_EXEC_PREFIX
30053 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30054 names of the subprograms executed by the compiler. No slash is added
30055 when this prefix is combined with the name of a subprogram, but you can
30056 specify a prefix that ends with a slash if you wish.
30057
30058 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30059 an appropriate prefix to use based on the pathname it is invoked with.
30060
30061 If GCC cannot find the subprogram using the specified prefix, it
30062 tries looking in the usual places for the subprogram.
30063
30064 The default value of @env{GCC_EXEC_PREFIX} is
30065 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30066 the installed compiler. In many cases @var{prefix} is the value
30067 of @code{prefix} when you ran the @file{configure} script.
30068
30069 Other prefixes specified with @option{-B} take precedence over this prefix.
30070
30071 This prefix is also used for finding files such as @file{crt0.o} that are
30072 used for linking.
30073
30074 In addition, the prefix is used in an unusual way in finding the
30075 directories to search for header files. For each of the standard
30076 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30077 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30078 replacing that beginning with the specified prefix to produce an
30079 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
30080 @file{foo/bar} just before it searches the standard directory
30081 @file{/usr/local/lib/bar}.
30082 If a standard directory begins with the configured
30083 @var{prefix} then the value of @var{prefix} is replaced by
30084 @env{GCC_EXEC_PREFIX} when looking for header files.
30085
30086 @item COMPILER_PATH
30087 @findex COMPILER_PATH
30088 The value of @env{COMPILER_PATH} is a colon-separated list of
30089 directories, much like @env{PATH}. GCC tries the directories thus
30090 specified when searching for subprograms, if it cannot find the
30091 subprograms using @env{GCC_EXEC_PREFIX}.
30092
30093 @item LIBRARY_PATH
30094 @findex LIBRARY_PATH
30095 The value of @env{LIBRARY_PATH} is a colon-separated list of
30096 directories, much like @env{PATH}. When configured as a native compiler,
30097 GCC tries the directories thus specified when searching for special
30098 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30099 using GCC also uses these directories when searching for ordinary
30100 libraries for the @option{-l} option (but directories specified with
30101 @option{-L} come first).
30102
30103 @item LANG
30104 @findex LANG
30105 @cindex locale definition
30106 This variable is used to pass locale information to the compiler. One way in
30107 which this information is used is to determine the character set to be used
30108 when character literals, string literals and comments are parsed in C and C++.
30109 When the compiler is configured to allow multibyte characters,
30110 the following values for @env{LANG} are recognized:
30111
30112 @table @samp
30113 @item C-JIS
30114 Recognize JIS characters.
30115 @item C-SJIS
30116 Recognize SJIS characters.
30117 @item C-EUCJP
30118 Recognize EUCJP characters.
30119 @end table
30120
30121 If @env{LANG} is not defined, or if it has some other value, then the
30122 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30123 recognize and translate multibyte characters.
30124 @end table
30125
30126 @noindent
30127 Some additional environment variables affect the behavior of the
30128 preprocessor.
30129
30130 @include cppenv.texi
30131
30132 @c man end
30133
30134 @node Precompiled Headers
30135 @section Using Precompiled Headers
30136 @cindex precompiled headers
30137 @cindex speed of compilation
30138
30139 Often large projects have many header files that are included in every
30140 source file. The time the compiler takes to process these header files
30141 over and over again can account for nearly all of the time required to
30142 build the project. To make builds faster, GCC allows you to
30143 @dfn{precompile} a header file.
30144
30145 To create a precompiled header file, simply compile it as you would any
30146 other file, if necessary using the @option{-x} option to make the driver
30147 treat it as a C or C++ header file. You may want to use a
30148 tool like @command{make} to keep the precompiled header up-to-date when
30149 the headers it contains change.
30150
30151 A precompiled header file is searched for when @code{#include} is
30152 seen in the compilation. As it searches for the included file
30153 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30154 compiler looks for a precompiled header in each directory just before it
30155 looks for the include file in that directory. The name searched for is
30156 the name specified in the @code{#include} with @samp{.gch} appended. If
30157 the precompiled header file cannot be used, it is ignored.
30158
30159 For instance, if you have @code{#include "all.h"}, and you have
30160 @file{all.h.gch} in the same directory as @file{all.h}, then the
30161 precompiled header file is used if possible, and the original
30162 header is used otherwise.
30163
30164 Alternatively, you might decide to put the precompiled header file in a
30165 directory and use @option{-I} to ensure that directory is searched
30166 before (or instead of) the directory containing the original header.
30167 Then, if you want to check that the precompiled header file is always
30168 used, you can put a file of the same name as the original header in this
30169 directory containing an @code{#error} command.
30170
30171 This also works with @option{-include}. So yet another way to use
30172 precompiled headers, good for projects not designed with precompiled
30173 header files in mind, is to simply take most of the header files used by
30174 a project, include them from another header file, precompile that header
30175 file, and @option{-include} the precompiled header. If the header files
30176 have guards against multiple inclusion, they are skipped because
30177 they've already been included (in the precompiled header).
30178
30179 If you need to precompile the same header file for different
30180 languages, targets, or compiler options, you can instead make a
30181 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30182 header in the directory, perhaps using @option{-o}. It doesn't matter
30183 what you call the files in the directory; every precompiled header in
30184 the directory is considered. The first precompiled header
30185 encountered in the directory that is valid for this compilation is
30186 used; they're searched in no particular order.
30187
30188 There are many other possibilities, limited only by your imagination,
30189 good sense, and the constraints of your build system.
30190
30191 A precompiled header file can be used only when these conditions apply:
30192
30193 @itemize
30194 @item
30195 Only one precompiled header can be used in a particular compilation.
30196
30197 @item
30198 A precompiled header cannot be used once the first C token is seen. You
30199 can have preprocessor directives before a precompiled header; you cannot
30200 include a precompiled header from inside another header.
30201
30202 @item
30203 The precompiled header file must be produced for the same language as
30204 the current compilation. You cannot use a C precompiled header for a C++
30205 compilation.
30206
30207 @item
30208 The precompiled header file must have been produced by the same compiler
30209 binary as the current compilation is using.
30210
30211 @item
30212 Any macros defined before the precompiled header is included must
30213 either be defined in the same way as when the precompiled header was
30214 generated, or must not affect the precompiled header, which usually
30215 means that they don't appear in the precompiled header at all.
30216
30217 The @option{-D} option is one way to define a macro before a
30218 precompiled header is included; using a @code{#define} can also do it.
30219 There are also some options that define macros implicitly, like
30220 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30221 defined this way.
30222
30223 @item If debugging information is output when using the precompiled
30224 header, using @option{-g} or similar, the same kind of debugging information
30225 must have been output when building the precompiled header. However,
30226 a precompiled header built using @option{-g} can be used in a compilation
30227 when no debugging information is being output.
30228
30229 @item The same @option{-m} options must generally be used when building
30230 and using the precompiled header. @xref{Submodel Options},
30231 for any cases where this rule is relaxed.
30232
30233 @item Each of the following options must be the same when building and using
30234 the precompiled header:
30235
30236 @gccoptlist{-fexceptions}
30237
30238 @item
30239 Some other command-line options starting with @option{-f},
30240 @option{-p}, or @option{-O} must be defined in the same way as when
30241 the precompiled header was generated. At present, it's not clear
30242 which options are safe to change and which are not; the safest choice
30243 is to use exactly the same options when generating and using the
30244 precompiled header. The following are known to be safe:
30245
30246 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30247 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30248 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30249 -pedantic-errors}
30250
30251 @end itemize
30252
30253 For all of these except the last, the compiler automatically
30254 ignores the precompiled header if the conditions aren't met. If you
30255 find an option combination that doesn't work and doesn't cause the
30256 precompiled header to be ignored, please consider filing a bug report,
30257 see @ref{Bugs}.
30258
30259 If you do use differing options when generating and using the
30260 precompiled header, the actual behavior is a mixture of the
30261 behavior for the options. For instance, if you use @option{-g} to
30262 generate the precompiled header but not when using it, you may or may
30263 not get debugging information for routines in the precompiled header.